Linux Watchdog driver development
 help / color / mirror / Atom feed
* [PATCH] watchdog: it87_wdt: add support for IT8733
@ 2024-12-23 12:06 james
  2024-12-23 12:16 ` [PATCH v2] " james
  2025-01-06 16:04 ` [PATCH] " Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: james @ 2024-12-23 12:06 UTC (permalink / raw)
  To: linux-watchdog@vger.kernel.org


[-- Attachment #1.1: Type: text/plain, Size: 155 bytes --]

Add support for the IT8733 Super I/O watchdog timer.

Tested on a Lenovo ThinkCenter M93p SFF.

Signed-off-by: James Young <james@foreveryoung.id.au>

[-- Attachment #1.2: Type: text/html, Size: 1273 bytes --]

[-- Attachment #2: 0001-watchdog-it87_wdt-add-support-for-IT8733.patch --]
[-- Type: application/octet-stream, Size: 5674 bytes --]

From 2047671263067a41d76b4e0582b30cfda8c86779 Mon Sep 17 00:00:00 2001
From: James Young <james@foreveryoung.id.au>
Date: Mon, 23 Dec 2024 22:41:58 +1100
Subject: [PATCH] watchdog: it87_wdt: add support for IT8733

---
 drivers/watchdog/it87_wdt.c | 118 +++++++++++++++++++-----------------
 1 file changed, 62 insertions(+), 56 deletions(-)

diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c
index a1e23dce8810..36c8bdca4743 100644
--- a/drivers/watchdog/it87_wdt.c
+++ b/drivers/watchdog/it87_wdt.c
@@ -15,7 +15,7 @@
  *	Support of the watchdog timers, which are available on
  *	IT8607, IT8613, IT8620, IT8622, IT8625, IT8628, IT8655, IT8659,
  *	IT8665, IT8686, IT8702, IT8712, IT8716, IT8718, IT8720, IT8721,
- *	IT8726,	IT8728, IT8772, IT8783, IT8784 and IT8786.
+ *	IT8726,	IT8728, IT8733, IT8772, IT8783, IT8784 and IT8786.
  */
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
@@ -30,70 +30,71 @@
 #include <linux/types.h>
 #include <linux/watchdog.h>
 
-#define WATCHDOG_NAME		"IT87 WDT"
+#define WATCHDOG_NAME "IT87 WDT"
 
 /* Defaults for Module Parameter */
-#define DEFAULT_TIMEOUT		60
-#define DEFAULT_TESTMODE	0
-#define DEFAULT_NOWAYOUT	WATCHDOG_NOWAYOUT
+#define DEFAULT_TIMEOUT 60
+#define DEFAULT_TESTMODE 0
+#define DEFAULT_NOWAYOUT WATCHDOG_NOWAYOUT
 
 /* IO Ports */
-#define REG		0x2e
-#define VAL		0x2f
+#define REG 0x2e
+#define VAL 0x2f
 
 /* Logical device Numbers LDN */
-#define EC		0x04
-#define GPIO		0x07
+#define EC 0x04
+#define GPIO 0x07
 
 /* Configuration Registers and Functions */
-#define LDNREG		0x07
-#define CHIPID		0x20
-#define CHIPREV		0x22
+#define LDNREG 0x07
+#define CHIPID 0x20
+#define CHIPREV 0x22
 
 /* Chip Id numbers */
-#define NO_DEV_ID	0xffff
-#define IT8607_ID	0x8607
-#define IT8613_ID	0x8613
-#define IT8620_ID	0x8620
-#define IT8622_ID	0x8622
-#define IT8625_ID	0x8625
-#define IT8628_ID	0x8628
-#define IT8655_ID	0x8655
-#define IT8659_ID	0x8659
-#define IT8665_ID	0x8665
-#define IT8686_ID	0x8686
-#define IT8702_ID	0x8702
-#define IT8705_ID	0x8705
-#define IT8712_ID	0x8712
-#define IT8716_ID	0x8716
-#define IT8718_ID	0x8718
-#define IT8720_ID	0x8720
-#define IT8721_ID	0x8721
-#define IT8726_ID	0x8726	/* the data sheet suggest wrongly 0x8716 */
-#define IT8728_ID	0x8728
-#define IT8772_ID	0x8772
-#define IT8783_ID	0x8783
-#define IT8784_ID	0x8784
-#define IT8786_ID	0x8786
+#define NO_DEV_ID 0xffff
+#define IT8607_ID 0x8607
+#define IT8613_ID 0x8613
+#define IT8620_ID 0x8620
+#define IT8622_ID 0x8622
+#define IT8625_ID 0x8625
+#define IT8628_ID 0x8628
+#define IT8655_ID 0x8655
+#define IT8659_ID 0x8659
+#define IT8665_ID 0x8665
+#define IT8686_ID 0x8686
+#define IT8702_ID 0x8702
+#define IT8705_ID 0x8705
+#define IT8712_ID 0x8712
+#define IT8716_ID 0x8716
+#define IT8718_ID 0x8718
+#define IT8720_ID 0x8720
+#define IT8721_ID 0x8721
+#define IT8726_ID 0x8726 /* the data sheet suggest wrongly 0x8716 */
+#define IT8728_ID 0x8728
+#define IT8728_ID 0x8733
+#define IT8772_ID 0x8772
+#define IT8783_ID 0x8783
+#define IT8784_ID 0x8784
+#define IT8786_ID 0x8786
 
 /* Environment Controller Configuration Registers LDN=0x04 */
-#define SCR1		0xfa
+#define SCR1 0xfa
 
 /* Environment Controller Bits SCR1 */
-#define WDT_PWRGD	0x20
+#define WDT_PWRGD 0x20
 
 /* GPIO Configuration Registers LDN=0x07 */
-#define WDTCTRL		0x71
-#define WDTCFG		0x72
-#define WDTVALLSB	0x73
-#define WDTVALMSB	0x74
+#define WDTCTRL 0x71
+#define WDTCFG 0x72
+#define WDTVALLSB 0x73
+#define WDTVALMSB 0x74
 
 /* GPIO Bits WDTCFG */
-#define WDT_TOV1	0x80
-#define WDT_KRST	0x40
-#define WDT_TOVE	0x20
-#define WDT_PWROK	0x10 /* not in it8721 */
-#define WDT_INT_MASK	0x0f
+#define WDT_TOV1 0x80
+#define WDT_KRST 0x40
+#define WDT_TOVE 0x20
+#define WDT_PWROK 0x10 /* not in it8721 */
+#define WDT_INT_MASK 0x0f
 
 static unsigned int max_units, chip_type;
 
@@ -102,14 +103,18 @@ static int testmode = DEFAULT_TESTMODE;
 static bool nowayout = DEFAULT_NOWAYOUT;
 
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds, default="
-		__MODULE_STRING(DEFAULT_TIMEOUT));
+MODULE_PARM_DESC(timeout,
+		 "Watchdog timeout in seconds, default=" __MODULE_STRING(
+			 DEFAULT_TIMEOUT));
 module_param(testmode, int, 0);
-MODULE_PARM_DESC(testmode, "Watchdog test mode (1 = no reboot), default="
-		__MODULE_STRING(DEFAULT_TESTMODE));
+MODULE_PARM_DESC(testmode,
+		 "Watchdog test mode (1 = no reboot), default=" __MODULE_STRING(
+			 DEFAULT_TESTMODE));
 module_param(nowayout, bool, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started, default="
-		__MODULE_STRING(WATCHDOG_NOWAYOUT));
+MODULE_PARM_DESC(
+	nowayout,
+	"Watchdog cannot be stopped once started, default=" __MODULE_STRING(
+		WATCHDOG_NOWAYOUT));
 
 /* Superio Chip */
 
@@ -250,7 +255,7 @@ static int wdt_set_timeout(struct watchdog_device *wdd, unsigned int t)
 }
 
 enum {
-	IT87_WDT_OUTPUT_THROUGH_PWRGD	= BIT(0),
+	IT87_WDT_OUTPUT_THROUGH_PWRGD = BIT(0),
 };
 
 static const struct dmi_system_id it87_quirks[] = {
@@ -286,7 +291,7 @@ static struct watchdog_device wdt_dev = {
 static int __init it87_wdt_init(void)
 {
 	const struct dmi_system_id *dmi_id;
-	u8  chip_rev;
+	u8 chip_rev;
 	u8 ctrl;
 	int quirks = 0;
 	int rc;
@@ -296,7 +301,7 @@ static int __init it87_wdt_init(void)
 		return rc;
 
 	chip_type = superio_inw(CHIPID);
-	chip_rev  = superio_inb(CHIPREV) & 0x0f;
+	chip_rev = superio_inb(CHIPREV) & 0x0f;
 	superio_exit();
 
 	dmi_id = dmi_first_match(it87_quirks);
@@ -326,6 +331,7 @@ static int __init it87_wdt_init(void)
 	case IT8721_ID:
 	case IT8726_ID:
 	case IT8728_ID:
+	case IT8733_ID:
 	case IT8772_ID:
 	case IT8783_ID:
 	case IT8784_ID:
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re:  [PATCH v2] watchdog: it87_wdt: add support for IT8733
  2024-12-23 12:06 [PATCH] watchdog: it87_wdt: add support for IT8733 james
@ 2024-12-23 12:16 ` james
  2025-01-06 16:04 ` [PATCH] " Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: james @ 2024-12-23 12:16 UTC (permalink / raw)
  To: linux-watchdog@vger.kernel.org


[-- Attachment #1.1: Type: text/plain, Size: 764 bytes --]

I previously posted a patch titled "watchdog: it87_wdt: add support for IT8733" on 2024-12-23, but I realized there was an issue with the original version. Specifically, I made a typo in the chip ID definition. I have fixed the problem and am resubmitting the updated patch as v2.


Signed-off-by: James Young <james@foreveryoung.id.au>

________________________________
From: james@foreveryoung.id.au <james@foreveryoung.id.au>
Sent: Monday, 23 December 2024 11:06 PM
To: linux-watchdog@vger.kernel.org <linux-watchdog@vger.kernel.org>
Subject: [PATCH] watchdog: it87_wdt: add support for IT8733

Add support for the IT8733 Super I/O watchdog timer.

Tested on a Lenovo ThinkCenter M93p SFF.

Signed-off-by: James Young <james@foreveryoung.id.au>

[-- Attachment #1.2: Type: text/html, Size: 2664 bytes --]

[-- Attachment #2: 0002-watchdog-it87_wdt-add-support-for-IT8733.patch --]
[-- Type: application/octet-stream, Size: 764 bytes --]

From 2f57b6dff574c417f93deaa97d8e5d31aba202db Mon Sep 17 00:00:00 2001
From: James Young <james@foreveryoung.id.au>
Date: Mon, 23 Dec 2024 23:10:23 +1100
Subject: [PATCH] watchdog: it87_wdt: add support for IT8733

---
 drivers/watchdog/it87_wdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/watchdog/it87_wdt.c b/drivers/watchdog/it87_wdt.c
index 36c8bdca4743..93abaeb1e84b 100644
--- a/drivers/watchdog/it87_wdt.c
+++ b/drivers/watchdog/it87_wdt.c
@@ -71,7 +71,7 @@
 #define IT8721_ID 0x8721
 #define IT8726_ID 0x8726 /* the data sheet suggest wrongly 0x8716 */
 #define IT8728_ID 0x8728
-#define IT8728_ID 0x8733
+#define IT8733_ID 0x8733
 #define IT8772_ID 0x8772
 #define IT8783_ID 0x8783
 #define IT8784_ID 0x8784
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] watchdog: it87_wdt: add support for IT8733
  2024-12-23 12:06 [PATCH] watchdog: it87_wdt: add support for IT8733 james
  2024-12-23 12:16 ` [PATCH v2] " james
@ 2025-01-06 16:04 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2025-01-06 16:04 UTC (permalink / raw)
  To: james@foreveryoung.id.au, linux-watchdog@vger.kernel.org

On 12/23/24 04:06, james@foreveryoung.id.au wrote:
> Add support for the IT8733 Super I/O watchdog timer.
> 
> Tested on a Lenovo ThinkCenter M93p SFF.
> 
> Signed-off-by: James Young <james@foreveryoung.id.au>

 From Documentation/process/submitting-patches.rst:

"No MIME, no links, no compression, no attachments.  Just plain text"

That even has its own chapter, explaining the reasons.

Guenter


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-06 16:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-23 12:06 [PATCH] watchdog: it87_wdt: add support for IT8733 james
2024-12-23 12:16 ` [PATCH v2] " james
2025-01-06 16:04 ` [PATCH] " Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox