[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1643970842-2364-1-git-send-email-kyarlagadda@nvidia.com>
Date: Fri, 4 Feb 2022 16:04:02 +0530
From: Krishna Yarlagadda <kyarlagadda@...dia.com>
To: <p.zabel@...gutronix.de>, <linux-kernel@...r.kernel.org>,
<thierry.reding@...il.com>
CC: Krishna Yarlagadda <kyarlagadda@...dia.com>
Subject: [PATCH] reset: ACPI reset support
Some of the IO devices like I2C or SPI require reset at runtime to
recover from an error condition without changing the power state of
the system. Added check for ACPI handle and a call to method '__RST'
if supported. Devices using device tree method are unaffected by this.
Signed-off-by: Krishna Yarlagadda <kyarlagadda@...dia.com>
---
drivers/reset/core.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 61e6888..e4fb533 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -12,6 +12,7 @@
#include <linux/kref.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/acpi.h>
#include <linux/reset.h>
#include <linux/reset-controller.h>
#include <linux/slab.h>
@@ -1107,6 +1108,11 @@ int __device_reset(struct device *dev, bool optional)
struct reset_control *rstc;
int ret;
+ acpi_handle handle = ACPI_HANDLE(dev);
+
+ if (handle)
+ return acpi_evaluate_object(handle, "_RST", NULL, NULL);
+
rstc = __reset_control_get(dev, NULL, 0, 0, optional, true);
if (IS_ERR(rstc))
return PTR_ERR(rstc);
--
2.7.4
Powered by blists - more mailing lists