Commit 021723e6 authored by Linus Torvalds's avatar Linus Torvalds

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"
  ...
parents c6594fc6 1d72706f
...@@ -1090,6 +1090,10 @@ S: 6350 Stoneridge Mall Road ...@@ -1090,6 +1090,10 @@ S: 6350 Stoneridge Mall Road
S: Pleasanton, CA 94588 S: Pleasanton, CA 94588
S: USA S: USA
N: Dmitry Eremin-Solenikov
E: dbaryshkov@gmail.com
D: Power Supply Maintainer from v3.14 - v3.15
N: Doug Evans N: Doug Evans
E: dje@cygnus.com E: dje@cygnus.com
D: Wrote Xenix FS (part of standard kernel since 0.99.15) D: Wrote Xenix FS (part of standard kernel since 0.99.15)
......
...@@ -22,7 +22,7 @@ Description: ...@@ -22,7 +22,7 @@ Description:
What: /sys/class/power_supply/max14577-charger/device/fast_charge_timer What: /sys/class/power_supply/max14577-charger/device/fast_charge_timer
Date: October 2014 Date: October 2014
KernelVersion: 3.18.0 KernelVersion: 3.18.0
Contact: Krzysztof Kozlowski <k.kozlowski@samsung.com> Contact: Krzysztof Kozlowski <krzk@kernel.org>
Description: Description:
This entry shows and sets the maximum time the max14577 This entry shows and sets the maximum time the max14577
charger operates in fast-charge mode. When the timer expires charger operates in fast-charge mode. When the timer expires
...@@ -36,7 +36,7 @@ Description: ...@@ -36,7 +36,7 @@ Description:
What: /sys/class/power_supply/max77693-charger/device/fast_charge_timer What: /sys/class/power_supply/max77693-charger/device/fast_charge_timer
Date: January 2015 Date: January 2015
KernelVersion: 3.19.0 KernelVersion: 3.19.0
Contact: Krzysztof Kozlowski <k.kozlowski@samsung.com> Contact: Krzysztof Kozlowski <krzk@kernel.org>
Description: Description:
This entry shows and sets the maximum time the max77693 This entry shows and sets the maximum time the max77693
charger operates in fast-charge mode. When the timer expires charger operates in fast-charge mode. When the timer expires
...@@ -50,7 +50,7 @@ Description: ...@@ -50,7 +50,7 @@ Description:
What: /sys/class/power_supply/max77693-charger/device/top_off_threshold_current What: /sys/class/power_supply/max77693-charger/device/top_off_threshold_current
Date: January 2015 Date: January 2015
KernelVersion: 3.19.0 KernelVersion: 3.19.0
Contact: Krzysztof Kozlowski <k.kozlowski@samsung.com> Contact: Krzysztof Kozlowski <krzk@kernel.org>
Description: Description:
This entry shows and sets the charging current threshold for This entry shows and sets the charging current threshold for
entering top-off charging mode. When charging current in fast entering top-off charging mode. When charging current in fast
...@@ -65,7 +65,7 @@ Description: ...@@ -65,7 +65,7 @@ Description:
What: /sys/class/power_supply/max77693-charger/device/top_off_timer What: /sys/class/power_supply/max77693-charger/device/top_off_timer
Date: January 2015 Date: January 2015
KernelVersion: 3.19.0 KernelVersion: 3.19.0
Contact: Krzysztof Kozlowski <k.kozlowski@samsung.com> Contact: Krzysztof Kozlowski <krzk@kernel.org>
Description: Description:
This entry shows and sets the maximum time the max77693 This entry shows and sets the maximum time the max77693
charger operates in top-off charge mode. When the timer expires charger operates in top-off charge mode. When the timer expires
......
*Device-Tree bindings for ST SW reset functionality *Device-Tree bindings for ST SW reset functionality
Required properties: Required properties:
- compatible: should be "st,<chip>-restart". - compatible: should be "stih407-restart".
- st,syscfg: should be a phandle of the syscfg node. - st,syscfg: should be a phandle of the syscfg node.
Example node: Example node:
restart { restart {
compatible = "st,stih416-restart"; compatible = "st,stih407-restart";
st,syscfg = <&syscfg_sbc>; st,syscfg = <&syscfg_sbc_reg>;
status = "okay";
}; };
Device-Tree bindings for charger of Active-semi ACT8945A Multi-Function Device Device-Tree bindings for charger of Active-semi ACT8945A Multi-Function Device
Required properties: Required properties:
- compatible: "active-semi,act8945a", please refer to ../mfd/act8945a.txt. - compatible: "active-semi,act8945a-charger".
- active-semi,chglev-gpios: charge current level phandle with args - active-semi,chglev-gpios: charge current level phandle with args
as described in ../gpio/gpio.txt. as described in ../gpio/gpio.txt.
- active-semi,lbo-gpios: specify the low battery voltage detect phandle
with args as as described in ../gpio/gpio.txt.
- interrupts: <a b> where a is the interrupt number and b is a
field that represents an encoding of the sense and level
information for the interrupt.
- interrupt-parent: the phandle for the interrupt controller that
services interrupts for this device.
Optional properties: Optional properties:
- active-semi,check-battery-temperature: boolean to check the battery
temperature or not.
- active-semi,input-voltage-threshold-microvolt: unit: mV; - active-semi,input-voltage-threshold-microvolt: unit: mV;
Specifies the charger's input over-voltage threshold value; Specifies the charger's input over-voltage threshold value;
The value can be: 6600, 7000, 7500, 8000; default: 6600 The value can be: 6600, 7000, 7500, 8000; default: 6600
...@@ -26,10 +31,18 @@ Example: ...@@ -26,10 +31,18 @@ Example:
reg = <0x5b>; reg = <0x5b>;
status = "okay"; status = "okay";
pinctrl-names = "default"; charger {
pinctrl-0 = <&pinctrl_charger_chglev>; compatible = "active-semi,act8945a-charger";
active-semi,chglev-gpios = <&pioA 12 GPIO_ACTIVE_HIGH>; pinctrl-names = "default";
active-semi,input-voltage-threshold-microvolt = <6600>; pinctrl-0 = <&pinctrl_charger_chglev &pinctrl_charger_lbo &pinctrl_charger_irq>;
active-semi,precondition-timeout = <40>; interrupt-parent = <&pioA>;
active-semi,total-timeout = <3>; interrupts = <45 GPIO_ACTIVE_LOW>;
active-semi,chglev-gpios = <&pioA 12 GPIO_ACTIVE_HIGH>;
active-semi,lbo-gpios = <&pioA 72 GPIO_ACTIVE_LOW>;
active-semi,input-voltage-threshold-microvolt = <6600>;
active-semi,precondition-timeout = <40>;
active-semi,total-timeout = <3>;
status = "okay";
};
}; };
...@@ -346,6 +346,10 @@ PINCTRL ...@@ -346,6 +346,10 @@ PINCTRL
devm_pinctrl_register() devm_pinctrl_register()
devm_pinctrl_unregister() devm_pinctrl_unregister()
POWER
devm_reboot_mode_register()
devm_reboot_mode_unregister()
PWM PWM
devm_pwm_get() devm_pwm_get()
devm_pwm_put() devm_pwm_put()
......
...@@ -39,8 +39,8 @@ kind of power supply, and can process/present them to a user in consistent ...@@ -39,8 +39,8 @@ kind of power supply, and can process/present them to a user in consistent
manner. Results for different power supplies and machines are also directly manner. Results for different power supplies and machines are also directly
comparable. comparable.
See drivers/power/ds2760_battery.c and drivers/power/pda_power.c for the See drivers/power/supply/ds2760_battery.c and drivers/power/supply/pda_power.c
example how to declare and handle attributes. for the example how to declare and handle attributes.
Units Units
......
...@@ -3784,8 +3784,8 @@ F: drivers/leds/leds-da90??.c ...@@ -3784,8 +3784,8 @@ F: drivers/leds/leds-da90??.c
F: drivers/mfd/da903x.c F: drivers/mfd/da903x.c
F: drivers/mfd/da90??-*.c F: drivers/mfd/da90??-*.c
F: drivers/mfd/da91??-*.c F: drivers/mfd/da91??-*.c
F: drivers/power/da9052-battery.c F: drivers/power/supply/da9052-battery.c
F: drivers/power/da91??-*.c F: drivers/power/supply/da91??-*.c
F: drivers/regulator/da903x.c F: drivers/regulator/da903x.c
F: drivers/regulator/da9???-regulator.[ch] F: drivers/regulator/da9???-regulator.[ch]
F: drivers/rtc/rtc-da90??.c F: drivers/rtc/rtc-da90??.c
...@@ -7579,8 +7579,8 @@ M: Krzysztof Kozlowski <krzk@kernel.org> ...@@ -7579,8 +7579,8 @@ M: Krzysztof Kozlowski <krzk@kernel.org>
M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
L: linux-pm@vger.kernel.org L: linux-pm@vger.kernel.org
S: Supported S: Supported
F: drivers/power/max14577_charger.c F: drivers/power/supply/max14577_charger.c
F: drivers/power/max77693_charger.c F: drivers/power/supply/max77693_charger.c
MAXIM MAX77802 MULTIFUNCTION PMIC DEVICE DRIVERS MAXIM MAX77802 MULTIFUNCTION PMIC DEVICE DRIVERS
M: Javier Martinez Canillas <javier@osg.samsung.com> M: Javier Martinez Canillas <javier@osg.samsung.com>
...@@ -8486,11 +8486,11 @@ R: Pali Rohár <pali.rohar@gmail.com> ...@@ -8486,11 +8486,11 @@ R: Pali Rohár <pali.rohar@gmail.com>
F: include/linux/power/bq2415x_charger.h F: include/linux/power/bq2415x_charger.h
F: include/linux/power/bq27xxx_battery.h F: include/linux/power/bq27xxx_battery.h
F: include/linux/power/isp1704_charger.h F: include/linux/power/isp1704_charger.h
F: drivers/power/bq2415x_charger.c F: drivers/power/supply/bq2415x_charger.c
F: drivers/power/bq27xxx_battery.c F: drivers/power/supply/bq27xxx_battery.c
F: drivers/power/bq27xxx_battery_i2c.c F: drivers/power/supply/bq27xxx_battery_i2c.c
F: drivers/power/isp1704_charger.c F: drivers/power/supply/isp1704_charger.c
F: drivers/power/rx51_battery.c F: drivers/power/supply/rx51_battery.c
NTB DRIVER CORE NTB DRIVER CORE
M: Jon Mason <jdmason@kudzu.us> M: Jon Mason <jdmason@kudzu.us>
...@@ -9490,16 +9490,12 @@ F: drivers/powercap/ ...@@ -9490,16 +9490,12 @@ F: drivers/powercap/
POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS POWER SUPPLY CLASS/SUBSYSTEM and DRIVERS
M: Sebastian Reichel <sre@kernel.org> M: Sebastian Reichel <sre@kernel.org>
M: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
M: David Woodhouse <dwmw2@infradead.org>
L: linux-pm@vger.kernel.org L: linux-pm@vger.kernel.org
T: git git://git.infradead.org/battery-2.6.git T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
S: Maintained S: Maintained
F: Documentation/devicetree/bindings/power/ F: Documentation/devicetree/bindings/power/supply/
F: Documentation/devicetree/bindings/power_supply/
F: include/linux/power_supply.h F: include/linux/power_supply.h
F: drivers/power/ F: drivers/power/supply/
X: drivers/power/avs/
POWER STATE COORDINATION INTERFACE (PSCI) POWER STATE COORDINATION INTERFACE (PSCI)
M: Mark Rutland <mark.rutland@arm.com> M: Mark Rutland <mark.rutland@arm.com>
...@@ -10514,8 +10510,8 @@ F: drivers/thunderbolt/ ...@@ -10514,8 +10510,8 @@ F: drivers/thunderbolt/
TI BQ27XXX POWER SUPPLY DRIVER TI BQ27XXX POWER SUPPLY DRIVER
R: Andrew F. Davis <afd@ti.com> R: Andrew F. Davis <afd@ti.com>
F: include/linux/power/bq27xxx_battery.h F: include/linux/power/bq27xxx_battery.h
F: drivers/power/bq27xxx_battery.c F: drivers/power/supply/bq27xxx_battery.c
F: drivers/power/bq27xxx_battery_i2c.c F: drivers/power/supply/bq27xxx_battery_i2c.c
TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER TIMEKEEPING, CLOCKSOURCE CORE, NTP, ALARMTIMER
M: John Stultz <john.stultz@linaro.org> M: John Stultz <john.stultz@linaro.org>
...@@ -11512,6 +11508,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git ...@@ -11512,6 +11508,14 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git
S: Supported S: Supported
F: drivers/mfd/syscon.c F: drivers/mfd/syscon.c
SYSTEM RESET/SHUTDOWN DRIVERS
M: Sebastian Reichel <sre@kernel.org>
L: linux-pm@vger.kernel.org
T: git git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git
S: Maintained
F: Documentation/devicetree/bindings/power/reset/
F: drivers/power/reset/
SYSV FILESYSTEM SYSV FILESYSTEM
M: Christoph Hellwig <hch@infradead.org> M: Christoph Hellwig <hch@infradead.org>
S: Maintained S: Maintained
...@@ -11860,7 +11864,7 @@ F: include/linux/platform_data/lp855x.h ...@@ -11860,7 +11864,7 @@ F: include/linux/platform_data/lp855x.h
TI LP8727 CHARGER DRIVER TI LP8727 CHARGER DRIVER
M: Milo Kim <milo.kim@ti.com> M: Milo Kim <milo.kim@ti.com>
S: Maintained S: Maintained
F: drivers/power/lp8727_charger.c F: drivers/power/supply/lp8727_charger.c
F: include/linux/platform_data/lp8727.h F: include/linux/platform_data/lp8727.h
TI LP8788 MFD DRIVER TI LP8788 MFD DRIVER
...@@ -11869,7 +11873,7 @@ S: Maintained ...@@ -11869,7 +11873,7 @@ S: Maintained
F: drivers/iio/adc/lp8788_adc.c F: drivers/iio/adc/lp8788_adc.c
F: drivers/leds/leds-lp8788.c F: drivers/leds/leds-lp8788.c
F: drivers/mfd/lp8788*.c F: drivers/mfd/lp8788*.c
F: drivers/power/lp8788-charger.c F: drivers/power/supply/lp8788-charger.c
F: drivers/regulator/lp8788-*.c F: drivers/regulator/lp8788-*.c
F: include/linux/mfd/lp8788*.h F: include/linux/mfd/lp8788*.h
...@@ -12946,7 +12950,7 @@ F: drivers/input/touchscreen/wm97*.c ...@@ -12946,7 +12950,7 @@ F: drivers/input/touchscreen/wm97*.c
F: drivers/mfd/arizona* F: drivers/mfd/arizona*
F: drivers/mfd/wm*.c F: drivers/mfd/wm*.c
F: drivers/mfd/cs47l24* F: drivers/mfd/cs47l24*
F: drivers/power/wm83*.c F: drivers/power/supply/wm83*.c
F: drivers/rtc/rtc-wm83*.c F: drivers/rtc/rtc-wm83*.c
F: drivers/regulator/wm8*.c F: drivers/regulator/wm8*.c
F: drivers/video/backlight/wm83*_bl.c F: drivers/video/backlight/wm83*_bl.c
......
This diff is collapsed.
subdir-ccflags-$(CONFIG_POWER_SUPPLY_DEBUG) := -DDEBUG
power_supply-y := power_supply_core.o
power_supply-$(CONFIG_SYSFS) += power_supply_sysfs.o
power_supply-$(CONFIG_LEDS_TRIGGERS) += power_supply_leds.o
obj-$(CONFIG_POWER_SUPPLY) += power_supply.o
obj-$(CONFIG_GENERIC_ADC_BATTERY) += generic-adc-battery.o
obj-$(CONFIG_PDA_POWER) += pda_power.o
obj-$(CONFIG_APM_POWER) += apm_power.o
obj-$(CONFIG_AXP20X_POWER) += axp20x_usb_power.o
obj-$(CONFIG_MAX8925_POWER) += max8925_power.o
obj-$(CONFIG_WM831X_BACKUP) += wm831x_backup.o
obj-$(CONFIG_WM831X_POWER) += wm831x_power.o
obj-$(CONFIG_WM8350_POWER) += wm8350_power.o
obj-$(CONFIG_TEST_POWER) += test_power.o
obj-$(CONFIG_BATTERY_88PM860X) += 88pm860x_battery.o
obj-$(CONFIG_BATTERY_ACT8945A) += act8945a_charger.o
obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
obj-$(CONFIG_BATTERY_DS2780) += ds2780_battery.o
obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o
obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o
obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o
obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
obj-$(CONFIG_BATTERY_COLLIE) += collie_battery.o
obj-$(CONFIG_BATTERY_IPAQ_MICRO) += ipaq_micro_battery.o
obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o
obj-$(CONFIG_BATTERY_SBS) += sbs-battery.o
obj-$(CONFIG_BATTERY_BQ27XXX) += bq27xxx_battery.o
obj-$(CONFIG_BATTERY_BQ27XXX_I2C) += bq27xxx_battery_i2c.o
obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
obj-$(CONFIG_BATTERY_DA9052) += da9052-battery.o
obj-$(CONFIG_CHARGER_DA9150) += da9150-charger.o
obj-$(CONFIG_BATTERY_DA9150) += da9150-fg.o
obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o
obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o
obj-$(CONFIG_BATTERY_Z2) += z2_battery.o
obj-$(CONFIG_BATTERY_RT5033) += rt5033_battery.o
obj-$(CONFIG_CHARGER_RT9455) += rt9455_charger.o
obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_adc_battery.o
obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o
obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o
obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o
obj-$(CONFIG_BATTERY_JZ4740) += jz4740-battery.o
obj-$(CONFIG_BATTERY_INTEL_MID) += intel_mid_battery.o
obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o
obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o abx500_chargalg.o pm2301_charger.o
obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o
obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o
obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o
obj-$(CONFIG_CHARGER_LP8727) += lp8727_charger.o
obj-$(CONFIG_CHARGER_LP8788) += lp8788-charger.o
obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
obj-$(CONFIG_CHARGER_MANAGER) += charger-manager.o
obj-$(CONFIG_CHARGER_MAX14577) += max14577_charger.o
obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o
obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o
obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o
obj-$(CONFIG_CHARGER_QCOM_SMBB) += qcom_smbb.o
obj-$(CONFIG_CHARGER_BQ2415X) += bq2415x_charger.o
obj-$(CONFIG_CHARGER_BQ24190) += bq24190_charger.o
obj-$(CONFIG_CHARGER_BQ24257) += bq24257_charger.o
obj-$(CONFIG_CHARGER_BQ24735) += bq24735-charger.o
obj-$(CONFIG_CHARGER_BQ25890) += bq25890_charger.o
obj-$(CONFIG_POWER_AVS) += avs/ obj-$(CONFIG_POWER_AVS) += avs/
obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o
obj-$(CONFIG_CHARGER_TPS65090) += tps65090-charger.o
obj-$(CONFIG_CHARGER_TPS65217) += tps65217_charger.o
obj-$(CONFIG_POWER_RESET) += reset/ obj-$(CONFIG_POWER_RESET) += reset/
obj-$(CONFIG_AXP288_FUEL_GAUGE) += axp288_fuel_gauge.o obj-$(CONFIG_POWER_SUPPLY) += supply/
obj-$(CONFIG_AXP288_CHARGER) += axp288_charger.o
...@@ -139,7 +139,7 @@ static int rsctrl_probe(struct platform_device *pdev) ...@@ -139,7 +139,7 @@ static int rsctrl_probe(struct platform_device *pdev)
} }
if (val >= WDT_MUX_NUMBER) { if (val >= WDT_MUX_NUMBER) {
dev_err(dev, "ti,wdt-list property can contain" dev_err(dev, "ti,wdt-list property can contain "
"only numbers < 4\n"); "only numbers < 4\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -135,6 +135,65 @@ int reboot_mode_unregister(struct reboot_mode_driver *reboot) ...@@ -135,6 +135,65 @@ int reboot_mode_unregister(struct reboot_mode_driver *reboot)
} }
EXPORT_SYMBOL_GPL(reboot_mode_unregister); EXPORT_SYMBOL_GPL(reboot_mode_unregister);
static void devm_reboot_mode_release(struct device *dev, void *res)
{
reboot_mode_unregister(*(struct reboot_mode_driver **)res);
}
/**
* devm_reboot_mode_register() - resource managed reboot_mode_register()
* @dev: device to associate this resource with
* @reboot: reboot mode driver
*
* Returns: 0 on success or a negative error code on failure.
*/
int devm_reboot_mode_register(struct device *dev,
struct reboot_mode_driver *reboot)
{
struct reboot_mode_driver **dr;
int rc;
dr = devres_alloc(devm_reboot_mode_release, sizeof(*dr), GFP_KERNEL);
if (!dr)
return -ENOMEM;
rc = reboot_mode_register(reboot);
if (rc) {
devres_free(dr);
return rc;
}
*dr = reboot;
devres_add(dev, dr);
return 0;
}
EXPORT_SYMBOL_GPL(devm_reboot_mode_register);
static int devm_reboot_mode_match(struct device *dev, void *res, void *data)
{
struct reboot_mode_driver **p = res;
if (WARN_ON(!p || !*p))
return 0;
return *p == data;
}
/**
* devm_reboot_mode_unregister() - resource managed reboot_mode_unregister()
* @dev: device to associate this resource with
* @reboot: reboot mode driver
*/
void devm_reboot_mode_unregister(struct device *dev,
struct reboot_mode_driver *reboot)
{
WARN_ON(devres_release(dev,
devm_reboot_mode_release,
devm_reboot_mode_match, reboot));
}
EXPORT_SYMBOL_GPL(devm_reboot_mode_unregister);
MODULE_AUTHOR("Andy Yan <andy.yan@rock-chips.com"); MODULE_AUTHOR("Andy Yan <andy.yan@rock-chips.com");
MODULE_DESCRIPTION("System reboot mode core library"); MODULE_DESCRIPTION("System reboot mode core library");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
...@@ -10,5 +10,9 @@ struct reboot_mode_driver { ...@@ -10,5 +10,9 @@ struct reboot_mode_driver {
int reboot_mode_register(struct reboot_mode_driver *reboot); int reboot_mode_register(struct reboot_mode_driver *reboot);
int reboot_mode_unregister(struct reboot_mode_driver *reboot); int reboot_mode_unregister(struct reboot_mode_driver *reboot);
int devm_reboot_mode_register(struct device *dev,
struct reboot_mode_driver *reboot);
void devm_reboot_mode_unregister(struct device *dev,
struct reboot_mode_driver *reboot);
#endif #endif
...@@ -28,28 +28,6 @@ struct reset_syscfg { ...@@ -28,28 +28,6 @@ struct reset_syscfg {
unsigned int mask_rst_msk; unsigned int mask_rst_msk;
}; };
/* STiH415 */
#define STIH415_SYSCFG_11 0x2c
#define STIH415_SYSCFG_15 0x3c
static struct reset_syscfg stih415_reset = {
.offset_rst = STIH415_SYSCFG_11,
.mask_rst = BIT(0),
.offset_rst_msk = STIH415_SYSCFG_15,
.mask_rst_msk = BIT(0)
};
/* STiH416 */
#define STIH416_SYSCFG_500 0x7d0
#define STIH416_SYSCFG_504 0x7e0
static struct reset_syscfg stih416_reset = {
.offset_rst = STIH416_SYSCFG_500,
.mask_rst = BIT(0),
.offset_rst_msk = STIH416_SYSCFG_504,
.mask_rst_msk = BIT(0)
};
/* STiH407 */ /* STiH407 */
#define STIH407_SYSCFG_4000 0x0 #define STIH407_SYSCFG_4000 0x0
#define STIH407_SYSCFG_4008 0x20 #define STIH407_SYSCFG_4008 0x20
...@@ -61,16 +39,6 @@ static struct reset_syscfg stih407_reset = { ...@@ -61,16 +39,6 @@ static struct reset_syscfg stih407_reset = {
.mask_rst_msk = BIT(0) .mask_rst_msk = BIT(0)
}; };
/* STiD127 */
#define STID127_SYSCFG_700 0x0
#define STID127_SYSCFG_773 0x124
static struct reset_syscfg stid127_reset = {
.offset_rst = STID127_SYSCFG_773,
.mask_rst = BIT(0),
.offset_rst_msk = STID127_SYSCFG_700,
.mask_rst_msk = BIT(8)
};
static struct reset_syscfg *st_restart_syscfg; static struct reset_syscfg *st_restart_syscfg;
...@@ -99,17 +67,8 @@ static struct notifier_block st_restart_nb = { ...@@ -99,17 +67,8 @@ static struct notifier_block st_restart_nb = {
static const struct of_device_id st_reset_of_match[] = { static const struct of_device_id st_reset_of_match[] = {
{ {
.compatible = "st,stih415-restart",
.data = (void *)&stih415_reset,
}, {
.compatible = "st,stih416-restart",
.data = (void *)&stih416_reset,
}, {
.compatible = "st,stih407-restart", .compatible = "st,stih407-restart",
.data = (void *)&stih407_reset, .data = (void *)&stih407_reset,
}, {
.compatible = "st,stid127-restart",
.data = (void *)&stid127_reset,
}, },
{} {}
}; };
......
...@@ -53,8 +53,6 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev) ...@@ -53,8 +53,6 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
syscon_rbm->reboot.write = syscon_reboot_mode_write; syscon_rbm->reboot.write = syscon_reboot_mode_write;
syscon_rbm->mask = 0xffffffff; syscon_rbm->mask = 0xffffffff;
dev_set_drvdata(&pdev->dev, syscon_rbm);
syscon_rbm->map = syscon_node_to_regmap(pdev->dev.parent->of_node); syscon_rbm->map = syscon_node_to_regmap(pdev->dev.parent->of_node);
if (IS_ERR(syscon_rbm->map)) if (IS_ERR(syscon_rbm->map))
return PTR_ERR(syscon_rbm->map); return PTR_ERR(syscon_rbm->map);
...@@ -65,20 +63,13 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev) ...@@ -65,20 +63,13 @@ static int syscon_reboot_mode_probe(struct platform_device *pdev)
of_property_read_u32(pdev->dev.of_node, "mask", &syscon_rbm->mask); of_property_read_u32(pdev->dev.of_node, "mask", &syscon_rbm->mask);
ret = reboot_mode_register(&syscon_rbm->reboot); ret = devm_reboot_mode_register(&pdev->dev, &syscon_rbm->reboot);
if (ret) if (ret)
dev_err(&pdev->dev, "can't register reboot mode\n"); dev_err(&pdev->dev, "can't register reboot mode\n");
return ret; return ret;
} }
static int syscon_reboot_mode_remove(struct platform_device *pdev)
{
struct syscon_reboot_mode *syscon_rbm = dev_get_drvdata(&pdev->dev);
return reboot_mode_unregister(&syscon_rbm->reboot);
}
static const struct of_device_id syscon_reboot_mode_of_match[] = { static const struct of_device_id syscon_reboot_mode_of_match[] = {
{ .compatible = "syscon-reboot-mode" }, { .compatible = "syscon-reboot-mode" },
{} {}
...@@ -86,7 +77,6 @@ static const struct of_device_id syscon_reboot_mode_of_match[] = { ...@@ -86,7 +77,6 @@ static const struct of_device_id syscon_reboot_mode_of_match[] = {
static struct platform_driver syscon_reboot_mode_driver = { static struct platform_driver syscon_reboot_mode_driver = {
.probe = syscon_reboot_mode_probe, .probe = syscon_reboot_mode_probe,
.remove = syscon_reboot_mode_remove,
.driver = { .driver = {
.name = "syscon-reboot-mode", .name = "syscon-reboot-mode",
.of_match_table = syscon_reboot_mode_of_match, .of_match_table = syscon_reboot_mode_of_match,
......
...@@ -81,8 +81,10 @@ static int xgene_reboot_probe(struct platform_device *pdev) ...@@ -81,8 +81,10 @@ static int xgene_reboot_probe(struct platform_device *pdev)
ctx->restart_handler.notifier_call = xgene_restart_handler; ctx->restart_handler.notifier_call = xgene_restart_handler;
ctx->restart_handler.priority = 128; ctx->restart_handler.priority = 128;
err = register_restart_handler(&ctx->restart_handler); err = register_restart_handler(&ctx->restart_handler);
if (err) if (err) {
iounmap(ctx->csr);
dev_err(dev, "cannot register restart handler (err=%d)\n", err); dev_err(dev, "cannot register restart handler (err=%d)\n", err);
}
return err; return err;
} }
......
...@@ -58,9 +58,12 @@ static int zx_reboot_probe(struct platform_device *pdev) ...@@ -58,9 +58,12 @@ static int zx_reboot_probe(struct platform_device *pdev)
} }
err = register_restart_handler(&zx_restart_nb); err = register_restart_handler(&zx_restart_nb);
if (err) if (err) {
iounmap(base);
iounmap(pcu_base);
dev_err(&pdev->dev, "Register restart handler failed(err=%d)\n", dev_err(&pdev->dev, "Register restart handler failed(err=%d)\n",
err); err);
}
return err; return err;
} }
......
This diff is collapsed.
subdir-ccflags-$(CONFIG_POWER_SUPPLY_DEBUG) := -DDEBUG
power_supply-y := power_supply_core.o
power_supply-$(CONFIG_SYSFS) += power_supply_sysfs.o
power_supply-$(CONFIG_LEDS_TRIGGERS) += power_supply_leds.o
obj-$(CONFIG_POWER_SUPPLY) += power_supply.o
obj-$(CONFIG_GENERIC_ADC_BATTERY) += generic-adc-battery.o
obj-$(CONFIG_PDA_POWER) += pda_power.o
obj-$(CONFIG_APM_POWER) += apm_power.o
obj-$(CONFIG_AXP20X_POWER) += axp20x_usb_power.o
obj-$(CONFIG_MAX8925_POWER) += max8925_power.o
obj-$(CONFIG_WM831X_BACKUP) += wm831x_backup.o
obj-$(CONFIG_WM831X_POWER) += wm831x_power.o
obj-$(CONFIG_WM8350_POWER) += wm8350_power.o
obj-$(CONFIG_TEST_POWER) += test_power.o
obj-$(CONFIG_BATTERY_88PM860X) += 88pm860x_battery.o
obj-$(CONFIG_BATTERY_ACT8945A) += act8945a_charger.o
obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
obj-$(CONFIG_BATTERY_DS2780) += ds2780_battery.o
obj-$(CONFIG_BATTERY_DS2781) += ds2781_battery.o
obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o
obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o
obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o
obj-$(CONFIG_BATTERY_COLLIE) += collie_battery.o
obj-$(CONFIG_BATTERY_IPAQ_MICRO) += ipaq_micro_battery.o
obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o
obj-$(CONFIG_BATTERY_SBS) += sbs-battery.o
obj-$(CONFIG_BATTERY_BQ27XXX) += bq27xxx_battery.o
obj-$(CONFIG_BATTERY_BQ27XXX_I2C) += bq27xxx_battery_i2c.o
obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
obj-$(CONFIG_BATTERY_DA9052) += da9052-battery.o
obj-$(CONFIG_CHARGER_DA9150) += da9150-charger.o
obj-$(CONFIG_BATTERY_DA9150) += da9150-fg.o
obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o
obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o
obj-$(CONFIG_BATTERY_Z2) += z2_battery.o
obj-$(CONFIG_BATTERY_RT5033) += rt5033_battery.o
obj-$(CONFIG_CHARGER_RT9455) += rt9455_charger.o
obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_adc_battery.o
obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o
obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o
obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o
obj-$(CONFIG_BATTERY_JZ4740) += jz4740-battery.o
obj-$(CONFIG_BATTERY_INTEL_MID) += intel_mid_battery.o
obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o
obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o abx500_chargalg.o pm2301_charger.o
obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o
obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o
obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o
obj-$(CONFIG_CHARGER_LP8727) += lp8727_charger.o
obj-$(CONFIG_CHARGER_LP8788) += lp8788-charger.o
obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
obj-$(CONFIG_CHARGER_MANAGER) += charger-manager.o
obj-$(CONFIG_CHARGER_MAX14577) += max14577_charger.o
obj-$(CONFIG_CHARGER_MAX77693) += max77693_charger.o
obj-$(CONFIG_CHARGER_MAX8997) += max8997_charger.o
obj-$(CONFIG_CHARGER_MAX8998) += max8998_charger.o
obj-$(CONFIG_CHARGER_QCOM_SMBB) += qcom_smbb.o
obj-$(CONFIG_CHARGER_BQ2415X) += bq2415x_charger.o
obj-$(CONFIG_CHARGER_BQ24190) += bq24190_charger.o
obj-$(CONFIG_CHARGER_BQ24257) += bq24257_charger.o
obj-$(CONFIG_CHARGER_BQ24735) += bq24735-charger.o
obj-$(CONFIG_CHARGER_BQ25890) += bq25890_charger.o
obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o
obj-$(CONFIG_CHARGER_TPS65090) += tps65090-charger.o
obj-$(CONFIG_CHARGER_TPS65217) += tps65217_charger.o
obj-$(CONFIG_AXP288_FUEL_GAUGE) += axp288_fuel_gauge.o
obj-$(CONFIG_AXP288_CHARGER) += axp288_charger.o
...@@ -1095,7 +1095,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev) ...@@ -1095,7 +1095,7 @@ static int ab8500_btemp_probe(struct platform_device *pdev)
/* Create a work queue for the btemp */ /* Create a work queue for the btemp */
di->btemp_wq = di->btemp_wq =
create_singlethread_workqueue("ab8500_btemp_wq"); alloc_workqueue("ab8500_btemp_wq", WQ_MEM_RECLAIM, 0);
if (di->btemp_wq == NULL) { if (di->btemp_wq == NULL) {
dev_err(di->dev, "failed to create work queue\n"); dev_err(di->dev, "failed to create work queue\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -3540,8 +3540,8 @@ static int ab8500_charger_probe(struct platform_device *pdev) ...@@ -3540,8 +3540,8 @@ static int ab8500_charger_probe(struct platform_device *pdev)
di->usb_state.usb_current = -1; di->usb_state.usb_current = -1;
/* Create a work queue for the charger */ /* Create a work queue for the charger */
di->charger_wq = di->charger_wq = alloc_ordered_workqueue("ab8500_charger_wq",
create_singlethread_workqueue("ab8500_charger_wq"); WQ_MEM_RECLAIM);
if (di->charger_wq == NULL) { if (di->charger_wq == NULL) {
dev_err(di->dev, "failed to create work queue\n"); dev_err(di->dev, "failed to create work queue\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -245,13 +245,8 @@ static LIST_HEAD(ab8500_fg_list); ...@@ -245,13 +245,8 @@ static LIST_HEAD(ab8500_fg_list);
*/ */
struct ab8500_fg *ab8500_fg_get(void) struct ab8500_fg *ab8500_fg_get(void)
{ {
struct ab8500_fg *fg; return list_first_entry_or_null(&ab8500_fg_list, struct ab8500_fg,
node);
if (list_empty(&ab8500_fg_list))
return NULL;
fg = list_first_entry(&ab8500_fg_list, struct ab8500_fg, node);
return fg;
} }
/* Main battery properties */ /* Main battery properties */
...@@ -3096,7 +3091,7 @@ static int ab8500_fg_probe(struct platform_device *pdev) ...@@ -3096,7 +3091,7 @@ static int ab8500_fg_probe(struct platform_device *pdev)
ab8500_fg_discharge_state_to(di, AB8500_FG_DISCHARGE_INIT); ab8500_fg_discharge_state_to(di, AB8500_FG_DISCHARGE_INIT);
/* Create a work queue for running the FG algorithm */ /* Create a work queue for running the FG algorithm */
di->fg_wq = create_singlethread_workqueue("ab8500_fg_wq"); di->fg_wq = alloc_ordered_workqueue("ab8500_fg_wq", WQ_MEM_RECLAIM);
if (di->fg_wq == NULL) { if (di->fg_wq == NULL) {
dev_err(di->dev, "failed to create work queue\n"); dev_err(di->dev, "failed to create work queue\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -2091,8 +2091,8 @@ static int abx500_chargalg_probe(struct platform_device *pdev) ...@@ -2091,8 +2091,8 @@ static int abx500_chargalg_probe(struct platform_device *pdev)
abx500_chargalg_maintenance_timer_expired; abx500_chargalg_maintenance_timer_expired;
/* Create a work queue for the chargalg */ /* Create a work queue for the chargalg */
di->chargalg_wq = di->chargalg_wq = alloc_ordered_workqueue("abx500_chargalg_wq",
create_singlethread_workqueue("abx500_chargalg_wq"); WQ_MEM_RECLAIM);
if (di->chargalg_wq == NULL) { if (di->chargalg_wq == NULL) {
dev_err(di->dev, "failed to create work queue\n"); dev_err(di->dev, "failed to create work queue\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <linux/usb/otg.h> #include <linux/usb/otg.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/notifier.h>
#include <linux/property.h> #include <linux/property.h>
#include <linux/mfd/axp20x.h> #include <linux/mfd/axp20x.h>
#include <linux/extcon.h> #include <linux/extcon.h>
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/device.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/mfd/axp20x.h> #include <linux/mfd/axp20x.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
......
...@@ -1068,6 +1068,12 @@ static int bq24257_probe(struct i2c_client *client, ...@@ -1068,6 +1068,12 @@ static int bq24257_probe(struct i2c_client *client,
return ret; return ret;
} }
ret = bq24257_power_supply_init(bq);
if (ret < 0) {
dev_err(dev, "Failed to register power supply\n");
return ret;
}
ret = devm_request_threaded_irq(dev, client->irq, NULL, ret = devm_request_threaded_irq(dev, client->irq, NULL,
bq24257_irq_handler_thread, bq24257_irq_handler_thread,
IRQF_TRIGGER_FALLING | IRQF_TRIGGER_FALLING |
...@@ -1078,12 +1084,6 @@ static int bq24257_probe(struct i2c_client *client, ...@@ -1078,12 +1084,6 @@ static int bq24257_probe(struct i2c_client *client,
return ret; return ret;
} }
ret = bq24257_power_supply_init(bq);
if (ret < 0) {
dev_err(dev, "Failed to register power supply\n");
return ret;
}
ret = sysfs_create_group(&bq->charger->dev.kobj, &bq24257_attr_group); ret = sysfs_create_group(&bq->charger->dev.kobj, &bq24257_attr_group);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "Can't create sysfs entries\n"); dev_err(dev, "Can't create sysfs entries\n");
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_gpio.h> #include <linux/gpio/consumer.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -49,6 +49,7 @@ struct bq24735 { ...@@ -49,6 +49,7 @@ struct bq24735 {
struct i2c_client *client; struct i2c_client *client;
struct bq24735_platform *pdata; struct bq24735_platform *pdata;
struct mutex lock; struct mutex lock;
struct gpio_desc *status_gpio;
bool charging; bool charging;
}; };
...@@ -177,12 +178,8 @@ static int bq24735_config_charger(struct bq24735 *charger) ...@@ -177,12 +178,8 @@ static int bq24735_config_charger(struct bq24735 *charger)
static bool bq24735_charger_is_present(struct bq24735 *charger) static bool bq24735_charger_is_present(struct bq24735 *charger)
{ {
struct bq24735_platform *pdata = charger->pdata; if (charger->status_gpio) {
int ret; return !gpiod_get_value_cansleep(charger->status_gpio);
if (pdata->status_gpio_valid) {
ret = gpio_get_value_cansleep(pdata->status_gpio);
return ret ^= pdata->status_gpio_active_low == 0;
} else { } else {
int ac = 0; int ac = 0;
...@@ -201,8 +198,12 @@ static bool bq24735_charger_is_present(struct bq24735 *charger) ...@@ -201,8 +198,12 @@ static bool bq24735_charger_is_present(struct bq24735 *charger)
static int bq24735_charger_is_charging(struct bq24735 *charger) static int bq24735_charger_is_charging(struct bq24735 *charger)
{ {
int ret = bq24735_read_word(charger->client, BQ24735_CHG_OPT); int ret;
if (!bq24735_charger_is_present(charger))
return 0;
ret = bq24735_read_word(charger->client, BQ24735_CHG_OPT);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -304,7 +305,6 @@ static struct bq24735_platform *bq24735_parse_dt_data(struct i2c_client *client) ...@@ -304,7 +305,6 @@ static struct bq24735_platform *bq24735_parse_dt_data(struct i2c_client *client)
struct device_node *np = client->dev.of_node; struct device_node *np = client->dev.of_node;
u32 val; u32 val;
int ret; int ret;
enum of_gpio_flags flags;
pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata) {
...@@ -313,12 +313,6 @@ static struct bq24735_platform *bq24735_parse_dt_data(struct i2c_client *client) ...@@ -313,12 +313,6 @@ static struct bq24735_platform *bq24735_parse_dt_data(struct i2c_client *client)
return NULL; return NULL;
} }
pdata->status_gpio = of_get_named_gpio_flags(np, "ti,ac-detect-gpios",
0, &flags);
if (flags & OF_GPIO_ACTIVE_LOW)
pdata->status_gpio_active_low = 1;
ret = of_property_read_u32(np, "ti,charge-current", &val); ret = of_property_read_u32(np, "ti,charge-current", &val);
if (!ret) if (!ret)
pdata->charge_current = val; pdata->charge_current = val;
...@@ -392,21 +386,16 @@ static int bq24735_charger_probe(struct i2c_client *client, ...@@ -392,21 +386,16 @@ static int bq24735_charger_probe(struct i2c_client *client,
i2c_set_clientdata(client, charger); i2c_set_clientdata(client, charger);
if (gpio_is_valid(charger->pdata->status_gpio)) { charger->status_gpio = devm_gpiod_get_optional(&client->dev,
ret = devm_gpio_request(&client->dev, "ti,ac-detect",
charger->pdata->status_gpio, GPIOD_IN);
name); if (IS_ERR(charger->status_gpio)) {
if (ret) { ret = PTR_ERR(charger->status_gpio);
dev_err(&client->dev, dev_err(&client->dev, "Getting gpio failed: %d\n", ret);
"Failed GPIO request for GPIO %d: %d\n", return ret;
charger->pdata->status_gpio, ret);
}
charger->pdata->status_gpio_valid = !ret;
} }
if (!charger->pdata->status_gpio_valid if (!charger->status_gpio || bq24735_charger_is_present(charger)) {
|| bq24735_charger_is_present(charger)) {
ret = bq24735_read_word(client, BQ24735_MANUFACTURER_ID); ret = bq24735_read_word(client, BQ24735_MANUFACTURER_ID);
if (ret < 0) { if (ret < 0) {
dev_err(&client->dev, "Failed to read manufacturer id : %d\n", dev_err(&client->dev, "Failed to read manufacturer id : %d\n",
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <linux/device.h> #include <linux/device.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/mutex.h>
#include <linux/param.h> #include <linux/param.h>
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
...@@ -390,8 +391,35 @@ static struct { ...@@ -390,8 +391,35 @@ static struct {
BQ27XXX_PROP(BQ27421, bq27421_battery_props), BQ27XXX_PROP(BQ27421, bq27421_battery_props),
}; };
static DEFINE_MUTEX(bq27xxx_list_lock);
static LIST_HEAD(bq27xxx_battery_devices);
static int poll_interval_param_set(const char *val, const struct kernel_param *kp)
{
struct bq27xxx_device_info *di;
int ret;
ret = param_set_uint(val, kp);
if (ret < 0)
return ret;
mutex_lock(&bq27xxx_list_lock);
list_for_each_entry(di, &bq27xxx_battery_devices, list) {
cancel_delayed_work_sync(&di->work);
schedule_delayed_work(&di->work, 0);
}
mutex_unlock(&bq27xxx_list_lock);
return ret;
}
static const struct kernel_param_ops param_ops_poll_interval = {
.get = param_get_uint,
.set = poll_interval_param_set,
};
static unsigned int poll_interval = 360; static unsigned int poll_interval = 360;
module_param(poll_interval, uint, 0644); module_param_cb(poll_interval, &param_ops_poll_interval, &poll_interval, 0644);
MODULE_PARM_DESC(poll_interval, MODULE_PARM_DESC(poll_interval,
"battery poll interval in seconds - 0 disables polling"); "battery poll interval in seconds - 0 disables polling");
...@@ -644,8 +672,9 @@ static bool bq27xxx_battery_dead(struct bq27xxx_device_info *di, u16 flags) ...@@ -644,8 +672,9 @@ static bool bq27xxx_battery_dead(struct bq27xxx_device_info *di, u16 flags)
static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di) static int bq27xxx_battery_read_health(struct bq27xxx_device_info *di)
{ {
int flags; int flags;
bool has_singe_flag = di->chip == BQ27000 || di->chip == BQ27010;
flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, false); flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
if (flags < 0) { if (flags < 0) {
dev_err(di->dev, "error reading flag register:%d\n", flags); dev_err(di->dev, "error reading flag register:%d\n", flags);
return flags; return flags;
...@@ -745,7 +774,7 @@ static int bq27xxx_battery_current(struct bq27xxx_device_info *di, ...@@ -745,7 +774,7 @@ static int bq27xxx_battery_current(struct bq27xxx_device_info *di,
} }
if (di->chip == BQ27000 || di->chip == BQ27010) { if (di->chip == BQ27000 || di->chip == BQ27010) {
flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, false); flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, true);
if (flags & BQ27000_FLAG_CHGS) { if (flags & BQ27000_FLAG_CHGS) {
dev_dbg(di->dev, "negative current!\n"); dev_dbg(di->dev, "negative current!\n");
curr = -curr; curr = -curr;
...@@ -971,6 +1000,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di) ...@@ -971,6 +1000,10 @@ int bq27xxx_battery_setup(struct bq27xxx_device_info *di)
bq27xxx_battery_update(di); bq27xxx_battery_update(di);
mutex_lock(&bq27xxx_list_lock);
list_add(&di->list, &bq27xxx_battery_devices);
mutex_unlock(&bq27xxx_list_lock);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(bq27xxx_battery_setup); EXPORT_SYMBOL_GPL(bq27xxx_battery_setup);
...@@ -989,6 +1022,10 @@ void bq27xxx_battery_teardown(struct bq27xxx_device_info *di) ...@@ -989,6 +1022,10 @@ void bq27xxx_battery_teardown(struct bq27xxx_device_info *di)
power_supply_unregister(di->bat); power_supply_unregister(di->bat);
mutex_lock(&bq27xxx_list_lock);
list_del(&di->list);
mutex_unlock(&bq27xxx_list_lock);
mutex_destroy(&di->lock); mutex_destroy(&di->lock);
} }
EXPORT_SYMBOL_GPL(bq27xxx_battery_teardown); EXPORT_SYMBOL_GPL(bq27xxx_battery_teardown);
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include "../w1/w1.h" #include "../../w1/w1.h"
#include "../w1/slaves/w1_ds2760.h" #include "../../w1/slaves/w1_ds2760.h"
struct ds2760_device_info { struct ds2760_device_info {
struct device *dev; struct device *dev;
...@@ -566,7 +566,8 @@ static int ds2760_battery_probe(struct platform_device *pdev) ...@@ -566,7 +566,8 @@ static int ds2760_battery_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work); INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work);
INIT_DELAYED_WORK(&di->set_charged_work, INIT_DELAYED_WORK(&di->set_charged_work,
ds2760_battery_set_charged_work); ds2760_battery_set_charged_work);
di->monitor_wqueue = create_singlethread_workqueue(dev_name(&pdev->dev)); di->monitor_wqueue = alloc_ordered_workqueue(dev_name(&pdev->dev),
WQ_MEM_RECLAIM);
if (!di->monitor_wqueue) { if (!di->monitor_wqueue) {
retval = -ESRCH; retval = -ESRCH;
goto workqueue_failed; goto workqueue_failed;
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/idr.h> #include <linux/idr.h>
#include "../w1/w1.h" #include "../../w1/w1.h"
#include "../w1/slaves/w1_ds2780.h" #include "../../w1/slaves/w1_ds2780.h"
/* Current unit measurement in uA for a 1 milli-ohm sense resistor */ /* Current unit measurement in uA for a 1 milli-ohm sense resistor */
#define DS2780_CURRENT_UNITS 1563 #define DS2780_CURRENT_UNITS 1563
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#include <linux/power_supply.h> #include <linux/power_supply.h>
#include <linux/idr.h> #include <linux/idr.h>
#include "../w1/w1.h" #include "../../w1/w1.h"
#include "../w1/slaves/w1_ds2781.h" #include "../../w1/slaves/w1_ds2781.h"
/* Current unit measurement in uA for a 1 milli-ohm sense resistor */ /* Current unit measurement in uA for a 1 milli-ohm sense resistor */
#define DS2781_CURRENT_UNITS 1563 #define DS2781_CURRENT_UNITS 1563
......
...@@ -689,8 +689,7 @@ static int probe(int irq, struct device *dev) ...@@ -689,8 +689,7 @@ static int probe(int irq, struct device *dev)
/* initialize all required framework before enabling interrupts */ /* initialize all required framework before enabling interrupts */
INIT_WORK(&pbi->handler, pmic_battery_handle_intrpt); INIT_WORK(&pbi->handler, pmic_battery_handle_intrpt);
INIT_DELAYED_WORK(&pbi->monitor_battery, pmic_battery_monitor); INIT_DELAYED_WORK(&pbi->monitor_battery, pmic_battery_monitor);
pbi->monitor_wqueue = pbi->monitor_wqueue = alloc_workqueue(dev_name(dev), WQ_MEM_RECLAIM, 0);
create_singlethread_workqueue(dev_name(dev));
if (!pbi->monitor_wqueue) { if (!pbi->monitor_wqueue) {
dev_err(dev, "%s(): wqueue init failed\n", __func__); dev_err(dev, "%s(): wqueue init failed\n", __func__);
retval = -ESRCH; retval = -ESRCH;
......
...@@ -235,7 +235,7 @@ static int micro_batt_probe(struct platform_device *pdev) ...@@ -235,7 +235,7 @@ static int micro_batt_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
mb->micro = dev_get_drvdata(pdev->dev.parent); mb->micro = dev_get_drvdata(pdev->dev.parent);
mb->wq = create_singlethread_workqueue("ipaq-battery-wq"); mb->wq = alloc_workqueue("ipaq-battery-wq", WQ_MEM_RECLAIM, 0);
if (!mb->wq) if (!mb->wq)
return -ENOMEM; return -ENOMEM;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* max14577_charger.c - Battery charger driver for the Maxim 14577/77836 * max14577_charger.c - Battery charger driver for the Maxim 14577/77836
* *
* Copyright (C) 2013,2014 Samsung Electronics * Copyright (C) 2013,2014 Samsung Electronics
* Krzysztof Kozlowski <k.kozlowski@samsung.com> * Krzysztof Kozlowski <krzk@kernel.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -643,6 +643,6 @@ static struct platform_driver max14577_charger_driver = { ...@@ -643,6 +643,6 @@ static struct platform_driver max14577_charger_driver = {
}; };
module_platform_driver(max14577_charger_driver); module_platform_driver(max14577_charger_driver);
MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski@samsung.com>"); MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
MODULE_DESCRIPTION("Maxim 14577/77836 charger driver"); MODULE_DESCRIPTION("Maxim 14577/77836 charger driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* max77693_charger.c - Battery charger driver for the Maxim 77693 * max77693_charger.c - Battery charger driver for the Maxim 77693
* *
* Copyright (C) 2014 Samsung Electronics * Copyright (C) 2014 Samsung Electronics
* Krzysztof Kozlowski <k.kozlowski@samsung.com> * Krzysztof Kozlowski <krzk@kernel.org>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -766,6 +766,6 @@ static struct platform_driver max77693_charger_driver = { ...@@ -766,6 +766,6 @@ static struct platform_driver max77693_charger_driver = {
}; };
module_platform_driver(max77693_charger_driver); module_platform_driver(max77693_charger_driver);
MODULE_AUTHOR("Krzysztof Kozlowski <k.kozlowski@samsung.com>"); MODULE_AUTHOR("Krzysztof Kozlowski <krzk@kernel.org>");
MODULE_DESCRIPTION("Maxim 77693 charger driver"); MODULE_DESCRIPTION("Maxim 77693 charger driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment