Skip to content

Commit 4244b5d

Browse files
committed
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
2 parents f30dc8f + e13d112 commit 4244b5d

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

Documentation/devicetree/bindings/hwmon/ti,ads7828.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ examples:
4949
#size-cells = <0>;
5050
5151
adc@48 {
52-
comatible = "ti,ads7828";
52+
compatible = "ti,ads7828";
5353
reg = <0x48>;
5454
vref-supply = <&vref>;
5555
ti,differential-input;

drivers/hwmon/corsair-psu.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,16 @@ static int corsairpsu_raw_event(struct hid_device *hdev, struct hid_report *repo
771771
return 0;
772772
}
773773

774+
#ifdef CONFIG_PM
775+
static int corsairpsu_resume(struct hid_device *hdev)
776+
{
777+
struct corsairpsu_data *priv = hid_get_drvdata(hdev);
778+
779+
/* some PSUs turn off the microcontroller during standby, so a reinit is required */
780+
return corsairpsu_init(priv);
781+
}
782+
#endif
783+
774784
static const struct hid_device_id corsairpsu_idtable[] = {
775785
{ HID_USB_DEVICE(0x1b1c, 0x1c03) }, /* Corsair HX550i */
776786
{ HID_USB_DEVICE(0x1b1c, 0x1c04) }, /* Corsair HX650i */
@@ -793,6 +803,10 @@ static struct hid_driver corsairpsu_driver = {
793803
.probe = corsairpsu_probe,
794804
.remove = corsairpsu_remove,
795805
.raw_event = corsairpsu_raw_event,
806+
#ifdef CONFIG_PM
807+
.resume = corsairpsu_resume,
808+
.reset_resume = corsairpsu_resume,
809+
#endif
796810
};
797811
module_hid_driver(corsairpsu_driver);
798812

drivers/hwmon/scpi-hwmon.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ scpi_show_sensor(struct device *dev, struct device_attribute *attr, char *buf)
9999

100100
scpi_scale_reading(&value, sensor);
101101

102+
/*
103+
* Temperature sensor values are treated as signed values based on
104+
* observation even though that is not explicitly specified, and
105+
* because an unsigned u64 temperature does not really make practical
106+
* sense especially when the temperature is below zero degrees Celsius.
107+
*/
108+
if (sensor->info.class == TEMPERATURE)
109+
return sprintf(buf, "%lld\n", (s64)value);
110+
102111
return sprintf(buf, "%llu\n", value);
103112
}
104113

drivers/hwmon/tps23861.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@
9999
#define POWER_ENABLE 0x19
100100
#define TPS23861_NUM_PORTS 4
101101

102+
#define TPS23861_GENERAL_MASK_1 0x17
103+
#define TPS23861_CURRENT_SHUNT_MASK BIT(0)
104+
102105
#define TEMPERATURE_LSB 652 /* 0.652 degrees Celsius */
103106
#define VOLTAGE_LSB 3662 /* 3.662 mV */
104107
#define SHUNT_RESISTOR_DEFAULT 255000 /* 255 mOhm */
105-
#define CURRENT_LSB_255 62260 /* 62.260 uA */
106-
#define CURRENT_LSB_250 61039 /* 61.039 uA */
108+
#define CURRENT_LSB_250 62260 /* 62.260 uA */
109+
#define CURRENT_LSB_255 61039 /* 61.039 uA */
107110
#define RESISTANCE_LSB 110966 /* 11.0966 Ohm*/
108111
#define RESISTANCE_LSB_LOW 157216 /* 15.7216 Ohm*/
109112

@@ -117,6 +120,7 @@ struct tps23861_data {
117120
static struct regmap_config tps23861_regmap_config = {
118121
.reg_bits = 8,
119122
.val_bits = 8,
123+
.max_register = 0x6f,
120124
};
121125

122126
static int tps23861_read_temp(struct tps23861_data *data, long *val)
@@ -560,6 +564,15 @@ static int tps23861_probe(struct i2c_client *client)
560564
else
561565
data->shunt_resistor = SHUNT_RESISTOR_DEFAULT;
562566

567+
if (data->shunt_resistor == SHUNT_RESISTOR_DEFAULT)
568+
regmap_clear_bits(data->regmap,
569+
TPS23861_GENERAL_MASK_1,
570+
TPS23861_CURRENT_SHUNT_MASK);
571+
else
572+
regmap_set_bits(data->regmap,
573+
TPS23861_GENERAL_MASK_1,
574+
TPS23861_CURRENT_SHUNT_MASK);
575+
563576
hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name,
564577
data, &tps23861_chip_info,
565578
NULL);

0 commit comments

Comments
 (0)