Commit 1523e4d5 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'hwmon-for-v7.0-rc7' of...

Merge tag 'hwmon-for-v7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

 - Fix temperature sensor for PRIME X670E-PRO WIFI

 - occ: Add missing newline, and fix potential division by zero

 - pmbus:
    - Fix device ID comparison and printing in tps53676_identify()
    - Add missing MODULE_IMPORT_NS("PMBUS") for ltc4286
    - Check return value of page-select write in pxe1610 probe
    - Fix array access with zero-length block tps53679 read

* tag 'hwmon-for-v7.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (asus-ec-sensors) Fix T_Sensor for PRIME X670E-PRO WIFI
  hwmon: (occ) Fix missing newline in occ_show_extended()
  hwmon: (occ) Fix division by zero in occ_show_power_1()
  hwmon: (tps53679) Fix device ID comparison and printing in tps53676_identify()
  hwmon: (ltc4286) Add missing MODULE_IMPORT_NS("PMBUS")
  hwmon: (pxe1610) Check return value of page-select write in probe
  hwmon: (tps53679) Fix array access with zero-length block read
parents 631919fb cffff6df
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -111,6 +111,8 @@ enum ec_sensors {
	ec_sensor_temp_mb,
	/* "T_Sensor" temperature sensor reading [℃] */
	ec_sensor_temp_t_sensor,
	/* like ec_sensor_temp_t_sensor, but at an alternate address [℃] */
	ec_sensor_temp_t_sensor_alt1,
	/* VRM temperature [℃] */
	ec_sensor_temp_vrm,
	/* VRM east (right) temperature [℃] */
@@ -160,6 +162,7 @@ enum ec_sensors {
#define SENSOR_TEMP_CPU_PACKAGE BIT(ec_sensor_temp_cpu_package)
#define SENSOR_TEMP_MB BIT(ec_sensor_temp_mb)
#define SENSOR_TEMP_T_SENSOR BIT(ec_sensor_temp_t_sensor)
#define SENSOR_TEMP_T_SENSOR_ALT1 BIT(ec_sensor_temp_t_sensor_alt1)
#define SENSOR_TEMP_VRM BIT(ec_sensor_temp_vrm)
#define SENSOR_TEMP_VRME BIT(ec_sensor_temp_vrme)
#define SENSOR_TEMP_VRMW BIT(ec_sensor_temp_vrmw)
@@ -279,6 +282,8 @@ static const struct ec_sensor_info sensors_family_amd_600[] = {
		EC_SENSOR("VRM", hwmon_temp, 1, 0x00, 0x33),
	[ec_sensor_temp_t_sensor] =
		EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x36),
	[ec_sensor_temp_t_sensor_alt1] =
		EC_SENSOR("T_Sensor", hwmon_temp, 1, 0x00, 0x37),
	[ec_sensor_fan_cpu_opt] =
		EC_SENSOR("CPU_Opt", hwmon_fan, 2, 0x00, 0xb0),
	[ec_sensor_temp_water_in] =
@@ -519,7 +524,7 @@ static const struct ec_board_info board_info_prime_x570_pro = {
static const struct ec_board_info board_info_prime_x670e_pro_wifi = {
	.sensors = SENSOR_TEMP_CPU | SENSOR_TEMP_CPU_PACKAGE |
		SENSOR_TEMP_MB | SENSOR_TEMP_VRM |
		SENSOR_TEMP_T_SENSOR | SENSOR_FAN_CPU_OPT,
		SENSOR_TEMP_T_SENSOR_ALT1 | SENSOR_FAN_CPU_OPT,
	.mutex_path = ACPI_GLOBAL_LOCK_PSEUDO_PATH,
	.family = family_amd_600_series,
};
+9 −10
Original line number Diff line number Diff line
@@ -420,6 +420,12 @@ static ssize_t occ_show_freq_2(struct device *dev,
	return sysfs_emit(buf, "%u\n", val);
}

static u64 occ_get_powr_avg(u64 accum, u32 samples)
{
	return (samples == 0) ? 0 :
		mul_u64_u32_div(accum, 1000000UL, samples);
}

static ssize_t occ_show_power_1(struct device *dev,
				struct device_attribute *attr, char *buf)
{
@@ -441,9 +447,8 @@ static ssize_t occ_show_power_1(struct device *dev,
		val = get_unaligned_be16(&power->sensor_id);
		break;
	case 1:
		val = get_unaligned_be32(&power->accumulator) /
			get_unaligned_be32(&power->update_tag);
		val *= 1000000ULL;
		val = occ_get_powr_avg(get_unaligned_be32(&power->accumulator),
				       get_unaligned_be32(&power->update_tag));
		break;
	case 2:
		val = (u64)get_unaligned_be32(&power->update_tag) *
@@ -459,12 +464,6 @@ static ssize_t occ_show_power_1(struct device *dev,
	return sysfs_emit(buf, "%llu\n", val);
}

static u64 occ_get_powr_avg(u64 accum, u32 samples)
{
	return (samples == 0) ? 0 :
		mul_u64_u32_div(accum, 1000000UL, samples);
}

static ssize_t occ_show_power_2(struct device *dev,
				struct device_attribute *attr, char *buf)
{
@@ -725,7 +724,7 @@ static ssize_t occ_show_extended(struct device *dev,
	switch (sattr->nr) {
	case 0:
		if (extn->flags & EXTN_FLAG_SENSOR_ID) {
			rc = sysfs_emit(buf, "%u",
			rc = sysfs_emit(buf, "%u\n",
					get_unaligned_be32(&extn->sensor_id));
		} else {
			rc = sysfs_emit(buf, "%4phN\n", extn->name);
+1 −0
Original line number Diff line number Diff line
@@ -173,3 +173,4 @@ module_i2c_driver(ltc4286_driver);
MODULE_AUTHOR("Delphine CC Chiu <Delphine_CC_Chiu@wiwynn.com>");
MODULE_DESCRIPTION("PMBUS driver for LTC4286 and compatibles");
MODULE_LICENSE("GPL");
MODULE_IMPORT_NS("PMBUS");
+4 −1
Original line number Diff line number Diff line
@@ -104,7 +104,10 @@ static int pxe1610_probe(struct i2c_client *client)
	 * By default this device doesn't boot to page 0, so set page 0
	 * to access all pmbus registers.
	 */
	i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
	ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
	if (ret < 0)
		return dev_err_probe(&client->dev, ret,
				     "Failed to set page 0\n");

	/* Read Manufacturer id */
	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
+5 −5
Original line number Diff line number Diff line
@@ -103,10 +103,10 @@ static int tps53679_identify_chip(struct i2c_client *client,
	}

	ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf);
	if (ret < 0)
		return ret;
	if (ret <= 0)
		return ret < 0 ? ret : -EIO;

	/* Adjust length if null terminator if present */
	/* Adjust length if null terminator is present */
	buf_len = (buf[ret - 1] != '\x00' ? ret : ret - 1);

	id_len = strlen(id);
@@ -175,8 +175,8 @@ static int tps53676_identify(struct i2c_client *client,
	ret = i2c_smbus_read_block_data(client, PMBUS_IC_DEVICE_ID, buf);
	if (ret < 0)
		return ret;
	if (strncmp("TI\x53\x67\x60", buf, 5)) {
		dev_err(&client->dev, "Unexpected device ID: %s\n", buf);
	if (ret != 6 || memcmp(buf, "TI\x53\x67\x60\x00", 6)) {
		dev_err(&client->dev, "Unexpected device ID: %*ph\n", ret, buf);
		return -ENODEV;
	}