Commit graph

1579 commits

Author SHA1 Message Date
Peter Rosin a7d143d42b power: supply: bq24735: always check for AC adapter presence in probe
So what if there is a status_gpio specified? bq24735_charger_is_present()
do have a working fallback for the case of no status_gpio.

Simplify this by not special casing setups w/o status_gpio, folding
two consecutive if-blocks in the process.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:52 +01:00
Peter Rosin a07bea32c6 power: supply: bq24735: configure the charger as part of enabling it
During probe, it makes no sense to take care to first not issue any
i2c commands to verify if the connected part really is a bq24735, to
later simply fail the probe in the next step when trying to configure
the charger. So, delay configuration of the charging parameters until
the charger is accessible (i.e. when the AC adapter is present) as
part of enabling the charging.

This also fixes the rather serious issue that the charging parameters
are lost when the AC adapter is disconnected.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:48 +01:00
Peter Rosin 2e66585ca2 power: supply: bq24735: move down bq24735_{en,dis}able_charging
bq24735_enable_charging() needs to call bq24735_config_charging(),
which is something to change later, this is just a preparatory patch.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:41 +01:00
Milo Kim 5b903a1555 power: supply: tps65217: Use generic charger name
"tps65217-charger" is more appropriate name because the driver supports
not only AC but also USB charger.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:37 +01:00
Milo Kim 757620c4e4 power: supply: tps65217: Use generic name for get_property()
Rename it as tps65217_charger_get_property().

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:33 +01:00
Milo Kim da50b3a584 power: supply: tps65217: Use generic name for power supply property
Replace 'ac_props' with 'charger_props'.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:29 +01:00
Milo Kim 3967d1f91c power: supply: tps65217: Use generic name for power supply structure
Replace 'ac' of tps65217_charger structure with 'psy'.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:25 +01:00
Milo Kim 3c2e58a6d7 power: supply: tps65217: Use generic name for charger online
This driver supports AC and USB chargers. Generic name is preferred.
Replace 'ac_online' with 'online'.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:21 +01:00
Milo Kim 20a7e173c2 power: supply: tps65217: Support USB charger interrupt
TPS65217 has two charger interrupts - AC and USB power status change.

Interrupt number in the TPS65217 driver data:
  IRQ number is only used on requesting the interrupt, so no need to keep
  it inside the driver data.

Interrupt handler:
  Check not only AC but also USB charger status.
  In both cases, enable charging operation.

Interrupt request:
  If an interrupt number is invalid, then use legacy polling thread.
  Otherwise, create IRQ threads to handle AC and USB charger event.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:18 +01:00
Milo Kim 9ef0bf1184 power: supply: tps65217: Use 'poll_task' on unloading the module
Use the task_struct variable for running polling thread. If polling task
is activated, then use it to stop running thread.
This is a preceding step of supporting two interrupts of TPS65217 charger,
so checking single IRQ number is not appropriate when the module is removed.

Signed-off-by: Milo Kim <woogyom.kim@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:14 +01:00
Chanwoo Choi bdca5d9e6b power: supply: qcom_smbb: Replace the deprecated extcon API
This patch replaces the deprecated extcon API as following:
- extcon_set_cable_state_() -> extcon_set_state_sync()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:07 +01:00
Chanwoo Choi c31480348f power: supply: axp288_charger: Replace the extcon API
This patch uses the resource-managed extcon API for extcon_register_notifier()
and replaces the deprecated extcon API as following:
- extcon_get_cable_state_() -> extcon_get_state()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 22:00:02 +01:00
Srikant Ritolia a50b0dbbaf power: supply: max8997_charger: Using device managed API and remove OOM print
Use managed resource function devm_power_supply_register instead of
power_supply_register to simplify the error path by allowing unregistering
to happen automatically on error and remove.
Removing max8997_battery_remove function also as it is now redundant.

Also removing out of memory printk message after kzalloc as there is
already enough information on failure.

Signed-off-by: Srikant Ritolia <s.ritolia@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:56 +01:00
Quentin Schulz 50111d3f88 power: supply: axp20x_usb_power: add 100mA max current limit for AXP223
The X-Powers AXP223 shares most of its behaviour with the AXP221 PMIC
but allows the VBUS power supply max current to be set to 100mA (like
the AXP209 PMIC).

This basically adds a new compatible to the VBUS power supply driver and
adds a check on the compatible when setting current max limit.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:46 +01:00
Quentin Schulz 5c3ff59b4e power: supply: axp20x_usb_power: set min voltage and max current from sysfs
AXP20X and AXP22X PMICs allow setting the min voltage and max current of
VBUS power supply. This adds entries in sysfs to allow to do so.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:34 +01:00
Quentin Schulz 0dcc70ca86 power: supply: axp20x_usb_power: use of_device_id data field instead of device_is_compatible
This replaces calls to of_device_is_compatible to check data field of
of_device_id matched when probing the driver.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:30 +01:00
Peter Rosin bf383fea1f power: supply: bq24735-charger: optionally poll the ac-detect gpio
If the ac-detect gpio does not support interrupts, provide a fallback
to poll the gpio at a configurable interval.

Signed-off-by: Peter Rosin <peda@axentia.se>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:23 +01:00
Hans de Goede 248efcf006 power: supply: axp288_fuel_gauge: Read 12 bit values 2 registers at a time
In order for the MSB -> LSB latching to work correctly we must read the
2 8 bit registers of a 12 bit value in one consecutive read.

This fixes voltage_ocv reporting inconsistent values on my tablet.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:17 +01:00
Hans de Goede 4949fc5e07 power: supply: axp288_fuel_gauge: Read 15 bit values 2 registers at a time
In order for the MSB -> LSB latching to work correctly we must read the
2 8 bit registers of a 15 bit value in one consecutive read.

This fixes charge_full reporting 3498768 on some reads and 3354624 one
other reads on my tablet (for the 3354624 value the raw LSB is 0x00).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:13 +01:00
Hans de Goede 6f074bc878 power: supply: axp288_fuel_gauge: Fix fuel_gauge_reg_readb return on error
If reading the register fails, return the actual error code, instead
of the uninitialized val variable;

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:59:08 +01:00
Peter Rosin d0ddcba9e9 power: supply: bq24735-charger: simplify register update to stop charging
Providing value bits outside of the mask is pointless.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:58:42 +01:00
Hans de Goede 888f97435a power: supply: axp288_fuel_gauge: Drop platform_data dependency
When the axp288_faul_gauge driver was originally merged, it was
merged with a dependency on some other driver providing platform
data for it.

However the battery-data-framework which should provide that data
never got merged, resulting in x86 tablets / laptops with an axp288
having no working battery monitor, as before this commit the driver
would simply return -ENODEV if there is no platform data.

This commit removes the dependency on the platform_data instead
checking that the firmware has initialized the fuel-gauge and
reading the info back from the pmic.

What is missing from the read-back info is the table to map raw adc
values to temperature, so this commit drops the temperature and
temperature limits properties. The min voltage, charge design and
model name info is also missing. Note that none of these are really
important for userspace to have.

All other functionality is preserved and actually made available
by this commit.

BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=88471
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:56:10 +01:00
Hans de Goede eac53b3664 power: supply: axp288_charger: Drop platform_data dependency
When the axp288_charger driver was originally merged, it was merged with
a dependency on some other driver providing platform data for it.

However the battery-data-framework which should provide that data never
got merged, so the axp288_charger as merged upstream has never worked,
its probe method simply always returns -ENODEV.

This commit removes the dependency on the platform_data instead reading
back the charging current and charging voltage that the firmware has set
and using those values as the maximum values the user may set.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:54:58 +01:00
Hans de Goede d556f21cb0 power: supply: axp288_charger: Make charger_init_hw_regs propagate i2c errors
Make charger_init_hw_regs propagate i2c errors, instead of only warning
about them and then ignoring them.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2017-01-04 21:54:53 +01:00
Thomas Gleixner 8b0e195314 ktime: Cleanup ktime_set() usage
ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
2016-12-25 17:21:22 +01:00
Linus Torvalds bbcd9c53c7 power supply and reset changes for the v4.10 series
* New driver for Intel PIIX4
 * lots of module autoload fixes
 * misc. fixes
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAlhRSwwACgkQ2O7X88g7
 +ppsxQ/7BMBtkVlr2lLFfognswP87r6cqeEhKICpxbgk1KfcTG7xJ/AEyPUDflET
 htPTurpcetlJLB1057ikSt9QTMtyIBUgpbnM+oJt0EVj/UYV6mXw6rqkNX/ROfVY
 JcIN1/nQljv3W//tR83x04TJv+8V65lV/Jrh3XkNS2arRXCD/JktRNljvgUpn2iw
 Tp9MM8eyv9J4VN5BCPudyBOU0Y6ztC9VVDj/p+I7giUOm3udAvgYvcOTqBdCcuZH
 ThDnf8dLNWmTkLTWqPBCnmfe2TyS8IbWMYMtYec3E5NzymzuYA1r0U1wBRVLm4BA
 LFeEXLtmRx3pXt6YY2MqPF9jQGhMsiDdKhHmF0GhpofEk1Ctu0xzCyvA1wxtLq/I
 bt006d5tu1Y+yFu1t0iPCEtGP5H2dt1p9Rq4EM7rgEodIsolIdD5h/Fdc3g7IdRK
 1HgkKhzEOT4+WrIyT3HoI8k8lgFmYs8BumbLTYIR6j/XD8ZBO8Dk4pljyL3B4lur
 qszI73U1yp5iEq4/Mcam1LHwfOxt7liYPrqDiZgUDuK3QAy4Z2lQTjXbaEaTCgN9
 Z5YUSh9RrCTYhAcy5zNEeoixfnDxB7G09v7+5Cfh4RJnZZ2tBL5sQSbMZMgTjbRT
 Trbupf9z7ItYNRerEm+2vSgOTkQpj2V6SaP+jrEl/il0/UDLVoo=
 =s+mK
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:

 - new driver for Intel PIIX4

 - lots of module autoload fixes

 - misc fixes

* tag 'for-v4.10' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  power_supply: wm97xx_battery: use power_supply_get_drvdata
  wm8350_power: use permission-specific DEVICE_ATTR variants
  power: ipaq_micro_battery: fix alias
  power: supply: bq27xxx_battery: Fix register map for BQ27510 and BQ27520
  bq24190_charger: Fix PM runtime use for bq24190_battery_set_property
  power: supply: lp8788: remove an unneeded NULL check
  power: reset: zx-reboot: Fix module autoload
  power: reset: syscon-reboot-mode: Fix module autoload
  power: reset: at91-poweroff: Fix module autoload
  power: reset: at91-reset: Fix module autoload
  power: supply: axp288_fuel_gauge: Fix module autoload
  power: supply: max8997_charger: Fix module autoload
  power: supply: max17040: Change register transaction length from 8 bits to 16 bits
  power: supply: bq27xxx_battery: don't update poll_interval param if same
  power: supply: improve function-level documentation
  power: reset: Add Intel PIIX4 poweroff driver
2016-12-14 11:18:51 -08:00
Robert Jarzmik 6480af4915 power_supply: wm97xx_battery: use power_supply_get_drvdata
As the power supply framework provides a way to store and retrieve
private supply data, use it.

In the process, change the platform data for wm97xx_battery from a
container of a single struct wm97xx_batt_pdata to the direct point to wm97xx_batt_pdata.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-11-23 23:48:12 +01:00
Julia Lawall 8d4124cb94 wm8350_power: use permission-specific DEVICE_ATTR variants
Use DEVICE_ATTR_RO for read only attributes.  This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@

DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);

@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@

if not (x^"_show" = x_show) then Coccilib.include_match false

@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@

- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-11-23 23:46:20 +01:00
Russell King 5ee1d39e1c power: ipaq_micro_battery: fix alias
The alias for the ipaq_micro_battery driver is incorrect, fix it so the
module can be auto-loaded.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-11-23 23:44:40 +01:00
Andrew F. Davis 3bee9ea1de power: supply: bq27xxx_battery: Fix register map for BQ27510 and BQ27520
The BQ27510 and BQ27520 use a slightly different register map than the
BQ27500, add a new type enum and add these gauges to it.

Fixes: d74534c277 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Based-on-patch-by: Kenneth R. Crudup <kenny@panix.com>
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-11-23 23:37:27 +01:00
Tony Lindgren 075eb5719d bq24190_charger: Fix PM runtime use for bq24190_battery_set_property
There's a typo, it should do pm_runtime_get_sync, not put.

Fixes: d7bf353fd0 ("bq24190_charger: Add support for TI BQ24190 Battery Charger")
Cc: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Mark Greer <mgreer@animalcreek.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-11-23 23:27:41 +01:00
Shawn Lin f526140249 PM / AVS: rockchip-io: make the log more consistent
When testing SD hotplug automatically, I got bunch of
useless log like this:

[  588.357838] mmc0: card 0007 removed
[  589.492664] rockchip-iodomain ff770000.syscon:io-domains: Setting to 3300000 done
[  589.500698] vccio_sd: ramp_delay not set
[  589.504817] rockchip-iodomain ff770000.syscon:io-domains: Setting to 3300000 done
[  589.669705] rockchip-iodomain ff770000.syscon:io-domains: Setting to 3300000 done
[  589.677593] vccio_sd: ramp_delay not set
[  589.681581] rockchip-iodomain ff770000.syscon:io-domains: Setting to 1800000 done
[  590.032820] dwmmc_rockchip ff0c0000.dwmmc: Successfully tuned phase to 140
[  590.039725] mmc0: new ultra high speed SDR50 SDHC card at address 0007
[  590.046641] mmcblk0: mmc0:0007 SD32G 29.3 GiB
[  590.052163]  mmcblk0: p1

Moreover the code is intent to print the 'uV' for debug but
later print it using dev_info. It looks more like to me that
it should be the real intention of the code. Anyway, let's
mark this verbose log as debug message.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-10-21 14:51:03 +02:00
Dan Carpenter 44fccac4ff power: supply: lp8788: remove an unneeded NULL check
We checked that "pdata->chg_params" is non-NULL earlier in this function
so when we add "i" to it, it's still non-NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:36:09 +02:00
Javier Martinez Canillas 93f7c27b4d power: reset: zx-reboot: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/zx-reboot.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/zx-reboot.ko | grep alias
alias:          of:N*T*Czte,sysctrlC*
alias:          of:N*T*Czte,sysctrl

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Javier Martinez Canillas 0a27aa9c31 power: reset: syscon-reboot-mode: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/syscon-reboot-mode.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/syscon-reboot-mode.ko | grep alias
alias:          of:N*T*Csyscon-reboot-modeC*
alias:          of:N*T*Csyscon-reboot-mode

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Javier Martinez Canillas c9ba9b7763 power: reset: at91-poweroff: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/at91-poweroff.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/at91-poweroff.ko | grep alias
alias:          of:N*T*Catmel,at91sam9x5-shdwcC*
alias:          of:N*T*Catmel,at91sam9x5-shdwc
alias:          of:N*T*Catmel,at91sam9rl-shdwcC*
alias:          of:N*T*Catmel,at91sam9rl-shdwc
alias:          of:N*T*Catmel,at91sam9260-shdwcC*
alias:          of:N*T*Catmel,at91sam9260-shdwc

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Javier Martinez Canillas 991de44036 power: reset: at91-reset: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/reset/at91-reset.ko | grep alias
$

After this patch:

$ modinfo drivers/power/reset/at91-reset.ko | grep alias
alias:          of:N*T*Catmel,sama5d3-rstcC*
alias:          of:N*T*Catmel,sama5d3-rstc
alias:          of:N*T*Catmel,at91sam9g45-rstcC*
alias:          of:N*T*Catmel,at91sam9g45-rstc
alias:          of:N*T*Catmel,at91sam9260-rstcC*
alias:          of:N*T*Catmel,at91sam9260-rstc
alias:          platform:at91-sam9g45-reset
alias:          platform:at91-sam9260-reset

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:16:09 +02:00
Javier Martinez Canillas 99e33fbdff power: supply: axp288_fuel_gauge: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/supply/axp288_fuel_gauge.ko | grep alias
$

After this patch:

$ modinfo drivers/power/supply/axp288_fuel_gauge.ko | grep alias
alias:          platform:axp288_fuel_gauge

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:15:07 +02:00
Javier Martinez Canillas a5a8539927 power: supply: max8997_charger: Fix module autoload
If the driver is built as a module, autoload won't work because the module
alias information is not filled. So user-space can't match the registered
device with the corresponding module.

Export the module alias information using the MODULE_DEVICE_TABLE() macro.

Before this patch:

$ modinfo drivers/power/supply/max8997_charger.ko | grep alias
$

After this patch:

$ modinfo drivers/power/supply/max8997_charger.ko | grep alias
alias:          platform:max8997-battery

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:15:07 +02:00
Liu Xiang 14d60bdd1e power: supply: max17040: Change register transaction length from 8 bits to 16 bits
According to the datasheet, MAX17040 has six 16-bit registers.
Register reads and writes are only valid if all 16 bits are transferred.
Any write command that is terminated early is ignored.
So it's better to change register transacton length from 8 bits to 16 bits.

Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:06:32 +02:00
Matt Ranostay 950b6c2d11 power: supply: bq27xxx_battery: don't update poll_interval param if same
To avoid canceling the delayed workqueue needlessly, and scheduling an
immediate polling. Check if the new poll_interval value is different
than the previous setting.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:06:28 +02:00
Julia Lawall 32c52eff6a power: supply: improve function-level documentation
In drivers/power/supply/ab8500_fg.c, fix two typos and adjust the function
name in two cases to correspond to the names of the defined functions.

In drivers/power/supply/power_supply_core.c, change two variable names to
the names of the corresponding parameters.

Issue detected using Coccinelle (http://coccinelle.lip6.fr/)

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-19 05:06:22 +02:00
Paul Burton 29676833df power: reset: Add Intel PIIX4 poweroff driver
Add a driver which allows powering off the system via an Intel PIIX4
southbridge, by entering the PIIX4 SOff state. This is useful on the
MIPS Malta development board, where it will power down the FPGA based
board until its ON/NMI button is pressed, or the QEMU implementation of
the MIPS Malta board where it will cause QEMU to exit.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-10-18 05:13:37 +02:00
Linus Torvalds 021723e6c5 power supply and reset changes for the v4.9 series
* move power supply drivers to drivers/power/supply
  * unify location of power supply DT documentation
  * tps65217-charger: IRQ support
  * act8945a-charger: misc. cleanups & improvements
  * sbs-battery cleanup
  * fix users of deprecated create_singlethread_workqueue()
  * misc fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQIcBAABCgAGBQJX8j3bAAoJENju1/PIO/qavlcP/Rq5LeMol2KYQfYOLrVKmS9N
 sqJpOM1wnQS25Dw+KQf+bNOLuBY/w44SnINFYswV2Vw5DQ2ODt1IzvqoaPBwznpq
 BeLN/NLvYY2vIAPxmHxvdB0mnPEhRJOgZkHXUkonIqX98qnzbIorQtHBhAZ3h2v6
 nz5ltO3GXiAyzPE6Zhx9OWWTZRLi1YKCuPZstRU6SY6uGwEMyEVMcu6Rv3XFizBj
 kng9nOCWRE3723UaGQx3LumI2EIsJ1m7RDHIx0ZPOIRlUEd5bawhxdhfT1pQAEZS
 y7GSs4FE86QuGN4M+zcxr4u1vSmYsK2c7FGFRnBcwG4Hkmy4O4h1yBjmrMby8eWo
 V0JxsGkkN+R/6/cAKqXRL0T5gU4rKf4LAj84kSOHGZDiQk0D29wGNZuBtlQw/2sB
 CLABJvpn11aQ3NIkNttr1ur8S15C9tAEMKmjrK7bbvtzBUp2BoVguYQtkP909s0U
 19exP0yslM95t0cRT6lCpZUPFUvoEDs7iIDwv7QBFJSB2ZDMUFfGy6ouM6gHnfKL
 ZkiCi2gmhTqHCpGvD/yi8FhuDFBZ7Ujcotzn3bE07GSTeG7FmzhR+6khedq9DIYQ
 xJbDdPwmwhbrOe99O0wk/qFCBcvgmkXaE4O23fBPS10oCs70FFseYFfb15qAljsE
 4ydoaCMwFUgH49SpDQC6
 =HpLI
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 - move power supply drivers to drivers/power/supply
 - unify location of power supply DT documentation
 - tps65217-charger: IRQ support
 - act8945a-charger: misc. cleanups & improvements
 - sbs-battery cleanup
 - fix users of deprecated create_singlethread_workqueue()
 - misc fixes.

* tag 'for-v4.9' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (46 commits)
  power: supply: bq27xxx_battery: allow kernel poll_interval parameter runtime update
  power: supply: sbs-battery: Cleanup removal of chip->pdata
  power: reset: st: Remove obsolete platforms from dt doc
  power: reset: st-poweroff: Remove obsolete platforms.
  power: reset: zx-reboot: Unmap region obtained by of_iomap
  power: reset: xgene-reboot: Unmap region obtained by of_iomap
  power: supply: ab8500: cleanup with list_first_entry_or_null()
  power: reset: add in missing white space in error message text
  sbs-battery: make writes to ManufacturerAccess optional
  power: bq24257: Fix use of uninitialized pointer bq->charger
  power: supply: sbs-battery: simplify DT parsing
  power: supply: bq24735-charger: Request status GPIO with initial input setup
  power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect
  power: supply: act8945a_charger: Add max current property
  power: supply: act8945a_charger: Add capacity level property
  doc: bindings: power: act8945a-charger: Update properties.
  power: supply: act8945a_charger: Fix the power supply type
  power: supply: act8945a_charger: Add status change update support
  power: supply: act8945a_charger: Improve state handling
  power: supply: act8945a_charger: Remove "battery_temperature"
  ...
2016-10-06 18:21:15 -07:00
Matt Ranostay 1d72706f04 power: supply: bq27xxx_battery: allow kernel poll_interval parameter runtime update
Fix issue with poll_interval being not updated till the previous
interval expired.

Cc: Tony Lindgren <tony@atomide.com>
Cc: Liam Breck <liam@networkimprov.net>
Signed-off-by: Matt Ranostay <matt@ranostay.consulting>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-21 02:08:04 +02:00
Phil Reid 389958bb6b power: supply: sbs-battery: Cleanup removal of chip->pdata
There where still a few lingering references to pdata after commit
power: supply: sbs-battery: simplify DT parsing.

Remove pdata from struct·sbs_info and conditional checks to ser if this
was set from the i2c read / write functions.
Instead of call max in each function for incrementing poll_retry_count
do it once in the probe function.
Fixup null pointer dereference in to pdata in sbs_external_power_changed.
Change retry counts to u32 to avoid need for max.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-21 02:04:47 +02:00
Peter Griffin 8ad5d85efd power: reset: st-poweroff: Remove obsolete platforms.
This patch removes support for STiH415/6 SoC's from the
st-poweroff driver, as support for these platforms is
being removed from the kernel.

Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
Cc: <linux-pm@vger.kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:32:22 +02:00
Arvind Yadav 7531be5cdf power: reset: zx-reboot: Unmap region obtained by of_iomap
Free memory mapping, if probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:25:41 +02:00
Arvind Yadav 896af83ef6 power: reset: xgene-reboot: Unmap region obtained by of_iomap
Free memory mapping, if probe is not successful.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:24:06 +02:00
Masahiro Yamada f04f7aef7f power: supply: ab8500: cleanup with list_first_entry_or_null()
The combo of list_empty() check and return list_first_entry()
can be replaced with list_first_entry_or_null().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:22:10 +02:00
Colin Ian King 1dff6ce026 power: reset: add in missing white space in error message text
A dev_err message spans two lines and the literal string is missing
a white space between words. Add the white space.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:19:46 +02:00
Guenter Roeck 17c6d3979e sbs-battery: make writes to ManufacturerAccess optional
According to the Smart Battery Data Specification, the use
of ManufacturerAcess (register 0x0) is implementation-defined.
It appears that some batteries use writes to this register
in order to implement certain functionality, but others may
simply NAK all writes to it. As a result, write failures to
ManufacturerAccess should not be used as an indicator of
battery presence, nor as a failure to enter sleep mode.

The failed write access was seen with SANYO AP13J3K.

Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 21:02:17 +02:00
Georges Savoundararadj 0610735928 power: bq24257: Fix use of uninitialized pointer bq->charger
bq->charger is initialized in bq24257_power_supply_init.
Therefore, bq24257_power_supply_init should be called before the
registration of the IRQ handler bq24257_irq_handler_thread that calls
power_supply_changed(bq->charger).

Signed-off-by: Georges Savoundararadj <savoundg@gmail.com>
Cc: Aurelien Chanot <chanot.a@gmail.com>
Cc: Andreas Dannenberg <dannenberg@ti.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: David Woodhouse <dwmw2@infradead.org>
Fixes: 2219a93596 ("power_supply: Add TI BQ24257 charger driver")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-19 20:56:22 +02:00
Joe Perches e2cdeaa123 PM / AVS: SmartReflex: Neaten logging
Use a more common logging style.

Miscellanea:

o Use pr_warn
o Coalesce formats adding missing spaces
o Argument alignment
o Remove unnecessary OOM messages as k.alloc does stack dumps

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Nishanth Menon <nm@ti.com>
[khilman: update shortlog]
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-09-13 02:43:05 +02:00
Arnd Bergmann 9edeaada19 power: supply: sbs-battery: simplify DT parsing
After the change to use the gpio descriptor interface, we get a warning if
-Wmaybe-uninitialized is added back to the build flags (it is currently
disabled:

drivers/power/supply/sbs-battery.c: In function 'sbs_probe':
drivers/power/supply/sbs-battery.c:760:28: error: 'pdata' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The problem is that if neither the DT properties nor a platform_data
pointer are provided, the chip->pdata pointer gets set to an uninitialized
value.

Looking at the code some more, I found that the sbs_of_populate_pdata
function is more complex than necessary and has confusing calling
conventions of possibly returning a valid pointer, a NULL pointer
or an ERR_PTR pointer (in addition to the uninitialized pointer).

To fix all of that, this gets rid of the chip->pdata pointer and
simply moves the two integers into the sbs_info structure. This
makes it much clearer from reading sbs_probe() what the precedence
of the three possible values are (pdata, DT, hardcoded defaults)
and completely avoids the #ifdef CONFIG_OF guards as
of_property_read_u32() gets replaced with a compile-time stub
when that is disabled, and returns an error if passed a NULL of_node
pointer.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 3b5dd3a494 ("power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-07 01:46:59 +02:00
Paul Kocialkowski c65a8b5112 power: supply: bq24735-charger: Request status GPIO with initial input setup
This requests the status GPIO with initial input setup. It is required
to read the GPIO status at probe time and thus correctly avoid sending
I2C messages when AC is not plugged.

When requesting the GPIO without initial input setup, it always reads 0
which causes probe to fail as it assumes the charger is connected, sends
I2C messages and fails.

While at it, this switches the driver over to gpiod API.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-05 12:59:49 +02:00
Phil Reid 3b5dd3a494 power: supply: sbs-battery: Use gpio_desc and sleeping calls for battery detect
Switch to using new gpio_desc interface and devm gpio get calls to
automatically manage gpio resource. Use gpiod_get_value which handles
active high / low calls.

If gpio_detect is set then force loading of the driver as it is
reasonable to assume that the battery may not be present.

Update the is_present flag immediately in the IRQ.

Remove legacy gpio specification from platform data.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-01 16:06:14 +02:00
Wenyou Yang 528e350412 power: supply: act8945a_charger: Add max current property
Add the power supply's current max property,
POWER_SUPPLY_PROP_CURRENT_MAX.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-01 13:55:55 +02:00
Wenyou Yang 369eba0986 power: supply: act8945a_charger: Add capacity level property
Add the power supply capacity level property, it corresponds to
POWER_SUPPLY_CAPACITY_LEVEL_*.

It also utilizes the precision voltage detector function module
to catch the low battery voltage.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-09-01 13:55:52 +02:00
Wenyou Yang 10ca08b07b power: supply: act8945a_charger: Fix the power supply type
The power supply type property is varying as the external power
supply changes. It is not a constant.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-31 16:47:01 +02:00
Wenyou Yang a09209acd6 power: supply: act8945a_charger: Add status change update support
Add the charger status change interrupt support, it will report
the power supply changed event.

This interrupt is generated by one of the conditions as below:
 - the state machine jumps out of or into the EOC state
 - the CHGIN input voltage goes out of or into the valid range.
 - the battery temperature goes out of or into the valid range.
 - the PRECHARGE time-out occurs.
 - the total charge time-out occurs.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-31 16:46:57 +02:00
Wenyou Yang 1f0ba4067a power: supply: act8945a_charger: Improve state handling
When get the property, first check the charger state machine,
then check the status bit to decide what value is assigned to
the corresponding property.

Retain the SUSCHG bit of REG 0x71 when configure the timers to
avoid losting the charger suspending info after boot.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-31 16:46:54 +02:00
Wenyou Yang 6b021fc910 power: supply: act8945a_charger: Remove "battery_temperature"
Remove "battery_temperature" member, it is redundant, it is the
hardware's responsibility to handle TH pin properly.
It is unnecessary to use the dt property to check if there is
a battery temperature monitor or not.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-31 16:46:50 +02:00
Wenyou Yang 5da643b26d power: supply: act8945a_charger: Achieve properties from its node
Since the act8945a_charger is regarded as a sub-device, all properties will
be assigned to its own device node. All properties can be achieved from its
own node, instead of from its parent device.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-31 16:46:43 +02:00
Paul Kocialkowski ae0f74be6e power: bq24735-charger: Assume not charging when charger is missing
When the charger is missing (disconnected), it is safe to assume that
the charger chip is no charging.

This is especially relevant when a status GPIO is present and the
charger is getting disconnected. bq24735_charger_is_charging will be
triggered due to the interrupt then, it will attempt to read whether it
is charging through i2c, which will fail as the charger is disconnected.

This also fixes that specific issue.

Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-29 02:39:06 +02:00
Krzysztof Kozlowski 1c4593edbd power: supply: Change Krzysztof Kozlowski's email to kernel.org
Change my email address to kernel.org instead of Samsung one for the
purpose of any future contact. The copyrights remain untouched and are
attributed to Samsung.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-17 14:15:58 +02:00
Sebastian Reichel f7c8f1de03 Power Supply Fixes for 4.8 cycle
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJXsk2BAAoJENju1/PIO/qa0E4P/0rsS4Kzv+B61BJsoCIoXYOp
 p347gy6fS7QEJxSlHG430uVV74zlXQE3JTiBrjIdX2TKRA6EvD0RyM3/h+vfQU1c
 GviBJ53UwNlq1bBuJD1jkIHCvIW274FjX1h45Tytuzsi/8rLWas15oumnRFuOtyA
 UtgTbPtualYab01XgQyivv/dY4Dfb3d0aNPl3Nq77hAJMTVc9s1DLVqRMudqc0Zc
 e489mw+8l31L2pJs7CPxzNXqlS4YvMz4/mwbGCsqtEJTNHyzyrVH5VfCpMUNfGr4
 rZdqtF/nj/9c/DTIO6GvhoOVjja4MCEf3WpGCxrz2KUmhvxVTeBqsPStjE1xnC8u
 rNDDpRAwtjgpiw8fiEw+CXB5XsDMPmMSJi1KaOLz1q9O2GxHzoz2tgfjCh9V73qj
 J5pq1cQY2V6AkB+10WQ7afCnN3Zn2qDUoWXj2cvkd8yuvyfjTuC53Gd1sGpNk1dj
 f+euFLm6YYMvLv37vDCQDaxvzmud1Z60bgJy/uvbaVhcCABLUdbfwJpRf/3tWjp3
 rU3Lw43p5MPfBWHkZrzpQO33GEzO6FSrIkTr3YfVJiwAoViXgt5WEknbVde/pZDz
 Acn8UTE+6KeLrmrwA66pF++ewKjA7GgUzW50Ubju15rWujnwu5QVg/T+UVpGrB4k
 OYmwCtd5i2/OjnC+APnK
 =hK7R
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.8-rc' into psy-next

Power Supply Fixes for 4.8 cycle
2016-08-16 01:17:42 +02:00
Bhaktipriya Shridhar b732ace40a power: ds2760_battery: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.

The workqueue "monitor_wqueue" is used to monitor the battery
status. It has been identity converted.

It queues multiple work items viz &di->monitor_work,
&di->set_charged_work, which require execution ordering.
Hence, alloc_workqueue has been used to replace the
deprecated create_singlethread_workqueue instance.

WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Bhaktipriya Shridhar 1c53f3709c power: ab8500_fg: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.

The workqueue "fg_wq" is used for running the FG algorithm periodically.
It has been identity converted.

It has multiple work items viz fg_periodic_work, fg_low_bat_work,
fg_reinit_work, fg_work, fg_acc_cur_work and fg_check_hw_failure_work,
which require execution ordering. Hence, a dedicated ordered workqueue
has been used here.

The WQ_MEM_RECLAIM flag has been set to guarantee forward progress under
memory pressure.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Bhaktipriya Shridhar 829f0e97cc power: ipaq_micro_battery: Remove deprecated create_singlethread_workqueue
The workqueue "wq" is used for handling battery related tasks.

It has a single work item viz &mb->update and hence it doesn't require
execution ordering. Hence, alloc_workqueue has been used to replace the
deprecated create_singlethread_workqueue instance.

The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.

Since there is a single work item, explicit concurrency
limit is unnecessary here.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Bhaktipriya Shridhar 9df8262826 power: ab8500_charger: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.

The workqueue "charger_wq" is used for the IRQs and checking HW state of
the charger. It has been identity converted.

It has multiple work items viz usb_charger_attached_work, kick_wd_work,
check_vbat_work, check_hw_failure_work, usb_charger_attached_work,
ac_work, ac_charger_attached_work, attach_work and check_usbchgnotok_work,
which require execution ordering. Hence, a dedicated ordered workqueue
has been used here.

The WQ_MEM_RECLAIM flag has also been set to ensure
forward progress under memory pressure.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Bhaktipriya Shridhar 87f818b35c power: intel_mid_battery: Remove deprecated create_singlethread_workqueue
The workqueue "monitor_wqueue" is used to monitor the PMIC battery status.
It queues a single work item (pbi->monitor_battery) and hence doesn't
require ordering. Hence, alloc_workqueue has been used to replace the
deprecated create_singlethread_workqueue instance.

Since PMIC battery status needs to be monitored for any change, the
WQ_MEM_RECLAIM flag has been set to ensure forward progress under memory
pressure.

Since there is a single work item, explicit concurrency
limit is unnecessary here.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Bhaktipriya Shridhar d8a69251fb power: pm2301_charger: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.

The workqueue "charger_wq" is used for running all the charger related
tasks. This involves charger detection, checking for HW failure and HW
status. This workqueue has been identity converted.

It queues multiple workitems viz &pm2->check_main_thermal_prot_work,
&pm2->check_hw_failure_work, &pm2->ac_work. Hence, the deprecated
create_singlethread_workqueue() instance has been replaced with a
dedicated ordered workqueue.

The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Bhaktipriya Shridhar a8dd5b6868 power: ab8500_btemp: Remove deprecated create_singlethread_workqueue
The workqueue "btemp_wq" is used for measuring the temperature
periodically. It queues a single workitem (btemp_periodic_work) and
hence doesn't require ordering. Thus, the deprecated
create_singlethread_workqueue() instance has been replaced with
alloc_workqueue().

The WQ_MEM_RECLAIM flag has been set to ensure forward progress under
memory pressure.

Since there is a single work item, explicit concurrency
limit is unnecessary here.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Bhaktipriya Shridhar 0b9992f76f power: abx500_chargalg: Remove deprecated create_singlethread_workqueue
alloc_ordered_workqueue() with WQ_MEM_RECLAIM set replaces
deprecated create_singlethread_workqueue(). This is the identity
conversion.

The workqueue "chargalg_wq" is used for running the charging algorithm.
It has multiple workitems viz &di->chargalg_periodic_work,
&di->chargalg_wd_work, &di->chargalg_work per abx500_chargalg, which
require ordering. It has been identity converted.

Also, WQ_MEM_RECLAIM has been set to ensure forward progress under
memory pressure.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:54:37 +02:00
Wei Yongjun 2ee565c934 power: axp288_charger: remove duplicated include from axp288_charger.c
Remove duplicated include.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:36:37 +02:00
Wei Yongjun ad7656c75f power: axp288_fuel_gauge: remove duplicated include from axp288_fuel_gauge.c
Remove duplicated include.

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Acked-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:36:27 +02:00
Wei Yongjun 1bbd3d2825 power: z2_battery: remove .owner field for driver
Remove .owner field if calls are used which set it automatically.

Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:36:06 +02:00
Bjorn Andersson 8dfdd2a842 power: reset: syscon-reboot-mode: Use managed resource API
Use the managed resource version of reboot_mode_register().

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:29:34 +02:00
Bjorn Andersson c1a9634f1a power: reset: reboot-mode: Add managed resource API
Provide managed resource version of reboot_mode_register() and
reboot_mode_unregister() to simplify implementations.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-16 00:29:22 +02:00
Joshua Clayton 957cb72051 sbs-battery: add ability to get battery capacity
Battery capacity level is a standard feature of sbs battery
That can be used to tell what the remainig battery capacity is, and
can tell if the battery has not been calibrated/initialized, which makes
the capacity and charging/discharging percentages invalid.

Signed-off-by: Joshua Clayton <stillcompiling@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-15 23:14:55 +02:00
Wei Yongjun 33e7664a0a power_supply: tps65217-charger: fix missing platform_set_drvdata()
Add missing platform_set_drvdata() in tps65217_charger_probe(), otherwise
calling platform_get_drvdata() in remove returns NULL.

This is detected by Coccinelle semantic patch.

Fixes: 3636859b28 ("power_supply: Add support for tps65217-charger")
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-15 23:10:44 +02:00
Phil Reid 492ff9d8f5 power: sbs-battery: Use devm_power_supply_register
Use devm_power_supply_register instead of power_supply_register.
Remove call to power_supply_unregister.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-15 21:51:30 +02:00
Phil Reid d2cec82c28 power: sbs-battery: Request threaded irq and fix dev callback cookie
Currently the battery detect gpio can not be used with a chained interrupt
controller that requires threaded irq handlers. Use threaded irq instead.
In addition this was not going to be working at present because
chip->power_supply is assigned after the request irq call.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-15 21:51:30 +02:00
Phil Reid 9239a86f09 power: sbs-battery: Use devm_kzalloc to alloc data
Use devm_kzalloc to allow memory to be freed automatically on
driver probe failure or removal.

Signed-off-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-15 21:51:30 +02:00
H. Nikolaus Schaller e4a404a081 power:bq27xxx: 27000/10 read FLAGS register as single
The bq27000 and bq27010 have a single byte FLAGS register.
Other gauges have 16 bit FLAGS registers.

For reading the FLAGS register it is sufficient to read the single
register instead of reading RSOC at the next higher address as
well and then ignore the high byte.

This does not change functionality but optimizes i2c and hdq
traffic.

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-15 21:26:52 +02:00
Marcin Niestroj 47d7d5ed68 power_supply: tps65217-charger: Add support for IRQs
Make use of IRQ resources defined in tps65217 mfd code. If they are valid
we use them instead separate poll task, in order to define AC power state.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-15 21:25:02 +02:00
Arvind Yadav bae170efd6 power: reset: hisi-reboot: Unmap region obtained by of_iomap
Free memory mapping, if probe is not successful.

Fixes: 4a9b373718 ("power: reset: move hisilicon reboot code")
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-12 22:42:37 +02:00
Andy Yan 7a4947cf6f power: reset: reboot-mode: fix build error of missing ioremap/iounmap on UM
commit 4fcd504edb ("power: reset: add reboot mode driver") uses api from
syscon, and syscon uses ioremap/iounmap which depends on HAS_IOMEM, so
let's depend on MFD_SYSCON instead of selecting it directly to avoid the
um-allyesconfig like build error on archs that without iomem:

drivers/mfd/syscon.c: In function 'of_syscon_register':
drivers/mfd/syscon.c:67:9: error: implicit declaration of function 'ioremap' [-Werror=implicit-function-declaration]
  base = ioremap(res.start, resource_size(&res));
         ^
drivers/mfd/syscon.c:67:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  base = ioremap(res.start, resource_size(&res));
       ^
drivers/mfd/syscon.c:109:2: error: implicit declaration of function 'iounmap' [-Werror=implicit-function-declaration]
  iounmap(base);
  ^

Reported-by: Kbuild test robot <fengguang.wu@intel.com>
Fixes: 4fcd504edbf7("power: reset: add reboot mode driver")
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-12 22:42:36 +02:00
Sven Van Asbroeck 5381cfb6f0 power: supply: max17042_battery: fix model download bug.
The device's model download function returns the model data as
an array of u32s, which is later compared to the reference
model data. However, since the latter is an array of u16s,
the comparison does not happen correctly, and model verification
fails. This in turn breaks the POR initialization sequence.

Fixes: 39e7213edc ("max17042_battery: Support regmap to access device's registers")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sven Van Asbroeck <TheSven73@googlemail.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-12 22:42:25 +02:00
Sebastian Reichel 8c0984e5a7 power: move power supply drivers to power/supply
This moves all power supply drivers from drivers/power/
to drivers/power/supply/. The intention is a cleaner
source tree, since drivers/power/ also contains frameworks
unrelated to power supply, like adaptive voltage scaling.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-08-11 01:11:03 +02:00
Linus Torvalds 43a0a98aa8 ARM: SoC driver updates for v4.8
Driver updates for ARM SoCs.
 
 A slew of changes this release cycle. The reset driver tree, that we merge
 through arm-soc for historical reasons, is also sizable this time around.
 
 Among the changes:
 
  - clps711x: Treewide changes to compatible strings, merged here for simplicity.
  - Qualcomm: SCM firmware driver cleanups, move to platform driver
  - ux500: Major cleanups, removal of old mach-specific infrastructure.
  - Atmel external bus memory driver
  - Move of brcmstb platform to the rest of bcm
  - PMC driver updates for tegra, various fixes and improvements
  - Samsung platform driver updates to support 64-bit Exynos platforms
  - Reset controller cleanups moving to devm_reset_controller_register() APIs
  - Reset controller driver for Amlogic Meson
  - Reset controller driver for Hisilicon hi6220
  - ARM SCPI power domain support
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXnm1XAAoJEIwa5zzehBx35lcP/ApuQarIXeZCQZtjlUBV9McW
 o3o7FhKFHePmEPeoYCvVeK5D8NykTkQv3WpnCknoxPJzxGJF7jbPWQJcVnXfKOXD
 kTcyIK15WL2HHtSE3lYyLfyUPz8AbJyRt0l0cxgcg6jvo+uzlWooNz1y78rLIYzg
 UwRssj7OiHv4dsyYRHZIsjnB8gMWw8rYMk154gP2xy6MnNXXzzOVVnOiVqxSZBm+
 EgIIcROMOqkkHuFlClMYKluIgrmgz1Ypjf+FuAg7dqXZd+TGRrmGXeI7SkGThfLu
 nyvY3N18NViNu7xOUkI9zg7+ifyYM8Si9ylalSICSJdIAxZfiwFqFaLJvVWKU1rY
 rBOBjKckQI0/X9WYusFNFHcijhIFV8/FgGAnVRRMPdvlCss7Zp03C9mR4AEhmKMX
 rLG49x81hU1C+LftC59ml3iB8dhZrrRkbxNHjLFHVGWNrKMrmJKa8JhXGRAoNM+u
 LRauiuJZatqvLfISNvpfcoW2EashVoU3f+uC8ymT3QCyME3wZm0t7T4tllxhMfBl
 sOgJqNkTKDmPLofwm/dASiLML7ZF1WePScrFyOACnj9K4mUD+OaCnowtWoQPu0eI
 aNmT84oosJ2S9F/iUDPtFHXdzQ+1QPPfSiQ9FXMoauciVq/2F+pqq68yYgqoxFOG
 vmkmG2YM4Wyq43u0BONR
 =O8+y
 -----END PGP SIGNATURE-----

Merge tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC driver updates from Olof Johansson:
 "Driver updates for ARM SoCs.

  A slew of changes this release cycle.  The reset driver tree, that we
  merge through arm-soc for historical reasons, is also sizable this
  time around.

  Among the changes:

   - clps711x: Treewide changes to compatible strings, merged here for simplicity.
   - Qualcomm: SCM firmware driver cleanups, move to platform driver
   - ux500: Major cleanups, removal of old mach-specific infrastructure.
   - Atmel external bus memory driver
   - Move of brcmstb platform to the rest of bcm
   - PMC driver updates for tegra, various fixes and improvements
   - Samsung platform driver updates to support 64-bit Exynos platforms
   - Reset controller cleanups moving to devm_reset_controller_register() APIs
   - Reset controller driver for Amlogic Meson
   - Reset controller driver for Hisilicon hi6220
   - ARM SCPI power domain support"

* tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (100 commits)
  ARM: ux500: consolidate base platform files
  ARM: ux500: move soc_id driver to drivers/soc
  ARM: ux500: call ux500_setup_id later
  ARM: ux500: consolidate soc_device code in id.c
  ARM: ux500: remove cpu_is_u* helpers
  ARM: ux500: use CLK_OF_DECLARE()
  ARM: ux500: move l2x0 init to .init_irq
  mfd: db8500 stop passing around platform data
  ASoC: ab8500-codec: remove platform data based probe
  ARM: ux500: move ab8500_regulator_plat_data into driver
  ARM: ux500: remove unused regulator data
  soc: raspberrypi-power: add CONFIG_OF dependency
  firmware: scpi: add CONFIG_OF dependency
  video: clps711x-fb: Changing the compatibility string to match with the smallest supported chip
  input: clps711x-keypad: Changing the compatibility string to match with the smallest supported chip
  pwm: clps711x: Changing the compatibility string to match with the smallest supported chip
  serial: clps711x: Changing the compatibility string to match with the smallest supported chip
  irqchip: clps711x: Changing the compatibility string to match with the smallest supported chip
  clocksource: clps711x: Changing the compatibility string to match with the smallest supported chip
  clk: clps711x: Changing the compatibility string to match with the smallest supported chip
  ...
2016-08-01 18:36:01 -04:00
Linus Torvalds 6f888fe31d ARM: SoC cleanups for v4.8
The cleanup branch keeps going down in size as we've completed a lot of
 the major legacy platform removals and conversions.
 
 A handful of changes this time around, some of the themes or larger sets are:
 
  - A bunch of i.MX cleanups around platform detection, init call cleanups
  - Misc fixes of missing/implicit includes
  - Removal of ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJXnnwFAAoJEIwa5zzehBx3zXQP/2a/+XkiseeGkEoiX/6FOfhH
 XTzipye0OYdEe3kVWFL1sVVXRH6a5sbDJRNtfsQc+KdSG5i7LMHWARRJmIx9CTMB
 oQ9pEbYKSyBQDHBSOZYT6W+qYOI2SdTYqesjd3yn+FY4SIFBpQ/V3axHnMICIRm9
 PmHF1QUQEdtQ2Y9+E1vA1mHcPN9enjlesD3VdRbxVPX/PZw63kx9y8ICVq5I/PX9
 DfJRcA+PKIYQghhEZ0cx2bEoKozv7W088C7DD1Umw1NN18pMuvvNQGhid80xUqKY
 4bmLSGWqwmSzv1WZ/u1pUnBGGQE9YY1U2b8kZy8hSVg9rupxS8Ang0ztZRRE6nk2
 4t8GmWuLDH+7PxFv/skzi1AMAx+4KxSfp3N5qyKr8ddmnYrFWmBPj2AeBqrlziw6
 8Z41LQULmf/Gs6McikGUP7ryqd15gNtTJO1wlavqFrPe0fyzcHsgqpIy3YCqZiSE
 wQ4Hc036xqGknmg6GjHWp+W1rHZVGsnXmvnp1IVRoAGqwBqxNi4ItIXE7an8144H
 NnWFmPRSsGg26MfEJVsbtPQWNtEGqM2lgr6zn9xirC0cVbQ4ZDtWp2q0bJ1v/cLQ
 sW6Gu6jgVN8YUPp56lBaXJ5RxHE9V1Sqi4/+KghBKWW0X/BIo99b6PVr2bJRrkaq
 ZvpvsgzbCHdGqTptF9Dw
 =SfR/
 -----END PGP SIGNATURE-----

Merge tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC cleanups from Olof Johansson:
 "The cleanup branch keeps going down in size as we've completed a lot
  of the major legacy platform removals and conversions.

  A handful of changes this time around, some of the themes or larger
  sets are:

   - A bunch of i.MX cleanups around platform detection, init call cleanups
   - Misc fixes of missing/implicit includes
   - Removal of ARCH_[WANT_OPTIONAL|REQUIRE]_GPIOLIB"

* tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (40 commits)
  ARM: mps2: fix typo
  ARM: s3c64xx: avoid warning about 'struct device_node'
  bus: mvebu-mbus: make mvebu_mbus_syscore_ops static
  bus: mvebu-mbus: fix __iomem on register pointers
  ARM: tegra: Remove board_init_funcs array
  ARM: iop: Fix indentation
  ARM: imx: remove cpu_is_mx*()
  ARM: imx: remove last call to cpu_is_mx5*
  ARM: imx: rework mx27_pm_init() call
  ARM: imx: deconstruct mx3_idle
  ARM: imx: deconstruct mxc_rnga initialization
  ARM: imx: remove cpu_is_mx1 check
  ARM: i.MX: Do not explicitly call l2x0_of_init()
  ARM: i.MX: system.c: Tweak prefetch settings for performance
  ARM: i.MX: system.c: Replace magic numbers
  ARM: i.MX: system.c: Remove redundant errata 752271 code
  ARM: i.MX: system.c: Convert goto to if statement
  ARM: Kirkwood: fix kirkwood_pm_init() declaration/type
  ARM: Kirkwood: make kirkwood_disable_mbus_error_propagation() static
  ARM: orion5x: make orion5x_legacy_handle_irq static
  ...
2016-08-01 18:21:13 -04:00
Linus Torvalds f7816ad0f8 power supply and reset changes for the v4.8 series
* introduce reboot mode driver
  * add DT support to max8903
  * add power supply support for axp221
  * misc. fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJXlm+bAAoJENju1/PIO/qaHCsP/0bwvb3PlvPozVs7iXba4hbK
 It6RxQDHl9Q0tvsgRitqoibomBlGqdMXADwr2yXsio255IYqNTKErJasiOn0KkO6
 Wuoo9FSiZV6KL1JMBvZOgMydK/x8q2yBKKJKm9JG9srLueJWuZa/4BqOWS4JSFJ6
 xlevxxA0XqUzWr6VUXFRTd/YXa0OaRDHaG9JN1NN8qvJWvvYZJLhpDzWdDu83KzU
 CPEP7g8UeOFLylcmjeHgT9rJuiHbd6UCr4yKjFqLvM6uM9SY/Uinz62u4tKL5zcp
 /9V4oo8/9RjJnG/gkm4ozAL2Rb1fpeajTZivUX3t+CiEV4Nc8xiQMCMDI2nKSqr4
 IF9nghYub+q6q7EfonWZ22Aa6VhGdI6ToG5iK3euag2vkypLYe9GD1tPyAnnxx1o
 xlnziiveGKcKwSIY3tTOFVAoGqhCWIpM06ZC7/Y9HvM6EPhAr4q4Pq1xNFwr0Rrs
 OoEobm5cRB7IUtu2Gl0GU/Ku5mDoen2LvSVzIjF36/aGN+atpd7Tkoam7LBtedZA
 aqsEV/qMfgsIUYWj5/lmLZOQuG6viEou/BWvQz8cczA0U2mFDcgY6UCLMwVeJ7sj
 ZT+1uVoupcO5UNEULwdzufUmaC0ze7HrGNeXZZwt5S1IWqNsRg71FzqFYYaIwZGy
 Rnt3P3tSqhxZrz1xeZ6r
 =bMvA
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 - introduce reboot mode driver
 - add DT support to max8903
 - add power supply support for axp221
 - misc fixes

* tag 'for-v4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  power: reset: add reboot mode driver
  dt-bindings: power: reset: add document for reboot-mode driver
  power_supply: fix return value of get_property
  power: qcom_smbb: Make an extcon for usb cable detection
  max8903: adds support for initiation via device tree
  max8903: adds documentation for device tree bindings.
  max8903: remove unnecessary 'out of memory' error message.
  max8903: removes non zero validity checks on gpios.
  max8903: adds requesting of gpios.
  max8903: cleans up confusing relationship between dc_valid, dok and dcm.
  max8903: store pointer to pdata instead of copying it.
  power_supply: bq27xxx_battery: Group register mappings into one table
  docs: Move brcm,bcm21664-resetmgr.txt
  power/reset: make syscon_poweroff() static
  power: axp20x_usb: Add support for usb power-supply on axp22x pmics
  power_supply: bq27xxx_battery: Index register numbers by enum
  power_supply: bq27xxx_battery: Fix copy/paste error in header comment
  MAINTAINERS: Add file patterns for power supply device tree bindings
  power: reset: keystone: Enable COMPILE_TEST
2016-07-26 19:49:09 -07:00
Linus Torvalds 55392c4c06 Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer updates from Thomas Gleixner:
 "This update provides the following changes:

   - The rework of the timer wheel which addresses the shortcomings of
     the current wheel (cascading, slow search for next expiring timer,
     etc).  That's the first major change of the wheel in almost 20
     years since Finn implemted it.

   - A large overhaul of the clocksource drivers init functions to
     consolidate the Device Tree initialization

   - Some more Y2038 updates

   - A capability fix for timerfd

   - Yet another clock chip driver

   - The usual pile of updates, comment improvements all over the place"

* 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (130 commits)
  tick/nohz: Optimize nohz idle enter
  clockevents: Make clockevents_subsys static
  clocksource/drivers/time-armada-370-xp: Fix return value check
  timers: Implement optimization for same expiry time in mod_timer()
  timers: Split out index calculation
  timers: Only wake softirq if necessary
  timers: Forward the wheel clock whenever possible
  timers/nohz: Remove pointless tick_nohz_kick_tick() function
  timers: Optimize collect_expired_timers() for NOHZ
  timers: Move __run_timers() function
  timers: Remove set_timer_slack() leftovers
  timers: Switch to a non-cascading wheel
  timers: Reduce the CPU index space to 256k
  timers: Give a few structs and members proper names
  hlist: Add hlist_is_singular_node() helper
  signals: Use hrtimer for sigtimedwait()
  timers: Remove the deprecated mod_timer_pinned() API
  timers, net/ipv4/inet: Initialize connection request timers as pinned
  timers, drivers/tty/mips_ejtag: Initialize the poll timer as pinned
  timers, drivers/tty/metag_da: Initialize the poll timer as pinned
  ...
2016-07-25 20:43:12 -07:00
Linus Torvalds b7545b79a1 USB update for 4.8-rc1
Here's the big USB driver update for 4.8-rc1.  Lots of the normal stuff
 in here, musb, gadget, xhci, and other updates and fixes.  All of the
 details are in the shortlog.
 
 All of these have been in linux-next for a while with no reported
 issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iFYEABECABYFAleVPioPHGdyZWdAa3JvYWguY29tAAoJEDFH1A3bLfspB5AAnj7a
 VJ2t2kcWzFUNQ6dyJrJCGGRAAKDZmb5CnOGeqJmdVpDzN1CGLYjfiw==
 =47iA
 -----END PGP SIGNATURE-----

Merge tag 'usb-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB updates from Greg KH:
 "Here's the big USB driver update for 4.8-rc1.  Lots of the normal
  stuff in here, musb, gadget, xhci, and other updates and fixes.  All
  of the details are in the shortlog.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'usb-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (169 commits)
  cdc-acm: beautify probe()
  cdc-wdm: use the common CDC parser
  cdc-acm: cleanup error handling
  cdc-acm: use the common parser
  usbnet: move the CDC parser into USB core
  usb: musb: sunxi: Simplify dr_mode handling
  usb: musb: sunxi: make unexported symbols static
  usb: musb: cppi41: add dma channel tracepoints
  usb: musb: cppi41: move struct cppi41_dma_channel to header
  usb: musb: cleanup cppi_dma header
  usb: musb: gadget: add usb-request tracepoints
  usb: musb: host: add urb tracepoints
  usb: musb: add tracepoints to dump interrupt events
  usb: musb: add tracepoints for register access
  usb: musb: dsps: use musb register read/write wrappers instead
  usb: musb: switch dev_dbg to tracepoints
  usb: musb: add tracepoints support for debugging
  usb: quirks: Add no-lpm quirk for Elan
  phy: rcar-gen3-usb2: fix mutex_lock calling in interrupt
  phy: rockhip-usb: use devm_add_action_or_reset()
  ...
2016-07-24 17:22:18 -07:00
Linus Torvalds 9d0be76f52 Char/Misc driver patches for 4.8-rc1
Here is the big char/misc driver update for 4.8-rc1.
 
 Not a lot of stuff, but it's all over the place, full details are in the
 shortlog below.  All of these have been in linux-next with no reported
 issues for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iFYEABECABYFAleVPBsPHGdyZWdAa3JvYWguY29tAAoJEDFH1A3bLfspEQgAoJOX
 nSWKA7j4JMGy1v+uNIqsgUmUAJsFyS388N+Faa2K4uyp7CYQ6jaAZw==
 =0Ofd
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver updates from Greg KH:
 "Here is the big char/misc driver update for 4.8-rc1.

  Not a lot of stuff, but it's all over the place, full details are in
  the shortlog.  All of these have been in linux-next with no reported
  issues for a while"

* tag 'char-misc-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (49 commits)
  lkdtm: silence warnings about function declarations
  lkdtm: hide unused functions
  intel_th: pci: Add Kaby Lake PCH-H support
  intel_th: Fix a deadlock in modprobing
  dsp56k: prevent a harmless underflow
  chardev: add missing line break in pr_warn
  lkdtm: use struct arrays instead of enums
  lkdtm: move jprobe entry points to start of source
  lkdtm: reorganize module paramaters
  lkdtm: rename globals for clarity
  lkdtm: rename "count" to "crash_count"
  lkdtm: remove intentional off-by-one array access
  lkdtm: split remaining logic bug tests to separate file
  lkdtm: split heap corruption tests to separate file
  lkdtm: split memory permissions tests to separate file
  lkdtm: split usercopy tests to separate file
  lkdtm: drop "alloc_size" parameter
  lkdtm: add usercopy test for blocking kernel text
  extcon: adc-jack: add suspend/resume support
  extcon: add missing of_node_put after calling of_parse_phandle
  ...
2016-07-24 16:26:26 -07:00
Thomas Gleixner 53bf837b78 timers: Remove set_timer_slack() leftovers
We now have implicit batching in the timer wheel. The slack API is no longer
used, so remove it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Andrew F. Davis <afd@ti.com>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Chris Mason <clm@fb.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: George Spelvin <linux@sciencehorizons.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Len Brown <lenb@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mathias Nyman <mathias.nyman@intel.com>
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-mmc@vger.kernel.org
Cc: linux-pm@vger.kernel.org
Cc: linux-usb@vger.kernel.org
Cc: netdev@vger.kernel.org
Cc: rt@linutronix.de
Link: http://lkml.kernel.org/r/20160704094342.189813118@linutronix.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2016-07-07 10:35:09 +02:00
Andy Yan 4fcd504edb power: reset: add reboot mode driver
This driver parses the reboot commands like "reboot bootloader"
and "reboot recovery" to get a boot mode described in the
device tree , then call the write interfae to store the boot
mode in some place like special register or sram, which can
be read by the bootloader after system reboot, then the bootloader
can take different action according to the mode stored.

This is commonly used on Android based devices, in order to
reboot the device into fastboot or recovery mode.

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>
Reviewed-by: Moritz Fischer <moritz.fischer@ettus.com>
Tested-by: John Stultz <john.stultz@linaro.org>
Acked-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-07-06 17:16:27 +02:00
Greg Kroah-Hartman c318a821b9 Merge 4.7-rc6 into usb-next
We want the USB fixes in here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-07-04 08:19:21 -07:00
Rhyland Klein e380538529 power_supply: fix return value of get_property
power_supply_get_property() should ideally return -EAGAIN if it is
called while the power_supply is being registered. There was no way
previously to determine if use_cnt == 0 meant that the power_supply
wasn't fully registered yet, or if it had already been unregistered.

Add a new boolean to the power_supply struct to simply show if
registration is completed. Lastly, modify the check in
power_supply_show_property() to also ignore -EAGAIN when so it
doesn't complain about not returning the property.

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-07-01 22:44:34 +02:00
Stephen Boyd eee1d077f0 power: qcom_smbb: Make an extcon for usb cable detection
On these PMICs the usb cable connection/disconnection is
indicated by the usb-valid interrupt being high or low
respectively. Let's make an extcon for that, so we can notify usb
drivers of the cable state.

Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-29 23:10:12 +02:00
Chris Lapa c5ed330794 max8903: adds support for initiation via device tree
Adds support for device tree to setup a max8903 battery charger. DC and USB
validity are determined by looking the presence of the dok and uok gpios.

Signed-off-by: Chris Lapa <chris@lapa.com.au>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-28 20:16:26 +02:00
Chris Lapa e6518a4325 max8903: remove unnecessary 'out of memory' error message.
Remove the 'out of memory' error message as it is printed by the core.

Signed-off-by: Chris Lapa <chris@lapa.com.au>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-28 20:05:41 +02:00
Chris Lapa 3525e5c5b3 max8903: removes non zero validity checks on gpios.
Prior to this commit a zero gpio was treated as invalid. Whereas
gpio_is_valid() will treat a zero gpio as valid.

This commit removes the confusion and explicitly uses gpio_is_valid()
throughout. Which in turn results in several of the error messages becoming
redundant and thus removed.

Signed-off-by: Chris Lapa <chris@lapa.com.au>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-28 20:05:41 +02:00
Chris Lapa 88a469bbb2 max8903: adds requesting of gpios.
This change ensures all gpios are available for the driver to use and also
splits off gpio setup into its own function for readability.

Signed-off-by: Chris Lapa <chris@lapa.com.au>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-28 20:05:41 +02:00
Chris Lapa cbf9077e58 max8903: cleans up confusing relationship between dc_valid, dok and dcm.
The max8903_charger.h file indicated that dcm and dok were not optional
when dc_valid is set.

It makes sense to have dok as a compulsory pin when dc_valid is given.
However dcm can be optionally wired to a fixed level especially when the
circuit is configured for dc power exclusively.

The previous implementation already allowed for this somewhat, however no
error was given if dok wasn't given whilst dc_valid was.

The new implementation enforces dok presence when dc_valid is given. Whilst
allowing dcm to be optional.

Signed-off-by: Chris Lapa <chris@lapa.com.au>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-28 20:05:41 +02:00
Chris Lapa 0c3ae04b00 max8903: store pointer to pdata instead of copying it.
Stores pointer to pdata because it easily allows pdata to reference
either platform data or in the future device tree data.

Signed-off-by: Chris Lapa <chris@lapa.com.au>

Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-28 20:05:41 +02:00
Sebastian Reichel 411ef2be43 Merge remote-tracking branch 'chanwoo-extcon/ib-extcon-powersupply-4.8' into psy-next 2016-06-28 19:56:54 +02:00
Felipe Balbi 5a8d651a2b usb: gadget: move gadget API functions to udc-core
instead of defining all functions as static inlines,
let's move them to udc-core and export them with
EXPORT_SYMBOL_GPL, that way we can make sure that
only GPL drivers will use them.

As a side effect, it'll be nicer to add tracepoints
to the gadget API.

While at that, also fix Kconfig dependencies to
avoid randconfig build failures.

Acked-By: Sebastian Reichel <sre@kernel.org>
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-06-21 10:38:34 +03:00
Andrew F. Davis 2e05b518c8 power_supply: bq27xxx_battery: Group register mappings into one table
Currently for each device with a unique register map we have a named
array that we then merge into a multidimensional array. Skip this
middle step and apply the register arrays directly to the multi-array.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-18 12:07:57 +02:00
Marcin Niestroj 362761299e power_supply: tps65217-charger: Fix NULL deref during property export
This bug leads to:

[    1.906411] Unable to handle kernel NULL pointer dereference at virtual address 0000000c
[    1.914878] pgd = c0004000
[    1.917786] [0000000c] *pgd=00000000
[    1.921536] Internal error: Oops: 5 [#1] SMP ARM
[    1.926357] Modules linked in:
[    1.929556] CPU: 0 PID: 14 Comm: kworker/0:1 Not tainted 4.4.5 #18
[    1.936006] Hardware name: Generic AM33XX (Flattened Device Tree)
[    1.942383] Workqueue: events power_supply_changed_work
[    1.947842] task: de2c41c0 ti: de2c8000 task.ti: de2c8000
[    1.953483] PC is at tps65217_ac_get_property+0x14/0x28
[    1.958937] LR is at tps65217_ac_get_property+0x10/0x28

Driver was trying to use drv_data in property get handler. However drv_data
was not set, so it caused NULL pointer dereference. This patch properly
sets drv_data during probe by power_supply_config parameter, so the
property get handler works as desired.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
Fixes: 3636859b28 ("power_supply: Add support for tps65217-charger")
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-16 15:54:11 +02:00
Rhyland Klein 5bc28b93a3 power_supply: power_supply_read_temp only if use_cnt > 0
Change power_supply_read_temp() to use power_supply_get_property()
so that it will check the use_cnt and ensure it is > 0. The use_cnt
will be incremented at the end of __power_supply_register, so this
will block to case where get_property can be called before the supply
is fully registered. This fixes the issue show in the stack below:

[    1.452598] power_supply_read_temp+0x78/0x80
[    1.458680] thermal_zone_get_temp+0x5c/0x11c
[    1.464765] thermal_zone_device_update+0x34/0xb4
[    1.471195] thermal_zone_device_register+0x87c/0x8cc
[    1.477974] __power_supply_register+0x364/0x424
[    1.484317] power_supply_register_no_ws+0x10/0x18
[    1.490833] bq27xxx_battery_setup+0x10c/0x164
[    1.497003] bq27xxx_battery_i2c_probe+0xd0/0x1b0
[    1.503435] i2c_device_probe+0x174/0x240
[    1.509172] driver_probe_device+0x1fc/0x29c
[    1.515167] __driver_attach+0xa4/0xa8
[    1.520643] bus_for_each_dev+0x58/0x98
[    1.526204] driver_attach+0x20/0x28
[    1.531505] bus_add_driver+0x1c8/0x22c
[    1.537067] driver_register+0x68/0x108
[    1.542630] i2c_register_driver+0x38/0x7c
[    1.548457] bq27xxx_battery_i2c_driver_init+0x18/0x20
[    1.555321] do_one_initcall+0x38/0x12c
[    1.560886] kernel_init_freeable+0x148/0x1ec
[    1.566972] kernel_init+0x10/0xfc
[    1.572101] ret_from_fork+0x10/0x40

Also make the same change to ps_get_max_charge_cntl_limit() and
ps_get_cur_chrage_cntl_limit() to be safe. Lastly, change the return
value of power_supply_get_property() to -EAGAIN from -ENODEV if
use_cnt <= 0.

Fixes: 297d716f62 ("power_supply: Change ownership from driver to core")
Cc: stable@vger.kernel.org
Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-14 19:25:48 +02:00
Ben Dooks 0a14d280e1 power: vexpress: make dev_attr_active static
The dev_attr_active is not exported or defined to be used
outside the driver, so make it static to avoid the following
warning:

drivers/power/reset/vexpress-poweroff.c:77:1: warning: symbol 'dev_attr_active' was not declared. Should it be static?

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
2016-06-13 09:55:51 +01:00
Chanwoo Choi b396cff519 power: axp288_charger: Replace deprecatd API of extcon
This patch removes the deprecated notifier API of extcon framework and then use
the new extcon API[2] with the unique id[1] to indicate the each external
connector. Alter deprecated API as following:
- extcon_register_interest() -> extcon_register_notifier()
- extcon_unregister_interest() -> extcon_unregister_notifier()
- extcon_get_cable_state() -> extcon_get_cable_state_()

And, extcon alters the name of USB charger connector in patch[3] as following:
- EXTCON_CHG_USB_SDP /* Standard Downstream Port */
- EXTCON_CHG_USB_DCP /* Dedicated Charging Port */
- EXTCON_CHG_USB_CDP /* Charging Downstream Port */
- EXTCON_CHG_USB_ACA /* Accessory Charger Adapter */

[1] Commit 2a9de9c0f0
- ("extcon: Use the unique id for external connector instead of string)
[2] Commit 046050f6e6
- ("extcon: Update the prototype of extcon_register_notifier() with enum extcon
[3] Commit 11eecf910b
- ("extcon: Modify the id and name of external connector")

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-By: Sebastian Reichel <sre@kernel.org>
2016-06-10 11:12:35 +09:00
Ben Dooks d04b674e18 power/reset: make syscon_poweroff() static
The syscon_poweroff() function is not exported or declared for
usage elsewhere, so make it static to avoid the folloiwing warning:

drivers/power/reset/syscon-poweroff.c:33:6: warning: symbol 'syscon_poweroff' was not declared. Should it be static?

Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-10 03:52:13 +02:00
Hans de Goede cecbf8d52e power: axp20x_usb: Add support for usb power-supply on axp22x pmics
The usb power-supply on the axp22x pmics is mostly identical to the
one on the axp20x pmics. One significant difference is that it cannot
measure / monitor the usb voltage / current.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-10 03:31:27 +02:00
Andrew F. Davis 5630b4334c power_supply: bq27xxx_battery: Index register numbers by enum
Currently we use tables to map from register function to register number,
these tables assume the enum used to describe the register function
and index the register number is ordered to match the enum order. Index
the register numbers by the enum instead. This also removes the need
to comment each value with its function.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-10 02:45:12 +02:00
Andrew F. Davis 5d9e01b31d power_supply: bq27xxx_battery: Fix copy/paste error in header comment
Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-10 00:19:06 +02:00
Chris Brand 783cb948d7 power: Introduce Broadcom kona reset driver
This driver supports reset on both BCM21664 and BCM23550.
Code is being moved from arch/arm/mach-bcm/board_bcm21664.c

Signed-off-by: Chris Brand <chris.brand@broadcom.com>
Acked-By: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
2016-06-06 16:17:33 -07:00
Krzysztof Kozlowski e771e0a1e4 power: reset: keystone: Enable COMPILE_TEST
Enable the COMPILE_TEST to get build coverage, except on platforms
!HAS_IOMEM (required by selected MFD_SYSCON).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-06-03 04:16:15 +02:00
Linus Torvalds 7992893c5a power supply and reset changes for the v4.7 series
* alternative reset driver for new at91 SoCs
  * misc. fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJXPypDAAoJENju1/PIO/qav7MP/3jCiRTSLHIBsUE9AHQpX2hz
 t5MoG4OrIGFfsWHzq0M0I3fMWJv8ZBZ3eltT+giBoaGb9+t01p4sYydOCEnYbZXk
 xkp0yusMe11CYUbtyYgHpJaRLz1jziuvrHVb1HW1Kj6jzFmdDG19daUbPPyxnDA5
 Qvp/5/D7vGhMjqikqFUqYWkGxot1SnQJeJ2cf5xp9WkENobGmMvLZlfxuO5ZW0ez
 LZgstS37pqlndwWfx3sdq+UDOnm5S07zGK4hCvj1Rv8a0zgMuvrrOF5vw/mBLoO/
 r/MuX0feItqFT1kf2vUtD8im/UnSJvp0MGoNI4pzQQnYH0riQavegTMXPQG3cCeG
 ikxw2+b9iUER9N8Xwa25gt4IbgYg+YsVdtU60xRb18gu1AE+wIWCMC5Otxeh2+XR
 +AZa4/8TGqAp7pcT+uPA0KuOD8KcBo08OEYEX2GBDFTgo8zd7EOxFqo2ml0v+BxG
 DqAX1VsV6v/U6VuJegCUWSH1vvdIzbe8w45M7K9JtsZomoXWHRq6ffiLs4ytur1P
 0T4wISBU8Mn98fpORFJW8E3iN0DSUrrORMwrbUgy/XmPmVAaByB2XBRQ5+yRGzyO
 lKHr68sNIOrqaXncjeLd1sWVVmaHC8VRueqMiQ/VkA+KXyb/zLeNUPP57xv6kcsD
 FJSLY6S4JC1eI+pJuaWc
 =NkO/
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:

 - alternative reset driver for new at91 SoCs

 - misc fixes

* tag 'for-v4.7' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  sbs-battery: fix power status when battery charging near dry
  power: ipaq-micro-battery: freeing the wrong variable
  power/max8925: freeing wrong variable
  power: reset: at91-shdwc: add new shutdown controller driver
  ARM: dts: at91: shdwc binding: add new shutdown controller documentation
2016-05-20 14:06:21 -07:00
Heiko Stuebner bc19b9a81d PM / AVS: rockchip-io: make io-domains a child of the GRF
IO-domain handling is part of the general register files, so should live
under the grf directly. This change allows the grf to be a simple-mfd and
the io-domains fetching the syscon regmap from that parent-node.

The old binding is of course preserved, though deprecated.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Tested-by: David Wu <david.wu@rock-chips.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-04-26 19:12:28 +02:00
YH Huang 4a99fa06a8 sbs-battery: fix power status when battery charging near dry
POWER_SUPPLY_STATUS_NOT_CHARGING is used for AC connected, but
battery not charging (e.g. because battery temperature is out
of acceptable range).

When battery is charging near dry and BATTERY_FULL_DISCHARGED is set,
it is wrong to set as POWER_SUPPLY_STATUS_NOT_CHARGING.
Just use BATTERY_DISCHARGING to decide the power supply status is
discharging or charging.

Signed-off-by: YH Huang <yh.huang@mediatek.com>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-04-10 17:22:35 +02:00
Dan Carpenter b9223da417 power: ipaq-micro-battery: freeing the wrong variable
We accidentally free "micro_ac_power" which is an error pointer and it
leads to an oops.  We intended to free "micro_batt_power".

Fixes: a2c1d53185 ('power_supply: ipaq_micro_battery: Check return values in probe')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-04-10 17:19:52 +02:00
Dan Carpenter 1285b0a30d power/max8925: freeing wrong variable
We were freeing "info->battery" instead of "info->usb", which leads to
an OOps and a resource leak.

The labels were wonky, "out_battery" did release the battery but out_usb
did not release usb.  I was introducing a call to free usb so it sort
conflicted with existing misleading name.  I renamed them.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-04-10 17:19:33 +02:00
Nicolas Ferre f80cb48843 power: reset: at91-shdwc: add new shutdown controller driver
Sama5d2 SoC has a completely new shutdown controller with new features and
register layout. It thus makes sense to add a new driver for this new
peripheral.

This driver is Device Tree only and handles events from the wake-up pin and
the RTC.
As the register layout may change in the future, so some values are encoded
in a configuration structure.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-04-10 17:17:38 +02:00
Linus Torvalds 15dbc136df Power management and ACPI material for v4.6-rc1, part 2
- Fix for an intel_pstate driver issue related to the handling of
    MSR updates uncovered by the recent cpufreq rework (Rafael Wysocki).
 
  - cpufreq core cleanups related to starting governors and frequency
    synchronization during resume from system suspend and a locking
    fix for cpufreq_quick_get() (Rafael Wysocki, Richard Cochran).
 
  - acpi-cpufreq and powernv cpufreq driver updates (Jisheng Zhang,
    Michael Neuling, Richard Cochran, Shilpasri Bhat).
 
  - intel_idle driver update preventing some Skylake-H systems
    from hanging during initialization by disabling deep C-states
    mishandled by the platform in the problematic configurations (Len
    Brown).
 
  - Intel Xeon Phi Processor x200 support for intel_idle (Dasaratharaman
    Chandramouli).
 
  - cpuidle menu governor updates to make it always honor PM QoS
    latency constraints (and prevent C1 from being used as the
    fallback C-state on x86 when they are set below its exit latency)
    and to restore the previous behavior to fall back to C1 if the next
    timer event is set far enough in the future that was changed in 4.4
    which led to an energy consumption regression (Rik van Riel, Rafael
    Wysocki).
 
  - New device ID for a future AMD UART controller in the ACPI driver
    for AMD SoCs (Wang Hongcheng).
 
  - Rockchip rk3399 support for the rockchip-io-domain adaptive voltage
    scaling (AVS) driver (David Wu).
 
  - ACPI PCI resources management fix for the handling of IO space
    resources on architectures where the IO space is memory mapped
    (IA64 and ARM64) broken by the introduction of common ACPI
    resources parsing for PCI host bridges in 4.4 (Lorenzo Pieralisi).
 
  - Fix for the ACPI backend of the generic device properties API
    to make it parse non-device (data node only) children of an
    ACPI device correctly (Irina Tirdea).
 
  - Fixes for the handling of global suspend flags (introduced in 4.4)
    during hibernation and resume from it (Lukas Wunner).
 
  - Support for obtaining configuration information from Device Trees
    in the PM clocks framework (Jon Hunter).
 
  - ACPI _DSM helper code and devfreq framework cleanups (Colin Ian
    King, Geert Uytterhoeven).
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJW9bXRAAoJEILEb/54YlRxjX8P/38haQ1cs7aNyHjv+eAAXGDq
 kr+oNG+cE5D8/X6wT7pWliIRkLzZM2+D/ec2QdA9kFnB/8DNoKdeJ2vi/K3cfbVO
 Jz3W97GgwdxSjzSxF2MjHSP/AGAZSvipzH9aL4ofxSFdPNWnget/58bUMo/HdRPH
 +vtAfTcfYxYCiJAKJMntvCjWuMZqDTM+YUcTkfUp5jDqvNStqzHvhZCFqo4lpci6
 pJAUIkaSXo6lmazIfyPgYQLVEXN1ljbXceJFP84Uk+XfaAEKmtzi5aI11MADqUwj
 7TXCR9p6wb678Rbb7FCTVBkOFvQ607+qASG2lMe8IxGa0l7rmyNpVKuQ1uKHLCwp
 ozMV3oLVaG/HyZTHpUN6nYXF7QgHWmNk+YZcpun0JTk/ehwGQTOt3B2Zheianyq/
 I0lFnBqTFI4e0cuYTDv6N7CKAK7rsBHvoNB5t/oPbtAzdGbeDpceoI1R8Mj7hbSj
 zOf+Q46AVyC7neWWbY5QJvKnWp8fVMzlj1p3BqzWD5XWWyaYE2f/xijFM+jU34lE
 jx+X/C0N7vZ7cL2x5Zd4BD9E80D1MxqzW1lZ763lMg8bmpQaPNDFWH8rmq/r7CUv
 uf0HC91ndTaJ8yoV8gUNXPWQrev8w5Gcrse1LDXXGDfXq7MupLgE+MKxRm8oW+hr
 uEAOfwkU9eeswv+jWPJx
 =KY4f
 -----END PGP SIGNATURE-----

Merge tag 'pm+acpi-4.6-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fixlet from Rafael Wysocki:
 "One of commits in my previous pull request changed the permissions of
  drivers/power/avs/rockchip-io-domain.c to executable by mistake"

* tag 'pm+acpi-4.6-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  Fix permissions of drivers/power/avs/rockchip-io-domain.c
2016-03-25 16:55:37 -07:00
Rafael J. Wysocki 8e653b6544 Fix permissions of drivers/power/avs/rockchip-io-domain.c
The permissions of this file were modified by commit (f447671b9e PM /
AVS: rockchip-io: add io selectors and supplies for rk3399) by mistake,
so fix them.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-03-25 22:36:17 +01:00
Linus Torvalds 3d66c6ba3f Power management and ACPI material for v4.6-rc1, part 2
- Fix for an intel_pstate driver issue related to the handling of
    MSR updates uncovered by the recent cpufreq rework (Rafael Wysocki).
 
  - cpufreq core cleanups related to starting governors and frequency
    synchronization during resume from system suspend and a locking
    fix for cpufreq_quick_get() (Rafael Wysocki, Richard Cochran).
 
  - acpi-cpufreq and powernv cpufreq driver updates (Jisheng Zhang,
    Michael Neuling, Richard Cochran, Shilpasri Bhat).
 
  - intel_idle driver update preventing some Skylake-H systems
    from hanging during initialization by disabling deep C-states
    mishandled by the platform in the problematic configurations (Len
    Brown).
 
  - Intel Xeon Phi Processor x200 support for intel_idle (Dasaratharaman
    Chandramouli).
 
  - cpuidle menu governor updates to make it always honor PM QoS
    latency constraints (and prevent C1 from being used as the
    fallback C-state on x86 when they are set below its exit latency)
    and to restore the previous behavior to fall back to C1 if the next
    timer event is set far enough in the future that was changed in 4.4
    which led to an energy consumption regression (Rik van Riel, Rafael
    Wysocki).
 
  - New device ID for a future AMD UART controller in the ACPI driver
    for AMD SoCs (Wang Hongcheng).
 
  - Rockchip rk3399 support for the rockchip-io-domain adaptive voltage
    scaling (AVS) driver (David Wu).
 
  - ACPI PCI resources management fix for the handling of IO space
    resources on architectures where the IO space is memory mapped
    (IA64 and ARM64) broken by the introduction of common ACPI
    resources parsing for PCI host bridges in 4.4 (Lorenzo Pieralisi).
 
  - Fix for the ACPI backend of the generic device properties API
    to make it parse non-device (data node only) children of an
    ACPI device correctly (Irina Tirdea).
 
  - Fixes for the handling of global suspend flags (introduced in 4.4)
    during hibernation and resume from it (Lukas Wunner).
 
  - Support for obtaining configuration information from Device Trees
    in the PM clocks framework (Jon Hunter).
 
  - ACPI _DSM helper code and devfreq framework cleanups (Colin Ian
    King, Geert Uytterhoeven).
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJW9JaRAAoJEILEb/54YlRx/GAQAJujANWilWHZYm24a9JDcIE9
 rsNZIC/FdeBVilPtRTZQnig/Pj32Z4Jm7IZ/DLOq0Deu1YK/9uv3y59M3BcX6WyL
 H5VR80L8geUJZ7RRk0WfM5D4X82ovzwpE/kWt2Z7HDuvJSCBmFBZOvNrXbaRncKD
 jIvat/p6uCuxt5c08+ebnBLQ6tOs8wLTWiCx3fO128GIrGRGN2xFV6hzRWVGnJ4g
 WXGAR+AdLxRMZz4PPmqdTfRj4TNSR071GjKyaeKfZUjQGAsf5O9A77JFjeNVomDx
 g1K37Byid2bTByzVavlEXPJZ7eKb5dAhlo7IJ9HAcOAXChLqH2Czjrpd+1XjR9MF
 SV/78rCnF8eet83QYLbGV/Mzf7gbJP2Xp6wiaM22VAPpGe+sYfphJoQka9XRTfId
 OgAjyYMYdWAKo5DhxVNI8WyN0W5dsoBFPxnaUFhHSGDCIJH7Ksy20m6y3plG2Bxf
 ahoiQhmd9ohjtB5JbRnf4MY0hjekp8Srdf+DoNKsk/+JscIyROpYY3msQ3smUKo+
 f628MC/wAosMpSV+l+KOYkbjCbtB49IabWtZ//NVD9hYB3E1f6aTN59yFbWB+1rp
 L7Y8iaxzSkyJy/yYVuBal3rSk356+BvvoXBlLXmBsyu1TMlcDjALIYztSiTVT5MB
 RZBhgNwdkxNCYJfU3ex+
 =hUVj
 -----END PGP SIGNATURE-----

Merge tag 'pm+acpi-4.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull more power management and ACPI updates from Rafael Wysocki:
 "The second batch of power management and ACPI updates for v4.6.

  Included are fixups on top of the previous PM/ACPI pull request and
  other material that didn't make into it but still should go into 4.6.

  Among other things, there's a fix for an intel_pstate driver issue
  uncovered by recent cpufreq changes, a workaround for a boot hang on
  Skylake-H related to the handling of deep C-states by the platform and
  a PCI/ACPI fix for the handling of IO port resources on non-x86
  architectures plus some new device IDs and similar.

  Specifics:

   - Fix for an intel_pstate driver issue related to the handling of MSR
     updates uncovered by the recent cpufreq rework (Rafael Wysocki).

   - cpufreq core cleanups related to starting governors and frequency
     synchronization during resume from system suspend and a locking fix
     for cpufreq_quick_get() (Rafael Wysocki, Richard Cochran).

   - acpi-cpufreq and powernv cpufreq driver updates (Jisheng Zhang,
     Michael Neuling, Richard Cochran, Shilpasri Bhat).

   - intel_idle driver update preventing some Skylake-H systems from
     hanging during initialization by disabling deep C-states mishandled
     by the platform in the problematic configurations (Len Brown).

   - Intel Xeon Phi Processor x200 support for intel_idle
     (Dasaratharaman Chandramouli).

   - cpuidle menu governor updates to make it always honor PM QoS
     latency constraints (and prevent C1 from being used as the fallback
     C-state on x86 when they are set below its exit latency) and to
     restore the previous behavior to fall back to C1 if the next timer
     event is set far enough in the future that was changed in 4.4 which
     led to an energy consumption regression (Rik van Riel, Rafael
     Wysocki).

   - New device ID for a future AMD UART controller in the ACPI driver
     for AMD SoCs (Wang Hongcheng).

   - Rockchip rk3399 support for the rockchip-io-domain adaptive voltage
     scaling (AVS) driver (David Wu).

   - ACPI PCI resources management fix for the handling of IO space
     resources on architectures where the IO space is memory mapped
     (IA64 and ARM64) broken by the introduction of common ACPI
     resources parsing for PCI host bridges in 4.4 (Lorenzo Pieralisi).

   - Fix for the ACPI backend of the generic device properties API to
     make it parse non-device (data node only) children of an ACPI
     device correctly (Irina Tirdea).

   - Fixes for the handling of global suspend flags (introduced in 4.4)
     during hibernation and resume from it (Lukas Wunner).

   - Support for obtaining configuration information from Device Trees
     in the PM clocks framework (Jon Hunter).

   - ACPI _DSM helper code and devfreq framework cleanups (Colin Ian
     King, Geert Uytterhoeven)"

* tag 'pm+acpi-4.6-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (23 commits)
  PM / AVS: rockchip-io: add io selectors and supplies for rk3399
  intel_idle: Support for Intel Xeon Phi Processor x200 Product Family
  intel_idle: prevent SKL-H boot failure when C8+C9+C10 enabled
  ACPI / PM: Runtime resume devices when waking from hibernate
  PM / sleep: Clear pm_suspend_global_flags upon hibernate
  cpufreq: governor: Always schedule work on the CPU running update
  cpufreq: Always update current frequency before startig governor
  cpufreq: Introduce cpufreq_update_current_freq()
  cpufreq: Introduce cpufreq_start_governor()
  cpufreq: powernv: Add sysfs attributes to show throttle stats
  cpufreq: acpi-cpufreq: make Intel/AMD MSR access, io port access static
  PCI: ACPI: IA64: fix IO port generic range check
  ACPI / util: cast data to u64 before shifting to fix sign extension
  cpufreq: powernv: Define per_cpu chip pointer to optimize hot-path
  cpuidle: menu: Fall back to polling if next timer event is near
  cpufreq: acpi-cpufreq: Clean up hot plug notifier callback
  intel_pstate: Do not call wrmsrl_on_cpu() with disabled interrupts
  cpufreq: Make cpufreq_quick_get() safe to call
  ACPI / property: fix data node parsing in acpi_get_next_subnode()
  ACPI / APD: Add device HID for future AMD UART controller
  ...
2016-03-24 22:59:58 -07:00
David Wu f447671b9e PM / AVS: rockchip-io: add io selectors and supplies for rk3399
This adds the necessary data for handling io voltage domains on the rk3399.
As interesting tidbit, the rk3399 contains two separate iodomain areas.
One in the regular General Register Files (GRF) and one in PMUGRF in the
pmu power domain.

Signed-off-by: David Wu <david.wu@rock-chips.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-03-23 22:10:15 +01:00
Linus Torvalds 814a2bf957 Merge branch 'akpm' (patches from Andrew)
Merge second patch-bomb from Andrew Morton:

 - a couple of hotfixes

 - the rest of MM

 - a new timer slack control in procfs

 - a couple of procfs fixes

 - a few misc things

 - some printk tweaks

 - lib/ updates, notably to radix-tree.

 - add my and Nick Piggin's old userspace radix-tree test harness to
   tools/testing/radix-tree/.  Matthew said it was a godsend during the
   radix-tree work he did.

 - a few code-size improvements, switching to __always_inline where gcc
   screwed up.

 - partially implement character sets in sscanf

* emailed patches from Andrew Morton <akpm@linux-foundation.org>: (118 commits)
  sscanf: implement basic character sets
  lib/bug.c: use common WARN helper
  param: convert some "on"/"off" users to strtobool
  lib: add "on"/"off" support to kstrtobool
  lib: update single-char callers of strtobool()
  lib: move strtobool() to kstrtobool()
  include/linux/unaligned: force inlining of byteswap operations
  include/uapi/linux/byteorder, swab: force inlining of some byteswap operations
  include/asm-generic/atomic-long.h: force inlining of some atomic_long operations
  usb: common: convert to use match_string() helper
  ide: hpt366: convert to use match_string() helper
  ata: hpt366: convert to use match_string() helper
  power: ab8500: convert to use match_string() helper
  power: charger_manager: convert to use match_string() helper
  drm/edid: convert to use match_string() helper
  pinctrl: convert to use match_string() helper
  device property: convert to use match_string() helper
  lib/string: introduce match_string() helper
  radix-tree tests: add test for radix_tree_iter_next
  radix-tree tests: add regression3 test
  ...
2016-03-18 19:26:54 -07:00
Andy Shevchenko ea32cea140 power: ab8500: convert to use match_string() helper
The new helper returns index of the mathing string in an array.  We
would use it here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-17 15:09:34 -07:00
Andy Shevchenko 5f4768225c power: charger_manager: convert to use match_string() helper
The new helper returns index of the mathing string in an array.  We
would use it here.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Sebastian Reichel <sre@kernel.org>
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2016-03-17 15:09:34 -07:00
Linus Torvalds 9cc984e4bc power supply and reset changes for the v4.6 series
* add types for USB Type C and PD chargers
  * add act8945a charger driver
  * add ACPI/DT bindings for goldfish-battery
  * add support for versatile reset controller
  * misc. fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJW6XstAAoJENju1/PIO/qaSmMP+gJY9U4yPscEoW2UkvKJ2y81
 /Bxvy8GWSnnaFFPLMHYk/n53EPJbPnewETBftv1xRHzgJ6wQlgM/5EAEU2Qwud+A
 V8K3V8VStIZLIrQ1tU8r10UE5OW95lsupCAlFp9AHYrBgIiRDUHlqWtxuhwH12F2
 uLZt7moLHJFZtvg3EWl4agsvoEWfqPOKwmOpda+PyIUOlZrAIu3nItvKwBKWdvr3
 WuomqfknkekkvX2lSB8R4OfE+w4fkYTFak2+4ymNiaQWrLeEqLuJbICUNGMD+APb
 nX8TmQ8wmYYHLZTu455ctGJIdpYfrRI/IPAsdW/vMYnQ/8GiO0dgke5dfzZU08Du
 PAWb/NM2pjFfG76fqG46hQPq/Jsns9k/SM1e3Q6fCkwewqtx8P56vUML6FtomYe7
 HP3oPqlNeEpcF/jMmxKfSNiF78pmRLpCkWuhhYaT4Suv8bJhoQRE7Ur00Y47hp9i
 taAIDE3HNFucqTEXMudBktEKsDPRpEx2K1fZEvZbCF8sOUK4xWPQr1yuPTXrM7jm
 sWl/T4s1tn9/P6esdZUTXGghBiehj71mCHsOfXBQZPifaB2s8uINEf+GHQyQcLL4
 X2HiMWrv9Pyn+PLVVwWRmTpSVIFWrCHNQPQ1ofgsgWkrEqsAbdZ4O2srlCqg/4WL
 irCHBm6fbGpoVRQHg3xS
 =L4ho
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset changes from Sebastian Reichel:
 - add types for USB Type C and PD chargers
 - add act8945a charger driver
 - add ACPI/DT bindings for goldfish-battery
 - add support for versatile reset controller
 - misc fixes

* tag 'for-v4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (24 commits)
  power: pm2301-charger: use __maybe_unused to hide pm functions
  power: ipaq-micro-battery: use __maybe_unused to hide pm functions
  power_supply: 88pm860x_charger: do not pass NULL to power_supply_put
  jz4740-battery: Correct voltage change check
  power_supply: lp8788-charger: initialize boolean 'found'
  goldfish: Enable ACPI-based enumeration for goldfish battery
  power: goldfish_battery: add devicetree bindings
  power: act8945a: add charger driver for ACT8945A
  power: add documentation for ACT8945A's charger DT bindings
  ARM: dts: n900: Rename isp1704 to isp1707 to match correct name
  power_supply: bq27xxx_battery: Add of modalias and match table when CONFIG_OF is enabled
  power_supply: bq2415x_charger: Add of modalias and match table when CONFIG_OF is enabled
  power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is not enabled
  power_supply: isp1704_charger: Add compatible of match for nxp,isp1707
  power_supply: isp1704_charger: Error messages when probe fail
  power_supply: Add types for USB Type C and PD chargers
  power: bq24735-charger: add 'ti,external-control' option
  power: bq24735-charger: document 'ti,external-control' option
  power: bq24735-charger: fix failed i2c with ac-detect
  power: reset: Fix dependencies for !HAS_IOMEM archs
  ...
2016-03-17 12:50:55 -07:00
Arnd Bergmann 0df6e32b0e power: pm2301-charger: use __maybe_unused to hide pm functions
The pm2301 charger driver uses nested #ifdefs to check for both
CONFIG_PM and CONFIG_PM_SLEEP in an attempt to hide its
suspend and runtime-pm operations when they are unused, but
it does not hide the clear_lpn_pin() function in the same
way, so we get a build warning when everything is
disabled:

drivers/power/pm2301_charger.c:123:13: error: 'clear_lpn_pin' defined but not used [-Werror=unused-function]

This removes all the #ifdef and instead uses __maybe_unused
annotations to let the compiler know it can silently drop
the function definition.

For the PM2XXX_PM_OPS, we can use an IS_ENABLED() check
to avoid defining the structure when CONFIG_PM is not set without
the #ifdef.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03 15:12:08 +01:00
Arnd Bergmann 298cb0f192 power: ipaq-micro-battery: use __maybe_unused to hide pm functions
The ipaq micro battery driver has suspend/resume functions that
are accessed using SIMPLE_DEV_PM_OPS, which hide the reference
when CONFIG_PM_SLEEP is not set, resulting in a warning about
unused functions:

drivers/power/ipaq_micro_battery.c:284:12: error: 'micro_batt_suspend' defined but not used [-Werror=unused-function]
drivers/power/ipaq_micro_battery.c:292:12: error: 'micro_batt_resume' defined but not used [-Werror=unused-function]

This adds __maybe_unused annotations to let the compiler know
it can silently drop the function definition.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03 15:12:08 +01:00
Colin Ian King 9761dca68c power_supply: 88pm860x_charger: do not pass NULL to power_supply_put
In the case where power_supply_get_by_name returns NULL the current
error return path calls power_supply_put with a NULL psy which will
cause a null pointer dereference.  Avoid this with an immediate
return.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03 15:07:22 +01:00
Maarten ter Huurne 754645342a jz4740-battery: Correct voltage change check
The check is supposed to avoid redundant update notifications, so it
should check for the difference between old and new voltage exceeding
a threshold.

Also make sure the result of a failed read is never stored.

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03 15:05:08 +01:00
Colin Ian King 9052768fe4 power_supply: lp8788-charger: initialize boolean 'found'
The boolean 'found' is not initialized and hence garbage. It should
be initialized as false.

Found with static analysis using CoverityScan

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03 15:01:49 +01:00
Yu Ning fdb2f37a54 goldfish: Enable ACPI-based enumeration for goldfish battery
Add the ACPI bindings to the goldfish battery driver.

Signed-off-by: Yu Ning <yu.ning@intel.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03 13:55:36 +01:00
Greg Hackmann 65d687a7b7 power: goldfish_battery: add devicetree bindings
Add device tree bindings to the Goldfish virtual platform battery drivers.

Signed-off-by: Greg Hackmann <ghackmann@google.com>
Signed-off-by: Jin Qian <jinqian@android.com>
Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-03-03 13:53:52 +01:00
Wenyou Yang 5c0e09e03f power: act8945a: add charger driver for ACT8945A
This patch adds new driver for Active-semi ACT8945A ActivePath
charger (part of ACT8945A MFD driver) providing power supply class
information to userspace.

The driver can be configured through DT (such as, total timer,
precondition timer and input over-voltage threshold).

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[ add "|| COMPILE_TEST" to MFD_ACT8945A dependency ]
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-24 18:31:24 +01:00
Ivaylo Dimitrov 9aafabc7fe power: bq27xxx_battery: Restore device name
Patch <703df6c09795> ("power: bq27xxx_battery: Reorganize I2C
into a module") has removed the device name numbering from
bq27xxx_battery_i2c_probe. Fix that by restoring the code.

Fixes: 703df6c097
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Tested-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21 20:49:34 +01:00
Pali Rohár 7df3a7468f power_supply: bq27xxx_battery: Add of modalias and match table when CONFIG_OF is enabled
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21 20:26:00 +01:00
Pali Rohár 523e550141 power_supply: bq2415x_charger: Add of modalias and match table when CONFIG_OF is enabled
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21 20:25:49 +01:00
Pali Rohár ec3d7d08c2 power_supply: bq2415x_charger: Do not add acpi modalias when CONFIG_ACPI is not enabled
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21 20:25:10 +01:00
Pali Rohár 64876fe552 power_supply: isp1704_charger: Add compatible of match for nxp,isp1707
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21 20:25:09 +01:00
Pali Rohár ed6107beb5 power_supply: isp1704_charger: Error messages when probe fail
This patch adds more detailed error messages when probe function fails.
It is useful for debbuging why the driver refuses to register the
charger device.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-21 20:24:28 +01:00
Benson Leung 6659b55dae power_supply: Add types for USB Type C and PD chargers
This adds power supply types for USB chargers defined in
the USB Type-C Specification 1.1 and in the
USB Power Delivery Specification Revision 2.0 V1.1.

The following are added :
POWER_SUPPLY_TYPE_USB_TYPE_C,	/* Type C Port */
POWER_SUPPLY_TYPE_USB_PD,	/* Power Delivery Port */
POWER_SUPPLY_TYPE_USB_PD_DRP,	/* PD Dual Role Port */

Signed-off-by: Benson Leung <bleung@chromium.org>
[tomeu: remove the mention to Type C from the comments]
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15 07:02:32 +01:00
Jonathan Tinkham 64024ac7bb power: bq24735-charger: add 'ti,external-control' option
Implement an 'ti,external-control' option for when the charger
shouldn't be configured by the host.

Signed-off-by: Jonathan Tinkham <sctincman@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15 06:36:10 +01:00
Jonathan Tinkham 1a3adce1c2 power: bq24735-charger: fix failed i2c with ac-detect
When an ac-detect pin exists, but the charger is not plugged in,
the chip will not respond to i2c messages, causing the module to
fail when inserted.

Signed-off-by: Jonathan Tinkham <sctincman@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15 06:35:21 +01:00
Richard Weinberger 4f4bfe6bf1 power: reset: Fix dependencies for !HAS_IOMEM archs
Not every arch has io memory.
So, unbreak the build by fixing the dependencies.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15 06:06:07 +01:00
Arnd Bergmann 6a65b2b2af power: collie_battery: hide unused variable
The 'wakeup_enabled' variable in this driver is only accessed
by the optional power management functions and we get a warning
when they are disabled:

drivers/power/collie_battery.c:29:12: error: 'wakeup_enabled' defined but not used [-Werror=unused-variable]

This moves the definition next to the users inside the same #ifdef,
which avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15 06:01:51 +01:00
Linus Walleij 3f652c969d power/reset: versatile: support the actual versatile
While this driver is named after the Versatile family of
boards (ARM reference designs) the machine actually called
Versatile was not supported. This patch makes the driver
handle also that machine. We augment the register names for
the reset to *VERSATILE* as well since it is the same
register offsets for Versatile and RealView.

Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15 05:45:22 +01:00
Peter Rosin 5b7a018739 bq24735_charger: add status property to view/enable/disable charging
Add possibility to disable/re-enable charging via sysfs.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-02-15 05:44:30 +01:00
Liu Xiang 265b60497a power: bq27xxx_battery: Fix bq27541 AveragePower register address
Currently in bq27541 driver, the average power register address is
incorrectly set to 0x76, which would result in an error:
bq27xxx-battery 2-0055: error reading average power register  10: -11
According to the bq27541 datasheet, fix this problem by setting
the average power register address to 0x24.

Fixes: d74534c277 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Signed-off-by: Liu Xiang <liu.xiang6@zte.com.cn>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-14 01:03:18 +01:00
Sasha Levin 6b9140f39c power: test_power: correctly handle empty writes
Writing 0 length data into test_power makes it access an invalid array
location and kill the system.

Fixes: f17ef9b2d ("power: Make test_power driver more dynamic.")
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07 18:39:34 +01:00
Geliang Tang 127d286848 power: generic-adc-battery: use to_delayed_work
Use to_delayed_work() instead of open-coding it.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07 16:38:31 +01:00
Ivaylo Dimitrov 8802563251 power: isp1704_charger: Fix isp1704_write() definition
All calls to isp1704_write() are using parameter sequence of
isp1704_write(isp, reg, val) but the function is defined as
isp1704_write(isp, val, reg). Fix isp1704_write function definition so
that the driver to be functional.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07 16:38:30 +01:00
H. Nikolaus Schaller 099867a16a power: bq27xxx: fix register numbers of bq27500
bug: according to data sheet some register numbers are wrong.

tested: no

Fixes: d74534c277 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07 16:38:27 +01:00
H. Nikolaus Schaller 549d7b317c power: bq27xxx: fix reading for bq27000 and bq27010
bug: the driver reports funny capacity values:

root@letux:/sys/class/power_supply/bq27000-battery# cat uevent
POWER_SUPPLY_NAME=bq27000-battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_VOLTAGE_NOW=3702000
POWER_SUPPLY_CURRENT_NOW=-464635
POWER_SUPPLY_CAPACITY=1536			<- over 100% is magic
POWER_SUPPLY_CAPACITY_LEVEL=Normal
POWER_SUPPLY_TEMP=311
POWER_SUPPLY_TIME_TO_FULL_NOW=10440
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_CHARGE_FULL=805450
POWER_SUPPLY_CHARGE_NOW=1068
POWER_SUPPLY_CHARGE_FULL_DESIGN=8844998	<- battery has just 1200 mAh
POWER_SUPPLY_CYCLE_COUNT=21
POWER_SUPPLY_ENERGY_NOW=0
POWER_SUPPLY_POWER_AVG=0
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_MANUFACTURER=Texas Instruments

reason: the state of charge and the design capacity register are single
byte only. The design capacity returns the higer order byte.

tested: GTA04 with Openmoko/FIC HF08x battery (using hdq)

Fixes: d74534c277 ("power: bq27xxx_battery: Add support for additional bq27xxx family devices")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Reviewed-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2016-01-07 16:38:24 +01:00
Krzysztof Kozlowski f96576bd63 power: Fix unmet dependency on POWER_SUPPLY by POWER_RESET by uncoupling them
Currently the reset/power off handlers (POWER_RESET) and Adaptive Voltage
Scaling class (POWER_AVS) are not built when POWER_SUPPLY is disabled.
The POWER_RESET is also not visible in drivers main section of config.

However they do not really depend on power supply so they can be built
always. The objects for power supply drivers already depend on
particular Kconfig symbols so there is no need for any changes in
drivers/power/Makefile.

This allows selecting POWER_RESET from main drivers config section and
fixes following build warning (encountered on ARM exynos defconfig when
POWER_SUPPLY is disabled manually):

warning: (ARCH_HISI && ARCH_INTEGRATOR && ARCH_EXYNOS && ARCH_VEXPRESS && REALVIEW_DT) selects POWER_RESET which has unmet direct dependencies (POWER_SUPPLY)
warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF)
warning: (ARCH_EXYNOS) selects POWER_RESET_SYSCON_POWEROFF which has unmet direct dependencies (POWER_SUPPLY && POWER_RESET && OF)

Reported-by: Pavel Fedin <p.fedin@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-08 04:26:05 +01:00
Andrew F. Davis 703df6c097 power: bq27xxx_battery: Reorganize I2C into a module
Separate out I2C functionality into a module. This fixes several small
issues and simplifies the driver initialization.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05 02:06:51 +01:00
NeilBrown 1f94b2563a power: bq27xxx: don't fill system log by missing battery
Print message that battery is not calibrated only once
to avoid spamming the log.

Suggested-By: H. Nikolaus Schaller <hns@goldelico.com>
Suggested-By: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05 02:06:50 +01:00
Saurabh Sengar d5fdfedc0e power: max8903_charger: set IRQF_ONESHOT if no primary handler is specified
If no primary handler is specified for threaded_irq then a
default one is assigned which always returns IRQ_WAKE_THREAD.
This handler requires the IRQF_ONESHOT, because the source of
interrupt is not disabled.

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05 02:06:50 +01:00
Julia Lawall c4c0edfbf8 power/reset: at91-reset: add missing of_node_put
for_each_matching_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

A simplified version of the semantic patch that fixes this problem is as
follows (http://coccinelle.lip6.fr):

// <smpl>
@@
expression e,e1;
local idexpression np;
@@

 for_each_matching_node(np, e1) {
   ... when != of_node_put(np)
       when != e = np
(
   return np;
|
+  of_node_put(np);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05 02:06:49 +01:00
Julia Lawall 79fbdb66cf power: ds2782_battery: constify ds278x_battery_ops structure
The ds278x_battery_ops structure is never modified, so declare it as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05 02:06:49 +01:00
Markus Elfring b7e16ec6e3 power: bq2415x_charger: Delete unnecessary checks before the function call "of_node_put"
The of_node_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-12-05 02:04:03 +01:00
Linus Torvalds bc914532a0 - New Device Support
- Add support for 88pm860; 88pm80x
    - Add support for 24c08 EEPROM; at24
    - Add support for Broxton Whiskey Cove; intel*
    - Add support for RTS522A; rts5227
    - Add support for I2C devices; intel_quark_i2c_gpio
  - New Functionality
    - Add microphone support; arizona
    - Add general purpose switch support; arizona
    - Add fuel-gauge support; da9150-core
    - Add shutdown support; sec-core
    - Add charger support; tps65217
    - Add flexible serial communication unit support; atmel-flexcom
    - Add power button support; axp20x
    - Add led-flash support; rt5033
  - Core Frameworks
    - Supply a generic macro for defining Regmap IRQs
    - Rework ACPI child device matching
  - Fix-ups
    - Use Regmap to access registers; tps6105x
    - Use DEFINE_RES_IRQ_NAMED() macro; da9150
    - Re-arrange device registration order; intel_quark_i2c_gpio
    - Allow OF matching; cros_ec_i2c, atmel-hlcdc, hi6421-pmic, max8997, sm501
    - Handle deferred probe; twl6040
    - Improve accuracy of headphone detect; arizona
    - Unnecessary MODULE_ALIAS() removal; bcm590xx, rt5033
    - Remove unused code; htc-i2cpld, arizona, pcf50633-irq, sec-core
    - Simplify code; kempld, rts5209, da903x, lm3533, da9052, arizona
    - Remove #iffery; arizona
    - DT binding adaptions; many
  - Bug Fixes
    - Fix possible NULL pointer dereference; wm831x, tps6105x
    - Fix 64bit bug; intel_soc_pmic_bxtwc
    - Fix signedness issue; arizona
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWOzEbAAoJEFGvii+H/HdhbUEQAIBHvNaunWp362L2D2lOOQMa
 cBlGiR2yXCpsFGAcvpr50zX5soFuNITGea1CidJmp/ZIHIG7hVUz5E8wQZ8HdiyG
 03UKsa6xkVx9i+PhV5agUjxi6MDgUvxsPwdbVw6LTw1wQejIrfxq7ObdcPo30OTI
 4r0tjLonQkGaFFdGqC4Jr7Grs7pvzmKzHu08AaknaoTyhUl/E9Wtq12HJFr8kUCw
 WNgEyiPzNk0h9EByCUiG7iFwyg1EJLsF1U973Th8Utvl7PFe8REQVZ46v9iYAM9J
 1OeSrsKhtyhQqAP/FJ5odZCXwTy9q6ifGfELyyS26/okCYWDzxDcF+hAp0VNbzb4
 zYvEnKue101Y+WEsF9bNaya3avf45obJuRaRukoGMZ/brW6+d1ub0kwUKMD8MqOn
 UFL3oZwfPQ8mWB5ddELl97dzJDwHbEIhWe7yKQVpTaJ2pCm6JSS5Vb0TU+A1Zywp
 Hie1Yr0y36npnCbml4W74O9H/rblpNpgFlaupfB6mHRWZyTsyQNeKJ6FWTirncgQ
 xy8Ti+ZsXlMTvWCzzS3GcjP9rAK0e5dKurOE8t+krZmTul96+OYsnvxRC0nyo7XC
 1PKomkWO+3if2DsnurFX/QKfE55PCKermJRO5mDZbsWp6aJAhKW5UwxAgkHpUHsJ
 hHaT+npBczXbq8jvEMTt
 =99/D
 -----END PGP SIGNATURE-----

Merge tag 'mfd-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd

Pull MFD updates from Lee Jones:
 "New Device Support:
   - Add support for 88pm860; 88pm80x
   - Add support for 24c08 EEPROM; at24
   - Add support for Broxton Whiskey Cove; intel*
   - Add support for RTS522A; rts5227
   - Add support for I2C devices; intel_quark_i2c_gpio

  New Functionality:
   - Add microphone support; arizona
   - Add general purpose switch support; arizona
   - Add fuel-gauge support; da9150-core
   - Add shutdown support; sec-core
   - Add charger support; tps65217
   - Add flexible serial communication unit support; atmel-flexcom
   - Add power button support; axp20x
   - Add led-flash support; rt5033

  Core Frameworks:
   - Supply a generic macro for defining Regmap IRQs
   - Rework ACPI child device matching

  Fix-ups:
   - Use Regmap to access registers; tps6105x
   - Use DEFINE_RES_IRQ_NAMED() macro; da9150
   - Re-arrange device registration order; intel_quark_i2c_gpio
   - Allow OF matching; cros_ec_i2c, atmel-hlcdc, hi6421-pmic, max8997, sm501
   - Handle deferred probe; twl6040
   - Improve accuracy of headphone detect; arizona
   - Unnecessary MODULE_ALIAS() removal; bcm590xx, rt5033
   - Remove unused code; htc-i2cpld, arizona, pcf50633-irq, sec-core
   - Simplify code; kempld, rts5209, da903x, lm3533, da9052, arizona
   - Remove #iffery; arizona
   - DT binding adaptions; many

  Bug Fixes:
   - Fix possible NULL pointer dereference; wm831x, tps6105x
   - Fix 64bit bug; intel_soc_pmic_bxtwc
   - Fix signedness issue; arizona"

* tag 'mfd-for-linus-4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (73 commits)
  bindings: mfd: s2mps11: Add documentation for s2mps15 PMIC
  mfd: sec-core: Remove unused s2mpu02-rtc and s2mpu02-clk children
  extcon: arizona: Add extcon specific device tree binding document
  MAINTAINERS: Add binding docs for Cirrus Logic/Wolfson Arizona devices
  mfd: arizona: Remove bindings covered in new subsystem specific docs
  mfd: rt5033: Add RT5033 Flash led sub device
  mfd: lpss: Add Intel Broxton PCI IDs
  mfd: lpss: Add Broxton ACPI IDs
  mfd: arizona: Signedness bug in arizona_runtime_suspend()
  mfd: axp20x: Add a cell for the power button part of the, axp288 PMICs
  mfd: dt-bindings: Document pulled down WRSTBI pin on S2MPS1X
  mfd: sec-core: Disable buck voltage reset on watchdog falling edge
  mfd: sec-core: Dump PMIC revision to find out the HW
  mfd: arizona: Use correct type ID for device tree config
  mfd: arizona: Remove use of codec build config #ifdefs
  mfd: arizona: Simplify adding subdevices
  mfd: arizona: Downgrade type mismatch messages to dev_warn
  mfd: arizona: Factor out checking of jack detection state
  mfd: arizona: Factor out DCVDD isolation control
  mfd: Make TPS6105X select REGMAP_I2C
  ...
2015-11-06 10:23:50 -08:00
Linus Torvalds 400c5bd5a5 power supply and reset changes for the v4.4 series
* new AXP20X USB Power driver
  * new Qualcomm SMBB driver
  * new TPS65217 Charger driver
  * BQ24257: add BQ24250/BQ24251 support
  * overhaul bq27x00 battery driver, rename to bq27xxx
  * misc. fixes and cleanups
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJWOn8oAAoJENju1/PIO/qahrEP/RPHXvTxtYv8YvhaFbqcr07x
 11gRB8RRthKK5woC3s70QKlMtcHijFeCwKuacut+7tfgK2oZDIm+Bd43Pl93aypU
 Yk4oTwop5OyrLsGIGiTIPPV9HTwr4q69Or2Q91mqUAUe2wGB5uCuJiJmCowUwfZs
 piv+ISLSOcH+i1bTx3hQ7h7axsdAlaSz2o1JprZaxm3rM67M8zF1ZHSK7wlpAeBa
 DiDrtUvEDCeLL8dmCA9xkFV4yFB9T+KNh0730N2RY+zlZS6WjSpzryqwsUWWyQ6h
 U9gFgcs+DjVaGHuMsIX2zm7xXfXHgUBtXdSQoCBhpSrZsdufMsT/8VQqVZ0yqpXL
 pQ2EXy63k6tXnXEyAKTA0tAOX/WZNfmmNblkea4JiyZULn7b/WH09waMZUBJqe84
 Yn3SatVdGDN4nawsivzdiM3zR9/WTE9R3DmEeAE+g1RRsSraNwWlkzpDXcmnWmbc
 DoprnjLsDJfqL3/1ysF2V2I4B26Bws73qq6UUjJ4KEGWf8Y1fVawxrbcYmnrvg1K
 zW/saEgtl70FYqtee/0lIqTpjOZRX/O6QH5i8p7VC8cUzftX0Twc8MvfvpamDywX
 Cr1Y7pIMEhc6TFUP5lOzx9xJelA5PHJMpAT+02fh6YXMAzCcBUzL113rY5zBrVVl
 gce0iHDKAybmvww77z1r
 =0be4
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 - new AXP20X USB Power driver
 - new Qualcomm SMBB driver
 - new TPS65217 Charger driver
 - BQ24257: add BQ24250/BQ24251 support
 - overhaul bq27x00 battery driver, rename to bq27xxx
 - misc fixes and cleanups

* tag 'for-v4.4' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (54 commits)
  power: bq27xxx_battery: Remove unneeded dependency in Kconfig
  power: bq27xxx_battery: move irq handler to i2c section
  power: bq27xxx_battery: fix platform probe
  twl4030_charger: add missing iio dependency
  power_supply: charger-manager: add missing of_node_put
  Documentation: power: bq24257: Document exported sysfs entries
  power: bq24257: Add various device-specific sysfs properties
  power: bq24257: Allow input current limit sysfs access
  power: bq24257: Add input DPM voltage threshold setting support
  power: bq24257: Add over voltage protection setting support
  power: bq24257: Add SW-based approach for Power Good determination
  power: bq24257: Allow manual setting of input current limit
  power: bq24257: Add bit definition for temp sense enable
  power: bq24257: Add basic support for bq24250/bq24251
  dt: power: bq24257-charger: Cover additional devices
  power: bq24257: Simplify bq24257_power_supply_init()
  power: bq24257: Use managed power supply register
  power: bq24257: Streamline input current limit setup
  power: bq24257: Remove IRQ config through stat-gpios
  power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health()
  ...
2015-11-05 12:28:15 -08:00
Andrew F. Davis 6bd03ce3c1 power: bq27xxx_battery: Remove unneeded dependency in Kconfig
I2C is only required when using the config item BATTERY_BQ27XXX_I2C which
already depends on the I2C subsystem, remove the unneeded dependency from
BATTERY_BQ27XXX.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-10-19 10:38:50 +02:00
Sebastian Reichel 41a90db8fd power: bq27xxx_battery: move irq handler to i2c section
The IRQ handler is not used by the platform based
code resulting in a 'defined but not used' warning,
if CONFIG_BQ27XXX_I2C is not enabled.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
2015-10-19 10:38:03 +02:00
Sebastian Reichel 0077ae7e99 power: bq27xxx_battery: fix platform probe
Add missing initialization of register mapping table to
platform probe function.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
2015-10-19 10:37:25 +02:00
Sebastian Reichel 0f4998cbb2 twl4030_charger: add missing iio dependency
This driver fails to link without CONFIG_IIO, since
there are no stubs for the iio_channels functions.

Signed-off-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Marek Belisko <marek@goldelico.com>
Acked-by: Nikolaus Schaller <hns@goldelico.com>
2015-10-16 14:12:38 +02:00
Julia Lawall 8e5cfb74bc power_supply: charger-manager: add missing of_node_put
for_each_child_of_node performs an of_node_get on each iteration, so
a break out of the loop requires an of_node_put.

The semantic patch that fixes this problem is as follows
(http://coccinelle.lip6.fr):

// <smpl>
@@
expression root,e;
local idexpression child;
@@

 for_each_child_of_node(root, child) {
   ... when != of_node_put(child)
       when != e = child
(
   return child;
|
+  of_node_put(child);
?  return ...;
)
   ...
 }
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-10-15 10:55:44 +02:00
Luis de Bethencourt fa743d96e7 PM / AVS: rockchip-io: Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-10-14 02:38:53 +02:00
Adam Thomson a419b4fd91 power: Add support for DA9150 Fuel-Gauge
This adds power supply driver support for the Fuel-Gauge part of
the DA9150 combined Charger and Fuel-Gauge device.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Acked-by: Sebastian Reichel <sre@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-10-13 11:28:07 +01:00
Andreas Dannenberg 007ee5f656 power: bq24257: Add various device-specific sysfs properties
This patch adds support for enabling/disabling optional device specific
features through sysfs properties at runtime.

* High-impedance mode enable/disable
* Sysoff enable/disable

Refer to the respective device datasheets for more information:

http://www.ti.com/product/bq24250
http://www.ti.com/product/bq24251
http://www.ti.com/product/bq24257

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:55:03 +02:00
Andreas Dannenberg 0cfbfde65a power: bq24257: Allow input current limit sysfs access
This patch allows reading and writing of the input current limit through
the power supply's input_current_limit sysfs property. This allows
userspace to see what charger was detected (if the D+/D- USB signal-
based charger type detection is enabled) and to re-configure the maximum
current drawn from the external supply at runtime based on system-level
knowledge or user input. Note that upon charger disconnection and
re-connection the limit configured through firmware becomes active again
(or the D+/D- USB signal-based charger detection will be run again).

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:54:52 +02:00
Andreas Dannenberg 138606ffe4 power: bq24257: Add input DPM voltage threshold setting support
A new optional device property called "ti,in-dpm-voltage" is introduced
to allow configuring the input voltage threshold for the devices'
dynamic power path management (DPM) feature. In short, it can be used to
prevent the input voltage from dropping below a certain value as current
is drawn to charge the battery or supply the system.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:54:44 +02:00
Andreas Dannenberg bb2956e8e1 power: bq24257: Add over voltage protection setting support
A new optional device property called "ti,ovp-voltage" is introduced to
allow configuring the input over voltage protection setting.

This commit also adds the basic sysfs support for custom properties
which is being used to allow userspace to read the current ovp-voltage
setting.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:54:22 +02:00
Andreas Dannenberg 7c071a0a08 power: bq24257: Add SW-based approach for Power Good determination
A software-based approach for determining the charger's input voltage
"Power Good" state is introduced for devices like the bq24250 which
don't have a dedicated hardware pin for that purpose. This SW-based
approach is also used for other devices (with dedicated PG pin) as a
fall back solution if that pin is not configured to be used through
"pg-gpios".

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:53:37 +02:00
Andreas Dannenberg eb9fbcc669 power: bq24257: Allow manual setting of input current limit
A new optional device property called "ti,current-limit" is introduced
to allow disabling the D+/D- USB signal-based charger type auto-
detection algorithm used to set the input current limit and instead to
use a fixed input current limit.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:52:56 +02:00
Andreas Dannenberg 7ef62365c6 power: bq24257: Add bit definition for temp sense enable
Adding a missing bit definition for the sake of consistency device model
vs. bit field representation. No change in functionality.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:49:58 +02:00
Andreas Dannenberg bf02dca9ee power: bq24257: Add basic support for bq24250/bq24251
This patch adds basic support for bq24250 and bq24251 which are very
similar to the bq24257 the driver was originally written for. Basic
support means the ability to select a device through Kconfig, DT and
ACPI, an instance variable allowing to check which chip is active, and
the reporting back of the selected device through the model_name power
supply sysfs property.

This patch by itself is not sufficient to actually use those two added
devices in a real-world setting due to some feature differences which
are addressed by other patches in this series.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:49:58 +02:00
Andreas Dannenberg 3b84b8efef power: bq24257: Simplify bq24257_power_supply_init()
Eliminate a few lines of code by using the PTR_ERR_OR_ZERO() macro.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:48:28 +02:00
Andreas Dannenberg dfc602524b power: bq24257: Use managed power supply register
Use the devm_* managed version of the function to register the power
supply and remove the associated unregister function. This will simplify
error handling moving forward as it allows the unregister to happen
automatically. It also saves a few lines of code.

As this changes the order of putting the bq24257 into reset vs.
unregistering the power-supply during driver remove re-tested various
driver unload scenario to make sure that this doesn't cause any
unintended side effects such as erroneous interrupts.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-29 16:48:07 +02:00
Andreas Dannenberg 9b1cf1e44d power: bq24257: Streamline input current limit setup
The maximum amount of input current the charger should draw is dependent
on the power supply and should only be (re-)configured when the power
supply gets connected and disconnected. However the driver was also
lowering the bq24257's input current limit setting to 500mA when the
battery was removed and restored the previous setting according to the
power supply capabilities when the battery was reconnected although
these events are not impacting the amount of power that can be drawn
from the supply. Furthermore, a re-configuration of the input current
limit to 500mA when the battery gets disconnected is actually dangerous
if the limit was set higher previously and the system draws more than
500mA in which case the system voltage would be reduced in order to
maintain 500mA which could result in the system getting too low of a
supply to maintain operation. Last but not least the mechanism itself
used for battery re-connection detection did not work in corner cases
such as when the device's input current loop becomes active and the
bq24257 device clears its battery fault error resulting in incorrectly
reporting that the battery got reconnected.

This patches removes the impact the battery removal/insertion has on the
input current limit configured for the bq24257 and simplifies the
associated handler routine.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-28 18:47:50 +02:00
Andreas Dannenberg 5ff8c89d11 power: bq24257: Remove IRQ config through stat-gpios
At the time the driver was written GpioInt resources in ACPI were not
passed to the driver in client->irq, as opposed to DT enumeration. To
accommodate this use case, a "stat-gpios" property was introduced to
allow configuring the IRQ.

However this issue with ACPI was fixed in commit "845c877 i2c / ACPI:
Assign IRQ for devices that have GpioInt automatically" and makes this
workaround no longer necessary, hence we can remove the support for the
"stat-gpios" property and the associated code from the bq24257 driver.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-28 18:36:35 +02:00
Andrzej Hajda 2edd69a81d power: bq27xxx_battery: fix signedness bug in bq27xxx_battery_read_health()
We need flags to be signed for the error handling to work.

The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci [1].

[1]: http://permalink.gmane.org/gmane.linux.kernel/2038576

Fixes: 74aab849f3 ('power: bq27xxx_battery: Cleanup health checking')
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-By: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-28 18:07:48 +02:00
Marek Belisko 2202e1fc5a drivers: power: twl4030_charger: fix link problems when building as module
If either twl4030_charger or twl4030_madc is configured as MODULE,
we get build (link) errors.

To solve, the direct call of twl4030_get_madc_conversion() is replaced
by a call to iio_read_channel_processed().

Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Marek Belisko <marek@goldelico.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-26 19:10:09 +02:00
Valentin Rothberg 90adf98d95 wm831x_power: Use IRQF_ONESHOT to request threaded IRQs
Since commit 1c6c69525b ("genirq: Reject bogus threaded irq requests")
threaded IRQs without a primary handler need to be requested with
IRQF_ONESHOT, otherwise the request will fail.

scripts/coccinelle/misc/irqf_oneshot.cocci detected this issue.

Fixes: b5874f33bb ("wm831x_power: Use genirq")
Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-26 18:55:09 +02:00
Enric Balletbo i Serra 3636859b28 power_supply: Add support for tps65217-charger.
This patch adds support for the tps65217 charger driver. This driver is
responsible for controlling the charger aspect of the tps65217 mfd.
Currently, this mainly consists of turning on and off the charger, but
some other features of the charger can be supported through this driver.

Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-24 22:43:13 +02:00
Dan Carpenter 0bc58e9381 power: qcom_smbb: test the correct variable
"state" is a bool so it's never less than zero.  The intent was to test
"ret" instead.

Fixes: 56d7df8716 ('power: Add Qualcomm SMBB driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-24 22:35:24 +02:00
Pali Rohár 28153a31b8 bq2415x_charger: Fix null pointer dereference
Commit b68c316143 (bq2415x_charger: Allow to load and use driver even if
notify device is not registered yet) introduced null pointer dereference in
case bq is NULL. This patch fixes it.

Fixes: b68c316143 ("bq2415x_charger: Allow to load and use driver even if notify device is not registered yet")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23 18:59:19 +02:00
Andrew F. Davis 8807feb91b power: bq27xxx_battery: Add interrupt handling support
Some devices have a pin that can generate an interrupt when
the battery's status changes. Add an interrupt handler to
read the new battery status.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23 17:36:18 +02:00
Andrew F. Davis 74aab849f3 power: bq27xxx_battery: Cleanup health checking
Reorganize the logic checking battery health and add under temperature
condition checking.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23 17:36:18 +02:00
Andrew F. Davis d74534c277 power: bq27xxx_battery: Add support for additional bq27xxx family devices
Add support for additional devices and register equivalent family devices
including the bq27010, bq27210, bq27500, bq27510, bq27520, bq27530,
bq27531, bq27541, bq27542, bq27546, bq27545, bq27441, bq27421, and the
bq27641.

To facilitate this process the register mapings have been moved to tables
and other small cleanups have been made.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23 17:15:27 +02:00
Andrew F. Davis c570903290 power: bq27xxx_battery: Fix typos and change naming for state of charge functions
Fix typos and change "relative state of charge" to "state of charge" as not
all supported devices use relative state of charge.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23 16:23:59 +02:00
Andrew F. Davis 424cfde49a power: bq27xxx_battery: Platform initialization must declare a device
When initialized as a platform device the initializer must now specify
a device. An empty device name is no longer valid.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23 16:23:12 +02:00
Andrew F. Davis 081bab217d power: bq27x00_battery: Renaming for consistency
Rename functions that are used by multiple devices. New devices
have been added and the function names and driver name are no longer
general enough for the functionality they provide.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Acked-by: GUAN Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-23 16:16:22 +02:00
Andrew F. Davis 95b8aff2a6 power: bq27x00_battery: Remove unneeded i2c MODULE_ALIAS
The MODULE_DEVICE_TABLE macro automatically adds all needed
i2c MODULE_ALIASes so remove the extra MODULE_ALIAS.

Signed-off-by: Andrew F. Davis <afd@ti.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 16:20:10 +02:00
Vaishali Thakkar 5e5822f670 power_supply: max8998: Use devm_power_supply_register
Use managed resource function devm_power_supply_register instead
of power_supply_register to simplify the error path by allowing
unregister to happen automatically on error. To be compatible with
the change, replace various gotos by direct returns and remove
unneeded label err.

Also, remove max8998_battery_remove as it is now redundant.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 16:20:10 +02:00
Luis de Bethencourt c72b7bf82c tps65090-charger: Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luisbg@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 16:03:37 +02:00
Vaishali Thakkar 0df2deeab4 max8903_charger: Convert to using managed resources
Use managed resource functions devm_request_threaded_irq and
devm_power_supply_register to simplify error handling.

To be compatible with the change, various gotos are replaced
with direct returns and unneeded labels are dropped. Also,
remove max8903_remove as it is now redundant.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 16:02:16 +02:00
Vaishali Thakkar 50bddb99c1 power: max17042_battery: Convert to using managed resources
Use managed resource functions devm_request_threaded_irq and
devm_power_supply_register to simplify error handling.

Also, remove max17042_remove as it is now redundant.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 16:01:34 +02:00
Nicolas Ferre bc312cbdfa power: reset: at91-reset/trivial: driver applies to SAMA5 family as well
This diver doesn't applies only on SAM9 SoC families but on SAMA5 families
as well.

Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 15:45:39 +02:00
Alexandre Belloni 064380a12e power/reset: at91-poweroff: get and use slow clock
Commit dca1a4b5ff ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91 shutdown
controller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 15:18:53 +02:00
Alexandre Belloni 6dd1ad1f23 power/reset: at91-poweroff: allow compiling as a module
It was not possible to compile at91-poweroff as a module. Implement
.remove() to allow it. Also switch to module_platform_driver_probe() as it
is not hotpluggable.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 15:18:53 +02:00
Alexandre Belloni 2b2c6148fe power/reset: at91-reset: get and use slow clock
Commit dca1a4b5ff ("clk: at91: keep slow clk enabled to prevent system
hang") added a workaround for the slow clock as it is not properly handled
by its users.

Get and use the slow clock as it is necessary for the at91 reset
controller.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 15:18:52 +02:00
Alexandre Belloni 6e64180a7c power/reset: at91-reset: allow compiling as a module
It was not possible to compile at91-reset as a module. Implement .remove()
to allow it. Also switch to module_platform_driver_probe() as it is not
hotpluggable.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 15:18:52 +02:00
Alexandre Belloni eacd8d09db power/reset: at91-reset: remove useless at91_reset_platform_probe()
Since all the at91 platforms are now DT only, at91_reset_platform_probe()
is now useless, remove it.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 15:18:52 +02:00
Vaishali Thakkar 2a9123f185 88pm860x_battery: Convert to using managed resources
Use managed resource functions devm_request_threaded_irq and
devm_power_supply_register to simplify error handling.

To be compatible with the change, various gotos are replaced
with direct returns and unneeded labels are dropped. Also,
remove pm860x_battery_remove as it is now redundant.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 13:35:31 +02:00
Courtney Cavin 56d7df8716 power: Add Qualcomm SMBB driver
Add the Qualcomm Switch-Mode Battery Charger and Boost driver, found in
pm8941.

Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 13:35:30 +02:00
Javier Martinez Canillas da42bbd99d power: Remove unnecessary MODULE_ALIAS() for I2C drivers
These drivers already have an I2C device id table that is used to create
module aliases and the used MODULE_ALIAS() was either already in the I2C
table so it was redundant or wasn't a valid I2C id so it was never used.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 13:35:30 +02:00
Milo Kim 9615a29932 power:lp8727_charger: parsing child node after getting debounce-ms
According to lp8727 bindings[*], charging parameter is optional.
So parsing can be skipped in case those properties are undefined.
However, 'debounce-ms' should be read prior to checking the properties.
Otherwise, 'debounce-ms' property will be ignored even it is configured
inside the DT.
So, counting child is processed after updating 'debounce-ms'.

[*] Documentation/devicetree/bindings/power_supply/lp8727_charger.txt

Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 13:35:29 +02:00
Milo Kim 87d931d569 power:lp8727_charger: use the private data instead of updating I2C device platform data
Currently, lp8727 charger driver parses the DT and copies values into the
'cl->dev.platform_data' if 'of_node' exists.
This may have architectural issue. Platform data is configurable through
the DT or I2C board info inside the platform area.
However, lp8727 driver changes this configuration when it is loaded.

The driver should get data from the platform side and use the private
data, 'lp8727_chg->pdata' instead of changing the original platform data.

_probe() procedure is changed as follows.
  1. lp8727_parse_dt() returns the pointer of lp8727_platform_data.
     The driver uses this allocated platform data. So it should keep
     original platform data, 'dev->platform_data'.
  2. In _probe(), check the return value of lp8727_parse_dt().
     If an error is found, then exit as PTR_ERR(pdata).
  3. If 'of_node' is not found, then the driver just gets the platform data
     from the I2C device structure.
  4. Map the platform data to private data structure.

Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Milo Kim <milo.kim@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 13:35:29 +02:00
Mark Brown c01576c8f3 power: wm831x_power: Convert to devm_kzalloc()
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 13:35:28 +02:00
Hans de Goede 69fb4dcada power: Add an axp20x-usb-power driver
This adds a driver for the usb power_supply bits of the axp20x PMICs.

I initially started writing my own driver, before coming aware of
Bruno Prémont's excellent earlier RFC with a driver for this.

My driver was lacking CURRENT_MAX and VOLTAGE_MIN support Bruno's
drvier has, so I've copied the code for those from his driver.

Note that the AC-power-supply and battery charger bits will need separate
drivers. Each one needs its own devictree child-node so that other
devicetree nodes can reference the right power-supply, and thus each one
will get its own mfd-cell / platform_device and platform-driver.

Cc: Bruno Prémont <bonbons@linux-vserver.org>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-22 13:35:28 +02:00
Linus Torvalds 2e5735f4c3 power supply and reset fixes for the v4.3 series
* twl4030-charger fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABCgAGBQJV+BZgAAoJENju1/PIO/qaWpMP/0s+579Lu1dJssDGiTYzbe0h
 IDeLvFbj6ikHehSCoKYeKiWJ765p/yYI0SySB6OLXuXxJsluDNqD/OSNh+ieZSZy
 thLmV5+pEW/a9zIl223JZGDWMBbFCtHJX3S61bRldtrv3CCeB1vQIw+3QDhG4YKb
 GAuWF/zs3FLMtMpycxx8cl08cm8KaDZ9tZEtASt2xAO2LfVOWc2I0JDfTraFrtn6
 xpnqT6Y7noFHDT2DdKgg6hvymWzUUPhQj2uTEhdl4l3yjTCXXOYReyYEmYBQKYgi
 cpT6ydetphZAeu73I4UikQjRUeXbE+d/iWdPwR6ZzgYPn9V9yBWkN5v7F1aVm8+1
 GWZUcT5tFXSeOIwocPlzTJP5h7f/wLhTfgPtN4REaQJTj1NGvptByZPbKckdCbQr
 V6eYryhQNdDYBRwKHFn48YD6X2CkuvitQ8CJokcnGqB0iw1L/tdACjcsFC0hIbrN
 N3tXenzvnA9mTeAQRMMXjAO7Y9GBY86ssZcMbtMQGbMv4hfVOgmK/RBauMMmLb2t
 HffceagdQr9Dxf2UVUGvH/hRwCqvmGjiK9vbO8iY8VgnWFmtIjDQiP9y8uns2RsD
 5AR/HMl00dcptLc0/MWojvJzn3Q43MlkFb9Hod3GFKgI1IsVjrlmepO9ImFCnKmQ
 UMzowtWTwm4lBk0Bk1gh
 =5keI
 -----END PGP SIGNATURE-----

Merge tag 'for-v4.3-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply fixes from Sebastian Reichel:
 "twl4030-charger fixes"

* tag 'for-v4.3-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply:
  twl4030_charger: fix another compile error
  Revert "twl4030_charger: correctly handle -EPROBE_DEFER from devm_usb_get_phy_by_node"
2015-09-17 12:25:42 -07:00
Linus Torvalds 9ebd051a7d Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal updates from Zhang Rui:

 - use int instead of unsigned long to represent temperature to avoid
   bogus overheat detection when negative temperature reported.  From
   Sascha Hauer.

 - export available thermal governors information to user space via
   sysfs.  From Wei Ni.

 - introduce new thermal driver for Wildcat Point platform controller
   hub, which uses PCH thermal sensor and associated critical and hot
   trip points.  From Tushar Dave.

 - add suuport for Intel Skylake and Denlow platforms in powerclamp
   driver.

 - some small cleanups in thermal core.

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
  thermal: Add Intel PCH thermal driver
  thermal: Add comment explaining test for critical temperature
  thermal: Use IS_ENABLED instead of #ifdef
  thermal: remove unnecessary call to thermal_zone_device_set_polling
  thermal: trivial: fix typo in comment
  thermal: consistently use int for temperatures
  thermal: add available policies sysfs attribute
  thermal/powerclamp: add cpu id for denlow platform
  thermal/powerclamp: add cpu id for Skylake u/y
  thermal/powerclamp: add cpu id for skylake h/s
2015-09-11 16:13:47 -07:00
Grazvydas Ignotas e11fc21e75 twl4030_charger: fix another compile error
When CONFIG_CHARGER_TWL4030=y and CONFIG_TWL4030_MADC=m we get a
compile error:

drivers/built-in.o: In function `twl4030_charger_update_current':
twl4030_charger.c:(.text+0x504681): undefined reference to
`twl4030_get_madc_conversion'

Use IS_REACHABLE to fix it.

Cc: NeilBrown <neil@brown.name>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-10 22:13:11 +02:00
Sebastian Reichel aefc574bbb Revert "twl4030_charger: correctly handle -EPROBE_DEFER from devm_usb_get_phy_by_node"
Revert commit 3fc3895e4f, since
it introduced a boot failure on some OMAP platforms.

Reported-by: Kevin Hilman <khilman@kernel.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-09-10 22:04:07 +02:00
Linus Torvalds ae98207309 Power management and ACPI material for v4.3-rc1
- ACPICA update to upstream revision 20150818 including method
    tracing extensions to allow more in-depth AML debugging in the
    kernel and a number of assorted fixes and cleanups (Bob Moore,
    Lv Zheng, Markus Elfring).
 
  - ACPI sysfs code updates and a documentation update related to
    AML method tracing (Lv Zheng).
 
  - ACPI EC driver fix related to serialized evaluations of _Qxx
    methods and ACPI tools updates allowing the EC userspace tool
    to be built from the kernel source (Lv Zheng).
 
  - ACPI processor driver updates preparing it for future
    introduction of CPPC support and ACPI PCC mailbox driver
    updates (Ashwin Chaugule).
 
  - ACPI interrupts enumeration fix for a regression related
    to the handling of IRQ attribute conflicts between MADT
    and the ACPI namespace (Jiang Liu).
 
  - Fixes related to ACPI device PM (Mika Westerberg, Srinidhi Kasagar).
 
  - ACPI device registration code reorganization to separate the
    sysfs-related code and bus type operations from the rest (Rafael
    J Wysocki).
 
  - Assorted cleanups in the ACPI core (Jarkko Nikula, Mathias Krause,
    Andy Shevchenko, Rafael J Wysocki, Nicolas Iooss).
 
  - ACPI cpufreq driver and ia64 cpufreq driver fixes and cleanups
    (Pan Xinhui, Rafael J Wysocki).
 
  - cpufreq core cleanups on top of the previous changes allowing it
    to preseve its sysfs directories over system suspend/resume (Viresh
    Kumar, Rafael J Wysocki, Sebastian Andrzej Siewior).
 
  - cpufreq fixes and cleanups related to governors (Viresh Kumar).
 
  - cpufreq updates (core and the cpufreq-dt driver) related to the
    turbo/boost mode support (Viresh Kumar, Bartlomiej Zolnierkiewicz).
 
  - New DT bindings for Operating Performance Points (OPP), support
    for them in the OPP framework and in the cpufreq-dt driver plus
    related OPP framework fixes and cleanups (Viresh Kumar).
 
  - cpufreq powernv driver updates (Shilpasri G Bhat).
 
  - New cpufreq driver for Mediatek MT8173 (Pi-Cheng Chen).
 
  - Assorted cpufreq driver (speedstep-lib, sfi, integrator) cleanups
    and fixes (Abhilash Jindal, Andrzej Hajda, Cristian Ardelean).
 
  - intel_pstate driver updates including Skylake-S support, support
    for enabling HW P-states per CPU and an additional vendor bypass
    list entry (Kristen Carlson Accardi, Chen Yu, Ethan Zhao).
 
  - cpuidle core fixes related to the handling of coupled idle states
    (Xunlei Pang).
 
  - intel_idle driver updates including Skylake Client support and
    support for freeze-mode-specific idle states (Len Brown).
 
  - Driver core updates related to power management (Andy Shevchenko,
    Rafael J Wysocki).
 
  - Generic power domains framework fixes and cleanups (Jon Hunter,
    Geert Uytterhoeven, Rajendra Nayak, Ulf Hansson).
 
  - Device PM QoS framework update to allow the latency tolerance
    setting to be exposed to user space via sysfs (Mika Westerberg).
 
  - devfreq support for PPMUv2 in Exynos5433 and a fix for an incorrect
    exynos-ppmu DT binding (Chanwoo Choi, Javier Martinez Canillas).
 
  - System sleep support updates (Alan Stern, Len Brown, SungEun Kim).
 
  - rockchip-io AVS support updates (Heiko Stuebner).
 
  - PM core clocks support fixup (Colin Ian King).
 
  - Power capping RAPL driver update including support for Skylake H/S
    and Broadwell-H (Radivoje Jovanovic, Seiichi Ikarashi).
 
  - Generic device properties framework fixes related to the handling
    of static (driver-provided) property sets (Andy Shevchenko).
 
  - turbostat and cpupower updates (Len Brown, Shilpasri G Bhat,
    Shreyas B Prabhu).
 
 /
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABCAAGBQJV5hhGAAoJEILEb/54YlRxs+EQAK51iFk48+IbpHYaZZ50Yo4m
 ZZc2zBcbwRcBlU9vKERrhG+jieSl8J/JJNxT8vBjKqyvNw038mCjewQh02ol0HuC
 R7nlDiVJkmZ50sLO4xwE/1UBZr/XqbddwCUnYzvFMkMTA0ePzFtf8BrJ1FXpT8S/
 fkwSXQty6hvJDwxkfrbMSaA730wMju9lahx8D6MlmUAedWYZOJDMQKB4WKa/St5X
 9uckBPHUBB2KiKlXxdbFPwKLNxHvLROq5SpDLc6cM/7XZB+QfNFy85CUjCUtYo1O
 1W8k0qnztvZ6UEv27qz5dejGyAGOarMWGGNsmL9evoeGeHRpQL+dom7HcTnbAfUZ
 walyhYSm/zKkdy7Vl3xWUUQkMG48+PviMI6K0YhHXb3Rm5wlR/yBNZTwNIty9SX/
 fKCHEa8QynWwLxgm53c3xRkiitJxMsHNK03moLD9zQMjshTyTNvpNbZoahyKQzk6
 H+9M1DBRHhkkREDWSwGutukxfEMtWe2vcZcyERrFiY7l5k1j58DwDBMPqjPhRv6q
 P/1NlCzr0XYf83Y86J18LbDuPGDhTjjIEn6CqbtI2mmWqTg3+rF7zvS2ux+FzMnA
 gisv8l6GT9JiWhxKFqqL/rrVpwtyHebWLYE/RpNUW6fEzLziRNj1qyYO9dqI/GGi
 I3rfxlXoc/5xJWCgNB8f
 =fTgI
 -----END PGP SIGNATURE-----

Merge tag 'pm+acpi-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management and ACPI updates from Rafael Wysocki:
 "From the number of commits perspective, the biggest items are ACPICA
  and cpufreq changes with the latter taking the lead (over 50 commits).

  On the cpufreq front, there are many cleanups and minor fixes in the
  core and governors, driver updates etc.  We also have a new cpufreq
  driver for Mediatek MT8173 chips.

  ACPICA mostly updates its debug infrastructure and adds a number of
  fixes and cleanups for a good measure.

  The Operating Performance Points (OPP) framework is updated with new
  DT bindings and support for them among other things.

  We have a few updates of the generic power domains framework and a
  reorganization of the ACPI device enumeration code and bus type
  operations.

  And a lot of fixes and cleanups all over.

  Included is one branch from the MFD tree as it contains some
  PM-related driver core and ACPI PM changes a few other commits are
  based on.

  Specifics:

   - ACPICA update to upstream revision 20150818 including method
     tracing extensions to allow more in-depth AML debugging in the
     kernel and a number of assorted fixes and cleanups (Bob Moore, Lv
     Zheng, Markus Elfring).

   - ACPI sysfs code updates and a documentation update related to AML
     method tracing (Lv Zheng).

   - ACPI EC driver fix related to serialized evaluations of _Qxx
     methods and ACPI tools updates allowing the EC userspace tool to be
     built from the kernel source (Lv Zheng).

   - ACPI processor driver updates preparing it for future introduction
     of CPPC support and ACPI PCC mailbox driver updates (Ashwin
     Chaugule).

   - ACPI interrupts enumeration fix for a regression related to the
     handling of IRQ attribute conflicts between MADT and the ACPI
     namespace (Jiang Liu).

   - Fixes related to ACPI device PM (Mika Westerberg, Srinidhi
     Kasagar).

   - ACPI device registration code reorganization to separate the
     sysfs-related code and bus type operations from the rest (Rafael J
     Wysocki).

   - Assorted cleanups in the ACPI core (Jarkko Nikula, Mathias Krause,
     Andy Shevchenko, Rafael J Wysocki, Nicolas Iooss).

   - ACPI cpufreq driver and ia64 cpufreq driver fixes and cleanups (Pan
     Xinhui, Rafael J Wysocki).

   - cpufreq core cleanups on top of the previous changes allowing it to
     preseve its sysfs directories over system suspend/resume (Viresh
     Kumar, Rafael J Wysocki, Sebastian Andrzej Siewior).

   - cpufreq fixes and cleanups related to governors (Viresh Kumar).

   - cpufreq updates (core and the cpufreq-dt driver) related to the
     turbo/boost mode support (Viresh Kumar, Bartlomiej Zolnierkiewicz).

   - New DT bindings for Operating Performance Points (OPP), support for
     them in the OPP framework and in the cpufreq-dt driver plus related
     OPP framework fixes and cleanups (Viresh Kumar).

   - cpufreq powernv driver updates (Shilpasri G Bhat).

   - New cpufreq driver for Mediatek MT8173 (Pi-Cheng Chen).

   - Assorted cpufreq driver (speedstep-lib, sfi, integrator) cleanups
     and fixes (Abhilash Jindal, Andrzej Hajda, Cristian Ardelean).

   - intel_pstate driver updates including Skylake-S support, support
     for enabling HW P-states per CPU and an additional vendor bypass
     list entry (Kristen Carlson Accardi, Chen Yu, Ethan Zhao).

   - cpuidle core fixes related to the handling of coupled idle states
     (Xunlei Pang).

   - intel_idle driver updates including Skylake Client support and
     support for freeze-mode-specific idle states (Len Brown).

   - Driver core updates related to power management (Andy Shevchenko,
     Rafael J Wysocki).

   - Generic power domains framework fixes and cleanups (Jon Hunter,
     Geert Uytterhoeven, Rajendra Nayak, Ulf Hansson).

   - Device PM QoS framework update to allow the latency tolerance
     setting to be exposed to user space via sysfs (Mika Westerberg).

   - devfreq support for PPMUv2 in Exynos5433 and a fix for an incorrect
     exynos-ppmu DT binding (Chanwoo Choi, Javier Martinez Canillas).

   - System sleep support updates (Alan Stern, Len Brown, SungEun Kim).

   - rockchip-io AVS support updates (Heiko Stuebner).

   - PM core clocks support fixup (Colin Ian King).

   - Power capping RAPL driver update including support for Skylake H/S
     and Broadwell-H (Radivoje Jovanovic, Seiichi Ikarashi).

   - Generic device properties framework fixes related to the handling
     of static (driver-provided) property sets (Andy Shevchenko).

   - turbostat and cpupower updates (Len Brown, Shilpasri G Bhat,
     Shreyas B Prabhu)"

* tag 'pm+acpi-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (180 commits)
  cpufreq: speedstep-lib: Use monotonic clock
  cpufreq: powernv: Increase the verbosity of OCC console messages
  cpufreq: sfi: use kmemdup rather than duplicating its implementation
  cpufreq: drop !cpufreq_driver check from cpufreq_parse_governor()
  cpufreq: rename cpufreq_real_policy as cpufreq_user_policy
  cpufreq: remove redundant 'policy' field from user_policy
  cpufreq: remove redundant 'governor' field from user_policy
  cpufreq: update user_policy.* on success
  cpufreq: use memcpy() to copy policy
  cpufreq: remove redundant CPUFREQ_INCOMPATIBLE notifier event
  cpufreq: mediatek: Add MT8173 cpufreq driver
  dt-bindings: mediatek: Add MT8173 CPU DVFS clock bindings
  PM / Domains: Fix typo in description of genpd_dev_pm_detach()
  PM / Domains: Remove unusable governor dummies
  PM / Domains: Make pm_genpd_init() available to modules
  PM / domains: Align column headers and data in pm_genpd_summary output
  powercap / RAPL: disable the 2nd power limit properly
  tools: cpupower: Fix error when running cpupower monitor
  PM / OPP: Drop unlikely before IS_ERR(_OR_NULL)
  PM / OPP: Fix static checker warning (broken 64bit big endian systems)
  ...
2015-09-01 19:45:46 -07:00
Linus Torvalds cf9d615f7f regulator: Updates for v4.3
The biggest changes in the core this time around have been some
 refactorings that move us towards being able to drop the list of
 regulators maintained by the core and instead just use the driver model
 list maintained for the class devices for regulators which will make the
 code smaller and avoid some potential bugs.  Otherwise another fairly
 quiet release for the regulator API, highlights include:
 
  - A new API for setting voltages based on a minimum, target, maximum
    triplet.
  - Support for continuous voltage ranges rather than tables of explicit
    steps in the PWM regulator, requiring less explicit configuration.
  - New driver support for Dialog DA9215, Maxim 77843, Mediatek MT6311
    and Qualcomm RPM.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJV5DCWAAoJECTWi3JdVIfQDgYH/3mNwtRcwslt8M1L8lzRVyf1
 gRrJY5r4EUOcqqsLnQvDHdjgO2yowEolEd3Hd/GElZqzeFgwXaQ62kHwgqnvOt9k
 O0l99FbU6ECpB56tSENrV1lfvBTlld9bEhq9NhxvNiWAdpGPqIcjvXfSH28GssJ0
 NGr4Yt/A1DG6GsOWxKSODX56WJXJn4emKx3vHH+leUClNWwQVK6JunTmj5IPKLxW
 K94Ke41L3JgAy18TLqvFNlTAC22QaHFaM8ul9v7gnPW+S8Bx15MCQz16rMkGViZV
 c/DyCu69qCVFLI1svRrvB5oq700QT0GT6jANCVmw+CrkIkESwjS39kX861H6hk8=
 =vrVx
 -----END PGP SIGNATURE-----

Merge tag 'regulator-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "The biggest changes in the core this time around have been some
  refactorings that move us towards being able to drop the list of
  regulators maintained by the core and instead just use the driver
  model list maintained for the class devices for regulators which will
  make the code smaller and avoid some potential bugs.

  Otherwise another fairly quiet release for the regulator API,
  highlights include:

   - a new API for setting voltages based on a minimum, target, maximum
     triplet

   - support for continuous voltage ranges rather than tables of
     explicit steps in the PWM regulator, requiring less explicit
     configuration

   - new driver support for Dialog DA9215, Maxim 77843, Mediatek MT6311
     and Qualcomm RPM"

* tag 'regulator-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (70 commits)
  regulator: mt6311: fix platform_no_drv_owner.cocci warnings
  regulator: ltc3589: Remove unnecessary MODULE_ALIAS()
  regulator: ad5398: Remove unnecessary MODULE_ALIAS()
  regulator: pfuze100: Remove unnecessary MODULE_ALIAS()
  regulator: core: use debug level print in regulator_check_drms
  regulator: lp872x: handle error case
  regulator: lp872x: use the private data instead of updating I2C device platform data
  regulator: isl9305: Export OF module alias information
  regulators: max77693: register driver earlier to avoid deferred probe
  regulator: qcom_smd: Set n_voltages for pm8941_lnldo
  regulator: core: Use IS_ERR_OR_NULL()
  regulator: core: Define regulator_set_voltage_triplet()
  regulator: Regulator driver for the Qualcomm RPM
  regulator: pbias: Fix broken pbias disable functionality
  regulator: core: Spelling fix
  regulator: core: Use class device list for regulator_list in late init
  regulator: core: Move more deallocation into class unregister
  regulator: core: Reduce rdev locking region when releasing regulator
  Input: Remove the max77843 haptic driver
  Input: max77693: Add support for Maxim 77843
  ...
2015-08-31 15:49:19 -07:00
Pali Rohár b68c316143 bq2415x_charger: Allow to load and use driver even if notify device is not registered yet
Driver bq2415x_charger works also without notify power supply device for
charger detection. But when charger detection is specified in DT, then
bq2415x_charger refused to loaded with -EPROBE_DEFER.

This patch rewrites code so that notify device for charger detection is
checked when power supply event is received and not when registering power
supply device. So this patch allows to use bq2415x_charger driver also when
kernel is compiled without driver for notify power supply device.

Now after this patch scheduled workqueue is called after INIT_DELAYED_WORK,
so it also fix problem when scheduled workqueue was called before init.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-21 16:46:38 +02:00
Heiko Stuebner 3fc147e915 PM / AVS: rockchip-io: add io selectors and supplies for rk3368
This adds the necessary data for handling io voltage domains on the rk3368.
As interesting tidbit, the rk3368 contains two separate iodomain areas.
One in the regular General Register Files (GRF) and one in PMUGRF in the
pmu power domain.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-08-08 03:07:52 +02:00
Heiko Stuebner 28c1f1628e PM / AVS: rockchip-io: depend on CONFIG_POWER_AVS
The rockchip io-domain driver currently only depends on ARCH_ROCKCHIP
itself. This makes it possible to select the power-domain driver, but
not the POWER_AVS class and results in the iodomain-driver not getting
build in this case.

So add the additional dependency, which also results in the driver
config option now being placed nicely into the AVS submenu.

Fixes: 662a958638 ("PM / AVS: rockchip-io: add driver handling Rockchip io domains")
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Acked-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-08-08 03:07:52 +02:00
NeilBrown b49d15d138 twl4030_charger: fix compile error when TWL4030_MADC not available.
We can only use the madc to check for 'ac' availability if the madc has
been compiled in.  If not: assume always using USB.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: NeilBrown <neil@brown.name>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-07 07:04:56 +02:00
Andreas Dannenberg c9f85a90d4 power: bq24190_charger: Fix charge type sysfs property
Access to the BQ24190's configurable charge type property (none, trickle,
fast) is being masked by an incorrect power_supply_property entry. After
applying this patch a new 'charge_type' property will appear in the
bq24190-charger sysfs folder backed up by getters/setters already
present in the driver.

Signed-off-by: Andreas Dannenberg <dannenberg@ti.com>
Acked-by: Dan Murphy <dmurphy@ti.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 06:01:15 +02:00
Geert Uytterhoeven 1e8b82c1ff power: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:48:08 +02:00
Javier Martinez Canillas 63369b2b99 power: Export I2C module alias information in missing drivers
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the driver was matched using the I2C id_table or the
of_match_table. So the driver needs to export the I2C table and this
be built into the module or udev won't have the necessary information
to auto load the correct module when the device is added.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:39:08 +02:00
NeilBrown 21ae40404f twl4030_charger: Increase current carefully while watching voltage.
The USB Battery Charging spec (BC1.2) suggests a dedicated
charging port can deliver from 0.5 to 5.0A at between 4.75 and 5.25
volts.

To choose the "correct" current voltage setting requires a trial
and error approach: try to draw current and see if the voltage drops
too low.

Even with a configured Standard Downstream Port, it may not be possible
to reliably pull 500mA - depending on cable quality and source
quality I have reports of charging failure due to the voltage dropping
too low.

To address both these concerns, this patch introduce incremental
current setting.
The current pull from VBUS is increased in steps of 20mA every 100ms
until the target is reached or until the measure voltage drops below
4.75V.  If the voltage does go too low, the target current is reduced
by 20mA and kept there.

This applies to currents selected automatically, or to values
set via sysfs.  So setting a large value will cause the maximum
available to be used - up to the limit of 1.7A imposed by the
hardware.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:23:04 +02:00
NeilBrown b04b908d8a twl4030_charger: add ac/mode to match usb/mode
This allows AC charging to be turned off, much like usb charging.
"continuous" mode is not available though.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:21:57 +02:00
NeilBrown 7f4a633d21 twl4030_charger: add software controlled linear charging mode.
Add a 'continuous' option for usb charging which enables
the "linear" charging mode of the twl4030.

Linear charging does a good job with not-so-reliable power sources.
Auto mode does not work well as it switches off when voltage drops
momentarily.  Care must be taken not to over-charge.

It was used with a bike hub dynamo since a year or so. In that case
there are automatically charging stops when the cyclist needs a break.

Original-by: Andreas Kemnade <andreas@kemnade.info>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:21:32 +02:00
NeilBrown 22d4c33f73 twl4030_charger: enable manual enable/disable of usb charging.
'off' or 'auto' to

 /sys/class/power/twl4030_usb/mode

will now enable or disable charging from USB port.  Normally this is
enabled on 'plug' and disabled on 'unplug'.
Unplug will still disable charging.  'plug' will only enable it if
'auto' if selected.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:20:36 +02:00
NeilBrown aca3c35463 twl4030_charger: allow max_current to be managed via sysfs.
'max_current' sysfs attributes are created which allow the
max to be set.
Whenever a current source changes, the default is restored.
This will be followed by a uevent, so user-space can decide to
update again.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:19:44 +02:00
NeilBrown e4ae537e04 twl4030_charger: distinguish between USB current and 'AC' current
The twl4030 charger has two current sources, 'USB' and 'AC'
(presumably "Accessory Charger" because it isn't Alternating Current).

If 'AC' is providing current, we should set the current limit
differently to when it isn't (and so USB is used).
So split 'cur' into 'usb_cur' and 'ac_cur' and use accordingly.

Now we must review the current setting on any interrupt or USB
event which might indicate that the charger-source has changed.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:18:06 +02:00
NeilBrown 1098cb58ae twl4030_charger: allow fine control of charger current.
The twl4030 allows control of the incoming current.
Part of this control is a 'CGAIN' setting which doubles
the range for half the precision.  This control affects
several different current setting, so all need to be updated
at once when CGAIN is changed.

With this patch, all of these current setting are managed
by the driver, but most are left at their default settings.

The current drawn is set to 500mA if the allow_usb module parameter is
set, and to 100mA otherwise.
More fine control will appear in later patches.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:15:25 +02:00
NeilBrown 3b542f089d twl4030_charger: split uA calculation into a function.
We will need this calculation in other places, so
create functions to map between register value and uA value.

Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:14:43 +02:00
NeilBrown 6e37ec8c77 twl4030_charger: trust phy to determine when USB power is available.
The usb phy driver already determines when VBUS is available,
so repeating the test in the charger driver is pointless duplication.

On probe, process the last event from the phy, and from then on,
do whatever the phy tells us without double-checking.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:12:42 +02:00
NeilBrown 3fc3895e4f twl4030_charger: correctly handle -EPROBE_DEFER from devm_usb_get_phy_by_node
Now that twl4030_bci_probe can safely return -EPROBE_DEFER,
do so when devm_usb_get_phy_by_node returns that error.

Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:11:35 +02:00
Pavel Machek 7396f708b9 twl4030_charger: convert to module_platform_driver instead of ..._probe.
Drivers using module_platform_driver_probe cannot return
EPROBE_DEFER from the probe function, which makes them rather useless
these days...

Convert to module_platform_driver() so EPROBE_DEFER can be used.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:10:54 +02:00
NeilBrown e57c4a67d7 twl4030_charger: use runtime_pm to keep usb phy active while charging.
The twl4030 usb phy needs to be active while we are using
the USB VBUS as a current source for charging.
In particular, the usb3v1 regulator must be enabled and the
PHY_PWR_PHYPWD bit must be set to keep the phy powered.

commit ab37813f40
    twl4030_charger: Allow charger to control the regulator that feeds it

gave the charger control over the regulator, but didn't resolve
the PHY_PWR_PHYPWD issue.

Now that both of these are controlled by runtime_pm in
phy-twl4030-usb, we can simply take a runtime_pm reference to the USB
phy whenever the charger wants to use it as a current source.

So this patch reverts the above commit, and adds the necessary
runtime_pm calls.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-05 05:10:06 +02:00
Sascha Hauer 17e8351a77 thermal: consistently use int for temperatures
The thermal code uses int, long and unsigned long for temperatures
in different places.

Using an unsigned type limits the thermal framework to positive
temperatures without need. Also several drivers currently will report
temperatures near UINT_MAX for temperatures below 0°C. This will probably
immediately shut the machine down due to overtemperature if started below
0°C.

'long' is 64bit on several architectures. This is not needed since INT_MAX °mC
is above the melting point of all known materials.

Consistently use a plain 'int' for temperatures throughout the thermal code and
the drivers. This only changes the places in the drivers where the temperature
is passed around as pointer, when drivers internally use another type this is
not changed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Peter Feuerer <peter@piie.net>
Cc: Punit Agrawal <punit.agrawal@arm.com>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Jean Delvare <jdelvare@suse.de>
Cc: Peter Feuerer <peter@piie.net>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: linux-acpi@vger.kernel.org
Cc: platform-driver-x86@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Cc: linux-samsung-soc@vger.kernel.org
Cc: Guenter Roeck <linux@roeck-us.net>
Cc: Rafael J. Wysocki <rjw@rjwysocki.net>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Darren Hart <dvhart@infradead.org>
Cc: lm-sensors@lm-sensors.org
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-08-03 23:15:50 +08:00
Pali Rohár b5e578631e rx51-battery: Set name to rx51-battery
For compatibility between board code and DT, set battery name to same value.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-08-03 17:14:57 +02:00
Vladimir Zapolskiy 3e1d9c6f24 power: olpc_battery: clean up eeprom read function
The change removes redundant sysfs binary file boundary check while
reading eeprom content from userspace, the check is done on caller
side in fs/sysfs/file.c, if binary attribute size is not zero.

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27 16:28:54 +02:00
Vladimir Zapolskiy 9f28b86552 power: ds2781_battery: clean up eeprom read/write functions
The change removes redundant calculation of left space on eeprom while
reading or writing "param_eeprom" or "user_eeprom", the checks are not
needed, since this task is done on caller side in fs/sysfs/file.c

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27 16:28:54 +02:00
Vladimir Zapolskiy 753f15833c power: ds2780_battery: clean up eeprom read/write functions
The change removes redundant sysfs binary file boundary checks while
reading or writing "param_eeprom" or "user_eeprom", the checks are not
needed, since this task is done on caller side in fs/sysfs/file.c

Signed-off-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
2015-07-27 16:28:54 +02:00