samsung-manta: smb347 charger state not updating
The SMB347 is a somewhat sophisticated charge controller. A datasheet seems to be only available under NDA.
In the samsung-manta port, the power supply doesn’t notice when a USB cable has been pulled or plugged. I did some investigations into why this is.
- Observation 1: interrupts are not (always) getting triggered.
- Observation 2: when the interrupt routine runs none of the IRQ bits in the
IRQSTAT_*
registers indicating an interrupt are set.
I spend a lot of time trying to figure out (2), to no avail. Afaict everything is configured correctly on the chip.
For (1) my working theory is that the IRQ line of the smb347 chip isn’t actually connected to the GPX0-4 gpio as specified in the device tree, but it’s rather some other signal telling the chip whether it’s charging or not.
We can still use this as an interrupt signal for the driver: When switching the trigger config from "low" to "rising & falling edges", the irq routine is (mostly smb347_update_ps_status
is not called (because of (2)).
In the AOSP variant, the chip’s status is externally updated based on other events.
I think a relatively easy (and hopefully good enough) fix would be to unconditionally call smb347_update_ps_status
in the irq handler (or at least have a module option for this). This would require a respective kernel patch. I haven’t done much development there, so I’m not sure how the chances are to upstream such a change to mainline.
Additional inputs and ideas are welcome