power: pm8921-charger: report DC online for some platforms.

Some hardware platforms can supply VPH_PWR without battery
or charger being present.

To avoid shutting down due to no connected power sources
from the perspective of software set a flag that forces
the DC supply to be online for this type of platform.

Signed-off-by: David Keitel <dkeitel@codeaurora.org>
(cherry picked from commit a3cf943ef8c91435e2cb94b8e8bcc482dc65cb27)

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>

Conflicts:

	drivers/power/pm8921-charger.c

Change-Id: I565edb1ab797384481ce5e37aee73ee0a8e80428
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
power: pm8921-charger: Fix bug in current limit lookup

In the usb_ma_table there exist two consecutive values
that have IUSB_FINE_RES bit set. Some functions
incorrectly assume that this does not happen.

Fix this by checking for consecutive values having
IUSB_FINE_IRES bit set.
(cherry picked from commit 67ebde08e12d246302d133b4510d59c8f96325d1)
CRs-Fixed: 404348
Signed-off-by: David Keitel <dkeitel@codeaurora.org>

Change-Id: I6b6ca96b92ec4b9765e4812352057a0ac8cff380
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
power: pm8921-charger: Control CHG_USB_SUSPEND enabling boost

Toggle the CHG_USB_SUSPEND bit when utilizing the VBUS boost.
This bit controls ensures that no current is being drawn from
a USB device and the charger runs off the battery.

This makes sure that when pm8921_disable_source_current is called
the correct setting is written to the suspend bit depending
on the disable flag.

(cherry picked from commit d8878596b9b19668fd1f1b226a333d955f2218c4)
CRs-Fixed: 393498
Signed-off-by: David Keitel <dkeitel@codeaurora.org>

Change-Id: Iae390fd10e59d6ba1fe85743c1015eea35b06f7a
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
power: pm8921-charger: fix EOC worker not starting

There are situations when we observe that charging is in progress
but the end of charge (EOC) worker is not running. This leads to
problems like
-never detecting end of charge
-not adjusting vddmax
-not preventing suspend while charging.

The reason is that the bootloader could have started charging already,
causing a fastchg interrupt to not happen. If the fastchg interrupt is
missed the driver will never start EOC worker.

Check the real time status of the fastchg interrupt and if it is fast
charging invoke the handler so that the eoc worker could be
started.

(cherry picked from commit 7f1d97fd69c3afe66577e731105207e5db544ab2)

CRs-Fixed: 393301
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>

Change-Id: I5c0ba3b8f0653c5f9d64f35346601763c059505a
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
auto_hotplug.c: ditch NVIDIA's load averaging usage on this driver - according to @thalamus its not cheaper than his original implementation.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: gpu: use original ringbuffer code to average cpu load - using cpu load to ramp GPU frequencies is not great, but it should work for now until I find a better way to account for GPU stress.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>
drivers: gpu: fix second condition thresholds for GPU ramps.

Signed-off-by: franciscofranco <franciscofranco.1990@gmail.com>