mirror of
https://github.com/Dasharo/linux.git
synced 2026-03-06 15:25:10 -08:00
Merge tag 'hwmon-for-v6.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon fixes from Guenter Roeck: - xgene-hwmon: Fix a NULL vs IS_ERR_OR_NULL() check - ad7314: Return error if leading zero bits are non-zero - ntc_thermistor: Update/fix the ncpXXxh103 sensor table - pmbus: Initialise page count in pmbus_identify() - peci/dimmtemp: Do not provide fake threshold data * tag 'hwmon-for-v6.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: fix a NULL vs IS_ERR_OR_NULL() check in xgene_hwmon_probe() hwmon: (ad7314) Validate leading zero bits and return error hwmon: (ntc_thermistor) Fix the ncpXXxh103 sensor table hwmon: (pmbus) Initialise page count in pmbus_identify() hwmon: (peci/dimmtemp) Do not provide fake thresholds data
This commit is contained in:
@@ -22,11 +22,13 @@
|
||||
*/
|
||||
#define AD7314_TEMP_MASK 0x7FE0
|
||||
#define AD7314_TEMP_SHIFT 5
|
||||
#define AD7314_LEADING_ZEROS_MASK BIT(15)
|
||||
|
||||
/*
|
||||
* ADT7301 and ADT7302 temperature masks
|
||||
*/
|
||||
#define ADT7301_TEMP_MASK 0x3FFF
|
||||
#define ADT7301_LEADING_ZEROS_MASK (BIT(15) | BIT(14))
|
||||
|
||||
enum ad7314_variant {
|
||||
adt7301,
|
||||
@@ -65,12 +67,20 @@ static ssize_t ad7314_temperature_show(struct device *dev,
|
||||
return ret;
|
||||
switch (spi_get_device_id(chip->spi_dev)->driver_data) {
|
||||
case ad7314:
|
||||
if (ret & AD7314_LEADING_ZEROS_MASK) {
|
||||
/* Invalid read-out, leading zero part is missing */
|
||||
return -EIO;
|
||||
}
|
||||
data = (ret & AD7314_TEMP_MASK) >> AD7314_TEMP_SHIFT;
|
||||
data = sign_extend32(data, 9);
|
||||
|
||||
return sprintf(buf, "%d\n", 250 * data);
|
||||
case adt7301:
|
||||
case adt7302:
|
||||
if (ret & ADT7301_LEADING_ZEROS_MASK) {
|
||||
/* Invalid read-out, leading zero part is missing */
|
||||
return -EIO;
|
||||
}
|
||||
/*
|
||||
* Documented as a 13 bit twos complement register
|
||||
* with a sign bit - which is a 14 bit 2's complement
|
||||
|
||||
@@ -181,40 +181,40 @@ static const struct ntc_compensation ncpXXwf104[] = {
|
||||
};
|
||||
|
||||
static const struct ntc_compensation ncpXXxh103[] = {
|
||||
{ .temp_c = -40, .ohm = 247565 },
|
||||
{ .temp_c = -35, .ohm = 181742 },
|
||||
{ .temp_c = -30, .ohm = 135128 },
|
||||
{ .temp_c = -25, .ohm = 101678 },
|
||||
{ .temp_c = -20, .ohm = 77373 },
|
||||
{ .temp_c = -15, .ohm = 59504 },
|
||||
{ .temp_c = -10, .ohm = 46222 },
|
||||
{ .temp_c = -5, .ohm = 36244 },
|
||||
{ .temp_c = 0, .ohm = 28674 },
|
||||
{ .temp_c = 5, .ohm = 22878 },
|
||||
{ .temp_c = 10, .ohm = 18399 },
|
||||
{ .temp_c = 15, .ohm = 14910 },
|
||||
{ .temp_c = 20, .ohm = 12169 },
|
||||
{ .temp_c = -40, .ohm = 195652 },
|
||||
{ .temp_c = -35, .ohm = 148171 },
|
||||
{ .temp_c = -30, .ohm = 113347 },
|
||||
{ .temp_c = -25, .ohm = 87559 },
|
||||
{ .temp_c = -20, .ohm = 68237 },
|
||||
{ .temp_c = -15, .ohm = 53650 },
|
||||
{ .temp_c = -10, .ohm = 42506 },
|
||||
{ .temp_c = -5, .ohm = 33892 },
|
||||
{ .temp_c = 0, .ohm = 27219 },
|
||||
{ .temp_c = 5, .ohm = 22021 },
|
||||
{ .temp_c = 10, .ohm = 17926 },
|
||||
{ .temp_c = 15, .ohm = 14674 },
|
||||
{ .temp_c = 20, .ohm = 12081 },
|
||||
{ .temp_c = 25, .ohm = 10000 },
|
||||
{ .temp_c = 30, .ohm = 8271 },
|
||||
{ .temp_c = 35, .ohm = 6883 },
|
||||
{ .temp_c = 40, .ohm = 5762 },
|
||||
{ .temp_c = 45, .ohm = 4851 },
|
||||
{ .temp_c = 50, .ohm = 4105 },
|
||||
{ .temp_c = 55, .ohm = 3492 },
|
||||
{ .temp_c = 60, .ohm = 2985 },
|
||||
{ .temp_c = 65, .ohm = 2563 },
|
||||
{ .temp_c = 70, .ohm = 2211 },
|
||||
{ .temp_c = 75, .ohm = 1915 },
|
||||
{ .temp_c = 80, .ohm = 1666 },
|
||||
{ .temp_c = 85, .ohm = 1454 },
|
||||
{ .temp_c = 90, .ohm = 1275 },
|
||||
{ .temp_c = 95, .ohm = 1121 },
|
||||
{ .temp_c = 100, .ohm = 990 },
|
||||
{ .temp_c = 105, .ohm = 876 },
|
||||
{ .temp_c = 110, .ohm = 779 },
|
||||
{ .temp_c = 115, .ohm = 694 },
|
||||
{ .temp_c = 120, .ohm = 620 },
|
||||
{ .temp_c = 125, .ohm = 556 },
|
||||
{ .temp_c = 30, .ohm = 8315 },
|
||||
{ .temp_c = 35, .ohm = 6948 },
|
||||
{ .temp_c = 40, .ohm = 5834 },
|
||||
{ .temp_c = 45, .ohm = 4917 },
|
||||
{ .temp_c = 50, .ohm = 4161 },
|
||||
{ .temp_c = 55, .ohm = 3535 },
|
||||
{ .temp_c = 60, .ohm = 3014 },
|
||||
{ .temp_c = 65, .ohm = 2586 },
|
||||
{ .temp_c = 70, .ohm = 2228 },
|
||||
{ .temp_c = 75, .ohm = 1925 },
|
||||
{ .temp_c = 80, .ohm = 1669 },
|
||||
{ .temp_c = 85, .ohm = 1452 },
|
||||
{ .temp_c = 90, .ohm = 1268 },
|
||||
{ .temp_c = 95, .ohm = 1110 },
|
||||
{ .temp_c = 100, .ohm = 974 },
|
||||
{ .temp_c = 105, .ohm = 858 },
|
||||
{ .temp_c = 110, .ohm = 758 },
|
||||
{ .temp_c = 115, .ohm = 672 },
|
||||
{ .temp_c = 120, .ohm = 596 },
|
||||
{ .temp_c = 125, .ohm = 531 },
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -127,8 +127,6 @@ static int update_thresholds(struct peci_dimmtemp *priv, int dimm_no)
|
||||
return 0;
|
||||
|
||||
ret = priv->gen_info->read_thresholds(priv, dimm_order, chan_rank, &data);
|
||||
if (ret == -ENODATA) /* Use default or previous value */
|
||||
return 0;
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -509,11 +507,11 @@ read_thresholds_icx(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd4, ®_val);
|
||||
if (ret || !(reg_val & BIT(31)))
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 13, 0, 2, 0xd0, ®_val);
|
||||
if (ret)
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
/*
|
||||
* Device 26, Offset 224e0: IMC 0 channel 0 -> rank 0
|
||||
@@ -546,11 +544,11 @@ read_thresholds_spr(struct peci_dimmtemp *priv, int dimm_order, int chan_rank, u
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd4, ®_val);
|
||||
if (ret || !(reg_val & BIT(31)))
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
ret = peci_ep_pci_local_read(priv->peci_dev, 0, 30, 0, 2, 0xd0, ®_val);
|
||||
if (ret)
|
||||
return -ENODATA; /* Use default or previous value */
|
||||
return -ENODATA;
|
||||
|
||||
/*
|
||||
* Device 26, Offset 219a8: IMC 0 channel 0 -> rank 0
|
||||
|
||||
@@ -103,6 +103,8 @@ static int pmbus_identify(struct i2c_client *client,
|
||||
if (pmbus_check_byte_register(client, 0, PMBUS_PAGE)) {
|
||||
int page;
|
||||
|
||||
info->pages = PMBUS_PAGES;
|
||||
|
||||
for (page = 1; page < PMBUS_PAGES; page++) {
|
||||
if (pmbus_set_page(client, page, 0xff) < 0)
|
||||
break;
|
||||
|
||||
@@ -706,7 +706,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!ctx->pcc_comm_addr) {
|
||||
if (IS_ERR_OR_NULL(ctx->pcc_comm_addr)) {
|
||||
dev_err(&pdev->dev,
|
||||
"Failed to ioremap PCC comm region\n");
|
||||
rc = -ENOMEM;
|
||||
|
||||
Reference in New Issue
Block a user