Commit f5c07a2d authored by Linus Torvalds's avatar Linus Torvalds

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
parents 7223b915 d618540f
...@@ -485,8 +485,8 @@ S: Maintained ...@@ -485,8 +485,8 @@ S: Maintained
F: drivers/input/mouse/bcm5974.c F: drivers/input/mouse/bcm5974.c
APPLE SMC DRIVER APPLE SMC DRIVER
M: Nicolas Boichat <nicolas@boichat.ch> M: Henrik Rydberg <rydberg@euromail.se>
L: mactel-linux-devel@lists.sourceforge.net L: lm-sensors@lm-sensors.org
S: Maintained S: Maintained
F: drivers/hwmon/applesmc.c F: drivers/hwmon/applesmc.c
......
...@@ -142,6 +142,12 @@ static const char *temperature_sensors_sets[][41] = { ...@@ -142,6 +142,12 @@ static const char *temperature_sensors_sets[][41] = {
"TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", "TM9S", "TM1S", "TM2P", "TM2S", "TM3S", "TM8P", "TM8S", "TM9P", "TM9S",
"TN0C", "TN0D", "TN0H", "TS0C", "Tp0C", "Tp1C", "Tv0S", "Tv1S", "TN0C", "TN0D", "TN0H", "TS0C", "Tp0C", "Tp1C", "Tv0S", "Tv1S",
NULL }, NULL },
/* Set 17: iMac 9,1 */
{ "TA0P", "TC0D", "TC0H", "TC0P", "TG0D", "TG0H", "TH0P", "TL0P",
"TN0D", "TN0H", "TN0P", "TO0P", "Tm0P", "Tp0P", NULL },
/* Set 18: MacBook Pro 2,2 */
{ "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "TM0P", "TTF0",
"Th0H", "Th1H", "Tm0P", "Ts0P", NULL },
}; };
/* List of keys used to read/write fan speeds */ /* List of keys used to read/write fan speeds */
...@@ -1350,6 +1356,10 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = { ...@@ -1350,6 +1356,10 @@ static __initdata struct dmi_match_data applesmc_dmi_data[] = {
{ .accelerometer = 1, .light = 1, .temperature_set = 15 }, { .accelerometer = 1, .light = 1, .temperature_set = 15 },
/* MacPro3,1: temperature set 16 */ /* MacPro3,1: temperature set 16 */
{ .accelerometer = 0, .light = 0, .temperature_set = 16 }, { .accelerometer = 0, .light = 0, .temperature_set = 16 },
/* iMac 9,1: light sensor only, temperature set 17 */
{ .accelerometer = 0, .light = 0, .temperature_set = 17 },
/* MacBook Pro 2,2: accelerometer, backlight and temperature set 18 */
{ .accelerometer = 1, .light = 1, .temperature_set = 18 },
}; };
/* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1". /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
...@@ -1375,6 +1385,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { ...@@ -1375,6 +1385,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3") }, DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro3") },
&applesmc_dmi_data[9]}, &applesmc_dmi_data[9]},
{ applesmc_dmi_match, "Apple MacBook Pro 2,2", {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple Computer, Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "MacBookPro2,2") },
&applesmc_dmi_data[18]},
{ applesmc_dmi_match, "Apple MacBook Pro", { { applesmc_dmi_match, "Apple MacBook Pro", {
DMI_MATCH(DMI_BOARD_VENDOR,"Apple"), DMI_MATCH(DMI_BOARD_VENDOR,"Apple"),
DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") }, DMI_MATCH(DMI_PRODUCT_NAME,"MacBookPro") },
...@@ -1415,6 +1429,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = { ...@@ -1415,6 +1429,10 @@ static __initdata struct dmi_system_id applesmc_whitelist[] = {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
DMI_MATCH(DMI_PRODUCT_NAME, "MacPro") }, DMI_MATCH(DMI_PRODUCT_NAME, "MacPro") },
&applesmc_dmi_data[4]}, &applesmc_dmi_data[4]},
{ applesmc_dmi_match, "Apple iMac 9,1", {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "iMac9,1") },
&applesmc_dmi_data[17]},
{ applesmc_dmi_match, "Apple iMac 8", { { applesmc_dmi_match, "Apple iMac 8", {
DMI_MATCH(DMI_BOARD_VENDOR, "Apple"), DMI_MATCH(DMI_BOARD_VENDOR, "Apple"),
DMI_MATCH(DMI_PRODUCT_NAME, "iMac8") }, DMI_MATCH(DMI_PRODUCT_NAME, "iMac8") },
......
...@@ -539,14 +539,14 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, ...@@ -539,14 +539,14 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr,
struct it87_data *data = dev_get_drvdata(dev); struct it87_data *data = dev_get_drvdata(dev);
long val; long val;
u8 reg;
if (strict_strtol(buf, 10, &val) < 0) if (strict_strtol(buf, 10, &val) < 0)
return -EINVAL; return -EINVAL;
mutex_lock(&data->update_lock); reg = it87_read_value(data, IT87_REG_TEMP_ENABLE);
reg &= ~(1 << nr);
data->sensor &= ~(1 << nr); reg &= ~(8 << nr);
data->sensor &= ~(8 << nr);
if (val == 2) { /* backwards compatibility */ if (val == 2) { /* backwards compatibility */
dev_warn(dev, "Sensor type 2 is deprecated, please use 4 " dev_warn(dev, "Sensor type 2 is deprecated, please use 4 "
"instead\n"); "instead\n");
...@@ -554,14 +554,16 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr, ...@@ -554,14 +554,16 @@ static ssize_t set_sensor(struct device *dev, struct device_attribute *attr,
} }
/* 3 = thermal diode; 4 = thermistor; 0 = disabled */ /* 3 = thermal diode; 4 = thermistor; 0 = disabled */
if (val == 3) if (val == 3)
data->sensor |= 1 << nr; reg |= 1 << nr;
else if (val == 4) else if (val == 4)
data->sensor |= 8 << nr; reg |= 8 << nr;
else if (val != 0) { else if (val != 0)
mutex_unlock(&data->update_lock);
return -EINVAL; return -EINVAL;
}
mutex_lock(&data->update_lock);
data->sensor = reg;
it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor); it87_write_value(data, IT87_REG_TEMP_ENABLE, data->sensor);
data->valid = 0; /* Force cache refresh */
mutex_unlock(&data->update_lock); mutex_unlock(&data->update_lock);
return count; return count;
} }
...@@ -1841,14 +1843,10 @@ static void __devinit it87_init_device(struct platform_device *pdev) ...@@ -1841,14 +1843,10 @@ static void __devinit it87_init_device(struct platform_device *pdev)
it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127); it87_write_value(data, IT87_REG_TEMP_HIGH(i), 127);
} }
/* Check if temperature channels are reset manually or by some reason */ /* Temperature channels are not forcibly enabled, as they can be
tmp = it87_read_value(data, IT87_REG_TEMP_ENABLE); * set to two different sensor types and we can't guess which one
if ((tmp & 0x3f) == 0) { * is correct for a given system. These channels can be enabled at
/* Temp1,Temp3=thermistor; Temp2=thermal diode */ * run-time through the temp{1-3}_type sysfs accessors if needed. */
tmp = (tmp & 0xc0) | 0x2a;
it87_write_value(data, IT87_REG_TEMP_ENABLE, tmp);
}
data->sensor = tmp;
/* Check if voltage monitors are reset manually or by some reason */ /* Check if voltage monitors are reset manually or by some reason */
tmp = it87_read_value(data, IT87_REG_VIN_ENABLE); tmp = it87_read_value(data, IT87_REG_VIN_ENABLE);
......
...@@ -303,13 +303,13 @@ static int sht15_update_vals(struct sht15_data *data) ...@@ -303,13 +303,13 @@ static int sht15_update_vals(struct sht15_data *data)
**/ **/
static inline int sht15_calc_temp(struct sht15_data *data) static inline int sht15_calc_temp(struct sht15_data *data)
{ {
int d1 = 0; int d1 = temppoints[0].d1;
int i; int i;
for (i = 1; i < ARRAY_SIZE(temppoints); i++) for (i = ARRAY_SIZE(temppoints) - 1; i > 0; i--)
/* Find pointer to interpolate */ /* Find pointer to interpolate */
if (data->supply_uV > temppoints[i - 1].vdd) { if (data->supply_uV > temppoints[i - 1].vdd) {
d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd) d1 = (data->supply_uV - temppoints[i - 1].vdd)
* (temppoints[i].d1 - temppoints[i - 1].d1) * (temppoints[i].d1 - temppoints[i - 1].d1)
/ (temppoints[i].vdd - temppoints[i - 1].vdd) / (temppoints[i].vdd - temppoints[i - 1].vdd)
+ temppoints[i - 1].d1; + temppoints[i - 1].d1;
...@@ -542,7 +542,12 @@ static int __devinit sht15_probe(struct platform_device *pdev) ...@@ -542,7 +542,12 @@ static int __devinit sht15_probe(struct platform_device *pdev)
/* If a regulator is available, query what the supply voltage actually is!*/ /* If a regulator is available, query what the supply voltage actually is!*/
data->reg = regulator_get(data->dev, "vcc"); data->reg = regulator_get(data->dev, "vcc");
if (!IS_ERR(data->reg)) { if (!IS_ERR(data->reg)) {
data->supply_uV = regulator_get_voltage(data->reg); int voltage;
voltage = regulator_get_voltage(data->reg);
if (voltage)
data->supply_uV = voltage;
regulator_enable(data->reg); regulator_enable(data->reg);
/* setup a notifier block to update this if another device /* setup a notifier block to update this if another device
* causes the voltage to change */ * causes the voltage to change */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment