Skip to content

Commit fd71b9a

Browse files
committed
Merge tag 'for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: "Power-supply core: - new charging_orange_full_green RGB LED trigger - simplify and cleanup power-supply LED trigger code - expose power information via hwmon compatibility layer New hardware support: - enable battery support for Qualcomm Snapdragon X Elite - new battery driver for Maxim MAX17201/MAX17205 - new battery driver for Lenovo Yoga C630 laptop (custom EC) Cleanups: - cleanup 'struct i2c_device_id' initializations - misc small battery driver cleanups and fixes" * tag 'for-v6.11' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: supply: sysfs: use power_supply_property_is_writeable() power: supply: qcom_battmgr: Enable battery support on x1e80100 power: supply: add support for MAX1720x standalone fuel gauge dt-bindings: power: supply: add support for MAX17201/MAX17205 fuel gauge power: reset: piix4: add missing MODULE_DESCRIPTION() macro power: supply: samsung-sdi-battery: Constify struct power_supply_maintenance_charge_table power: supply: samsung-sdi-battery: Constify struct power_supply_vbat_ri_table power: supply: lenovo_yoga_c630_battery: add Lenovo C630 driver power: supply: ingenic: Fix some error handling paths in ingenic_battery_get_property() power: supply: ab8500: Clean some error messages power: supply: ab8500: Use iio_read_channel_processed_scale() power: supply: ab8500: Fix error handling when calling iio_read_channel_processed() power: supply: hwmon: Add support for power sensors power: supply: ab8500: remove unused struct 'inst_curr_result_list' power: supply: bd99954: remove unused struct 'battery_data' power: supply: leds: Add activate() callback to triggers power: supply: leds: Share trig pointer for online and charging_full power: supply: leds: Add power_supply_[un]register_led_trigger() power: supply: Drop explicit initialization of struct i2c_device_id::driver_data to 0
2 parents c5d2be6 + be6299c commit fd71b9a

30 files changed

+1127
-161
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/power/supply/maxim,max17201.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Maxim MAX17201 fuel gauge
8+
9+
maintainers:
10+
- Dimitri Fedrau <[email protected]>
11+
12+
allOf:
13+
- $ref: power-supply.yaml#
14+
15+
properties:
16+
compatible:
17+
oneOf:
18+
- const: maxim,max17201
19+
- items:
20+
- enum:
21+
- maxim,max17205
22+
- const: maxim,max17201
23+
24+
reg:
25+
items:
26+
- description: ModelGauge m5 registers
27+
- description: Nonvolatile registers
28+
29+
reg-names:
30+
items:
31+
- const: m5
32+
- const: nvmem
33+
34+
interrupts:
35+
maxItems: 1
36+
37+
required:
38+
- compatible
39+
- reg
40+
- reg-names
41+
42+
unevaluatedProperties: false
43+
44+
examples:
45+
- |
46+
#include <dt-bindings/interrupt-controller/irq.h>
47+
i2c {
48+
#address-cells = <1>;
49+
#size-cells = <0>;
50+
51+
fuel-gauge@36 {
52+
compatible = "maxim,max17201";
53+
reg = <0x36>, <0xb>;
54+
reg-names = "m5", "nvmem";
55+
interrupt-parent = <&gpio0>;
56+
interrupts = <31 IRQ_TYPE_LEVEL_LOW>;
57+
};
58+
};

drivers/power/reset/piix4-poweroff.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,5 @@ static struct pci_driver piix4_poweroff_driver = {
106106

107107
module_pci_driver(piix4_poweroff_driver);
108108
MODULE_AUTHOR("Paul Burton <[email protected]>");
109+
MODULE_DESCRIPTION("Intel PIIX4 power-off driver");
109110
MODULE_LICENSE("GPL");

drivers/power/supply/Kconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ config BATTERY_LEGO_EV3
167167
help
168168
Say Y here to enable support for the LEGO MINDSTORMS EV3 battery.
169169

170+
config BATTERY_LENOVO_YOGA_C630
171+
tristate "Lenovo Yoga C630 battery"
172+
depends on EC_LENOVO_YOGA_C630
173+
help
174+
This driver enables battery support on the Lenovo Yoga C630 laptop.
175+
176+
To compile the driver as a module, choose M here: the module will be
177+
called lenovo_yoga_c630_battery.
178+
170179
config BATTERY_PMU
171180
tristate "Apple PMU battery"
172181
depends on PPC32 && ADB_PMU
@@ -402,6 +411,18 @@ config BATTERY_MAX17042
402411

403412
Driver can be build as a module (max17042_battery).
404413

414+
config BATTERY_MAX1720X
415+
tristate "Maxim MAX17201/MAX17205 Fuel Gauge"
416+
depends on I2C
417+
select REGMAP_I2C
418+
help
419+
MAX1720x is a family of fuel-gauge systems for lithium-ion (Li+)
420+
batteries in handheld and portable equipment. MAX17201 are
421+
configured to operate with a single lithium cell, the MAX17205
422+
can operate with multiple cells.
423+
424+
Say Y to include support for the MAX17201/MAX17205 Fuel Gauges.
425+
405426
config BATTERY_MAX1721X
406427
tristate "MAX17211/MAX17215 standalone gas-gauge"
407428
depends on W1

drivers/power/supply/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ obj-$(CONFIG_BATTERY_DS2782) += ds2782_battery.o
3232
obj-$(CONFIG_BATTERY_GAUGE_LTC2941) += ltc2941-battery-gauge.o
3333
obj-$(CONFIG_BATTERY_GOLDFISH) += goldfish_battery.o
3434
obj-$(CONFIG_BATTERY_LEGO_EV3) += lego_ev3_battery.o
35+
obj-$(CONFIG_BATTERY_LENOVO_YOGA_C630) += lenovo_yoga_c630_battery.o
3536
obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o
3637
obj-$(CONFIG_BATTERY_QCOM_BATTMGR) += qcom_battmgr.o
3738
obj-$(CONFIG_BATTERY_OLPC) += olpc_battery.o
@@ -52,6 +53,7 @@ obj-$(CONFIG_CHARGER_DA9150) += da9150-charger.o
5253
obj-$(CONFIG_BATTERY_DA9150) += da9150-fg.o
5354
obj-$(CONFIG_BATTERY_MAX17040) += max17040_battery.o
5455
obj-$(CONFIG_BATTERY_MAX17042) += max17042_battery.o
56+
obj-$(CONFIG_BATTERY_MAX1720X) += max1720x_battery.o
5557
obj-$(CONFIG_BATTERY_MAX1721X) += max1721x_battery.o
5658
obj-$(CONFIG_BATTERY_RT5033) += rt5033_battery.o
5759
obj-$(CONFIG_CHARGER_RT5033) += rt5033_charger.o

drivers/power/supply/ab8500_chargalg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,8 +1225,8 @@ static bool ab8500_chargalg_time_to_restart(struct ab8500_chargalg *di)
12251225
*/
12261226
static void ab8500_chargalg_algorithm(struct ab8500_chargalg *di)
12271227
{
1228+
const struct power_supply_maintenance_charge_table *mt;
12281229
struct power_supply_battery_info *bi = di->bm->bi;
1229-
struct power_supply_maintenance_charge_table *mt;
12301230
int charger_status;
12311231
int ret;
12321232

drivers/power/supply/ab8500_charger.c

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -487,14 +487,17 @@ static int ab8500_charger_get_ac_voltage(struct ab8500_charger *di)
487487

488488
/* Only measure voltage if the charger is connected */
489489
if (di->ac.charger_connected) {
490-
ret = iio_read_channel_processed(di->adc_main_charger_v, &vch);
491-
if (ret < 0)
492-
dev_err(di->dev, "%s ADC conv failed,\n", __func__);
490+
/* Convert to microvolt, IIO returns millivolt */
491+
ret = iio_read_channel_processed_scale(di->adc_main_charger_v,
492+
&vch, 1000);
493+
if (ret < 0) {
494+
dev_err(di->dev, "%s ADC conv failed\n", __func__);
495+
return ret;
496+
}
493497
} else {
494498
vch = 0;
495499
}
496-
/* Convert to microvolt, IIO returns millivolt */
497-
return vch * 1000;
500+
return vch;
498501
}
499502

500503
/**
@@ -539,14 +542,17 @@ static int ab8500_charger_get_vbus_voltage(struct ab8500_charger *di)
539542

540543
/* Only measure voltage if the charger is connected */
541544
if (di->usb.charger_connected) {
542-
ret = iio_read_channel_processed(di->adc_vbus_v, &vch);
543-
if (ret < 0)
544-
dev_err(di->dev, "%s ADC conv failed,\n", __func__);
545+
/* Convert to microvolt, IIO returns millivolt */
546+
ret = iio_read_channel_processed_scale(di->adc_vbus_v,
547+
&vch, 1000);
548+
if (ret < 0) {
549+
dev_err(di->dev, "%s ADC conv failed\n", __func__);
550+
return ret;
551+
}
545552
} else {
546553
vch = 0;
547554
}
548-
/* Convert to microvolt, IIO returns millivolt */
549-
return vch * 1000;
555+
return vch;
550556
}
551557

552558
/**
@@ -562,14 +568,17 @@ static int ab8500_charger_get_usb_current(struct ab8500_charger *di)
562568

563569
/* Only measure current if the charger is online */
564570
if (di->usb.charger_online) {
565-
ret = iio_read_channel_processed(di->adc_usb_charger_c, &ich);
566-
if (ret < 0)
567-
dev_err(di->dev, "%s ADC conv failed,\n", __func__);
571+
/* Return microamperes */
572+
ret = iio_read_channel_processed_scale(di->adc_usb_charger_c,
573+
&ich, 1000);
574+
if (ret < 0) {
575+
dev_err(di->dev, "%s ADC conv failed\n", __func__);
576+
return ret;
577+
}
568578
} else {
569579
ich = 0;
570580
}
571-
/* Return microamperes */
572-
return ich * 1000;
581+
return ich;
573582
}
574583

575584
/**
@@ -585,14 +594,17 @@ static int ab8500_charger_get_ac_current(struct ab8500_charger *di)
585594

586595
/* Only measure current if the charger is online */
587596
if (di->ac.charger_online) {
588-
ret = iio_read_channel_processed(di->adc_main_charger_c, &ich);
589-
if (ret < 0)
590-
dev_err(di->dev, "%s ADC conv failed,\n", __func__);
597+
/* Return microamperes */
598+
ret = iio_read_channel_processed_scale(di->adc_main_charger_c,
599+
&ich, 1000);
600+
if (ret < 0) {
601+
dev_err(di->dev, "%s ADC conv failed\n", __func__);
602+
return ret;
603+
}
591604
} else {
592605
ich = 0;
593606
}
594-
/* Return microamperes */
595-
return ich * 1000;
607+
return ich;
596608
}
597609

598610
/**

drivers/power/supply/ab8500_fg.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,6 @@ struct ab8500_fg_flags {
149149
bool batt_id_received;
150150
};
151151

152-
struct inst_curr_result_list {
153-
struct list_head list;
154-
int *result;
155-
};
156-
157152
/**
158153
* struct ab8500_fg - ab8500 FG device information
159154
* @dev: Pointer to the structure device

drivers/power/supply/adp5061.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ static int adp5061_probe(struct i2c_client *client)
727727
}
728728

729729
static const struct i2c_device_id adp5061_id[] = {
730-
{ "adp5061", 0},
730+
{ "adp5061" },
731731
{ }
732732
};
733733
MODULE_DEVICE_TABLE(i2c, adp5061_id);

drivers/power/supply/bd99954-charger.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,6 @@
7070

7171
#include "bd99954-charger.h"
7272

73-
struct battery_data {
74-
u16 precharge_current; /* Trickle-charge Current */
75-
u16 fc_reg_voltage; /* Fast Charging Regulation Voltage */
76-
u16 voltage_min;
77-
u16 voltage_max;
78-
};
79-
8073
/* Initial field values, converted to initial register values */
8174
struct bd9995x_init_data {
8275
u16 vsysreg_set; /* VSYS Regulation Setting */

drivers/power/supply/bq24735-charger.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ static int bq24735_charger_probe(struct i2c_client *client)
489489
}
490490

491491
static const struct i2c_device_id bq24735_charger_id[] = {
492-
{ "bq24735-charger", 0 },
492+
{ "bq24735-charger" },
493493
{}
494494
};
495495
MODULE_DEVICE_TABLE(i2c, bq24735_charger_id);

0 commit comments

Comments
 (0)