iio: adc: tadc: fix leakage problem
There is a leakage path in the TADC block while the device is shutdown
or is in deep sleep mode. To fix this hw problem, the driver needs to
disable hw conversions and enable direct test mode while charger is
plugged out, kernel goes to suspend or device shuts down. The driver
needs to undo those changes when charger is plugged in, kernel resumes
or device powers up.
Moreover while disabling hw conversions it is advisable to wait until
the current conversion is complete.
To realize this
* create a tadc_disable_votable, where the three usecases viz. charger
presence, suspend/resume and shutdown will vote. Enabling it will
disable hw conversions and enable direct test mode and vice versa for
disabling case.
* update complete to complete all since the disable path may be waiting
for conversion to complete.
* create a power supply notifier hook to get the usb presence/absence
notifications.
* add suspend,resume and shutdown driver callbacks that vote for
enabling/disabling tadc.
* prevent more requests coming in when the tadc is disabled.
* skip printing an error reading a channel for requests coming after
tadc is disabled. Return -ENODATA error for these situations.
* since we are introducing a secure write well beyond 0x3652, update the
code to treat everything beyond 0x3652 as locked.
CRs-Fixed: 2021456
Change-Id: Ifa92764d11f0b717558f3b7169313f5bcb1f507e
Signed-off-by:
Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Loading
Please register or sign in to comment