Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c92758ce authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'release' of git://lm-sensors.org/kernel/mhoffman/hwmon-2.6:
  hwmon: (adt7473) minor cleanup / refactoring
  hwmon: (asb100) Remove some dead code
  hwmon: (lm75) Fix an incorrect comment
  hwmon: (w83793) VID and VRM handling cleanups
  hwmon: (w83l785ts) Don't ask the user to report failures
  hwmon: (smsc47b397) add a new chip id (0x8c)
parents 03fc922f 4f02f822
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -33,7 +33,8 @@ Known Issues
------------

On some systems (Asus), the BIOS is known to interfere with the driver
and cause read errors. The driver will retry a given number of times
and cause read errors. Or maybe the W83L785TS-S chip is simply unreliable,
we don't really know. The driver will retry a given number of times
(5 by default) and then give up, returning the old value (or 0 if
there is no old value). It seems to work well enough so that you should
not notice anything. Thanks to James Bolt for helping test this feature.
+23 −22
Original line number Diff line number Diff line
@@ -422,18 +422,14 @@ static ssize_t show_volt(struct device *dev, struct device_attribute *devattr,
 * number in the range -128 to 127, or as an unsigned number that must
 * be offset by 64.
 */
static int decode_temp(struct adt7473_data *data, u8 raw)
static int decode_temp(u8 twos_complement, u8 raw)
{
	if (data->temp_twos_complement)
		return (s8)raw;
	return raw - 64;
	return twos_complement ? (s8)raw : raw - 64;
}

static u8 encode_temp(struct adt7473_data *data, int cooked)
static u8 encode_temp(u8 twos_complement, int cooked)
{
	if (data->temp_twos_complement)
		return (cooked & 0xFF);
	return cooked + 64;
	return twos_complement ? cooked & 0xFF : cooked + 64;
}

static ssize_t show_temp_min(struct device *dev,
@@ -442,8 +438,9 @@ static ssize_t show_temp_min(struct device *dev,
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct adt7473_data *data = adt7473_update_device(dev);
	return sprintf(buf, "%d\n",
		       1000 * decode_temp(data, data->temp_min[attr->index]));
	return sprintf(buf, "%d\n", 1000 * decode_temp(
						data->temp_twos_complement,
						data->temp_min[attr->index]));
}

static ssize_t set_temp_min(struct device *dev,
@@ -455,7 +452,7 @@ static ssize_t set_temp_min(struct device *dev,
	struct i2c_client *client = to_i2c_client(dev);
	struct adt7473_data *data = i2c_get_clientdata(client);
	int temp = simple_strtol(buf, NULL, 10) / 1000;
	temp = encode_temp(data, temp);
	temp = encode_temp(data->temp_twos_complement, temp);

	mutex_lock(&data->lock);
	data->temp_min[attr->index] = temp;
@@ -472,8 +469,9 @@ static ssize_t show_temp_max(struct device *dev,
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct adt7473_data *data = adt7473_update_device(dev);
	return sprintf(buf, "%d\n",
		       1000 * decode_temp(data, data->temp_max[attr->index]));
	return sprintf(buf, "%d\n", 1000 * decode_temp(
						data->temp_twos_complement,
						data->temp_max[attr->index]));
}

static ssize_t set_temp_max(struct device *dev,
@@ -485,7 +483,7 @@ static ssize_t set_temp_max(struct device *dev,
	struct i2c_client *client = to_i2c_client(dev);
	struct adt7473_data *data = i2c_get_clientdata(client);
	int temp = simple_strtol(buf, NULL, 10) / 1000;
	temp = encode_temp(data, temp);
	temp = encode_temp(data->temp_twos_complement, temp);

	mutex_lock(&data->lock);
	data->temp_max[attr->index] = temp;
@@ -501,8 +499,9 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *devattr,
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct adt7473_data *data = adt7473_update_device(dev);
	return sprintf(buf, "%d\n",
		       1000 * decode_temp(data, data->temp[attr->index]));
	return sprintf(buf, "%d\n", 1000 * decode_temp(
						data->temp_twos_complement,
						data->temp[attr->index]));
}

static ssize_t show_fan_min(struct device *dev,
@@ -671,8 +670,9 @@ static ssize_t show_temp_tmax(struct device *dev,
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct adt7473_data *data = adt7473_update_device(dev);
	return sprintf(buf, "%d\n",
		       1000 * decode_temp(data, data->temp_tmax[attr->index]));
	return sprintf(buf, "%d\n", 1000 * decode_temp(
						data->temp_twos_complement,
						data->temp_tmax[attr->index]));
}

static ssize_t set_temp_tmax(struct device *dev,
@@ -684,7 +684,7 @@ static ssize_t set_temp_tmax(struct device *dev,
	struct i2c_client *client = to_i2c_client(dev);
	struct adt7473_data *data = i2c_get_clientdata(client);
	int temp = simple_strtol(buf, NULL, 10) / 1000;
	temp = encode_temp(data, temp);
	temp = encode_temp(data->temp_twos_complement, temp);

	mutex_lock(&data->lock);
	data->temp_tmax[attr->index] = temp;
@@ -701,8 +701,9 @@ static ssize_t show_temp_tmin(struct device *dev,
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct adt7473_data *data = adt7473_update_device(dev);
	return sprintf(buf, "%d\n",
		       1000 * decode_temp(data, data->temp_tmin[attr->index]));
	return sprintf(buf, "%d\n", 1000 * decode_temp(
						data->temp_twos_complement,
						data->temp_tmin[attr->index]));
}

static ssize_t set_temp_tmin(struct device *dev,
@@ -714,7 +715,7 @@ static ssize_t set_temp_tmin(struct device *dev,
	struct i2c_client *client = to_i2c_client(dev);
	struct adt7473_data *data = i2c_get_clientdata(client);
	int temp = simple_strtol(buf, NULL, 10) / 1000;
	temp = encode_temp(data, temp);
	temp = encode_temp(data->temp_twos_complement, temp);

	mutex_lock(&data->lock);
	data->temp_tmin[attr->index] = temp;
+0 −4
Original line number Diff line number Diff line
@@ -953,12 +953,8 @@ static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value)
static void asb100_init_client(struct i2c_client *client)
{
	struct asb100_data *data = i2c_get_clientdata(client);
	int vid = 0;

	vid = asb100_read_value(client, ASB100_REG_VID_FANDIV) & 0x0f;
	vid |= (asb100_read_value(client, ASB100_REG_CHIPID) & 0x01) << 4;
	data->vrm = vid_which_vrm();
	vid = vid_from_reg(vid, data->vrm);

	/* Start monitoring */
	asb100_write_value(client, ASB100_REG_CONFIG,
+1 −4
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ static int lm75_detach_client(struct i2c_client *client)

/* All registers are word-sized, except for the configuration register.
   LM75 uses a high-byte first convention, which is exactly opposite to
   the usual practice. */
   the SMBus standard. */
static int lm75_read_value(struct i2c_client *client, u8 reg)
{
	if (reg == LM75_REG_CONF)
@@ -257,9 +257,6 @@ static int lm75_read_value(struct i2c_client *client, u8 reg)
		return swab16(i2c_smbus_read_word_data(client, reg));
}

/* All registers are word-sized, except for the configuration register.
   LM75 uses a high-byte first convention, which is exactly opposite to
   the usual practice. */
static int lm75_write_value(struct i2c_client *client, u8 reg, u16 value)
{
	if (reg == LM75_REG_CONF)
+14 −3
Original line number Diff line number Diff line
@@ -335,11 +335,23 @@ static int __init smsc47b397_device_add(unsigned short address)
static int __init smsc47b397_find(unsigned short *addr)
{
	u8 id, rev;
	char *name;

	superio_enter();
	id = force_id ? force_id : superio_inb(SUPERIO_REG_DEVID);

	if ((id != 0x6f) && (id != 0x81) && (id != 0x85)) {
	switch(id) {
	case 0x81:
		name = "SCH5307-NS";
		break;
	case 0x6f:
		name = "LPC47B397-NC";
		break;
	case 0x85:
	case 0x8c:
		name = "SCH5317";
		break;
	default:
		superio_exit();
		return -ENODEV;
	}
@@ -352,8 +364,7 @@ static int __init smsc47b397_find(unsigned short *addr)

	printk(KERN_INFO DRVNAME ": found SMSC %s "
		"(base address 0x%04x, revision %u)\n",
		id == 0x81 ? "SCH5307-NS" : id == 0x85 ? "SCH5317" :
	       "LPC47B397-NC", *addr, rev);
		name, *addr, rev);

	superio_exit();
	return 0;
Loading