mb/google/bluey: Add parallel charging infrastructure
Add support for parallel charging by configuring PMC8380F GPIO07 and GPIO09. These GPIOs are configured as outputs with inverted logic. A new Kconfig option MAINBOARD_SUPPORTS_PARALLEL_CHARGING is introduced to allow variants to opt-in to this configuration. BUG=b:468120472 TEST=Build Google/Quartz. Change-Id: I0126d987650c660e305f704708c09356908633e4 Signed-off-by: Kapil Porwal <kapilporwal@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/90514 Reviewed-by: Pranava Y N <pranavayn@google.com> Reviewed-by: Jayvik Desai <jayvik@google.com> Reviewed-by: Subrata Banik <subratabanik@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
cfb0d8a144
commit
de87ea0efa
4 changed files with 38 additions and 0 deletions
|
|
@ -94,6 +94,12 @@ config MAINBOARD_NO_USB_A_PORT
|
||||||
help
|
help
|
||||||
Enable this option if your mainboard is not equipped with USB-A port.
|
Enable this option if your mainboard is not equipped with USB-A port.
|
||||||
|
|
||||||
|
config MAINBOARD_SUPPORTS_PARALLEL_CHARGING
|
||||||
|
bool
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable this option if your mainboard supports parallel charging.
|
||||||
|
|
||||||
config MAINBOARD_HAS_GOOGLE_TPM
|
config MAINBOARD_HAS_GOOGLE_TPM
|
||||||
bool
|
bool
|
||||||
default n
|
default n
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@
|
||||||
|
|
||||||
void setup_chromeos_gpios(void);
|
void setup_chromeos_gpios(void);
|
||||||
bool is_off_mode(void);
|
bool is_off_mode(void);
|
||||||
|
void configure_parallel_charging(void);
|
||||||
void enable_slow_battery_charging(void);
|
void enable_slow_battery_charging(void);
|
||||||
void disable_slow_battery_charging(void);
|
void disable_slow_battery_charging(void);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,35 @@ enum charging_status {
|
||||||
CHRG_ENABLE,
|
CHRG_ENABLE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define PMC8380F_SLAVE_ID 0x05
|
||||||
|
#define GPIO07_MODE_CTL 0x8E40
|
||||||
|
#define GPIO07_DIG_OUT_SOURCE_CTL 0x8E44
|
||||||
|
#define GPIO07_EN_CTL 0x8E46
|
||||||
|
#define GPIO09_MODE_CTL 0x9040
|
||||||
|
#define GPIO09_DIG_OUT_SOURCE_CTL 0x9044
|
||||||
|
#define GPIO09_EN_CTL 0x9046
|
||||||
|
|
||||||
|
#define MODE_OUTPUT 0x01
|
||||||
|
#define OUTPUT_INVERT 0x80
|
||||||
|
#define PERPH_EN 0x80
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable PMC8380F GPIO07 & GPIO09 for parallel charging.
|
||||||
|
*/
|
||||||
|
void configure_parallel_charging(void)
|
||||||
|
{
|
||||||
|
if (!CONFIG(MAINBOARD_SUPPORTS_PARALLEL_CHARGING))
|
||||||
|
return;
|
||||||
|
|
||||||
|
printk(BIOS_INFO, "Configure parallel charging support\n");
|
||||||
|
spmi_write8(SPMI_ADDR(PMC8380F_SLAVE_ID, GPIO07_MODE_CTL), MODE_OUTPUT);
|
||||||
|
spmi_write8(SPMI_ADDR(PMC8380F_SLAVE_ID, GPIO07_DIG_OUT_SOURCE_CTL), OUTPUT_INVERT);
|
||||||
|
spmi_write8(SPMI_ADDR(PMC8380F_SLAVE_ID, GPIO07_EN_CTL), PERPH_EN);
|
||||||
|
spmi_write8(SPMI_ADDR(PMC8380F_SLAVE_ID, GPIO09_MODE_CTL), MODE_OUTPUT);
|
||||||
|
spmi_write8(SPMI_ADDR(PMC8380F_SLAVE_ID, GPIO09_DIG_OUT_SOURCE_CTL), OUTPUT_INVERT);
|
||||||
|
spmi_write8(SPMI_ADDR(PMC8380F_SLAVE_ID, GPIO09_EN_CTL), PERPH_EN);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable charging w/ 1A Icurrent supply at max.
|
* Enable charging w/ 1A Icurrent supply at max.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,8 @@ static void display_startup(void)
|
||||||
|
|
||||||
static void mainboard_init(struct device *dev)
|
static void mainboard_init(struct device *dev)
|
||||||
{
|
{
|
||||||
|
configure_parallel_charging();
|
||||||
|
|
||||||
/* Skip mainboard initialization if boot mode is "low-battery" or "off-mode charging"*/
|
/* Skip mainboard initialization if boot mode is "low-battery" or "off-mode charging"*/
|
||||||
if (is_low_power_boot())
|
if (is_low_power_boot())
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue