Skip to content

Commit b547f9b

Browse files
committed
Merge tag 'for-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply
Pull power supply and reset updates from Sebastian Reichel: - core: avoid duplicate hwmon device from thermal framework - convert multiple drivers to devm_platform_ioremap_resource - at91-reset: add sysfs interface to the power on reason - misc small fixes and improvements * tag 'for-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: power: supply: qcom_pmi8998_charger: fix charger status power: supply: qcom_pmi8998_charger: remove CHARGE_CONTROL_LIMIT_* props power: supply: qcom_pmi8998_charger: fix uninitialized variable power: reset: oxnas-restart: remove obsolete restart driver power: supply: core: Avoid duplicate hwmon device from thermal framework power: reset: ocelot: Convert to devm_platform_ioremap_resource() power: reset: msm: Convert to devm_platform_ioremap_resource() power: reset: gemini-poweroff: Convert to devm_platform_ioremap_resource() power: reset: brcm-kona: Convert to devm_platform_ioremap_resource() power: reset: at91-sama5d2_shdwc: Convert to devm_platform_ioremap_resource() power: reset: at91-poweroff: Convert to devm_platform_ioremap_resource() power: reset: at91-reset: add sysfs interface to the power on reason power: supply: bd99954: make read-only array sub_status_reg power: supply: bq24190: Considers FORCE_20PCT when getting IPRECHG power: Explicitly include correct DT includes
2 parents 5ea0cf7 + 7e6311f commit b547f9b

Some content is hidden

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

44 files changed

+114
-321
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
What: /sys/devices/platform/.../power_on_reason
2+
Date: June 2023
3+
KernelVersion: 6.5
4+
Contact: Kamel Bouhara <[email protected]>
5+
Description: Shows system power on reason. The following strings/reasons can
6+
be read (the list can be extended):
7+
"regular power-up", "RTC wakeup", "watchdog timeout",
8+
"software reset", "reset button action", "CPU clock failure",
9+
"crystal oscillator failure", "brown-out reset",
10+
"unknown reason".
11+
12+
The file is read only.

drivers/power/reset/Kconfig

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,6 @@ config POWER_RESET_ODROID_GO_ULTRA_POWEROFF
148148
help
149149
This driver supports Power off for Odroid Go Ultra device.
150150

151-
config POWER_RESET_OXNAS
152-
bool "OXNAS SoC restart driver"
153-
depends on ARCH_OXNAS
154-
default MACH_OX820
155-
help
156-
Restart support for OXNAS/PLXTECH OX820 SoC.
157-
158151
config POWER_RESET_PIIX4_POWEROFF
159152
tristate "Intel PIIX4 power-off driver"
160153
depends on PCI

drivers/power/reset/Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ obj-$(CONFIG_POWER_RESET_HISI) += hisi-reboot.o
1414
obj-$(CONFIG_POWER_RESET_LINKSTATION) += linkstation-poweroff.o
1515
obj-$(CONFIG_POWER_RESET_MSM) += msm-poweroff.o
1616
obj-$(CONFIG_POWER_RESET_MT6323) += mt6323-poweroff.o
17-
obj-$(CONFIG_POWER_RESET_OXNAS) += oxnas-restart.o
1817
obj-$(CONFIG_POWER_RESET_QCOM_PON) += qcom-pon.o
1918
obj-$(CONFIG_POWER_RESET_OCELOT_RESET) += ocelot-reset.o
2019
obj-$(CONFIG_POWER_RESET_ODROID_GO_ULTRA_POWEROFF) += odroid-go-ultra-poweroff.o

drivers/power/reset/as3722-poweroff.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <linux/mfd/as3722.h>
1111
#include <linux/module.h>
1212
#include <linux/of.h>
13-
#include <linux/of_device.h>
1413
#include <linux/platform_device.h>
1514
#include <linux/slab.h>
1615

drivers/power/reset/at91-poweroff.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,11 @@ static void at91_poweroff_dt_set_wakeup_mode(struct platform_device *pdev)
151151

152152
static int __init at91_poweroff_probe(struct platform_device *pdev)
153153
{
154-
struct resource *res;
155154
struct device_node *np;
156155
u32 ddr_type;
157156
int ret;
158157

159-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
160-
at91_shdwc.shdwc_base = devm_ioremap_resource(&pdev->dev, res);
158+
at91_shdwc.shdwc_base = devm_platform_ioremap_resource(pdev, 0);
161159
if (IS_ERR(at91_shdwc.shdwc_base))
162160
return PTR_ERR(at91_shdwc.shdwc_base);
163161

drivers/power/reset/at91-reset.c

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/platform_device.h>
1919
#include <linux/reboot.h>
2020
#include <linux/reset-controller.h>
21+
#include <linux/power/power_on_reason.h>
2122

2223
#include <soc/at91/at91sam9_ddrsdr.h>
2324
#include <soc/at91/at91sam9_sdramc.h>
@@ -149,44 +150,54 @@ static int at91_reset(struct notifier_block *this, unsigned long mode,
149150
return NOTIFY_DONE;
150151
}
151152

152-
static const char * __init at91_reset_reason(struct at91_reset *reset)
153+
static const char *at91_reset_reason(struct at91_reset *reset)
153154
{
154155
u32 reg = readl(reset->rstc_base + AT91_RSTC_SR);
155156
const char *reason;
156157

157158
switch ((reg & AT91_RSTC_RSTTYP) >> 8) {
158159
case RESET_TYPE_GENERAL:
159-
reason = "general reset";
160+
reason = POWER_ON_REASON_REGULAR;
160161
break;
161162
case RESET_TYPE_WAKEUP:
162-
reason = "wakeup";
163+
reason = POWER_ON_REASON_RTC;
163164
break;
164165
case RESET_TYPE_WATCHDOG:
165-
reason = "watchdog reset";
166+
reason = POWER_ON_REASON_WATCHDOG;
166167
break;
167168
case RESET_TYPE_SOFTWARE:
168-
reason = "software reset";
169+
reason = POWER_ON_REASON_SOFTWARE;
169170
break;
170171
case RESET_TYPE_USER:
171-
reason = "user reset";
172+
reason = POWER_ON_REASON_RST_BTN;
172173
break;
173174
case RESET_TYPE_CPU_FAIL:
174-
reason = "CPU clock failure detection";
175+
reason = POWER_ON_REASON_CPU_CLK_FAIL;
175176
break;
176177
case RESET_TYPE_XTAL_FAIL:
177-
reason = "32.768 kHz crystal failure detection";
178+
reason = POWER_ON_REASON_XTAL_FAIL;
178179
break;
179180
case RESET_TYPE_ULP2:
180-
reason = "ULP2 reset";
181+
reason = POWER_ON_REASON_BROWN_OUT;
181182
break;
182183
default:
183-
reason = "unknown reset";
184+
reason = POWER_ON_REASON_UNKNOWN;
184185
break;
185186
}
186187

187188
return reason;
188189
}
189190

191+
static ssize_t power_on_reason_show(struct device *dev,
192+
struct device_attribute *attr, char *buf)
193+
{
194+
struct platform_device *pdev = to_platform_device(dev);
195+
struct at91_reset *reset = platform_get_drvdata(pdev);
196+
197+
return sprintf(buf, "%s\n", at91_reset_reason(reset));
198+
}
199+
static DEVICE_ATTR_RO(power_on_reason);
200+
190201
static const struct of_device_id at91_ramc_of_match[] = {
191202
{
192203
.compatible = "atmel,at91sam9260-sdramc",
@@ -391,6 +402,12 @@ static int __init at91_reset_probe(struct platform_device *pdev)
391402
if (ret)
392403
goto disable_clk;
393404

405+
ret = device_create_file(&pdev->dev, &dev_attr_power_on_reason);
406+
if (ret) {
407+
dev_err(&pdev->dev, "Could not create sysfs entry\n");
408+
return ret;
409+
}
410+
394411
dev_info(&pdev->dev, "Starting after %s\n", at91_reset_reason(reset));
395412

396413
return 0;

drivers/power/reset/at91-sama5d2_shdwc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ static const struct of_device_id at91_pmc_ids[] = {
331331

332332
static int __init at91_shdwc_probe(struct platform_device *pdev)
333333
{
334-
struct resource *res;
335334
const struct of_device_id *match;
336335
struct device_node *np;
337336
u32 ddr_type;
@@ -349,8 +348,7 @@ static int __init at91_shdwc_probe(struct platform_device *pdev)
349348

350349
platform_set_drvdata(pdev, at91_shdwc);
351350

352-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
353-
at91_shdwc->shdwc_base = devm_ioremap_resource(&pdev->dev, res);
351+
at91_shdwc->shdwc_base = devm_platform_ioremap_resource(pdev, 0);
354352
if (IS_ERR(at91_shdwc->shdwc_base))
355353
return PTR_ERR(at91_shdwc->shdwc_base);
356354

drivers/power/reset/brcm-kona-reset.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Copyright (C) 2016 Broadcom
33

44
#include <linux/io.h>
5-
#include <linux/of_address.h>
6-
#include <linux/of_platform.h>
5+
#include <linux/mod_devicetable.h>
6+
#include <linux/platform_device.h>
77
#include <linux/reboot.h>
88

99
#define RSTMGR_REG_WR_ACCESS_OFFSET 0
@@ -38,9 +38,7 @@ static struct notifier_block kona_reset_nb = {
3838

3939
static int kona_reset_probe(struct platform_device *pdev)
4040
{
41-
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
42-
43-
kona_reset_base = devm_ioremap_resource(&pdev->dev, res);
41+
kona_reset_base = devm_platform_ioremap_resource(pdev, 0);
4442
if (IS_ERR(kona_reset_base))
4543
return PTR_ERR(kona_reset_base);
4644

drivers/power/reset/gemini-poweroff.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static void gemini_poweroff(void)
9191
static int gemini_poweroff_probe(struct platform_device *pdev)
9292
{
9393
struct device *dev = &pdev->dev;
94-
struct resource *res;
9594
struct gemini_powercon *gpw;
9695
u32 val;
9796
int irq;
@@ -101,8 +100,7 @@ static int gemini_poweroff_probe(struct platform_device *pdev)
101100
if (!gpw)
102101
return -ENOMEM;
103102

104-
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
105-
gpw->base = devm_ioremap_resource(dev, res);
103+
gpw->base = devm_platform_ioremap_resource(pdev, 0);
106104
if (IS_ERR(gpw->base))
107105
return PTR_ERR(gpw->base);
108106

drivers/power/reset/gpio-poweroff.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
#include <linux/init.h>
1212
#include <linux/delay.h>
1313
#include <linux/platform_device.h>
14+
#include <linux/property.h>
1415
#include <linux/gpio/consumer.h>
15-
#include <linux/of_platform.h>
16+
#include <linux/mod_devicetable.h>
1617
#include <linux/module.h>
1718

1819
#define DEFAULT_TIMEOUT_MS 3000

0 commit comments

Comments
 (0)