Commit b220f311 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply

Pull power supply and reset updates from Sebastian Reichel:

 - bq25890: add charge voltage/current support

 - bd99954: convert to linear range

 - convert all i2c drivers to use probe_new

 - misc fixes and cleanups

* tag 'for-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (51 commits)
  power: supply: fix null pointer dereferencing in power_supply_get_battery_info
  power: supply: bq25890: Fix usb-notifier probe and remove races
  power: supply: bq25890: Ensure pump_express_work is cancelled on remove
  power: supply: Fix refcount leak in rk817_charger_probe
  power: supply: bq25890: Only use pdata->regulator_init_data for vbus
  power: supply: ab8500: Fix error handling in ab8500_charger_init()
  power: supply: cw2015: Fix potential null-ptr-deref in cw_bat_probe()
  power: supply: z2_battery: Fix possible memleak in z2_batt_probe()
  power: supply: z2_battery: Convert to i2c's .probe_new()
  power: supply: ucs1002: Convert to i2c's .probe_new()
  power: supply: smb347: Convert to i2c's .probe_new()
  power: supply: sbs-manager: Convert to i2c's .probe_new()
  power: supply: sbs: Convert to i2c's .probe_new()
  power: supply: rt9455: Convert to i2c's .probe_new()
  power: supply: rt5033_battery: Convert to i2c's .probe_new()
  power: supply: max17042_battery: Convert to i2c's .probe_new()
  power: supply: max17040: Convert to i2c's .probe_new()
  power: supply: max14656: Convert to i2c's .probe_new()
  power: supply: ltc4162-l: Convert to i2c's .probe_new()
  power: supply: ltc2941: Convert to i2c's .probe_new()
  ...
parents b611996e 104bb8a6
......@@ -13,6 +13,8 @@ description: |
maintainers:
- Dmitry Osipenko <digetx@gmail.com>
$ref: /schemas/power/supply/power-supply.yaml
properties:
compatible:
items:
......@@ -22,15 +24,13 @@ properties:
reg:
maxItems: 1
monitored-battery: true
power-supplies: true
system-power-controller: true
required:
- compatible
- reg
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -124,6 +124,8 @@ properties:
The child node for the charger to hold additional properties. If a
battery is not in use, this node can be omitted.
type: object
$ref: /schemas/power/supply/power-supply.yaml
properties:
monitored-battery:
description: |
......
......@@ -25,6 +25,9 @@ description: >
inactive-delay, the GPIO is driven active again. After a delay specified by wait-delay, the
restart handler completes allowing other restart handlers to be attempted.
allOf:
- $ref: restart-handler.yaml#
properties:
compatible:
const: gpio-restart
......@@ -41,16 +44,6 @@ properties:
in its inactive state.
priority:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
A priority ranging from 0 to 255 (default 129) according to the following guidelines:
0: Restart handler of last resort, with limited restart capabilities.
128: Default restart handler; use if no other restart handler is expected to be available,
and/or if restart functionality is sufficient to restart the entire system.
255: Highest priority restart handler, will preempt all other restart handlers.
minimum: 0
maximum: 255
default: 129
active-delay:
......
# SPDX-License-Identifier: GPL-2.0-only or BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/reset/restart-handler.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Restart and shutdown handler generic binding
maintainers:
- Sebastian Reichel <sre@kernel.org>
description:
Restart and shutdown handler device is responsible for powering off the
system, e.g. my cutting off the power. System might have several restart
handlers, which usually are tried from most precise to last resort.
properties:
priority:
$ref: /schemas/types.yaml#/definitions/uint32
description: |
A priority ranging from 0 to 255 according to the following guidelines::
0:: Restart handler of last resort, with limited restart capabilities.
128:: Typical, default restart handler; use if no other restart handler
is expected to be available, and/or if restart functionality is
sufficient to restart the entire system.
255:: Highest priority restart handler, will preempt all other restart handlers.
minimum: 0
maximum: 255
additionalProperties: true
......@@ -15,11 +15,15 @@ allOf:
properties:
compatible:
enum:
- ti,bq25890
- ti,bq25892
- ti,bq25895
- ti,bq25896
oneOf:
- enum:
- ti,bq25890
- items:
- enum:
- ti,bq25892
- ti,bq25895
- ti,bq25896
- const: ti,bq25890
reg:
maxItems: 1
......@@ -93,7 +97,7 @@ required:
- ti,boost-voltage
- ti,boost-max-current
additionalProperties: false
unevaluatedProperties: false
examples:
- |
......
......@@ -60,13 +60,11 @@ properties:
monitored-battery:
description: |
phandle of battery characteristics node.
The fuel gauge uses the following battery properties:
- energy-full-design-microwatt-hours
- charge-full-design-microamp-hours
- voltage-min-design-microvolt
Both or neither of the *-full-design-*-hours properties must be set.
See Documentation/devicetree/bindings/power/supply/battery.yaml
power-supplies: true
......
......@@ -10,6 +10,8 @@ title: Ingenic JZ47xx battery bindings
maintainers:
- Artur Rojek <contact@artur-rojek.eu>
$ref: power-supply.yaml#
properties:
compatible:
oneOf:
......@@ -28,8 +30,6 @@ properties:
monitored-battery:
description: >
phandle to a "simple-battery" compatible node.
This property must be a phandle to a node using the format described
in battery.yaml, with the following properties being required:
- voltage-min-design-microvolt: drained battery voltage,
......
......@@ -59,6 +59,8 @@ properties:
Voltage threshold to report battery as over voltage (in mV).
Default is not to report over-voltage events.
power-supplies: true
required:
- compatible
- reg
......
......@@ -18,4 +18,10 @@ properties:
This property is added to a supply in order to list the devices which
supply it power, referenced by their phandles.
monitored-battery:
$ref: /schemas/types.yaml#/definitions/phandle
description:
The battery (with "simple-battery" compatible) being monitored by this
power supply.
additionalProperties: true
......@@ -18,6 +18,7 @@ description: |
provides a Dual-source Battery Charger, two port BC1.2 detection and a
Battery Monitor.
$ref: power-supply.yaml#
properties:
compatible:
......
......@@ -28,7 +28,6 @@ properties:
The charger uses the following battery properties
- charge-term-current-microamp: current for charge termination phase.
- constant-charge-voltage-max-microvolt: maximum constant input voltage.
See Documentation/devicetree/bindings/power/supply/battery.yaml
additionalProperties: false
......
......@@ -690,8 +690,7 @@ static int pm860x_charger_probe(struct platform_device *pdev)
(chip->id == CHIP_PM8607) ? chip->companion : chip->client;
if (!info->i2c_8606) {
dev_err(&pdev->dev, "Missed I2C address of 88PM8606!\n");
ret = -EINVAL;
goto out;
return -EINVAL;
}
info->dev = &pdev->dev;
......@@ -704,44 +703,26 @@ static int pm860x_charger_probe(struct platform_device *pdev)
psy_cfg.drv_data = info;
psy_cfg.supplied_to = pm860x_supplied_to;
psy_cfg.num_supplicants = ARRAY_SIZE(pm860x_supplied_to);
info->usb = power_supply_register(&pdev->dev, &pm860x_charger_desc,
&psy_cfg);
info->usb = devm_power_supply_register(&pdev->dev, &pm860x_charger_desc,
&psy_cfg);
if (IS_ERR(info->usb)) {
ret = PTR_ERR(info->usb);
goto out;
return PTR_ERR(info->usb);
}
pm860x_init_charger(info);
for (i = 0; i < ARRAY_SIZE(info->irq); i++) {
ret = request_threaded_irq(info->irq[i], NULL,
pm860x_irq_descs[i].handler,
IRQF_ONESHOT, pm860x_irq_descs[i].name, info);
ret = devm_request_threaded_irq(&pdev->dev, info->irq[i], NULL,
pm860x_irq_descs[i].handler,
IRQF_ONESHOT,
pm860x_irq_descs[i].name, info);
if (ret < 0) {
dev_err(chip->dev, "Failed to request IRQ: #%d: %d\n",
info->irq[i], ret);
goto out_irq;
return ret;
}
}
return 0;
out_irq:
power_supply_unregister(info->usb);
while (--i >= 0)
free_irq(info->irq[i], info);
out:
return ret;
}
static int pm860x_charger_remove(struct platform_device *pdev)
{
struct pm860x_charger_info *info = platform_get_drvdata(pdev);
int i;
power_supply_unregister(info->usb);
for (i = 0; i < info->irq_nums; i++)
free_irq(info->irq[i], info);
return 0;
}
static struct platform_driver pm860x_charger_driver = {
......@@ -749,7 +730,6 @@ static struct platform_driver pm860x_charger_driver = {
.name = "88pm860x-charger",
},
.probe = pm860x_charger_probe,
.remove = pm860x_charger_remove,
};
module_platform_driver(pm860x_charger_driver);
......
......@@ -1940,7 +1940,7 @@ static int ab8500_charger_get_ext_psy_data(struct device *dev, void *data)
*
* Due to a asic bug it is necessary to lower the input current to the vbus
* charger when charging with at some specific levels. This issue is only valid
* for below a certain battery voltage. This function makes sure that the
* for below a certain battery voltage. This function makes sure that
* the allowed current limit isn't exceeded.
*/
static void ab8500_charger_check_vbat_work(struct work_struct *work)
......@@ -3719,7 +3719,14 @@ static int __init ab8500_charger_init(void)
if (ret)
return ret;
return platform_driver_register(&ab8500_charger_driver);
ret = platform_driver_register(&ab8500_charger_driver);
if (ret) {
platform_unregister_drivers(ab8500_charger_component_drivers,
ARRAY_SIZE(ab8500_charger_component_drivers));
return ret;
}
return 0;
}
static void __exit ab8500_charger_exit(void)
......
......@@ -694,8 +694,7 @@ static const struct power_supply_desc adp5061_desc = {
.num_properties = ARRAY_SIZE(adp5061_props),
};
static int adp5061_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int adp5061_probe(struct i2c_client *client)
{
struct power_supply_config psy_cfg = {};
struct adp5061_state *st;
......@@ -737,7 +736,7 @@ static struct i2c_driver adp5061_driver = {
.driver = {
.name = KBUILD_MODNAME,
},
.probe = adp5061_probe,
.probe_new = adp5061_probe,
.id_table = adp5061_id,
};
module_i2c_driver(adp5061_driver);
......
......@@ -768,27 +768,13 @@ static const struct power_supply_desc bd9995x_power_supply_desc = {
* Describe the setting in linear_range table.
*/
static const struct linear_range input_current_limit_ranges[] = {
{
.min = 0,
.step = 32000,
.min_sel = 0x0,
.max_sel = 0x1ff,
},
LINEAR_RANGE(0, 0x0, 0x1ff, 32000),
};
/* Possible trickle, pre-charging and termination current values */
static const struct linear_range charging_current_ranges[] = {
{
.min = 0,
.step = 64000,
.min_sel = 0x0,
.max_sel = 0x10,
}, {
.min = 1024000,
.step = 0,
.min_sel = 0x11,
.max_sel = 0x1f,
},
LINEAR_RANGE(0, 0x0, 0x10, 64000),
LINEAR_RANGE(1024000, 0x11, 0x1f, 0),
};
/*
......@@ -796,72 +782,28 @@ static const struct linear_range charging_current_ranges[] = {
* and battery over voltage protection have same possible values
*/
static const struct linear_range charge_voltage_regulation_ranges[] = {
{
.min = 2560000,
.step = 0,
.min_sel = 0,
.max_sel = 0xA0,
}, {
.min = 2560000,
.step = 16000,
.min_sel = 0xA0,
.max_sel = 0x4B0,
}, {
.min = 19200000,
.step = 0,
.min_sel = 0x4B0,
.max_sel = 0x7FF,
},
LINEAR_RANGE(2560000, 0, 0xA0, 0),
LINEAR_RANGE(2560000, 0xA0, 0x4B0, 16000),
LINEAR_RANGE(19200000, 0x4B0, 0x7FF, 0),
};
/* Possible VSYS voltage regulation values */
static const struct linear_range vsys_voltage_regulation_ranges[] = {
{
.min = 2560000,
.step = 0,
.min_sel = 0,
.max_sel = 0x28,
}, {
.min = 2560000,
.step = 64000,
.min_sel = 0x28,
.max_sel = 0x12C,
}, {
.min = 19200000,
.step = 0,
.min_sel = 0x12C,
.max_sel = 0x1FF,
},
LINEAR_RANGE(2560000, 0, 0x28, 0),
LINEAR_RANGE(2560000, 0x28, 0x12C, 64000),
LINEAR_RANGE(19200000, 0x12C, 0x1FF, 0),
};
/* Possible settings for switching from trickle to pre-charging limits */
static const struct linear_range trickle_to_pre_threshold_ranges[] = {
{
.min = 2048000,
.step = 0,
.min_sel = 0,
.max_sel = 0x20,
}, {
.min = 2048000,
.step = 64000,
.min_sel = 0x20,
.max_sel = 0x12C,
}, {
.min = 19200000,
.step = 0,
.min_sel = 0x12C,
.max_sel = 0x1FF
}
LINEAR_RANGE(2048000, 0, 0x20, 0),
LINEAR_RANGE(2048000, 0x20, 0x12C, 64000),
LINEAR_RANGE(19200000, 0x12C, 0x1FF, 0),
};
/* Possible current values for fast-charging constant current phase */
static const struct linear_range fast_charge_current_ranges[] = {
{
.min = 0,
.step = 64000,
.min_sel = 0,
.max_sel = 0xFF,
}
LINEAR_RANGE(0, 0, 0xFF, 64000),
};
struct battery_init {
......
......@@ -1520,9 +1520,9 @@ static int bq2415x_power_supply_init(struct bq2415x_device *bq)
}
/* main bq2415x probe function */
static int bq2415x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq2415x_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
int ret;
int num;
char *name = NULL;
......@@ -1780,7 +1780,7 @@ static struct i2c_driver bq2415x_driver = {
.of_match_table = of_match_ptr(bq2415x_of_match_table),
.acpi_match_table = ACPI_PTR(bq2415x_i2c_acpi_match),
},
.probe = bq2415x_probe,
.probe_new = bq2415x_probe,
.remove = bq2415x_remove,
.id_table = bq2415x_i2c_id_table,
};
......
......@@ -1767,9 +1767,9 @@ static int bq24190_get_config(struct bq24190_dev_info *bdi)
return 0;
}
static int bq24190_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq24190_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct i2c_adapter *adapter = client->adapter;
struct device *dev = &client->dev;
struct power_supply_config charger_cfg = {}, battery_cfg = {};
......@@ -2032,7 +2032,7 @@ static const struct of_device_id bq24190_of_match[] = {
MODULE_DEVICE_TABLE(of, bq24190_of_match);
static struct i2c_driver bq24190_driver = {
.probe = bq24190_probe,
.probe_new = bq24190_probe,
.remove = bq24190_remove,
.shutdown = bq24190_shutdown,
.id_table = bq24190_i2c_ids,
......
......@@ -947,9 +947,9 @@ static int bq24257_fw_probe(struct bq24257_device *bq)
return 0;
}
static int bq24257_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq24257_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct i2c_adapter *adapter = client->adapter;
struct device *dev = &client->dev;
const struct acpi_device_id *acpi_id;
......@@ -1167,7 +1167,7 @@ static struct i2c_driver bq24257_driver = {
.acpi_match_table = ACPI_PTR(bq24257_acpi_match),
.pm = &bq24257_pm,
},
.probe = bq24257_probe,
.probe_new = bq24257_probe,
.remove = bq24257_remove,
.id_table = bq24257_i2c_ids,
};
......
......@@ -352,8 +352,7 @@ static struct bq24735_platform *bq24735_parse_dt_data(struct i2c_client *client)
return pdata;
}
static int bq24735_charger_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq24735_charger_probe(struct i2c_client *client)
{
int ret;
struct bq24735 *charger;
......@@ -506,7 +505,7 @@ static struct i2c_driver bq24735_charger_driver = {
.name = "bq24735-charger",
.of_match_table = bq24735_match_ids,
},
.probe = bq24735_charger_probe,
.probe_new = bq24735_charger_probe,
.id_table = bq24735_charger_id,
};
......
......@@ -1078,9 +1078,9 @@ static const struct regmap_config bq25155_regmap_config = {
.volatile_reg = bq2515x_volatile_register,
};
static int bq2515x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq2515x_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device *dev = &client->dev;
struct bq2515x_device *bq2515x;
struct power_supply_config charger_cfg = {};
......@@ -1158,7 +1158,7 @@ static struct i2c_driver bq2515x_driver = {
.name = "bq2515x-charger",
.of_match_table = bq2515x_of_match,
},
.probe = bq2515x_probe,
.probe_new = bq2515x_probe,
.id_table = bq2515x_i2c_ids,
};
module_i2c_driver(bq2515x_driver);
......
......@@ -1619,9 +1619,9 @@ static int bq256xx_parse_dt(struct bq256xx_device *bq,
return 0;
}
static int bq256xx_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq256xx_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device *dev = &client->dev;
struct bq256xx_device *bq;
struct power_supply_config psy_cfg = { };
......@@ -1744,7 +1744,7 @@ static struct i2c_driver bq256xx_driver = {
.of_match_table = bq256xx_of_match,
.acpi_match_table = bq256xx_acpi_match,
},
.probe = bq256xx_probe,
.probe_new = bq256xx_probe,
.id_table = bq256xx_i2c_ids,
};
module_i2c_driver(bq256xx_driver);
......
This diff is collapsed.
......@@ -1207,9 +1207,9 @@ static int bq25980_parse_dt(struct bq25980_device *bq)
return 0;
}
static int bq25980_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq25980_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct device *dev = &client->dev;
struct bq25980_device *bq;
int ret;
......@@ -1287,7 +1287,7 @@ static struct i2c_driver bq25980_driver = {
.name = "bq25980-charger",
.of_match_table = bq25980_of_match,
},
.probe = bq25980_probe,
.probe_new = bq25980_probe,
.id_table = bq25980_i2c_ids,
};
module_i2c_driver(bq25980_driver);
......
......@@ -136,9 +136,9 @@ static int bq27xxx_battery_i2c_bulk_write(struct bq27xxx_device_info *di,
return 0;
}
static int bq27xxx_battery_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int bq27xxx_battery_i2c_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct bq27xxx_device_info *di;
int ret;
char *name;
......@@ -295,7 +295,7 @@ static struct i2c_driver bq27xxx_battery_i2c_driver = {
.name = "bq27xxx-battery",
.of_match_table = of_match_ptr(bq27xxx_battery_i2c_of_match_table),
},
.probe = bq27xxx_battery_i2c_probe,
.probe_new = bq27xxx_battery_i2c_probe,
.remove = bq27xxx_battery_i2c_remove,
.id_table = bq27xxx_i2c_id_table,
};
......
......@@ -699,6 +699,9 @@ static int cw_bat_probe(struct i2c_client *client)
}
cw_bat->battery_workqueue = create_singlethread_workqueue("rk_battery");
if (!cw_bat->battery_workqueue)
return -ENOMEM;
devm_delayed_work_autocancel(&client->dev,
&cw_bat->battery_delay_work, cw_bat_work);
queue_delayed_work(cw_bat->battery_workqueue,
......
......@@ -368,9 +368,9 @@ static const struct ds278x_battery_ops ds278x_ops[] = {
}
};
static int ds278x_battery_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int ds278x_battery_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct ds278x_platform_data *pdata = client->dev.platform_data;
struct power_supply_config psy_cfg = {};
struct ds278x_info *info;
......@@ -458,7 +458,7 @@ static struct i2c_driver ds278x_battery_driver = {
.name = "ds2782-battery",
.pm = &ds278x_battery_pm_ops,
},
.probe = ds278x_battery_probe,
.probe_new = ds278x_battery_probe,
.remove = ds278x_battery_remove,
.id_table = ds278x_id,
};
......
......@@ -540,7 +540,7 @@ static struct lp8727_platform_data *lp8727_parse_dt(struct device *dev)
}
#endif
static int lp8727_probe(struct i2c_client *cl, const struct i2c_device_id *id)
static int lp8727_probe(struct i2c_client *cl)
{
struct lp8727_chg *pchg;
struct lp8727_platform_data *pdata;
......@@ -615,7 +615,7 @@ static struct i2c_driver lp8727_driver = {
.name = "lp8727",
.of_match_table = of_match_ptr(lp8727_dt_ids),
},
.probe = lp8727_probe,
.probe_new = lp8727_probe,
.remove = lp8727_remove,
.id_table = lp8727_ids,
};
......
......@@ -520,7 +520,7 @@ static int lp8788_set_irqs(struct platform_device *pdev,
static int lp8788_irq_register(struct platform_device *pdev,
struct lp8788_charger *pchg)
{
const char *name[] = {
static const char * const name[] = {
LP8788_CHG_IRQ, LP8788_PRSW_IRQ, LP8788_BATT_IRQ
};
int i;
......
......@@ -439,8 +439,7 @@ static enum power_supply_property ltc294x_properties[] = {
POWER_SUPPLY_PROP_CURRENT_NOW,
};
static int ltc294x_i2c_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int ltc294x_i2c_probe(struct i2c_client *client)
{
struct power_supply_config psy_cfg = {};
struct ltc294x_info *info;
......@@ -636,7 +635,7 @@ static struct i2c_driver ltc294x_driver = {
.of_match_table = ltc294x_i2c_of_match,
.pm = LTC294X_PM_OPS,
},
.probe = ltc294x_i2c_probe,
.probe_new = ltc294x_i2c_probe,
.shutdown = ltc294x_i2c_shutdown,
.id_table = ltc294x_i2c_id,
};
......
......@@ -819,8 +819,7 @@ static void ltc4162l_clear_interrupts(struct ltc4162l_info *info)
regmap_write(info->regmap, LTC4162L_CHARGE_STATUS_ALERTS_REG, 0);
}
static int ltc4162l_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int ltc4162l_probe(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
struct device *dev = &client->dev;
......@@ -916,7 +915,7 @@ static const struct of_device_id ltc4162l_of_match[] = {
MODULE_DEVICE_TABLE(of, ltc4162l_of_match);
static struct i2c_driver ltc4162l_driver = {
.probe = ltc4162l_probe,
.probe_new = ltc4162l_probe,
.alert = ltc4162l_alert,
.id_table = ltc4162l_i2c_id_table,
.driver = {
......
......@@ -234,8 +234,7 @@ static enum power_supply_property max14656_battery_props[] = {
POWER_SUPPLY_PROP_MANUFACTURER,
};
static int max14656_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int max14656_probe(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
struct device *dev = &client->dev;
......@@ -317,7 +316,7 @@ static struct i2c_driver max14656_i2c_driver = {
.name = "max14656",
.of_match_table = max14656_match_table,
},
.probe = max14656_probe,
.probe_new = max14656_probe,
.id_table = max14656_id,
};
module_i2c_driver(max14656_i2c_driver);
......
......@@ -430,9 +430,9 @@ static const struct power_supply_desc max17040_battery_desc = {
.num_properties = ARRAY_SIZE(max17040_battery_props),
};
static int max17040_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int max17040_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct i2c_adapter *adapter = client->adapter;
struct power_supply_config psy_cfg = {};
struct max17040_chip *chip;
......@@ -599,7 +599,7 @@ static struct i2c_driver max17040_i2c_driver = {
.of_match_table = max17040_of_match,
.pm = MAX17040_PM_OPS,
},
.probe = max17040_probe,
.probe_new = max17040_probe,
.id_table = max17040_id,
};
module_i2c_driver(max17040_i2c_driver);
......
......@@ -1031,9 +1031,9 @@ static const struct power_supply_desc max17042_no_current_sense_psy_desc = {
.num_properties = ARRAY_SIZE(max17042_battery_props) - 2,
};
static int max17042_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int max17042_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct i2c_adapter *adapter = client->adapter;
const struct power_supply_desc *max17042_desc = &max17042_psy_desc;
struct power_supply_config psy_cfg = {};
......@@ -1220,7 +1220,7 @@ static struct i2c_driver max17042_i2c_driver = {
.of_match_table = of_match_ptr(max17042_dt_match),
.pm = &max17042_pm_ops,
},
.probe = max17042_probe,
.probe_new = max17042_probe,
.id_table = max17042_id,
};
module_i2c_driver(max17042_i2c_driver);
......
......@@ -113,16 +113,13 @@ enum {
MT6360_RANGE_MAX,
};
#define MT6360_LINEAR_RANGE(idx, _min, _min_sel, _max_sel, _step) \
[idx] = REGULATOR_LINEAR_RANGE(_min, _min_sel, _max_sel, _step)
static const struct linear_range mt6360_chg_range[MT6360_RANGE_MAX] = {
MT6360_LINEAR_RANGE(MT6360_RANGE_VMIVR, 3900000, 0, 0x5F, 100000),
MT6360_LINEAR_RANGE(MT6360_RANGE_ICHG, 100000, 0, 0x31, 100000),
MT6360_LINEAR_RANGE(MT6360_RANGE_VOREG, 3900000, 0, 0x51, 10000),
MT6360_LINEAR_RANGE(MT6360_RANGE_AICR, 100000, 0, 0x3F, 50000),
MT6360_LINEAR_RANGE(MT6360_RANGE_IPREC, 100000, 0, 0x0F, 50000),
MT6360_LINEAR_RANGE(MT6360_RANGE_IEOC, 100000, 0, 0x0F, 50000),
LINEAR_RANGE_IDX(MT6360_RANGE_VMIVR, 3900000, 0, 0x5F, 100000),
LINEAR_RANGE_IDX(MT6360_RANGE_ICHG, 100000, 0, 0x31, 100000),
LINEAR_RANGE_IDX(MT6360_RANGE_VOREG, 3900000, 0, 0x51, 10000),
LINEAR_RANGE_IDX(MT6360_RANGE_AICR, 100000, 0, 0x3F, 50000),
LINEAR_RANGE_IDX(MT6360_RANGE_IPREC, 100000, 0, 0x0F, 50000),
LINEAR_RANGE_IDX(MT6360_RANGE_IEOC, 100000, 0, 0x0F, 50000),
};
struct mt6360_chg_info {
......
......@@ -750,6 +750,11 @@ int power_supply_get_battery_info(struct power_supply *psy,
int i, tab_len, size;
propname = kasprintf(GFP_KERNEL, "ocv-capacity-table-%d", index);
if (!propname) {
power_supply_put_battery_info(psy, info);
err = -ENOMEM;
goto out_put_node;
}
list = of_get_property(battery_np, propname, &size);
if (!list || !size) {
dev_err(&psy->dev, "failed to get %s\n", propname);
......@@ -870,7 +875,6 @@ EXPORT_SYMBOL_GPL(power_supply_temp2resist_simple);
* power_supply_vbat2ri() - find the battery internal resistance
* from the battery voltage
* @info: The battery information container
* @table: Pointer to battery resistance temperature table
* @vbat_uv: The battery voltage in microvolt
* @charging: If we are charging (true) or not (false)
*
......@@ -1387,8 +1391,8 @@ __power_supply_register(struct device *parent,
register_cooler_failed:
psy_unregister_thermal(psy);
register_thermal_failed:
device_del(dev);
wakeup_init_failed:
device_del(dev);
device_add_failed:
check_supplies_failed:
dev_set_name_failed:
......
......@@ -1060,8 +1060,10 @@ static int rk817_charger_probe(struct platform_device *pdev)
return -ENODEV;
charger = devm_kzalloc(&pdev->dev, sizeof(*charger), GFP_KERNEL);
if (!charger)
if (!charger) {
of_node_put(node);
return -ENOMEM;
}
charger->rk808 = rk808;
......
......@@ -112,8 +112,7 @@ static const struct power_supply_desc rt5033_battery_desc = {
.num_properties = ARRAY_SIZE(rt5033_battery_props),
};
static int rt5033_battery_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int rt5033_battery_probe(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
struct power_supply_config psy_cfg = {};
......@@ -173,7 +172,7 @@ static struct i2c_driver rt5033_battery_driver = {
.name = "rt5033-battery",
.of_match_table = rt5033_battery_of_match,
},
.probe = rt5033_battery_probe,
.probe_new = rt5033_battery_probe,
.remove = rt5033_battery_remove,
.id_table = rt5033_battery_id,
};
......
......@@ -1581,8 +1581,7 @@ static const struct regmap_config rt9455_regmap_config = {
.cache_type = REGCACHE_RBTREE,
};
static int rt9455_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int rt9455_probe(struct i2c_client *client)
{
struct i2c_adapter *adapter = client->adapter;
struct device *dev = &client->dev;
......@@ -1738,7 +1737,7 @@ MODULE_DEVICE_TABLE(acpi, rt9455_i2c_acpi_match);
#endif
static struct i2c_driver rt9455_driver = {
.probe = rt9455_probe,
.probe_new = rt9455_probe,
.remove = rt9455_remove,
.id_table = rt9455_i2c_id_table,
.driver = {
......
......@@ -162,8 +162,7 @@ static const struct power_supply_desc sbs_desc = {
.get_property = sbs_get_property,
};
static int sbs_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int sbs_probe(struct i2c_client *client)
{
struct power_supply_config psy_cfg = {};
struct sbs_info *chip;
......@@ -241,7 +240,7 @@ static const struct i2c_device_id sbs_id[] = {
MODULE_DEVICE_TABLE(i2c, sbs_id);
static struct i2c_driver sbs_driver = {
.probe = sbs_probe,
.probe_new = sbs_probe,
.id_table = sbs_id,
.driver = {
.name = "sbs-charger",
......
......@@ -315,9 +315,9 @@ static void sbsm_del_mux_adapter(void *data)
i2c_mux_del_adapters(sbsm->muxc);
}
static int sbsm_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int sbsm_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct i2c_adapter *adapter = client->adapter;
struct sbsm_data *data;
struct device *dev = &client->dev;
......@@ -409,7 +409,7 @@ static struct i2c_driver sbsm_driver = {
.name = "sbsm",
.of_match_table = of_match_ptr(sbsm_dt_ids),
},
.probe = sbsm_probe,
.probe_new = sbsm_probe,
.alert = sbsm_alert,
.id_table = sbsm_ids
};
......
......@@ -1528,9 +1528,9 @@ static const struct regulator_desc smb347_usb_vbus_regulator_desc = {
.n_voltages = 1,
};
static int smb347_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int smb347_probe(struct i2c_client *client)
{
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct power_supply_config mains_usb_cfg = {};
struct regulator_config usb_rdev_cfg = {};
struct device *dev = &client->dev;
......@@ -1629,7 +1629,7 @@ static struct i2c_driver smb347_driver = {
.name = "smb347",
.of_match_table = smb3xx_of_match,
},
.probe = smb347_probe,
.probe_new = smb347_probe,
.remove = smb347_remove,
.shutdown = smb347_shutdown,
.id_table = smb347_id,
......
......@@ -532,8 +532,7 @@ static const struct regulator_desc ucs1002_regulator_descriptor = {
.n_voltages = 1,
};
static int ucs1002_probe(struct i2c_client *client,
const struct i2c_device_id *dev_id)
static int ucs1002_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct power_supply_config charger_config = {};
......@@ -681,7 +680,7 @@ static struct i2c_driver ucs1002_driver = {
.name = "ucs1002",
.of_match_table = ucs1002_of_match,
},
.probe = ucs1002_probe,
.probe_new = ucs1002_probe,
};
module_i2c_driver(ucs1002_driver);
......
......@@ -176,8 +176,7 @@ static int z2_batt_ps_init(struct z2_charger *charger, int props)
return 0;
}
static int z2_batt_probe(struct i2c_client *client,
const struct i2c_device_id *id)
static int z2_batt_probe(struct i2c_client *client)
{
int ret = 0;
int props = 1; /* POWER_SUPPLY_PROP_PRESENT */
......@@ -206,10 +205,12 @@ static int z2_batt_probe(struct i2c_client *client,
charger->charge_gpiod = devm_gpiod_get_optional(&client->dev,
NULL, GPIOD_IN);
if (IS_ERR(charger->charge_gpiod))
return dev_err_probe(&client->dev,
if (IS_ERR(charger->charge_gpiod)) {
ret = dev_err_probe(&client->dev,
PTR_ERR(charger->charge_gpiod),
"failed to get charge GPIO\n");
goto err;
}
if (charger->charge_gpiod) {
gpiod_set_consumer_name(charger->charge_gpiod, "BATT CHRG");
......@@ -306,7 +307,7 @@ static struct i2c_driver z2_batt_driver = {
.name = "z2-battery",
.pm = Z2_BATTERY_PM_OPS
},
.probe = z2_batt_probe,
.probe_new = z2_batt_probe,
.remove = z2_batt_remove,
.id_table = z2_batt_id,
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment