mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-30 16:07:39 +00:00
Couple of minor driver fixes.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iQIcBAABAgAGBQJPR9QMAAoJEMsfJm/On5mBWbgP+wcJFIpqh84EyFGQuhSt61su MQYcF8fWexSBzYjK5TB0nOougY/DQfTIBrqGf00Yr0RM81W3DlfbFNfl9tlBSwee SEMBIm8qXALjWGb0eL3gy+Y8U10I2Pe0AvAvbiw3rjuJadqCLKljIQjQgwsuY0zY yHwmeYgLTHVQfH8pk1n2QCFviqC4Lfd4Ltf/9EdQjm3WMxbJdLfHFnb99JvUt9Cu b/NlXjeECZFLmX4P7JltdcfixbDUls9bPioFoldR8g5k1t/nCpnuUqPyj75zjQFk D3WwzdA+YzH2nvoj0c+RjFBXYoHG7M/DFkKAy3ZF2cuRvxWP8QDK+WBbbOfA3HBF YeefJp7hThRZVTkLCW+rG93PcUAIbOyX2tEk7DuaVlM9MyMjE/2SMqVw+AO6PBDS 4qXgfBrFmpVB6rapChD2M8RJsjbV5rw6eI3jM3+e2MJWDrCKgi13KHaCsUWTRFXI l429vy809sdAx+8dTJK4KOIytFXDrrsw6tMPs9JQvcbLr2Bpn/4/jyUSyrZ0a7J4 ovfQtFk7y9NPHgjQmOswZm2yJPLwEJbuMUcwK3iIpelX8Y51ltMuVaQymKTeJAwi +elRGK24q8C8wmRKT3mul4qSTmdvC+8nsAMD4/ozKsgDyO4oc9SYhf46mjCXzyn2 km0owCCnyoFWzS+w9lUJ =YJz+ -----END PGP SIGNATURE----- Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging Couple of minor driver fixes. * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (max34440) Fix resetting temperature history hwmon: (f75375s) Fix register write order when setting fans to full speed hwmon: (ads1015) Fix file leak in probe function hwmon: (max6639) Fix PPR register initialization to set both channels hwmon: (max6639) Fix FAN_FROM_REG calculation
This commit is contained in:
commit
00b10ecf2d
4 changed files with 17 additions and 17 deletions
|
@ -271,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client,
|
|||
continue;
|
||||
err = device_create_file(&client->dev, &ads1015_in[k].dev_attr);
|
||||
if (err)
|
||||
goto exit_free;
|
||||
goto exit_remove;
|
||||
}
|
||||
|
||||
data->hwmon_dev = hwmon_device_register(&client->dev);
|
||||
|
@ -285,7 +285,6 @@ static int ads1015_probe(struct i2c_client *client,
|
|||
exit_remove:
|
||||
for (k = 0; k < ADS1015_CHANNELS; ++k)
|
||||
device_remove_file(&client->dev, &ads1015_in[k].dev_attr);
|
||||
exit_free:
|
||||
kfree(data);
|
||||
exit:
|
||||
return err;
|
||||
|
|
|
@ -340,8 +340,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
|
|||
fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
|
||||
fanmode |= (1 << F75387_FAN_DUTY_MODE(nr));
|
||||
data->pwm[nr] = 255;
|
||||
f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
|
||||
data->pwm[nr]);
|
||||
break;
|
||||
case 1: /* PWM */
|
||||
fanmode |= (1 << F75387_FAN_MANU_MODE(nr));
|
||||
|
@ -361,8 +359,6 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
|
|||
case 0: /* full speed */
|
||||
fanmode |= (3 << FAN_CTRL_MODE(nr));
|
||||
data->pwm[nr] = 255;
|
||||
f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
|
||||
data->pwm[nr]);
|
||||
break;
|
||||
case 1: /* PWM */
|
||||
fanmode |= (3 << FAN_CTRL_MODE(nr));
|
||||
|
@ -377,6 +373,9 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val)
|
|||
|
||||
f75375_write8(client, F75375_REG_FAN_TIMER, fanmode);
|
||||
data->pwm_enable[nr] = val;
|
||||
if (val == 0)
|
||||
f75375_write8(client, F75375_REG_FAN_PWM_DUTY(nr),
|
||||
data->pwm[nr]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,8 +72,8 @@ static unsigned short normal_i2c[] = { 0x2c, 0x2e, 0x2f, I2C_CLIENT_END };
|
|||
|
||||
static const int rpm_ranges[] = { 2000, 4000, 8000, 16000 };
|
||||
|
||||
#define FAN_FROM_REG(val, div, rpm_range) ((val) == 0 ? -1 : \
|
||||
(val) == 255 ? 0 : (rpm_ranges[rpm_range] * 30) / ((div + 1) * (val)))
|
||||
#define FAN_FROM_REG(val, rpm_range) ((val) == 0 || (val) == 255 ? \
|
||||
0 : (rpm_ranges[rpm_range] * 30) / (val))
|
||||
#define TEMP_LIMIT_TO_REG(val) SENSORS_LIMIT((val) / 1000, 0, 255)
|
||||
|
||||
/*
|
||||
|
@ -333,7 +333,7 @@ static ssize_t show_fan_input(struct device *dev,
|
|||
return PTR_ERR(data);
|
||||
|
||||
return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index],
|
||||
data->ppr, data->rpm_range));
|
||||
data->rpm_range));
|
||||
}
|
||||
|
||||
static ssize_t show_alarm(struct device *dev,
|
||||
|
@ -429,9 +429,9 @@ static int max6639_init_client(struct i2c_client *client)
|
|||
struct max6639_data *data = i2c_get_clientdata(client);
|
||||
struct max6639_platform_data *max6639_info =
|
||||
client->dev.platform_data;
|
||||
int i = 0;
|
||||
int i;
|
||||
int rpm_range = 1; /* default: 4000 RPM */
|
||||
int err = 0;
|
||||
int err;
|
||||
|
||||
/* Reset chip to default values, see below for GCONFIG setup */
|
||||
err = i2c_smbus_write_byte_data(client, MAX6639_REG_GCONFIG,
|
||||
|
@ -446,11 +446,6 @@ static int max6639_init_client(struct i2c_client *client)
|
|||
else
|
||||
data->ppr = 2;
|
||||
data->ppr -= 1;
|
||||
err = i2c_smbus_write_byte_data(client,
|
||||
MAX6639_REG_FAN_PPR(i),
|
||||
data->ppr << 5);
|
||||
if (err)
|
||||
goto exit;
|
||||
|
||||
if (max6639_info)
|
||||
rpm_range = rpm_range_to_reg(max6639_info->rpm_range);
|
||||
|
@ -458,6 +453,13 @@ static int max6639_init_client(struct i2c_client *client)
|
|||
|
||||
for (i = 0; i < 2; i++) {
|
||||
|
||||
/* Set Fan pulse per revolution */
|
||||
err = i2c_smbus_write_byte_data(client,
|
||||
MAX6639_REG_FAN_PPR(i),
|
||||
data->ppr << 6);
|
||||
if (err)
|
||||
goto exit;
|
||||
|
||||
/* Fans config PWM, RPM */
|
||||
err = i2c_smbus_write_byte_data(client,
|
||||
MAX6639_REG_FAN_CONFIG1(i),
|
||||
|
|
|
@ -82,7 +82,7 @@ static int max34440_write_word_data(struct i2c_client *client, int page,
|
|||
case PMBUS_VIRT_RESET_TEMP_HISTORY:
|
||||
ret = pmbus_write_word_data(client, page,
|
||||
MAX34440_MFR_TEMPERATURE_PEAK,
|
||||
0xffff);
|
||||
0x8000);
|
||||
break;
|
||||
default:
|
||||
ret = -ENODATA;
|
||||
|
|
Loading…
Reference in a new issue