Commit 312869ec authored by Hans de Goede's avatar Hans de Goede Committed by Guenter Roeck

hwmon: (sch56xx) Add support for the integrated watchdog (v2)

Add support for the watchdog integrated into the SMSC SCH5627 and
SCH5636 superio-s. Since the watchdog is part of the hwmon logical device
and thus shares ioports with it, the watchdog driver is integrated into the
existing hwmon drivers for these.

Note that this version of the watchdog support for sch56xx superio-s
implements the watchdog chardev interface itself, rather then relying on
the recently added watchdog core / watchdog_dev. This is done because
currently some needed functionality is missing from watchdog_dev, as soon
as this functionality is added (which is being discussed on the
linux-watchdog mailinglist), I'll convert this driver over to using
watchdog_dev.
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
[guenter.roeck@ericsson.com: Added missing linux/slab.h include]
Signed-off-by: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
parent 840e191d
...@@ -16,6 +16,11 @@ Description ...@@ -16,6 +16,11 @@ Description
SMSC SCH5627 Super I/O chips include complete hardware monitoring SMSC SCH5627 Super I/O chips include complete hardware monitoring
capabilities. They can monitor up to 5 voltages, 4 fans and 8 temperatures. capabilities. They can monitor up to 5 voltages, 4 fans and 8 temperatures.
The SMSC SCH5627 hardware monitoring part also contains an integrated
watchdog. In order for this watchdog to function some motherboard specific
initialization most be done by the BIOS, so if the watchdog is not enabled
by the BIOS the sch5627 driver will not register a watchdog device.
The hardware monitoring part of the SMSC SCH5627 is accessed by talking The hardware monitoring part of the SMSC SCH5627 is accessed by talking
through an embedded microcontroller. An application note describing the through an embedded microcontroller. An application note describing the
protocol for communicating with the microcontroller is available upon protocol for communicating with the microcontroller is available upon
......
...@@ -26,6 +26,9 @@ temperatures. Note that the driver detects how many fan headers / ...@@ -26,6 +26,9 @@ temperatures. Note that the driver detects how many fan headers /
temperature sensors are actually implemented on the motherboard, so you will temperature sensors are actually implemented on the motherboard, so you will
likely see fewer temperature and fan inputs. likely see fewer temperature and fan inputs.
The Fujitsu Theseus hwmon solution also contains an integrated watchdog.
This watchdog is fully supported by the sch5636 driver.
An application note describing the Theseus' registers, as well as an An application note describing the Theseus' registers, as well as an
application note describing the protocol for communicating with the application note describing the protocol for communicating with the
microcontroller is available upon request. Please mail me if you want a copy. microcontroller is available upon request. Please mail me if you want a copy.
...@@ -1028,7 +1028,8 @@ config SENSORS_SCH5627 ...@@ -1028,7 +1028,8 @@ config SENSORS_SCH5627
select SENSORS_SCH56XX_COMMON select SENSORS_SCH56XX_COMMON
help help
If you say yes here you get support for the hardware monitoring If you say yes here you get support for the hardware monitoring
features of the SMSC SCH5627 Super-I/O chip. features of the SMSC SCH5627 Super-I/O chip including support for
the integrated watchdog.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called sch5627. will be called sch5627.
...@@ -1044,7 +1045,8 @@ config SENSORS_SCH5636 ...@@ -1044,7 +1045,8 @@ config SENSORS_SCH5636
Currently this driver only supports the Fujitsu Theseus SCH5636 based Currently this driver only supports the Fujitsu Theseus SCH5636 based
hwmon solution. Say yes here if you want support for the Fujitsu hwmon solution. Say yes here if you want support for the Fujitsu
Theseus' hardware monitoring features. Theseus' hardware monitoring features including support for the
integrated watchdog.
This driver can also be built as a module. If so, the module This driver can also be built as a module. If so, the module
will be called sch5636. will be called sch5636.
......
/*************************************************************************** /***************************************************************************
* Copyright (C) 2010-2011 Hans de Goede <hdegoede@redhat.com> * * Copyright (C) 2010-2012 Hans de Goede <hdegoede@redhat.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
...@@ -79,6 +79,7 @@ static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = { ...@@ -79,6 +79,7 @@ static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = {
struct sch5627_data { struct sch5627_data {
unsigned short addr; unsigned short addr;
struct device *hwmon_dev; struct device *hwmon_dev;
struct sch56xx_watchdog_data *watchdog;
u8 control; u8 control;
u8 temp_max[SCH5627_NO_TEMPS]; u8 temp_max[SCH5627_NO_TEMPS];
u8 temp_crit[SCH5627_NO_TEMPS]; u8 temp_crit[SCH5627_NO_TEMPS];
...@@ -453,6 +454,9 @@ static int sch5627_remove(struct platform_device *pdev) ...@@ -453,6 +454,9 @@ static int sch5627_remove(struct platform_device *pdev)
{ {
struct sch5627_data *data = platform_get_drvdata(pdev); struct sch5627_data *data = platform_get_drvdata(pdev);
if (data->watchdog)
sch56xx_watchdog_unregister(data->watchdog);
if (data->hwmon_dev) if (data->hwmon_dev)
hwmon_device_unregister(data->hwmon_dev); hwmon_device_unregister(data->hwmon_dev);
...@@ -574,6 +578,11 @@ static int __devinit sch5627_probe(struct platform_device *pdev) ...@@ -574,6 +578,11 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
goto error; goto error;
} }
/* Note failing to register the watchdog is not a fatal error */
data->watchdog = sch56xx_watchdog_register(data->addr,
(build_code << 24) | (build_id << 8) | hwmon_rev,
&data->update_lock, 1);
return 0; return 0;
error: error:
......
/*************************************************************************** /***************************************************************************
* Copyright (C) 2011 Hans de Goede <hdegoede@redhat.com> * * Copyright (C) 2011-2012 Hans de Goede <hdegoede@redhat.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
...@@ -67,6 +67,7 @@ static const u16 SCH5636_REG_FAN_VAL[SCH5636_NO_FANS] = { ...@@ -67,6 +67,7 @@ static const u16 SCH5636_REG_FAN_VAL[SCH5636_NO_FANS] = {
struct sch5636_data { struct sch5636_data {
unsigned short addr; unsigned short addr;
struct device *hwmon_dev; struct device *hwmon_dev;
struct sch56xx_watchdog_data *watchdog;
struct mutex update_lock; struct mutex update_lock;
char valid; /* !=0 if following fields are valid */ char valid; /* !=0 if following fields are valid */
...@@ -384,6 +385,9 @@ static int sch5636_remove(struct platform_device *pdev) ...@@ -384,6 +385,9 @@ static int sch5636_remove(struct platform_device *pdev)
struct sch5636_data *data = platform_get_drvdata(pdev); struct sch5636_data *data = platform_get_drvdata(pdev);
int i; int i;
if (data->watchdog)
sch56xx_watchdog_unregister(data->watchdog);
if (data->hwmon_dev) if (data->hwmon_dev)
hwmon_device_unregister(data->hwmon_dev); hwmon_device_unregister(data->hwmon_dev);
...@@ -505,6 +509,11 @@ static int __devinit sch5636_probe(struct platform_device *pdev) ...@@ -505,6 +509,11 @@ static int __devinit sch5636_probe(struct platform_device *pdev)
goto error; goto error;
} }
/* Note failing to register the watchdog is not a fatal error */
data->watchdog = sch56xx_watchdog_register(data->addr,
(revision[0] << 8) | revision[1],
&data->update_lock, 0);
return 0; return 0;
error: error:
......
This diff is collapsed.
/*************************************************************************** /***************************************************************************
* Copyright (C) 2010-2011 Hans de Goede <hdegoede@redhat.com> * * Copyright (C) 2010-2012 Hans de Goede <hdegoede@redhat.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * 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 * * it under the terms of the GNU General Public License as published by *
...@@ -17,8 +17,16 @@ ...@@ -17,8 +17,16 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/ ***************************************************************************/
#include <linux/mutex.h>
struct sch56xx_watchdog_data;
int sch56xx_read_virtual_reg(u16 addr, u16 reg); int sch56xx_read_virtual_reg(u16 addr, u16 reg);
int sch56xx_write_virtual_reg(u16 addr, u16 reg, u8 val); int sch56xx_write_virtual_reg(u16 addr, u16 reg, u8 val);
int sch56xx_read_virtual_reg16(u16 addr, u16 reg); int sch56xx_read_virtual_reg16(u16 addr, u16 reg);
int sch56xx_read_virtual_reg12(u16 addr, u16 msb_reg, u16 lsn_reg, int sch56xx_read_virtual_reg12(u16 addr, u16 msb_reg, u16 lsn_reg,
int high_nibble); int high_nibble);
struct sch56xx_watchdog_data *sch56xx_watchdog_register(
u16 addr, u32 revision, struct mutex *io_lock, int check_enabled);
void sch56xx_watchdog_unregister(struct sch56xx_watchdog_data *data);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment