cheza: Make sure switchcap is configured right

Configure switchcap every time we're about to change the signal,
just in case it forgot.
Feel free to revert this after b/77957956 is fixed.

BRANCH=none
BUG=b:77957956
TEST="i2cxfer r 0 0xd0 0x2" never shows 0x70, even after a bad brownout
(like "gpioset EN_PP5000_A 1" on an unreworked board)

Change-Id: I8994cd402ce96d8bf4e436dadfc0e572e7f77a85
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024501
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
This commit is contained in:
Alexandru M Stan
2018-04-23 11:39:06 -07:00
committed by chrome-bot
parent f7aec0ceb5
commit 05e33b28e7
3 changed files with 13 additions and 1 deletions

View File

@@ -32,6 +32,16 @@ const enum gpio_signal hibernate_wake_pins[] = {
};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
void board_set_switchcap(int enable)
{
/*
* Disable SwitchCap auto-boot and make EN pin level-trigger
* TODO(b/77957956): Remove it after hardware fix.
*/
i2c_write8(I2C_PORT_POWER, DA9313_I2C_ADDR, 0x02, 0x34);
gpio_set_level(GPIO_SWITCHCAP_ON_L, enable);
}
const struct adc_t adc_channels[] = {};
/* Power signal list. Must match order of enum power_signal. */

View File

@@ -68,6 +68,8 @@ enum adc_channel {
ADC_CH_COUNT
};
void board_set_switchcap(int asserted);
#endif /* !defined(__ASSEMBLER__) */
#endif /* __CROS_EC_BOARD_H */

View File

@@ -145,7 +145,7 @@ DECLARE_HOOK(HOOK_POWER_BUTTON_CHANGE, powerbtn_sdm845_changed,
static void set_system_power(int enable)
{
CPRINTS("set_system_power(%d)", enable);
gpio_set_level(GPIO_SWITCHCAP_ON_L, enable);
board_set_switchcap(enable);
gpio_set_level(GPIO_VBOB_EN, enable);
}