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>
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>
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>
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>
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>
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>
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>
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>
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>
Add support to configure and trigger preemptive charger
mitigation in flash driver.
Change-Id: Iec92d2037fcc60446760182c9eda53918e6e094c
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Update the flash prepare API to accept a led_trigger device as an
argument. Also split the leds-qpnp-flash-v2 header file to keep the
flash_prepare API in a common header file for both legacy and v2
flash drivers.
CRs-Fixed: 1043718
Change-Id: Idb4ab086740b680e101d76d882bcfb618ac4b936
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Add support to register and handle the all-ramp-up-done
and all-ramp-down-done irqs for flash-led.
CRs-Fixed: 921325
Change-Id: I843a008dbe6900f9f16c202a05435dbaf7a37627
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Remove the leds_off label and move the switch node disable
sequence into a separate function. Also take this opportunity
to move the flash-led structs from header file to driver file.
CRs-Fixed: 1024187
Change-Id: I5d4eb58f5ed3ace03190f3c48b98f0d88e8b8965
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Since multiple devices may need to use the flash module,
each will need its own switch node to be able to
independently control the different leds. Add support for
this functionality.
CRs-Fixed: 1024187
Change-Id: Ibeebaff8456d8d338ac9bebb50e205e1196ce8a6
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Add support to control regulators required for
flash-led. The pmicobalt_bob regulator is one
such regulator required by the flash-led device.
CRs-Fixed: 1024187
Change-Id: I1515fba2fb04c0b4d21828af3cea6d322262ab14
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Flash LED is a high energy aggregator from system as it is capable
to provide current up to 3750mA for illumination. Therefore, it
should be used with caution especially when battery state of charge
is low. Therefore, add a function which can be used by clients like
camera to query the flash current limit before using flash LED. This
protects the system from a possible UVLO condition.
CRs-Fixed: 964855
Change-Id: I17fa4f28cc151e3a3ad89d284995a3fa770bec68
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Flash LED module supports various kinds of strobe support. Strobe
type can be hardware or software, active high or low, and level or
edge trigger. Add support for configuring strobe type through
device tree properties.
CRs-Fixed: 1024187
Change-Id: Ief6a610c82b7f645966c596f543a1d30f7a40dcc
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
The mask and enable values being used are incorrect for the
safety timer. Fix it. Also take this opportunity to update
all relevant macros to use the GENMASK(h,l)/BIT(x) macros.
CRs-Fixed: 1024187
Change-Id: Ibdd139c98aa289f1d6b8545b953e79a1187284e9
Signed-off-by: Devesh Jhunjhunwala <deveshj@codeaurora.org>
Add the qcom,current-ma property to specify the operational
current for the flash led. Also limit the minimum flash current
to 25mA since currents below this value cause unstable flash
operation.
CRs-Fixed: 1033071
Change-Id: Ia133b6c0cf0c21484f61631f04cba0d1112c9d48
Signed-off-by: Devesh Jhunjhunwala <deveshj@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>
Add store interface for max_brightness to allow users
to change the maximum brightness to be supported by
the hardware.
Change-Id: I8b65debdc52ded24227483c4db21aaec63e27927
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
There is a new Qualcomm Technology Inc. Plug-n-play(QPNP) PMIC chip,
which introduces brand new flash LED hardware. The new hardware
comes with up to 3 LEDs support, different register mapping layout,
and different torch enablement requirement. Therefore, a new driver
is introduced to cover this need.
Change-Id: Ic878f1a946955edff3a9228e7fe54b7a525e37b1
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
Signed-off-by: Mohan Pallaka <mpallaka@codeaurora.org>
LED switch node operations are invoked both from LED trigger framework
callback and LED work thread. As work thread and LED trigger framework
operations are asynchronous, a race condition occurs when back-to-back
operations happen. Therefore, moving LED switch node operations from
LED trigger framework callback to work thread to eliminate race condition.
Change-Id: Ia962f3aebda9162e3a35773ef3ee27a4434e6d0c
Signed-off-by: Chun Zhang <chunz@codeaurora.org>
The open fault status flag depends on fault status register. However,
the register value is reset when LED module is disabled. In this
case, use OR logic to make sure the value is always set even if
module gets disabled.
Change-Id: If89f8fca25abc79d9d200d59031b8654f812105d
Signed-off-by: Chun Zhang <chunz@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>
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.
CRs-fixed: 969344
Change-Id: I75fa040c6e6f0e6ee40ec3e931c654f2c27ffcaf
Signed-off-by: Shantanu Jain <shjain@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>
Fix some variable initializations which would otherwise cause
forbidden warnings.
Signed-off-by: Rohit Vaswani <rvaswani@codeaurora.org>
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
Replace all call sites which invoke the get/set_property apis on the
power_supply object with power_supply_get/set_property() api call.
Change-Id: Ibd4c5db6a50734f827878589df1f3e48a0062a06
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Change to using upstream spmi bus architecture. All the spmi devices,
marked by spmi-dev-container, become platform devices.
spmi-slave-container devices become spmi_devices each representing
a slave. The read/write functions use regmap api's instead of calls to
spmi_ext_register_read/write() implemented by the spmi bus. This
regmap is instantiated per slave.
The spmi bus helper functions like spmi_get_irq get changed to their
platform bus equivalents.
Change Kconfig files include
* Remove dependence on OF_SPMI, MSM_QPNP_INT
* There were few places where an earlier commit
dcc2aedc80746acee589e4b47d3e6adf5d3ec253
missed adding dependence on SPMI along with MSM_SPMI.
Fix them.
* Add depends on ARCH_MSM. ARCH_MSM is used for internal builds.
Change the nodes in DTSI files to confirm to the modified drivers.
Update their binding docs to drop spmi-dev-container and
spmi-slave-container;
Finally update defconfig to use upstream SPMI.
Change-Id: Ic85bff27c09c84b152cb38acbc3cadd05c0ec57a
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Pass the chip structure to masked write. This is in preparation
for the upcoming transition to being a platform device.
Change-Id: Ic98c9e80a526e4eadb4892505f6cd20d9e993040
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
This snapshot is taken as of msm-3.18 commit
9da4ddc (Merge "clk: msm: clock-gcc: Associate gfx rail
voting with gfx3d branch")
Change-Id: Idd2f467f1f1863a156d1757589dfe78158f0e43f
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Quite a lot of activity in SPI this cycle, almost all of it in drivers
with a few minor improvements and tweaks in the core.
- Updates to pxa2xx to support Intel Broxton and multiple chip selects.
- Support for big endian in the bcm63xx driver.
- Multiple slave support for the mt8173
- New driver for the auxiliary SPI controller in bcm2835 SoCs.
- Support for Layerscale SoCs in the Freescale DSPI driver.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJWOehzAAoJECTWi3JdVIfQTPYH+wYMDG8gAIw2s0AJ4DvVe4qZ
sOAm1UgUJZxssrEA6BNqbfM0dfRo+oQJKmRd0Dc5n7LEMsYHdI/5yKHk8PCS6ZzD
iQyQCzbd0thDAqwuPaMP62cyPDHwyJX22VGTsgVnj6AZqAQ+9+g4SPKhFnm1Mlm4
hmDi6fdSrsqo8k8gkpVN8RFOfVsjAV1dLtAauQRWDHrqMxXURSrKG76eqAqUa5bn
BLPXBoj5PA0DMLPO2j+ADZwWN723LrI2mSSlc+ThjEX/OIt2OhAoiOTV5RPqaafy
TIsCkh68q/gYAsL5HtvvmgZByl41FLYiO0Z+rXmWUyMMbnvhZTLws9S2BNpBLuk=
=DgXG
-----END PGP SIGNATURE-----
Merge tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi
Pull spi updates from Mark Brown:
"Quite a lot of activity in SPI this cycle, almost all of it in drivers
with a few minor improvements and tweaks in the core.
- Updates to pxa2xx to support Intel Broxton and multiple chip selects.
- Support for big endian in the bcm63xx driver.
- Multiple slave support for the mt8173
- New driver for the auxiliary SPI controller in bcm2835 SoCs.
- Support for Layerscale SoCs in the Freescale DSPI driver"
* tag 'spi-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi: (87 commits)
spi: pxa2xx: Rework self-initiated platform data creation for non-ACPI
spi: pxa2xx: Add support for Intel Broxton
spi: pxa2xx: Detect number of enabled Intel LPSS SPI chip select signals
spi: pxa2xx: Add output control for multiple Intel LPSS chip selects
spi: pxa2xx: Use LPSS prefix for defines that are Intel LPSS specific
spi: Add DSPI support for layerscape family
spi: ti-qspi: improve ->remove() callback
spi/spi-xilinx: Fix race condition on last word read
spi: Drop owner assignment from spi_drivers
spi: Add THIS_MODULE to spi_driver in SPI core
spi: Setup the master controller driver before setting the chipselect
spi: dw: replace magic constant by DW_SPI_DR
spi: mediatek: mt8173 spi multiple devices support
spi: mediatek: handle controller_data in mtk_spi_setup
spi: mediatek: remove mtk_spi_config
spi: mediatek: Update document devicetree bindings to support multiple devices
spi: fix kernel-doc warnings about missing return desc in spi.c
spi: fix kernel-doc warnings about missing return desc in spi.h
spi: pxa2xx: Align a few defines
spi: pxa2xx: Save other reg_cs_ctrl bits when configuring chip select
...