Gaggery Tsai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39850 )
Change subject: [WIP]/mb/google/hatch/vr/puff: Add psys_pmax calculation ......................................................................
[WIP]/mb/google/hatch/vr/puff: Add psys_pmax calculation
This patch adds psys_pmax calculation. There are two types of power sources. One is barrel jack and the other is USB TYPE-C. The voltage level is fixed for a barrel jack while TYPE-C maybe varies which dependnets on power ratings. We need to get voltage infomration from EC and calculate correct psys_pmax value.
BUG=b:151972149 TEST=pending on test result
Signed-off-by: Gaggery Tsai gaggery.tsai@intel.com Change-Id: I8ea01f856411e05a533489280fc2b4a46a1440c5 --- M src/mainboard/google/hatch/variants/puff/mainboard.c 1 file changed, 22 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/50/39850/1
diff --git a/src/mainboard/google/hatch/variants/puff/mainboard.c b/src/mainboard/google/hatch/variants/puff/mainboard.c index f00f47f..518da42 100644 --- a/src/mainboard/google/hatch/variants/puff/mainboard.c +++ b/src/mainboard/google/hatch/variants/puff/mainboard.c @@ -97,6 +97,23 @@ * | n (U22) | 29 | .9n | .9n | x(43) | * +-------------+-----+---------+---------+-------+ */ + +/* + * Psys_pmax consideratins + * Given the hardware design in puff, the serial shunt resistor is 0.01ohm + * The full scale of hardware PSYS signal 0.8v maps to system current 9.58A + * instead of real system power. The equestion is shown below: + * PSYS = 0.8v = (0.01ohm x Iinput) x 50 (INA213, gain 50V/V) x 15k/(15k + 75k) + * Hence, Iinput (Amps) = 9.58A + * Since there is no voltage information from PSYS, different voltage input + * would map to different Psys_pmax settings: + * For Type-C 15V, the Psys_pmax sholud be 15v x 9.58A = 143.7W + * For Type-C 20V, the Psys_pmax should be 20v x 9.58A = 191.6W + * For a barral jack, the Psys_pmax should be 19v x 9.58A = 182W + */ +#define PSYS_IMAX_MINIAMPS 9580 +#define BJ_MINIVOLTS 19000 + static void mainboard_set_power_limits(config_t *conf) { enum usb_chg_type type; @@ -118,8 +135,12 @@ /* set minimum duty cycle */ conf->tdp_psyspl3_dutycycle = PUFF_MIN_DUTYCYCLE; conf->tdp_pl4 = SET_PSYSPL2(psyspl2); + } else { + /* Input type is barrel jack */ + mini_volts = BJ_MINIVOLTS; } - + + conf->psys_pmax = (u16)(((u32)PSYS_IMAX_MINIAMPS * mini_volts)/1000000); conf->tdp_pl2_override = PUFF_PL2; /* set psyspl2 to 90% of max adapter power */ conf->tdp_psyspl2 = SET_PSYSPL2(psyspl2);