[Letux-kernel] LetuxOS: driver for bq24297 (Pyra charger)
H. Nikolaus Schaller
hns at goldelico.com
Thu Sep 27 18:32:24 CEST 2018
> Am 27.09.2018 um 16:52 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
>
> Hi,
> the driver was unreliable to detect usb unplug and plug and (re)start charging.
>
> So I did improve it in several areas:
>
> 1. detect status flag (REG9/CHRG_FAULT) that tells if the power adapter was
> unplugged even if the driver wasn't directly immediately VBUS
s/immediately/scanning/
> (previously we checked only once a second for VBUS and a quick power drop wasn't
> recognised by the driver code but made the charger chip change its state)
> 2. move all status flag detection into single place for interrupt handler/polling
> (this avoids races and inconsistent reports to /sys)
> 3. fix presentation of VBUS to /sys if it is detected to be too low and the charger
> goes into DPM (Dynamic Power Management i.e. self-limit current consumption) mode
> 4. fix coarse reporting of NTC temperature (don't expect too much: it has only 3
> levels -10°C, 22.5°C, 60°C and no real ADC)
> 5. significant code cleanup to get rid of all static variables
>
> I haven't committed the patches yet, but plan to do so for v4.19-rc6. Or maybe v4.18.11.
> Whatever will be processed first.
>
> Attached is the full source file if you want to give it a try.
> It should work with 4.14 to 4.18 as well (I am not aware of API dependencies).
There is a small bug which makes detection fail again on the latest boards until
you plug in and remove an OTG cable... Please:
s/GPIOD_OUT_HIGH/GPIOD_OUT_LOW/
in line 1138.
>
> BR,
> Nikolaus
>
> <bq2429x_charger.c>_______________________________________________
> Kernel mailing list
> Kernel at pyra-handheld.com
> http://pyra-handheld.com/cgi-bin/mailman/listinfo/kernel
More information about the Letux-kernel
mailing list