Skip to contentSkip to conversation

power: reset: at91-reset: add sysfs interface to the power on reason

PATCH Superseded Kamel Bouhara 1 participant 1 message Dec 9, 2019

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 power: reset: at91-reset: add sysfs interface to the power on reason

This patch export the power on reason through the sysfs interface and introduce some generic reset sources.
Update the ABI documentation to list current power on sources.

---
Changes in v2
=============
- Be less specific on the crystal oscillator value
- Add an Acked-by

 .../sysfs-devices-platform-power-on-reason    | 14 ++++++
 drivers/power/reset/at91-reset.c              | 44 +++++++++++++------
 include/linux/power/power_on_reason.h         | 19 ++++++++
 3 files changed, 64 insertions(+), 13 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-devices-platform-power-on-reason
 create mode 100644 include/linux/power/power_on_reason.h
Documentation/ABI/testing/sysfs-devices-platform-power-on-reason new file +14 -0
new file mode 100644
index 000000000000..83daeb9b1aa2
@@ -0,0 +1,14 @@
+What:		/sys/devices/platform/.../power_on_reason
+
+Date:		October 2019
+KernelVersion:	5.4
+Contact:	Kamel Bouhara <[email protected]>
+Description:	This file shows system power on reason.
+		The possible sources are:
+		General System Power-ON, RTC wakeup, Watchdog timeout,
+		Software Reset, User pressed reset button,
+		CPU Clock failure, 32.768kHz Oscillator Failure,
+		Low power mode exit, Unknown.
+
+		The file is read only.
+
drivers/power/reset/at91-reset.c +31 -13

93 lines not on this page · raw message

include/linux/power/power_on_reason.h new file +19 -0
new file mode 100644
index 000000000000..9978cc757427
@@ -0,0 +1,19 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Author: Kamel Bouhra <[email protected]>
+ */
+
+#ifndef POWER_ON_REASON_H
+#define POWER_ON_REASON_H
+
+#define POWER_ON_REASON_GENERAL "General"
+#define POWER_ON_REASON_RTC "RTC wakeup"
+#define POWER_ON_REASON_WATCHDOG "Watchdog timeout"
+#define POWER_ON_REASON_SOFTWARE "Software"
+#define POWER_ON_REASON_USER "User"
+#define POWER_ON_REASON_CPU_FAIL "CPU Clock Failure"
+#define POWER_ON_REASON_XTAL_FAIL "32.768k Crystal oscillator Failure"
+#define POWER_ON_REASON_LOW_POWER "Low power exit"
+#define POWER_ON_REASON_UNKNOWN "Unknown"
+
+#endif /* POWER_ON_REASON_H */

--
2.24.0

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel