aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/pc87427.c
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2012-01-19 14:02:23 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2012-03-18 21:27:35 -0400
commit36564efaddb7c1ace20f531860985a9848714c79 (patch)
treec517e6148179efba38880c908bca3bacbc4d57ea /drivers/hwmon/pc87427.c
parentb6707b78ff3172f03ee197b7e638cf6bc81d4407 (diff)
hwmon: (pc87427) Fix multi-line comments
Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/pc87427.c')
-rw-r--r--drivers/hwmon/pc87427.c72
1 files changed, 45 insertions, 27 deletions
diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c
index cb35461d52d9..37059a3755e9 100644
--- a/drivers/hwmon/pc87427.c
+++ b/drivers/hwmon/pc87427.c
@@ -46,9 +46,11 @@ static struct platform_device *pdev;
46 46
47#define DRVNAME "pc87427" 47#define DRVNAME "pc87427"
48 48
49/* The lock mutex protects both the I/O accesses (needed because the 49/*
50 device is using banked registers) and the register cache (needed to keep 50 * The lock mutex protects both the I/O accesses (needed because the
51 the data in the registers and the cache in sync at any time). */ 51 * device is using banked registers) and the register cache (needed to keep
52 * the data in the registers and the cache in sync at any time).
53 */
52struct pc87427_data { 54struct pc87427_data {
53 struct device *hwmon_dev; 55 struct device *hwmon_dev;
54 struct mutex lock; 56 struct mutex lock;
@@ -173,10 +175,12 @@ static inline void pc87427_write8_bank(struct pc87427_data *data, u8 ldi,
173#define FAN_STATUS_LOSPD (1 << 1) 175#define FAN_STATUS_LOSPD (1 << 1)
174#define FAN_STATUS_MONEN (1 << 0) 176#define FAN_STATUS_MONEN (1 << 0)
175 177
176/* Dedicated function to read all registers related to a given fan input. 178/*
177 This saves us quite a few locks and bank selections. 179 * Dedicated function to read all registers related to a given fan input.
178 Must be called with data->lock held. 180 * This saves us quite a few locks and bank selections.
179 nr is from 0 to 7 */ 181 * Must be called with data->lock held.
182 * nr is from 0 to 7
183 */
180static void pc87427_readall_fan(struct pc87427_data *data, u8 nr) 184static void pc87427_readall_fan(struct pc87427_data *data, u8 nr)
181{ 185{
182 int iobase = data->address[LD_FAN]; 186 int iobase = data->address[LD_FAN];
@@ -189,8 +193,10 @@ static void pc87427_readall_fan(struct pc87427_data *data, u8 nr)
189 outb(data->fan_status[nr], iobase + PC87427_REG_FAN_STATUS); 193 outb(data->fan_status[nr], iobase + PC87427_REG_FAN_STATUS);
190} 194}
191 195
192/* The 2 LSB of fan speed registers are used for something different. 196/*
193 The actual 2 LSB of the measurements are not available. */ 197 * The 2 LSB of fan speed registers are used for something different.
198 * The actual 2 LSB of the measurements are not available.
199 */
194static inline unsigned long fan_from_reg(u16 reg) 200static inline unsigned long fan_from_reg(u16 reg)
195{ 201{
196 reg &= 0xfffc; 202 reg &= 0xfffc;
@@ -224,10 +230,12 @@ static inline u16 fan_to_reg(unsigned long val)
224#define PWM_MODE_OFF (2 << 4) 230#define PWM_MODE_OFF (2 << 4)
225#define PWM_MODE_ON (7 << 4) 231#define PWM_MODE_ON (7 << 4)
226 232
227/* Dedicated function to read all registers related to a given PWM output. 233/*
228 This saves us quite a few locks and bank selections. 234 * Dedicated function to read all registers related to a given PWM output.
229 Must be called with data->lock held. 235 * This saves us quite a few locks and bank selections.
230 nr is from 0 to 3 */ 236 * Must be called with data->lock held.
237 * nr is from 0 to 3
238 */
231static void pc87427_readall_pwm(struct pc87427_data *data, u8 nr) 239static void pc87427_readall_pwm(struct pc87427_data *data, u8 nr)
232{ 240{
233 int iobase = data->address[LD_FAN]; 241 int iobase = data->address[LD_FAN];
@@ -286,10 +294,12 @@ static inline u8 pwm_enable_to_reg(unsigned long val, u8 pwmval)
286#define TEMP_TYPE_REMOTE_DIODE (2 << 5) 294#define TEMP_TYPE_REMOTE_DIODE (2 << 5)
287#define TEMP_TYPE_LOCAL_DIODE (3 << 5) 295#define TEMP_TYPE_LOCAL_DIODE (3 << 5)
288 296
289/* Dedicated function to read all registers related to a given temperature 297/*
290 input. This saves us quite a few locks and bank selections. 298 * Dedicated function to read all registers related to a given temperature
291 Must be called with data->lock held. 299 * input. This saves us quite a few locks and bank selections.
292 nr is from 0 to 5 */ 300 * Must be called with data->lock held.
301 * nr is from 0 to 5
302 */
293static void pc87427_readall_temp(struct pc87427_data *data, u8 nr) 303static void pc87427_readall_temp(struct pc87427_data *data, u8 nr)
294{ 304{
295 int iobase = data->address[LD_TEMP]; 305 int iobase = data->address[LD_TEMP];
@@ -318,8 +328,10 @@ static inline unsigned int temp_type_from_reg(u8 reg)
318 } 328 }
319} 329}
320 330
321/* We assume 8-bit thermal sensors; 9-bit thermal sensors are possible 331/*
322 too, but I have no idea how to figure out when they are used. */ 332 * We assume 8-bit thermal sensors; 9-bit thermal sensors are possible
333 * too, but I have no idea how to figure out when they are used.
334 */
323static inline long temp_from_reg(s16 reg) 335static inline long temp_from_reg(s16 reg)
324{ 336{
325 return reg * 1000 / 256; 337 return reg * 1000 / 256;
@@ -423,9 +435,11 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute
423 435
424 mutex_lock(&data->lock); 436 mutex_lock(&data->lock);
425 outb(BANK_FM(nr), iobase + PC87427_REG_BANK); 437 outb(BANK_FM(nr), iobase + PC87427_REG_BANK);
426 /* The low speed limit registers are read-only while monitoring 438 /*
427 is enabled, so we have to disable monitoring, then change the 439 * The low speed limit registers are read-only while monitoring
428 limit, and finally enable monitoring again. */ 440 * is enabled, so we have to disable monitoring, then change the
441 * limit, and finally enable monitoring again.
442 */
429 outb(0, iobase + PC87427_REG_FAN_STATUS); 443 outb(0, iobase + PC87427_REG_FAN_STATUS);
430 data->fan_min[nr] = fan_to_reg(val); 444 data->fan_min[nr] = fan_to_reg(val);
431 outw(data->fan_min[nr], iobase + PC87427_REG_FAN_MIN); 445 outw(data->fan_min[nr], iobase + PC87427_REG_FAN_MIN);
@@ -542,8 +556,10 @@ static const struct attribute_group pc87427_group_fan[8] = {
542 { .attrs = pc87427_attributes_fan[7] }, 556 { .attrs = pc87427_attributes_fan[7] },
543}; 557};
544 558
545/* Must be called with data->lock held and pc87427_readall_pwm() freshly 559/*
546 called */ 560 * Must be called with data->lock held and pc87427_readall_pwm() freshly
561 * called
562 */
547static void update_pwm_enable(struct pc87427_data *data, int nr, u8 mode) 563static void update_pwm_enable(struct pc87427_data *data, int nr, u8 mode)
548{ 564{
549 int iobase = data->address[LD_FAN]; 565 int iobase = data->address[LD_FAN];
@@ -1023,9 +1039,11 @@ static void __devinit pc87427_init_device(struct device *dev)
1023 if (reg & PWM_ENABLE_CTLEN) 1039 if (reg & PWM_ENABLE_CTLEN)
1024 data->pwm_enabled |= (1 << i); 1040 data->pwm_enabled |= (1 << i);
1025 1041
1026 /* We don't expose an interface to reconfigure the automatic 1042 /*
1027 fan control mode, so only allow to return to this mode if 1043 * We don't expose an interface to reconfigure the automatic
1028 it was originally set. */ 1044 * fan control mode, so only allow to return to this mode if
1045 * it was originally set.
1046 */
1029 if ((reg & PWM_ENABLE_MODE_MASK) == PWM_MODE_AUTO) { 1047 if ((reg & PWM_ENABLE_MODE_MASK) == PWM_MODE_AUTO) {
1030 dev_dbg(dev, "PWM%d is in automatic control mode\n", 1048 dev_dbg(dev, "PWM%d is in automatic control mode\n",
1031 i + 1); 1049 i + 1);