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
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>
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>
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>
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>
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>
-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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>