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/jdelvare/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
hwmon: (applesmc) Switch maintainers
hwmon: (applesmc) Add iMac9,1 and MacBookPro2,2 support
hwmon: (it87) Invalidate cache on temperature sensor change
hwmon: (it87) Properly handle wrong sensor type requests
hwmon: (it87) Don't arbitrarily enable temperature channels
hwmon: (sht15) Properly handle the case CONFIG_REGULATOR=n
hwmon: (sht15) Fix sht15_calc_temp interpolation function

+44 -23
+2 -2
MAINTAINERS
··· 485 485 F: drivers/input/mouse/bcm5974.c 486 486 487 487 APPLE SMC DRIVER 488 - M: Nicolas Boichat <nicolas@boichat.ch> 489 - L: mactel-linux-devel@lists.sourceforge.net 488 + M: Henrik Rydberg <rydberg@euromail.se> 489 + L: lm-sensors@lm-sensors.org 490 490 S: Maintained 491 491 F: drivers/hwmon/applesmc.c 492 492
+18
drivers/hwmon/applesmc.c
··· 142 142 "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", "TM9S", 143 143 "TN0C", "TN0D", "TN0H", "TS0C", "Tp0C", "Tp1C", "Tv0S", "Tv1S", 144 144 NULL }, 145 + /* Set 17: iMac 9,1 */ 146 + { "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TH0P", "TL0P", 147 + "TN0D", "TN0H", "TN0P", "TO0P", "Tm0P", "Tp0P", NULL }, 148 + /* Set 18: MacBook Pro 2,2 */ 149 + { "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "TM0P", "TTF0", 150 + "Th0H", "Th1H", "Tm0P", "Ts0P", NULL }, 145 151 }; 146 152 147 153 /* List of keys used to read/write fan speeds */ ··· 1356 1350 { .accelerometer = 1, .light = 1, .temperature_set = 15 }, 1357 1351 /* MacPro3,1: temperature set 16 */ 1358 1352 { .accelerometer = 0, .light = 0, .temperature_set = 16 }, 1353 + /* iMac 9,1: light sensor only, temperature set 17 */ 1354 + { .accelerometer = 0, .light = 0, .temperature_set = 17 }, 1355 + /* MacBook Pro 2,2: accelerometer, backlight and temperature set 18 */ 1356 + { .accelerometer = 1, .light = 1, .temperature_set = 18 }, 1359 1357 }; 1360 1358 1361 1359 /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". ··· 1385 1375 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), 1386 1376 DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3") }, 1387 1377 &applesmc_dmi_data[9]}, 1378 + { applesmc_dmi_match, "Apple MacBook Pro 2,2", { 1379 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Computer, Inc."), 1380 + DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,2") }, 1381 + &applesmc_dmi_data[18]}, 1388 1382 { applesmc_dmi_match, "Apple MacBook Pro", { 1389 1383 DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), 1390 1384 DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") }, ··· 1429 1415 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), 1430 1416 DMI_MATCH(DMI_PRODUCT_NAME, "MacPro") }, 1431 1417 &applesmc_dmi_data[4]}, 1418 + { applesmc_dmi_match, "Apple iMac 9,1", { 1419 + DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."), 1420 + DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1") }, 1421 + &applesmc_dmi_data[17]}, 1432 1422 { applesmc_dmi_match, "Apple iMac 8", { 1433 1423 DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), 1434 1424 DMI_MATCH(DMI_PRODUCT_NAME, "iMac8") },
+15 -17
drivers/hwmon/it87.c
··· 539 539 540 540 struct it87_data *data = dev_get_drvdata(dev); 541 541 long val; 542 + u8 reg; 542 543 543 544 if (strict_strtol(buf, 10, &val) < 0) 544 545 return -EINVAL; 545 546 546 - mutex_lock(&data->update_lock); 547 - 548 - data->sensor &= ~(1 << nr); 549 - data->sensor &= ~(8 << nr); 547 + reg = it87_read_value(data, IT87_REG_TEMP_ENABLE); 548 + reg &= ~(1 << nr); 549 + reg &= ~(8 << nr); 550 550 if (val == 2) { /* backwards compatibility */ 551 551 dev_warn(dev, "Sensor type 2 is deprecated, please use 4 " 552 552 "instead\n"); ··· 554 554 } 555 555 /* 3 = thermal diode; 4 = thermistor; 0 = disabled */ 556 556 if (val == 3) 557 - data->sensor |= 1 << nr; 557 + reg |= 1 << nr; 558 558 else if (val == 4) 559 - data->sensor |= 8 << nr; 560 - else if (val != 0) { 561 - mutex_unlock(&data->update_lock); 559 + reg |= 8 << nr; 560 + else if (val != 0) 562 561 return -EINVAL; 563 - } 562 + 563 + mutex_lock(&data->update_lock); 564 + data->sensor = reg; 564 565 it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor); 566 + data->valid = 0; /* Force cache refresh */ 565 567 mutex_unlock(&data->update_lock); 566 568 return count; 567 569 } ··· 1843 1841 it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127); 1844 1842 } 1845 1843 1846 - /* Check if temperature channels are reset manually or by some reason */ 1847 - tmp = it87_read_value(data, IT87_REG_TEMP_ENABLE); 1848 - if ((tmp & 0x3f) == 0) { 1849 - /* Temp1,Temp3=thermistor; Temp2=thermal diode */ 1850 - tmp = (tmp & 0xc0) | 0x2a; 1851 - it87_write_value(data, IT87_REG_TEMP_ENABLE, tmp); 1852 - } 1853 - data->sensor = tmp; 1844 + /* Temperature channels are not forcibly enabled, as they can be 1845 + * set to two different sensor types and we can't guess which one 1846 + * is correct for a given system. These channels can be enabled at 1847 + * run-time through the temp{1-3}_type sysfs accessors if needed. */ 1854 1848 1855 1849 /* Check if voltage monitors are reset manually or by some reason */ 1856 1850 tmp = it87_read_value(data, IT87_REG_VIN_ENABLE);
+9 -4
drivers/hwmon/sht15.c
··· 303 303 **/ 304 304 static inline int sht15_calc_temp(struct sht15_data *data) 305 305 { 306 - int d1 = 0; 306 + int d1 = temppoints[0].d1; 307 307 int i; 308 308 309 - for (i = 1; i < ARRAY_SIZE(temppoints); i++) 309 + for (i = ARRAY_SIZE(temppoints) - 1; i > 0; i--) 310 310 /* Find pointer to interpolate */ 311 311 if (data->supply_uV > temppoints[i - 1].vdd) { 312 - d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd) 312 + d1 = (data->supply_uV - temppoints[i - 1].vdd) 313 313 * (temppoints[i].d1 - temppoints[i - 1].d1) 314 314 / (temppoints[i].vdd - temppoints[i - 1].vdd) 315 315 + temppoints[i - 1].d1; ··· 542 542 /* If a regulator is available, query what the supply voltage actually is!*/ 543 543 data->reg = regulator_get(data->dev, "vcc"); 544 544 if (!IS_ERR(data->reg)) { 545 - data->supply_uV = regulator_get_voltage(data->reg); 545 + int voltage; 546 + 547 + voltage = regulator_get_voltage(data->reg); 548 + if (voltage) 549 + data->supply_uV = voltage; 550 + 546 551 regulator_enable(data->reg); 547 552 /* setup a notifier block to update this if another device 548 553 * causes the voltage to change */