Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power: supply: smb347-charger: Add missing pin control activation

Pin control needs to be activated by setting the enable bit, otherwise
hardware rejects all pin changes. Previously this stayed unnoticed on
Nexus 7 because pin control was enabled by default after rebooting from
downstream kernel, which uses driver that enables the bit and charger
registers are non-volatile until power supply (battery) is disconnected.
Configure the pin control enable bit. This fixes the potentially
never-enabled charging on devices that use pin control.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

Dmitry Osipenko and committed by
Sebastian Reichel
efe21754 17e7bc53

+10
+10
drivers/power/supply/smb347-charger.c
··· 55 55 #define CFG_PIN_EN_CTRL_ACTIVE_LOW 0x60 56 56 #define CFG_PIN_EN_APSD_IRQ BIT(1) 57 57 #define CFG_PIN_EN_CHARGER_ERROR BIT(2) 58 + #define CFG_PIN_EN_CTRL BIT(4) 58 59 #define CFG_THERM 0x07 59 60 #define CFG_THERM_SOFT_HOT_COMPENSATION_MASK 0x03 60 61 #define CFG_THERM_SOFT_HOT_COMPENSATION_SHIFT 0 ··· 726 725 smb->use_usb_otg ? CFG_OTHER_RID_ENABLED_AUTO_OTG : 0); 727 726 if (ret < 0) 728 727 goto fail; 728 + 729 + /* Activate pin control, making it writable. */ 730 + switch (smb->enable_control) { 731 + case SMB3XX_CHG_ENABLE_PIN_ACTIVE_LOW: 732 + case SMB3XX_CHG_ENABLE_PIN_ACTIVE_HIGH: 733 + ret = regmap_set_bits(smb->regmap, CFG_PIN, CFG_PIN_EN_CTRL); 734 + if (ret < 0) 735 + goto fail; 736 + } 729 737 730 738 /* 731 739 * Make the charging functionality controllable by a write to the