From: Giel van Schijndel <me@mortis.eu>
To: unlisted-recipients:; (no To-header on input)
Cc: Laurens Leemans <laurens@signips.com>,
Jonathan Cameron <jic23@cam.ac.uk>,
Giel van Schijndel <me@mortis.eu>,
Randy Dunlap <rdunlap@xenotime.net>,
Hans de Goede <hdegoede@redhat.com>,
Jean Delvare <khali@linux-fr.org>,
Andrew Morton <akpm@linux-foundation.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Samuel Ortiz <sameo@linux.intel.com>,
lm-sensors@lm-sensors.org, linux-kernel@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: [PATCH] hwmon: f71882fg: Add support for the Fintek F71808E
Date: Sun, 1 Aug 2010 15:30:01 +0200 [thread overview]
Message-ID: <1280669402-31213-1-git-send-email-me@mortis.eu> (raw)
In-Reply-To: <20100801132226.GE3711@salidar.me.mortis.eu>
Allow device probing to recognise the Fintek F71808E.
Sysfs interface:
* Fan/pwm control is the same as for F71889FG
* Temperature and voltage sensor handling is largely the same as for
the F71889FG
- Has one temperature sensor less (doesn't have temp3)
- Misses one voltage sensor (doesn't have V6, thus in6_input refers to
what in7_input refers for F71889FG)
For the purpose of the sysfs interface fxxxx_in_temp_attr[] is split up
such that it can largely be reused.
Signed-off-by: Giel van Schijndel <me@mortis.eu>
---
Documentation/hwmon/f71882fg | 4 ++
drivers/hwmon/Kconfig | 6 ++--
drivers/hwmon/f71882fg.c | 83 ++++++++++++++++++++++++++++++++++++++----
3 files changed, 82 insertions(+), 11 deletions(-)
diff --git a/Documentation/hwmon/f71882fg b/Documentation/hwmon/f71882fg
index a7952c2..1a07fd6 100644
--- a/Documentation/hwmon/f71882fg
+++ b/Documentation/hwmon/f71882fg
@@ -2,6 +2,10 @@ Kernel driver f71882fg
======================
Supported chips:
+ * Fintek F71808E
+ Prefix: 'f71808fg'
+ Addresses scanned: none, address read from Super I/O config space
+ Datasheet: Not public
* Fintek F71858FG
Prefix: 'f71858fg'
Addresses scanned: none, address read from Super I/O config space
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index e19cf8e..7d0beac 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -332,11 +332,11 @@ config SENSORS_F71805F
will be called f71805f.
config SENSORS_F71882FG
- tristate "Fintek F71858FG, F71862FG, F71882FG, F71889FG and F8000"
+ tristate "Fintek F71808E, F71858FG, F71862FG, F71882FG, F71889FG and F8000"
depends on EXPERIMENTAL
help
- If you say yes here you get support for hardware monitoring
- features of the Fintek F71858FG, F71862FG/71863FG, F71882FG/F71883FG,
+ If you say yes here you get support for hardware monitoring features
+ of the Fintek F71808E, F71858FG, F71862FG/71863FG, F71882FG/F71883FG,
F71889FG and F8000 Super-I/O chips.
This driver can also be built as a module. If so, the module
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index f4d2279..7857ed3 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -45,6 +45,7 @@
#define SIO_REG_ADDR 0x60 /* Logical device address (2 bytes) */
#define SIO_FINTEK_ID 0x1934 /* Manufacturers ID */
+#define SIO_F71808_ID 0x0901 /* Chipset ID */
#define SIO_F71858_ID 0x0507 /* Chipset ID */
#define SIO_F71862_ID 0x0601 /* Chipset ID */
#define SIO_F71882_ID 0x0541 /* Chipset ID */
@@ -96,9 +97,10 @@ static unsigned short force_id;
module_param(force_id, ushort, 0);
MODULE_PARM_DESC(force_id, "Override the detected device ID");
-enum chips { f71858fg, f71862fg, f71882fg, f71889fg, f8000 };
+enum chips { f71808fg, f71858fg, f71862fg, f71882fg, f71889fg, f8000 };
static const char *f71882fg_names[] = {
+ "f71808fg",
"f71858fg",
"f71862fg",
"f71882fg",
@@ -306,8 +308,8 @@ static struct sensor_device_attribute_2 f71858fg_in_temp_attr[] = {
SENSOR_ATTR_2(temp3_fault, S_IRUGO, show_temp_fault, NULL, 0, 2),
};
-/* Temp and in attr common to the f71862fg, f71882fg and f71889fg */
-static struct sensor_device_attribute_2 fxxxx_in_temp_attr[] = {
+/* In attr common to the f71862fg, f71882fg and f71889fg */
+static struct sensor_device_attribute_2 fxxxx_in_attr[] = {
SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2),
@@ -317,6 +319,22 @@ static struct sensor_device_attribute_2 fxxxx_in_temp_attr[] = {
SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 6),
SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 7),
SENSOR_ATTR_2(in8_input, S_IRUGO, show_in, NULL, 0, 8),
+};
+
+/* In attr for the f71808fg */
+static struct sensor_device_attribute_2 f71808_in_attr[] = {
+ SENSOR_ATTR_2(in0_input, S_IRUGO, show_in, NULL, 0, 0),
+ SENSOR_ATTR_2(in1_input, S_IRUGO, show_in, NULL, 0, 1),
+ SENSOR_ATTR_2(in2_input, S_IRUGO, show_in, NULL, 0, 2),
+ SENSOR_ATTR_2(in3_input, S_IRUGO, show_in, NULL, 0, 3),
+ SENSOR_ATTR_2(in4_input, S_IRUGO, show_in, NULL, 0, 4),
+ SENSOR_ATTR_2(in5_input, S_IRUGO, show_in, NULL, 0, 5),
+ SENSOR_ATTR_2(in6_input, S_IRUGO, show_in, NULL, 0, 7),
+ SENSOR_ATTR_2(in7_input, S_IRUGO, show_in, NULL, 0, 8),
+};
+
+/* Temp attr common to the f71808fg, f71862fg, f71882fg and f71889fg */
+static struct sensor_device_attribute_2 fxxxx_temp_attr[] = {
SENSOR_ATTR_2(temp1_input, S_IRUGO, show_temp, NULL, 0, 1),
SENSOR_ATTR_2(temp1_max, S_IRUGO|S_IWUSR, show_temp_max,
store_temp_max, 0, 1),
@@ -355,6 +373,10 @@ static struct sensor_device_attribute_2 fxxxx_in_temp_attr[] = {
store_temp_beep, 0, 6),
SENSOR_ATTR_2(temp2_type, S_IRUGO, show_temp_type, NULL, 0, 2),
SENSOR_ATTR_2(temp2_fault, S_IRUGO, show_temp_fault, NULL, 0, 2),
+};
+
+/* Temp and in attr common to the f71862fg, f71882fg and f71889fg */
+static struct sensor_device_attribute_2 f71862_temp_attr[] = {
SENSOR_ATTR_2(temp3_input, S_IRUGO, show_temp, NULL, 0, 3),
SENSOR_ATTR_2(temp3_max, S_IRUGO|S_IWUSR, show_temp_max,
store_temp_max, 0, 3),
@@ -989,6 +1011,11 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev)
data->temp_type[1] = 6;
break;
}
+ } else if (data->type == f71808fg) {
+ reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE);
+ data->temp_type[1] = (reg & 0x02) ? 2 : 4;
+ data->temp_type[2] = (reg & 0x04) ? 2 : 4;
+
} else {
reg2 = f71882fg_read8(data, F71882FG_REG_PECI);
if ((reg2 & 0x03) == 0x01)
@@ -1871,7 +1898,8 @@ static ssize_t store_pwm_auto_point_temp(struct device *dev,
val /= 1000;
- if (data->type == f71889fg)
+ if (data->type == f71889fg
+ || data->type == f71808fg)
val = SENSORS_LIMIT(val, -128, 127);
else
val = SENSORS_LIMIT(val, 0, 127);
@@ -1974,8 +2002,28 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
/* fall through! */
case f71862fg:
err = f71882fg_create_sysfs_files(pdev,
- fxxxx_in_temp_attr,
- ARRAY_SIZE(fxxxx_in_temp_attr));
+ f71862_temp_attr,
+ ARRAY_SIZE(f71862_temp_attr));
+ if (err)
+ goto exit_unregister_sysfs;
+ err = f71882fg_create_sysfs_files(pdev,
+ fxxxx_in_attr,
+ ARRAY_SIZE(fxxxx_in_attr));
+ if (err)
+ goto exit_unregister_sysfs;
+ err = f71882fg_create_sysfs_files(pdev,
+ fxxxx_temp_attr,
+ ARRAY_SIZE(fxxxx_temp_attr));
+ break;
+ case f71808fg:
+ err = f71882fg_create_sysfs_files(pdev,
+ f71808_in_attr,
+ ARRAY_SIZE(f71808_in_attr));
+ if (err)
+ goto exit_unregister_sysfs;
+ err = f71882fg_create_sysfs_files(pdev,
+ fxxxx_temp_attr,
+ ARRAY_SIZE(fxxxx_temp_attr));
break;
case f8000:
err = f71882fg_create_sysfs_files(pdev,
@@ -2002,6 +2050,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
case f71862fg:
err = (data->pwm_enable & 0x15) != 0x15;
break;
+ case f71808fg:
case f71882fg:
case f71889fg:
err = 0;
@@ -2047,6 +2096,7 @@ static int __devinit f71882fg_probe(struct platform_device *pdev)
f8000_auto_pwm_attr,
ARRAY_SIZE(f8000_auto_pwm_attr));
break;
+ case f71808fg:
case f71889fg:
for (i = 0; i < nr_fans; i++) {
data->pwm_auto_point_mapping[i] =
@@ -2126,8 +2176,22 @@ static int f71882fg_remove(struct platform_device *pdev)
/* fall through! */
case f71862fg:
f71882fg_remove_sysfs_files(pdev,
- fxxxx_in_temp_attr,
- ARRAY_SIZE(fxxxx_in_temp_attr));
+ f71862_temp_attr,
+ ARRAY_SIZE(f71862_temp_attr));
+ f71882fg_remove_sysfs_files(pdev,
+ fxxxx_in_attr,
+ ARRAY_SIZE(fxxxx_in_attr));
+ f71882fg_remove_sysfs_files(pdev,
+ fxxxx_temp_attr,
+ ARRAY_SIZE(fxxxx_temp_attr));
+ break;
+ case f71808fg:
+ f71882fg_remove_sysfs_files(pdev,
+ f71808_in_attr,
+ ARRAY_SIZE(f71808_in_attr));
+ f71882fg_remove_sysfs_files(pdev,
+ fxxxx_temp_attr,
+ ARRAY_SIZE(fxxxx_temp_attr));
break;
case f8000:
f71882fg_remove_sysfs_files(pdev,
@@ -2195,6 +2259,9 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
devid = force_id ? force_id : superio_inw(sioaddr, SIO_REG_DEVID);
switch (devid) {
+ case SIO_F71808_ID:
+ sio_data->type = f71808fg;
+ break;
case SIO_F71858_ID:
sio_data->type = f71858fg;
break;
--
1.6.4.4
next prev parent reply other threads:[~2010-08-01 13:30 UTC|newest]
Thread overview: 81+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-23 14:12 [PATCH] hwmon: f71882fg: properly acquire I/O regions while probing Giel van Schijndel
2010-03-23 14:17 ` Giel van Schijndel
2010-03-23 23:12 ` [PATCH 1/4] [RFC] hwmon: f71882fg: Add support for the Fintek F71808E Giel van Schijndel
2010-03-23 23:12 ` [PATCH 2/4] hwmon: f71882fg: prepare for addition of watchdog support Giel van Schijndel
2010-03-23 23:12 ` [PATCH 3/4] hwmon: f71882fg: add watchdog detection code Giel van Schijndel
2010-03-23 23:12 ` [PATCH 4/4] [RFC] hwmon: f71882fg: Add watchdog API for F71808E and F71889 Giel van Schijndel
2010-03-23 23:26 ` Giel van Schijndel
2010-03-24 8:37 ` Hans de Goede
2010-03-24 9:36 ` Giel van Schijndel
2010-03-24 10:33 ` Hans de Goede
2010-03-24 15:35 ` Giel van Schijndel
2010-03-24 15:51 ` Alan Cox
2010-03-24 16:20 ` Hans de Goede
2010-03-24 20:35 ` Giel van Schijndel
2010-04-25 21:20 ` [lm-sensors] " Jim Cromie
2010-03-25 8:54 ` Giel van Schijndel
2010-03-25 10:40 ` Giel van Schijndel
2010-03-25 12:50 ` Alan Cox
2010-03-25 13:06 ` Hans de Goede
2010-03-25 13:17 ` [PATCH 1/3] resource: shared I/O region support Giel van Schijndel
2010-03-25 13:17 ` [PATCH 2/3] hwmon: f71882fg: use a muxed resource lock for the Super I/O port Giel van Schijndel
2010-03-25 13:17 ` [PATCH 3/3] [RFC] watchdog: f71808e_wdt: new watchdog driver for Fintek F71808E Giel van Schijndel
2010-03-30 9:06 ` Giel van Schijndel
2010-05-20 7:52 ` Wim Van Sebroeck
2010-05-25 21:08 ` Giel van Schijndel
2010-05-26 7:38 ` Wim Van Sebroeck
2010-07-31 21:36 ` Giel van Schijndel
2010-03-25 21:10 ` [PATCH 2/3] hwmon: f71882fg: use a muxed resource lock for the Super I/O port Hans de Goede
2010-04-25 10:35 ` Giel van Schijndel
2010-07-31 21:21 ` Giel van Schijndel
2010-03-25 15:57 ` [PATCH 1/3] resource: shared I/O region support Alan Cox
2010-03-25 18:03 ` Giel van Schijndel
2010-03-25 18:16 ` Alan Cox
2010-03-29 8:18 ` Giel van Schijndel
2010-03-29 16:07 ` Jesse Barnes
2010-03-29 17:38 ` Giel van Schijndel
2010-03-29 17:44 ` Giel van Schijndel
2010-03-29 17:45 ` H. Peter Anvin
2010-03-29 18:06 ` Jesse Barnes
2010-03-29 18:17 ` H. Peter Anvin
2010-03-29 18:29 ` Alan Cox
2010-04-02 20:29 ` Jesse Barnes
2010-03-29 18:39 ` Alan Cox
2010-03-29 18:56 ` H. Peter Anvin
2010-03-29 17:59 ` Jesse Barnes
2010-03-29 17:59 ` Jesse Barnes
2010-03-24 8:26 ` [PATCH 2/4] hwmon: f71882fg: prepare for addition of watchdog support Hans de Goede
2010-03-24 8:36 ` Hans de Goede
2010-03-24 8:25 ` [PATCH 1/4] [RFC] hwmon: f71882fg: Add support for the Fintek F71808E Hans de Goede
2010-03-24 9:23 ` [PATCH 1/4] " Giel van Schijndel
2010-03-24 10:31 ` Hans de Goede
2010-07-31 23:31 ` Giel van Schijndel
2010-08-01 6:12 ` Hans de Goede
2010-08-01 13:22 ` Giel van Schijndel
2010-08-01 13:30 ` Giel van Schijndel [this message]
2010-08-04 11:36 ` [PATCH] " Hans de Goede
2010-08-04 15:44 ` Giel van Schijndel
2010-08-13 10:56 ` Hans de Goede
2010-08-10 19:11 ` Giel van Schijndel
2010-08-13 10:01 ` Hans de Goede
2010-08-18 18:24 ` Andrew Morton
2010-08-22 18:04 ` Hans de Goede
2010-08-22 18:28 ` Giel van Schijndel
2010-08-01 13:30 ` [PATCH 1/2] hwmon: f71882fg: use a muxed resource lock for the Super I/O port Giel van Schijndel
2010-08-01 13:30 ` [PATCH 2/2] watchdog: f71808e_wdt: new watchdog driver for Fintek F71808E and F71882FG Giel van Schijndel
2010-08-04 11:38 ` [PATCH 1/2] hwmon: f71882fg: use a muxed resource lock for the Super I/O port Hans de Goede
2010-10-02 22:59 ` Giel van Schijndel
2010-10-03 1:06 ` Guenter Roeck
2010-10-03 9:01 ` Jean Delvare
2010-10-03 12:09 ` [PATCH] " Giel van Schijndel
2010-10-03 13:31 ` Guenter Roeck
2010-03-23 23:01 ` [PATCH] hwmon: f71882fg: properly acquire I/O regions while probing Giel van Schijndel
2010-03-24 8:14 ` Hans de Goede
2010-03-24 8:46 ` Giel van Schijndel
2010-03-24 9:09 ` [PATCH] hwmon: f71882fg: code cleanup Giel van Schijndel
2010-03-24 12:54 ` Jean Delvare
2010-03-24 9:09 ` [PATCH] hwmon: f71882fg: acquire I/O regions while we're working with them Giel van Schijndel
2010-03-24 9:28 ` [PATCH] hwmon: f71882fg: properly acquire I/O regions while probing Jean Delvare
2010-03-24 9:29 ` Jean Delvare
2010-03-24 9:34 ` Giel van Schijndel
2010-03-24 12:54 ` Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1280669402-31213-1-git-send-email-me@mortis.eu \
--to=me@mortis.eu \
--cc=akpm@linux-foundation.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=hdegoede@redhat.com \
--cc=jic23@cam.ac.uk \
--cc=khali@linux-fr.org \
--cc=laurens@signips.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lm-sensors@lm-sensors.org \
--cc=rdunlap@xenotime.net \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).