OSDN Git Service

smb-lib: manage override in icl_callback
authorAbhijeet Dharmapurikar <adharmap@codeaurora.org>
Tue, 7 Feb 2017 02:39:19 +0000 (18:39 -0800)
committerAshay Jaiswal <ashayj@codeaurora.org>
Fri, 10 Feb 2017 04:27:37 +0000 (09:57 +0530)
commit07b6e5b98f730ea7f2285fbbc4a94a57ddf82e50
tree63111504c8a1bea65e01535a8b204014bffb1aeb
parent059118476764090b5fc6ee4bdfb5491f6571cb34
smb-lib: manage override in icl_callback

Currently we have only one path - the pd active setting path -  where
ICL_OVERRIDE gets set.

With the upcoming changes to manage connector temperature
mitigation and usbin-usbin parallel charger, the ICL_OVERRIDE is needed
to be set from these usecases.

So instead of creating a voter for ICL_OVERRIDE and putting the onus
on callsites to set it before calling their icl settings, it is best
to handle it in icl_callback.

Update the icl_callback to manage override and suspend in this way.

- Presence of voter signifies that the driver wants to enforce a
  value different than the hw default. Force an icl override.

- No voters signifies that the hw defaults are good, undo an override.

- For USB types that command a limit aka SDP and CDP, never override.

- never suspend if there are no clients.

Change-Id: I3ed01237b0bb2c028bec572d2905cabb03ce50a3
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
drivers/power/supply/qcom/qpnp-smb2.c
drivers/power/supply/qcom/smb-lib.c
drivers/power/supply/qcom/smb-lib.h