Commit Graph

35 Commits

Author SHA1 Message Date
Xiaozhe Shi f1d5547bf4 power: pm8921-bms: account for sleep time in ADC calibration
Currently, the system calibrates the CCADC and HKADC every 10 minutes of
kernel time. However, this does not count sleep time, which could make
calibration much more infrequent.

Fix this by saving the time of the last calibration for both ADCs and
immediately calibrate upon resume if the elapsed time is longer than the
calibration period.

Change-Id: I34f51c6202cbaa805c496360e8dbd391890decc6
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
2013-09-04 15:46:14 -07:00
Abhijeet Dharmapurikar 478adc6b23 mfd: pm8xxx: provide api to read restart reason
The BMS driver needs to know the restart reason of the pmic. Add
an api in the pm8xxx design to provide the restart reason.

Change-Id: I0bbad22c5fed8c32dd7de387194e94c8d4b9ad75
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 15:14:11 -07:00
Stephen Boyd 830e276e13 mfd: pm8921-core: Sync up to our copy
Pull in all our to this file up to quic/msm-3.4 merge from
quic/msm-3.0.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:48:53 -07:00
Jay Chokshi b459b161ec mfd: 8821: Add support for pm8821 core driver
Add support for the Qualcomm PM8821 PMIC chip. The core driver
will communicate with the PMIC chip via the MSM SSBI bus.

Initial support is provided for: IRQ, MPP, and Debug

Change-Id: Ic072e634c55925292196a3e710d2dc628cbf2780
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
2013-09-04 14:48:47 -07:00
Stephen Boyd ac594effcc power: pm8xxx-ccadc: Add pm8xxx ccadc subdevice
Until now only the BMS system was using the ccadc so there was
no need to create a separate ccadc driver.

However we can run in a configuration with BMS disabled
and clients won't be able to read battery current via ccadc.

Separate the ccadc from the bms, this change in is preparation
to add a ccadc api to read the battery current.

Change-Id: Ib96b146d91d01d196df9291eb23432cd430db4d0
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
[sboyd: Take only 8921-core parts]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:48:45 -07:00
Stephen Boyd 57802b5b28 power: pm8921-bms: use eoc interrupt for writing trim values
The bms driver calibrates the ccadc channel every few minutes
for offset and gain.

The offset value calibrated needs to be written to the bms hardware
which it uses to adjust all the ccadc readings.
The software has to only adjust for gain for ccadc based readings.

One is not supposed to program the trim offset values in while a
bms conversion in progress. Update the code to try only two times
instead of 10 to check if the conversion is finished, if not enable
the ccadc eoc interrupt and write the values then.

Change-Id: I1a1a16feb5ffb927f630850f0f2539ad75805fb1
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
[sboyd: droped bms driver change]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:48:45 -07:00
Jay Chokshi c2490e576a leds-pm8xxx: Pass LED flags from board file
Instead of hard coding the flag into led driver, pass it
from board file.
While at it, re-factor the code to separate led upstream
core data with board specific data.

Change-Id: I9726f8444d422fdbebdbd5d5e0c5beb6288aa5b1
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
[sboyd: only take pm8921 part]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:48:44 -07:00
David Collins 38d9e98e99 mfd: pm8921-core: Fix possible null pointer dereference in pm8921_remove
It is possible to dereference the pmic pointer even if it is null;
fix this.

Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:43 -07:00
Anirudh Ghayal 454ca4ec31 mfd: pm8921: Add cell data for pm8921 vibrator
Change-Id: I0ddf2555d80ff8575ae85250b13aed46e21a0f0a
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-09-04 14:48:42 -07:00
David Collins ad59e78900 mfd: pm8921-core: add mfd cell for pm8921 battery alarm device
Add an mfd cell for the PMIC 8921 battery alarm into the
pm8921-core.

Change-Id: Ia856c88050aa99822e6541311f40417ec63964d4
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:41 -07:00
David Collins d5bc2130cb mfd: pm8921-core: Add mfd cell for pm8921 thermal alarm device
Add an mfd cell for the PMIC 8921 thermal alarm into the pm8921-core.

Change-Id: Icd791e879b5289a4b0af374f0f08d928c6b15719
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:41 -07:00
Anirudh Ghayal fc6790b961 mfd: pm8921: Add LEDs mfd cell data
Change-Id: Ia3948b2743599321573665ad7a2a4be7b3954b52
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-09-04 14:48:40 -07:00
David Collins ee35d199c2 mfd: pm8921: remove VBAT IRQ from charger driver control
The VBAT IRQ needs to be controlled by the pm8xxx-batt-alarm
battery alarm driver.  Remove VBAT IRQ control from the
pm8921-charger driver.

Change-Id: I478b4b572e4c08cfcd50ba4c288f847ea549f775
Signed-off-by: David Collins <collinsd@codeaurora.org>
[sboyd: Drop charger part]
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-09-04 14:48:39 -07:00
Abhijeet Dharmapurikar 1e381a777a mfd: pm8921: add bms cell
pm8921 chip is equipped with a smart battery gauge called bms.
BMS is capable of intelligently measuring battery parameters
under various loads, the software uses these reading to
accurately determine battery capacity.

Add code to support the bms driver.

Change-Id: I5f14a82db0fda11adc0404ba58704a25fa7713af
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 14:48:39 -07:00
Siddartha Mohanadoss faae579cf0 mfd: pm8921-core: Add mfd cell for pm8921 adc
Add a mfd cell of adc as part of the pm8921 core. It adds the
interrupts allocated for the ADC/BTM driver.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
Change-Id: I68e1f8df9e24a2512869f238cb3b2fccf09aa8de
2013-09-04 14:48:38 -07:00
David Collins 274af3ab4b mfd: pm8921-core: Print out PMIC version and revision names
Print out the PMIC version and revision names in human readable
form inside of the PM8921 probe function.

Change-Id: I0cfcbd25ab67834a8187d91e34d286cac806fd98
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:37 -07:00
David Collins 0787333a0f mfd: pm8921-core: Add mfd cell for pm8xxx-misc device into core
Add an mfd cell in the pm8921-core for a pm8xxx-misc device.

Change-Id: I0bc955c118aa427e45a4d2ce80065ca1d7c146a9
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:36 -07:00
David Collins 700d980779 pm8xxx: core: Add pm8xxx functions to get PMIC version and revision
Add a pair of APIs in pm8xxx/core.h: pm8xxx_get_version which returns
an enum representing the type of the PMIC (8058, 8901, 8921, etc) and
pm8xxx_get_revision which returns the silicon revision of the PMIC
chip.

Update pm8921-core to implement this new API and remove core data
members previously used to pass revision information.

Change-Id: Ib2aaf5843e4aef9281745919908c530b85717510
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:36 -07:00
Abhijeet Dharmapurikar b0f62be736 mfd: pm8921-core: Use SINGLE_IRQ_RESOURCE wherever possible
The charger cell introduced SINGLE_IRQ_RESOURCE. Use it for other cells
too.

Change-Id: I3e53810b792216135453baef229101f8fed98ea9
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 14:48:35 -07:00
Abhijeet Dharmapurikar 98262e4a26 mfd: pm8921: Add charger cell
The 8921 pmic is equipped with a charger block that can trickle charge
and fast charge a battery. The charger block has 32 interrupts for
notifying various charging events. It needs some parameters such as max
and min voltage of the system, charging resume voltage.

Add code to support the charger module in the core file.

Change-Id: I082b3009dd070af4120b1cd170972e7bf88ce810
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 14:48:34 -07:00
Willie Ruan 378f9c61a1 mfd: pm8921-core: add pwm device for PM8921
Qualcomm PM8921 has a PWM module which can output 8 channels
of PWM signals. This patch adds a PWM device in the sub device
list of PM8921 core driver.

Change-Id: I0799f12dafdffaedcb7cd13bee0d13993931d3a2
Signed-off-by: Willie Ruan <wruan@codeaurora.org>
2013-09-04 14:48:34 -07:00
David Collins 960e35b707 mfd: pm8xxx: add pm8xxx debugfs read/write interface
This driver will provide a means to read and write arbitrary PMIC
PM8XXX SSBI registers via debugfs.  It will first be used on the
PM8921 chip for MSM 8960.

Change-Id: I71c8b98cafec088ad864a89fa39e7ca14d212c7f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:33 -07:00
David Collins 353224dda9 mfd: pm8921: change PM8921 core and regulator init to postcore
The pm8921-core and pm8921-regulator drivers are currently registered
in the subsys init level.  This is not soon enough because the
acpuclock driver needs them to be available during the arch init
level.  Therefore, change them to postcore init so that they are
ready in time.

Change-Id: I6ec7d42e0ef459e7f76621ce518cf9a9c9093c3c
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:48:32 -07:00
David Collins d600052cf2 regulator: pm8921-regulator: Add regulator driver for PM8921
Create a regulator driver to control all regulators on the Qualcomm
PM8921 PMIC chip.  This chip contains many different types of
regulators with a wide range of abilities and voltage ranges.

Eight different regulator types are available on the PM8921.  These
are managed via 7 different type values in the driver:

LDO      - low drop out regulator (supports both NMOS and PMOS LDOs)
NLDO1200 - 1.2A NMOS LDO (different control structure than other LDOs)
SMPS     - switched-mode power supply
FTSMPS   - fast transient SMPS
VS       - voltage switch
VS300    - 300mA voltage switch (different control structure than
             other switches)
NCP      - negative charge pump

The driver interfaces with the PMIC using Qualcomm's SSBI bus.
Calls to this bus are abtracted through the pm8xxx_readb/writeb API.

Change-Id: I01fb755c6be8e3f32c86fef079b5740edfc39f14
Signed-off-by: David Collins <collinsd@codeaurora.org>
[sboyd: Take only pm8921-core bits]
2013-09-04 14:48:32 -07:00
Anirudh Ghayal 8c130bbccb drivers: mfd: Add keypad mfd cell for PM8921
Change-Id: I1aacec2aa638bb1e21b96128b485d479cf4c5a94
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-09-04 14:48:31 -07:00
Anirudh Ghayal 338fa76259 drivers: mfd: Add power/end key mfd cell for PM8921
Change-Id: Idc13abf078d742c959eabc7aa5bfbac074e8538e
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2013-09-04 14:48:30 -07:00
Ashay Jaiswal bc65d75087 mfd: pm8921-core: Add support for RTC driver
Add RTC to PMIC subdevices.

Change-Id: I654ccc8e00fda38fc360c7b00dd632dd00fabdb7
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2013-09-04 14:48:29 -07:00
Stephen Boyd eec0850729 mfd: pm8xxx-mpp: Add pm8xxx MPP driver
Add support for multi-purpose pins (MPPs) on Qualcomm PM8xxx
PMIC chips.

PM8xxx MPPs can be configured as digital or analog inputs or
outputs, current sinks, or buffers.

Note that mpp pins appear as gpio lines to the kernel. However they
are implemented separately from the pmic's gpio driver as
mpps have different configuration attributes and have different
register controls than the pmic's gpio controller. Basically they are
different set of pins.

Change-Id: Iab39b2f7c2ba3f35ef6ac74d37ee7add8c70681f
Signed-off-by: David Collins <collinsd@codeaurora.org>
2013-09-04 14:47:09 -07:00
Stephen Boyd f142a0f2d1 gpio: pm8xxx-gpio: Add pm8xxx gpio driver
Add support for GPIO on Qualcomm PM8xxx PMIC chips.

Change-Id: I5c00baeedc6c40ed40065d15c83577051e6ac9c6
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2013-09-04 14:47:08 -07:00
David Brown ce44bf5b55 SSBI: Remove MSM_ prefix from SSBI drivers
Although the SSBI sub is currently only used on MSM SoCs, it is still
a bus in its own right.  Remove this msm_ prefix from the driver and
it's symbols.  Clients can now refer directly to ssbi_write() and
ssbi_read().

Signed-off-by: David Brown <davidb@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-25 10:39:40 -07:00
Bill Pemberton 4740f73fe5 mfd: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 12:22:27 -08:00
Bill Pemberton f791be492f mfd: remove use of __devinit
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 12:20:19 -08:00
Bill Pemberton 84449216b0 mfd: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Cc: Peter Tyser <ptyser@xes-inc.com>
Cc: Daniel Walker <dwalker@fifo99.com>
Cc: Bryan Huntsman <bryanh@codeaurora.org>
Acked-by: David Brown <davidb@codeaurora.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28 12:16:42 -08:00
Abhijeet Dharmapurikar c013f0a56c mfd: Add pm8xxx irq support
Add support for the irq controller in Qualcomm 8xxx pmic. The 8xxx
interrupt controller provides control for gpio and mpp configured as
interrupts in addition to other subdevice interrupts. The interrupt
controller also provides a way to read the real time status of an
interrupt. This real time status is the only way one can get the
input values of gpio and mpp lines.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:28 +02:00
Abhijeet Dharmapurikar cbdb53e1f3 mfd: Add Qualcomm PMIC 8921 core driver
Add support for the Qualcomm PM8921 PMIC chip. The core driver
will communicate with the PMIC chip via the MSM SSBI bus.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:27 +02:00