mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 20:22:09 +00:00
hwmon fixes for v5.9-rc3
- 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 -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAl9KKcMACgkQyx8mb86f mYH92hAAmUH8JS/M3QPNxxUUXUW5PqbRabv/TiSSnTTawjoZ3X0VYBCk5ntrV3oz 5HWrNFHZ/o/hKwkPZqIgkEaSdSC2VYhDnlOdLHzx1Eior/QugmXm8qfmywjSUy9Z 5Y4SMsHHFq+vSiNZgovUjwJC5swfxHuav+RAKSZkXWsphGwJ44N25uYxN3ytpRFi 3zFPbVC7ITNQbxQTdKqHsUmCAb5PknDM3fwdvEWMQl/0UaEIxvX8+062ipuJborr 4+Z0lz0hDrZRdlMAe9JuGAHwUSAAF9g+Gctb1Zwdg500ofZI4cuxMrzqYwJKuG78 86Xp0lu8K7m8Z1VwENVwfRxkGQUESdr3P9uX03O1vmcFeEE2Zn2pAnjZR19Z62x4 SmKlOFQFKMVXdiFlsqQPfHM+OWl6B6TEVQOP1Wa9Cyoyb5VtEgpyw58ppYKhqOWs hCz/6Ap6kO1Pfq9oShwWAw7clbG2iC4cApzZDrfaXCNTh523YKlCUeGgJL7g7tVR c26i3xu0HB1Rhr2fUqirnAWhpLuZTcP7cRpCU8FcsicHcwHhJv1Kl2WGL3pyuB7O rIPwFZ8j0L4qqnXewEpvOt3Libk8GXJlSjfdMdVsKm8EKPmusY3N3C/+6oazN8UR OvA+72nIofcMtQ/8dG9LetY3ri+kmnp9sXmbHPmTPVHZ94NCgS4= =Nr4L -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
e4cad138aa
@ -753,15 +753,18 @@ static ssize_t applesmc_light_show(struct device *dev,
|
||||
}
|
||||
|
||||
ret = applesmc_read_key(LIGHT_SENSOR_LEFT_KEY, buffer, data_length);
|
||||
if (ret)
|
||||
goto out;
|
||||
/* newer macbooks report a single 10-bit bigendian value */
|
||||
if (data_length == 10) {
|
||||
left = be16_to_cpu(*(__be16 *)(buffer + 6)) >> 2;
|
||||
goto out;
|
||||
}
|
||||
left = buffer[2];
|
||||
|
||||
ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
|
||||
if (ret)
|
||||
goto out;
|
||||
ret = applesmc_read_key(LIGHT_SENSOR_RIGHT_KEY, buffer, data_length);
|
||||
right = buffer[2];
|
||||
|
||||
out:
|
||||
@ -810,12 +813,11 @@ static ssize_t applesmc_show_fan_speed(struct device *dev,
|
||||
to_index(attr));
|
||||
|
||||
ret = applesmc_read_key(newkey, buffer, 2);
|
||||
speed = ((buffer[0] << 8 | buffer[1]) >> 2);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
else
|
||||
return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed);
|
||||
|
||||
speed = ((buffer[0] << 8 | buffer[1]) >> 2);
|
||||
return snprintf(sysfsbuf, PAGE_SIZE, "%u\n", speed);
|
||||
}
|
||||
|
||||
static ssize_t applesmc_store_fan_speed(struct device *dev,
|
||||
@ -851,12 +853,11 @@ static ssize_t applesmc_show_fan_manual(struct device *dev,
|
||||
u8 buffer[2];
|
||||
|
||||
ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
|
||||
manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
else
|
||||
return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual);
|
||||
|
||||
manual = ((buffer[0] << 8 | buffer[1]) >> to_index(attr)) & 0x01;
|
||||
return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", manual);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
ret = applesmc_read_key(FANS_MANUAL, buffer, 2);
|
||||
val = (buffer[0] << 8 | buffer[1]);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
val = (buffer[0] << 8 | buffer[1]);
|
||||
|
||||
if (input)
|
||||
val = val | (0x01 << to_index(attr));
|
||||
else
|
||||
@ -951,13 +953,12 @@ static ssize_t applesmc_key_count_show(struct device *dev,
|
||||
u32 count;
|
||||
|
||||
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)
|
||||
return ret;
|
||||
else
|
||||
return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count);
|
||||
|
||||
count = ((u32)buffer[0]<<24) + ((u32)buffer[1]<<16) +
|
||||
((u32)buffer[2]<<8) + buffer[3];
|
||||
return snprintf(sysfsbuf, PAGE_SIZE, "%d\n", count);
|
||||
}
|
||||
|
||||
static ssize_t applesmc_key_at_index_read_show(struct device *dev,
|
||||
|
@ -172,6 +172,7 @@ gsc_hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
|
||||
case mode_temperature:
|
||||
if (tmp > 0x8000)
|
||||
tmp -= 0xffff;
|
||||
tmp *= 100; /* convert to millidegrees celsius */
|
||||
break;
|
||||
case mode_voltage_raw:
|
||||
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,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
|
||||
if (cnt == 0x1fff)
|
||||
if (cnt == 0 || cnt == 0x1fff)
|
||||
rpm = 0;
|
||||
else
|
||||
rpm = 1350000 / cnt;
|
||||
@ -243,7 +243,7 @@ static int nct7904_read_fan(struct device *dev, u32 attr, int channel,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
cnt = ((ret & 0xff00) >> 3) | (ret & 0x1f);
|
||||
if (cnt == 0x1fff)
|
||||
if (cnt == 0 || cnt == 0x1fff)
|
||||
rpm = 0;
|
||||
else
|
||||
rpm = 1350000 / cnt;
|
||||
|
@ -67,6 +67,7 @@ enum variants {
|
||||
raa_dmpvr1_2rail,
|
||||
raa_dmpvr2_1rail,
|
||||
raa_dmpvr2_2rail,
|
||||
raa_dmpvr2_2rail_nontc,
|
||||
raa_dmpvr2_3rail,
|
||||
raa_dmpvr2_hv,
|
||||
};
|
||||
@ -241,6 +242,10 @@ static int isl68137_probe(struct i2c_client *client,
|
||||
info->pages = 1;
|
||||
info->read_word_data = raa_dmpvr2_read_word_data;
|
||||
break;
|
||||
case raa_dmpvr2_2rail_nontc:
|
||||
info->func[0] &= ~PMBUS_HAVE_TEMP;
|
||||
info->func[1] &= ~PMBUS_HAVE_TEMP;
|
||||
fallthrough;
|
||||
case raa_dmpvr2_2rail:
|
||||
info->pages = 2;
|
||||
info->read_word_data = raa_dmpvr2_read_word_data;
|
||||
@ -304,7 +309,7 @@ static const struct i2c_device_id raa_dmpvr_id[] = {
|
||||
{"raa228000", raa_dmpvr2_hv},
|
||||
{"raa228004", raa_dmpvr2_hv},
|
||||
{"raa228006", raa_dmpvr2_hv},
|
||||
{"raa228228", raa_dmpvr2_2rail},
|
||||
{"raa228228", raa_dmpvr2_2rail_nontc},
|
||||
{"raa229001", raa_dmpvr2_2rail},
|
||||
{"raa229004", raa_dmpvr2_2rail},
|
||||
{}
|
||||
|
Loading…
Reference in New Issue
Block a user