summaryrefslogtreecommitdiff
path: root/src/mainboard/google/hatch
diff options
context:
space:
mode:
authorGaggery Tsai <gaggery.tsai@intel.com>2020-03-25 11:34:25 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-04-20 06:47:16 +0000
commit52f18df1e361fe9a29a7b75ee514646e640afd50 (patch)
tree316802d442ea1dcd0fc56aaa02c811d7936888e8 /src/mainboard/google/hatch
parent04a8cfbbc047579b4051793384238228dc38301b (diff)
downloadcoreboot-52f18df1e361fe9a29a7b75ee514646e640afd50.tar.xz
google/chromeec: Revise parameters of EC USB PD API call
This patch adds voltage and curent parameters in google_chromeec_get_usb_pd_power_info and remove power parameter. Caller could use the voltage and current information to calculate charger power rating. The reason for this change is, some applications need the voltage information to calculate correct system power eg PsysPmax. BUG=b:151972149 TEST=emerge-puff coreboot; emerge-fizz coreboot Change-Id: I11efe6f45f2f929fcb2763d192268e677d7426cb Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/39849 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
Diffstat (limited to 'src/mainboard/google/hatch')
-rw-r--r--src/mainboard/google/hatch/variants/puff/mainboard.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mainboard/google/hatch/variants/puff/mainboard.c b/src/mainboard/google/hatch/variants/puff/mainboard.c
index e8098b96ac..3f74c968b1 100644
--- a/src/mainboard/google/hatch/variants/puff/mainboard.c
+++ b/src/mainboard/google/hatch/variants/puff/mainboard.c
@@ -90,8 +90,9 @@ static void mainboard_set_power_limits(config_t *conf)
{
enum usb_chg_type type;
u32 watts;
+ u16 volts_mv, current_ma;
u32 psyspl2 = PUFF_PSYSPL2; // default barrel jack value for U22
- int rv = google_chromeec_get_usb_pd_power_info(&type, &watts);
+ int rv = google_chromeec_get_usb_pd_power_info(&type, &current_ma, &volts_mv);
/* use SoC default value for PsysPL3 and PL4 unless we're on USB-PD*/
conf->tdp_psyspl3 = 0;
@@ -99,6 +100,7 @@ static void mainboard_set_power_limits(config_t *conf)
if (rv == 0 && type == USB_CHG_TYPE_PD) {
/* Detected USB-PD. Base on max value of adapter */
+ watts = ((u32)current_ma * volts_mv) / 1000000;
psyspl2 = watts;
conf->tdp_psyspl3 = SET_PSYSPL2(psyspl2);
/* set max possible time window */