mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: - Improve support for TI bq20z75 in sbs-battery - Add Qualcomm PM8xxx reboot driver - Add cros-ec USBPD charger driver - Move ds2760 battery driver from w1 to power-supply and add DT support - Misc fixes * tag 'for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (28 commits) power: supply: bq27xxx: Update comments power: supply: max77693_charger: fix unintentional fall-through power: supply: mark expected switch fall-throughs power: supply: lego_ev3_battery: fix Vce offset power: supply: lego_ev3_battery: Don't ignore iio_read_channel_processed() return value power: supply: ds2760_battery: add devicetree probing power: supply: ds2760_battery: merge ds2760 supply driver with its w1 slave companion w1: core: match sub-nodes of bus masters in devicetree dt-bindings: w1: document bindings for ds2760 battery monitor dt-bindings: w1: document generic onewire bindings power: supply: adp5061: Fix a couple off by ones dt-bindings: power: reset: qcom: Add resin binding adp5061: New driver for ADP5061 I2C battery charger power: generic-adc-battery: check for duplicate properties copied from iio channels power: generic-adc-battery: fix out-of-bounds write when copying channel properties power: supply: axp288_charger: Fix initial constant_charge_current value power: supply: ab8500: stop using getnstimeofday64() power: gemini-poweroff: Avoid more spurious poweroffs power: vexpress: fix corruption in notifier registration power: remove possible deadlock when unregistering power_supply ...
This commit is contained in:
commit
c1fecabecc
36 files changed
+1931
-408
No files matched your search
@@ -0,0 +1,45 @@
|
||||
Qualcomm PON Device
|
||||
|
||||
The Power On device for Qualcomm PM8xxx is MFD supporting pwrkey
|
||||
and resin along with the Android reboot-mode.
|
||||
|
||||
This DT node has pwrkey and resin as sub nodes.
|
||||
|
||||
Required Properties:
|
||||
-compatible: "qcom,pm8916-pon"
|
||||
-reg: Specifies the physical address of the pon register
|
||||
|
||||
Optional subnode:
|
||||
-pwrkey: Specifies the subnode pwrkey and should follow the
|
||||
qcom,pm8941-pwrkey.txt description.
|
||||
-resin: Specifies the subnode resin and should follow the
|
||||
qcom,pm8xxx-pwrkey.txt description.
|
||||
|
||||
The rest of the properties should follow the generic reboot-mode description
|
||||
found in reboot-mode.txt
|
||||
|
||||
Example:
|
||||
|
||||
pon@800 {
|
||||
compatible = "qcom,pm8916-pon";
|
||||
|
||||
reg = <0x800>;
|
||||
mode-bootloader = <0x2>;
|
||||
mode-recovery = <0x1>;
|
||||
|
||||
pwrkey {
|
||||
compatible = "qcom,pm8941-pwrkey";
|
||||
interrupts = <0x0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
|
||||
debounce = <15625>;
|
||||
bias-pull-up;
|
||||
linux,code = <KEY_POWER>;
|
||||
};
|
||||
|
||||
resin {
|
||||
compatible = "qcom,pm8941-resin";
|
||||
interrupts = <0x0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
|
||||
debounce = <15625>;
|
||||
bias-pull-up;
|
||||
linux,code = <KEY_VOLUMEDOWN>;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
Devicetree bindings for Maxim DS2760
|
||||
====================================
|
||||
|
||||
The ds2760 is a w1 slave device and must hence have its sub-node in DT
|
||||
under a w1 bus master node.
|
||||
|
||||
The device exposes a power supply, so the details described in
|
||||
Documentation/devicetree/bindings/power/supply/power_supply.txt apply.
|
||||
|
||||
Required properties:
|
||||
- compatible: must be "maxim,ds2760"
|
||||
|
||||
Optional properties:
|
||||
- power-supplies: Refers to one or more power supplies connected to
|
||||
this battery.
|
||||
- maxim,pmod-enabled: This boolean property enables the DS2760 to enter
|
||||
sleep mode when the DQ line goes low for greater
|
||||
than 2 seconds and leave sleep Mode when the DQ
|
||||
line goes high.
|
||||
- maxim,cache-time-ms: Time im milliseconds to cache the data for. When
|
||||
this time expires, the values are read again from
|
||||
the hardware. Defaults to 1000.
|
||||
- rated-capacity-microamp-hours:
|
||||
The rated capacity of the battery, in mAh.
|
||||
If not specified, the value stored in the
|
||||
non-volatile chip memory is used.
|
||||
@@ -2,7 +2,11 @@ SBS sbs-battery
|
||||
~~~~~~~~~~
|
||||
|
||||
Required properties :
|
||||
- compatible : "sbs,sbs-battery"
|
||||
- compatible: "<vendor>,<part-number>", "sbs,sbs-battery" as fallback. The
|
||||
part number compatible string might be used in order to take care of
|
||||
vendor specific registers.
|
||||
Known <vendor>,<part-number>:
|
||||
ti,bq20z75
|
||||
|
||||
Optional properties :
|
||||
- sbs,i2c-retry-count : The number of times to retry i2c transactions on i2c
|
||||
@@ -14,9 +18,9 @@ Optional properties :
|
||||
|
||||
Example:
|
||||
|
||||
bq20z75@b {
|
||||
compatible = "sbs,sbs-battery";
|
||||
reg = < 0xb >;
|
||||
battery@b {
|
||||
compatible = "ti,bq20z75", "sbs,sbs-battery";
|
||||
reg = <0xb>;
|
||||
sbs,i2c-retry-count = <2>;
|
||||
sbs,poll-retry-count = <10>;
|
||||
sbs,battery-detect-gpios = <&gpio-controller 122 1>;
|
||||
|
||||
@@ -13,10 +13,15 @@ Optional properties:
|
||||
- linux,open-drain: if specified, the data pin is considered in
|
||||
open-drain mode.
|
||||
|
||||
Also refer to the generic w1.txt document.
|
||||
|
||||
Examples:
|
||||
|
||||
onewire {
|
||||
compatible = "w1-gpio";
|
||||
gpios = <&gpio 126 0>, <&gpio 105 0>;
|
||||
};
|
||||
gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
|
||||
|
||||
battery {
|
||||
// ...
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
Generic devicetree bindings for onewire (w1) busses
|
||||
===================================================
|
||||
|
||||
Onewire busses are described through nodes of their master bus controller.
|
||||
Slave devices are listed as sub-nodes of such master devices. For now, only
|
||||
one slave is allowed per bus master.
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
charger: charger {
|
||||
compatible = "gpio-charger";
|
||||
charger-type = "mains";
|
||||
gpios = <&gpio 1 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
|
||||
onewire {
|
||||
compatible = "w1-gpio";
|
||||
gpios = <&gpio 100 0>, <&gpio 101 0>;
|
||||
|
||||
battery {
|
||||
compatible = "maxim,ds2760";
|
||||
power-supplies = <&charger>;
|
||||
};
|
||||
};
|
||||
@@ -842,6 +842,13 @@ S: Supported
|
||||
F: drivers/mux/adgs1408.c
|
||||
F: Documentation/devicetree/bindings/mux/adgs1408.txt
|
||||
|
||||
ANALOG DEVICES INC ADP5061 DRIVER
|
||||
M: Stefan Popa <stefan.popa@analog.com>
|
||||
L: linux-pm@vger.kernel.org
|
||||
W: http://ez.analog.com/community/linux-device-drivers
|
||||
S: Supported
|
||||
F: drivers/power/supply/adp5061.c
|
||||
|
||||
ANALOG DEVICES INC ADV7180 DRIVER
|
||||
M: Lars-Peter Clausen <lars@metafoo.de>
|
||||
L: linux-media@vger.kernel.org
|
||||
|
||||
@@ -104,6 +104,17 @@ config POWER_RESET_MSM
|
||||
help
|
||||
Power off and restart support for Qualcomm boards.
|
||||
|
||||
config POWER_RESET_QCOM_PON
|
||||
tristate "Qualcomm power-on driver"
|
||||
depends on ARCH_QCOM
|
||||
depends on MFD_SPMI_PMIC
|
||||
select REBOOT_MODE
|
||||
help
|
||||
Power On support for Qualcomm boards.
|
||||
If you have a Qualcomm platform and need support for
|
||||
power-on and reboot reason, Say Y.
|
||||
If unsure, Say N.
|
||||
|
||||
config POWER_RESET_OCELOT_RESET
|
||||
bool "Microsemi Ocelot reset driver"
|
||||
depends on MSCC_OCELOT || COMPILE_TEST
|
||||
|
||||
@@ -11,6 +11,7 @@ obj-$(CONFIG_POWER_RESET_GPIO) += gpio-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_GPIO_RESTART) += gpio-restart.o
|
||||
obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
|
||||
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o
|
||||
obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o
|
||||
obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o
|
||||
obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o
|
||||
|
||||
@@ -130,7 +130,17 @@ static int gemini_poweroff_probe(struct platform_device *pdev)
|
||||
val |= GEMINI_CTRL_ENABLE;
|
||||
writel(val, gpw->base + GEMINI_PWC_CTRLREG);
|
||||
|
||||
/* Now that the state machine is active, clear the IRQ */
|
||||
/* Clear the IRQ */
|
||||
val = readl(gpw->base + GEMINI_PWC_CTRLREG);
|
||||
val |= GEMINI_CTRL_IRQ_CLR;
|
||||
writel(val, gpw->base + GEMINI_PWC_CTRLREG);
|
||||
|
||||
/* Wait for this to clear */
|
||||
val = readl(gpw->base + GEMINI_PWC_STATREG);
|
||||
while (val & 0x70U)
|
||||
val = readl(gpw->base + GEMINI_PWC_STATREG);
|
||||
|
||||
/* Clear the IRQ again */
|
||||
val = readl(gpw->base + GEMINI_PWC_CTRLREG);
|
||||
val |= GEMINI_CTRL_IRQ_CLR;
|
||||
writel(val, gpw->base + GEMINI_PWC_CTRLREG);
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (c) 2017-18 Linaro Limited
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/reboot-mode.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#define PON_SOFT_RB_SPARE 0x8f
|
||||
|
||||
struct pm8916_pon {
|
||||
struct device *dev;
|
||||
struct regmap *regmap;
|
||||
u32 baseaddr;
|
||||
struct reboot_mode_driver reboot_mode;
|
||||
};
|
||||
|
||||
static int pm8916_reboot_mode_write(struct reboot_mode_driver *reboot,
|
||||
unsigned int magic)
|
||||
{
|
||||
struct pm8916_pon *pon = container_of
|
||||
(reboot, struct pm8916_pon, reboot_mode);
|
||||
int ret;
|
||||
|
||||
ret = regmap_update_bits(pon->regmap,
|
||||
pon->baseaddr + PON_SOFT_RB_SPARE,
|
||||
0xfc, magic << 2);
|
||||
if (ret < 0)
|
||||
dev_err(pon->dev, "update reboot mode bits failed\n");
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pm8916_pon_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct pm8916_pon *pon;
|
||||
int error;
|
||||
|
||||
pon = devm_kzalloc(&pdev->dev, sizeof(*pon), GFP_KERNEL);
|
||||
if (!pon)
|
||||
return -ENOMEM;
|
||||
|
||||
pon->dev = &pdev->dev;
|
||||
|
||||
pon->regmap = dev_get_regmap(pdev->dev.parent, NULL);
|
||||
if (!pon->regmap) {
|
||||
dev_err(&pdev->dev, "failed to locate regmap\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
error = of_property_read_u32(pdev->dev.of_node, "reg",
|
||||
&pon->baseaddr);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
pon->reboot_mode.dev = &pdev->dev;
|
||||
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);
|
||||
|
||||
return devm_of_platform_populate(&pdev->dev);
|
||||
}
|
||||
|
||||
static const struct of_device_id pm8916_pon_id_table[] = {
|
||||
{ .compatible = "qcom,pm8916-pon" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, pm8916_pon_id_table);
|
||||
|
||||
static struct platform_driver pm8916_pon_driver = {
|
||||
.probe = pm8916_pon_probe,
|
||||
.driver = {
|
||||
.name = "pm8916-pon",
|
||||
.of_match_table = of_match_ptr(pm8916_pon_id_table),
|
||||
},
|
||||
};
|
||||
module_platform_driver(pm8916_pon_driver);
|
||||
|
||||
MODULE_DESCRIPTION("pm8916 Power On driver");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
@@ -35,6 +35,7 @@ static void vexpress_reset_do(struct device *dev, const char *what)
|
||||
}
|
||||
|
||||
static struct device *vexpress_power_off_device;
|
||||
static atomic_t vexpress_restart_nb_refcnt = ATOMIC_INIT(0);
|
||||
|
||||
static void vexpress_power_off(void)
|
||||
{
|
||||
@@ -99,10 +100,13 @@ static int _vexpress_register_restart_handler(struct device *dev)
|
||||
int err;
|
||||
|
||||
vexpress_restart_device = dev;
|
||||
err = register_restart_handler(&vexpress_restart_nb);
|
||||
if (err) {
|
||||
dev_err(dev, "cannot register restart handler (err=%d)\n", err);
|
||||
return err;
|
||||
if (atomic_inc_return(&vexpress_restart_nb_refcnt) == 1) {
|
||||
err = register_restart_handler(&vexpress_restart_nb);
|
||||
if (err) {
|
||||
dev_err(dev, "cannot register restart handler (err=%d)\n", err);
|
||||
atomic_dec(&vexpress_restart_nb_refcnt);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
device_create_file(dev, &dev_attr_active);
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ static int zx_reboot_probe(struct platform_device *pdev)
|
||||
|
||||
np = of_find_compatible_node(NULL, NULL, "zte,zx296702-pcu");
|
||||
pcu_base = of_iomap(np, 0);
|
||||
of_node_put(np);
|
||||
if (!pcu_base) {
|
||||
iounmap(base);
|
||||
WARN(1, "failed to map pcu_base address");
|
||||
|
||||
@@ -75,6 +75,17 @@ config BATTERY_88PM860X
|
||||
help
|
||||
Say Y here to enable battery monitor for Marvell 88PM860x chip.
|
||||
|
||||
config CHARGER_ADP5061
|
||||
tristate "ADP5061 battery charger driver"
|
||||
depends on I2C
|
||||
select REGMAP_I2C
|
||||
help
|
||||
Say Y here to enable support for the ADP5061 standalone battery
|
||||
charger.
|
||||
|
||||
This driver can be built as a module. If so, the module will be
|
||||
called adp5061.
|
||||
|
||||
config BATTERY_ACT8945A
|
||||
tristate "Active-semi ACT8945A charger driver"
|
||||
depends on MFD_ACT8945A || COMPILE_TEST
|
||||
@@ -92,7 +103,7 @@ config BATTERY_CPCAP
|
||||
|
||||
config BATTERY_DS2760
|
||||
tristate "DS2760 battery driver (HP iPAQ & others)"
|
||||
depends on W1 && W1_SLAVE_DS2760
|
||||
depends on W1
|
||||
help
|
||||
Say Y here to enable support for batteries with ds2760 chip.
|
||||
|
||||
@@ -624,4 +635,14 @@ config CHARGER_RT9455
|
||||
help
|
||||
Say Y to enable support for Richtek RT9455 battery charger.
|
||||
|
||||
config CHARGER_CROS_USBPD
|
||||
tristate "ChromeOS EC based USBPD charger"
|
||||
depends on MFD_CROS_EC
|
||||
default n
|
||||
help
|
||||
Say Y here to enable ChromeOS EC based USBPD charger
|
||||
driver. This driver gets various bits of information about
|
||||
what is connected to USB PD ports from the EC and converts
|
||||
that into power_supply properties.
|
||||
|
||||
endif # POWER_SUPPLY
|
||||
@@ -18,6 +18,7 @@ obj-$(CONFIG_WM8350_POWER) += wm8350_power.o
|
||||
obj-$(CONFIG_TEST_POWER) += test_power.o
|
||||
|
||||
obj-$(CONFIG_BATTERY_88PM860X) += 88pm860x_battery.o
|
||||
obj-$(CONFIG_CHARGER_ADP5061) += adp5061.o
|
||||
obj-$(CONFIG_BATTERY_ACT8945A) += act8945a_charger.o
|
||||
obj-$(CONFIG_BATTERY_AXP20X) += axp20x_battery.o
|
||||
obj-$(CONFIG_CHARGER_AXP20X) += axp20x_ac_power.o
|
||||
@@ -83,3 +84,4 @@ obj-$(CONFIG_CHARGER_TPS65090) += tps65090-charger.o
|
||||
obj-$(CONFIG_CHARGER_TPS65217) += tps65217_charger.o
|
||||
obj-$(CONFIG_AXP288_FUEL_GAUGE) += axp288_fuel_gauge.o
|
||||
obj-$(CONFIG_AXP288_CHARGER) += axp288_charger.o
|
||||
obj-$(CONFIG_CHARGER_CROS_USBPD) += cros_usbpd-charger.o
|
||||
@@ -379,15 +379,13 @@ static int ab8500_fg_is_low_curr(struct ab8500_fg *di, int curr)
|
||||
*/
|
||||
static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample)
|
||||
{
|
||||
struct timespec64 ts64;
|
||||
time64_t now = ktime_get_boottime_seconds();
|
||||
struct ab8500_fg_avg_cap *avg = &di->avg_cap;
|
||||
|
||||
getnstimeofday64(&ts64);
|
||||
|
||||
do {
|
||||
avg->sum += sample - avg->samples[avg->pos];
|
||||
avg->samples[avg->pos] = sample;
|
||||
avg->time_stamps[avg->pos] = ts64.tv_sec;
|
||||
avg->time_stamps[avg->pos] = now;
|
||||
avg->pos++;
|
||||
|
||||
if (avg->pos == NBR_AVG_SAMPLES)
|
||||
@@ -400,7 +398,7 @@ static int ab8500_fg_add_cap_sample(struct ab8500_fg *di, int sample)
|
||||
* Check the time stamp for each sample. If too old,
|
||||
* replace with latest sample
|
||||
*/
|
||||
} while (ts64.tv_sec - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]);
|
||||
} while (now - VALID_CAPACITY_SEC > avg->time_stamps[avg->pos]);
|
||||
|
||||
avg->avg = avg->sum / avg->nbr_samples;
|
||||
|
||||
@@ -439,14 +437,14 @@ static void ab8500_fg_clear_cap_samples(struct ab8500_fg *di)
|
||||
static void ab8500_fg_fill_cap_sample(struct ab8500_fg *di, int sample)
|
||||
{
|
||||
int i;
|
||||
struct timespec64 ts64;
|
||||
time64_t now;
|
||||
struct ab8500_fg_avg_cap *avg = &di->avg_cap;
|
||||
|
||||
getnstimeofday64(&ts64);
|
||||
now = ktime_get_boottime_seconds();
|
||||
|
||||
for (i = 0; i < NBR_AVG_SAMPLES; i++) {
|
||||
avg->samples[i] = sample;
|
||||
avg->time_stamps[i] = ts64.tv_sec;
|
||||
avg->time_stamps[i] = now;
|
||||
}
|
||||
|
||||
avg->pos = 0;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -222,6 +222,7 @@ static int axp20x_usb_power_set_current_max(struct axp20x_usb_power *power,
|
||||
case 100000:
|
||||
if (power->axp20x_id == AXP221_ID)
|
||||
return -EINVAL;
|
||||
/* fall through */
|
||||
case 500000:
|
||||
case 900000:
|
||||
val = (900000 - intval) / 400000;
|
||||
|
||||
@@ -718,7 +718,7 @@ static int charger_init_hw_regs(struct axp288_chrg_info *info)
|
||||
}
|
||||
|
||||
/* Determine charge current limit */
|
||||
cc = (ret & CHRG_CCCV_CC_MASK) >> CHRG_CCCV_CC_BIT_POS;
|
||||
cc = (val & CHRG_CCCV_CC_MASK) >> CHRG_CCCV_CC_BIT_POS;
|
||||
cc = (cc * CHRG_CCCV_CC_LSB_RES) + CHRG_CCCV_CC_OFFSET;
|
||||
info->cc = cc;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
* http://www.ti.com/product/bq27510-g1
|
||||
* http://www.ti.com/product/bq27510-g2
|
||||
* http://www.ti.com/product/bq27510-g3
|
||||
* http://www.ti.com/product/bq27520-g4
|
||||
* http://www.ti.com/product/bq27520-g1
|
||||
* http://www.ti.com/product/bq27520-g2
|
||||
* http://www.ti.com/product/bq27520-g3
|
||||
@@ -40,7 +39,9 @@
|
||||
* http://www.ti.com/product/bq27545-g1
|
||||
* http://www.ti.com/product/bq27421-g1
|
||||
* http://www.ti.com/product/bq27425-g1
|
||||
* http://www.ti.com/product/bq27426
|
||||
* http://www.ti.com/product/bq27411-g1
|
||||
* http://www.ti.com/product/bq27441-g1
|
||||
* http://www.ti.com/product/bq27621-g1
|
||||
*/
|
||||
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
Loaded 20 of 36 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user