Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-v6.15' 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:
- remove unused set_charged infrastructure
- drop of_node from power_supply struct

Power-supply drivers:
- axp717: support devices without thermistors
- bq27xxx: support max design voltage for bq270x0 and bq27x10
- pcf50633: drop charger driver
- max1720x: add battery health support
- switch all power-supply devices from of_node to fwnode
- convert regmap users to maple tree register cache
- convert drivers to devm_kmemdup_array
- misc cleanups and fixes

Reset drivers:
- at91-sama5d2_shdwc: add sama7d65 support

* tag 'for-v6.15' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (30 commits)
power: supply: mt6370: Remove redundant 'flush_workqueue()' calls
Revert "power: supply: bq27xxx: do not report bogus zero values"
power: supply: max77693: Fix wrong conversion of charge input threshold value
power: supply: pcf50633: Remove charger
power: supply: all: switch psy_cfg from of_node to fwnode
power: supply: core: get rid of of_node
power: reset: at91-sama5d2_shdwc: Add sama7d65 PMC
power: supply: smb347: convert to use maple tree register cache
power: supply: rt9455: convert to use maple tree register cache
power: supply: max1720x: convert to use maple tree register cache
power: supply: ltc4162l: convert to use maple tree register cache
power: supply: bq25980: convert to use maple tree register cache
power: supply: bq25890: convert to use maple tree register cache
power: supply: bq2515x: convert to use maple tree register cache
power: supply: bq24257: convert to use maple tree register cache
power: supply: bd99954: convert to use maple tree register cache
power: supply: Remove unused set_charged method
power: supply: ds2760: Remove unused ds2760_battery_set_charged
power: supply: core: Remove unused power_supply_set_battery_charged
power: supply: sc27xx: use devm_kmemdup_array()
...

+212 -627
+5
Documentation/devicetree/bindings/power/reset/atmel,sama5d2-shdwc.yaml
··· 17 17 compatible: 18 18 oneOf: 19 19 - items: 20 + - enum: 21 + - microchip,sama7d65-shdwc 22 + - const: microchip,sama7g5-shdwc 23 + - const: syscon 24 + - items: 20 25 - const: microchip,sama7g5-shdwc 21 26 - const: syscon 22 27 - enum:
-1
Documentation/devicetree/bindings/power/reset/xlnx,zynqmp-power.yaml
··· 46 46 47 47 required: 48 48 - compatible 49 - - interrupts 50 49 51 50 additionalProperties: false 52 51
+17 -3
Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
··· 14 14 - Chen-Yu Tsai <wens@csie.org> 15 15 - Sebastian Reichel <sre@kernel.org> 16 16 17 - allOf: 18 - - $ref: power-supply.yaml# 19 - 20 17 properties: 21 18 compatible: 22 19 oneOf: ··· 32 35 this gauge. 33 36 $ref: /schemas/types.yaml#/definitions/phandle 34 37 38 + x-powers,no-thermistor: 39 + type: boolean 40 + description: Indicates that no thermistor is connected to the TS pin 41 + 35 42 required: 36 43 - compatible 44 + 45 + allOf: 46 + - $ref: power-supply.yaml# 47 + - if: 48 + not: 49 + properties: 50 + compatible: 51 + contains: 52 + enum: 53 + - x-powers,axp717-battery-power-supply 54 + then: 55 + properties: 56 + x-powers,no-thermistor: false 37 57 38 58 additionalProperties: false
+1
drivers/power/reset/at91-sama5d2_shdwc.c
··· 327 327 { .compatible = "microchip,sam9x60-pmc" }, 328 328 { .compatible = "microchip,sama7g5-pmc" }, 329 329 { .compatible = "microchip,sam9x7-pmc" }, 330 + { .compatible = "microchip,sama7d65-pmc" }, 330 331 { /* Sentinel. */ } 331 332 }; 332 333
-6
drivers/power/supply/Kconfig
··· 449 449 help 450 450 Say Y here to enable charger for Marvell 88PM860x chip. 451 451 452 - config CHARGER_PCF50633 453 - tristate "NXP PCF50633 MBC" 454 - depends on MFD_PCF50633 455 - help 456 - Say Y to include support for NXP PCF50633 Main Battery Charger. 457 - 458 452 config BATTERY_RX51 459 453 tristate "Nokia RX-51 (N900) battery driver" 460 454 depends on TWL4030_MADC
-1
drivers/power/supply/Makefile
··· 62 62 obj-$(CONFIG_CHARGER_RT9471) += rt9471.o 63 63 obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o 64 64 obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o 65 - obj-$(CONFIG_CHARGER_PCF50633) += pcf50633-charger.o 66 65 obj-$(CONFIG_BATTERY_RX51) += rx51_battery.o 67 66 obj-$(CONFIG_AB8500_BM) += ab8500_bmdata.o ab8500_charger.o ab8500_fg.o ab8500_btemp.o ab8500_chargalg.o 68 67 obj-$(CONFIG_CHARGER_CPCAP) += cpcap-charger.o
+2 -2
drivers/power/supply/ab8500_charger.c
··· 3494 3494 di->invalid_charger_detect_state = 0; 3495 3495 3496 3496 /* AC and USB supply config */ 3497 - ac_psy_cfg.of_node = np; 3497 + ac_psy_cfg.fwnode = dev_fwnode(dev); 3498 3498 ac_psy_cfg.supplied_to = supply_interface; 3499 3499 ac_psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface); 3500 3500 ac_psy_cfg.drv_data = &di->ac_chg; 3501 - usb_psy_cfg.of_node = np; 3501 + usb_psy_cfg.fwnode = dev_fwnode(dev); 3502 3502 usb_psy_cfg.supplied_to = supply_interface; 3503 3503 usb_psy_cfg.num_supplicants = ARRAY_SIZE(supply_interface); 3504 3504 usb_psy_cfg.drv_data = &di->usb_chg;
+2 -1
drivers/power/supply/acer_a500_battery.c
··· 17 17 #include <linux/sched.h> 18 18 #include <linux/slab.h> 19 19 #include <linux/workqueue.h> 20 + #include <linux/property.h> 20 21 21 22 enum { 22 23 REG_CAPACITY, ··· 232 231 233 232 platform_set_drvdata(pdev, bat); 234 233 235 - psy_cfg.of_node = pdev->dev.parent->of_node; 234 + psy_cfg.fwnode = dev_fwnode(pdev->dev.parent); 236 235 psy_cfg.drv_data = bat; 237 236 psy_cfg.no_wakeup_source = true; 238 237
+1 -1
drivers/power/supply/act8945a_charger.c
··· 614 614 if (ret) 615 615 return -EINVAL; 616 616 617 - psy_cfg.of_node = pdev->dev.of_node; 617 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 618 618 psy_cfg.drv_data = charger; 619 619 620 620 charger->psy = devm_power_supply_register(&pdev->dev,
+1 -1
drivers/power/supply/axp20x_ac_power.c
··· 364 364 365 365 platform_set_drvdata(pdev, power); 366 366 367 - psy_cfg.of_node = pdev->dev.of_node; 367 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 368 368 psy_cfg.drv_data = power; 369 369 370 370 power->supply = devm_power_supply_register(&pdev->dev,
+22 -1
drivers/power/supply/axp20x_battery.c
··· 89 89 #define AXP717_BAT_CC_MIN_UA 0 90 90 #define AXP717_BAT_CC_MAX_UA 3008000 91 91 92 + #define AXP717_TS_PIN_DISABLE BIT(4) 93 + 92 94 struct axp20x_batt_ps; 93 95 94 96 struct axp_data { ··· 119 117 /* Maximum constant charge current */ 120 118 unsigned int max_ccc; 121 119 const struct axp_data *data; 120 + bool ts_disable; 122 121 }; 123 122 124 123 static int axp20x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt, ··· 987 984 int ccc = info->constant_charge_current_max_ua; 988 985 int val; 989 986 987 + axp_batt->ts_disable = (device_property_read_bool(axp_batt->dev, 988 + "x-powers,no-thermistor")); 989 + 990 + /* 991 + * Under rare conditions an incorrectly programmed efuse for 992 + * the temp sensor on the PMIC may trigger a fault condition. 993 + * Allow users to hard-code if the ts pin is not used to work 994 + * around this problem. Note that this requires the battery 995 + * be correctly defined in the device tree with a monitored 996 + * battery node. 997 + */ 998 + if (axp_batt->ts_disable) { 999 + regmap_update_bits(axp_batt->regmap, 1000 + AXP717_TS_PIN_CFG, 1001 + AXP717_TS_PIN_DISABLE, 1002 + AXP717_TS_PIN_DISABLE); 1003 + } 1004 + 990 1005 if (vmin > 0 && axp717_set_voltage_min_design(axp_batt, vmin)) 991 1006 dev_err(&pdev->dev, 992 1007 "couldn't set voltage_min_design\n"); ··· 1111 1090 platform_set_drvdata(pdev, axp20x_batt); 1112 1091 1113 1092 psy_cfg.drv_data = axp20x_batt; 1114 - psy_cfg.of_node = pdev->dev.of_node; 1093 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 1115 1094 1116 1095 axp20x_batt->data = (struct axp_data *)of_device_get_match_data(dev); 1117 1096
+2 -2
drivers/power/supply/axp20x_usb_power.c
··· 492 492 493 493 if (power->max_input_cur && (intval > power->max_input_cur)) { 494 494 dev_warn(power->dev, 495 - "reqested current %d clamped to max current %d\n", 495 + "requested current %d clamped to max current %d\n", 496 496 intval, power->max_input_cur); 497 497 intval = power->max_input_cur; 498 498 } ··· 1011 1011 return ret; 1012 1012 } 1013 1013 1014 - psy_cfg.of_node = pdev->dev.of_node; 1014 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 1015 1015 psy_cfg.drv_data = power; 1016 1016 1017 1017 power->supply = devm_power_supply_register(&pdev->dev,
+2 -2
drivers/power/supply/bd99954-charger.c
··· 156 156 .reg_stride = 1, 157 157 158 158 .max_register = 3 * 0x100, 159 - .cache_type = REGCACHE_RBTREE, 159 + .cache_type = REGCACHE_MAPLE, 160 160 161 161 .ranges = regmap_range_cfg, 162 162 .num_ranges = ARRAY_SIZE(regmap_range_cfg), ··· 982 982 bd->client = client; 983 983 bd->dev = dev; 984 984 psy_cfg.drv_data = bd; 985 - psy_cfg.of_node = dev->of_node; 985 + psy_cfg.fwnode = dev_fwnode(dev); 986 986 987 987 mutex_init(&bd->lock); 988 988
+1 -1
drivers/power/supply/bq2415x_charger.c
··· 1497 1497 char revstr[8]; 1498 1498 struct power_supply_config psy_cfg = { 1499 1499 .drv_data = bq, 1500 - .of_node = bq->dev->of_node, 1500 + .fwnode = dev_fwnode(bq->dev), 1501 1501 .attr_grp = bq2415x_sysfs_groups, 1502 1502 }; 1503 1503
+1 -1
drivers/power/supply/bq24190_charger.c
··· 2117 2117 #endif 2118 2118 2119 2119 charger_cfg.drv_data = bdi; 2120 - charger_cfg.of_node = dev->of_node; 2120 + charger_cfg.fwnode = dev_fwnode(dev); 2121 2121 charger_cfg.supplied_to = bq24190_charger_supplied_to; 2122 2122 charger_cfg.num_supplicants = ARRAY_SIZE(bq24190_charger_supplied_to); 2123 2123 bdi->charger = power_supply_register(dev, &bq24190_charger_desc,
+1 -1
drivers/power/supply/bq24257_charger.c
··· 113 113 .val_bits = 8, 114 114 115 115 .max_register = BQ24257_REG_7, 116 - .cache_type = REGCACHE_RBTREE, 116 + .cache_type = REGCACHE_MAPLE, 117 117 118 118 .volatile_reg = bq24257_is_volatile_reg, 119 119 };
+1 -1
drivers/power/supply/bq24735-charger.c
··· 402 402 403 403 psy_cfg.supplied_to = charger->pdata->supplied_to; 404 404 psy_cfg.num_supplicants = charger->pdata->num_supplicants; 405 - psy_cfg.of_node = client->dev.of_node; 405 + psy_cfg.fwnode = dev_fwnode(&client->dev); 406 406 psy_cfg.drv_data = charger; 407 407 408 408 i2c_set_clientdata(client, charger);
+3 -3
drivers/power/supply/bq2515x_charger.c
··· 1060 1060 .max_register = BQ2515X_DEVICE_ID, 1061 1061 .reg_defaults = bq25150_reg_defaults, 1062 1062 .num_reg_defaults = ARRAY_SIZE(bq25150_reg_defaults), 1063 - .cache_type = REGCACHE_RBTREE, 1063 + .cache_type = REGCACHE_MAPLE, 1064 1064 .volatile_reg = bq2515x_volatile_register, 1065 1065 }; 1066 1066 ··· 1071 1071 .max_register = BQ2515X_DEVICE_ID, 1072 1072 .reg_defaults = bq25155_reg_defaults, 1073 1073 .num_reg_defaults = ARRAY_SIZE(bq25155_reg_defaults), 1074 - .cache_type = REGCACHE_RBTREE, 1074 + .cache_type = REGCACHE_MAPLE, 1075 1075 .volatile_reg = bq2515x_volatile_register, 1076 1076 }; 1077 1077 ··· 1102 1102 i2c_set_clientdata(client, bq2515x); 1103 1103 1104 1104 charger_cfg.drv_data = bq2515x; 1105 - charger_cfg.of_node = dev->of_node; 1105 + charger_cfg.fwnode = dev_fwnode(dev); 1106 1106 1107 1107 ret = bq2515x_read_properties(bq2515x); 1108 1108 if (ret) {
+1 -1
drivers/power/supply/bq256xx_charger.c
··· 1657 1657 int ret = 0; 1658 1658 1659 1659 psy_cfg->drv_data = bq; 1660 - psy_cfg->of_node = dev->of_node; 1660 + psy_cfg->fwnode = dev_fwnode(dev); 1661 1661 1662 1662 ret = device_property_read_u32(bq->dev, "ti,watchdog-timeout-ms", 1663 1663 &bq->watchdog_timer);
+1 -1
drivers/power/supply/bq25890_charger.c
··· 164 164 .val_bits = 8, 165 165 166 166 .max_register = 0x14, 167 - .cache_type = REGCACHE_RBTREE, 167 + .cache_type = REGCACHE_MAPLE, 168 168 169 169 .wr_table = &bq25890_writeable_regs, 170 170 .volatile_table = &bq25890_volatile_regs,
+4 -4
drivers/power/supply/bq25980_charger.c
··· 932 932 .max_register = BQ25980_CHRGR_CTRL_6, 933 933 .reg_defaults = bq25980_reg_defs, 934 934 .num_reg_defaults = ARRAY_SIZE(bq25980_reg_defs), 935 - .cache_type = REGCACHE_RBTREE, 935 + .cache_type = REGCACHE_MAPLE, 936 936 .volatile_reg = bq25980_is_volatile_reg, 937 937 }; 938 938 ··· 943 943 .max_register = BQ25980_CHRGR_CTRL_6, 944 944 .reg_defaults = bq25975_reg_defs, 945 945 .num_reg_defaults = ARRAY_SIZE(bq25975_reg_defs), 946 - .cache_type = REGCACHE_RBTREE, 946 + .cache_type = REGCACHE_MAPLE, 947 947 .volatile_reg = bq25980_is_volatile_reg, 948 948 }; 949 949 ··· 954 954 .max_register = BQ25980_CHRGR_CTRL_6, 955 955 .reg_defaults = bq25960_reg_defs, 956 956 .num_reg_defaults = ARRAY_SIZE(bq25960_reg_defs), 957 - .cache_type = REGCACHE_RBTREE, 957 + .cache_type = REGCACHE_MAPLE, 958 958 .volatile_reg = bq25980_is_volatile_reg, 959 959 }; 960 960 ··· 1057 1057 struct device *dev) 1058 1058 { 1059 1059 struct power_supply_config psy_cfg = { .drv_data = bq, 1060 - .of_node = dev->of_node, }; 1060 + .fwnode = dev_fwnode(dev), }; 1061 1061 1062 1062 psy_cfg.supplied_to = bq25980_charger_supplied_to; 1063 1063 psy_cfg.num_supplicants = ARRAY_SIZE(bq25980_charger_supplied_to);
+38 -2
drivers/power/supply/bq27xxx_battery.c
··· 124 124 BQ27XXX_DM_DATA, /* Block Data */ 125 125 BQ27XXX_DM_CKSUM, /* Block Data Checksum */ 126 126 BQ27XXX_REG_SEDVF, /* End-of-discharge Voltage */ 127 + BQ27XXX_REG_PKCFG, /* Pack Configuration */ 127 128 BQ27XXX_REG_MAX, /* sentinel */ 128 129 }; 129 130 ··· 162 161 [BQ27XXX_DM_DATA] = INVALID_REG_ADDR, 163 162 [BQ27XXX_DM_CKSUM] = INVALID_REG_ADDR, 164 163 [BQ27XXX_REG_SEDVF] = 0x77, 164 + [BQ27XXX_REG_PKCFG] = 0x7C, 165 165 }, 166 166 bq27010_regs[BQ27XXX_REG_MAX] = { 167 167 [BQ27XXX_REG_CTRL] = 0x00, ··· 189 187 [BQ27XXX_DM_DATA] = INVALID_REG_ADDR, 190 188 [BQ27XXX_DM_CKSUM] = INVALID_REG_ADDR, 191 189 [BQ27XXX_REG_SEDVF] = 0x77, 190 + [BQ27XXX_REG_PKCFG] = 0x7C, 192 191 }, 193 192 bq2750x_regs[BQ27XXX_REG_MAX] = { 194 193 [BQ27XXX_REG_CTRL] = 0x00, ··· 586 583 POWER_SUPPLY_PROP_HEALTH, 587 584 POWER_SUPPLY_PROP_MANUFACTURER, 588 585 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 586 + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, 589 587 }; 590 588 591 589 static enum power_supply_property bq27010_props[] = { ··· 608 604 POWER_SUPPLY_PROP_HEALTH, 609 605 POWER_SUPPLY_PROP_MANUFACTURER, 610 606 POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 607 + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, 611 608 }; 612 609 613 610 #define bq2750x_props bq27510g3_props ··· 1923 1918 cache.flags = -1; /* read error */ 1924 1919 if (cache.flags >= 0) { 1925 1920 cache.capacity = bq27xxx_battery_read_soc(di); 1926 - di->cache.flags = cache.flags; 1927 1921 1928 1922 /* 1929 1923 * On gauges with signed current reporting the current must be ··· 2049 2045 } 2050 2046 2051 2047 /* 2048 + * Return the design maximum battery Voltage in microvolts, or < 0 if something 2049 + * fails. The programmed value of the maximum battery voltage is determined by 2050 + * QV0 and QV1 (bits 5 and 6) in the Pack Configuration register. 2051 + */ 2052 + static int bq27xxx_battery_read_dmax_volt(struct bq27xxx_device_info *di, 2053 + union power_supply_propval *val) 2054 + { 2055 + int reg_val, qv; 2056 + 2057 + if (di->voltage_max_design > 0) { 2058 + val->intval = di->voltage_max_design; 2059 + return 0; 2060 + } 2061 + 2062 + reg_val = bq27xxx_read(di, BQ27XXX_REG_PKCFG, true); 2063 + if (reg_val < 0) { 2064 + dev_err(di->dev, "error reading design max voltage\n"); 2065 + return reg_val; 2066 + } 2067 + 2068 + qv = (reg_val >> 5) & 0x3; 2069 + val->intval = 3968000 + 48000 * qv; 2070 + 2071 + di->voltage_max_design = val->intval; 2072 + 2073 + return 0; 2074 + } 2075 + 2076 + /* 2052 2077 * Return the design minimum battery Voltage in microvolts 2053 2078 * Or < 0 if something fails. 2054 2079 */ ··· 2191 2158 case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: 2192 2159 ret = bq27xxx_battery_read_dmin_volt(di, val); 2193 2160 break; 2161 + case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: 2162 + ret = bq27xxx_battery_read_dmax_volt(di, val); 2163 + break; 2194 2164 case POWER_SUPPLY_PROP_CYCLE_COUNT: 2195 2165 ret = bq27xxx_battery_read_cyct(di, val); 2196 2166 break; ··· 2235 2199 { 2236 2200 struct power_supply_desc *psy_desc; 2237 2201 struct power_supply_config psy_cfg = { 2238 - .of_node = di->dev->of_node, 2202 + .fwnode = dev_fwnode(di->dev), 2239 2203 .drv_data = di, 2240 2204 .no_wakeup_source = true, 2241 2205 };
+1 -1
drivers/power/supply/cpcap-battery.c
··· 1130 1130 if (error) 1131 1131 return error; 1132 1132 1133 - psy_cfg.of_node = pdev->dev.of_node; 1133 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 1134 1134 psy_cfg.drv_data = ddata; 1135 1135 1136 1136 ddata->psy = devm_power_supply_register(ddata->dev,
+1 -1
drivers/power/supply/cpcap-charger.c
··· 902 902 903 903 atomic_set(&ddata->active, 1); 904 904 905 - psy_cfg.of_node = pdev->dev.of_node; 905 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 906 906 psy_cfg.drv_data = ddata; 907 907 psy_cfg.supplied_to = cpcap_charger_supplied_to; 908 908 psy_cfg.num_supplicants = ARRAY_SIZE(cpcap_charger_supplied_to);
+1 -51
drivers/power/supply/ds2760_battery.c
··· 112 112 struct power_supply_desc bat_desc; 113 113 struct workqueue_struct *monitor_wqueue; 114 114 struct delayed_work monitor_work; 115 - struct delayed_work set_charged_work; 116 115 struct notifier_block pm_notifier; 117 116 }; 118 117 ··· 488 489 } 489 490 490 491 491 - static void ds2760_battery_set_charged_work(struct work_struct *work) 492 - { 493 - char bias; 494 - struct ds2760_device_info *di = container_of(work, 495 - struct ds2760_device_info, set_charged_work.work); 496 - 497 - dev_dbg(di->dev, "%s\n", __func__); 498 - 499 - ds2760_battery_read_status(di); 500 - 501 - /* When we get notified by external circuitry that the battery is 502 - * considered fully charged now, we know that there is no current 503 - * flow any more. However, the ds2760's internal current meter is 504 - * too inaccurate to rely on - spec say something ~15% failure. 505 - * Hence, we use the current offset bias register to compensate 506 - * that error. 507 - */ 508 - 509 - if (!power_supply_am_i_supplied(di->bat)) 510 - return; 511 - 512 - bias = (signed char) di->current_raw + 513 - (signed char) di->raw[DS2760_CURRENT_OFFSET_BIAS]; 514 - 515 - dev_dbg(di->dev, "%s: bias = %d\n", __func__, bias); 516 - 517 - w1_ds2760_write(di->dev, &bias, DS2760_CURRENT_OFFSET_BIAS, 1); 518 - w1_ds2760_store_eeprom(di->dev, DS2760_EEPROM_BLOCK1); 519 - w1_ds2760_recall_eeprom(di->dev, DS2760_EEPROM_BLOCK1); 520 - 521 - /* Write to the di->raw[] buffer directly - the CURRENT_OFFSET_BIAS 522 - * value won't be read back by ds2760_battery_read_status() */ 523 - di->raw[DS2760_CURRENT_OFFSET_BIAS] = bias; 524 - } 525 - 526 - static void ds2760_battery_set_charged(struct power_supply *psy) 527 - { 528 - struct ds2760_device_info *di = power_supply_get_drvdata(psy); 529 - 530 - /* postpone the actual work by 20 secs. This is for debouncing GPIO 531 - * signals and to let the current value settle. See AN4188. */ 532 - mod_delayed_work(di->monitor_wqueue, &di->set_charged_work, HZ * 20); 533 - } 534 - 535 492 static int ds2760_battery_get_property(struct power_supply *psy, 536 493 enum power_supply_property psp, 537 494 union power_supply_propval *val) ··· 647 692 di->bat_desc.set_property = ds2760_battery_set_property; 648 693 di->bat_desc.property_is_writeable = 649 694 ds2760_battery_property_is_writeable; 650 - di->bat_desc.set_charged = ds2760_battery_set_charged; 651 695 di->bat_desc.external_power_changed = 652 696 ds2760_battery_external_power_changed; 653 697 654 698 psy_cfg.drv_data = di; 699 + psy_cfg.fwnode = dev_fwnode(dev); 655 700 656 701 if (dev->of_node) { 657 702 u32 tmp; 658 - 659 - psy_cfg.of_node = dev->of_node; 660 703 661 704 if (!of_property_read_bool(dev->of_node, "maxim,pmod-enabled")) 662 705 pmod_enabled = true; ··· 700 747 } 701 748 702 749 INIT_DELAYED_WORK(&di->monitor_work, ds2760_battery_work); 703 - INIT_DELAYED_WORK(&di->set_charged_work, 704 - ds2760_battery_set_charged_work); 705 750 di->monitor_wqueue = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); 706 751 if (!di->monitor_wqueue) { 707 752 retval = -ESRCH; ··· 725 774 726 775 unregister_pm_notifier(&di->pm_notifier); 727 776 cancel_delayed_work_sync(&di->monitor_work); 728 - cancel_delayed_work_sync(&di->set_charged_work); 729 777 destroy_workqueue(di->monitor_wqueue); 730 778 } 731 779
+1 -1
drivers/power/supply/generic-adc-battery.c
··· 166 166 if (!adc_bat) 167 167 return -ENOMEM; 168 168 169 - psy_cfg.of_node = pdev->dev.of_node; 169 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 170 170 psy_cfg.drv_data = adc_bat; 171 171 psy_desc = &adc_bat->psy_desc; 172 172 psy_desc->name = dev_name(&pdev->dev);
+1 -1
drivers/power/supply/gpio-charger.c
··· 333 333 charger_desc->property_is_writeable = 334 334 gpio_charger_property_is_writeable; 335 335 336 - psy_cfg.of_node = dev->of_node; 336 + psy_cfg.fwnode = dev_fwnode(dev); 337 337 psy_cfg.drv_data = gpio_charger; 338 338 339 339 if (pdata) {
+1 -1
drivers/power/supply/ingenic-battery.c
··· 146 146 desc->num_properties = ARRAY_SIZE(ingenic_battery_properties); 147 147 desc->get_property = ingenic_battery_get_property; 148 148 psy_cfg.drv_data = bat; 149 - psy_cfg.of_node = dev->of_node; 149 + psy_cfg.fwnode = dev_fwnode(dev); 150 150 151 151 bat->battery = devm_power_supply_register(dev, desc, &psy_cfg); 152 152 if (IS_ERR(bat->battery))
+1 -1
drivers/power/supply/ip5xxx_power.c
··· 848 848 fields = (const struct ip5xxx_regfield_config *)of_id->data; 849 849 ip5xxx_setup_regs(dev, ip5xxx, fields); 850 850 851 - psy_cfg.of_node = dev->of_node; 851 + psy_cfg.fwnode = dev_fwnode(dev); 852 852 psy_cfg.drv_data = ip5xxx; 853 853 854 854 psy = devm_power_supply_register(dev, &ip5xxx_battery_desc, &psy_cfg);
+2 -1
drivers/power/supply/lego_ev3_battery.c
··· 23 23 #include <linux/mod_devicetable.h> 24 24 #include <linux/platform_device.h> 25 25 #include <linux/power_supply.h> 26 + #include <linux/property.h> 26 27 27 28 struct lego_ev3_battery { 28 29 struct iio_channel *iio_v; ··· 199 198 batt->v_min = 48000000; 200 199 } 201 200 202 - psy_cfg.of_node = pdev->dev.of_node; 201 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 203 202 psy_cfg.drv_data = batt; 204 203 205 204 batt->psy = devm_power_supply_register(dev, &lego_ev3_battery_desc,
+1 -1
drivers/power/supply/lt3651-charger.c
··· 131 131 charger_desc->properties = lt3651_charger_properties; 132 132 charger_desc->num_properties = ARRAY_SIZE(lt3651_charger_properties); 133 133 charger_desc->get_property = lt3651_charger_get_property; 134 - psy_cfg.of_node = pdev->dev.of_node; 134 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 135 135 psy_cfg.drv_data = lt3651_charger; 136 136 137 137 lt3651_charger->charger = devm_power_supply_register(&pdev->dev,
+2 -2
drivers/power/supply/ltc4162-l-charger.c
··· 1119 1119 .writeable_reg = ltc4162l_is_writeable_reg, 1120 1120 .volatile_reg = ltc4162l_is_volatile_reg, 1121 1121 .max_register = LTC4162L_INPUT_UNDERVOLTAGE_DAC, 1122 - .cache_type = REGCACHE_RBTREE, 1122 + .cache_type = REGCACHE_MAPLE, 1123 1123 }; 1124 1124 1125 1125 static void ltc4162l_clear_interrupts(struct ltc4162l_info *info) ··· 1185 1185 if (!device_property_read_u32(dev, "lltc,cell-count", &value)) 1186 1186 info->cell_count = value; 1187 1187 1188 - ltc4162l_config.of_node = dev->of_node; 1188 + ltc4162l_config.fwnode = dev_fwnode(dev); 1189 1189 ltc4162l_config.drv_data = info; 1190 1190 ltc4162l_config.attr_grp = ltc4162l_attr_groups; 1191 1191
+1 -1
drivers/power/supply/max17042_battery.c
··· 1066 1066 1067 1067 dev_set_drvdata(dev, chip); 1068 1068 psy_cfg.drv_data = chip; 1069 - psy_cfg.of_node = dev->of_node; 1069 + psy_cfg.fwnode = dev_fwnode(dev); 1070 1070 1071 1071 /* When current is not measured, 1072 1072 * CURRENT_NOW and CURRENT_AVG properties should be invisible. */
+49 -2
drivers/power/supply/max1720x_battery.c
··· 29 29 /* ModelGauge m5 */ 30 30 #define MAX172XX_STATUS 0x00 /* Status */ 31 31 #define MAX172XX_STATUS_BAT_ABSENT BIT(3) /* Battery absent */ 32 + #define MAX172XX_STATUS_IMX BIT(6) /* Maximum Current Alert Threshold Exceeded */ 33 + #define MAX172XX_STATUS_VMN BIT(8) /* Minimum Voltage Alert Threshold Exceeded */ 34 + #define MAX172XX_STATUS_TMN BIT(9) /* Minimum Temperature Alert Threshold Exceeded */ 35 + #define MAX172XX_STATUS_VMX BIT(12) /* Maximum Voltage Alert Threshold Exceeded */ 36 + #define MAX172XX_STATUS_TMX BIT(13) /* Maximum Temperature Alert Threshold Exceeded */ 32 37 #define MAX172XX_REPCAP 0x05 /* Average capacity */ 33 38 #define MAX172XX_REPSOC 0x06 /* Percentage of charge */ 34 39 #define MAX172XX_TEMP 0x08 /* Temperature */ ··· 119 114 .val_format_endian = REGMAP_ENDIAN_LITTLE, 120 115 .rd_table = &max1720x_readable_regs, 121 116 .volatile_table = &max1720x_volatile_regs, 122 - .cache_type = REGCACHE_RBTREE, 117 + .cache_type = REGCACHE_MAPLE, 123 118 }; 124 119 125 120 static const struct regmap_range max1720x_nvmem_allow[] = { ··· 255 250 }; 256 251 257 252 static const enum power_supply_property max1720x_battery_props[] = { 253 + POWER_SUPPLY_PROP_HEALTH, 258 254 POWER_SUPPLY_PROP_PRESENT, 259 255 POWER_SUPPLY_PROP_CAPACITY, 260 256 POWER_SUPPLY_PROP_VOLTAGE_NOW, ··· 308 302 /* 309 303 * Calculating current registers resolution: 310 304 * 311 - * RSense stored in 10^-5 Ohm, so mesaurment voltage must be 305 + * RSense stored in 10^-5 Ohm, so measurement voltage must be 312 306 * in 10^-11 Volts for get current in uA. 313 307 * 16 bit current reg fullscale +/-51.2mV is 102400 uV. 314 308 * So: 102400 / 65535 * 10^5 = 156252 ··· 320 314 return val * 156252; 321 315 } 322 316 317 + static int max172xx_battery_health(struct max1720x_device_info *info, 318 + unsigned int *health) 319 + { 320 + unsigned int status; 321 + int ret; 322 + 323 + ret = regmap_read(info->regmap, MAX172XX_STATUS, &status); 324 + if (ret < 0) 325 + return ret; 326 + 327 + if (status & MAX172XX_STATUS_VMN) 328 + *health = POWER_SUPPLY_HEALTH_DEAD; 329 + else if (status & MAX172XX_STATUS_VMX) 330 + *health = POWER_SUPPLY_HEALTH_OVERVOLTAGE; 331 + else if (status & MAX172XX_STATUS_TMN) 332 + *health = POWER_SUPPLY_HEALTH_COLD; 333 + else if (status & MAX172XX_STATUS_TMX) 334 + *health = POWER_SUPPLY_HEALTH_OVERHEAT; 335 + else if (status & MAX172XX_STATUS_IMX) 336 + *health = POWER_SUPPLY_HEALTH_OVERCURRENT; 337 + else 338 + *health = POWER_SUPPLY_HEALTH_GOOD; 339 + 340 + /* Clear events which are not self-clearing to detect next events */ 341 + if (status > 0 && status != MAX172XX_STATUS_IMX) { 342 + ret = regmap_set_bits(info->regmap, MAX172XX_STATUS, 343 + MAX172XX_STATUS_VMN | 344 + MAX172XX_STATUS_VMX | 345 + MAX172XX_STATUS_TMN | 346 + MAX172XX_STATUS_TMX); 347 + if (ret < 0) 348 + return ret; 349 + } 350 + 351 + return 0; 352 + } 353 + 323 354 static int max1720x_battery_get_property(struct power_supply *psy, 324 355 enum power_supply_property psp, 325 356 union power_supply_propval *val) ··· 366 323 int ret = 0; 367 324 368 325 switch (psp) { 326 + case POWER_SUPPLY_PROP_HEALTH: 327 + ret = max172xx_battery_health(info, &reg_val); 328 + val->intval = reg_val; 329 + break; 369 330 case POWER_SUPPLY_PROP_PRESENT: 370 331 /* 371 332 * POWER_SUPPLY_PROP_PRESENT will always readable via
+1 -1
drivers/power/supply/max77650-charger.c
··· 298 298 299 299 chg->dev = dev; 300 300 301 - pscfg.of_node = dev->of_node; 301 + pscfg.fwnode = dev_fwnode(dev); 302 302 pscfg.drv_data = chg; 303 303 304 304 chg_irq = platform_get_irq_byname(pdev, "CHG");
+1 -1
drivers/power/supply/max77693_charger.c
··· 608 608 case 4700000: 609 609 case 4800000: 610 610 case 4900000: 611 - data = (uvolt - 4700000) / 100000; 611 + data = ((uvolt - 4700000) / 100000) + 1; 612 612 break; 613 613 default: 614 614 dev_err(chg->dev, "Wrong value for charge input voltage regulation threshold\n");
+1 -1
drivers/power/supply/max8903_charger.c
··· 349 349 data->psy_desc.properties = max8903_charger_props; 350 350 data->psy_desc.num_properties = ARRAY_SIZE(max8903_charger_props); 351 351 352 - psy_cfg.of_node = dev->of_node; 352 + psy_cfg.fwnode = dev_fwnode(dev); 353 353 psy_cfg.drv_data = data; 354 354 355 355 data->psy = devm_power_supply_register(dev, &data->psy_desc, &psy_cfg);
+1 -1
drivers/power/supply/mm8013.c
··· 274 274 return dev_err_probe(dev, ret, "MM8013 not found\n"); 275 275 276 276 psy_cfg.drv_data = chip; 277 - psy_cfg.of_node = dev->of_node; 277 + psy_cfg.fwnode = dev_fwnode(dev); 278 278 279 279 psy = devm_power_supply_register(dev, &mm8013_desc, &psy_cfg); 280 280 if (IS_ERR(psy))
+1 -1
drivers/power/supply/mt6360_charger.c
··· 810 810 memcpy(&mci->psy_desc, &mt6360_charger_desc, sizeof(mci->psy_desc)); 811 811 mci->psy_desc.name = dev_name(&pdev->dev); 812 812 charger_cfg.drv_data = mci; 813 - charger_cfg.of_node = pdev->dev.of_node; 813 + charger_cfg.fwnode = dev_fwnode(&pdev->dev); 814 814 mci->psy = devm_power_supply_register(&pdev->dev, 815 815 &mci->psy_desc, &charger_cfg); 816 816 if (IS_ERR(mci->psy))
+1 -2
drivers/power/supply/mt6370-charger.c
··· 752 752 { 753 753 struct power_supply_config cfg = { 754 754 .drv_data = priv, 755 - .of_node = dev_of_node(priv->dev), 755 + .fwnode = dev_fwnode(priv->dev), 756 756 }; 757 757 758 758 priv->psy = devm_power_supply_register(priv->dev, &mt6370_chg_psy_desc, ··· 772 772 { 773 773 struct workqueue_struct *wq = data; 774 774 775 - flush_workqueue(wq); 776 775 destroy_workqueue(wq); 777 776 } 778 777
+2 -2
drivers/power/supply/olpc_battery.c
··· 674 674 675 675 /* Ignore the status. It doesn't actually matter */ 676 676 677 - ac_psy_cfg.of_node = pdev->dev.of_node; 677 + ac_psy_cfg.fwnode = dev_fwnode(&pdev->dev); 678 678 ac_psy_cfg.drv_data = data; 679 679 680 680 data->olpc_ac = devm_power_supply_register(&pdev->dev, &olpc_ac_desc, ··· 692 692 olpc_bat_desc.num_properties = ARRAY_SIZE(olpc_xo1_bat_props); 693 693 } 694 694 695 - bat_psy_cfg.of_node = pdev->dev.of_node; 695 + bat_psy_cfg.fwnode = dev_fwnode(&pdev->dev); 696 696 bat_psy_cfg.drv_data = data; 697 697 bat_psy_cfg.attr_grp = olpc_bat_sysfs_groups; 698 698
-466
drivers/power/supply/pcf50633-charger.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* NXP PCF50633 Main Battery Charger Driver 3 - * 4 - * (C) 2006-2008 by Openmoko, Inc. 5 - * Author: Balaji Rao <balajirrao@openmoko.org> 6 - * All rights reserved. 7 - * 8 - * Broken down from monstrous PCF50633 driver mainly by 9 - * Harald Welte, Andy Green and Werner Almesberger 10 - */ 11 - 12 - #include <linux/kernel.h> 13 - #include <linux/module.h> 14 - #include <linux/slab.h> 15 - #include <linux/init.h> 16 - #include <linux/types.h> 17 - #include <linux/device.h> 18 - #include <linux/sysfs.h> 19 - #include <linux/platform_device.h> 20 - #include <linux/power_supply.h> 21 - 22 - #include <linux/mfd/pcf50633/core.h> 23 - #include <linux/mfd/pcf50633/mbc.h> 24 - 25 - struct pcf50633_mbc { 26 - struct pcf50633 *pcf; 27 - 28 - int adapter_online; 29 - int usb_online; 30 - 31 - struct power_supply *usb; 32 - struct power_supply *adapter; 33 - struct power_supply *ac; 34 - }; 35 - 36 - int pcf50633_mbc_usb_curlim_set(struct pcf50633 *pcf, int ma) 37 - { 38 - struct pcf50633_mbc *mbc = platform_get_drvdata(pcf->mbc_pdev); 39 - int ret = 0; 40 - u8 bits; 41 - u8 mbcs2, chgmod; 42 - unsigned int mbcc5; 43 - 44 - if (ma >= 1000) { 45 - bits = PCF50633_MBCC7_USB_1000mA; 46 - ma = 1000; 47 - } else if (ma >= 500) { 48 - bits = PCF50633_MBCC7_USB_500mA; 49 - ma = 500; 50 - } else if (ma >= 100) { 51 - bits = PCF50633_MBCC7_USB_100mA; 52 - ma = 100; 53 - } else { 54 - bits = PCF50633_MBCC7_USB_SUSPEND; 55 - ma = 0; 56 - } 57 - 58 - ret = pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_MBCC7, 59 - PCF50633_MBCC7_USB_MASK, bits); 60 - if (ret) 61 - dev_err(pcf->dev, "error setting usb curlim to %d mA\n", ma); 62 - else 63 - dev_info(pcf->dev, "usb curlim to %d mA\n", ma); 64 - 65 - /* 66 - * We limit the charging current to be the USB current limit. 67 - * The reason is that on pcf50633, when it enters PMU Standby mode, 68 - * which it does when the device goes "off", the USB current limit 69 - * reverts to the variant default. In at least one common case, that 70 - * default is 500mA. By setting the charging current to be the same 71 - * as the USB limit we set here before PMU standby, we enforce it only 72 - * using the correct amount of current even when the USB current limit 73 - * gets reset to the wrong thing 74 - */ 75 - 76 - if (mbc->pcf->pdata->charger_reference_current_ma) { 77 - mbcc5 = (ma << 8) / mbc->pcf->pdata->charger_reference_current_ma; 78 - if (mbcc5 > 255) 79 - mbcc5 = 255; 80 - pcf50633_reg_write(mbc->pcf, PCF50633_REG_MBCC5, mbcc5); 81 - } 82 - 83 - mbcs2 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2); 84 - chgmod = (mbcs2 & PCF50633_MBCS2_MBC_MASK); 85 - 86 - /* If chgmod == BATFULL, setting chgena has no effect. 87 - * Datasheet says we need to set resume instead but when autoresume is 88 - * used resume doesn't work. Clear and set chgena instead. 89 - */ 90 - if (chgmod != PCF50633_MBCS2_MBC_BAT_FULL) 91 - pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_MBCC1, 92 - PCF50633_MBCC1_CHGENA, PCF50633_MBCC1_CHGENA); 93 - else { 94 - pcf50633_reg_clear_bits(pcf, PCF50633_REG_MBCC1, 95 - PCF50633_MBCC1_CHGENA); 96 - pcf50633_reg_set_bit_mask(pcf, PCF50633_REG_MBCC1, 97 - PCF50633_MBCC1_CHGENA, PCF50633_MBCC1_CHGENA); 98 - } 99 - 100 - power_supply_changed(mbc->usb); 101 - 102 - return ret; 103 - } 104 - EXPORT_SYMBOL_GPL(pcf50633_mbc_usb_curlim_set); 105 - 106 - int pcf50633_mbc_get_status(struct pcf50633 *pcf) 107 - { 108 - struct pcf50633_mbc *mbc = platform_get_drvdata(pcf->mbc_pdev); 109 - int status = 0; 110 - u8 chgmod; 111 - 112 - if (!mbc) 113 - return 0; 114 - 115 - chgmod = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2) 116 - & PCF50633_MBCS2_MBC_MASK; 117 - 118 - if (mbc->usb_online) 119 - status |= PCF50633_MBC_USB_ONLINE; 120 - if (chgmod == PCF50633_MBCS2_MBC_USB_PRE || 121 - chgmod == PCF50633_MBCS2_MBC_USB_PRE_WAIT || 122 - chgmod == PCF50633_MBCS2_MBC_USB_FAST || 123 - chgmod == PCF50633_MBCS2_MBC_USB_FAST_WAIT) 124 - status |= PCF50633_MBC_USB_ACTIVE; 125 - if (mbc->adapter_online) 126 - status |= PCF50633_MBC_ADAPTER_ONLINE; 127 - if (chgmod == PCF50633_MBCS2_MBC_ADP_PRE || 128 - chgmod == PCF50633_MBCS2_MBC_ADP_PRE_WAIT || 129 - chgmod == PCF50633_MBCS2_MBC_ADP_FAST || 130 - chgmod == PCF50633_MBCS2_MBC_ADP_FAST_WAIT) 131 - status |= PCF50633_MBC_ADAPTER_ACTIVE; 132 - 133 - return status; 134 - } 135 - EXPORT_SYMBOL_GPL(pcf50633_mbc_get_status); 136 - 137 - int pcf50633_mbc_get_usb_online_status(struct pcf50633 *pcf) 138 - { 139 - struct pcf50633_mbc *mbc = platform_get_drvdata(pcf->mbc_pdev); 140 - 141 - if (!mbc) 142 - return 0; 143 - 144 - return mbc->usb_online; 145 - } 146 - EXPORT_SYMBOL_GPL(pcf50633_mbc_get_usb_online_status); 147 - 148 - static ssize_t 149 - show_chgmode(struct device *dev, struct device_attribute *attr, char *buf) 150 - { 151 - struct pcf50633_mbc *mbc = dev_get_drvdata(dev); 152 - 153 - u8 mbcs2 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS2); 154 - u8 chgmod = (mbcs2 & PCF50633_MBCS2_MBC_MASK); 155 - 156 - return sysfs_emit(buf, "%d\n", chgmod); 157 - } 158 - static DEVICE_ATTR(chgmode, S_IRUGO, show_chgmode, NULL); 159 - 160 - static ssize_t 161 - show_usblim(struct device *dev, struct device_attribute *attr, char *buf) 162 - { 163 - struct pcf50633_mbc *mbc = dev_get_drvdata(dev); 164 - u8 usblim = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC7) & 165 - PCF50633_MBCC7_USB_MASK; 166 - unsigned int ma; 167 - 168 - if (usblim == PCF50633_MBCC7_USB_1000mA) 169 - ma = 1000; 170 - else if (usblim == PCF50633_MBCC7_USB_500mA) 171 - ma = 500; 172 - else if (usblim == PCF50633_MBCC7_USB_100mA) 173 - ma = 100; 174 - else 175 - ma = 0; 176 - 177 - return sysfs_emit(buf, "%u\n", ma); 178 - } 179 - 180 - static ssize_t set_usblim(struct device *dev, 181 - struct device_attribute *attr, const char *buf, size_t count) 182 - { 183 - struct pcf50633_mbc *mbc = dev_get_drvdata(dev); 184 - unsigned long ma; 185 - int ret; 186 - 187 - ret = kstrtoul(buf, 10, &ma); 188 - if (ret) 189 - return ret; 190 - 191 - pcf50633_mbc_usb_curlim_set(mbc->pcf, ma); 192 - 193 - return count; 194 - } 195 - 196 - static DEVICE_ATTR(usb_curlim, S_IRUGO | S_IWUSR, show_usblim, set_usblim); 197 - 198 - static ssize_t 199 - show_chglim(struct device *dev, struct device_attribute *attr, char *buf) 200 - { 201 - struct pcf50633_mbc *mbc = dev_get_drvdata(dev); 202 - u8 mbcc5 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC5); 203 - unsigned int ma; 204 - 205 - if (!mbc->pcf->pdata->charger_reference_current_ma) 206 - return -ENODEV; 207 - 208 - ma = (mbc->pcf->pdata->charger_reference_current_ma * mbcc5) >> 8; 209 - 210 - return sysfs_emit(buf, "%u\n", ma); 211 - } 212 - 213 - static ssize_t set_chglim(struct device *dev, 214 - struct device_attribute *attr, const char *buf, size_t count) 215 - { 216 - struct pcf50633_mbc *mbc = dev_get_drvdata(dev); 217 - unsigned long ma; 218 - unsigned int mbcc5; 219 - int ret; 220 - 221 - if (!mbc->pcf->pdata->charger_reference_current_ma) 222 - return -ENODEV; 223 - 224 - ret = kstrtoul(buf, 10, &ma); 225 - if (ret) 226 - return ret; 227 - 228 - mbcc5 = (ma << 8) / mbc->pcf->pdata->charger_reference_current_ma; 229 - if (mbcc5 > 255) 230 - mbcc5 = 255; 231 - pcf50633_reg_write(mbc->pcf, PCF50633_REG_MBCC5, mbcc5); 232 - 233 - return count; 234 - } 235 - 236 - /* 237 - * This attribute allows to change MBC charging limit on the fly 238 - * independently of usb current limit. It also gets set automatically every 239 - * time usb current limit is changed. 240 - */ 241 - static DEVICE_ATTR(chg_curlim, S_IRUGO | S_IWUSR, show_chglim, set_chglim); 242 - 243 - static struct attribute *pcf50633_mbc_sysfs_attrs[] = { 244 - &dev_attr_chgmode.attr, 245 - &dev_attr_usb_curlim.attr, 246 - &dev_attr_chg_curlim.attr, 247 - NULL, 248 - }; 249 - 250 - ATTRIBUTE_GROUPS(pcf50633_mbc_sysfs); 251 - 252 - static void 253 - pcf50633_mbc_irq_handler(int irq, void *data) 254 - { 255 - struct pcf50633_mbc *mbc = data; 256 - 257 - /* USB */ 258 - if (irq == PCF50633_IRQ_USBINS) { 259 - mbc->usb_online = 1; 260 - } else if (irq == PCF50633_IRQ_USBREM) { 261 - mbc->usb_online = 0; 262 - pcf50633_mbc_usb_curlim_set(mbc->pcf, 0); 263 - } 264 - 265 - /* Adapter */ 266 - if (irq == PCF50633_IRQ_ADPINS) 267 - mbc->adapter_online = 1; 268 - else if (irq == PCF50633_IRQ_ADPREM) 269 - mbc->adapter_online = 0; 270 - 271 - power_supply_changed(mbc->ac); 272 - power_supply_changed(mbc->usb); 273 - power_supply_changed(mbc->adapter); 274 - 275 - if (mbc->pcf->pdata->mbc_event_callback) 276 - mbc->pcf->pdata->mbc_event_callback(mbc->pcf, irq); 277 - } 278 - 279 - static int adapter_get_property(struct power_supply *psy, 280 - enum power_supply_property psp, 281 - union power_supply_propval *val) 282 - { 283 - struct pcf50633_mbc *mbc = power_supply_get_drvdata(psy); 284 - int ret = 0; 285 - 286 - switch (psp) { 287 - case POWER_SUPPLY_PROP_ONLINE: 288 - val->intval = mbc->adapter_online; 289 - break; 290 - default: 291 - ret = -EINVAL; 292 - break; 293 - } 294 - return ret; 295 - } 296 - 297 - static int usb_get_property(struct power_supply *psy, 298 - enum power_supply_property psp, 299 - union power_supply_propval *val) 300 - { 301 - struct pcf50633_mbc *mbc = power_supply_get_drvdata(psy); 302 - int ret = 0; 303 - u8 usblim = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC7) & 304 - PCF50633_MBCC7_USB_MASK; 305 - 306 - switch (psp) { 307 - case POWER_SUPPLY_PROP_ONLINE: 308 - val->intval = mbc->usb_online && 309 - (usblim <= PCF50633_MBCC7_USB_500mA); 310 - break; 311 - default: 312 - ret = -EINVAL; 313 - break; 314 - } 315 - return ret; 316 - } 317 - 318 - static int ac_get_property(struct power_supply *psy, 319 - enum power_supply_property psp, 320 - union power_supply_propval *val) 321 - { 322 - struct pcf50633_mbc *mbc = power_supply_get_drvdata(psy); 323 - int ret = 0; 324 - u8 usblim = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCC7) & 325 - PCF50633_MBCC7_USB_MASK; 326 - 327 - switch (psp) { 328 - case POWER_SUPPLY_PROP_ONLINE: 329 - val->intval = mbc->usb_online && 330 - (usblim == PCF50633_MBCC7_USB_1000mA); 331 - break; 332 - default: 333 - ret = -EINVAL; 334 - break; 335 - } 336 - return ret; 337 - } 338 - 339 - static enum power_supply_property power_props[] = { 340 - POWER_SUPPLY_PROP_ONLINE, 341 - }; 342 - 343 - static const u8 mbc_irq_handlers[] = { 344 - PCF50633_IRQ_ADPINS, 345 - PCF50633_IRQ_ADPREM, 346 - PCF50633_IRQ_USBINS, 347 - PCF50633_IRQ_USBREM, 348 - PCF50633_IRQ_BATFULL, 349 - PCF50633_IRQ_CHGHALT, 350 - PCF50633_IRQ_THLIMON, 351 - PCF50633_IRQ_THLIMOFF, 352 - PCF50633_IRQ_USBLIMON, 353 - PCF50633_IRQ_USBLIMOFF, 354 - PCF50633_IRQ_LOWSYS, 355 - PCF50633_IRQ_LOWBAT, 356 - }; 357 - 358 - static const struct power_supply_desc pcf50633_mbc_adapter_desc = { 359 - .name = "adapter", 360 - .type = POWER_SUPPLY_TYPE_MAINS, 361 - .properties = power_props, 362 - .num_properties = ARRAY_SIZE(power_props), 363 - .get_property = &adapter_get_property, 364 - }; 365 - 366 - static const struct power_supply_desc pcf50633_mbc_usb_desc = { 367 - .name = "usb", 368 - .type = POWER_SUPPLY_TYPE_USB, 369 - .properties = power_props, 370 - .num_properties = ARRAY_SIZE(power_props), 371 - .get_property = usb_get_property, 372 - }; 373 - 374 - static const struct power_supply_desc pcf50633_mbc_ac_desc = { 375 - .name = "ac", 376 - .type = POWER_SUPPLY_TYPE_MAINS, 377 - .properties = power_props, 378 - .num_properties = ARRAY_SIZE(power_props), 379 - .get_property = ac_get_property, 380 - }; 381 - 382 - static int pcf50633_mbc_probe(struct platform_device *pdev) 383 - { 384 - struct power_supply_config psy_cfg = {}; 385 - struct power_supply_config usb_psy_cfg; 386 - struct pcf50633_mbc *mbc; 387 - int i; 388 - u8 mbcs1; 389 - 390 - mbc = devm_kzalloc(&pdev->dev, sizeof(*mbc), GFP_KERNEL); 391 - if (!mbc) 392 - return -ENOMEM; 393 - 394 - platform_set_drvdata(pdev, mbc); 395 - mbc->pcf = dev_to_pcf50633(pdev->dev.parent); 396 - 397 - /* Set up IRQ handlers */ 398 - for (i = 0; i < ARRAY_SIZE(mbc_irq_handlers); i++) 399 - pcf50633_register_irq(mbc->pcf, mbc_irq_handlers[i], 400 - pcf50633_mbc_irq_handler, mbc); 401 - 402 - psy_cfg.supplied_to = mbc->pcf->pdata->batteries; 403 - psy_cfg.num_supplicants = mbc->pcf->pdata->num_batteries; 404 - psy_cfg.drv_data = mbc; 405 - 406 - /* Create power supplies */ 407 - mbc->adapter = devm_power_supply_register(&pdev->dev, 408 - &pcf50633_mbc_adapter_desc, 409 - &psy_cfg); 410 - if (IS_ERR(mbc->adapter)) { 411 - dev_err(mbc->pcf->dev, "failed to register adapter\n"); 412 - return PTR_ERR(mbc->adapter); 413 - } 414 - 415 - usb_psy_cfg = psy_cfg; 416 - usb_psy_cfg.attr_grp = pcf50633_mbc_sysfs_groups; 417 - 418 - mbc->usb = devm_power_supply_register(&pdev->dev, 419 - &pcf50633_mbc_usb_desc, 420 - &usb_psy_cfg); 421 - if (IS_ERR(mbc->usb)) { 422 - dev_err(mbc->pcf->dev, "failed to register usb\n"); 423 - return PTR_ERR(mbc->usb); 424 - } 425 - 426 - mbc->ac = devm_power_supply_register(&pdev->dev, 427 - &pcf50633_mbc_ac_desc, 428 - &psy_cfg); 429 - if (IS_ERR(mbc->ac)) { 430 - dev_err(mbc->pcf->dev, "failed to register ac\n"); 431 - return PTR_ERR(mbc->ac); 432 - } 433 - 434 - mbcs1 = pcf50633_reg_read(mbc->pcf, PCF50633_REG_MBCS1); 435 - if (mbcs1 & PCF50633_MBCS1_USBPRES) 436 - pcf50633_mbc_irq_handler(PCF50633_IRQ_USBINS, mbc); 437 - if (mbcs1 & PCF50633_MBCS1_ADAPTPRES) 438 - pcf50633_mbc_irq_handler(PCF50633_IRQ_ADPINS, mbc); 439 - 440 - return 0; 441 - } 442 - 443 - static void pcf50633_mbc_remove(struct platform_device *pdev) 444 - { 445 - struct pcf50633_mbc *mbc = platform_get_drvdata(pdev); 446 - int i; 447 - 448 - /* Remove IRQ handlers */ 449 - for (i = 0; i < ARRAY_SIZE(mbc_irq_handlers); i++) 450 - pcf50633_free_irq(mbc->pcf, mbc_irq_handlers[i]); 451 - } 452 - 453 - static struct platform_driver pcf50633_mbc_driver = { 454 - .driver = { 455 - .name = "pcf50633-mbc", 456 - }, 457 - .probe = pcf50633_mbc_probe, 458 - .remove = pcf50633_mbc_remove, 459 - }; 460 - 461 - module_platform_driver(pcf50633_mbc_driver); 462 - 463 - MODULE_AUTHOR("Balaji Rao <balajirrao@openmoko.org>"); 464 - MODULE_DESCRIPTION("PCF50633 mbc driver"); 465 - MODULE_LICENSE("GPL"); 466 - MODULE_ALIAS("platform:pcf50633-mbc");
+1 -1
drivers/power/supply/pm8916_bms_vm.c
··· 210 210 bat->vbat_now = bat->last_ocv; 211 211 212 212 psy_cfg.drv_data = bat; 213 - psy_cfg.of_node = dev->of_node; 213 + psy_cfg.fwnode = dev_fwnode(dev); 214 214 215 215 bat->battery = devm_power_supply_register(dev, &pm8916_bms_vm_battery_psy_desc, &psy_cfg); 216 216 if (IS_ERR(bat->battery))
+1 -1
drivers/power/supply/pm8916_lbc.c
··· 322 322 dev_err_probe(dev, ret, "Error while parsing device tree\n"); 323 323 324 324 psy_cfg.drv_data = chg; 325 - psy_cfg.of_node = dev->of_node; 325 + psy_cfg.fwnode = dev_fwnode(dev); 326 326 327 327 chg->charger = devm_power_supply_register(dev, &pm8916_lbc_charger_psy_desc, &psy_cfg); 328 328 if (IS_ERR(chg->charger))
+8 -22
drivers/power/supply/power_supply_core.c
··· 200 200 int i = 0; 201 201 202 202 do { 203 - np = of_parse_phandle(psy->of_node, "power-supplies", i++); 203 + np = of_parse_phandle(psy->dev.of_node, "power-supplies", i++); 204 204 if (!np) 205 205 break; 206 206 207 - if (np == epsy->of_node) { 207 + if (np == epsy->dev.of_node) { 208 208 dev_dbg(&psy->dev, "%s: Found supply : %s\n", 209 209 psy->desc->name, epsy->desc->name); 210 210 psy->supplied_from[i-1] = (char *)epsy->desc->name; ··· 235 235 struct device_node *np = data; 236 236 237 237 /* returning non-zero breaks out of power_supply_for_each_psy loop */ 238 - if (epsy->of_node == np) 238 + if (epsy->dev.of_node == np) 239 239 return 1; 240 240 241 241 return 0; ··· 270 270 return 0; 271 271 272 272 /* No device node found, nothing to do */ 273 - if (!psy->of_node) 273 + if (!psy->dev.of_node) 274 274 return 0; 275 275 276 276 do { 277 277 int ret; 278 278 279 - np = of_parse_phandle(psy->of_node, "power-supplies", cnt++); 279 + np = of_parse_phandle(psy->dev.of_node, "power-supplies", cnt++); 280 280 if (!np) 281 281 break; 282 282 ··· 449 449 } 450 450 EXPORT_SYMBOL_GPL(power_supply_get_property_from_supplier); 451 451 452 - int power_supply_set_battery_charged(struct power_supply *psy) 453 - { 454 - if (atomic_read(&psy->use_cnt) >= 0 && 455 - psy->desc->type == POWER_SUPPLY_TYPE_BATTERY && 456 - psy->desc->set_charged) { 457 - psy->desc->set_charged(psy); 458 - return 0; 459 - } 460 - 461 - return -EINVAL; 462 - } 463 - EXPORT_SYMBOL_GPL(power_supply_set_battery_charged); 464 - 465 452 static int power_supply_match_device_by_name(struct device *dev, const void *data) 466 453 { 467 454 const char *name = data; ··· 593 606 const __be32 *list; 594 607 u32 min_max[2]; 595 608 596 - if (psy->of_node) { 597 - battery_np = of_parse_phandle(psy->of_node, "monitored-battery", 0); 609 + if (psy->dev.of_node) { 610 + battery_np = of_parse_phandle(psy->dev.of_node, "monitored-battery", 0); 598 611 if (!battery_np) 599 612 return -ENODEV; 600 613 ··· 1531 1544 if (cfg) { 1532 1545 dev->groups = cfg->attr_grp; 1533 1546 psy->drv_data = cfg->drv_data; 1534 - psy->of_node = 1547 + dev->of_node = 1535 1548 cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node; 1536 - dev->of_node = psy->of_node; 1537 1549 psy->supplied_to = cfg->supplied_to; 1538 1550 psy->num_supplicants = cfg->num_supplicants; 1539 1551 }
+3 -2
drivers/power/supply/qcom_battmgr.c
··· 8 8 #include <linux/mutex.h> 9 9 #include <linux/of_device.h> 10 10 #include <linux/power_supply.h> 11 + #include <linux/property.h> 11 12 #include <linux/soc/qcom/pdr.h> 12 13 #include <linux/soc/qcom/pmic_glink.h> 13 14 #include <linux/math.h> ··· 1337 1336 battmgr->dev = dev; 1338 1337 1339 1338 psy_cfg.drv_data = battmgr; 1340 - psy_cfg.of_node = adev->dev.of_node; 1339 + psy_cfg.fwnode = dev_fwnode(&adev->dev); 1341 1340 1342 1341 psy_cfg_supply.drv_data = battmgr; 1343 - psy_cfg_supply.of_node = adev->dev.of_node; 1342 + psy_cfg_supply.fwnode = dev_fwnode(&adev->dev); 1344 1343 psy_cfg_supply.supplied_to = qcom_battmgr_battery; 1345 1344 psy_cfg_supply.num_supplicants = 1; 1346 1345
+1 -1
drivers/power/supply/qcom_pmi8998_charger.c
··· 964 964 return rc; 965 965 966 966 supply_config.drv_data = chip; 967 - supply_config.of_node = pdev->dev.of_node; 967 + supply_config.fwnode = dev_fwnode(&pdev->dev); 968 968 969 969 desc = devm_kzalloc(chip->dev, sizeof(smb2_psy_desc), GFP_KERNEL); 970 970 if (!desc)
+1 -1
drivers/power/supply/qcom_smbb.c
··· 880 880 } 881 881 882 882 bat_cfg.drv_data = chg; 883 - bat_cfg.of_node = pdev->dev.of_node; 883 + bat_cfg.fwnode = dev_fwnode(&pdev->dev); 884 884 chg->bat_psy = devm_power_supply_register(&pdev->dev, 885 885 &bat_psy_desc, 886 886 &bat_cfg);
+1 -1
drivers/power/supply/rk817_charger.c
··· 1088 1088 rk817_bat_calib_vol(charger); 1089 1089 1090 1090 pscfg.drv_data = charger; 1091 - pscfg.of_node = node; 1091 + pscfg.fwnode = node ? &node->fwnode : NULL; 1092 1092 1093 1093 /* 1094 1094 * Get sample resistor value. Note only values of 10000 or 20000
+1 -1
drivers/power/supply/rt5033_battery.c
··· 160 160 } 161 161 162 162 i2c_set_clientdata(client, battery); 163 - psy_cfg.of_node = client->dev.of_node; 163 + psy_cfg.fwnode = dev_fwnode(&client->dev); 164 164 psy_cfg.drv_data = battery; 165 165 166 166 battery->psy = devm_power_supply_register(&client->dev,
+2 -1
drivers/power/supply/rt5033_charger.c
··· 16 16 #include <linux/power_supply.h> 17 17 #include <linux/regmap.h> 18 18 #include <linux/mfd/rt5033-private.h> 19 + #include <linux/property.h> 19 20 20 21 struct rt5033_charger_data { 21 22 unsigned int pre_uamp; ··· 676 675 charger->regmap = dev_get_regmap(pdev->dev.parent, NULL); 677 676 mutex_init(&charger->lock); 678 677 679 - psy_cfg.of_node = pdev->dev.of_node; 678 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 680 679 psy_cfg.drv_data = charger; 681 680 682 681 charger->psy = devm_power_supply_register(charger->dev,
+2 -2
drivers/power/supply/rt9455_charger.c
··· 1579 1579 .writeable_reg = rt9455_is_writeable_reg, 1580 1580 .volatile_reg = rt9455_is_volatile_reg, 1581 1581 .max_register = RT9455_REG_MASK3, 1582 - .cache_type = REGCACHE_RBTREE, 1582 + .cache_type = REGCACHE_MAPLE, 1583 1583 }; 1584 1584 1585 1585 static int rt9455_probe(struct i2c_client *client) ··· 1658 1658 INIT_DEFERRABLE_WORK(&info->batt_presence_work, 1659 1659 rt9455_batt_presence_work_callback); 1660 1660 1661 - rt9455_charger_config.of_node = dev->of_node; 1661 + rt9455_charger_config.fwnode = dev_fwnode(dev); 1662 1662 rt9455_charger_config.drv_data = info; 1663 1663 rt9455_charger_config.supplied_to = rt9455_charger_supplied_to; 1664 1664 rt9455_charger_config.num_supplicants =
+1 -1
drivers/power/supply/rt9467-charger.c
··· 826 826 { 827 827 struct power_supply_config cfg = { 828 828 .drv_data = data, 829 - .of_node = dev_of_node(data->dev), 829 + .fwnode = dev_fwnode(data->dev), 830 830 .attr_grp = rt9467_sysfs_groups, 831 831 }; 832 832
+1 -1
drivers/power/supply/rt9471.c
··· 723 723 char *psy_name; 724 724 725 725 cfg.drv_data = chip; 726 - cfg.of_node = dev->of_node; 726 + cfg.fwnode = dev_fwnode(dev); 727 727 cfg.attr_grp = rt9471_sysfs_groups; 728 728 729 729 psy_name = devm_kasprintf(dev, GFP_KERNEL, "rt9471-%s", dev_name(dev));
+1 -1
drivers/power/supply/sbs-battery.c
··· 1138 1138 1139 1139 chip->flags = (uintptr_t)i2c_get_match_data(client); 1140 1140 chip->client = client; 1141 - psy_cfg.of_node = client->dev.of_node; 1141 + psy_cfg.fwnode = dev_fwnode(&client->dev); 1142 1142 psy_cfg.drv_data = chip; 1143 1143 chip->last_state = POWER_SUPPLY_STATUS_UNKNOWN; 1144 1144 sbs_invalidate_cached_props(chip);
+1 -1
drivers/power/supply/sbs-charger.c
··· 173 173 return -ENOMEM; 174 174 175 175 chip->client = client; 176 - psy_cfg.of_node = client->dev.of_node; 176 + psy_cfg.fwnode = dev_fwnode(&client->dev); 177 177 psy_cfg.drv_data = chip; 178 178 179 179 i2c_set_clientdata(client, chip);
+1 -1
drivers/power/supply/sbs-manager.c
··· 379 379 return ret; 380 380 381 381 psy_cfg.drv_data = data; 382 - psy_cfg.of_node = dev->of_node; 382 + psy_cfg.fwnode = dev_fwnode(dev); 383 383 data->psy = devm_power_supply_register(dev, psy_desc, &psy_cfg); 384 384 if (IS_ERR(data->psy)) 385 385 return dev_err_probe(dev, PTR_ERR(data->psy),
+1 -1
drivers/power/supply/sc2731_charger.c
··· 480 480 } 481 481 482 482 charger_cfg.drv_data = info; 483 - charger_cfg.of_node = np; 483 + charger_cfg.fwnode = dev_fwnode(&pdev->dev); 484 484 info->psy_usb = devm_power_supply_register(&pdev->dev, 485 485 &sc2731_charger_desc, 486 486 &charger_cfg);
+3 -5
drivers/power/supply/sc27xx_fuel_gauge.c
··· 1014 1014 if (!table) 1015 1015 return -EINVAL; 1016 1016 1017 - data->cap_table = devm_kmemdup(data->dev, table, 1018 - data->table_len * sizeof(*table), 1019 - GFP_KERNEL); 1017 + data->cap_table = devm_kmemdup_array(data->dev, table, data->table_len, 1018 + sizeof(*table), GFP_KERNEL); 1020 1019 if (!data->cap_table) { 1021 1020 power_supply_put_battery_info(data->battery, info); 1022 1021 return -ENOMEM; ··· 1140 1141 static int sc27xx_fgu_probe(struct platform_device *pdev) 1141 1142 { 1142 1143 struct device *dev = &pdev->dev; 1143 - struct device_node *np = dev->of_node; 1144 1144 struct power_supply_config fgu_cfg = { }; 1145 1145 struct sc27xx_fgu_data *data; 1146 1146 int ret, irq; ··· 1203 1205 platform_set_drvdata(pdev, data); 1204 1206 1205 1207 fgu_cfg.drv_data = data; 1206 - fgu_cfg.of_node = np; 1208 + fgu_cfg.fwnode = dev_fwnode(dev); 1207 1209 data->battery = devm_power_supply_register(dev, &sc27xx_fgu_desc, 1208 1210 &fgu_cfg); 1209 1211 if (IS_ERR(data->battery)) {
+2 -2
drivers/power/supply/smb347-charger.c
··· 1488 1488 .max_register = SMB347_MAX_REGISTER, 1489 1489 .volatile_reg = smb347_volatile_reg, 1490 1490 .readable_reg = smb347_readable_reg, 1491 - .cache_type = REGCACHE_RBTREE, 1491 + .cache_type = REGCACHE_MAPLE, 1492 1492 }; 1493 1493 1494 1494 static const struct regulator_ops smb347_usb_vbus_regulator_ops = { ··· 1553 1553 return PTR_ERR(smb->regmap); 1554 1554 1555 1555 mains_usb_cfg.drv_data = smb; 1556 - mains_usb_cfg.of_node = dev->of_node; 1556 + mains_usb_cfg.fwnode = dev_fwnode(dev); 1557 1557 if (smb->use_mains) { 1558 1558 smb->mains = devm_power_supply_register(dev, &smb347_mains_desc, 1559 1559 &mains_usb_cfg);
+1 -1
drivers/power/supply/tps65090-charger.c
··· 259 259 260 260 psy_cfg.supplied_to = pdata->supplied_to; 261 261 psy_cfg.num_supplicants = pdata->num_supplicants; 262 - psy_cfg.of_node = pdev->dev.of_node; 262 + psy_cfg.fwnode = dev_fwnode(&pdev->dev); 263 263 psy_cfg.drv_data = cdata; 264 264 265 265 cdata->ac = devm_power_supply_register(&pdev->dev, &tps65090_charger_desc,
+1 -1
drivers/power/supply/tps65217_charger.c
··· 198 198 charger->tps = tps; 199 199 charger->dev = &pdev->dev; 200 200 201 - cfg.of_node = pdev->dev.of_node; 201 + cfg.fwnode = dev_fwnode(&pdev->dev); 202 202 cfg.drv_data = charger; 203 203 204 204 charger->psy = devm_power_supply_register(&pdev->dev,
+1 -1
drivers/power/supply/ucs1002_power.c
··· 560 560 irq_a_det = of_irq_get_byname(dev->of_node, "a_det"); 561 561 irq_alert = of_irq_get_byname(dev->of_node, "alert"); 562 562 563 - charger_config.of_node = dev->of_node; 563 + charger_config.fwnode = dev_fwnode(dev); 564 564 charger_config.drv_data = info; 565 565 566 566 ret = regmap_read(info->regmap, UCS1002_REG_PRODUCT_ID, &regval);
+1
include/linux/power/bq27xxx_battery.h
··· 62 62 struct bq27xxx_reg_cache cache; 63 63 int charge_design_full; 64 64 int voltage_min_design; 65 + int voltage_max_design; 65 66 bool removed; 66 67 unsigned long last_update; 67 68 union power_supply_propval last_status;
-3
include/linux/power_supply.h
··· 274 274 int (*property_is_writeable)(struct power_supply *psy, 275 275 enum power_supply_property psp); 276 276 void (*external_power_changed)(struct power_supply *psy); 277 - void (*set_charged)(struct power_supply *psy); 278 277 279 278 /* 280 279 * Set if thermal zone should not be created for this power supply. ··· 315 316 316 317 char **supplied_from; 317 318 size_t num_supplies; 318 - struct device_node *of_node; 319 319 320 320 /* Driver private data */ 321 321 void *drv_data; ··· 850 852 int power_supply_get_property_from_supplier(struct power_supply *psy, 851 853 enum power_supply_property psp, 852 854 union power_supply_propval *val); 853 - extern int power_supply_set_battery_charged(struct power_supply *psy); 854 855 855 856 static inline bool 856 857 power_supply_supports_maintenance_charging(struct power_supply_battery_info *info)