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@chromium.org> Reviewed-on: https://review.coreboot.org/23182 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
parent
69cd62c751
commit
750ec94314
|
@ -31,6 +31,7 @@
|
||||||
#define FIZZ_SKU_ID_I7_U42 0x4
|
#define FIZZ_SKU_ID_I7_U42 0x4
|
||||||
#define FIZZ_PL2_I7_U42 44
|
#define FIZZ_PL2_I7_U42 44
|
||||||
#define FIZZ_PL2_OTHERS 29
|
#define FIZZ_PL2_OTHERS 29
|
||||||
|
#define FIZZ_PSYSPL2_ALL 90
|
||||||
/*
|
/*
|
||||||
* For type-C chargers, set PL2 to 90% of max power to account for
|
* 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.
|
* cable loss and FET Rdson loss in the path from the source.
|
||||||
|
@ -96,30 +97,33 @@ static uint8_t board_sku_id(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mainboard_get_pl2
|
* mainboard_set_power_limits
|
||||||
*
|
*
|
||||||
* @return value Pl2 should be set to
|
* Set Pl2 and SysPl2 values based on detected charger.
|
||||||
*
|
|
||||||
* Check if charger is USB C. If so, set to 90% of the max value.
|
|
||||||
* Otherwise, set PL2 based on sku id.
|
|
||||||
*/
|
*/
|
||||||
static u32 mainboard_get_pl2(void)
|
static void mainboard_set_power_limits(u32 *pl2_val, u32 *psyspl2_val)
|
||||||
{
|
{
|
||||||
enum usb_chg_type type;
|
enum usb_chg_type type;
|
||||||
u32 watts;
|
u32 watts;
|
||||||
|
u32 pl2, psyspl2;
|
||||||
|
|
||||||
int rv = google_chromeec_get_usb_pd_power_info(&type, &watts);
|
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 we can't get charger info or not PD charger, assume barrel jack */
|
||||||
if (rv != 0 || type != USB_CHG_TYPE_PD) {
|
if (rv != 0 || type != USB_CHG_TYPE_PD) {
|
||||||
/* using the barrel jack, get PL2 based on sku id */
|
/* using the barrel jack, get PL2 based on sku id */
|
||||||
watts = FIZZ_PL2_OTHERS;
|
pl2 = FIZZ_PL2_OTHERS;
|
||||||
if (board_sku_id() == FIZZ_SKU_ID_I7_U42)
|
if (board_sku_id() == FIZZ_SKU_ID_I7_U42)
|
||||||
watts = FIZZ_PL2_I7_U42;
|
pl2 = FIZZ_PL2_I7_U42;
|
||||||
} else
|
/* PsysPl2 same for all SKUs */
|
||||||
watts = GET_TYPEC_PL2(watts);
|
psyspl2 = FIZZ_PSYSPL2_ALL;
|
||||||
|
} else {
|
||||||
|
pl2 = GET_TYPEC_PL2(watts);
|
||||||
|
psyspl2 = watts;
|
||||||
|
}
|
||||||
|
|
||||||
return watts;
|
*pl2_val = pl2;
|
||||||
|
*psyspl2_val = psyspl2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t board_oem_id(void)
|
static uint8_t board_oem_id(void)
|
||||||
|
@ -210,7 +214,7 @@ static void mainboard_enable(device_t dev)
|
||||||
device_t root = SA_DEV_ROOT;
|
device_t root = SA_DEV_ROOT;
|
||||||
config_t *conf = root->chip_info;
|
config_t *conf = root->chip_info;
|
||||||
|
|
||||||
conf->tdp_pl2_override = mainboard_get_pl2();
|
mainboard_set_power_limits(&conf->tdp_pl2_override, &conf->tdp_psyspl2);
|
||||||
|
|
||||||
set_bj_adapter_limit();
|
set_bj_adapter_limit();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue