aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2011-03-09 14:57:07 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-03-15 01:39:21 -0400
commit44c4dc521e99c0b2946973090b27c9bd4eb81b63 (patch)
tree521e4acfb2a8985783c3a51f5c1900568dd0e8f4 /drivers
parent02309ad2b8cbcf45260dd9bb5a527799a612c161 (diff)
hwmon/f71882fg: Fix temp1 sensor type reporting
The code for determining a sensort type for temp1 was based on me misreading the datasheet, the tested registers do not determine what kind of sensor is actually reported as temp1. Instead the enable / disable certain additional digital sensor readouts throug PECI / AMDSI, etc. Independent of these settings temp1 is still reading an external BJT or thermistor as configured by the Temperature Sensor Type Register (0x6b). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hwmon/f71882fg.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c
index 6e06019015a5..6c3de065e04b 100644
--- a/drivers/hwmon/f71882fg.c
+++ b/drivers/hwmon/f71882fg.c
@@ -1,6 +1,6 @@
1/*************************************************************************** 1/***************************************************************************
2 * Copyright (C) 2006 by Hans Edgington <hans@edgington.nl> * 2 * Copyright (C) 2006 by Hans Edgington <hans@edgington.nl> *
3 * Copyright (C) 2007-2009 Hans de Goede <hdegoede@redhat.com> * 3 * Copyright (C) 2007-2011 Hans de Goede <hdegoede@redhat.com> *
4 * * 4 * *
5 * This program is free software; you can redistribute it and/or modify * 5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by * 6 * it under the terms of the GNU General Public License as published by *
@@ -57,8 +57,6 @@
57#define ADDR_REG_OFFSET 5 57#define ADDR_REG_OFFSET 5
58#define DATA_REG_OFFSET 6 58#define DATA_REG_OFFSET 6
59 59
60#define F71882FG_REG_PECI 0x0A
61
62#define F71882FG_REG_IN_STATUS 0x12 /* f71882fg only */ 60#define F71882FG_REG_IN_STATUS 0x12 /* f71882fg only */
63#define F71882FG_REG_IN_BEEP 0x13 /* f71882fg only */ 61#define F71882FG_REG_IN_BEEP 0x13 /* f71882fg only */
64#define F71882FG_REG_IN(nr) (0x20 + (nr)) 62#define F71882FG_REG_IN(nr) (0x20 + (nr))
@@ -943,7 +941,7 @@ static u16 f71882fg_read_temp(struct f71882fg_data *data, int nr)
943static struct f71882fg_data *f71882fg_update_device(struct device *dev) 941static struct f71882fg_data *f71882fg_update_device(struct device *dev)
944{ 942{
945 struct f71882fg_data *data = dev_get_drvdata(dev); 943 struct f71882fg_data *data = dev_get_drvdata(dev);
946 int nr, reg = 0, reg2; 944 int nr, reg;
947 int nr_fans = (data->type == f71882fg) ? 4 : 3; 945 int nr_fans = (data->type == f71882fg) ? 4 : 3;
948 int nr_ins = (data->type == f71858fg || data->type == f8000) ? 3 : 9; 946 int nr_ins = (data->type == f71858fg || data->type == f8000) ? 3 : 9;
949 947
@@ -980,38 +978,11 @@ static struct f71882fg_data *f71882fg_update_device(struct device *dev)
980 F71882FG_REG_FAN_BEEP); 978 F71882FG_REG_FAN_BEEP);
981 data->temp_beep = f71882fg_read8(data, 979 data->temp_beep = f71882fg_read8(data,
982 F71882FG_REG_TEMP_BEEP); 980 F71882FG_REG_TEMP_BEEP);
983 /* Have to hardcode type, because temp1 is special */
984 reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE); 981 reg = f71882fg_read8(data, F71882FG_REG_TEMP_TYPE);
982 data->temp_type[1] = (reg & 0x02) ? 2 : 4;
985 data->temp_type[2] = (reg & 0x04) ? 2 : 4; 983 data->temp_type[2] = (reg & 0x04) ? 2 : 4;
986 data->temp_type[3] = (reg & 0x08) ? 2 : 4; 984 data->temp_type[3] = (reg & 0x08) ? 2 : 4;
987 } 985 }
988 /* Determine temp index 1 sensor type */
989 if (data->type == f71889fg) {
990 reg2 = f71882fg_read8(data, F71882FG_REG_START);
991 switch ((reg2 & 0x60) >> 5) {
992 case 0x00: /* BJT / Thermistor */
993 data->temp_type[1] = (reg & 0x02) ? 2 : 4;
994 break;
995 case 0x01: /* AMDSI */
996 data->temp_type[1] = 5;
997 break;
998 case 0x02: /* PECI */
999 case 0x03: /* Ibex Peak ?? Report as PECI for now */
1000 data->temp_type[1] = 6;
1001 break;
1002 }
1003 } else {
1004 reg2 = f71882fg_read8(data, F71882FG_REG_PECI);
1005 if ((reg2 & 0x03) == 0x01)
1006 data->temp_type[1] = 6; /* PECI */
1007 else if ((reg2 & 0x03) == 0x02)
1008 data->temp_type[1] = 5; /* AMDSI */
1009 else if (data->type == f71862fg ||
1010 data->type == f71882fg)
1011 data->temp_type[1] = (reg & 0x02) ? 2 : 4;
1012 else /* f71858fg and f8000 only support BJT */
1013 data->temp_type[1] = 2;
1014 }
1015 986
1016 data->pwm_enable = f71882fg_read8(data, 987 data->pwm_enable = f71882fg_read8(data,
1017 F71882FG_REG_PWM_ENABLE); 988 F71882FG_REG_PWM_ENABLE);