Skip to content

Commit

Permalink
Merge tag 'for-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:
 "Power-supply core:

   - replace power_supply_register_no_ws() with power_supply_register()
     and a new "no_wakeup_source" field in struct power_supply_config

   - constify battery info tables in the core and all drivers

   - switch back to remove callback for all platform drivers

   - allow power_supply_put() to be called from atomic context

   - mark attribute arrays read-only after init

  Power-supply drivers:

   - new driver for TWL6030 and TWL6032

   - rk817: improve battery capacity calibration

   - misc small cleanups and fixes"

* tag 'for-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (42 commits)
  power: reset: ep93xx: add AUXILIARY_BUS dependency
  dt-bindings: power: reset: Convert mode-.* properties to array
  power: supply: sc27xx: Fix battery detect GPIO probe
  dt-bindings: power: supply: sc27xx-fg: document deprecated bat-detect-gpio
  reset: keystone-reset: remove unused macros
  power: supply: axp20x_battery: Use scaled iio_read_channel
  power: supply: axp20x_usb_power: Use scaled iio_read_channel
  power: supply: generic-adc-battery: change my gmail
  power: supply: pmu_battery: Set power supply type to BATTERY
  power: Switch back to struct platform_driver::remove()
  power: supply: hwmon: move interface to private header
  power: supply: rk817: Update battery capacity calibration
  power: supply: rk817: stop updating info in suspend
  power: supply: rt9471: Use IC status regfield to report real charger status
  power: supply: rt9471: Fix wrong WDT function regfield declaration
  dt-bindings: power/supply: qcom,pmi8998-charger: Drop incorrect "#interrupt-cells" from example
  power: supply: core: mark attribute arrays as ro_after_init
  power: supply: core: unexport power_supply_property_is_writeable()
  power: supply: core: use device mutex wrappers
  power: supply: bq27xxx: Fix registers of bq27426
  ...
  • Loading branch information
torvalds committed Nov 28, 2024
2 parents 1fdae00 + b6d445f commit 448ecd5
Show file tree
Hide file tree
Showing 70 changed files with 971 additions and 292 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ properties:
allOf:
- $ref: reboot-mode.yaml#

patternProperties:
"^mode-.*$":
maxItems: 1

required:
- compatible
- nvmem-cells
Expand Down
7 changes: 7 additions & 0 deletions Documentation/devicetree/bindings/power/reset/qcom,pon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ required:
- compatible
- reg

patternProperties:
"^mode-.*$":
maxItems: 1

unevaluatedProperties: false

allOf:
Expand All @@ -75,6 +79,9 @@ allOf:
reg-names:
items:
- const: pon
else:
patternProperties:
"^mode-.*$": false

# Special case for pm8941, which doesn't store reset mode
- if:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ description: |
properties:
mode-normal:
$ref: /schemas/types.yaml#/definitions/uint32
$ref: /schemas/types.yaml#/definitions/uint32-array
description:
Default value to set on a reboot if no command was provided.

patternProperties:
"^mode-.*$":
$ref: /schemas/types.yaml#/definitions/uint32
$ref: /schemas/types.yaml#/definitions/uint32-array

additionalProperties: true

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ properties:
allOf:
- $ref: reboot-mode.yaml#

patternProperties:
"^mode-.*$":
maxItems: 1

unevaluatedProperties: false

required:
Expand Down
11 changes: 10 additions & 1 deletion Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ properties:
$ref: /schemas/types.yaml#/definitions/uint32
description: Offset in the register map for the reboot register (in bytes).

reg:
maxItems: 1
description: Base address and size for the reboot register.

regmap:
$ref: /schemas/types.yaml#/definitions/phandle
deprecated: true
Expand All @@ -45,9 +49,14 @@ properties:
priority:
default: 192

oneOf:
- required:
- offset
- required:
- reg

required:
- compatible
- offset

additionalProperties: false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ examples:
pmic {
#address-cells = <1>;
#size-cells = <0>;
#interrupt-cells = <4>;
charger@1000 {
compatible = "qcom,pmi8998-charger";
Expand Down
5 changes: 5 additions & 0 deletions Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ properties:
battery-detect-gpios:
maxItems: 1

bat-detect-gpio:
maxItems: 1
deprecated: true
description: use battery-detect-gpios instead

interrupts:
maxItems: 1

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/ti,twl6030-charger.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: TWL6030/32 BCI (Battery Charger Interface)

description:
The battery charger needs to be configured to do any charging besides of
precharging. The GPADC in the PMIC has to be used to get the related
voltages.

maintainers:
- Andreas Kemnade <andreas@kemnade.info>

allOf:
- $ref: power-supply.yaml#

properties:
compatible:
oneOf:
- const: ti,twl6030-charger
- items:
- const: ti,twl6032-charger
- const: ti,twl6030-charger

interrupts:
items:
- description: Charger Control Interrupt
- description: Charger Fault Interrupt

io-channels:
items:
- description: VBUS Voltage Channel

io-channel-names:
items:
- const: vusb

monitored-battery: true

required:
- compatible
- interrupts
- monitored-battery

additionalProperties: false
3 changes: 2 additions & 1 deletion drivers/acpi/battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,7 @@ static int sysfs_add_battery(struct acpi_battery *battery)
struct power_supply_config psy_cfg = {
.drv_data = battery,
.attr_grp = acpi_battery_groups,
.no_wakeup_source = true,
};
bool full_cap_broken = false;

Expand Down Expand Up @@ -888,7 +889,7 @@ static int sysfs_add_battery(struct acpi_battery *battery)
battery->bat_desc.type = POWER_SUPPLY_TYPE_BATTERY;
battery->bat_desc.get_property = acpi_battery_get_property;

battery->bat = power_supply_register_no_ws(&battery->device->dev,
battery->bat = power_supply_register(&battery->device->dev,
&battery->bat_desc, &psy_cfg);

if (IS_ERR(battery->bat)) {
Expand Down
1 change: 1 addition & 0 deletions drivers/power/reset/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ config POWER_RESET_EP93XX
bool "Cirrus EP93XX reset driver" if COMPILE_TEST
depends on MFD_SYSCON
default ARCH_EP93XX
select AUXILIARY_BUS
help
This driver provides restart support for Cirrus EP93XX SoC.

Expand Down
2 changes: 1 addition & 1 deletion drivers/power/reset/at91-poweroff.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ MODULE_DEVICE_TABLE(of, at91_poweroff_of_match);

static struct platform_driver at91_poweroff_driver = {
.probe = at91_poweroff_probe,
.remove_new = at91_poweroff_remove,
.remove = at91_poweroff_remove,
.driver = {
.name = "at91-poweroff",
.of_match_table = at91_poweroff_of_match,
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/reset/at91-reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ static void at91_reset_remove(struct platform_device *pdev)

static struct platform_driver at91_reset_driver = {
.probe = at91_reset_probe,
.remove_new = at91_reset_remove,
.remove = at91_reset_remove,
.driver = {
.name = "at91-reset",
.of_match_table = at91_reset_of_match,
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/reset/at91-sama5d2_shdwc.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ static void at91_shdwc_remove(struct platform_device *pdev)

static struct platform_driver at91_shdwc_driver = {
.probe = at91_shdwc_probe,
.remove_new = at91_shdwc_remove,
.remove = at91_shdwc_remove,
.driver = {
.name = "at91-shdwc",
.of_match_table = at91_shdwc_of_match,
Expand Down
2 changes: 0 additions & 2 deletions drivers/power/reset/keystone-reset.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <linux/mfd/syscon.h>
#include <linux/of.h>

#define RSTYPE_RG 0x0
#define RSCTRL_RG 0x4
#define RSCFG_RG 0x8
#define RSISO_RG 0xc
Expand All @@ -28,7 +27,6 @@
#define RSMUX_OMODE_MASK 0xe
#define RSMUX_OMODE_RESET_ON 0xa
#define RSMUX_OMODE_RESET_OFF 0x0
#define RSMUX_LOCK_MASK 0x1
#define RSMUX_LOCK_SET 0x1

#define RSCFG_RSTYPE_SOFT 0x300f
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/reset/ltc2952-poweroff.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ MODULE_DEVICE_TABLE(of, of_ltc2952_poweroff_match);

static struct platform_driver ltc2952_poweroff_driver = {
.probe = ltc2952_poweroff_probe,
.remove_new = ltc2952_poweroff_remove,
.remove = ltc2952_poweroff_remove,
.driver = {
.name = "ltc2952-poweroff",
.of_match_table = of_ltc2952_poweroff_match,
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/reset/qnap-poweroff.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void qnap_power_off_remove(struct platform_device *pdev)

static struct platform_driver qnap_power_off_driver = {
.probe = qnap_power_off_probe,
.remove_new = qnap_power_off_remove,
.remove = qnap_power_off_remove,
.driver = {
.name = "qnap_power_off",
.of_match_table = of_match_ptr(qnap_power_off_of_match_table),
Expand Down
3 changes: 2 additions & 1 deletion drivers/power/reset/syscon-reboot.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ static int syscon_reboot_probe(struct platform_device *pdev)
priority = 192;

if (of_property_read_u32(pdev->dev.of_node, "offset", &ctx->offset))
return -EINVAL;
if (of_property_read_u32(pdev->dev.of_node, "reg", &ctx->offset))
return -EINVAL;

value_err = of_property_read_u32(pdev->dev.of_node, "value", &ctx->value);
mask_err = of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask);
Expand Down
4 changes: 2 additions & 2 deletions drivers/power/supply/88pm860x_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ static irqreturn_t pm860x_batt_handler(int irq, void *data)
info->temp_type = PM860X_TEMP_TINT;
}
mutex_unlock(&info->lock);
/* clear ccnt since battery is attached or dettached */
/* clear ccnt since battery is attached or detached */
clear_ccnt(info, &ccnt_data);
return IRQ_HANDLED;
}
Expand Down Expand Up @@ -566,7 +566,7 @@ static int measure_temp(struct pm860x_battery_info *info, int *data)
ret = measure_12bit_voltage(info, PM8607_GPADC1_MEAS1, data);
if (ret)
return ret;
/* meausered Vtbat(mV) / Ibias_current(11uA)*/
/* measured Vtbat(mV) / Ibias_current(11uA)*/
*data = (*data * 1000) / GPBIAS2_GPADC1_UA;

if (*data > TBAT_NEG_25D) {
Expand Down
10 changes: 10 additions & 0 deletions drivers/power/supply/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,16 @@ config CHARGER_TWL4030
help
Say Y here to enable support for TWL4030 Battery Charge Interface.

config CHARGER_TWL6030
tristate "OMAP TWL6030 BCI charger driver"
depends on IIO && TWL4030_CORE
help
Say Y here to enable support for TWL6030/6032 Battery Charge
Interface.

This driver can be build as a module. If so, the module will be
called twl6030_charger.

config CHARGER_LP8727
tristate "TI/National Semiconductor LP8727 charger driver"
depends on I2C
Expand Down
1 change: 1 addition & 0 deletions drivers/power/supply/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ obj-$(CONFIG_CHARGER_CPCAP) += cpcap-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_TWL6030) += twl6030_charger.o
obj-$(CONFIG_CHARGER_LP8727) += lp8727_charger.o
obj-$(CONFIG_CHARGER_LP8788) += lp8788-charger.o
obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
Expand Down
4 changes: 2 additions & 2 deletions drivers/power/supply/ab8500_bmdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/* Default: temperature hysteresis */
#define AB8500_TEMP_HYSTERESIS 3

static struct power_supply_battery_ocv_table ocv_cap_tbl[] = {
static const struct power_supply_battery_ocv_table ocv_cap_tbl[] = {
{ .ocv = 4186000, .capacity = 100},
{ .ocv = 4163000, .capacity = 99},
{ .ocv = 4114000, .capacity = 95},
Expand Down Expand Up @@ -48,7 +48,7 @@ static struct power_supply_battery_ocv_table ocv_cap_tbl[] = {
* temperature values to work. Factory resistance is 300 mOhm and the
* resistance values to the right are percentages of 300 mOhm.
*/
static struct power_supply_resistance_temp_table temp_to_batres_tbl_thermistor[] = {
static const struct power_supply_resistance_temp_table temp_to_batres_tbl_thermistor[] = {
{ .temp = 40, .resistance = 40 /* 120 mOhm */ },
{ .temp = 30, .resistance = 45 /* 135 mOhm */ },
{ .temp = 20, .resistance = 55 /* 165 mOhm */ },
Expand Down
4 changes: 2 additions & 2 deletions drivers/power/supply/ab8500_btemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ static void ab8500_btemp_periodic_work(struct work_struct *work)
dev_warn(di->dev, "failed to identify the battery\n");
}

/* Failover if a reading is erroneous, use last meausurement */
/* Failover if a reading is erroneous, use last measurement */
ret = thermal_zone_get_temp(di->tz, &bat_temp);
if (ret) {
dev_err(di->dev, "error reading temperature\n");
Expand Down Expand Up @@ -818,7 +818,7 @@ MODULE_DEVICE_TABLE(of, ab8500_btemp_match);

struct platform_driver ab8500_btemp_driver = {
.probe = ab8500_btemp_probe,
.remove_new = ab8500_btemp_remove,
.remove = ab8500_btemp_remove,
.driver = {
.name = "ab8500-btemp",
.of_match_table = ab8500_btemp_match,
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/ab8500_chargalg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1837,7 +1837,7 @@ static const struct of_device_id ab8500_chargalg_match[] = {

struct platform_driver ab8500_chargalg_driver = {
.probe = ab8500_chargalg_probe,
.remove_new = ab8500_chargalg_remove,
.remove = ab8500_chargalg_remove,
.driver = {
.name = "ab8500_chargalg",
.of_match_table = ab8500_chargalg_match,
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/ab8500_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -3711,7 +3711,7 @@ MODULE_DEVICE_TABLE(of, ab8500_charger_match);

static struct platform_driver ab8500_charger_driver = {
.probe = ab8500_charger_probe,
.remove_new = ab8500_charger_remove,
.remove = ab8500_charger_remove,
.driver = {
.name = "ab8500-charger",
.of_match_table = ab8500_charger_match,
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/ab8500_fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -3242,7 +3242,7 @@ MODULE_DEVICE_TABLE(of, ab8500_fg_match);

struct platform_driver ab8500_fg_driver = {
.probe = ab8500_fg_probe,
.remove_new = ab8500_fg_remove,
.remove = ab8500_fg_remove,
.driver = {
.name = "ab8500-fg",
.of_match_table = ab8500_fg_match,
Expand Down
9 changes: 5 additions & 4 deletions drivers/power/supply/acer_a500_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,15 @@ static int a500_battery_probe(struct platform_device *pdev)

psy_cfg.of_node = pdev->dev.parent->of_node;
psy_cfg.drv_data = bat;
psy_cfg.no_wakeup_source = true;

bat->regmap = dev_get_regmap(pdev->dev.parent, "KB930");
if (!bat->regmap)
return -EINVAL;

bat->psy = devm_power_supply_register_no_ws(&pdev->dev,
&a500_battery_desc,
&psy_cfg);
bat->psy = devm_power_supply_register(&pdev->dev,
&a500_battery_desc,
&psy_cfg);
if (IS_ERR(bat->psy))
return dev_err_probe(&pdev->dev, PTR_ERR(bat->psy),
"failed to register battery\n");
Expand Down Expand Up @@ -285,7 +286,7 @@ static struct platform_driver a500_battery_driver = {
.pm = &a500_battery_pm_ops,
},
.probe = a500_battery_probe,
.remove_new = a500_battery_remove,
.remove = a500_battery_remove,
};
module_platform_driver(a500_battery_driver);

Expand Down
2 changes: 1 addition & 1 deletion drivers/power/supply/act8945a_charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ static struct platform_driver act8945a_charger_driver = {
.name = "act8945a-charger",
},
.probe = act8945a_charger_probe,
.remove_new = act8945a_charger_remove,
.remove = act8945a_charger_remove,
};
module_platform_driver(act8945a_charger_driver);

Expand Down
Loading

0 comments on commit 448ecd5

Please sign in to comment.