Skip to contentSkip to conversation

watchdog: Add support for the WM8350 watchdog

PATCH New Mark Brown 1 participant 1 message Oct 10, 2008

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 watchdog: Add support for the WM8350 watchdog

This driver implements support for the watchdog functionality provided by the Wolfson Microelectronics WM8350, a multi-function audio and power management subsystem intended for use in embedded systems. It is based on a driver originally written by Graeme Gregory, though it has been extensively modified since then.

Use of a GPIO to kick the watchdog is not yet supported.

---

This patch depends on the WM8350 core support which is currently in the process of being merged via the regulator tree - Wim, are you OK with also merging this via there?

 drivers/mfd/wm8350-core.c       |    5 +
 drivers/watchdog/Kconfig        |    7 +
 drivers/watchdog/Makefile       |    1 +
 drivers/watchdog/wm8350_wdt.c   |  316 +++++++++++++++++++++++++++++++++++++++
 include/linux/mfd/wm8350/core.h |    2 +
 include/linux/mfd/wm8350/wdt.h  |    8 +-
 6 files changed, 338 insertions(+), 1 deletions(-)
 create mode 100644 drivers/watchdog/wm8350_wdt.c
drivers/mfd/wm8350-core.c +5 -0
index cd1f76e..db354de 100644
@@ -1234,6 +1234,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
 
 	wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
 
+	wm8350_client_dev_register(wm8350, "wm8350-wdt", &(wm8350->wdt.pdev));
+
 	return 0;
 
 err:
@@ -1250,6 +1252,9 @@ void wm8350_device_exit(struct wm8350 *wm8350)
 		if (wm8350->pmic.pdev[i] != NULL)
 			platform_device_unregister(wm8350->pmic.pdev[i]);
 
+	if (wm8350->wdt.pdev)
+		platform_device_unregister(wm8350->wdt.pdev);
+
 	free_irq(wm8350->chip_irq, wm8350);
 	flush_work(&wm8350->irq_work);
 	kfree(wm8350->reg_cache);
drivers/watchdog/Kconfig +7 -0
index c510367..bf0d1bc 100644
@@ -55,6 +55,13 @@ config SOFT_WATCHDOG
 	  To compile this driver as a module, choose M here: the
 	  module will be called softdog.
 
+config WM8350_WATCHDOG
+	tristate "WM8350 watchdog"
+	depends on MFD_WM8350
+	help
+	  Support for the watchdog in the WM8350 AudioPlus PMIC.  When
+	  the watchdog triggers the system will be reset.
+
 # ALPHA Architecture
 
 # ARM Architecture
drivers/watchdog/Makefile +1 -0
index e0ef123..e9d36c9 100644
@@ -127,3 +127,4 @@ obj-$(CONFIG_SH_WDT) += shwdt.o
 
 # Architecture Independant
 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
+obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o
drivers/watchdog/wm8350_wdt.c new file +316 -0

316 lines not on this page · raw message

include/linux/mfd/wm8350/core.h +2 -0
index 348101c..5df704f 100644
@@ -18,6 +18,7 @@
 #include <linux/workqueue.h>
 
 #include <linux/mfd/wm8350/pmic.h>
+#include <linux/mfd/wm8350/wdt.h>
 
 /*
  * Register values.
@@ -575,6 +576,7 @@ struct wm8350 {
 
 	/* Client devices */
 	struct wm8350_pmic pmic;
+	struct wm8350_wdt wdt;
 };
 
 /**
include/linux/mfd/wm8350/wdt.h +7 -1
index 72fc9f5..f6135b5 100644
@@ -1,7 +1,7 @@
 /*
  * wdt.h  --  Watchdog Driver for Wolfson WM8350 PMIC
  *
- * Copyright 2007 Wolfson Microelectronics PLC
+ * Copyright 2007, 2008 Wolfson Microelectronics PLC
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -12,6 +12,8 @@
 #ifndef __LINUX_MFD_WM8350_WDT_H_
 #define __LINUX_MFD_WM8350_WDT_H_
 
+#include <linux/platform_device.h>
+
 #define WM8350_WDOG_HIB_MODE                    0x0080
 #define WM8350_WDOG_DEBUG                       0x0040
 #define WM8350_WDOG_MODE_MASK                   0x0030
@@ -19,4 +21,8 @@
 
 #define WM8350_IRQ_SYS_WDOG_TO			24
 
+struct wm8350_wdt {
+	struct platform_device *pdev;
+};
+
 #endif
Signature · 1 line
1.5.6.5