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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Enable/disable the wled module only if it changes
the state.
Change-Id: I754a7ac23cd5ec6fea1ea2e6d4dd2d3f7c44ed37
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>