This merge is performed to take commit c56f5c0342 ("Thermal: Make
Thermal trip points writeable") out of Linus' tree and then fixup power
supply class. This is needed since thermal stuff added a new argument:
CC drivers/power/power_supply_core.o
drivers/power/power_supply_core.c: In function ‘psy_register_thermal’:
drivers/power/power_supply_core.c:204:6: warning: passing argument 3 of ‘thermal_zone_device_register’ makes integer from pointer without a cast [enabled by default]
include/linux/thermal.h:154:29: note: expected ‘int’ but argument is of type ‘struct power_supply *’
drivers/power/power_supply_core.c:204:6: error: too few arguments to function ‘thermal_zone_device_register’
include/linux/thermal.h:154:29: note: declared here
make[1]: *** [drivers/power/power_supply_core.o] Error 1
make: *** [drivers/power/] Error 2
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Reduce the mAh value for the BYD LiFe battery from 3100mAh to 2800mAh
to better reflect the average usable capacity as measured by olpc-pwr-log.
Signed-off-by: Richard A. Smith <richard@laptop.org>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
upowerd wants to compute the energy in the battery by looking at this
property. If it's not present then it falls back on using the reported
voltage of the battery at time upowerd loads. That's close but also
means that every time you boot you get a slightly different energy
capacity.
Adding the VOLTAGE_MAX_DESIGN property allows upowerd to compute the
same energy every time.
Signed-off-by: Richard A. Smith <richard@laptop.org>
Signed-off-by: Daniel Drake <dsd@laptop.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This patch select CONFIG_EXTCON to resolve below build break of
charger-manager because charger-manager use API of EXTCON subsystem.
drivers/built-in.o: In function `charger_manager_probe':
charger-manager.c:(.text+0x11d61a): undefined reference to `extcon_register_interest'
charger-manager.c:(.text+0x11d7b6): undefined reference to `extcon_unregister_interest'
drivers/built-in.o: In function `charger_manager_remove':
charger-manager.c:(.devexit.text+0x8f3): undefined reference to `extcon_unregister_interest'
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
The lp8727 header can be used only in the platform side, so it can be
moved to the platform_data directory.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Minimum and maximum alerts on power supply properties will help or allow
the user space to "proactively" create policies like connect/disconnect
charger or stop/start the user apps based on capacity or temperature
parameters.
These parameters can be used to avoid unnecessary polling from user space
and even from kernel space if the underlying HW can support INT triggers
(ex: max17042/47).
This patch adds the following power supply alert type properties:
CAPACITY_ALERT_MIN
CAPACITY_ALERT_MAX
TEMP_ALERT_MIN
TEMP_ALERT_MAX
TEMP_AMBIENT_ALERT_MIN
TEMP_AMBIENT_ALERT_MAX
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This patch adds support for BQ27425 (TI) chip. This chip is same as
BQ27500 with few registers removed and register address map changed.
The data sheet for this chip is publicly available at
http://www.ti.com/product/bq27425-g1
Signed-off-by: Saranya Gopal <saranya.gopal@intel.com>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This patch support the protection of host device from over current.
The Charger-manager set proper current limit of charger(regulator) for
charging according to type of charger cable when external connector
is attached.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This patch support that charger-manager use EXTCON(External Connector)
Subsystem to detect the state of charger cables for enabling or disabling
charger(regulator) and select the charger cable for charging among
a number of external cable according to policy of H/W board.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Emulate battery temperature (fixed to 26) and battery voltage (variable)
properties.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Usually a device has both AC plug and UDC plug usable for charging.
Provide both AC sources.
Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin@mentor.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Context of gpio_charger_get_property is sleepable so we should
use gpio_set_value_cansleep instead of gpio_set_value.
It will remove WARN_ON incase of using gpio from i2c-to-gpio
expander like pca953x.
Signed-off-by: Pritesh Raithatha <praithatha@nvidia.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Addition of power average and health properties.
Signed-off-by: Syed Rafiuddin <srafiuddin@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
power_supply_changed() events are triggerd based on the return value
of a get_property() call. However the property TECHNOLOGY is
hard-coded to LION in this driver, thus always succeeds.
So, with the battery removed, this triggers a false battery present
uevent. This uevent triggers a new query via power_supply_uevent()
which again starts to query all known properties and thus leads to
an infinite loop of battery present/not-present uevents.
This patch skips the battery presence detection for the hard-coded
property TECHNOLOGY.
Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Acked-by Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
The charger needs usb3v1 to be running, so add a new consumer to
keep it running.
This allows the charger to draw current even when the USB driver has
powered down.
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Tero Kristo <t-kristo@ti.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This allows a voltage and current (bb_uvolts and bb_uamps) to be
specified in the platform_data, and charging of the backup battery will
be enabled with those specification.
As it is not possible to monitor the backup battery at all there is no
new device created to represent it.
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This patch adds the support for CHARGE_COUNTER power supply attribute
to max17042/47 driver.
Note:QH(Charge Counter) register is not documented in max17042 the Spec.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This patch makes use of the two new properties in smb347 charger driver.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Constant Charge Current(CC) is charging parameter which limit the
maximum current which can be pumped into the battery during charge cycle.
Constant Charge Voltage(CV) is also charging parameter which limit the
maximum voltage that battery can reach during charge cycle.
It is very common practice that at low or high temperatures we
do not charge the batteries upto it's fullest charge voltage
to avoid battery and user safety issues.
These sysfs properties will be useful for debug and to implement
certain user space policies like "Charging limited due to OverTemp".
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Battery and charger contribute to Thermals in most of the embedded
devices. So, it makes sense to identify them as Thermal zones in a
particular platform.
This patch registers a thermal zone if the power supply is reporting
a temperature property. The thermal zone will be used by platform's
thermal management solution.
Signed-off-by: Jenny TC <jenny.tc@intel.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This patch fixes the following sparse warning:
CHECK drivers/power/ds2781_battery.c
drivers/power/ds2781_battery.c:72:5: warning: symbol 'w1_ds2781_read' was not declared. Should it be static?
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
Rather than silently ignoring errors from the regulator enable and disable
add a WARN_ON() - it's probably pretty important if we're not getting
power, though it should be vanishingly unlikely in production.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)
iQIcBAABAgAGBQJPxr4VAAoJEGgI9fZJve1bmOkP/R+hVC0lHRzbevDiDXVzxx+M
XNG3krM73Y6jC9sdIxUj5wU1/BpQ3z6wYNEKKPKeXJoHPW+UJaN+wjhm6+uYQPx/
6QM7Fkraxcya98I7vKIsz+uVRd9vETMBvgrix6hZ/ec8xO9q62d5ozkXjfG3E4qO
3vUFSihGmeVVGES1BFehIMkLEHRqlEuiUsXwMw71cBaIYATXruzy46iRqS9e3fVS
mLc5+Ylvsm9q65wY1djv2Kieq5AuZ1dOgH8du2FYWJED+vogkqRcZTWeJeuZ3HAc
ql72WhN2ga2U+xuxypVt+mVl2Gb1pjfE1j802EDjZX6ir1E50iSWpcaKIM1M8th7
kZwCvzcMihtzBaKvZjXf1IVazZyBo8Chi02YNbG3UVWW/rSrYjV9GSSh5HPKfY3A
Arw80C4t/I3kiCPr5uwdZZO/D5lsleMF677NEilTmsKZgPSOe9EqbZOTOGPKuALj
A/y2SVCV0sPVb2ki8wYlQ5dpNRsz/Uya+I3cqRFW63YGeSyGHm8VysxWRjzzu6LN
+n7I2q/3Un95aHGMMIoJ/3crHcdtKSqtXeBKbBSiRdRpyO4b4rVRkLJRARv36V7m
eiaduSZJEf5ZrEb3z20FmM2SqjiFHz+d0Q1QH6MQmhwDQ44acKxx/iw6moxGtLTQ
JsDneVe+4d3WlJFqXd3s
=B6u0
-----END PGP SIGNATURE-----
Merge tag 'for-v3.5' of git://git.infradead.org/battery-2.6
Pull battery updates from Anton Vorontsov:
"A bunch of fixes for v3.5, nothing extraordinary."
* tag 'for-v3.5' of git://git.infradead.org/battery-2.6: (27 commits)
smb347-charger: Include missing <linux/err.h>
smb347-charger: Clean up battery attributes
max17042_battery: Add support for max17047/50 chip
sbs-battery.c: Capacity attr = remaining relative capacity
isp1704_charger: Use after free on probe error
ds2781_battery: Use DS2781_PARAM_EEPROM_SIZE and DS2781_USER_EEPROM_SIZE
power_supply: Fix a typo in BATTERY_DS2781 Kconfig entry
charger-manager: Provide cm_notify_event function for in-kernel use
charger-manager: Poll battery health in normal state
smb347-charger: Convert to regmap API
smb347-charger: Move IRQ enabling to the end of probe
smb347-charger: Rename few functions to match better what they are doing
smb347-charger: Convert to use module_i2c_driver()
smb347_charger: Cleanup power supply registration code in probe
ab8500: Clean up probe routines
ab8500_fg: Harden platform data check
ab8500_btemp: Harden platform data check
ab8500_charger: Harden platform data check
MAINTAINERS: Fix 'F' entry for the power supply class
max17042_battery: Handle irq request failure case
...
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQIcBAABAgAGBQJPw2QKAAoJEIqAPN1PVmxKfv8P/2L5d38tc3+9wYuGI1l+k7Mz
xQt2PdAx/kHQGTjLE1DSoeOD6dn4aodFbPaTcsLsU9Eo4IiJnT68b8adr/bqYHKU
Cod6NSPJMaBxLBJZxXsA7nY69Z6O5SMjXxEQsiDc24gaP0jjwaeY35KJSfMug8nF
DA6rvEpchkF8QXzBmkO2t2/uPYr1YWqDZQkauLDnLRG01JnGXFz5ajv9N5pYhiFt
QyYtheg8yEnfwnQ6AlmRtGK75jZRVmrj0kOzRjE9UL7ZwtzswWJes+RE3tlgk89m
JQ7KASRmmqLpvcVJ9fG9SlGX//yBO6OEp5Km06RTxgmt0XftBDVqBTjk1EG2tfMR
SR0NIz6gJ0twKAe6U0d+5HMYalOU45H5ha9e3vCqZ8vl9JfmM95RS+TmWbGcRIqj
04Y5x3I4zq6e9D0u+211BeuRfzkQiefwWJmdPpn0oac3u5LeYbRj/aQ85fqwJWzG
f99D9VU5xgfFHPAtL3SLFiwgd9yOiMBar6eeIva+okDyOW3KaEUzs8Y4dgDyvYcg
IU//JGK51vLVmI5kXtGCwYkgRLF/Y7WKZ8TwypT+SY6iv6tPQVvApOZljq7RC9GI
mXx2z2slA90jlg3TlEFZfxr1WqbZ3TCbonU1riLeMEtkiXUpLtmKC8gbhOqfGvvn
Nzgt+YqRJXafZdELb/S+
=Rh0r
-----END PGP SIGNATURE-----
Merge tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Pull MFD changes from Samuel Ortiz:
"Besides the usual cleanups, this one brings:
* Support for 5 new chipsets: Intel's ICH LPC and SCH Centerton,
ST-E's STAX211, Samsung's MAX77693 and TI's LM3533.
* Device tree support for the twl6040, tps65910, da9502 and ab8500
drivers.
* Fairly big tps56910, ab8500 and db8500 updates.
* i2c support for mc13xxx.
* Our regular update for the wm8xxx driver from Mark."
Fix up various conflicts with other trees, largely due to ab5500 removal
etc.
* tag 'mfd-3.5-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (106 commits)
mfd: Fix build break of max77693 by adding REGMAP_I2C option
mfd: Fix twl6040 build failure
mfd: Fix max77693 build failure
mfd: ab8500-core should depend on MFD_DB8500_PRCMU
gpio: tps65910: dt: process gpio specific device node info
mfd: Remove the parsing of dt info for tps65910 gpio
mfd: Save device node parsed platform data for tps65910 sub devices
mfd: Add r_select to lm3533 platform data
gpio: Add Intel Centerton support to gpio-sch
mfd: Emulate active low IRQs as well as active high IRQs for wm831x
mfd: Mark two lm3533 zone registers as volatile
mfd: Fix return type of lm533 attribute is_visible
mfd: Enable Device Tree support in the ab8500-pwm driver
mfd: Enable Device Tree support in the ab8500-sysctrl driver
mfd: Add support for Device Tree to twl6040
mfd: Register the twl6040 child for the ASoC codec unconditionally
mfd: Allocate twl6040 IRQ numbers dynamically
mfd: twl6040 code cleanup in interrupt initialization part
mfd: Enable ab8500-gpadc driver for Device Tree
mfd: Prevent unassigned pointer from being used in ab8500-gpadc driver
...
The modern idiom is to use irq_domain to allocate interrupts. This is
useful partly to allow further infrastructure to be based on the domains
and partly because it makes it much easier to allocate virtual interrupts
to devices as we don't need to allocate a contiguous range of interrupt
numbers.
Convert the wm831x driver over to this infrastructure, using a legacy
IRQ mapping if an irq_base is specified in platform data and otherwise
using a linear mapping, always registering the interrupts even if they
won't ever be used. Only boards which need to use the GPIOs as
interrupts should need to use an irq_base.
This means that we can't use the MFD irq_base management since the
unless we're using an explicit irq_base from platform data we can't rely
on a linear mapping of interrupts. Instead we need to map things via
the irq_domain - provide a conveniencem function wm831x_irq() to save a
small amount of typing when doing so. Looking at this I couldn't clearly
see anything the MFD core could do to make this nicer.
Since we're not supporting device tree yet there's no meaningful
advantage if we don't do this conversion in one, the fact that the
interrupt resources are used for repeated IP blocks makes accessor
functions for the irq_domain more trouble to do than they're worth.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Without the include we get build errors like:
drivers/power/smb347-charger.c: In function 'smb347_probe':
drivers/power/smb347-charger.c:1039:2: error: implicit declaration of function 'IS_ERR' [-Werror=implicit-function-declaration]
drivers/power/smb347-charger.c:1040:3: error: implicit declaration of function 'PTR_ERR' [-Werror=implicit-function-declaration]
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
CURRENT_NOW and VOLTAGE_NOW should be instantaneous readings
from power supply(ex: battery).
smb347 charger driver reports charge voltage for VOLTAGE_NOW
and charge current for CURRENT_NOW attributes which are not
instantaneous readings.
This patch removes the battery VOLTAGE_NOW and CURRENT_NOW
properties from the driver and also removes hw_to_current()
which is not required anymore.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
max17047 is improved version of max17042 chip. It has few HW bug
fixes with minor changes in register set.
max17050 is same as max17047 chip except its silicon packging. So from
driver's point of view there is no difference btw max1047 and max1050.
This patch adds the support to dynamically detect the chip type and
adds steps to initialize the max17047 chip.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Currently, the capacity exported by this driver refers to reg 0x0e,
which is the absolute state of charge which according to SBS
refers to the design capacity/ energy of the battery. It can be
> 100 % and drops below 100 % for a fully charged battery with
the battery aging.
This is not what the user exspects of a remaining capacity
indication between 0 and 100 % with 100 % referring to
a fully charged battery. This is provided by SBS reg 0x0d,
which is the relative state of charge referring to the
full charge capacity.
Signed-off-by: Nikolaus Voss <n.voss@weinmann.de>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
We can't use "isp" after freeing it.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Since we have defined DS2781_PARAM_EEPROM_SIZE and
DS2781_USER_EEPROM_SIZE, use them to simplify the code.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
By using cm_notify_event function, charger driver can report several
charger events (e.g. battery full and external power in/out, etc) to
Charger-Manager. Charger-Manager can properly and immediately control
chargers by the reported event.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Charger-Manager needs to check battery health in normal state
as well as suspend-to-RAM state. When the battery is fully charged,
Charger-Manager needs to determine when the chargers restart charging.
This patch allows Charger-Manager to monitor battery health in normal
state and handle operation for chargers after battery is fully charged.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
The smb347-charger driver does a lot of read-modify-write to the device
registers. Instead of open-coding everything we can take advantage of
regmap API which provides nice functions to do this kind of things.
In addition there is no need for custom debugfs file for dumping
registers as this is already provided by the regmap API.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
There is a potential problem if we call smb347_irq_enable() from
smb347_irq_init() because smb347_irq_enable() makes the device registers
read-only once it returns and smb347_irq_init() expects them to still be
read-write. Currently no harm happens because it is the last call we make
in smb347_irq_init().
Anyway a better place for enabling IRQs is at the end of probe function
and this is also symmetric to call smb347_irq_disable() which is done at
the beginning of remove function.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
The naming used in the driver for some functions is not very clear what
the functions are really doing. To make this a bit easier to understand
we rename few functions which were badly named.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This reduces the amount of boilerplate code in the driver and
makes it a bit simpler.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This patch checks if the usb or mains charging is enabled by the
platform before registering with the power supply class.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
These patches clean up some ugliness and brings the variable
initialisation formatting more into line with other drivers.
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
If no platform data at all is supplied the driver crashes,
extend the checks to be more careful so we can compile in the
driver and boot also without platform data present.
Acked-by: Arun Murthy <arun.murthy@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
If no platform data at all is supplied the driver crashes,
extend the checks to be more careful so we can compile in the
driver and boot also without platform data present.
Acked-by: Arun Murthy <arun.murthy@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
If no platform data at all is supplied the driver crashes,
extend the checks to be more careful so we can compile in the
driver and boot also without platform data present.
Acked-by: Arun Murthy <arun.murthy@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
suspend/resume functions take action based upon the fuel gauge
interrupt. If the rquest irq fails we should assign 0 to client->irq.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
IRQ registration should happen only after power supply object usable.
This patch fixes the ordering of power supply and irq registration
calls.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
On Mon, Apr 02, 2012 at 01:53:23PM +1000, Benjamin Herrenschmidt wrote:
> > drivers/built-in.o: In function `.nouveau_pm_trigger':
> > (.text+0xa56e8): undefined reference to `.power_supply_is_system_supplied'
> >
> > nouveau probably needs to depends on CONFIG_POWER_SUPPLY to force a module
> > build with the latter is =m
>
> Ok, not that trivial...
>
> The problem is more like POWER_SUPPLY should be a bool, not a tristate.
>
> If you think about it: you don't want things like nouveau to depend on a
> random subsystem like that, people will never get it. In fact,
> POWER_SUPPLY provides empty inline stubs when not enabled, so that's
> really designed to not have depends...
>
> However that -cannot- work if POWER_SUPPLY is modular and the drivers
> who use it are not.
>
> The only fixes here that make sense I can think of
> that don't also involve Kconfig horrors are:
>
> - Ugly: in power_supply.h, use the extern variant if
>
> defined(CONFIG_POWER_SUPPLY) ||
> (defined(CONFIG_POWER_SUPPLY_MODULE) && defined(MODULE))
>
> IE. use the stub if power supply is a module and what is being built is
> built-in. Of course that's not only ugly, it somewhat sucks from a user
> perspective as the subsystem now exists but can't be used by some
> drivers...
>
> - Better: Just make the bloody thing a bool :-) The power supply
> framework itself is small enough, just make it a boolean option and
> avoid the problem entirely. The actual power supply sub drivers can
> remain modular of course.
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
This adds a new sysfs file called 'voltage_ocv' which gives the
Open Circuit Voltage of the battery.
This property can be used for platform shutdown policies and
can be useful for initial capacity estimations.
Note: This patch is generated against linux-next branch.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This is what we do for the rest of the drivers, saves some bytes.
Plus a small style change while at it.
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
This patch adds suspend/resume methods to the driver.
In suspend method irq line is disabled to avoid i2c
read/write errors from the interrupt handler as the
i2c bus itself could be in suspend state.
In resume function irq line will be re-enabled.
Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>