aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-01-19 14:02:27 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-18 21:26:49 -0400
commit61ba031841ad60c4a9ea16b20dd46b6cdb0faf2a (patch)
tree58388a53d17e7a88c0486ef271a42b699eb4fc65 /drivers/hwmon
parent9ed5bc24fa2b4ebe52b5aec3318babe2aa31795a (diff)
hwmon: (vt8231) Fix multi-line comments
Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Roger Lucas <vt8231@hiddenengine.co.uk> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/vt8231.c164
1 files changed, 87 insertions, 77 deletions
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c
index eb74f3778c90..386a84538010 100644
--- a/drivers/hwmon/vt8231.c
+++ b/drivers/hwmon/vt8231.c
@@ -1,28 +1,29 @@
1/* 1/*
2 vt8231.c - Part of lm_sensors, Linux kernel modules 2 * vt8231.c - Part of lm_sensors, Linux kernel modules
3 for hardware monitoring 3 * for hardware monitoring
4 *
5 * Copyright (c) 2005 Roger Lucas <vt8231@hiddenengine.co.uk>
6 * Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
7 * Aaron M. Marsh <amarsh@sdf.lonestar.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
4 23
5 Copyright (c) 2005 Roger Lucas <vt8231@hiddenengine.co.uk> 24/*
6 Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> 25 * Supports VIA VT8231 South Bridge embedded sensors
7 Aaron M. Marsh <amarsh@sdf.lonestar.org> 26 */
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/
23
24/* Supports VIA VT8231 South Bridge embedded sensors
25*/
26 27
27#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 28#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
28 29
@@ -50,26 +51,27 @@ static struct platform_device *pdev;
50#define VT8231_BASE_REG 0x70 51#define VT8231_BASE_REG 0x70
51#define VT8231_ENABLE_REG 0x74 52#define VT8231_ENABLE_REG 0x74
52 53
53/* The VT8231 registers 54/*
54 55 * The VT8231 registers
55 The reset value for the input channel configuration is used (Reg 0x4A=0x07) 56 *
56 which sets the selected inputs marked with '*' below if multiple options are 57 * The reset value for the input channel configuration is used (Reg 0x4A=0x07)
57 possible: 58 * which sets the selected inputs marked with '*' below if multiple options are
58 59 * possible:
59 Voltage Mode Temperature Mode 60 *
60 Sensor Linux Id Linux Id VIA Id 61 * Voltage Mode Temperature Mode
61 -------- -------- -------- ------ 62 * Sensor Linux Id Linux Id VIA Id
62 CPU Diode N/A temp1 0 63 * -------- -------- -------- ------
63 UIC1 in0 temp2 * 1 64 * CPU Diode N/A temp1 0
64 UIC2 in1 * temp3 2 65 * UIC1 in0 temp2 * 1
65 UIC3 in2 * temp4 3 66 * UIC2 in1 * temp3 2
66 UIC4 in3 * temp5 4 67 * UIC3 in2 * temp4 3
67 UIC5 in4 * temp6 5 68 * UIC4 in3 * temp5 4
68 3.3V in5 N/A 69 * UIC5 in4 * temp6 5
69 70 * 3.3V in5 N/A
70 Note that the BIOS may set the configuration register to a different value 71 *
71 to match the motherboard configuration. 72 * Note that the BIOS may set the configuration register to a different value
72*/ 73 * to match the motherboard configuration.
74 */
73 75
74/* fans numbered 0-1 */ 76/* fans numbered 0-1 */
75#define VT8231_REG_FAN_MIN(nr) (0x3b + (nr)) 77#define VT8231_REG_FAN_MIN(nr) (0x3b + (nr))
@@ -81,13 +83,14 @@ static const u8 regvolt[] = { 0x21, 0x22, 0x23, 0x24, 0x25, 0x26 };
81static const u8 regvoltmax[] = { 0x3d, 0x2b, 0x2d, 0x2f, 0x31, 0x33 }; 83static const u8 regvoltmax[] = { 0x3d, 0x2b, 0x2d, 0x2f, 0x31, 0x33 };
82static const u8 regvoltmin[] = { 0x3e, 0x2c, 0x2e, 0x30, 0x32, 0x34 }; 84static const u8 regvoltmin[] = { 0x3e, 0x2c, 0x2e, 0x30, 0x32, 0x34 };
83 85
84/* Temperatures are numbered 1-6 according to the Linux kernel specification. 86/*
85** 87 * Temperatures are numbered 1-6 according to the Linux kernel specification.
86** In the VIA datasheet, however, the temperatures are numbered from zero. 88 *
87** Since it is important that this driver can easily be compared to the VIA 89 * In the VIA datasheet, however, the temperatures are numbered from zero.
88** datasheet, we will use the VIA numbering within this driver and map the 90 * Since it is important that this driver can easily be compared to the VIA
89** kernel sysfs device name to the VIA number in the sysfs callback. 91 * datasheet, we will use the VIA numbering within this driver and map the
90*/ 92 * kernel sysfs device name to the VIA number in the sysfs callback.
93 */
91 94
92#define VT8231_REG_TEMP_LOW01 0x49 95#define VT8231_REG_TEMP_LOW01 0x49
93#define VT8231_REG_TEMP_LOW25 0x4d 96#define VT8231_REG_TEMP_LOW25 0x4d
@@ -108,9 +111,10 @@ static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 };
108#define VT8231_REG_TEMP1_CONFIG 0x4b 111#define VT8231_REG_TEMP1_CONFIG 0x4b
109#define VT8231_REG_TEMP2_CONFIG 0x4c 112#define VT8231_REG_TEMP2_CONFIG 0x4c
110 113
111/* temps 0-5 as numbered in VIA datasheet - see later for mapping to Linux 114/*
112** numbering 115 * temps 0-5 as numbered in VIA datasheet - see later for mapping to Linux
113*/ 116 * numbering
117 */
114#define ISTEMP(i, ch_config) ((i) == 0 ? 1 : \ 118#define ISTEMP(i, ch_config) ((i) == 0 ? 1 : \
115 ((ch_config) >> ((i)+1)) & 0x01) 119 ((ch_config) >> ((i)+1)) & 0x01)
116/* voltages 0-5 */ 120/* voltages 0-5 */
@@ -119,24 +123,26 @@ static const u8 regtempmin[] = { 0x3a, 0x3e, 0x2c, 0x2e, 0x30, 0x32 };
119 123
120#define DIV_FROM_REG(val) (1 << (val)) 124#define DIV_FROM_REG(val) (1 << (val))
121 125
122/* NB The values returned here are NOT temperatures. The calibration curves 126/*
123** for the thermistor curves are board-specific and must go in the 127 * NB The values returned here are NOT temperatures. The calibration curves
124** sensors.conf file. Temperature sensors are actually ten bits, but the 128 * for the thermistor curves are board-specific and must go in the
125** VIA datasheet only considers the 8 MSBs obtained from the regtemp[] 129 * sensors.conf file. Temperature sensors are actually ten bits, but the
126** register. The temperature value returned should have a magnitude of 3, 130 * VIA datasheet only considers the 8 MSBs obtained from the regtemp[]
127** so we use the VIA scaling as the "true" scaling and use the remaining 2 131 * register. The temperature value returned should have a magnitude of 3,
128** LSBs as fractional precision. 132 * so we use the VIA scaling as the "true" scaling and use the remaining 2
129** 133 * LSBs as fractional precision.
130** All the on-chip hardware temperature comparisons for the alarms are only 134 *
131** 8-bits wide, and compare against the 8 MSBs of the temperature. The bits 135 * All the on-chip hardware temperature comparisons for the alarms are only
132** in the registers VT8231_REG_TEMP_LOW01 and VT8231_REG_TEMP_LOW25 are 136 * 8-bits wide, and compare against the 8 MSBs of the temperature. The bits
133** ignored. 137 * in the registers VT8231_REG_TEMP_LOW01 and VT8231_REG_TEMP_LOW25 are
134*/ 138 * ignored.
135 139 */
136/******** FAN RPM CONVERSIONS ******** 140
137** This chip saturates back at 0, not at 255 like many the other chips. 141/*
138** So, 0 means 0 RPM 142 ****** FAN RPM CONVERSIONS ********
139*/ 143 * This chip saturates back at 0, not at 255 like many the other chips.
144 * So, 0 means 0 RPM
145 */
140static inline u8 FAN_TO_REG(long rpm, int div) 146static inline u8 FAN_TO_REG(long rpm, int div)
141{ 147{
142 if (rpm == 0) 148 if (rpm == 0)
@@ -463,9 +469,10 @@ static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
463 return count; 469 return count;
464} 470}
465 471
466/* Note that these map the Linux temperature sensor numbering (1-6) to the VIA 472/*
467** temperature sensor numbering (0-5) 473 * Note that these map the Linux temperature sensor numbering (1-6) to the VIA
468*/ 474 * temperature sensor numbering (0-5)
475 */
469#define define_temperature_sysfs(offset) \ 476#define define_temperature_sysfs(offset) \
470static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \ 477static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, \
471 show_temp, NULL, offset - 1); \ 478 show_temp, NULL, offset - 1); \
@@ -1032,13 +1039,16 @@ static int __devinit vt8231_pci_probe(struct pci_dev *dev,
1032 if (vt8231_device_add(address)) 1039 if (vt8231_device_add(address))
1033 goto exit_unregister; 1040 goto exit_unregister;
1034 1041
1035 /* Always return failure here. This is to allow other drivers to bind 1042 /*
1043 * Always return failure here. This is to allow other drivers to bind
1036 * to this pci device. We don't really want to have control over the 1044 * to this pci device. We don't really want to have control over the
1037 * pci device, we only wanted to read as few register values from it. 1045 * pci device, we only wanted to read as few register values from it.
1038 */ 1046 */
1039 1047
1040 /* We do, however, mark ourselves as using the PCI device to stop it 1048 /*
1041 getting unloaded. */ 1049 * We do, however, mark ourselves as using the PCI device to stop it
1050 * getting unloaded.
1051 */
1042 s_bridge = pci_dev_get(dev); 1052 s_bridge = pci_dev_get(dev);
1043 return -ENODEV; 1053 return -ENODEV;
1044 1054