<p>Shelley Chen has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21772">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">google/fizz: Set PL2 value based on sku id/charge max power<br><br>Set PL2 based on either 90% of usb c charger's max power or sku id if<br>using a barrel jack.<br><br>BUG=b:37473486<br>BRANCH=None<br>TEST=output debug info for different skus and make sure<br>     PL2 set correctly.<br><br>Change-Id: I487fce4a5d0825a26488e71dee02400dbebbffb3<br>Signed-off-by: Shelley Chen <shchen@chromium.org><br>---<br>M src/mainboard/google/fizz/mainboard.c<br>1 file changed, 20 insertions(+), 12 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/21772/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/mainboard/google/fizz/mainboard.c b/src/mainboard/google/fizz/mainboard.c<br>index 76fb2b8..1ced07e 100644<br>--- a/src/mainboard/google/fizz/mainboard.c<br>+++ b/src/mainboard/google/fizz/mainboard.c<br>@@ -18,7 +18,9 @@<br> #include <chip.h><br> #include <device/device.h><br> #include <ec/ec.h><br>-#include <intelblocks/mp_init.h><br>+#include <ec/google/chromeec/ec.h><br>+#include <gpio.h><br>+#include <soc/gpio.h><br> #include <soc/pci_devs.h><br> #include <soc/nhlt.h><br> #include <vendorcode/google/chromeos/chromeos.h><br>@@ -29,23 +31,29 @@<br> /*<br>  * mainboard_get_pl2<br>  *<br>- * @return value Pl2 should be set to based on cpu id<br>+ * @return value Pl2 should be set to<br>  *<br>- * TODO: This is purely based on cpu id, which only works for the<br>- * current build because we have a different cpu id per sku.  However,<br>- * on the next build, we'll have distinct board ids per sku.  We'll<br>- * need to modify that at this point.<br>+ * Check if charger is USB C.  If so, set to 90% of the max value.<br>+ * Otherwise, set PL2 based on sku id.<br>  */<br> static u32 mainboard_get_pl2(void)<br> {<br>-  struct cpuid_result cpuidr;<br>+  u32 watts = 0.9 * google_chromeec_get_usb_pd_power_info();<br>+   int sku_id;<br> <br>-       cpuidr = cpuid(1);<br>-   if (cpuidr.eax == CPUID_KABYLAKE_Y0) {<br>-               /* i7 needs higher pl2 */<br>-            return 44;<br>+   if (watts == 0) {<br>+            /* using the barrel jack, get PL2 based on sku id */<br>+         watts = 29;<br>+          sku_id = gpio_get(GPP_C15) << 3 |<br>+                      gpio_get(GPP_C14) << 2 |<br>+                       gpio_get(GPP_C13) << 1 |<br>+                       gpio_get(GPP_C12);<br>+           if (sku_id == 0x4) {<br>+                 /* u42 i7 needs higher pl2.  Everything else is 29 */<br>+                        watts = 44;<br>+          }<br>     }<br>-    return 29;<br>+   return watts;<br> }<br> <br> static void mainboard_init(device_t dev)<br></pre><p>To view, visit <a href="https://review.coreboot.org/21772">change 21772</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/21772"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I487fce4a5d0825a26488e71dee02400dbebbffb3 </div>
<div style="display:none"> Gerrit-Change-Number: 21772 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Shelley Chen <shchen@google.com> </div>