forked from mirrors/linux
		
	hwmon: (adt7475) Fix multi-line comments
Cc: Jean Delvare <khali@linux-fr.org> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
		
							parent
							
								
									2fff0840c2
								
							
						
					
					
						commit
						9ed5bc24fa
					
				
					 1 changed files with 58 additions and 32 deletions
				
			
		| 
						 | 
					@ -32,9 +32,10 @@
 | 
				
			||||||
#define THERM		5
 | 
					#define THERM		5
 | 
				
			||||||
#define HYSTERSIS	6
 | 
					#define HYSTERSIS	6
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* These are unique identifiers for the sysfs functions - unlike the
 | 
					/*
 | 
				
			||||||
   numbers above, these are not also indexes into an array
 | 
					 * These are unique identifiers for the sysfs functions - unlike the
 | 
				
			||||||
*/
 | 
					 * numbers above, these are not also indexes into an array
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ALARM		9
 | 
					#define ALARM		9
 | 
				
			||||||
#define FAULT		10
 | 
					#define FAULT		10
 | 
				
			||||||
| 
						 | 
					@ -288,8 +289,10 @@ static void adt7475_write_word(struct i2c_client *client, int reg, u16 val)
 | 
				
			||||||
	i2c_smbus_write_byte_data(client, reg, val & 0xFF);
 | 
						i2c_smbus_write_byte_data(client, reg, val & 0xFF);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Find the nearest value in a table - used for pwm frequency and
 | 
					/*
 | 
				
			||||||
   auto temp range */
 | 
					 * Find the nearest value in a table - used for pwm frequency and
 | 
				
			||||||
 | 
					 * auto temp range
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
static int find_nearest(long val, const int *array, int size)
 | 
					static int find_nearest(long val, const int *array, int size)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
						int i;
 | 
				
			||||||
| 
						 | 
					@ -385,16 +388,20 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
 | 
				
			||||||
			out = (out >> 4) & 0xF;
 | 
								out = (out >> 4) & 0xF;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			out = (out & 0xF);
 | 
								out = (out & 0xF);
 | 
				
			||||||
		/* Show the value as an absolute number tied to
 | 
							/*
 | 
				
			||||||
		 * THERM */
 | 
							 * Show the value as an absolute number tied to
 | 
				
			||||||
 | 
							 * THERM
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
		out = reg2temp(data, data->temp[THERM][sattr->index]) -
 | 
							out = reg2temp(data, data->temp[THERM][sattr->index]) -
 | 
				
			||||||
			out * 1000;
 | 
								out * 1000;
 | 
				
			||||||
		mutex_unlock(&data->lock);
 | 
							mutex_unlock(&data->lock);
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case OFFSET:
 | 
						case OFFSET:
 | 
				
			||||||
		/* Offset is always 2's complement, regardless of the
 | 
							/*
 | 
				
			||||||
		 * setting in CONFIG5 */
 | 
							 * Offset is always 2's complement, regardless of the
 | 
				
			||||||
 | 
							 * setting in CONFIG5
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
		mutex_lock(&data->lock);
 | 
							mutex_lock(&data->lock);
 | 
				
			||||||
		out = (s8)data->temp[sattr->nr][sattr->index];
 | 
							out = (s8)data->temp[sattr->nr][sattr->index];
 | 
				
			||||||
		if (data->config5 & CONFIG5_TEMPOFFSET)
 | 
							if (data->config5 & CONFIG5_TEMPOFFSET)
 | 
				
			||||||
| 
						 | 
					@ -452,8 +459,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
 | 
				
			||||||
		break;
 | 
							break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case HYSTERSIS:
 | 
						case HYSTERSIS:
 | 
				
			||||||
		/* The value will be given as an absolute value, turn it
 | 
							/*
 | 
				
			||||||
		   into an offset based on THERM */
 | 
							 * The value will be given as an absolute value, turn it
 | 
				
			||||||
 | 
							 * into an offset based on THERM
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* Read fresh THERM and HYSTERSIS values from the chip */
 | 
							/* Read fresh THERM and HYSTERSIS values from the chip */
 | 
				
			||||||
		data->temp[THERM][sattr->index] =
 | 
							data->temp[THERM][sattr->index] =
 | 
				
			||||||
| 
						 | 
					@ -478,8 +487,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
 | 
				
			||||||
	default:
 | 
						default:
 | 
				
			||||||
		data->temp[sattr->nr][sattr->index] = temp2reg(data, val);
 | 
							data->temp[sattr->nr][sattr->index] = temp2reg(data, val);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* We maintain an extra 2 digits of precision for simplicity
 | 
							/*
 | 
				
			||||||
		 * - shift those back off before writing the value */
 | 
							 * We maintain an extra 2 digits of precision for simplicity
 | 
				
			||||||
 | 
							 * - shift those back off before writing the value
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
		out = (u8) (data->temp[sattr->nr][sattr->index] >> 2);
 | 
							out = (u8) (data->temp[sattr->nr][sattr->index] >> 2);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -514,8 +525,10 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *attr,
 | 
				
			||||||
	return count;
 | 
						return count;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Table of autorange values - the user will write the value in millidegrees,
 | 
					/*
 | 
				
			||||||
   and we'll convert it */
 | 
					 * Table of autorange values - the user will write the value in millidegrees,
 | 
				
			||||||
 | 
					 * and we'll convert it
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
static const int autorange_table[] = {
 | 
					static const int autorange_table[] = {
 | 
				
			||||||
	2000, 2500, 3330, 4000, 5000, 6670, 8000,
 | 
						2000, 2500, 3330, 4000, 5000, 6670, 8000,
 | 
				
			||||||
	10000, 13330, 16000, 20000, 26670, 32000, 40000,
 | 
						10000, 13330, 16000, 20000, 26670, 32000, 40000,
 | 
				
			||||||
| 
						 | 
					@ -558,8 +571,10 @@ static ssize_t set_point2(struct device *dev, struct device_attribute *attr,
 | 
				
			||||||
	data->range[sattr->index] =
 | 
						data->range[sattr->index] =
 | 
				
			||||||
		adt7475_read(TEMP_TRANGE_REG(sattr->index));
 | 
							adt7475_read(TEMP_TRANGE_REG(sattr->index));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* The user will write an absolute value, so subtract the start point
 | 
						/*
 | 
				
			||||||
	   to figure the range */
 | 
						 * The user will write an absolute value, so subtract the start point
 | 
				
			||||||
 | 
						 * to figure the range
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]);
 | 
						temp = reg2temp(data, data->temp[AUTOMIN][sattr->index]);
 | 
				
			||||||
	val = SENSORS_LIMIT(val, temp + autorange_table[0],
 | 
						val = SENSORS_LIMIT(val, temp + autorange_table[0],
 | 
				
			||||||
		temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]);
 | 
							temp + autorange_table[ARRAY_SIZE(autorange_table) - 1]);
 | 
				
			||||||
| 
						 | 
					@ -664,8 +679,10 @@ static ssize_t set_pwm(struct device *dev, struct device_attribute *attr,
 | 
				
			||||||
		data->pwm[CONTROL][sattr->index] =
 | 
							data->pwm[CONTROL][sattr->index] =
 | 
				
			||||||
			adt7475_read(PWM_CONFIG_REG(sattr->index));
 | 
								adt7475_read(PWM_CONFIG_REG(sattr->index));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		/* If we are not in manual mode, then we shouldn't allow
 | 
							/*
 | 
				
			||||||
		 * the user to set the pwm speed */
 | 
							 * If we are not in manual mode, then we shouldn't allow
 | 
				
			||||||
 | 
							 * the user to set the pwm speed
 | 
				
			||||||
 | 
							 */
 | 
				
			||||||
		if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) {
 | 
							if (((data->pwm[CONTROL][sattr->index] >> 5) & 7) != 7) {
 | 
				
			||||||
			mutex_unlock(&data->lock);
 | 
								mutex_unlock(&data->lock);
 | 
				
			||||||
			return count;
 | 
								return count;
 | 
				
			||||||
| 
						 | 
					@ -1280,9 +1297,11 @@ static int adt7475_probe(struct i2c_client *client,
 | 
				
			||||||
	if ((data->config4 & CONFIG4_PINFUNC) == 0x0)
 | 
						if ((data->config4 & CONFIG4_PINFUNC) == 0x0)
 | 
				
			||||||
		data->has_fan4 = 1;
 | 
							data->has_fan4 = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* THERM configuration is more complex on the ADT7476 and ADT7490,
 | 
						/*
 | 
				
			||||||
	   because 2 different pins (TACH4 and +2.5 Vin) can be used for
 | 
						 * THERM configuration is more complex on the ADT7476 and ADT7490,
 | 
				
			||||||
	   this function */
 | 
						 * because 2 different pins (TACH4 and +2.5 Vin) can be used for
 | 
				
			||||||
 | 
						 * this function
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	if (id->driver_data == adt7490) {
 | 
						if (id->driver_data == adt7490) {
 | 
				
			||||||
		if ((data->config4 & CONFIG4_PINFUNC) == 0x1 &&
 | 
							if ((data->config4 & CONFIG4_PINFUNC) == 0x1 &&
 | 
				
			||||||
		    !(config3 & CONFIG3_THERM))
 | 
							    !(config3 & CONFIG3_THERM))
 | 
				
			||||||
| 
						 | 
					@ -1294,8 +1313,10 @@ static int adt7475_probe(struct i2c_client *client,
 | 
				
			||||||
			data->has_voltage |= (1 << 0);		/* in0 */
 | 
								data->has_voltage |= (1 << 0);		/* in0 */
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* On the ADT7476, the +12V input pin may instead be used as VID5,
 | 
						/*
 | 
				
			||||||
	   and VID pins may alternatively be used as GPIO */
 | 
						 * On the ADT7476, the +12V input pin may instead be used as VID5,
 | 
				
			||||||
 | 
						 * and VID pins may alternatively be used as GPIO
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	if (id->driver_data == adt7476) {
 | 
						if (id->driver_data == adt7476) {
 | 
				
			||||||
		u8 vid = adt7475_read(REG_VID);
 | 
							u8 vid = adt7475_read(REG_VID);
 | 
				
			||||||
		if (!(vid & VID_VIDSEL))
 | 
							if (!(vid & VID_VIDSEL))
 | 
				
			||||||
| 
						 | 
					@ -1314,8 +1335,10 @@ static int adt7475_probe(struct i2c_client *client,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	data->bypass_attn &= data->has_voltage;
 | 
						data->bypass_attn &= data->has_voltage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Call adt7475_read_pwm for all pwm's as this will reprogram any
 | 
						/*
 | 
				
			||||||
	   pwm's which are disabled to manual mode with 0% duty cycle */
 | 
						 * Call adt7475_read_pwm for all pwm's as this will reprogram any
 | 
				
			||||||
 | 
						 * pwm's which are disabled to manual mode with 0% duty cycle
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	for (i = 0; i < ADT7475_PWM_COUNT; i++)
 | 
						for (i = 0; i < ADT7475_PWM_COUNT; i++)
 | 
				
			||||||
		adt7475_read_pwm(client, i);
 | 
							adt7475_read_pwm(client, i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1431,8 +1454,10 @@ static void adt7475_read_pwm(struct i2c_client *client, int index)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index));
 | 
						data->pwm[CONTROL][index] = adt7475_read(PWM_CONFIG_REG(index));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Figure out the internal value for pwmctrl and pwmchan
 | 
						/*
 | 
				
			||||||
	   based on the current settings */
 | 
						 * Figure out the internal value for pwmctrl and pwmchan
 | 
				
			||||||
 | 
						 * based on the current settings
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	v = (data->pwm[CONTROL][index] >> 5) & 7;
 | 
						v = (data->pwm[CONTROL][index] >> 5) & 7;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (v == 3)
 | 
						if (v == 3)
 | 
				
			||||||
| 
						 | 
					@ -1440,9 +1465,10 @@ static void adt7475_read_pwm(struct i2c_client *client, int index)
 | 
				
			||||||
	else if (v == 7)
 | 
						else if (v == 7)
 | 
				
			||||||
		data->pwmctl[index] = 1;
 | 
							data->pwmctl[index] = 1;
 | 
				
			||||||
	else if (v == 4) {
 | 
						else if (v == 4) {
 | 
				
			||||||
		/* The fan is disabled - we don't want to
 | 
							/*
 | 
				
			||||||
		   support that, so change to manual mode and
 | 
							 * The fan is disabled - we don't want to
 | 
				
			||||||
		   set the duty cycle to 0 instead
 | 
							 * support that, so change to manual mode and
 | 
				
			||||||
 | 
							 * set the duty cycle to 0 instead
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		data->pwm[INPUT][index] = 0;
 | 
							data->pwm[INPUT][index] = 0;
 | 
				
			||||||
		data->pwm[CONTROL][index] &= ~0xE0;
 | 
							data->pwm[CONTROL][index] &= ~0xE0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue