Skip to contentSkip to conversation

watchdog: sp5100_tco: Add support for get_timeleft

PATCH In review Thomas Weißschuh 2 participants 2 messages Sep 28, 2021 – Oct 2, 2021 Watchdog device drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog: sp5100_tco: Add support for get_timeleft

Tested on a Gigabyte X570 I AORUS PRO WIFI.

---
 drivers/watchdog/sp5100_tco.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/watchdog/sp5100_tco.c +9 -0
index a730ecbf78cd..dd9a744f82f8 100644
@@ -10,6 +10,7 @@
  *				https://www.kernelconcepts.de
  *
  *	See AMD Publication 43009 "AMD SB700/710/750 Register Reference Guide",
+ *	    AMD Publication 44413 "AMD SP5100 Register Reference Guide"
  *	    AMD Publication 45482 "AMD SB800-Series Southbridges Register
  *	                                                      Reference Guide"
  *	    AMD Publication 48751 "BIOS and Kernel Developer’s Guide (BKDG)
@@ -144,6 +145,13 @@ static int tco_timer_set_timeout(struct watchdog_device *wdd,
 	return 0;
 }
 
+static unsigned int tco_timer_get_timeleft(struct watchdog_device *wdd)
+{
+	struct sp5100_tco *tco = watchdog_get_drvdata(wdd);
+
+	return readl(SP5100_WDT_COUNT(tco->tcobase));
+}
+
 static u8 sp5100_tco_read_pm_reg8(u8 index)
 {
 	outb(index, SP5100_IO_PM_INDEX_REG);
@@ -386,6 +394,7 @@ static const struct watchdog_ops sp5100_tco_wdt_ops = {
 	.stop = tco_timer_stop,
 	.ping = tco_timer_ping,
 	.set_timeout = tco_timer_set_timeout,
+	.get_timeleft = tco_timer_get_timeleft,
 };
 
 static int sp5100_tco_probe(struct platform_device *pdev)

base-commit: 41e73feb1024929e75eaf2f7cd93f35a3feb331b

Signature · 1 line
2.33.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Thomas Weißschuh

Tested on a Gigabyte X570 I AORUS PRO WIFI.

Quoted 43 lines
---
 drivers/watchdog/sp5100_tco.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/watchdog/sp5100_tco.c +9 -0
index a730ecbf78cd..dd9a744f82f8 100644
@@ -10,6 +10,7 @@
  *				https://www.kernelconcepts.de
  *
  *	See AMD Publication 43009 "AMD SB700/710/750 Register Reference Guide",
+ *	    AMD Publication 44413 "AMD SP5100 Register Reference Guide"
  *	    AMD Publication 45482 "AMD SB800-Series Southbridges Register
  *	                                                      Reference Guide"
  *	    AMD Publication 48751 "BIOS and Kernel Developer’s Guide (BKDG)
@@ -144,6 +145,13 @@ static int tco_timer_set_timeout(struct watchdog_device *wdd,
 	return 0;
 }
 
+static unsigned int tco_timer_get_timeleft(struct watchdog_device *wdd)
+{
+	struct sp5100_tco *tco = watchdog_get_drvdata(wdd);
+
+	return readl(SP5100_WDT_COUNT(tco->tcobase));
+}
+
 static u8 sp5100_tco_read_pm_reg8(u8 index)
 {
 	outb(index, SP5100_IO_PM_INDEX_REG);
@@ -386,6 +394,7 @@ static const struct watchdog_ops sp5100_tco_wdt_ops = {
 	.stop = tco_timer_stop,
 	.ping = tco_timer_ping,
 	.set_timeout = tco_timer_set_timeout,
+	.get_timeleft = tco_timer_get_timeleft,
 };
 
 static int sp5100_tco_probe(struct platform_device *pdev)

base-commit: 41e73feb1024929e75eaf2f7cd93f35a3feb331b

Signature · 1 line
2.33.0