[coreboot-gerrit] Change in coreboot[master]: google/fizz: Dynamically set PsysPl2 MSR if using type-C charger

Shelley Chen (Code Review) gerrit at coreboot.org
Tue Jan 9 03:28:32 CET 2018


Shelley Chen has uploaded this change for review. ( https://review.coreboot.org/23182


Change subject: google/fizz: Dynamically set PsysPl2 MSR if using type-C charger
......................................................................

google/fizz: Dynamically set PsysPl2 MSR if using type-C charger

If using type-C charger, then PsysPl2 may be lower than barrel jack
value of 90W, so need to override value to the max power of type-C
charger.

BUG=b:71594855
BRANCH=None
TEST=Make sure that PsysPL2 value set to 60W with zinger, but 90W
     when using proper barrel jack adapter on and i7.

Change-Id: If955b9af0e23f47719f001f1d73ec37113937cea
Signed-off-by: Shelley Chen <shchen at chromium.org>
---
M src/mainboard/google/fizz/mainboard.c
1 file changed, 24 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/82/23182/1

diff --git a/src/mainboard/google/fizz/mainboard.c b/src/mainboard/google/fizz/mainboard.c
index 98c0078..82c3153 100644
--- a/src/mainboard/google/fizz/mainboard.c
+++ b/src/mainboard/google/fizz/mainboard.c
@@ -31,6 +31,7 @@
 #define FIZZ_SKU_ID_I7_U42 0x4
 #define FIZZ_PL2_I7_U42    44
 #define FIZZ_PL2_OTHERS    29
+#define FIZZ_PSYSPL2_ALL   90
 /*
  * For type-C chargers, set PL2 to 90% of max power to account for
  * cable loss and FET Rdson loss in the path from the source.
@@ -122,6 +123,28 @@
 	return watts;
 }
 
+/*
+ * mainboard_get_psyspl2
+ *
+ * @return value PsysPl2 should be set to
+ *
+ * Check if charger is USB C.  If so, set to the max value.
+ * Otherwise, set PL2 based on sku id.
+ */
+static u32 mainboard_get_psyspl2(void)
+{
+	enum usb_chg_type type;
+	u32 watts;
+	/* If type C charger, set to max Watts of charger */
+	int rv = google_chromeec_get_usb_pd_power_info(&type, &watts);
+
+	/* If we can't get charger info or not PD charger, assume barrel jack */
+	if (rv != 0 || type != USB_CHG_TYPE_PD)
+		watts = FIZZ_PSYSPL2_ALL;
+
+	return watts;
+}
+
 static uint8_t board_oem_id(void)
 {
 	static int id = -1;
@@ -211,6 +234,7 @@
 	config_t *conf = root->chip_info;
 
 	conf->tdp_pl2_override = mainboard_get_pl2();
+	conf->tdp_psyspl2 = mainboard_get_psyspl2();
 
 	set_bj_adapter_limit();
 

-- 
To view, visit https://review.coreboot.org/23182
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: If955b9af0e23f47719f001f1d73ec37113937cea
Gerrit-Change-Number: 23182
Gerrit-PatchSet: 1
Gerrit-Owner: Shelley Chen <shchen at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180109/399c8f1a/attachment-0001.html>


More information about the coreboot-gerrit mailing list