Fix some null pointer dereference flaw and parameter not init issues.
change-Id: I0ed5f3f62c3794775bf97d353c4e50dd8ceb32da
Signed-off-by: Yao Jiang <yaojia@codeaurora.org>
Properly initialize variables at the time of declaration.
Change-Id: I6eab6b08cb9ec7bfa6523ab3ed66d086eab89544
Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org>
On VADC_HC peripheral the ADC code can extend beyond
0-0x4000 range if the input is below 0V or if the
offset and gain error needs to be calibrated out.
Clamp the values for cases where the code represents
the value below 0V.
Change-Id: I2ede3d86d812fbdf757395d92e08e70636e9965a
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Initialize ADC parameters for decimation rate and
LDO enable. Common ADC decimation settings is
used across the battery thermistor threshold
channels.
Change-Id: I99ce1e5940506a5e65debfe822460c210a276b00
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Add support to scale reverse thresholds on VADC_TM refresh
peripheral for voltage measurements such as vbatt, vph_pwr,
thermistor channels, PMIC die temperature.
VADC_TM refresh uses one interrupt for high and low threshold
notification. Update the sequence to check the respective
sensors status for high/low threshold crossing for the VADC_TM
refresh and notify the clients on a threshold crossing.
Change-Id: I070b537e14b505bc247f2f5e6a0e125f1d0fbb81
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Add option to select whether a fresh calibration
needs to be performed when performing the channel measurement.
If the property is not present the default value of
using calibration measurement collected from a timer
will be used. For most cases using a measurement collected
from a timer interval should suffice and the default value
can be used.
Change-Id: I632a9466f04d5d0712de436fc3e1251f7e2e7ad2
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
The BTM (Battery temperature module) peripheral driver
on the PMIC (Power management IC) supports threshold
monitoring and notifies clients when thresholds are crossed.
PMCOBALT supports refreshed BTM peripheral register interface
and the driver uses compatible property qpnp-adc-tm-hc to
distinguish using the refreshed peripheral. The external
client interface with the driver remains the same. Updates
include handling the interrupt when the thresholds are
crossed,programming the threholds and configuring
the hardware based on the refreshed design.
BTM peripheral needs the VADC_HC peripheral to compute the
gain/offset that are used to reverse compute the threhold
values to ADC code. Some of the reverse computation API's
such as calculating thermistor thresholds require the
gain and offset values before computing the ADC code to
be programmed. This requires modification to the existing
calibration API in the VADC_HC driver to calculate
the reference calibration points and store these values
for clients to use in the reverse computation
Change-Id: I989cfa4f40e7f1671f04dfa9d4c3fe2ccbbc44ab
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Incorrect voltage and temperature results are seen
during ADC reads from VADC_HC peripheral.
Fix setting the correct flag used to select the respective
peripherals scaling formula to return the correct voltage
and temperature readings for VADC_HC peripheral.
Change-Id: I6f4fe857996c8df996b6e4a0e4475a48740929fa
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
The TYPE for a PMIC chip is always 0x51. There is no need to define it
for each PMIC chip.
Also the SUBTYPE of a PMIC chip doesn't change with versions. Have a
single definition of the SUBTYPE per PMIC chip.
Also, the driver uses integer indexes to get to the pmic name, instead
use the SUBTYPE to index in the pmic names array.
Change-Id: Ie1c43f3db0d4a395307253aad347ad93624a1203
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
"This snapshot is taken as of msm-3.18 commit dbdb6776f
(Merge "msm: camera: Add dummy sub module in sensor pipeline")
Use regulator_set_load() to specify the load required
while issuing VADC requests on the VADC LDO and fixup
compilation for qpnp_vadc_read() from thermal sysfs.
Signed-off-by: Siddartha Mohanadoss <smohanad@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>
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>