summaryrefslogtreecommitdiff
path: root/src/ec
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/ec
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/ec')
-rw-r--r--src/ec/google/chromeec/ec.c8
-rw-r--r--src/ec/google/chromeec/ec.h5
2 files changed, 7 insertions, 6 deletions
diff --git a/src/ec/google/chromeec/ec.c b/src/ec/google/chromeec/ec.c
index 17e110c5c9..73baec63be 100644
--- a/src/ec/google/chromeec/ec.c
+++ b/src/ec/google/chromeec/ec.c
@@ -1120,9 +1120,9 @@ int google_chromeec_set_usb_charge_mode(uint8_t port_id, enum usb_charge_mode mo
return google_chromeec_command(&cmd);
}
-/* Get charger power info in Watts. Also returns type of charger */
+/* Get charger voltage and current. Also returns type of charger */
int google_chromeec_get_usb_pd_power_info(enum usb_chg_type *type,
- uint32_t *max_watts)
+ uint16_t *current_max, uint16_t *voltage_max)
{
struct ec_params_usb_pd_power_info params = {
.port = PD_POWER_CHARGING_PORT,
@@ -1147,8 +1147,8 @@ int google_chromeec_get_usb_pd_power_info(enum usb_chg_type *type,
/* values are given in milliAmps and milliVolts */
*type = resp.type;
m = resp.meas;
- *max_watts = (m.current_max * m.voltage_max) / 1000000;
-
+ *voltage_max = m.voltage_max;
+ *current_max = m.current_max;
return 0;
}
diff --git a/src/ec/google/chromeec/ec.h b/src/ec/google/chromeec/ec.h
index 13e3bd9b7f..64d7e52981 100644
--- a/src/ec/google/chromeec/ec.h
+++ b/src/ec/google/chromeec/ec.h
@@ -102,11 +102,12 @@ int google_chromeec_set_usb_pd_role(uint8_t port, enum usb_pd_control_role role)
* Retrieve the charger type and max wattage.
*
* @param type charger type
- * @param max_watts charger max wattage
+ * @param current_max charger max current
+ * @param voltage_max charger max voltage
* @return non-zero for error, otherwise 0.
*/
int google_chromeec_get_usb_pd_power_info(enum usb_chg_type *type,
- uint32_t *max_watts);
+ uint16_t *current_max, uint16_t *voltage_max);
/*
* Set max current and voltage of a dedicated charger.