Skip to content

Commit 051e6b7

Browse files
committed
Merge tag 'hwmon-for-v5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - Fix ADC access synchronization problem with da9052 driver - Fix temperature limit and status reporting in nct7904 driver - Fix drivetemp temperature reporting if SCT is supported but SCT data tables are not. * tag 'hwmon-for-v5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: (da9052) Synchronize access with mfd hwmon: (nct7904) Fix incorrect range of temperature limit registers hwmon: (nct7904) Read all SMI status registers in probe function hwmon: (drivetemp) Fix SCT support if SCT data tables are not supported
2 parents 1742bcd + 333e22d commit 051e6b7

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

drivers/hwmon/da9052-hwmon.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,9 @@ static ssize_t da9052_tsi_show(struct device *dev,
244244
int channel = to_sensor_dev_attr(devattr)->index;
245245
int ret;
246246

247-
mutex_lock(&hwmon->hwmon_lock);
247+
mutex_lock(&hwmon->da9052->auxadc_lock);
248248
ret = __da9052_read_tsi(dev, channel);
249-
mutex_unlock(&hwmon->hwmon_lock);
249+
mutex_unlock(&hwmon->da9052->auxadc_lock);
250250

251251
if (ret < 0)
252252
return ret;

drivers/hwmon/drivetemp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ static int drivetemp_identify_sata(struct drivetemp_data *st)
346346
st->have_temp_highest = temp_is_valid(buf[SCT_STATUS_TEMP_HIGHEST]);
347347

348348
if (!have_sct_data_table)
349-
goto skip_sct;
349+
goto skip_sct_data;
350350

351351
/* Request and read temperature history table */
352352
memset(buf, '\0', sizeof(st->smartdata));

drivers/hwmon/nct7904.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#define FANCTL_MAX 4 /* Counted from 1 */
4242
#define TCPU_MAX 8 /* Counted from 1 */
4343
#define TEMP_MAX 4 /* Counted from 1 */
44+
#define SMI_STS_MAX 10 /* Counted from 1 */
4445

4546
#define VT_ADC_CTRL0_REG 0x20 /* Bank 0 */
4647
#define VT_ADC_CTRL1_REG 0x21 /* Bank 0 */
@@ -361,6 +362,7 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel,
361362
struct nct7904_data *data = dev_get_drvdata(dev);
362363
int ret, temp;
363364
unsigned int reg1, reg2, reg3;
365+
s8 temps;
364366

365367
switch (attr) {
366368
case hwmon_temp_input:
@@ -466,7 +468,8 @@ static int nct7904_read_temp(struct device *dev, u32 attr, int channel,
466468

467469
if (ret < 0)
468470
return ret;
469-
*val = ret * 1000;
471+
temps = ret;
472+
*val = temps * 1000;
470473
return 0;
471474
}
472475

@@ -1009,6 +1012,13 @@ static int nct7904_probe(struct i2c_client *client,
10091012
data->fan_mode[i] = ret;
10101013
}
10111014

1015+
/* Read all of SMI status register to clear alarms */
1016+
for (i = 0; i < SMI_STS_MAX; i++) {
1017+
ret = nct7904_read_reg(data, BANK_0, SMI_STS1_REG + i);
1018+
if (ret < 0)
1019+
return ret;
1020+
}
1021+
10121022
hwmon_dev =
10131023
devm_hwmon_device_register_with_info(dev, client->name, data,
10141024
&nct7904_chip_info, NULL);

0 commit comments

Comments
 (0)