Skip to content

Commit 288cb34

Browse files
committed
Merge tag 'for-v6.12' 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: - introduce power_supply_show_enum_with_available() helper - change usb_types from an array into a bitmask - fix early usage of power_supply_property_is_writeable() resulting in sysfs files not being writable - fix missing temp1_max_alarm attribute in power-supply's hwmon devices Drivers: - max1720x: expose nvmem device - brcmstb: cleanup driver to use latest APIs - max77693: expose input and charging current limit - max17042_battery: fix state of charge reading for devices without current sensing - axp20x_battery: add AXP717 support - axp20x_battery: fix min/max voltage properties - axp20x_usb_power: add AXP717 support - axp20x_usb_power: add DT based input current limit Documentation updates Misc minor cleanups and fixes" * tag 'for-v6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (38 commits) power: supply: hwmon: Fix missing temp1_max_alarm attribute power: supply: Drop use_cnt check from power_supply_property_is_writeable() power: supply: ab8500: Constify struct kobj_type power: supply: max1720x: fix a double free on error in probe() power: supply: axp20x_battery: add support for AXP717 power: supply: axp20x_usb_power: Add support for AXP717 dt-bindings: power: supply: axp20x: Add AXP717 compatible dt-bindings: power: supply: axp20x: Add AXP717 compatible power: supply: axp20x_usb_power: Fix spelling mistake "reqested" -> "requested" power: supply: Change usb_types from an array into a bitmask power: supply: sysfs: Move power_supply_show_enum_with_available() up power: supply: sysfs: Add power_supply_show_enum_with_available() helper power: supply: rt9467-charger: Remove "usb_type" property write support power: supply: ucs1002: Adjust ucs1002_set_usb_type() to accept string values power: supply: "usb_type" property may be written to power: supply: max1720x: add read support for nvmem mfd: axp20x: Add ADC, BAT, and USB cells for AXP717 power: supply: core: constify psy_tzd_ops power: reset: brcmstb: Do not go into infinite loop if reset fails power: reset: brcmstb: Use devm_register_sys_off_handler() ...
2 parents bfbb963 + e50a57d commit 288cb34

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1433
-444
lines changed

Documentation/ABI/testing/sysfs-class-power

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -377,17 +377,33 @@ What: /sys/class/power_supply/<supply_name>/charge_type
377377
Date: July 2009
378378
379379
Description:
380-
Represents the type of charging currently being applied to the
381-
battery. "Trickle", "Fast", and "Standard" all mean different
382-
charging speeds. "Adaptive" means that the charger uses some
383-
algorithm to adjust the charge rate dynamically, without
384-
any user configuration required. "Custom" means that the charger
385-
uses the charge_control_* properties as configuration for some
386-
different algorithm. "Long Life" means the charger reduces its
387-
charging rate in order to prolong the battery health. "Bypass"
388-
means the charger bypasses the charging path around the
389-
integrated converter allowing for a "smart" wall adaptor to
390-
perform the power conversion externally.
380+
Select the charging algorithm to use for a battery.
381+
382+
Standard:
383+
Fully charge the battery at a moderate rate.
384+
Fast:
385+
Quickly charge the battery using fast-charge
386+
technology. This is typically harder on the battery
387+
than standard charging and may lower its lifespan.
388+
Trickle:
389+
Users who primarily operate the system while
390+
plugged into an external power source can extend
391+
battery life with this mode. Vendor tooling may
392+
call this "Primarily AC Use".
393+
Adaptive:
394+
Automatically optimize battery charge rate based
395+
on typical usage pattern.
396+
Custom:
397+
Use the charge_control_* properties to determine
398+
when to start and stop charging. Advanced users
399+
can use this to drastically extend battery life.
400+
Long Life:
401+
The charger reduces its charging rate in order to
402+
prolong the battery health.
403+
Bypass:
404+
The charger bypasses the charging path around the
405+
integrated converter allowing for a "smart" wall
406+
adaptor to perform the power conversion externally.
391407

392408
Access: Read, Write
393409

@@ -592,7 +608,12 @@ Description:
592608
the supply, for example it can show if USB-PD capable source
593609
is attached.
594610

595-
Access: Read-Only
611+
Access: For power-supplies which consume USB power such
612+
as battery charger chips, this indicates the type of
613+
the connected USB power source and is Read-Only.
614+
615+
For power-supplies which act as a USB power-source such as
616+
e.g. the UCS1002 USB Port Power Controller this is writable.
596617

597618
Valid values:
598619
"Unknown", "SDP", "DCP", "CDP", "ACA", "C", "PD",

Documentation/devicetree/bindings/power/supply/sc27xx-fg.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ properties:
2727
battery-detect-gpios:
2828
maxItems: 1
2929

30+
interrupts:
31+
maxItems: 1
32+
3033
io-channels:
3134
items:
3235
- description: Battery Temperature ADC
@@ -53,6 +56,7 @@ required:
5356
- compatible
5457
- reg
5558
- battery-detect-gpios
59+
- interrupts
5660
- io-channels
5761
- io-channel-names
5862
- nvmem-cells
@@ -88,6 +92,8 @@ examples:
8892
compatible = "sprd,sc2731-fgu";
8993
reg = <0xa00>;
9094
battery-detect-gpios = <&pmic_eic 9 GPIO_ACTIVE_HIGH>;
95+
interrupt-parent = <&sc2731_pmic>;
96+
interrupts = <4>;
9197
io-channels = <&pmic_adc 5>, <&pmic_adc 14>;
9298
io-channel-names = "bat-temp", "charge-vol";
9399
nvmem-cells = <&fgu_calib>;

Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,18 @@ properties:
2323
- const: x-powers,axp202-battery-power-supply
2424
- const: x-powers,axp209-battery-power-supply
2525
- const: x-powers,axp221-battery-power-supply
26+
- const: x-powers,axp717-battery-power-supply
2627
- items:
2728
- const: x-powers,axp803-battery-power-supply
2829
- const: x-powers,axp813-battery-power-supply
2930
- const: x-powers,axp813-battery-power-supply
3031

32+
monitored-battery:
33+
description:
34+
Specifies the phandle of an optional simple-battery connected to
35+
this gauge.
36+
$ref: /schemas/types.yaml#/definitions/phandle
37+
3138
required:
3239
- compatible
3340

Documentation/devicetree/bindings/power/supply/x-powers,axp20x-usb-power-supply.yaml

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ maintainers:
1515
- Chen-Yu Tsai <[email protected]>
1616
- Sebastian Reichel <[email protected]>
1717

18-
allOf:
19-
- $ref: power-supply.yaml#
20-
2118
properties:
2219
compatible:
2320
oneOf:
@@ -26,13 +23,82 @@ properties:
2623
- x-powers,axp202-usb-power-supply
2724
- x-powers,axp221-usb-power-supply
2825
- x-powers,axp223-usb-power-supply
26+
- x-powers,axp717-usb-power-supply
2927
- x-powers,axp813-usb-power-supply
3028
- items:
3129
- const: x-powers,axp803-usb-power-supply
3230
- const: x-powers,axp813-usb-power-supply
3331

32+
input-current-limit-microamp:
33+
description:
34+
Optional value to clamp the maximum input current limit to for
35+
the device. If omitted, the programmed value from the EFUSE will
36+
be used.
37+
minimum: 100000
38+
maximum: 4000000
3439

3540
required:
3641
- compatible
3742

43+
allOf:
44+
- $ref: power-supply.yaml#
45+
- if:
46+
properties:
47+
compatible:
48+
contains:
49+
enum:
50+
- x-powers,axp192-usb-power-supply
51+
then:
52+
properties:
53+
input-current-limit-microamp:
54+
enum: [100000, 500000]
55+
56+
- if:
57+
properties:
58+
compatible:
59+
contains:
60+
enum:
61+
- x-powers,axp202-usb-power-supply
62+
- x-powers,axp223-usb-power-supply
63+
then:
64+
properties:
65+
input-current-limit-microamp:
66+
enum: [100000, 500000, 900000]
67+
68+
- if:
69+
properties:
70+
compatible:
71+
contains:
72+
enum:
73+
- x-powers,axp221-usb-power-supply
74+
then:
75+
properties:
76+
input-current-limit-microamp:
77+
enum: [500000, 900000]
78+
79+
- if:
80+
properties:
81+
compatible:
82+
contains:
83+
enum:
84+
- x-powers,axp717-usb-power-supply
85+
then:
86+
properties:
87+
input-current-limit-microamp:
88+
description: Maximum input current in increments of 50000 uA.
89+
minimum: 100000
90+
maximum: 3250000
91+
92+
- if:
93+
properties:
94+
compatible:
95+
contains:
96+
enum:
97+
- x-powers,axp813-usb-power-supply
98+
then:
99+
properties:
100+
input-current-limit-microamp:
101+
enum: [100000, 500000, 900000, 1500000, 2000000, 2500000,
102+
3000000, 3500000, 4000000]
103+
38104
additionalProperties: false

drivers/extcon/extcon-intel-cht-wc.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -461,14 +461,6 @@ static int cht_wc_extcon_psy_get_prop(struct power_supply *psy,
461461
return 0;
462462
}
463463

464-
static const enum power_supply_usb_type cht_wc_extcon_psy_usb_types[] = {
465-
POWER_SUPPLY_USB_TYPE_SDP,
466-
POWER_SUPPLY_USB_TYPE_CDP,
467-
POWER_SUPPLY_USB_TYPE_DCP,
468-
POWER_SUPPLY_USB_TYPE_ACA,
469-
POWER_SUPPLY_USB_TYPE_UNKNOWN,
470-
};
471-
472464
static const enum power_supply_property cht_wc_extcon_psy_props[] = {
473465
POWER_SUPPLY_PROP_USB_TYPE,
474466
POWER_SUPPLY_PROP_ONLINE,
@@ -477,8 +469,11 @@ static const enum power_supply_property cht_wc_extcon_psy_props[] = {
477469
static const struct power_supply_desc cht_wc_extcon_psy_desc = {
478470
.name = "cht_wcove_pwrsrc",
479471
.type = POWER_SUPPLY_TYPE_USB,
480-
.usb_types = cht_wc_extcon_psy_usb_types,
481-
.num_usb_types = ARRAY_SIZE(cht_wc_extcon_psy_usb_types),
472+
.usb_types = BIT(POWER_SUPPLY_USB_TYPE_SDP) |
473+
BIT(POWER_SUPPLY_USB_TYPE_CDP) |
474+
BIT(POWER_SUPPLY_USB_TYPE_DCP) |
475+
BIT(POWER_SUPPLY_USB_TYPE_ACA) |
476+
BIT(POWER_SUPPLY_USB_TYPE_UNKNOWN),
482477
.properties = cht_wc_extcon_psy_props,
483478
.num_properties = ARRAY_SIZE(cht_wc_extcon_psy_props),
484479
.get_property = cht_wc_extcon_psy_get_prop,

drivers/mfd/axp20x.c

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,23 @@ static const struct regmap_access_table axp313a_volatile_table = {
209209
};
210210

211211
static const struct regmap_range axp717_writeable_ranges[] = {
212-
regmap_reg_range(AXP717_MODULE_EN_CONTROL_2, AXP717_MODULE_EN_CONTROL_2),
213-
regmap_reg_range(AXP717_BOOST_CONTROL, AXP717_BOOST_CONTROL),
212+
regmap_reg_range(AXP717_PMU_FAULT, AXP717_MODULE_EN_CONTROL_1),
213+
regmap_reg_range(AXP717_MIN_SYS_V_CONTROL, AXP717_BOOST_CONTROL),
214+
regmap_reg_range(AXP717_VSYS_V_POWEROFF, AXP717_VSYS_V_POWEROFF),
214215
regmap_reg_range(AXP717_IRQ0_EN, AXP717_IRQ4_EN),
215216
regmap_reg_range(AXP717_IRQ0_STATE, AXP717_IRQ4_STATE),
217+
regmap_reg_range(AXP717_ICC_CHG_SET, AXP717_CV_CHG_SET),
216218
regmap_reg_range(AXP717_DCDC_OUTPUT_CONTROL, AXP717_CPUSLDO_CONTROL),
219+
regmap_reg_range(AXP717_ADC_CH_EN_CONTROL, AXP717_ADC_CH_EN_CONTROL),
220+
regmap_reg_range(AXP717_ADC_DATA_SEL, AXP717_ADC_DATA_SEL),
217221
};
218222

219223
static const struct regmap_range axp717_volatile_ranges[] = {
224+
regmap_reg_range(AXP717_ON_INDICATE, AXP717_PMU_FAULT),
220225
regmap_reg_range(AXP717_IRQ0_STATE, AXP717_IRQ4_STATE),
226+
regmap_reg_range(AXP717_BATT_PERCENT_DATA, AXP717_BATT_PERCENT_DATA),
227+
regmap_reg_range(AXP717_BATT_V_H, AXP717_BATT_CHRG_I_L),
228+
regmap_reg_range(AXP717_ADC_DATA_H, AXP717_ADC_DATA_L),
221229
};
222230

223231
static const struct regmap_access_table axp717_writeable_table = {
@@ -310,6 +318,12 @@ static const struct resource axp22x_usb_power_supply_resources[] = {
310318
DEFINE_RES_IRQ_NAMED(AXP22X_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
311319
};
312320

321+
static const struct resource axp717_usb_power_supply_resources[] = {
322+
DEFINE_RES_IRQ_NAMED(AXP717_IRQ_VBUS_OVER_V, "VBUS_OVER_V"),
323+
DEFINE_RES_IRQ_NAMED(AXP717_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
324+
DEFINE_RES_IRQ_NAMED(AXP717_IRQ_VBUS_REMOVAL, "VBUS_REMOVAL"),
325+
};
326+
313327
/* AXP803 and AXP813/AXP818 share the same interrupts */
314328
static const struct resource axp803_usb_power_supply_resources[] = {
315329
DEFINE_RES_IRQ_NAMED(AXP803_IRQ_VBUS_PLUGIN, "VBUS_PLUGIN"),
@@ -424,7 +438,7 @@ static const struct regmap_config axp717_regmap_config = {
424438
.val_bits = 8,
425439
.wr_table = &axp717_writeable_table,
426440
.volatile_table = &axp717_volatile_table,
427-
.max_register = AXP717_CPUSLDO_CONTROL,
441+
.max_register = AXP717_ADC_DATA_L,
428442
.cache_type = REGCACHE_MAPLE,
429443
};
430444

@@ -1026,6 +1040,13 @@ static struct mfd_cell axp313a_cells[] = {
10261040
static struct mfd_cell axp717_cells[] = {
10271041
MFD_CELL_NAME("axp20x-regulator"),
10281042
MFD_CELL_RES("axp20x-pek", axp717_pek_resources),
1043+
MFD_CELL_OF("axp717-adc",
1044+
NULL, NULL, 0, 0, "x-powers,axp717-adc"),
1045+
MFD_CELL_OF("axp20x-usb-power-supply",
1046+
axp717_usb_power_supply_resources, NULL, 0, 0,
1047+
"x-powers,axp717-usb-power-supply"),
1048+
MFD_CELL_OF("axp20x-battery-power-supply",
1049+
NULL, NULL, 0, 0, "x-powers,axp717-battery-power-supply"),
10291050
};
10301051

10311052
static const struct resource axp288_adc_resources[] = {

drivers/phy/ti/phy-tusb1210.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -411,12 +411,6 @@ static int tusb1210_psy_get_prop(struct power_supply *psy,
411411
return 0;
412412
}
413413

414-
static const enum power_supply_usb_type tusb1210_psy_usb_types[] = {
415-
POWER_SUPPLY_USB_TYPE_SDP,
416-
POWER_SUPPLY_USB_TYPE_DCP,
417-
POWER_SUPPLY_USB_TYPE_UNKNOWN,
418-
};
419-
420414
static const enum power_supply_property tusb1210_psy_props[] = {
421415
POWER_SUPPLY_PROP_ONLINE,
422416
POWER_SUPPLY_PROP_USB_TYPE,
@@ -426,8 +420,9 @@ static const enum power_supply_property tusb1210_psy_props[] = {
426420
static const struct power_supply_desc tusb1210_psy_desc = {
427421
.name = "tusb1211-charger-detect",
428422
.type = POWER_SUPPLY_TYPE_USB,
429-
.usb_types = tusb1210_psy_usb_types,
430-
.num_usb_types = ARRAY_SIZE(tusb1210_psy_usb_types),
423+
.usb_types = BIT(POWER_SUPPLY_USB_TYPE_SDP) |
424+
BIT(POWER_SUPPLY_USB_TYPE_DCP) |
425+
BIT(POWER_SUPPLY_USB_TYPE_UNKNOWN),
431426
.properties = tusb1210_psy_props,
432427
.num_properties = ARRAY_SIZE(tusb1210_psy_props),
433428
.get_property = tusb1210_psy_get_prop,

0 commit comments

Comments
 (0)