Commit graph

954 commits

Author SHA1 Message Date
Neeraj Upadhyay
da23c02138 msm: Rename msmfalcon/apqfalcon to sdm660/sda660
Update the code name from msmfalcon/apqfalcon to sdm660/sda660.
As part of this, update the filename containing "falcon" and
files content containing "falcon".

Change-Id: Iec85862251b9e1b4dcc8bdce8b214ce87c0049bc
Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
2016-12-28 21:56:21 +05:30
Linux Build Service Account
9721c27659 Merge "leds: qpnp-wled: Update WLED config" 2016-12-23 03:55:11 -08:00
ansharma
20da6a6d27 leds: qpnp-wled: Update WLED config
Update WLED configuration to enable HVG_PULL_SWITCH bit to
temporarily pull up Hvgate with larger switch(for pm2falcon)
and enable DEBOUNCE_BYPASS_ILIM bit to remove debouncing for
Ilim. This guarantee stable operation of WLED.

CRs-Fixed: 1102641
Change-Id: I39a1266f4158e71238f374b6cba49e1a8c2b1a3b
Signed-off-by: ansharma <ansharma@codeaurora.org>
2016-12-22 10:28:35 +05:30
Subbaraman Narayanamurthy
cf1d50169a leds: qpnp-wled: Reconfigure SWIRE_AVDD default voltage selectively
In certain PMICs, when WLED is configured for AMOLED panels, AVDD
default voltage configured for SWIRE mode has to be reconfigured
every time WLED module is disabled and enabled. Otherwise, AVDD
voltage can stay at the previous voltage level configured through
SWIRE pulses. Add support for it.

CRs-Fixed: 1071936
Change-Id: I938ce65f42eebe31be27151281d7e8502ba29f6e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-12-09 13:03:02 -08:00
Subbaraman Narayanamurthy
126ffb778d leds: qpnp-wled: Handle OVP fault interrupt properly
Sometimes, OVP fault interrupt fires as soon as WLED module is
enabled. This does not really represent a harmful event. Hence
add support to enable OVP fault interrupt 10 mS after enabling
WLED module so that the soft start is completed. Keep the OVP
fault interrupt disabled when the module is disabled.

While at it, print the fault status from both OVP and short
circuit interrupt handlers which might be useful.

Change-Id: If3c264c6e3a2bf4b23069c0960b354f7967ecb4c
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-12-05 20:52:25 -08:00
Subbaraman Narayanamurthy
c95c3c8a08 leds: qpnp-wled: Fix the APIs to read/write WLED registers
Fix the order of parameters passed into read/write APIs of WLED
driver to make it more readable. Fix the masked_write API to
directly use regmap API so that it can be protected properly to
avoid racing with secure writes.

While at it, remove the comments for variables that were removed
a while ago.

Change-Id: Ib372d3272550973fd98992f28b3b9bf7e5eb7f0f
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-28 12:22:51 -08:00
Runmin Wang
1289f98375 msm: 8998: Replace cobalt with 8998
Update the code name from msmcobalt to msm8998. As a result, update
the filename containing "cobalt" and files content containing "cobalt".

CRs-Fixed: 1070840
Change-Id: I2c7b95e3e2a2fec7730724da9eeb86a39a77faf1
Signed-off-by: Runmin Wang <runminw@codeaurora.org>
Signed-off-by: Kyle Yan <kyan@codeaurora.org>
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
2016-11-22 13:07:05 -08:00
Linux Build Service Account
7ee7f710ec Merge "leds: qpnp-wled: Add support to configure auto PFM for pmicobalt" 2016-11-18 01:55:01 -08:00
Linux Build Service Account
d52c401860 Merge "leds: qpnp-wled: Add support to configure AUTO_GM settings" 2016-11-17 10:08:45 -08:00
Linux Build Service Account
3c8d77bac1 Merge "leds: qpnp-flash: Fix the mask in the flash prepare API" 2016-11-17 10:08:40 -08:00
Linux Build Service Account
37d58e6c59 Merge "leds: qpnp-flash-v2: change from dev_*() to pr_*() for logging" 2016-11-17 10:08:38 -08:00
Linux Build Service Account
a1716776fd Merge "leds: qpnp-flash-v2: Add support for configuring OTST thresholds" 2016-11-17 10:08:38 -08:00
Linux Build Service Account
f645e3ce31 Merge "leds: qpnp-flash-v2: Add support for thermal derate features" 2016-11-17 10:08:37 -08:00
Fenglin Wu
596b431a5f leds: qpnp-wled: Add support to configure auto PFM for pmicobalt
The WLED boost controller in pmicobalt supports auto PFM mode when
LCD mode is selected. Auto PFM mode is enabled by default except
on some specific hardware versions. Add a property to specify
AUTO_PFM_THRESHOLD for the boost controller so that it can enter
PFM mode when the adaptive headroom voltage falls below the
threshold.

CRs-Fixed: 1081738
Change-Id: I964b3452d0cdb3618b4ab446655ae75fa3a1049d
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2016-11-17 19:38:14 +08:00
Linux Build Service Account
4b1c2e228c Merge "leds: qpnp-wled: Add support to configure VREF_CONTROL for pmicobalt" 2016-11-17 02:22:35 -08:00
Anirudh Ghayal
b154d78e5d leds: qpnp-flash: Fix the mask in the flash prepare API
Use the correct LED_OPTIONS mask to enable all the supported
flash prepare APIs.

CRs-Fixed: 1090029
Change-Id: I66f6de42b106fa2027285e7393b6f9fc143d00d8
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2016-11-15 12:53:36 +05:30
Subbaraman Narayanamurthy
104ce58784 leds: qpnp-flash-v2: change from dev_*() to pr_*() for logging
Currently, dev_*() variants are used in the flashv2 LED driver
for logging. However, it spews the kernel log because of the
device name being longer. Logging with device name is also not
really needed. Move to using pr_*() variants. Add a pr_fmt() to
help that by adding a function name which will be more useful.

Change-Id: I42503ccd2b2dcc62c5c868132d202b9698c9d216
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-14 19:52:52 -08:00
Subbaraman Narayanamurthy
ef5d639067 leds: qpnp-flash-v2: Add support for configuring OTST thresholds
Add support for configuring the three thermal mitigation
thresholds from device tree.

CRs-Fixed: 1060212
Change-Id: Iafb7915e196a18b5f8076dda8fb06a4bd71a8e6e
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-14 19:52:52 -08:00
Subbaraman Narayanamurthy
5c312a4f74 leds: qpnp-flash-v2: Add support for thermal derate features
Add support to configure thermal debounce, hysteresis and
ramp down rates from device tree.

CRs-Fixed: 1060212
Change-Id: Iabe79bae5f9471c3c6128ed21efd04de00739daa
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-14 19:52:32 -08:00
Subbaraman Narayanamurthy
98ac2b9cfa leds: qpnp-flash-v2: add support to read pmic revid
There are some features which needs to be enabled based on the
PMIC. PMIC information such as subtype, revision can be obtained
from revid peripheral. Hence add support to read pmic revid.

Change-Id: Ie7a94f59e58b8f1b0816afda2496449694629205
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-14 18:44:28 -08:00
Subbaraman Narayanamurthy
561bfca197 leds: qpnp-flash-v2: Add support for programming led clamp currents
Allow the mitigation clamp current values for the leds to be
configured through the device tree.

CRs-Fixed: 1060212
Change-Id: I23bf67fba7cef2735db436899a9d5b3306e5a77f
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-11 11:59:15 -08:00
Subbaraman Narayanamurthy
05939b3db2 leds: qpnp-flash-v2: modify regulator control for switch devices
Currently multiple regulator devices can be specified for LED
switch device though a switch device may just require one supply.
Also, before the switch device is enabled, voltage request is
sent to set the maximum voltage. This is not needed with the
regulators like BoB being used as supply for the switch device.
Just enabling the regulator is enough during switch operation.
Modify the way the regulator is obtained and controlled for
switch operation.

Since BoB regulator is configured by the bootloader properly
for flash operation, remove them from the supply list of LED
switch devices on pmicobalt and pm2falcon.

While at it, fix the way device tree properties are read from
flash/torch, switch devices.

CRs-Fixed: 1083246
Change-Id: I8eb5f305f89bc18ad4b735bd89cbf259f0e1ea11
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-11 11:59:15 -08:00
Subbaraman Narayanamurthy
e03e61b954 leds: qpnp-flash-v2: Add sysfs support to query max_current
Add support to query max_current for each switch node through
sysfs. This will be useful to know the maximum current that
the flash switch device can draw at that time.

Change-Id: Ie83e71eafff5c49c81f56f92aa719662814997ed
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-11-11 11:57:56 -08:00
Fenglin Wu
c8f85b42fe leds: qpnp-wled: Add support to configure AUTO_GM settings
WLED in pmicobalt supports AUTO_GM configuration in CTRL_VLOOP_COMP_GM
register. Add two properties to enable auto-gm and set auto-gm threshold.
Meanwhile, move "qcom,loop-ea-gm" property outside of AMOLED constraint
because WLED in LCD mode also support it.

CRs-Fixed: 1081738
Change-Id: Iee99e9d1b999c84ece075d2f17e9cdf6aef9a2ac
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2016-11-11 14:31:38 +08:00
Fenglin Wu
e146a32840 leds: qpnp-wled: Add support to configure VREF_CONTROL for pmicobalt
WLED module in pmicobalt has different VREF_CONTROL settings with current
WLED module which is existing in pmi8994/pmi8952, including min voltage,
max voltage, step size and default voltage. Add support for it.

CRs-Fixed: 1081738
Change-Id: Ibaa555cec8cfd296125af3e6277df5331f5c438b
Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2016-11-11 14:19:05 +08:00
Linux Build Service Account
46f563dcc0 Merge "leds: qpnp-flash-v2: Fix strobe control settings" 2016-11-02 14:41:37 -07:00
ansharma
c04ad37d1b leds: qpnp-flash-v2: Fix strobe control settings
Currently strobe control is cleared even when HW strobe control is not
explicitly enabled. Fix it.

CRs-Fixed: 1077179
Change-Id: I5bc6a5a46311206818d70567e31fd84adc0128be
Signed-off-by: ansharma <ansharma@codeaurora.org>
2016-11-02 13:05:10 +05:30
Linux Build Service Account
569214bfff Merge "leds: qpnp-wled: add support for configuring ILIM in pmicobalt" 2016-10-31 13:04:03 -07:00
Linux Build Service Account
680825f666 Merge "leds: qpnp-wled: Update AMOLED_VOUT programming" 2016-10-31 13:04:03 -07:00
Linux Build Service Account
e223d02cbb Merge "leds: qpnp-flash-v2: fix safety timer configuration" 2016-10-27 15:49:12 -07:00
Subbaraman Narayanamurthy
016b80785f leds: qpnp-wled: add support for configuring ILIM in pmicobalt
Currently, current limit (ILIM) for WLED is configured only for
pmi8994. ILIM levels differs in pmicobalt. Also, the step size
assumed before cannot go well with the different levels.
Default ILIM value differs for LCD and AMOLED mode. Taking this
all into account, add a separate function to configure ILIM for
different PMIC subtypes.

Change-Id: Ibc69706ae1dc878de5cbdaf283f0d71aff8000a1
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-26 18:23:44 -07:00
Subbaraman Narayanamurthy
9b32ac8b25 leds: qpnp-wled: Update AMOLED_VOUT programming
For newer PMICs like pmicobalt, AMOLED_VOUT can be programmed via
independent registers. Also the option to configure AVDD voltage
through SWIRE and SPMI mode is present. Add support to program
the AVDD voltage and mode through these registers. AVDD TRIM
adjustment is needed only for pmi8952 and pmi8994. It is not
needed for pmicobalt. Support it.

CRs-Fixed: 1051250
Change-Id: Ia5cc4a6bbf6b6d0d86e13cec7da167f8a49b859d
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-26 18:21:40 -07:00
Subbaraman Narayanamurthy
ec38ffc845 leds: qpnp-flash-v2: fix safety timer configuration
Safety timer is using an offset of 1ms whereas it should use
10ms. Fix the calculation to configure safety timer properly.

CRs-Fixed: 1076402
Change-Id: If06c421c559277066cf9ffd86e71fe366ab7bf8d
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-25 20:32:59 -07:00
Subbaraman Narayanamurthy
71d0b50560 leds: qpnp-flash-v2: fix ITARGET configuration
Currently, the code calculated to write to ITARGET based on the
brightness level or current is off by 2 bits. Fix it.

CRs-Fixed: 1079311
Change-Id: I58421ba7f784f7467015a5943aecc2dd0022145a
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-25 20:32:58 -07:00
Subbaraman Narayanamurthy
7a1b6d0276 leds: qpnp-wled: Fix configuration of AVDD TRIM and OVP registers
Currently the AVDD TRIM registers are being configured incorrectly.
Update the sequence to configure the TRIM register and the OVP
register based on predetermined values mapped to the target voltage
specified in the device tree. Also add support for performing
masked writes to the wled registers.

CRs-Fixed: 1082047
Change-Id: I4c99b598d5f484368712eab239f7de70b727c2aa
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-25 10:17:06 -07:00
Subbaraman Narayanamurthy
73518d1b29 leds: qpnp-wled: add a secure write API
Currently, for doing a secure write to the peripheral register,
secure access is acquired at the call site before writing to the
register. Optimize this by adding an API to do secure writes.
When a secure write is attempted, it should be atomic and not
raced with normal write. Add a mutex lock to synchronize the
normal and secure writes. While at it, fix the data parameter
passed to qpnp_wled_write_reg() as that doesn't really need a
pointer.

CRs-Fixed: 1082047
Change-Id: I6a678d9133b06dda2de1c6cfe4bbafacc594f299
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-25 10:07:19 -07:00
Subbaraman Narayanamurthy
0fec3cabfe leds: qpnp-wled: add support to read pmic revid
There are some features which needs to be enabled based on the
PMIC. PMIC information such as subtype, revision can be obtained
from revid peripheral. Hence add support to read pmic revid.

CRs-Fixed: 1082047
Change-Id: If0646f5ae111f75ababc405cbd2f7bcea899360e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2016-10-25 10:06:42 -07:00
Devesh Jhunjhunwala
b420097ef0 leds: qpnp-flash-v2: Fix possible NULL pointer dereference
Update the flash_led_brightness_set callback to gracefully handle
invalid led_class device, and being called before driver probe is
complete.

CRs-Fixed: 1060705
Change-Id: Ice714c1fad1d202d05de6ecaf6d1d1ec17a04c15
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-10-12 20:03:40 -07:00
Devesh Jhunjhunwala
169fd1f5f5 leds: qpnp-flash-v2: Add support for preemptive charger mitigation
Add support to configure and trigger preemptive charger
mitigation in flash driver.

Change-Id: Iec92d2037fcc60446760182c9eda53918e6e094c
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-10-12 18:40:32 -07:00
Devesh Jhunjhunwala
889d937b11 leds: qpnp-flash-v2: Add support for configuring hardware mitigation
Add support to program the ILED_GRT_THRESHOLD register, which
controls the led current threshold beyond which HW automatically
triggers preemptive mitigation.

Change-Id: I3ea14c8c76c4496eeeb11caf63c3ee62f031b157
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-10-12 18:38:54 -07:00
ansharma
aba9ed2d3e leds: qpnp-flash-v2: Fix compilation issue for 32-bit kernel
Use div64_s64() instead of direct division required for 32-bit kernel
compilation.

CRs-Fixed: 1070141
Change-Id: I9f58a411c2a923c07fd27ab9dc5ac244e4b13a44
Signed-off-by: ansharma <ansharma@codeaurora.org>
2016-09-23 16:12:21 +05:30
Devesh Jhunjhunwala
ecea159153 leds: qpnp-flash-v2: Update flash_prepare API
Update the flash prepare API to handle the DISABLE_REGULATOR
option, and include support to return the max_current value
in a parameter instead of the return value.

CRs-Fixed: 1043718
Change-Id: Ief86531658cd0e72ceeae062d29133d5505eb5cf
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-08-16 07:54:03 -07:00
Devesh Jhunjhunwala
717ccf3d01 leds: qpnp-flash-v2: Add support for voltage headroom
Add support to use the flash led current values to calculate
the voltage headroom to use for the maximum current query
algorithm.

CRs-Fixed: 1043718
Change-Id: I823276f75247a67f4a3dd2d6d333c19196b26063
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-08-16 07:54:03 -07:00
Devesh Jhunjhunwala
49d96e8bc7 leds: qpnp-flash-v2: Add support for thermal current mitigation
Based on the thermal thresholds triggered, use the LUT to
limit the maximum available flash current.

CRs-Fixed: 1043718
Change-Id: I456d6491987183e07eba921edc826ff801fdeee3
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-08-16 07:54:02 -07:00
Devesh Jhunjhunwala
f816e044c2 leds: qpnp-flash-v2: Add support for LMH mitigation
Based on the LMH trigger thresholds read from device tree
and the battery properties read from fuel gauge, trigger LMH
pre-emptive current mitigation if required.

CRs-Fixed: 1043718
Change-Id: I54e7670a880f862b6619d22f843c8fa13fd0b303
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-08-16 07:53:58 -07:00
Devesh Jhunjhunwala
5ee78edab2 leds: qpnp-flash-v2: Implement max_current_query API
Update the max_current_query stub to calculate the maximum
available current for flash based on the battery properties
read from fuel gauge.

CRs-Fixed: 1043718
Change-Id: I88fd40c449852704361ae3ed3e8223e1e9b3fe74
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-08-16 07:51:41 -07:00
Devesh Jhunjhunwala
e92b084360 leds: qpnp-flash-v2: add support to query battery parameters
Register a notifier callback with the power_supply framework
to detect when the bms power_supply is available so that
it can be used to query the battery properties required from
the fuel gauge for the maximum current query algorithm.

CRs-Fixed: 1043718
Change-Id: Icd535025a2f888e188f89841f32ac5b822f9b20d
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-08-03 11:35:18 -07:00
Devesh Jhunjhunwala
88e140010a leds: qpnp-flash-v2: Add support for led_fault_irq
Add support to receive and process the led_fault_irq to
detect short_circuit and open_circuit faults. Also, add
support to read all led_status registers in the irq handler.

CRs-Fixed: 1024187
Change-Id: I6941660484ea8b27377c668d1e7d815d52e83d83
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-07-29 11:24:14 -07:00
Devesh Jhunjhunwala
ba678210c5 leds: qpnp-flash-v2: Add support for droop and fault detection
Add support for configuring the following features available
in flash LED:
	1. VPH droop detection
	2. Short circuit fault detection
	3. Open circuit fault detection

CRs-Fixed: 1024187
Change-Id: I982e51ba62f0a75d1dcd3ef30e5d1249c970ffde
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-07-29 11:22:30 -07:00
Devesh Jhunjhunwala
a0a1d3cd64 leds: qpnp-flash: Implement the flash_prepare API
Add the flash_prepare API to the leds-qpnp-flash driver to
maintain consistent usage of the API by the camera flash driver
across targets.

CRs-Fixed: 1043718
Change-Id: I21cc4b4556b2a4a1a918bfeb1d55ae164d4b5568
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
2016-07-29 11:22:06 -07:00