Commit e4cad138 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'hwmon-for-v5.9-rc3' of...

Merge tag 'hwmon-for-v5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - Fix tempeerature scale in gsc-hwmon driver

 - Fix divide by 0 error in nct7904 driver

 - Drop non-existing attribute from pmbus/isl68137 driver

 - Fix status check in applesmc driver

* tag 'hwmon-for-v5.9-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (gsc-hwmon) Scale temperature to millidegrees
  hwmon: (applesmc) check status earlier.
  hwmon: (nct7904) Correct divide by 0
  hwmon: (pmbus/isl68137) remove READ_TEMPERATURE_1 telemetry for RAA228228
parents 4d41ead6 c1ae18d3
...@@ -753,15 +753,18 @@ static ssize_t applesmc_light_show(struct device *dev, ...@@ -753,15 +753,18 @@ static ssize_t applesmc_light_show(struct device *dev,
} }
ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length); ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
if (ret)
goto out;
/* newer macbooks report a single 10-bit bigendian value */ /* newer macbooks report a single 10-bit bigendian value */
if (data_length == 10) { if (data_length == 10) {
left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2; left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
goto out; goto out;
} }
left = buffer[2]; left = buffer[2];
ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
if (ret) if (ret)
goto out; goto out;
ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
right = buffer[2]; right = buffer[2];
out: out:
...@@ -810,11 +813,10 @@ static ssize_t applesmc_show_fan_speed(struct device *dev, ...@@ -810,11 +813,10 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
to_index(attr)); to_index(attr));
ret = applesmc_read_key(newkey, buffer, 2); ret = applesmc_read_key(newkey, buffer, 2);
speed = ((buffer[0] << 8 | buffer[1]) >> 2);
if (ret) if (ret)
return ret; return ret;
else
speed = ((buffer[0] << 8 | buffer[1]) >> 2);
return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed); return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed);
} }
...@@ -851,11 +853,10 @@ static ssize_t applesmc_show_fan_manual(struct device *dev, ...@@ -851,11 +853,10 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,
u8 buffer[2]; u8 buffer[2];
ret = applesmc_read_key(FANS_MANUAL, buffer, 2); ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
if (ret) if (ret)
return ret; return ret;
else
manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual); return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual);
} }
...@@ -872,10 +873,11 @@ static ssize_t applesmc_store_fan_manual(struct device *dev, ...@@ -872,10 +873,11 @@ static ssize_t applesmc_store_fan_manual(struct device *dev,
return -EINVAL; return -EINVAL;
ret = applesmc_read_key(FANS_MANUAL, buffer, 2); ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
val = (buffer[0] << 8 | buffer[1]);
if (ret) if (ret)
goto out; goto out;
val = (buffer[0] << 8 | buffer[1]);
if (input) if (input)
val = val | (0x01 << to_index(attr)); val = val | (0x01 << to_index(attr));
else else
...@@ -951,12 +953,11 @@ static ssize_t applesmc_key_count_show(struct device *dev, ...@@ -951,12 +953,11 @@ static ssize_t applesmc_key_count_show(struct device *dev,
u32 count; u32 count;
ret = applesmc_read_key(KEY_COUNT_KEY, buffer, 4); ret = applesmc_read_key(KEY_COUNT_KEY, buffer, 4);
count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) +
((u32)buffer[2]<<8) + buffer[3];
if (ret) if (ret)
return ret; return ret;
else
count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) +
((u32)buffer[2]<<8) + buffer[3];
return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count); return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count);
} }
......
...@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, ...@@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
case mode_temperature: case mode_temperature:
if (tmp > 0x8000) if (tmp > 0x8000)
tmp -= 0xffff; tmp -= 0xffff;
tmp *= 100; /* convert to millidegrees celsius */
break; break;
case mode_voltage_raw: case mode_voltage_raw:
tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION)); tmp = clamp_val(tmp, 0, BIT(GSC_HWMON_RESOLUTION));
......
...@@ -231,7 +231,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel, ...@@ -231,7 +231,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
if (ret < 0) if (ret < 0)
return ret; return ret;
cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f); cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
if (cnt == 0x1fff) if (cnt == 0 || cnt == 0x1fff)
rpm = 0; rpm = 0;
else else
rpm = 1350000 / cnt; rpm = 1350000 / cnt;
...@@ -243,7 +243,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel, ...@@ -243,7 +243,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
if (ret < 0) if (ret < 0)
return ret; return ret;
cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f); cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
if (cnt == 0x1fff) if (cnt == 0 || cnt == 0x1fff)
rpm = 0; rpm = 0;
else else
rpm = 1350000 / cnt; rpm = 1350000 / cnt;
......
...@@ -67,6 +67,7 @@ enum variants { ...@@ -67,6 +67,7 @@ enum variants {
raa_dmpvr1_2rail, raa_dmpvr1_2rail,
raa_dmpvr2_1rail, raa_dmpvr2_1rail,
raa_dmpvr2_2rail, raa_dmpvr2_2rail,
raa_dmpvr2_2rail_nontc,
raa_dmpvr2_3rail, raa_dmpvr2_3rail,
raa_dmpvr2_hv, raa_dmpvr2_hv,
}; };
...@@ -241,6 +242,10 @@ static int isl68137_probe(struct i2c_client *client, ...@@ -241,6 +242,10 @@ static int isl68137_probe(struct i2c_client *client,
info->pages = 1; info->pages = 1;
info->read_word_data = raa_dmpvr2_read_word_data; info->read_word_data = raa_dmpvr2_read_word_data;
break; break;
case raa_dmpvr2_2rail_nontc:
info->func[0] &= ~PMBUS_HAVE_TEMP;
info->func[1] &= ~PMBUS_HAVE_TEMP;
fallthrough;
case raa_dmpvr2_2rail: case raa_dmpvr2_2rail:
info->pages = 2; info->pages = 2;
info->read_word_data = raa_dmpvr2_read_word_data; info->read_word_data = raa_dmpvr2_read_word_data;
...@@ -304,7 +309,7 @@ static const struct i2c_device_id raa_dmpvr_id[] = { ...@@ -304,7 +309,7 @@ static const struct i2c_device_id raa_dmpvr_id[] = {
{"raa228000", raa_dmpvr2_hv}, {"raa228000", raa_dmpvr2_hv},
{"raa228004", raa_dmpvr2_hv}, {"raa228004", raa_dmpvr2_hv},
{"raa228006", raa_dmpvr2_hv}, {"raa228006", raa_dmpvr2_hv},
{"raa228228", raa_dmpvr2_2rail}, {"raa228228", raa_dmpvr2_2rail_nontc},
{"raa229001", raa_dmpvr2_2rail}, {"raa229001", raa_dmpvr2_2rail},
{"raa229004", raa_dmpvr2_2rail}, {"raa229004", raa_dmpvr2_2rail},
{} {}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment