Commit Graph

379 Commits

Author SHA1 Message Date
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
Jorge Eduardo Candelaria
a2974732ca TPS65911: Add new irq definitions
TPS65911 adds new interrupt sources, as well as two new registers
to handle them, one for interrupt status and one for interrupt
masking. The added irqs are:

-VMBCH2 - Low and High threshold
-GPIO1-8 - Rising and falling edge detection
-WTCHDG - Watchdog interrupt
-PWRDN	- PWRDN reset interrupt

The code should handle these new registers only when the chip
version is TPS65911.

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:10 +01:00
Jorge Eduardo Candelaria
a320e3c3d6 regulator: tps65911: Add new chip version
The tps65911 chip introduces new features, including changes in
the regulator module.

- VDD1 and VDD2 remain unchanged.
- VDD3 is now named VDDCTRL and has a wider voltage range.
- LDOs are now named LDO1...8 and voltage ranges are sequential,
  making LDOs easier to handle.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:10 +01:00
Jorge Eduardo Candelaria
795570561c MFD: TPS65910: Add support for TPS65911 device
The TPS65911 is the next generation of the TPS65910 family of
PMIC chips. It adds a few features:

- Watchdog Timer
- PWM & LED generators
- Comparators for system control status

It also adds a set of Interrupts and GPIOs, among other things.

The driver exports a function to identify between different
versions of the tps65910 family, allowing other modules to
identify the capabilities of the current chip.

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:10 +01:00
Axel Lin
ecb9c4f595 regulator: Remove MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros
In current implementation, the original macro implementation assumes the caller
pass the parameter starting from 1 (to match the register names in datasheet).
Thus we have unneeded plus one then minus one operations
when using MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros.

This patch removes these macros to avoid unneeded plus one then minus one operations
without reducing readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:10 +01:00
Graeme Gregory
518fb721de TPS65910: Add tps65910 regulator driver
The regulator module consists of 3 DCDCs and 8 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:08 +01:00
Graeme Gregory
e3471bdc27 TPS65910: IRQ: Add interrupt controller
This module controls the interrupt handling for the tps chip. The
interrupt sources are the following:

- GPIO falling/rising edge detection
- Battery voltage below/above threshold
- PWRON signal
- PWRHOLD signal
- Temperature detection
- RTC alarm and periodic event

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:48:43 +01:00
Graeme Gregory
2537df722d TPS65910: GPIO: Add GPIO driver
TPS65910 has one configurable GPIO that can be used for several
purposes. Subsequent versions of the TPS chip support more than
one GPIO.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
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:48:23 +01:00
Graeme Gregory
27c6750ec5 MFD: TPS65910: Add new mfd device for TPS65910
The TPS65910 chip is a power management IC for multimedia and handheld
devices. It contains the following components:

- Regulators
- GPIO controller
- RTC

The tps65910 core driver is registered as a platform driver and provides
communication through I2C with the host device for the different
components.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
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:35:22 +01:00
Paul Parsons
74e32d1b68 mfd: Fix ASIC3 SD Host Controller Configuration size
The size of the TC6380AF SD Host Controller Configuration area is 0x200 bytes (assuming registers are aligned on 32-bit boundaries), not 0x400 bytes. Source: Toshiba TC6380AF Specification sections 4.2 and 4.3.1

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:51 +02:00
Paul Parsons
7d9e7e9fbd leds: Add ASIC3 LED support
Add LED support for the HTC ASIC3. Underlying support is provided by the mfd/asic3 and leds/leds-asic3 drivers. An example configuration is provided by the pxa/hx4700 platform.

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:46 +02:00
Peter Ujfalusi
4a7c00cd94 mfd: Update twl4030-code maintainer e-mail address
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:45 +02:00
Linus Walleij
863dde5bfa mfd: Provide ab8500-core enumerators for chip cuts
Since functionality in MFD cells may need to be adjusted according to
chip revision, let's enumerate them and keep track of them.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-05-26 19:45:42 +02:00