Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
hwmon: (max6642): Better chip detection schema
hwmon: (coretemp) Further relax temperature range checks
hwmon: (coretemp) Fix TjMax detection for older CPUs
hwmon: (coretemp) Relax target temperature range check
hwmon: (max6642) Rename temp_fault sysfs attribute to temp2_fault

+22 -23
+4 -19
drivers/hwmon/coretemp.c
··· 296 296 * If the TjMax is not plausible, an assumption 297 297 * will be used 298 298 */ 299 - if (val > 80 && val < 120) { 299 + if (val) { 300 300 dev_info(dev, "TjMax is %d C.\n", val); 301 301 return val * 1000; 302 302 } ··· 304 304 305 305 /* 306 306 * An assumption is made for early CPUs and unreadable MSR. 307 - * NOTE: the given value may not be correct. 307 + * NOTE: the calculated value may not be correct. 308 308 */ 309 - 310 - switch (c->x86_model) { 311 - case 0xe: 312 - case 0xf: 313 - case 0x16: 314 - case 0x1a: 315 - dev_warn(dev, "TjMax is assumed as 100 C!\n"); 316 - return 100000; 317 - case 0x17: 318 - case 0x1c: /* Atom CPUs */ 319 - return adjust_tjmax(c, id, dev); 320 - default: 321 - dev_warn(dev, "CPU (model=0x%x) is not supported yet," 322 - " using default TjMax of 100C.\n", c->x86_model); 323 - return 100000; 324 - } 309 + return adjust_tjmax(c, id, dev); 325 310 } 326 311 327 312 static void __devinit get_ucode_rev_on_cpu(void *edx) ··· 326 341 err = rdmsr_safe_on_cpu(cpu, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx); 327 342 if (!err) { 328 343 val = (eax >> 16) & 0xff; 329 - if (val > 80 && val < 120) 344 + if (val) 330 345 return val * 1000; 331 346 } 332 347 dev_warn(dev, "Unable to read Pkg-TjMax from CPU:%u\n", cpu);
+18 -4
drivers/hwmon/max6642.c
··· 136 136 if (man_id != 0x4D) 137 137 return -ENODEV; 138 138 139 + /* sanity check */ 140 + if (i2c_smbus_read_byte_data(client, 0x04) != 0x4D 141 + || i2c_smbus_read_byte_data(client, 0x06) != 0x4D 142 + || i2c_smbus_read_byte_data(client, 0xff) != 0x4D) 143 + return -ENODEV; 144 + 139 145 /* 140 146 * We read the config and status register, the 4 lower bits in the 141 147 * config register should be zero and bit 5, 3, 1 and 0 should be 142 148 * zero in the status register. 143 149 */ 144 150 reg_config = i2c_smbus_read_byte_data(client, MAX6642_REG_R_CONFIG); 151 + if ((reg_config & 0x0f) != 0x00) 152 + return -ENODEV; 153 + 154 + /* in between, another round of sanity checks */ 155 + if (i2c_smbus_read_byte_data(client, 0x04) != reg_config 156 + || i2c_smbus_read_byte_data(client, 0x06) != reg_config 157 + || i2c_smbus_read_byte_data(client, 0xff) != reg_config) 158 + return -ENODEV; 159 + 145 160 reg_status = i2c_smbus_read_byte_data(client, MAX6642_REG_R_STATUS); 146 - if (((reg_config & 0x0f) != 0x00) || 147 - ((reg_status & 0x2b) != 0x00)) 161 + if ((reg_status & 0x2b) != 0x00) 148 162 return -ENODEV; 149 163 150 164 strlcpy(info->type, "max6642", I2C_NAME_SIZE); ··· 260 246 set_temp_max, 0, MAX6642_REG_W_LOCAL_HIGH); 261 247 static SENSOR_DEVICE_ATTR_2(temp2_max, S_IWUSR | S_IRUGO, show_temp_max, 262 248 set_temp_max, 1, MAX6642_REG_W_REMOTE_HIGH); 263 - static SENSOR_DEVICE_ATTR(temp_fault, S_IRUGO, show_alarm, NULL, 2); 249 + static SENSOR_DEVICE_ATTR(temp2_fault, S_IRUGO, show_alarm, NULL, 2); 264 250 static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, show_alarm, NULL, 6); 265 251 static SENSOR_DEVICE_ATTR(temp2_max_alarm, S_IRUGO, show_alarm, NULL, 4); 266 252 ··· 270 256 &sensor_dev_attr_temp1_max.dev_attr.attr, 271 257 &sensor_dev_attr_temp2_max.dev_attr.attr, 272 258 273 - &sensor_dev_attr_temp_fault.dev_attr.attr, 259 + &sensor_dev_attr_temp2_fault.dev_attr.attr, 274 260 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, 275 261 &sensor_dev_attr_temp2_max_alarm.dev_attr.attr, 276 262 NULL