hwmon fixes for v5.13-rc6

Fixes for tps23861, scpi-hwmon, and corsair-psu drivers, plus a bindings
 fix for TI ADS7828.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEiHPvMQj9QTOCiqgVyx8mb86fmYEFAmDDPgAACgkQyx8mb86f
 mYFH2g/+IxiJskcNMPCxJ+DjkeI8Sbms8DGRd+pN924rLwCVmRSsHjHEDZt08Jzp
 lXKWAk/D762UaBSZjNN/JVbNpVyI5NSwwZsgoAnWyvr+br3snph3NjNqCe+8jmJR
 BJe/1vHJONtfVtfypbkG+f64A9hKHelGZPG+TAtAhg6C6UrrRNtVodrcVPc353Sn
 zSDmtuvYEJ2wVEiCtM5YPLYGMO406GHfpOXXp005sRW61rdvHTwJpTP0dKp37jmQ
 NH+xZ+5Mzkya1f7rHZ6Hs9/ndL6LVgLAw1eNNEn4o5o/RLJ252T0VEaTiX0kYKt5
 f0CuAuex3O8anvFVcZb2bly46aHc9k96E3LCB/0m3vKQrEWFLUqkzMuuJMZ8xmPy
 z45jVNzSbE5sIgp+YgQ/Q3y7jpPIxh6KPK+jlC5oXS1Az2ZwrkwUknjLkgigibXz
 H+9RjI8vSk0fLEA+Bn7w/bEUbte884RFDPm8w8HmfPEhd7jlvpDGEZtrRrJl1ZkS
 EMq5hkFzvDYOVgpH+9kHUSpg+Yr9tBZL5cDoPfgswf93msvPwkO76ch2E2Oxxb3E
 YR5I6e1D8zRHfWZipR5RrK6BWZVbLd2RylZ7tbu+7X6+Uft9TJI1BmjSXIlrubAi
 7SdEnU7zrnqf9ld3uh3io10dcOmNi78GGgNW9BaCZ7tJCLzabHI=
 =xYUh
 -----END PGP SIGNATURE-----

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

Pull hwmon fixes from Guenter Roeck:
 "Fixes for tps23861, scpi-hwmon, and corsair-psu drivers, plus a
  bindings fix for TI ADS7828"

* tag 'hwmon-for-v5.13-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (tps23861) correct shunt LSB values
  hwmon: (tps23861) set current shunt value
  hwmon: (tps23861) define regmap max register
  hwmon: (scpi-hwmon) shows the negative temperature properly
  hwmon: (corsair-psu) fix suspend behavior
  dt-bindings: hwmon: Fix typo in TI ADS7828 bindings
This commit is contained in:
Linus Torvalds 2021-06-11 10:07:50 -07:00
commit 4244b5d872
4 changed files with 39 additions and 3 deletions

View File

@ -49,7 +49,7 @@ examples:
#size-cells = <0>; #size-cells = <0>;
adc@48 { adc@48 {
comatible = "ti,ads7828"; compatible = "ti,ads7828";
reg = <0x48>; reg = <0x48>;
vref-supply = <&vref>; vref-supply = <&vref>;
ti,differential-input; ti,differential-input;

View File

@ -771,6 +771,16 @@ static int corsairpsu_raw_event(struct hid_device *hdev, struct hid_report *repo
return 0; return 0;
} }
#ifdef CONFIG_PM
static int corsairpsu_resume(struct hid_device *hdev)
{
struct corsairpsu_data *priv = hid_get_drvdata(hdev);
/* some PSUs turn off the microcontroller during standby, so a reinit is required */
return corsairpsu_init(priv);
}
#endif
static const struct hid_device_id corsairpsu_idtable[] = { static const struct hid_device_id corsairpsu_idtable[] = {
{ HID_USB_DEVICE(0x1b1c, 0x1c03) }, /* Corsair HX550i */ { HID_USB_DEVICE(0x1b1c, 0x1c03) }, /* Corsair HX550i */
{ HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */ { HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */
@ -793,6 +803,10 @@ static struct hid_driver corsairpsu_driver = {
.probe = corsairpsu_probe, .probe = corsairpsu_probe,
.remove = corsairpsu_remove, .remove = corsairpsu_remove,
.raw_event = corsairpsu_raw_event, .raw_event = corsairpsu_raw_event,
#ifdef CONFIG_PM
.resume = corsairpsu_resume,
.reset_resume = corsairpsu_resume,
#endif
}; };
module_hid_driver(corsairpsu_driver); module_hid_driver(corsairpsu_driver);

View File

@ -99,6 +99,15 @@ scpi_show_sensor(struct device *dev, struct device_attribute *attr, char *buf)
scpi_scale_reading(&value, sensor); scpi_scale_reading(&value, sensor);
/*
* Temperature sensor values are treated as signed values based on
* observation even though that is not explicitly specified, and
* because an unsigned u64 temperature does not really make practical
* sense especially when the temperature is below zero degrees Celsius.
*/
if (sensor->info.class == TEMPERATURE)
return sprintf(buf, "%lld\n", (s64)value);
return sprintf(buf, "%llu\n", value); return sprintf(buf, "%llu\n", value);
} }

View File

@ -99,11 +99,14 @@
#define POWER_ENABLE 0x19 #define POWER_ENABLE 0x19
#define TPS23861_NUM_PORTS 4 #define TPS23861_NUM_PORTS 4
#define TPS23861_GENERAL_MASK_1 0x17
#define TPS23861_CURRENT_SHUNT_MASK BIT(0)
#define TEMPERATURE_LSB 652 /* 0.652 degrees Celsius */ #define TEMPERATURE_LSB 652 /* 0.652 degrees Celsius */
#define VOLTAGE_LSB 3662 /* 3.662 mV */ #define VOLTAGE_LSB 3662 /* 3.662 mV */
#define SHUNT_RESISTOR_DEFAULT 255000 /* 255 mOhm */ #define SHUNT_RESISTOR_DEFAULT 255000 /* 255 mOhm */
#define CURRENT_LSB_255 62260 /* 62.260 uA */ #define CURRENT_LSB_250 62260 /* 62.260 uA */
#define CURRENT_LSB_250 61039 /* 61.039 uA */ #define CURRENT_LSB_255 61039 /* 61.039 uA */
#define RESISTANCE_LSB 110966 /* 11.0966 Ohm*/ #define RESISTANCE_LSB 110966 /* 11.0966 Ohm*/
#define RESISTANCE_LSB_LOW 157216 /* 15.7216 Ohm*/ #define RESISTANCE_LSB_LOW 157216 /* 15.7216 Ohm*/
@ -117,6 +120,7 @@ struct tps23861_data {
static struct regmap_config tps23861_regmap_config = { static struct regmap_config tps23861_regmap_config = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 8, .val_bits = 8,
.max_register = 0x6f,
}; };
static int tps23861_read_temp(struct tps23861_data *data, long *val) static int tps23861_read_temp(struct tps23861_data *data, long *val)
@ -560,6 +564,15 @@ static int tps23861_probe(struct i2c_client *client)
else else
data->shunt_resistor = SHUNT_RESISTOR_DEFAULT; data->shunt_resistor = SHUNT_RESISTOR_DEFAULT;
if (data->shunt_resistor == SHUNT_RESISTOR_DEFAULT)
regmap_clear_bits(data->regmap,
TPS23861_GENERAL_MASK_1,
TPS23861_CURRENT_SHUNT_MASK);
else
regmap_set_bits(data->regmap,
TPS23861_GENERAL_MASK_1,
TPS23861_CURRENT_SHUNT_MASK);
hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name, hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name,
data, &tps23861_chip_info, data, &tps23861_chip_info,
NULL); NULL);