Commit Graph

391 Commits

Author SHA1 Message Date
Amir Samuelov
d31ef501b8 power: pm8921-charger: enable external charger
The pmic 8921 charger has a limit of 2Amp of charge current. This limit
makes it inadequate to charge multi-cell batteries.

The pm8921 charger supports a configuration where an external charger
with more current capacity may be used to charge the battery while the
pm8921 itself can charge from a USB source. In such a configuration
the external charger source is connected to the DCIN pins, this makes the
pmic detect insertion and removal of the external charger source. In turn
this enables automatic switching on or off the usb charging path when an
external charger is plugged out or in respectively. The pm8921 charger
driver has to call start and stop on external charger. The internal
FSM and logic correctly indicates that it is charging from a DC source.

The resume charging of a fully charged battery when an external source
is present needs to start charging from an external source. The driver
relies on VBATDET comparator to signal a low.

Change-Id: Iab5439ac2408ab061bce477f4d41d7b6a8de9b38
Signed-off-by: Amir Samuelov <amirs@codeaurora.org>
2011-10-26 14:41:36 +02:00
Jay Chokshi
e91f55cdb5 mfd: 8018: Add led and pwm devices
Change-Id: I92b9f6956aac24cef8898ce59263dd80b5b30d3f
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
2011-10-21 10:39:28 -07:00
Siddartha Mohanadoss
5bcd20614d mfd: pm8018: Add PM8018 ADC resource
Change-Id: I6a4df32671b95070cdb719d80767f0ffde8cd40a
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2011-10-20 18:07:37 -07:00
Siddartha Mohanadoss
17607d277e hwmon: pm8xxx-adc: Add PM8018 ADC Driver
PM8921 and PM8018 have a common ADC module. Difference's
are in the channel supported on individual PMIC's and
in the MPP mapping to the ADC device.
MPP configuration on PM8018 is not required. The MPP
is directly connected to the AMUX pre-mux channel.

Change-Id: I9aed3366f20e3985962119274d8b2865b7054a79
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2011-10-18 09:22:12 -07:00
Linux Build Service Account
d02d1db765 Merge "drivers: rtc-pm8xxx: Fix automatic wakeup of APPS due to RTC alarm." into msm-3.0 2011-10-17 03:47:33 -07:00
Anirudh Ghayal
9d9cdc218c msm: Add msm-ssbi devices for PM8058 on supported targets
Supported targets are msm8660, msm7x30 and fsm9xxx

Change-Id: I1d21b73ba67c6769441658e648c32204c72754d3
Acked-by: Kaushik Sikdar <ksikdar@qualcomm.com>
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2011-10-17 12:53:07 +05:30
Ashay Jaiswal
d66c9d51b2 drivers: rtc-pm8xxx: Fix automatic wakeup of APPS due to RTC alarm.
Alarm interrupt causes automatic wakeup even when the phone is in
powerdown state.

Change-Id: If3ae30304adba4f07284a3dc496956d67a1ae1b0
Signed-off-by: Ashay Jaiswal <ashayj@codeaurora.org>
2011-10-17 11:08:37 +05:30
Jay Chokshi
8994e39bcd 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.

Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>

Conflicts:

	drivers/mfd/pm8921-core.c
2011-10-11 09:59:29 -07:00
Jay Chokshi
4acbdd5c37 mfd: pm8xxx-pwm: add two APIs
These new APIs allow a driver to specify its PWM period,
and raw PWM values separately using chip specific
parameters.

Change-Id: I3e9860f30a50d4f3d9c556133761d51858d2a2e3
Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
2011-10-06 09:27:50 -07:00
Abhijeet Dharmapurikar
0f0242353f power: pm8921-charger: config cold/hot threshold
Pmic 8921, has configurable hot and cold battery thresholds as
percent of VREF_THERM. Provide means to configure these via
platform data.

One has to set the config values in the charger platform data defined
in the board file.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-05 10:36:45 -07:00
Abhijeet Dharmapurikar
fad7235d01 power: pm8921-bms: calculate real_fcc
real_fcc is the remaining capacity in the battery when the charger
driver indicates that the battery is fully charged. This value needs
to be calculated when charging ends with a fully charged battery.

The userspace can read this value via module parameter and preserve it
between restarts.

The real reason for calculating this is to indicate how much the battery
capacity has dropped w.r.t  the profiled battery data use this deviation
in calculations.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-05 10:35:51 -07:00
Siddartha Mohanadoss
77d106ea89 hwmon: pm8921-adc: Add sysfs interface
-Add sysfs interface to read PM8921 HK/XOADC
and thermistor temperature measurements mapped
through MPP's.
-Move PM8921 ADC from directory /drivers/mfd to
/drivers/hwmon for userspace clients to read ADC
through hwmon.

CRs-Fixed: 302365
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>

Conflicts:

	drivers/mfd/Kconfig
2011-10-04 17:14:12 -07:00
Jay Chokshi
1097519e8b mfd: pm8xxx-irq: Set unique dev id for sys device
Use device id passed from platform data to register
for sysfs.

Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>

Conflicts:

	drivers/mfd/pm8xxx-irq.c
2011-10-03 16:21:25 -07:00
Siddartha Mohanadoss
0f063b8670 mfd: pm8921-adc: Add configure and read from MPP ADC
Support configuring a MPP to pre-defined AMUX6 channel
which is used for dynamic mapping of the MPP-AMUX channel
for clients having multiple MPP's to read ADC.

Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2011-10-03 16:21:08 -07:00
Abhijeet Dharmapurikar
33fe6fb63c power: pm8921-charger: update userspace per update_time milliseconds
The userspace should be updated periodically to update it with the
charging progress.

Create a delayed_work and schedule it every update_time milliseconds
to notify the userspace that power supply changed. The userspace
is then supposed to read the power supply properties and know about
the charging progress.

CRs-Fixed: 305572
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:21:06 -07:00
Abhijeet Dharmapurikar
325bdc9937 power: pm8921-bms: report FCC
Since the BMS can calculate FCC based on the charge cycles and age, use it
to report ENERGY_FULL property in the power supply framework.

CRs-Fixed: 304029
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:21:05 -07:00
Abhijeet Dharmapurikar
6d565fdf7a msm: restart: Handle reset interrupt from pmic
The reset interrupt in the pmic indicates the pmic will shutdown
the msm in few seconds - it does so by lowering the reset_n line
to the msm.

When this interrupt is triggered it is required that no more ssbi
transactions are initiated and the msm should cleanup and prepare
for the impending shutdown. There is no need to lower ps_hold in
this case as the pmic will shutdown the msm regardless.

Also since we don't want any ssbi transactions, force shutdown
nonboot cpus. This will prevent ssbi transactions to the pmic for
lower/raising nonboot cpu's voltages as they enter/exit idle states.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:20:55 -07:00
Abhijeet Dharmapurikar
e922bbba5c power: pm8921-bms: use battery data based on battery id
Currently the battery data is passed via the board file. Instead
read the battery id and choose the appropriate battery data to use.

CRs-Fixed: 304376
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:20:20 -07:00
Siddartha Mohanadoss
a0f5121b96 mfd: pm8921-adc: Fix scaling and PM8921 MPP ADC read
-Modify the existing PM8921 ADC read api to include
reading ADC mapped to devices on the MPP.
-Modify scaling function to support XOTHERM and PATHERM
on PM8921.
-Remove post scaling functions for external charger
as its not used on PM8921.

CRs-Fixed: 307164
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2011-10-03 16:20:09 -07:00
David Collins
b909f239f1 mfd: pm8018: Add support for PM8018 regulators into PM8018 core
Signed-off-by: David Collins <collinsd@codeaurora.org>
2011-10-03 16:20:06 -07:00
David Collins
fdefdf941f mfd: pm8018: Add PMIC 8018 core driver
Add support for the Qualcomm PM8018 PMIC chip. The core driver
will communicate with the PMIC chip via the MSM SSBI bus.

Initial support is provided for: IRQ, GPIO, MPP, RTC, Power Key,
Misc, and Debug

Signed-off-by: David Collins <collinsd@codeaurora.org>
2011-10-03 16:20:04 -07:00
Abhijeet Dharmapurikar
ad74236b90 power: pm8921-charger: implement thermal mitigation
Implement thermal mitigation in the charger driver. The userspace
daemon can get the battery temperature from
/sys/class/power_supply/battery/temp

and set the mitigation levels on
/sys/module/pm8921_charger/parameters/thermal_mitigation

The battery driver supports 4 levels [0 through 3]. O being normal
and 3 being extreme thermal mitigation.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:18:33 -07:00
Jay Chokshi
24fc9b6b90 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

Signed-off-by: Jay Chokshi <jchokshi@codeaurora.org>
2011-10-03 16:18:11 -07:00
Willie Ruan
719c676f02 mfd: pm8xxx-pwm: split pm8xxx_pwm_config to smaller structs
A big struct of pm8xxx_pwm_config is not easy to manage. Split it
to smaller structs and make the period struct public.

Signed-off-by: Willie Ruan <wruan@codeaurora.org>
2011-10-03 16:17:57 -07:00
Abhijeet Dharmapurikar
6fe50a87c3 power: pm8921-charger: api to control input regulation
The pmic charger can take measures such as reducing charing
current if the input charger voltage falls below certain point.
Create api to use this feature.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:16:47 -07:00
Abhijeet Dharmapurikar
26cef9c5c9 power: pm8921-charger: api to control trkl charging
Provide mechanism to set trickle, weak voltage and currents via
board file. These settings are used to configure the hardware
controlled auto trickle charging.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:16:46 -07:00
Abhijeet Dharmapurikar
86eea30873 power: pm8921-charger: implement temperature control
pm8921 has a special hardware to monitor the battery temperature. Use
this block to program the cool and warm thresholds and reduce charging
current accordingly.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:16:46 -07:00
Siddartha Mohanadoss
93249a9485 mfd: pm8921-adc: Add BTM thermistor table
BTM (Battery Temperature Module) thermistor lookup
table is computed based on the resistor divider's
used on the board and the specifications of the
thermistor. Its a function of temperature vs the
ADC code for PM8921 ADC and is used to set the
cool/warm thresholds on the BTM.

CRs-Fixed: 299646
Signed-off-by: Siddartha Mohanadoss <smohanad@codeaurora.org>
2011-10-03 16:16:45 -07:00
Abhijeet Dharmapurikar
be6bd8ce1b power: pm8921-charger: add support for invalid battery
Use adc reading on the battery_id resistor to check if a battery
is valid. If it is not disable charging.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:16:39 -07:00
Abhijeet Dharmapurikar
b24e2c3810 power: pm8921-charger: various apis
Implement API's to
	- set maximum battery charging current
	- disable drawing current from the source
	- detect if battery is being charged and which charger source
	  is charging the battery
	- get battery temperature
	- detect battery is present
	- detect usb is present
	- detect dc is present
	- set max trickle charging time
	- set max auto charging time

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:16:39 -07:00
Abhijeet Dharmapurikar
1f52c4141c power: pm8921-charger: add enable/disable api
Add api to enable/disable battery charging. This api will help
start/stop current flowing in the battery for charging purposes, but
it does not affect the current the device draws from a charger source.

CRs-Fixed: 300786
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:16:29 -07:00
Patrick Lai
3043fbaf3c ASoC: wcd9310: Enable platform-specific micbias configuration
WCD9310 has four micbiases and each of them can be programmed to get its
power source from one of 3 available cfilters. Each cfilter can be
programmed to different voltage levels. Essentially, on WCD9310, a user
can have up to three different voltage levels to power various analog
microphones and digital microphones. As it is now, micbias voltage level
of WCD9310 is left to default value. Micbias and cfilter mapping is managed
by codec driver. Different board design can have different micbias
arrangement. Micbias configuration of wcd9310 CODEC for 8960 CDP/MTP/FLUID
is properly defined in this patch.

Signed-off-by: Patrick Lai <plai@codeaurora.org>
2011-10-03 16:16:00 -07:00
Terence Hampson
1316308eb3 msm_charger: Allow parameters to select default charger type
Added method to msm_charger to allow programming of max source
current. Created struct for platform data to be passed into
pmic8058_charger

Signed-off-by: Terence Hampson <thampson@codeaurora.org>
2011-10-03 16:15:46 -07:00
Bradley Rubin
6619d165cc Kbuild: Export Tabla register macro header file to user space
Gives audio acdb utility library access to Tabla register macros

Signed-off-by: Brad Rubin <brubin@codeaurora.org>
2011-10-03 16:14:59 -07:00
Abhijeet Dharmapurikar
76d4db9366 power: pm8921-bms: Add calibration for hkadc
The output of hkadc calibration steps are voltages measured at
0.625V and 1.25V.  We use these to adjust the vbatt readings.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 16:14:50 -07:00
Willie Ruan
6a3c91408d mfd: pmic8058: add pm8058_stay_on API
PMIC stay-on feature allows PMIC to ignore MSM PS_HOLD=low
signal so that some special functions like debugging could be
performed.

This feature should not be used in any product release.

Signed-off-by: Willie Ruan <wruan@codeaurora.org>
2011-10-03 10:28:53 -07:00
Bradley Rubin
4283a4c56a ASoC: WCD9310: Fixes issues with ANC
ANC register writes were improperly packed into
integers. ANC register writes were not correctly
performed, as the mask was incorrectly applied.

Signed-off-by: Brad Rubin <brubin@codeaurora.org>
2011-10-03 10:28:20 -07:00
Anirudh Ghayal
6804c742a1 mfd: pm8921: Add cell data for pm8921 vibrator
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2011-10-03 10:28:13 -07:00
Anirudh Ghayal
fcfbea6273 drivers: misc: Add pm8xxx based vibrator driver
This driver uses the timed output framework to
support the vibrator functionality.

Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2011-10-03 10:28:13 -07:00
Abhijeet Dharmapurikar
e0c3e5f39e power: pm8921-charger: implement CURRENT_NOW property
The pm8921 bms driver can provide instantaneous current. Use the
current now property of the power_supply class to expose this
feature.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 10:27:44 -07:00
Bradley Rubin
229c6a5dc0 ASoC: WCD9310: Add Active Noise Cancellation support
ANC is a feature which reduces noise on the near-end
by pushing anti-noise onto the audio stream heard
by the user.  ANC mixes the anti-noise signal
inside of the WCD9310 codec.

Signed-off-by: Brad Rubin <brubin@codeaurora.org>
2011-10-03 10:26:06 -07:00
Abhijeet Dharmapurikar
52344ac584 power: pm8921-bms: add nano-doc comments to exported functions
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 09:59:06 -07:00
Abhijeet Dharmapurikar
2fb6f08e50 power: pm8921-bms: Add api to read Vsense
The Rsense resistor connects between the -ve end of the battery
and GND. The voltage across the Rsense gives us a good indication
of the current flowing through the battery.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 09:59:06 -07:00
Abhijeet Dharmapurikar
c448d98e7e power: pm8921-bms: read temperature and voltage via adc
Read the battery temeperature and voltage from the adc driver instead
of hard coding them in the driver.

In the charing began and charing end functions, use
pm8921_bms_get_percent_charge api. This prevents duplicating calling
the adc functions.

Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
2011-10-03 09:59:00 -07:00
Bryan Huntsman
3f2bc4d6eb Initial Contribution
msm-2.6.38: tag AU_LINUX_ANDROID_GINGERBREAD.02.03.04.00.142

Signed-off-by: Bryan Huntsman <bryanh@codeaurora.org>
2011-10-03 09:57:10 -07:00
Misael Lopez Cruz
3c9d7a1842 mfd: twl6040: Add initial support
TWL6040 IC provides analog high-end audio codec functions for
handset applications. It contains several audio analog inputs
and outputs as well as vibrator support. It's connected to the
host processor via PDM interface for audio data communication.
The audio modules are controlled by internal registers that
can be accessed by I2C and PDM interface.

TWL6040 MFD will be registered as a child of TWL-CORE, and will
have two children of its own: twl6040-codec and twl6040-vibra.

This driver is based on TWL4030 and WM8350 MFD drivers.

Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
2011-07-24 21:31:53 +02:00
Peter Ujfalusi
d189dd57aa MFD: twl4030-codec -> twl4030-audio: Rename the driver
Rename the driver, and header file from twl4030-codec to
twl4030-audio.
To avoid breakage change depending drivers at the same time.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
CC: Misael Lopez Cruz <misael.lopez@ti.com>
2011-07-24 21:31:53 +02:00
Jean-François Dagenais
f607e7fc5f w1: ds1wm: add a reset recovery parameter
This fixes a regression in 3.0 reported by Paul Parsons regarding the
removal of the msleep(1) in the ds1wm_reset() function:

: The linux-3.0-rc4 DS1WM 1-wire driver is logging "bus error, retrying"
: error messages on an HP iPAQ hx4700 PDA (XScale-PXA270):
:
: <snip>
: Driver for 1-wire Dallas network protocol.
: DS1WM w1 busmaster driver - (c) 2004 Szabolcs Gyurko
: 1-Wire driver for the DS2760 battery monitor  chip  - (c) 2004-2005, Szabolcs Gyurko
: ds1wm ds1wm: pass: 1 bus error, retrying
: ds1wm ds1wm: pass: 2 bus error, retrying
: ds1wm ds1wm: pass: 3 bus error, retrying
: ds1wm ds1wm: pass: 4 bus error, retrying
: ds1wm ds1wm: pass: 5 bus error, retrying
: ...
:
: The visible result is that the battery charging LED is erratic; sometimes
: it works, mostly it doesn't.
:
: The linux-2.6.39 DS1WM 1-wire driver worked OK.  I haven't tried 3.0-rc1,
: 3.0-rc2, or 3.0-rc3.

This sleep should not be required on normal circuitry provided the
pull-ups on the bus are correctly adapted to the slaves.  Unfortunately,
this is not always the case.  The sleep is restored but as a parameter to
the probe function in the pdata.

[akpm@linux-foundation.org: coding-style fixes]
Reported-by: Paul Parsons <lost.distance@yahoo.com>
Tested-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Jean-François Dagenais <dagenaisj@sonatest.com>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-07-08 21:14:44 -07:00
Jorge Eduardo Candelaria
6851ad3ab3 TPS65911: Comparator: Add comparator driver
This driver adds functionality to the tps65911 chip driver.

Two of the comparators are configurable by software and measures
VCCS voltage to detect high or low voltage scenarios.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:29 +01:00
Jorge Eduardo Candelaria
11ad14f86a TPS65911: Add support for added GPIO lines
GPIO 1 to 8 are added for TPS65911 chip version. The gpio driver
now handles more than one gpio lines. Subsequent versions of the
chip family can add new GPIO lines with minimal driver changes.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:29 +01:00