Commit 0df24138 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull power supply and reset updates from Sebastian Reichel:

 - Add new Qualcomm PMI8998/PM660 SMB2 charger

 - bq256xx: support systems without thermistors

 - cros_pchg: fix peripheral device status after system resume

 - axp20x_usb_power: add support for AXP192

 - qcom-pon: add support for pm8941

 - at91-reset: prepare to expose reset reason to sysfs

 - switch all I2C drivers back to use .probe instead of .probe_new

 - convert some more DT bindings to YAML

 - misc cleanups

* tag 'for-v6.5' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (28 commits)
  MAINTAINERS: add documentation file for Microchip SAMA5D2 shutdown controller
  dt-bindings: power: reset: atmel,sama5d2-shdwc: convert to yaml
  dt-bindings: power: reset: atmel,at91sam9260-shdwc: convert to yaml
  power: reset: at91-reset: change the power on reason prototype
  power: reset: qcom-pon: add support for pm8941-pon
  dt-bindings: power: reset: qcom-pon: define pm8941-pon
  power: supply: add Qualcomm PMI8998 SMB2 Charger driver
  dt-bindings: power: supply: qcom,pmi8998-charger: add bindings for smb2 driver
  power: supply: rt9467: Make charger-enable control as logic level
  power: supply: Switch i2c drivers back to use .probe()
  power: reset: add HAS_IOPORT dependencies
  dt-bindings: power: supply: axp20x: Add AXP192 compatible
  power: supply: axp20x_usb_power: Add support for AXP192
  power: supply: axp20x_usb_power: Remove variant IDs from VBUS polling check
  power: supply: axp20x_usb_power: Use regmap field for VBUS disabling
  power: supply: axp20x_usb_power: Use regmap fields for USB BC feature
  power: supply: axp20x_usb_power: Use regmap fields for VBUS monitor feature
  power: supply: axp20x_usb_power: Simplify USB current limit handling
  power: supply: hwmon: constify pointers to hwmon_channel_info
  power: supply: twl4030_madc_battery: Refactor twl4030_madc_bat_ext_changed()
  ...
parents 02676ecc ef8d95b4
......@@ -52,100 +52,6 @@ Example:
reg = <0xe3804000 0x1000>;
};
SHDWC Shutdown Controller
required properties:
- compatible: Should be "atmel,<chip>-shdwc".
<chip> can be "at91sam9260", "at91sam9rl" or "at91sam9x5".
- reg: Should contain registers location and length
- clocks: phandle to input clock.
optional properties:
- atmel,wakeup-mode: String, operation mode of the wakeup mode.
Supported values are: "none", "high", "low", "any".
- atmel,wakeup-counter: Counter on Wake-up 0 (between 0x0 and 0xf).
optional at91sam9260 properties:
- atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up.
optional at91sam9rl properties:
- atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up.
- atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up.
optional at91sam9x5 properties:
- atmel,wakeup-rtc-timer: boolean to enable Real-time Clock Wake-up.
Example:
shdwc@fffffd10 {
compatible = "atmel,at91sam9260-shdwc";
reg = <0xfffffd10 0x10>;
clocks = <&clk32k>;
};
SHDWC SAMA5D2-Compatible Shutdown Controller
1) shdwc node
required properties:
- compatible: should be "atmel,sama5d2-shdwc", "microchip,sam9x60-shdwc" or
"microchip,sama7g5-shdwc"
- reg: should contain registers location and length
- clocks: phandle to input clock.
- #address-cells: should be one. The cell is the wake-up input index.
- #size-cells: should be zero.
optional properties:
- debounce-delay-us: minimum wake-up inputs debouncer period in
microseconds. It's usually a board-related property.
- atmel,wakeup-rtc-timer: boolean to enable Real-Time Clock wake-up.
optional microchip,sam9x60-shdwc or microchip,sama7g5-shdwc properties:
- atmel,wakeup-rtt-timer: boolean to enable Real-time Timer Wake-up.
The node contains child nodes for each wake-up input that the platform uses.
2) input nodes
Wake-up input nodes are usually described in the "board" part of the Device
Tree. Note also that input 0 is linked to the wake-up pin and is frequently
used.
Required properties:
- reg: should contain the wake-up input index [0 - 15].
Optional properties:
- atmel,wakeup-active-high: boolean, the corresponding wake-up input described
by the child, forces the wake-up of the core power supply on a high level.
The default is to be active low.
Example:
On the SoC side:
shdwc@f8048010 {
compatible = "atmel,sama5d2-shdwc";
reg = <0xf8048010 0x10>;
clocks = <&clk32k>;
#address-cells = <1>;
#size-cells = <0>;
atmel,wakeup-rtc-timer;
};
On the board side:
shdwc@f8048010 {
debounce-delay-us = <976>;
input@0 {
reg = <0>;
};
input@1 {
reg = <1>;
atmel,wakeup-active-high;
};
};
Special Function Registers (SFR)
Special Function Registers (SFR) manage specific aspects of the integrated
......
......@@ -134,6 +134,7 @@ patternProperties:
oneOf:
- $ref: /schemas/power/supply/qcom,pm8941-charger.yaml#
- $ref: /schemas/power/supply/qcom,pm8941-coincell.yaml#
- $ref: /schemas/power/supply/qcom,pmi8998-charger.yaml#
"gpio@[0-9a-f]+$":
type: object
......
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/reset/atmel,at91sam9260-shdwc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Microchip AT91 SHDWC Shutdown Controller
maintainers:
- Claudiu Beznea <claudiu.beznea@microchip.com>
description: |
Microchip AT91 SHDWC shutdown controller controls the power supplies VDDIO
and VDDCORE and the wake-up detection on debounced input lines.
properties:
compatible:
enum:
- atmel,at91sam9260-shdwc
- atmel,at91sam9rl-shdwc
- atmel,at91sam9x5-shdwc
reg:
maxItems: 1
clocks:
maxItems: 1
atmel,wakeup-mode:
description: operation mode of the wakeup mode
$ref: /schemas/types.yaml#/definitions/string
enum: [ none, high, low, any ]
atmel,wakeup-counter:
description: counter on wake-up 0
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 15
atmel,wakeup-rtt-timer:
description: enable real-time timer wake-up
type: boolean
atmel,wakeup-rtc-timer:
description: enable real-time clock wake-up
type: boolean
required:
- compatible
- reg
- clocks
allOf:
- if:
properties:
compatible:
contains:
const: atmel,at91sam9x5-shdwc
then:
properties:
atmel,wakeup-rtt-timer: false
- if:
properties:
compatible:
contains:
const: atmel,at91sam9260-shdwc
then:
properties:
atmel,wakeup-rtc-timer: false
additionalProperties: false
examples:
- |
shdwc: poweroff@fffffd10 {
compatible = "atmel,at91sam9260-shdwc";
reg = <0xfffffd10 0x10>;
clocks = <&clk32k>;
};
...
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/reset/atmel,sama5d2-shdwc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Microchip AT91 SAMA5D2 SHDWC Shutdown Controller
maintainers:
- Claudiu Beznea <claudiu.beznea@microchip.com>
description: |
Microchip AT91 SHDWC shutdown controller controls the power supplies VDDIO
and VDDCORE and the wake-up detection on debounced input lines.
properties:
compatible:
oneOf:
- items:
- const: microchip,sama7g5-shdwc
- const: syscon
- enum:
- atmel,sama5d2-shdwc
- microchip,sam9x60-shdwc
reg:
maxItems: 1
clocks:
maxItems: 1
"#address-cells":
const: 1
"#size-cells":
const: 0
debounce-delay-us:
description:
Minimum wake-up inputs debouncer period in microseconds. It is usually a
board-related property.
atmel,wakeup-rtc-timer:
description: enable real-time clock wake-up
type: boolean
atmel,wakeup-rtt-timer:
description: enable real-time timer wake-up
type: boolean
patternProperties:
"^input@[0-15]$":
description:
Wake-up input nodes. These are usually described in the "board" part of
the Device Tree. Note also that input 0 is linked to the wake-up pin and
is frequently used.
type: object
properties:
reg:
description: contains the wake-up input index
minimum: 0
maximum: 15
atmel,wakeup-active-high:
description:
The corresponding wake-up input described by the child forces the
wake-up of the core power supply on a high level. The default is to
be active low.
type: boolean
required:
- reg
additionalProperties: false
required:
- compatible
- reg
- clocks
allOf:
- if:
properties:
compatible:
contains:
const: atmel,sama5d2-shdwc
then:
properties:
atmel,wakeup-rtt-timer: false
additionalProperties: false
examples:
- |
shdwc: poweroff@f8048010 {
compatible = "atmel,sama5d2-shdwc";
reg = <0xf8048010 0x10>;
clocks = <&clk32k>;
#address-cells = <1>;
#size-cells = <0>;
atmel,wakeup-rtc-timer;
debounce-delay-us = <976>;
input@0 {
reg = <0>;
};
input@1 {
reg = <1>;
atmel,wakeup-active-high;
};
};
...
NVMEM reboot mode driver
This driver gets reboot mode magic value from reboot-mode driver
and stores it in a NVMEM cell named "reboot-mode". Then the bootloader
can read it and take different action according to the magic
value stored.
Required properties:
- compatible: should be "nvmem-reboot-mode".
- nvmem-cells: A phandle to the reboot mode provided by a nvmem device.
- nvmem-cell-names: Should be "reboot-mode".
The rest of the properties should follow the generic reboot-mode description
found in reboot-mode.txt
Example:
reboot-mode {
compatible = "nvmem-reboot-mode";
nvmem-cells = <&reboot_mode>;
nvmem-cell-names = "reboot-mode";
mode-normal = <0xAAAA5501>;
mode-bootloader = <0xBBBB5500>;
mode-recovery = <0xCCCC5502>;
mode-test = <0xDDDD5503>;
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/reset/nvmem-reboot-mode.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Generic NVMEM reboot mode
maintainers:
- Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
description:
This driver gets the reboot mode magic value from the reboot-mode driver
and stores it in the NVMEM cell named "reboot-mode". The bootloader can
then read it and take different action according to the value.
properties:
compatible:
const: nvmem-reboot-mode
nvmem-cells:
description:
A phandle pointing to the nvmem-cells node where the vendor-specific
magic value representing the reboot mode is stored.
maxItems: 1
nvmem-cell-names:
items:
- const: reboot-mode
patternProperties:
"^mode-.+":
$ref: /schemas/types.yaml#/definitions/uint32
description: Vendor-specific mode value written to the mode register
required:
- compatible
- nvmem-cells
- nvmem-cell-names
additionalProperties: false
examples:
- |
reboot-mode {
compatible = "nvmem-reboot-mode";
nvmem-cells = <&reboot_reason>;
nvmem-cell-names = "reboot-mode";
mode-recovery = <0x01>;
mode-bootloader = <0x02>;
};
...
......@@ -19,6 +19,7 @@ properties:
compatible:
enum:
- qcom,pm8916-pon
- qcom,pm8941-pon
- qcom,pms405-pon
- qcom,pm8998-pon
- qcom,pmk8350-pon
......@@ -56,7 +57,6 @@ required:
unevaluatedProperties: false
allOf:
- $ref: reboot-mode.yaml#
- if:
properties:
compatible:
......@@ -65,6 +65,23 @@ allOf:
- qcom,pm8916-pon
- qcom,pms405-pon
- qcom,pm8998-pon
then:
allOf:
- $ref: reboot-mode.yaml#
properties:
reg:
maxItems: 1
reg-names:
items:
- const: pon
# Special case for pm8941, which doesn't store reset mode
- if:
properties:
compatible:
contains:
const: qcom,pm8941-pon
then:
properties:
reg:
......@@ -72,6 +89,7 @@ allOf:
reg-names:
items:
- const: pon
- if:
properties:
compatible:
......
......@@ -68,11 +68,29 @@ properties:
Interrupt sends an active low, 256 μs pulse to host to report the charger
device status and faults.
ti,no-thermistor:
type: boolean
description: Indicates that no thermistor is connected to the TS pin
required:
- compatible
- reg
- monitored-battery
allOf:
- if:
properties:
compatible:
contains:
enum:
- ti,bq25600
- ti,bq25601
- ti,bq25600d
- ti,bq25601d
then:
properties:
ti,no-thermistor: false
additionalProperties: false
examples:
......
# SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/power/supply/qcom,pmi8998-charger.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm PMI8998/PM660 Switch-Mode Battery Charger "2"
maintainers:
- Caleb Connolly <caleb.connolly@linaro.org>
properties:
compatible:
enum:
- qcom,pmi8998-charger
- qcom,pm660-charger
reg:
maxItems: 1
interrupts:
maxItems: 4
interrupt-names:
items:
- const: usb-plugin
- const: bat-ov
- const: wdog-bark
- const: usbin-icl-change
io-channels:
items:
- description: USB in current in uA
- description: USB in voltage in uV
io-channel-names:
items:
- const: usbin_i
- const: usbin_v
monitored-battery:
description: phandle to the simple-battery node
$ref: /schemas/types.yaml#/definitions/phandle
required:
- compatible
- reg
- interrupts
- interrupt-names
- io-channels
- io-channel-names
- monitored-battery
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/irq.h>
pmic {
#address-cells = <1>;
#size-cells = <0>;
#interrupt-cells = <4>;
charger@1000 {
compatible = "qcom,pmi8998-charger";
reg = <0x1000>;
interrupts = <0x2 0x12 0x2 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x13 0x4 IRQ_TYPE_EDGE_BOTH>,
<0x2 0x13 0x6 IRQ_TYPE_EDGE_RISING>,
<0x2 0x16 0x1 IRQ_TYPE_EDGE_RISING>;
interrupt-names = "usb-plugin", "bat-ov", "wdog-bark", "usbin-icl-change";
io-channels = <&pmi8998_rradc 3>,
<&pmi8998_rradc 4>;
io-channel-names = "usbin_i",
"usbin_v";
monitored-battery = <&battery>;
};
};
......@@ -22,6 +22,7 @@ properties:
compatible:
oneOf:
- enum:
- x-powers,axp192-usb-power-supply
- x-powers,axp202-usb-power-supply
- x-powers,axp221-usb-power-supply
- x-powers,axp223-usb-power-supply
......
......@@ -14019,6 +14019,7 @@ F: include/dt-bindings/iio/adc/at91-sama5d2_adc.h
MICROCHIP SAMA5D2-COMPATIBLE SHUTDOWN CONTROLLER
M: Claudiu Beznea <claudiu.beznea@microchip.com>
S: Supported
F: Documentation/devicetree/bindings/power/reset/atmel,sama5d2-shdwc.yaml
F: drivers/power/reset/at91-sama5d2_shdwc.c
MICROCHIP SOC DRIVERS
......
......@@ -158,6 +158,7 @@ config POWER_RESET_OXNAS
config POWER_RESET_PIIX4_POWEROFF
tristate "Intel PIIX4 power-off driver"
depends on PCI
depends on HAS_IOPORT
depends on MIPS || COMPILE_TEST
help
This driver supports powering off a system using the Intel PIIX4
......
......@@ -149,11 +149,10 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
return NOTIFY_DONE;
}
static void __init at91_reset_status(struct platform_device *pdev,
void __iomem *base)
static const char * __init at91_reset_reason(struct at91_reset *reset)
{
u32 reg = readl(reset->rstc_base + AT91_RSTC_SR);
const char *reason;
u32 reg = readl(base + AT91_RSTC_SR);
switch ((reg & AT91_RSTC_RSTTYP) >> 8) {
case RESET_TYPE_GENERAL:
......@@ -185,7 +184,7 @@ static void __init at91_reset_status(struct platform_device *pdev,
break;
}
dev_info(&pdev->dev, "Starting after %s\n", reason);
return reason;
}
static const struct of_device_id at91_ramc_of_match[] = {
......@@ -392,7 +391,7 @@ static int __init at91_reset_probe(struct platform_device *pdev)
if (ret)
goto disable_clk;
at91_reset_status(pdev, reset->rstc_base);
dev_info(&pdev->dev, "Starting after %s\n", at91_reset_reason(reset));
return 0;
......
......@@ -105,7 +105,7 @@ static int gpio_restart_probe(struct platform_device *pdev)
return 0;
}
static int gpio_restart_remove(struct platform_device *pdev)
static void gpio_restart_remove(struct platform_device *pdev)
{
struct gpio_restart *gpio_restart = platform_get_drvdata(pdev);
int ret;
......@@ -115,10 +115,7 @@ static int gpio_restart_remove(struct platform_device *pdev)
dev_err(&pdev->dev,
"%s: cannot unregister restart handler, %d\n",
__func__, ret);
return -ENODEV;
}
return 0;
}
static const struct of_device_id of_gpio_restart_match[] = {
......@@ -128,7 +125,7 @@ static const struct of_device_id of_gpio_restart_match[] = {
static struct platform_driver gpio_restart_driver = {
.probe = gpio_restart_probe,
.remove = gpio_restart_remove,
.remove_new = gpio_restart_remove,
.driver = {
.name = "restart-gpio",
.of_match_table = of_gpio_restart_match,
......
......@@ -17,6 +17,8 @@
#define GEN1_REASON_SHIFT 2
#define GEN2_REASON_SHIFT 1
#define NO_REASON_SHIFT 0
struct pm8916_pon {
struct device *dev;
struct regmap *regmap;
......@@ -45,6 +47,7 @@ static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
static int pm8916_pon_probe(struct platform_device *pdev)
{
struct pm8916_pon *pon;
long reason_shift;
int error;
pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL);
......@@ -64,14 +67,18 @@ static int pm8916_pon_probe(struct platform_device *pdev)
if (error)
return error;
reason_shift = (long)of_device_get_match_data(&pdev->dev);
if (reason_shift != NO_REASON_SHIFT) {
pon->reboot_mode.dev = &pdev->dev;
pon->reason_shift = (long)of_device_get_match_data(&pdev->dev);
pon->reason_shift = reason_shift;
pon->reboot_mode.write = pm8916_reboot_mode_write;
error = devm_reboot_mode_register(&pdev->dev, &pon->reboot_mode);
if (error) {
dev_err(&pdev->dev, "can't register reboot mode\n");
return error;
}
}
platform_set_drvdata(pdev, pon);
......@@ -80,6 +87,7 @@ static int pm8916_pon_probe(struct platform_device *pdev)
static const struct of_device_id pm8916_pon_id_table[] = {
{ .compatible = "qcom,pm8916-pon", .data = (void *)GEN1_REASON_SHIFT },
{ .compatible = "qcom,pm8941-pon", .data = (void *)NO_REASON_SHIFT },
{ .compatible = "qcom,pms405-pon", .data = (void *)GEN1_REASON_SHIFT },
{ .compatible = "qcom,pm8998-pon", .data = (void *)GEN2_REASON_SHIFT },
{ .compatible = "qcom,pmk8350-pon", .data = (void *)GEN2_REASON_SHIFT },
......
......@@ -942,4 +942,13 @@ config BATTERY_UG3105
device is off or suspended, the functionality of this driver is
limited to reporting capacity only.
config CHARGER_QCOM_SMB2
tristate "Qualcomm PMI8998 PMIC charger driver"
depends on MFD_SPMI_PMIC
depends on IIO
help
Say Y here to enable the Qualcomm PMIC Charger driver. This
adds support for the SMB2 switch mode battery charger found
in PMI8998 and related PMICs.
endif # POWER_SUPPLY
......@@ -110,3 +110,4 @@ obj-$(CONFIG_BATTERY_ACER_A500) += acer_a500_battery.o
obj-$(CONFIG_BATTERY_SURFACE) += surface_battery.o
obj-$(CONFIG_CHARGER_SURFACE) += surface_charger.o
obj-$(CONFIG_BATTERY_UG3105) += ug3105_battery.o
obj-$(CONFIG_CHARGER_QCOM_SMB2) += qcom_pmi8998_charger.o
......@@ -736,7 +736,7 @@ static struct i2c_driver adp5061_driver = {
.driver = {
.name = KBUILD_MODNAME,
},
.probe_new = adp5061_probe,
.probe = adp5061_probe,
.id_table = adp5061_id,
};
module_i2c_driver(adp5061_driver);
......
This diff is collapsed.
......@@ -1077,7 +1077,7 @@ static struct i2c_driver bd9995x_driver = {
.name = "bd9995x-charger",
.of_match_table = bd9995x_of_match,
},
.probe_new = bd9995x_probe,
.probe = bd9995x_probe,
};
module_i2c_driver(bd9995x_driver);
......
......@@ -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_new = bq2415x_probe,
.probe = bq2415x_probe,
.remove = bq2415x_remove,
.id_table = bq2415x_i2c_id_table,
};
......
......@@ -2034,7 +2034,7 @@ static const struct of_device_id bq24190_of_match[] = {
MODULE_DEVICE_TABLE(of, bq24190_of_match);
static struct i2c_driver bq24190_driver = {
.probe_new = bq24190_probe,
.probe = bq24190_probe,
.remove = bq24190_remove,
.shutdown = bq24190_shutdown,
.id_table = bq24190_i2c_ids,
......
......@@ -1165,7 +1165,7 @@ static struct i2c_driver bq24257_driver = {
.acpi_match_table = ACPI_PTR(bq24257_acpi_match),
.pm = &bq24257_pm,
},
.probe_new = bq24257_probe,
.probe = bq24257_probe,
.remove = bq24257_remove,
.id_table = bq24257_i2c_ids,
};
......
......@@ -505,7 +505,7 @@ static struct i2c_driver bq24735_charger_driver = {
.name = "bq24735-charger",
.of_match_table = bq24735_match_ids,
},
.probe_new = bq24735_charger_probe,
.probe = bq24735_charger_probe,
.id_table = bq24735_charger_id,
};
......
......@@ -1158,7 +1158,7 @@ static struct i2c_driver bq2515x_driver = {
.name = "bq2515x-charger",
.of_match_table = bq2515x_of_match,
},
.probe_new = bq2515x_probe,
.probe = bq2515x_probe,
.id_table = bq2515x_i2c_ids,
};
module_i2c_driver(bq2515x_driver);
......
......@@ -41,6 +41,9 @@
#define BQ256XX_IINDPM_MAX_uA 3200000
#define BQ256XX_IINDPM_DEF_uA 2400000
#define BQ256XX_TS_IGNORE BIT(6)
#define BQ256XX_TS_IGNORE_SHIFT 6
#define BQ256XX_VINDPM_MASK GENMASK(3, 0)
#define BQ256XX_VINDPM_STEP_uV 100000
#define BQ256XX_VINDPM_OFFSET_uV 3900000
......@@ -156,6 +159,7 @@
* @vindpm: input voltage limit
* @ichg_max: maximum fast charge current
* @vbatreg_max: maximum charge voltage
* @ts_ignore: TS_IGNORE flag
*/
struct bq256xx_init_data {
u32 ichg;
......@@ -166,6 +170,7 @@ struct bq256xx_init_data {
u32 vindpm;
u32 ichg_max;
u32 vbatreg_max;
bool ts_ignore;
};
/**
......@@ -263,6 +268,7 @@ struct bq256xx_device {
* @bq256xx_set_iprechg: pointer to instance specific set_iprechg function
* @bq256xx_set_vindpm: pointer to instance specific set_vindpm function
* @bq256xx_set_charge_type: pointer to instance specific set_charge_type function
* @bq256xx_set_ts_ignore: pointer to instance specific set_ts_ignore function
*
* @bq256xx_def_ichg: default ichg value in microamps
* @bq256xx_def_iindpm: default iindpm value in microamps
......@@ -295,6 +301,7 @@ struct bq256xx_chip_info {
int (*bq256xx_set_iprechg)(struct bq256xx_device *bq, int iprechg);
int (*bq256xx_set_vindpm)(struct bq256xx_device *bq, int vindpm);
int (*bq256xx_set_charge_type)(struct bq256xx_device *bq, int type);
int (*bq256xx_set_ts_ignore)(struct bq256xx_device *bq, bool ts_ignore);
int bq256xx_def_ichg;
int bq256xx_def_iindpm;
......@@ -696,6 +703,12 @@ static int bq25601d_set_chrg_volt(struct bq256xx_device *bq, int vbatreg)
BQ256XX_VBATREG_BIT_SHIFT);
}
static int bq256xx_set_ts_ignore(struct bq256xx_device *bq, bool ts_ignore)
{
return regmap_update_bits(bq->regmap, BQ256XX_INPUT_CURRENT_LIMIT,
BQ256XX_TS_IGNORE, (ts_ignore ? 1 : 0) << BQ256XX_TS_IGNORE_SHIFT);
}
static int bq256xx_get_prechrg_curr(struct bq256xx_device *bq)
{
unsigned int prechg_and_term_curr_lim;
......@@ -1312,6 +1325,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
.bq256xx_get_iterm = bq256xx_get_term_curr,
.bq256xx_get_iprechg = bq256xx_get_prechrg_curr,
.bq256xx_get_vindpm = bq256xx_get_input_volt_lim,
.bq256xx_set_ts_ignore = NULL,
.bq256xx_set_ichg = bq256xx_set_ichg_curr,
.bq256xx_set_iindpm = bq256xx_set_input_curr_lim,
......@@ -1351,6 +1365,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
.bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
.bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
.bq256xx_set_charge_type = bq256xx_set_charge_type,
.bq256xx_set_ts_ignore = NULL,
.bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA,
.bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
......@@ -1382,6 +1397,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
.bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
.bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
.bq256xx_set_charge_type = bq256xx_set_charge_type,
.bq256xx_set_ts_ignore = NULL,
.bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA,
.bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
......@@ -1413,6 +1429,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
.bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
.bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
.bq256xx_set_charge_type = bq256xx_set_charge_type,
.bq256xx_set_ts_ignore = NULL,
.bq256xx_def_ichg = BQ2560X_ICHG_DEF_uA,
.bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
......@@ -1444,6 +1461,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
.bq256xx_set_iprechg = bq256xx_set_prechrg_curr,
.bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
.bq256xx_set_charge_type = bq256xx_set_charge_type,
.bq256xx_set_ts_ignore = bq256xx_set_ts_ignore,
.bq256xx_def_ichg = BQ25611D_ICHG_DEF_uA,
.bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
......@@ -1475,6 +1493,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
.bq256xx_set_iprechg = bq25618_619_set_prechrg_curr,
.bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
.bq256xx_set_charge_type = bq256xx_set_charge_type,
.bq256xx_set_ts_ignore = bq256xx_set_ts_ignore,
.bq256xx_def_ichg = BQ25618_ICHG_DEF_uA,
.bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
......@@ -1506,6 +1525,7 @@ static const struct bq256xx_chip_info bq256xx_chip_info_tbl[] = {
.bq256xx_set_iprechg = bq25618_619_set_prechrg_curr,
.bq256xx_set_vindpm = bq256xx_set_input_volt_lim,
.bq256xx_set_charge_type = bq256xx_set_charge_type,
.bq256xx_set_ts_ignore = bq256xx_set_ts_ignore,
.bq256xx_def_ichg = BQ25618_ICHG_DEF_uA,
.bq256xx_def_iindpm = BQ256XX_IINDPM_DEF_uA,
......@@ -1622,6 +1642,12 @@ static int bq256xx_hw_init(struct bq256xx_device *bq)
if (ret)
return ret;
if (bq->chip_info->bq256xx_set_ts_ignore) {
ret = bq->chip_info->bq256xx_set_ts_ignore(bq, bq->init_data.ts_ignore);
if (ret)
return ret;
}
power_supply_put_battery_info(bq->charger, bat_info);
return 0;
......@@ -1656,6 +1682,8 @@ static int bq256xx_parse_dt(struct bq256xx_device *bq,
if (ret)
bq->init_data.iindpm = bq->chip_info->bq256xx_def_iindpm;
bq->init_data.ts_ignore = device_property_read_bool(bq->dev, "ti,no-thermistor");
return 0;
}
......@@ -1784,7 +1812,7 @@ static struct i2c_driver bq256xx_driver = {
.of_match_table = bq256xx_of_match,
.acpi_match_table = bq256xx_acpi_match,
},
.probe_new = bq256xx_probe,
.probe = bq256xx_probe,
.id_table = bq256xx_i2c_ids,
};
module_i2c_driver(bq256xx_driver);
......
......@@ -1649,7 +1649,7 @@ static struct i2c_driver bq25890_driver = {
.acpi_match_table = ACPI_PTR(bq25890_acpi_match),
.pm = &bq25890_pm,
},
.probe_new = bq25890_probe,
.probe = bq25890_probe,
.remove = bq25890_remove,
.shutdown = bq25890_shutdown,
.id_table = bq25890_i2c_ids,
......
......@@ -1287,7 +1287,7 @@ static struct i2c_driver bq25980_driver = {
.name = "bq25980-charger",
.of_match_table = bq25980_of_match,
},
.probe_new = bq25980_probe,
.probe = bq25980_probe,
.id_table = bq25980_i2c_ids,
};
module_i2c_driver(bq25980_driver);
......
......@@ -296,7 +296,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_new = bq27xxx_battery_i2c_probe,
.probe = bq27xxx_battery_i2c_probe,
.remove = bq27xxx_battery_i2c_remove,
.id_table = bq27xxx_i2c_id_table,
};
......
......@@ -227,8 +227,7 @@ static int cros_pchg_get_prop(struct power_supply *psy,
return 0;
}
static int cros_pchg_event(const struct charger_data *charger,
unsigned long host_event)
static int cros_pchg_event(const struct charger_data *charger)
{
int i;
......@@ -256,7 +255,7 @@ static int cros_ec_notify(struct notifier_block *nb,
if (!(host_event & EC_MKBP_PCHG_DEVICE_EVENT))
return NOTIFY_DONE;
return cros_pchg_event(charger, host_event);
return cros_pchg_event(charger);
}
static int cros_pchg_probe(struct platform_device *pdev)
......@@ -281,6 +280,8 @@ static int cros_pchg_probe(struct platform_device *pdev)
charger->ec_dev = ec_dev;
charger->ec_device = ec_device;
platform_set_drvdata(pdev, charger);
ret = cros_pchg_port_count(charger);
if (ret <= 0) {
/*
......@@ -349,9 +350,27 @@ static int cros_pchg_probe(struct platform_device *pdev)
return 0;
}
#ifdef CONFIG_PM_SLEEP
static int __maybe_unused cros_pchg_resume(struct device *dev)
{
struct charger_data *charger = dev_get_drvdata(dev);
/*
* Sync all ports on resume in case reports from EC are lost during
* the last suspend.
*/
cros_pchg_event(charger);
return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(cros_pchg_pm_ops, NULL, cros_pchg_resume);
static struct platform_driver cros_pchg_driver = {
.driver = {
.name = DRV_NAME,
.pm = &cros_pchg_pm_ops,
},
.probe = cros_pchg_probe
};
......
......@@ -747,7 +747,7 @@ static struct i2c_driver cw_bat_driver = {
.of_match_table = cw2015_of_match,
.pm = &cw_bat_pm_ops,
},
.probe_new = cw_bat_probe,
.probe = cw_bat_probe,
.id_table = cw_bat_id_table,
};
......
......@@ -458,7 +458,7 @@ static struct i2c_driver ds278x_battery_driver = {
.name = "ds2782-battery",
.pm = &ds278x_battery_pm_ops,
},
.probe_new = ds278x_battery_probe,
.probe = ds278x_battery_probe,
.remove = ds278x_battery_remove,
.id_table = ds278x_id,
};
......
......@@ -625,7 +625,7 @@ static const struct of_device_id ip5xxx_power_of_match[] = {
MODULE_DEVICE_TABLE(of, ip5xxx_power_of_match);
static struct i2c_driver ip5xxx_power_driver = {
.probe_new = ip5xxx_power_probe,
.probe = ip5xxx_power_probe,
.driver = {
.name = "ip5xxx-power",
.of_match_table = ip5xxx_power_of_match,
......
......@@ -615,7 +615,7 @@ static struct i2c_driver lp8727_driver = {
.name = "lp8727",
.of_match_table = of_match_ptr(lp8727_dt_ids),
},
.probe_new = lp8727_probe,
.probe = lp8727_probe,
.remove = lp8727_remove,
.id_table = lp8727_ids,
};
......
......@@ -635,7 +635,7 @@ static struct i2c_driver ltc294x_driver = {
.of_match_table = ltc294x_i2c_of_match,
.pm = LTC294X_PM_OPS,
},
.probe_new = ltc294x_i2c_probe,
.probe = ltc294x_i2c_probe,
.shutdown = ltc294x_i2c_shutdown,
.id_table = ltc294x_i2c_id,
};
......
......@@ -915,7 +915,7 @@ static const struct of_device_id ltc4162l_of_match[] __maybe_unused = {
MODULE_DEVICE_TABLE(of, ltc4162l_of_match);
static struct i2c_driver ltc4162l_driver = {
.probe_new = ltc4162l_probe,
.probe = ltc4162l_probe,
.alert = ltc4162l_alert,
.id_table = ltc4162l_i2c_id_table,
.driver = {
......
......@@ -316,7 +316,7 @@ static struct i2c_driver max14656_i2c_driver = {
.name = "max14656",
.of_match_table = max14656_match_table,
},
.probe_new = max14656_probe,
.probe = max14656_probe,
.id_table = max14656_id,
};
module_i2c_driver(max14656_i2c_driver);
......
......@@ -599,7 +599,7 @@ static struct i2c_driver max17040_i2c_driver = {
.of_match_table = max17040_of_match,
.pm = MAX17040_PM_OPS,
},
.probe_new = max17040_probe,
.probe = max17040_probe,
.id_table = max17040_id,
};
module_i2c_driver(max17040_i2c_driver);
......
......@@ -499,11 +499,6 @@ static int max17042_property_is_writeable(struct power_supply *psy,
return ret;
}
static void max17042_external_power_changed(struct power_supply *psy)
{
power_supply_changed(psy);
}
static int max17042_write_verify_reg(struct regmap *map, u8 reg, u32 value)
{
int retries = 8;
......@@ -1016,7 +1011,7 @@ static const struct power_supply_desc max17042_psy_desc = {
.get_property = max17042_get_property,
.set_property = max17042_set_property,
.property_is_writeable = max17042_property_is_writeable,
.external_power_changed = max17042_external_power_changed,
.external_power_changed = power_supply_changed,
.properties = max17042_battery_props,
.num_properties = ARRAY_SIZE(max17042_battery_props),
};
......@@ -1220,7 +1215,7 @@ static struct i2c_driver max17042_i2c_driver = {
.of_match_table = of_match_ptr(max17042_dt_match),
.pm = &max17042_pm_ops,
},
.probe_new = max17042_probe,
.probe = max17042_probe,
.id_table = max17042_id,
};
module_i2c_driver(max17042_i2c_driver);
......
......@@ -499,7 +499,7 @@ static struct i2c_driver max77976_driver = {
.name = MAX77976_DRIVER_NAME,
.of_match_table = max77976_of_id,
},
.probe_new = max77976_probe,
.probe = max77976_probe,
.id_table = max77976_i2c_id,
};
module_i2c_driver(max77976_driver);
......
......@@ -293,7 +293,7 @@ static const struct hwmon_ops power_supply_hwmon_ops = {
.read_string = power_supply_hwmon_read_string,
};
static const struct hwmon_channel_info *power_supply_hwmon_info[] = {
static const struct hwmon_channel_info * const power_supply_hwmon_info[] = {
HWMON_CHANNEL_INFO(temp,
HWMON_T_LABEL |
HWMON_T_INPUT |
......
This diff is collapsed.
......@@ -1134,7 +1134,7 @@ static int rk817_charger_probe(struct platform_device *pdev)
&bat_info);
if (ret) {
return dev_err_probe(dev, ret,
"Unable to get battery info: %d\n", ret);
"Unable to get battery info\n");
}
if ((bat_info->charge_full_design_uah <= 0) ||
......
......@@ -196,7 +196,7 @@ static struct i2c_driver rt5033_battery_driver = {
.name = "rt5033-battery",
.of_match_table = rt5033_battery_of_match,
},
.probe_new = rt5033_battery_probe,
.probe = rt5033_battery_probe,
.remove = rt5033_battery_remove,
.id_table = rt5033_battery_id,
};
......
......@@ -1737,7 +1737,7 @@ MODULE_DEVICE_TABLE(acpi, rt9455_i2c_acpi_match);
#endif
static struct i2c_driver rt9455_driver = {
.probe_new = rt9455_probe,
.probe = rt9455_probe,
.remove = rt9455_remove,
.id_table = rt9455_i2c_id_table,
.driver = {
......
......@@ -1192,7 +1192,7 @@ static int rt9467_charger_probe(struct i2c_client *i2c)
i2c_set_clientdata(i2c, data);
/* Default pull charge enable gpio to make 'CHG_EN' by SW control only */
ceb_gpio = devm_gpiod_get_optional(dev, "charge-enable", GPIOD_OUT_LOW);
ceb_gpio = devm_gpiod_get_optional(dev, "charge-enable", GPIOD_OUT_HIGH);
if (IS_ERR(ceb_gpio))
return dev_err_probe(dev, PTR_ERR(ceb_gpio),
"Failed to config charge enable gpio\n");
......@@ -1272,7 +1272,7 @@ static struct i2c_driver rt9467_charger_driver = {
.name = "rt9467-charger",
.of_match_table = rt9467_charger_of_match_table,
},
.probe_new = rt9467_charger_probe,
.probe = rt9467_charger_probe,
};
module_i2c_driver(rt9467_charger_driver);
......
......@@ -919,7 +919,7 @@ static struct i2c_driver rt9471_driver = {
.name = "rt9471",
.of_match_table = rt9471_of_device_id,
},
.probe_new = rt9471_probe,
.probe = rt9471_probe,
.shutdown = rt9471_shutdown,
};
module_i2c_driver(rt9471_driver);
......
......@@ -1275,7 +1275,7 @@ static const struct of_device_id sbs_dt_ids[] = {
MODULE_DEVICE_TABLE(of, sbs_dt_ids);
static struct i2c_driver sbs_battery_driver = {
.probe_new = sbs_probe,
.probe = sbs_probe,
.alert = sbs_alert,
.id_table = sbs_id,
.driver = {
......
......@@ -240,7 +240,7 @@ static const struct i2c_device_id sbs_id[] = {
MODULE_DEVICE_TABLE(i2c, sbs_id);
static struct i2c_driver sbs_driver = {
.probe_new = sbs_probe,
.probe = sbs_probe,
.id_table = sbs_id,
.driver = {
.name = "sbs-charger",
......
......@@ -409,7 +409,7 @@ static struct i2c_driver sbsm_driver = {
.name = "sbsm",
.of_match_table = of_match_ptr(sbsm_dt_ids),
},
.probe_new = sbsm_probe,
.probe = sbsm_probe,
.alert = sbsm_alert,
.id_table = sbsm_ids
};
......
......@@ -1629,7 +1629,7 @@ static struct i2c_driver smb347_driver = {
.name = "smb347",
.of_match_table = smb3xx_of_match,
},
.probe_new = smb347_probe,
.probe = smb347_probe,
.remove = smb347_remove,
.shutdown = smb347_shutdown,
.id_table = smb347_id,
......
......@@ -168,19 +168,13 @@ static int twl4030_madc_bat_get_property(struct power_supply *psy,
return 0;
}
static void twl4030_madc_bat_ext_changed(struct power_supply *psy)
{
power_supply_changed(psy);
}
static const struct power_supply_desc twl4030_madc_bat_desc = {
.name = "twl4030_battery",
.type = POWER_SUPPLY_TYPE_BATTERY,
.properties = twl4030_madc_bat_props,
.num_properties = ARRAY_SIZE(twl4030_madc_bat_props),
.get_property = twl4030_madc_bat_get_property,
.external_power_changed = twl4030_madc_bat_ext_changed,
.external_power_changed = power_supply_changed,
};
static int twl4030_cmp(const void *a, const void *b)
......
......@@ -680,7 +680,7 @@ static struct i2c_driver ucs1002_driver = {
.name = "ucs1002",
.of_match_table = ucs1002_of_match,
},
.probe_new = ucs1002_probe,
.probe = ucs1002_probe,
};
module_i2c_driver(ucs1002_driver);
......
......@@ -476,7 +476,7 @@ static struct i2c_driver ug3105_i2c_driver = {
.name = "ug3105",
.pm = &ug3105_pm_ops,
},
.probe_new = ug3105_probe,
.probe = ug3105_probe,
.id_table = ug3105_id,
};
module_i2c_driver(ug3105_i2c_driver);
......
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