Skip to content

Commit

Permalink
hwmon: (sch56xx) Add support for the integrated watchdog (v2)
Browse files Browse the repository at this point in the history
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: Hans de Goede <hdegoede@redhat.com>
[guenter.roeck@ericsson.com: Added missing linux/slab.h include]
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
  • Loading branch information
jwrdegoede authored and Guenter Roeck committed Mar 20, 2012
1 parent 840e191 commit 312869e
Show file tree
Hide file tree
Showing 7 changed files with 558 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Documentation/hwmon/sch5627
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Description
SMSC SCH5627 Super I/O chips include complete hardware monitoring
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
through an embedded microcontroller. An application note describing the
protocol for communicating with the microcontroller is available upon
Expand Down
3 changes: 3 additions & 0 deletions Documentation/hwmon/sch5636
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
application note describing the protocol for communicating with the
microcontroller is available upon request. Please mail me if you want a copy.
6 changes: 4 additions & 2 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,8 @@ config SENSORS_SCH5627
select SENSORS_SCH56XX_COMMON
help
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
will be called sch5627.
Expand All @@ -1044,7 +1045,8 @@ config SENSORS_SCH5636

Currently this driver only supports the Fujitsu Theseus SCH5636 based
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
will be called sch5636.
Expand Down
11 changes: 10 additions & 1 deletion drivers/hwmon/sch5627.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* 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 *
* it under the terms of the GNU General Public License as published by *
Expand Down Expand Up @@ -79,6 +79,7 @@ static const char * const SCH5627_IN_LABELS[SCH5627_NO_IN] = {
struct sch5627_data {
unsigned short addr;
struct device *hwmon_dev;
struct sch56xx_watchdog_data *watchdog;
u8 control;
u8 temp_max[SCH5627_NO_TEMPS];
u8 temp_crit[SCH5627_NO_TEMPS];
Expand Down Expand Up @@ -453,6 +454,9 @@ static int sch5627_remove(struct platform_device *pdev)
{
struct sch5627_data *data = platform_get_drvdata(pdev);

if (data->watchdog)
sch56xx_watchdog_unregister(data->watchdog);

if (data->hwmon_dev)
hwmon_device_unregister(data->hwmon_dev);

Expand Down Expand Up @@ -574,6 +578,11 @@ static int __devinit sch5627_probe(struct platform_device *pdev)
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;

error:
Expand Down
11 changes: 10 additions & 1 deletion drivers/hwmon/sch5636.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/***************************************************************************
* 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 *
* it under the terms of the GNU General Public License as published by *
Expand Down Expand Up @@ -67,6 +67,7 @@ static const u16 SCH5636_REG_FAN_VAL[SCH5636_NO_FANS] = {
struct sch5636_data {
unsigned short addr;
struct device *hwmon_dev;
struct sch56xx_watchdog_data *watchdog;

struct mutex update_lock;
char valid; /* !=0 if following fields are valid */
Expand Down Expand Up @@ -384,6 +385,9 @@ static int sch5636_remove(struct platform_device *pdev)
struct sch5636_data *data = platform_get_drvdata(pdev);
int i;

if (data->watchdog)
sch56xx_watchdog_unregister(data->watchdog);

if (data->hwmon_dev)
hwmon_device_unregister(data->hwmon_dev);

Expand Down Expand Up @@ -505,6 +509,11 @@ static int __devinit sch5636_probe(struct platform_device *pdev)
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;

error:
Expand Down
Loading

0 comments on commit 312869e

Please sign in to comment.