Commit Graph

786 Commits

Author SHA1 Message Date
LuK1337 4e71469c73 Merge tag 'LA.BR.1.3.6-03510-8976.0' into HEAD
Change-Id: Ie506850703bf9550ede802c13ba5f8c2ce723fa3
2017-04-18 12:11:50 +02:00
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
Jigarkumar Kishorkumar Zala 2727ccd6b7 leds: leds-qpnp-flash: add PON regulator support
Add PON regulator support to torch LED, in order to set the spare
register bits of PON peripheral to avoid torch blinking in suspend.
Flash LED enables PON regulator when torch LED is in use, in order
to set the spare bits, and disables regulator when torch LED is
disabled.

Change-Id: I01901bec013047963fc72ec1928f0aceaac00e86
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2016-03-30 00:50:31 +05:30
Shantanu Jain d9f7c94052 leds: qpnp-flash: check power supply variable in flash led driver
Check the power supply variable if it is NULL or not, in flash led
driver while enabling the flash led.
This change is added to avoid crash in flash led driver.

CRs-Fixed: 944997
Change-Id: Ide1a9151d2a7c9a6686268a53ec9e38a4b087808
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-03-09 01:57:51 -08:00
Shantanu Jain 00424d93a7 leds: qpnp-wled: enable OVP irq properly in WLED driver
Enable OVP irq properly in WLED driver only when WLED state
is changed to ON and ovp_irq support is enabled.
Plus, disable the ovp_irq before dis/enabling the WLED
module by writing to QPNP_WLED_INT_EN_CLR WLED register.

Change-Id: I75fa040c6e6f0e6ee40ec3e931c654f2c27ffcaf
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-02-09 10:28:41 +05:30
Himanshu Aggarwal 322bf4d337 leds: qpnp-wled: add support for configuring sc debounce cycles
Add support for configuring short circuit debounce cycles in
both LCD mode and AMOLED mode. Also, when configuring the
WLED SHORT_PROTECT register, the bits corresponding to DBNC_SHORT
bit fields are incorrectly written, so correct the corresponding
bitmask and the associated code logic to avoid this. Add an
explicit SPMI write to WLED1_CTRL_SOFTSTART_RAMP_DELAY register
as well for LCD mode.

Change-Id: Ibae8926262c52c8db3d04ab355651e5df44ec090
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
2016-02-09 10:27:47 +05:30
Abinaya P 3ca3772b84 leds: qpnp-wled: configure AVDD TRIM voltage for AMOLED panels
Certain AMOLED panels may require voltage value to be configured
which is not within the voltage values allowable in WLED_OVP register.
In such cases, we may need to add/subtract the voltage value to obtain
the desired voltage value. Add support using TRIM register for the same.

Change-Id: I608a646233024b6b254df23d379ec9c8be277304
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
2016-02-09 10:26:55 +05:30
Abinaya P ae1008a928 leds: leds-qpnp-wled: set overwrite bit for switching frequency
While configuring the switching frequency for WLED, we need to set
the overwrite bit as well so that the switching frequency change
will get reflected.

Change-Id: I3e7f67b76ac49c1d925a8e84ea1280160ee044bd
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
2016-02-02 22:39:08 -08:00
Shantanu Jain 1c76efb522 leds: qpnp-wled: Add sync register writes in WLED driver probe
Add consecutive sync register writes in WLED driver probe.
This is needed for properly reflecting the configuration values
written for the WLED strings.

Change-Id: I252d3ee69ef3b0b67a3b137230a0b2a67f3e90d1
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-01-24 09:23:07 -08:00
Mohan Pallaka 06c37f54a4 leds: qpnp-wled: add sync commands after updating fs current
Fullscale current would be applied only after running
sync commands.

Change-Id: Ie7208e88d52aa945a7af22086f49389582723b5f
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-01-21 20:32:53 -08:00
Alex Sarraf d04dc77ab8 leds: qpnp-wled: disable OVP fault interrupt before module enable
Disable OVP fault interrupt before module enable then reenable
no later than 10us, as suggested by the PMIC team.
OVP fault interrupt is thrown every time when WLED brightness is
changed, which caused WLED to flicker. So this change is added
to solve this issue.

Change-Id: I4fedc457f1653185f6815d6b84d4b9cc0879f2ca
Signed-off-by: Alex Sarraf <asarraf@codeaurora.org>
Signed-off-by: Shantanu Jain <shjain@codeaurora.org>
2016-01-21 00:56:33 -08:00
Himanshu Aggarwal 8ac9931457 leds: qpnp-wled: add support for enabling AMOLED panels
As per the hardware documentation, certain registers in
the control block need to be over-written for supporting
AMOLED panels. Add support of configuring these registers.

Change-Id: I2a68b4033e2680290479523acd51a4472ad21e3a
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
2015-10-27 15:42:50 +05:30
Mohan Pallaka 1fd9fce807 leds: qpnp-wled: maintain wled state
Enable/disable the wled module only if it changes
the state.

Change-Id: I754a7ac23cd5ec6fea1ea2e6d4dd2d3f7c44ed37
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
2015-10-27 15:37:20 +05:30
Alex Sarraf 8121196b46 Revert "leds: qpnp-wled: avoid false ovp on module enable"
This reverts
commit 8b4c26548352 ("leds: qpnp-wled: avoid false ovp")

Change-Id: Ib38e044ad5d839c2a0f578c94538c127facd522a
Signed-off-by: Alex Sarraf <asarraf@codeaurora.org>
2015-10-27 03:03:24 -07:00
Mohan Pallaka 86c35019db leds: qpnp-wled: enable VREF_UP in TEST4 register
False ovp (over voltage protection) can be triggered
for LCD panels when the brightness is low. Avoid this
by enabling VREF_UP in TEST4 register.

Change-Id: I5c503f2c806499fd565234757fdac87367951f60
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
2015-10-27 02:22:20 -07:00
Mohan Pallaka cef757d2d7 leds: qpnp-wled: avoid false ovp on module enable
False ovp (over voltage protection) can be triggered
when the module is enabled. Avoid this scenario by
disabling the ovp before enabling the module. Enable
ovp after the module is enabled.

Change-Id: Icaa390b61ae2b09e21b10b801b8e22b0e6da5c3d
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
2015-10-27 02:21:50 -07:00
Himanshu Aggarwal 2d0253c5c5 leds: qpnp-wled: fix issues raised by static analyzer
Fix the issues raised by static analyzer:
1. Replace 'memcpy' with a member-wise copy of the strings array.
2. Remove comparison of unsigned values against 0.

Change-Id: I54153240faa236eb68bcceb8e64edd23704a245c
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
2015-10-27 02:18:26 -07:00
Himanshu Aggarwal 7cd2d376e3 leds: wled: unlock secure register before writing the AMOLED type
The AMOLED type register is PMIC locked and needs secure access before
being written to. Unlock the register before writing it to.

Change-Id: Ifdc97c887724a2444a720fdc5a335ed007a0d87f
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
2015-10-20 00:24:40 -07:00
Jigarkumar Kishorkumar Zala ba46629542 leds: leds-qpnp-flash: amend strobe bit for hardware strobe
Hardware strobe bit is bit[2] per PMIC hardware specification. This
bit should be set when user writes to existing sysfs entry to enable
hardware strobe.

Change-Id: I3d7bda808997025c1716f459807011da83ee1eb7
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
2015-09-17 02:23:42 -07:00
Jigarkumar Kishorkumar Zala 2013dea4f7 leds: leds-qpnp-flash: add check for determining enable flashLED module
Add check to determine enabled module, when module disablement sequence
is called. This check is necessary in order to avoid module disablement
when any of the flash/torch LED is in use.

Change-Id: I5d041ea531a78ce60ef0a793489602e3317f981a
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-08-20 03:50:16 -07:00
Chun Zhang d385b1f7e4 leds: leds-qpnp-flash: modify code to support single/dual flash
Flash LEDs were hardcoded as 0,1 and Torch LEDs were hard coded
as 2,3 in LED array. This may lead to issues in targets where
only single flash/torch LED is present. Hence, modify the code
to make it applicable for any generic case (single/dual LED).

Change-Id: Ia8d6eb98fb84310b3234b8deccfe7f604d6aa09a
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
2015-08-18 21:33:49 -07:00
Chun Zhang fb7aaab4b5 leds: leds-qpnp-flash: provide runtime detection for torch LED
Torch LEDs were hard coded as 2, 3 in LED array and whenever torch is
in use, driver dereference LED node 2 and 3 to utilize it. However,
when there is only one flash LED, torch will be placed at index 1 in
LED array and driver cannot access torch at all. To address this issue
update switch node type when torch or flash is utilized to detect
whether the LED in use is torch or flash.

Change-Id: I55c7088388fc7a651ab5c16cc9821759f46c8cc7
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
2015-08-14 17:58:35 +05:30
Jigarkumar Kishorkumar Zala 52e942ab76 leds: leds-qpnp-flash: move duration property to flash LED node
Move duration property support to flash LED node. Moving this
property is to allow camera software get flash LED duration
information, to support flash bracketing for camera sensor.

Change-Id: Id76716a89601158157437ad95317f82d12ee26d8
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-08-03 17:20:31 -07:00
Jigarkumar Kishorkumar Zala cdeee6f1e5 leds: leds-qpnp-flash: add PMIC die temp current derate feature
Add sysfs entry for enabling and disabling PMIC die temperature
derate current feature. Improve functionality for exposing
max allowed current for flash LED, with PMIC die temperature
derate current.

Change-Id: I2b17c0ca1fa0d26e5d3efd23c9a318f1c9782df0
CRs-Fixed: 793990
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-08-03 17:20:23 -07:00
Chun Zhang 752699410a leds: leds-qpnp-flash: unlock secure register before access
PERPH_RESET should be set in order to prevent flash LED module reset
before flash LED get chance to ramp down. To access PERPH_RESET register
we need to write to secure register to unlock the access.

Change-Id: I159317743ad8e64f616175a157313afb50fdcf7c
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
2015-08-03 17:20:12 -07:00
Jigarkumar Kishorkumar Zala 9c5f7bd669 leds: leds-qpnp-flash: add support to reset/deset module
Add support to reset/deset bit for FOLLOW_OTST2_RB when MASK3
module is enabled.

Change-Id: If14115e4cd007b117b131e5f239254a7049644d1
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-08-03 17:19:33 -07:00
Jigarkumar Kishorkumar Zala 8f11b86b4a leds: leds-qpnp-flash: reset module after flash LED ramp down
Deset bit for FOLLOW_OTST2_RB when MASK3 module is enabled, in
order to prevent device reset before flash LED will get a chance
to ramp down.

Change-Id: I1c77529a1aefeaf68c762ae6755d75d8dceab08e
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-08-03 17:19:13 -07:00
Chun Zhang 601a703c38 leds: leds-qpnp-flash: add ordered workqueue in flash LED
When flash LEDs are enabled and disabled back-to-back several times,
issue may arise that work threads to perform enablement/disablement
are trigerred out-of-order. Therefore, introduce an ordered workqueue
to ensure proper execution order.

Change-Id: I729326b3413ea588df3861b1f09d2209176363f6
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
2015-07-22 02:25:49 -07:00
Jigarkumar Kishorkumar Zala 43f9af7e74 leds: leds-qpnp-wled: remove IBB/LAB initialization and operations
Remove IBB/LAB initialization and operations, as IBB/LAB for display
panel is set by PMIC

CRs Fixed: 857820
Change-Id: I3b345275fbe6e8d185d4d24ea8a30cccd36bf68b
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-07-17 01:43:11 -07:00
Alex Sarraf d1c4540c55 leds: qpnp-wled: set overwrite bit to allow change in ILIM
Set overwrite bit to allow change in the PMI8994 register
for ILIM.

CRs-fixed: 834130
Change-Id: Ia20eb85d6bd1a032e6d757e27836505d13ea206b
Signed-off-by: Alex Sarraf <asarraf@codeaurora.org>
2015-07-10 14:28:22 -07:00
Chun Zhang ea65f857cc leds: leds-qpnp-flash: fix torch 1 reference in driver
Torch1 control in LED enablement call path was broken due to a
wrong dereference. That leads to incorrect brightness value written
into register and cause malfunction.

Change-Id: Id51671f61e8b3988f95c423c48d1e720eab514a9
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
2015-07-06 10:08:24 -07:00
Jigarkumar Kishorkumar Zala 45b19f8615 leds: leds-qpnp-flash: change to dynamic LED trigger
Change to dynamic LED trigger, in order to update strobe
trigger register as per LED request events. This change
helps to trigger only requested LED and isolate
other LED.

Change-Id: I6f3bcefa02513ff653b1857760c3b32de02365a9
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-06-29 15:28:38 -07:00
Linux Build Service Account 5a0cd6d3e3 Merge "leds: leds-qpnp-flash: add debugfs entries to expose register status" 2015-06-20 04:08:09 -07:00
Jigarkumar Kishorkumar Zala 5894adafb3 leds: leds-qpnp-flash: add debugfs entries to expose register status
Add debugfs entries to expose latched and fault status for flash LED
to userspace

Change-Id: Ieafd5e9b76ed414eb72365408dd78e30740428ae
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-06-16 20:24:40 -07:00
Jigarkumar Kishorkumar Zala 41d4e520ea leds: leds-qpnp-flash: disable headroom sense when module is disabled
Disabling headroom sense after module disable, for reducing
leakage current.

CRs-Fixed: 829939
Change-Id: Id72243eb1ff422402b01f8faba6110d8dd0637dc
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-06-15 15:29:14 -07:00
Linux Build Service Account e679ea02c6 Merge "leds: wled: unlock the secure register before writing the AMOLED type" 2015-06-12 07:57:26 -07:00
Chun Zhang 3128b25249 led: leds-qpnp-flash: change flash LED enablement method
Current flash LED enablement method glows LEDs one after another.
When it comes with battery current limit, two consecutive battery
level query causes inaccurate reading and delay in enablement,
which is not tolerable to camera and PMIC. In order to overcome
this issue, a new node is introduced as a switch, to provide
capability to glow both LEDs together. This addresses these
issues.

CRs-Fixed: 793302
Change-Id: I7e1689cc521f145bcfa3519c6f21e93d907f3408
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-06-09 13:11:15 -07:00
Himanshu Aggarwal 224aef51d1 leds: wled: unlock the secure register before writing the AMOLED type
The AMOLED type register is PMIC locked and needs secure access before
being written to. Unlock the register before writing it to.

Change-Id: Iccaa9d7e087e7608c6c2c687334eb6a9289dd923
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
2015-06-08 14:46:49 +05:30
Abinaya P a60b3ca7a9 Revert "leds: leds-qpnp-wled: reset WLED enable register in wled probe"
This reverts commit 41a9be703d as it
turns off display before the splash screen appears.

Change-Id: I6edf565c74afc6b6793c579082b7c9df14ac60f2
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
2015-06-04 15:03:39 +05:30
Linux Build Service Account 54e4d1c5fe Merge "leds: leds-qpnp-flash: enable MASK module for flash LED" 2015-05-30 16:23:13 -07:00
Jigarkumar Kishorkumar Zala 26abf82675 leds: leds-qpnp-flash: enable MASK module for flash LED
Enable MASK3 module, to support a new connection for OTST2
for flash LED driver.

Change-Id: Ie00a69c5353f704b734f2f6d0c2fe190abd5102c
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-05-29 15:44:04 -07:00
Abinaya P 5c47d3e753 leds: leds-qpnp-wled: add delay between consecutive writes to WLED SYNC
For PMi8950 WLED, consecutive writes to SYNC register of WLED SINK block
don't take effect unless a delay is introduced between the two writes.
Add an optional DT property which indicates the duration of this delay
and corresponding driver changes for the same.

Change-Id: I04dea7772233e38ce47854e1a4cc55e633b0f2be
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
2015-05-27 21:05:24 +05:30
Abinaya P 41a9be703d leds: leds-qpnp-wled: reset WLED enable register in wled probe
Reset WLED enable register in probe so that WLED rail consumes the
same current before and after the suspend.

Change-Id: Ib0a96407d730a8e6349855a9559d5d7686326da6
Signed-off-by: Abinaya P <abinayap@codeaurora.org>
2015-05-26 21:59:39 +05:30
Jigarkumar Kishorkumar Zala bae5a65dab leds: leds-qpnp-flash: update thermal derate threshold value
Update thermal derate threshold as per updated hardware behaviour.

Change-Id: I95bcf4270ed264dddefaebb296bfb1e28ee676d2
Signed-off-by: Jigarkumar Kishorkumar Zala <j_zala@codeaurora.org>
2015-04-24 09:05:41 -07:00
Mao Li d176b2bfaf leds: leds-qpnp-flash: Release pinctrl resources on error
Set led->pinctrl handle as NULL in case of pinctrl failures
during driver probe routine.

Change-Id: I3e26723b1c4cd0ff71b88f2404e79a7cae43db2a
Signed-off-by: Mao Li <maol@codeaurora.org>
Signed-off-by: Himanshu Aggarwal <haggarwa@codeaurora.org>
2015-04-16 14:02:18 +08:00
Linux Build Service Account bd515b4f6d Merge "leds: leds-qpnp-flash: add GPIO control to flash LED driver" 2015-04-13 11:20:50 -07:00
Linux Build Service Account 0a84ee6568 Merge "leds: led-class: Retain the latest user brightness request" 2015-04-11 09:09:01 -07:00
Chun Zhang 4fa95535ae leds: leds-qpnp-flash: add GPIO control to flash LED driver
GPIOs are used to control MOSFET circuit to enable flash LED on
some targets. Therefore, LED should control the GPIO to make sure
of LED proper enablement.

Change-Id: Ieb5374549a22c1ab0e848dc60f018060d7e59b2a
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
2015-04-09 18:50:18 -07:00
Ram Chandrasekar 2c4425c2eb leds: led-class: Retain the latest user brightness request
Retain the latest user brightness request. This ensures
that when a max brightness limit is altered, the last
brightness request is taken into account, when restoring
the current brightness.

Change-Id: I6461e06f64abe336cabc27a3992d734f1fb745c6
Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
2015-04-02 10:44:57 -06:00
Mao Li 379ac98297 leds: aw2013_led: disable regulators when not needed
Turn off the LED regulators if brightness of all the LEDs that are
connected to the host is 0. This change is required to save the power
consumption.

Change-Id: I9bae343becb9a794a5ecc8ddf9c2edb3b5aecfce
Signed-off-by: Mao Li <maol@codeaurora.org>
2015-04-01 01:00:53 -04:00