Skip to content

Commit

Permalink
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/jdelvare/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon: (w83627ehf) Add support for the W83627UHG
  hwmon: (w83627ehf) Clean up probe function
  hwmon: (w83627ehf) Properly report PECI and AMD-SI sensor types
  hwmon: Use i2c_smbus_{read,write}_word_swapped
  hwmon: (smsc47b397) Fix checkpatch errors
  hwmon: (lm90) Make code more readable
  hwmon: (lm90) Fix warnings
  hwmon: (ibmaem) Avoid repeated memory allocations
  hwmon: (ibmaem) Make instance initializations independent
  hwmon: (ibmaem) Fix error paths
  hwmon: (lm73) Make detection less problematic
  hwmon: Avoid building drivers for powerpc that read/write ISA addresses
  • Loading branch information
torvalds committed Nov 4, 2011
2 parents b2409fb + eff7687 commit 46e85f5
Show file tree
Hide file tree
Showing 25 changed files with 439 additions and 409 deletions.
28 changes: 15 additions & 13 deletions Documentation/hwmon/w83627ehf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ Supported chips:
Prefix: 'w83627dhg'
Addresses scanned: ISA address retrieved from Super I/O registers
Datasheet: not available
* Winbond W83627UHG
Prefix: 'w83627uhg'
Addresses scanned: ISA address retrieved from Super I/O registers
Datasheet: available from www.nuvoton.com
* Winbond W83667HG
Prefix: 'w83667hg'
Addresses scanned: ISA address retrieved from Super I/O registers
Expand Down Expand Up @@ -42,14 +46,13 @@ Description
-----------

This driver implements support for the Winbond W83627EHF, W83627EHG,
W83627DHG, W83627DHG-P, W83667HG, W83667HG-B, W83667HG-I (NCT6775F),
and NCT6776F super I/O chips. We will refer to them collectively as
Winbond chips.

The chips implement three temperature sensors (up to four for 667HG-B, and nine
for NCT6775F and NCT6776F), five fan rotation speed sensors, ten analog voltage
sensors (only nine for the 627DHG), one VID (6 pins for the 627EHF/EHG, 8 pins
for the 627DHG and 667HG), alarms with beep warnings (control unimplemented),
W83627DHG, W83627DHG-P, W83627UHG, W83667HG, W83667HG-B, W83667HG-I
(NCT6775F), and NCT6776F super I/O chips. We will refer to them collectively
as Winbond chips.

The chips implement 2 to 4 temperature sensors (9 for NCT6775F and NCT6776F),
2 to 5 fan rotation speed sensors, 8 to 10 analog voltage sensors, one VID
(except for 627UHG), alarms with beep warnings (control unimplemented),
and some automatic fan regulation strategies (plus manual fan control mode).

The temperature sensor sources on W82677HG-B, NCT6775F, and NCT6776F are
Expand Down Expand Up @@ -86,17 +89,16 @@ follows:

temp1 -> pwm1
temp2 -> pwm2
temp3 -> pwm3
temp3 -> pwm3 (not on 627UHG)
prog -> pwm4 (not on 667HG and 667HG-B; the programmable setting is not
supported by the driver)

/sys files
----------

name - this is a standard hwmon device entry. For the W83627EHF and W83627EHG,
it is set to "w83627ehf", for the W83627DHG it is set to "w83627dhg",
for the W83667HG and W83667HG-B it is set to "w83667hg", for NCT6775F it
is set to "nct6775", and for NCT6776F it is set to "nct6776".
name - this is a standard hwmon device entry, it contains the name of
the device (see the prefix in the list of supported devices at
the top of this file)

pwm[1-4] - this file stores PWM duty cycle or DC value (fan speed) in range:
0 (stop) to 255 (full)
Expand Down
20 changes: 16 additions & 4 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ config SENSORS_I5K_AMB

config SENSORS_F71805F
tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG"
depends on !PPC
help
If you say yes here you get support for hardware monitoring
features of the Fintek F71805F/FG, F71806F/FG and F71872F/FG
Expand All @@ -345,6 +346,7 @@ config SENSORS_F71805F

config SENSORS_F71882FG
tristate "Fintek F71882FG and compatibles"
depends on !PPC
help
If you say yes here you get support for hardware monitoring
features of many Fintek Super-I/O (LPC) chips. The currently
Expand Down Expand Up @@ -468,6 +470,7 @@ config SENSORS_IBMPEX

config SENSORS_IT87
tristate "ITE IT87xx and compatibles"
depends on !PPC
select HWMON_VID
help
If you say yes here you get support for ITE IT8705F, IT8712F,
Expand Down Expand Up @@ -824,6 +827,7 @@ config SENSORS_NTC_THERMISTOR

config SENSORS_PC87360
tristate "National Semiconductor PC87360 family"
depends on !PPC
select HWMON_VID
help
If you say yes here you get access to the hardware monitoring
Expand All @@ -837,6 +841,7 @@ config SENSORS_PC87360

config SENSORS_PC87427
tristate "National Semiconductor PC87427"
depends on !PPC
help
If you say yes here you get access to the hardware monitoring
functions of the National Semiconductor PC87427 Super-I/O chip.
Expand Down Expand Up @@ -928,7 +933,7 @@ config SENSORS_SMM665

config SENSORS_DME1737
tristate "SMSC DME1737, SCH311x and compatibles"
depends on I2C && EXPERIMENTAL
depends on I2C && EXPERIMENTAL && !PPC
select HWMON_VID
help
If you say yes here you get support for the hardware monitoring
Expand Down Expand Up @@ -970,6 +975,7 @@ config SENSORS_EMC6W201

config SENSORS_SMSC47M1
tristate "SMSC LPC47M10x and compatibles"
depends on !PPC
help
If you say yes here you get support for the integrated fan
monitoring and control capabilities of the SMSC LPC47B27x,
Expand Down Expand Up @@ -1003,7 +1009,7 @@ config SENSORS_SMSC47M192

config SENSORS_SMSC47B397
tristate "SMSC LPC47B397-NC"
depends on EXPERIMENTAL
depends on EXPERIMENTAL && !PPC
help
If you say yes here you get support for the SMSC LPC47B397-NC
sensor chip.
Expand All @@ -1017,6 +1023,7 @@ config SENSORS_SCH56XX_COMMON

config SENSORS_SCH5627
tristate "SMSC SCH5627"
depends on !PPC
select SENSORS_SCH56XX_COMMON
help
If you say yes here you get support for the hardware monitoring
Expand All @@ -1027,6 +1034,7 @@ config SENSORS_SCH5627

config SENSORS_SCH5636
tristate "SMSC SCH5636"
depends on !PPC
select SENSORS_SCH56XX_COMMON
help
SMSC SCH5636 Super I/O chips include an embedded microcontroller for
Expand Down Expand Up @@ -1150,6 +1158,7 @@ config SENSORS_VIA686A

config SENSORS_VT1211
tristate "VIA VT1211"
depends on !PPC
select HWMON_VID
help
If you say yes here then you get support for hardware monitoring
Expand Down Expand Up @@ -1262,6 +1271,7 @@ config SENSORS_W83L786NG

config SENSORS_W83627HF
tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF"
depends on !PPC
select HWMON_VID
help
If you say yes here you get support for the Winbond W836X7 series
Expand All @@ -1272,7 +1282,8 @@ config SENSORS_W83627HF
will be called w83627hf.

config SENSORS_W83627EHF
tristate "Winbond W83627EHF/EHG/DHG, W83667HG, NCT6775F, NCT6776F"
tristate "Winbond W83627EHF/EHG/DHG/UHG, W83667HG, NCT6775F, NCT6776F"
depends on !PPC
select HWMON_VID
help
If you say yes here you get support for the hardware
Expand All @@ -1281,7 +1292,8 @@ config SENSORS_W83627EHF
This driver also supports the W83627EHG, which is the lead-free
version of the W83627EHF, and the W83627DHG, which is a similar
chip suited for specific Intel processors that use PECI such as
the Core 2 Duo.
the Core 2 Duo. And also the W83627UHG, which is a stripped down
version of the W83627DHG (as far as hardware monitoring goes.)

This driver also supports Nuvoton W83667HG, W83667HG-B, NCT6775F
(also known as W83667HG-I), and NCT6776F.
Expand Down
7 changes: 3 additions & 4 deletions drivers/hwmon/ad7414.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,9 @@ static inline int ad7414_temp_from_reg(s16 reg)

static inline int ad7414_read(struct i2c_client *client, u8 reg)
{
if (reg == AD7414_REG_TEMP) {
int value = i2c_smbus_read_word_data(client, reg);
return (value < 0) ? value : swab16(value);
} else
if (reg == AD7414_REG_TEMP)
return i2c_smbus_read_word_swapped(client, reg);
else
return i2c_smbus_read_byte_data(client, reg);
}

Expand Down
27 changes: 9 additions & 18 deletions drivers/hwmon/ad7418.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,6 @@ static struct i2c_driver ad7418_driver = {
.id_table = ad7418_id,
};

/* All registers are word-sized, except for the configuration registers.
* AD7418 uses a high-byte first convention. Do NOT use those functions to
* access the configuration registers CONF and CONF2, as they are byte-sized.
*/
static inline int ad7418_read(struct i2c_client *client, u8 reg)
{
return swab16(i2c_smbus_read_word_data(client, reg));
}

static inline int ad7418_write(struct i2c_client *client, u8 reg, u16 value)
{
return i2c_smbus_write_word_data(client, reg, swab16(value));
}

static void ad7418_init_client(struct i2c_client *client)
{
struct ad7418_data *data = i2c_get_clientdata(client);
Expand Down Expand Up @@ -128,7 +114,9 @@ static struct ad7418_data *ad7418_update_device(struct device *dev)
udelay(30);

for (i = 0; i < 3; i++) {
data->temp[i] = ad7418_read(client, AD7418_REG_TEMP[i]);
data->temp[i] =
i2c_smbus_read_word_swapped(client,
AD7418_REG_TEMP[i]);
}

for (i = 0, ch = 4; i < data->adc_max; i++, ch--) {
Expand All @@ -138,11 +126,12 @@ static struct ad7418_data *ad7418_update_device(struct device *dev)

udelay(15);
data->in[data->adc_max - 1 - i] =
ad7418_read(client, AD7418_REG_ADC);
i2c_smbus_read_word_swapped(client,
AD7418_REG_ADC);
}

/* restore old configuration value */
ad7418_write(client, AD7418_REG_CONF, cfg);
i2c_smbus_write_word_swapped(client, AD7418_REG_CONF, cfg);

data->last_updated = jiffies;
data->valid = 1;
Expand Down Expand Up @@ -182,7 +171,9 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *devattr,

mutex_lock(&data->lock);
data->temp[attr->index] = LM75_TEMP_TO_REG(temp);
ad7418_write(client, AD7418_REG_TEMP[attr->index], data->temp[attr->index]);
i2c_smbus_write_word_swapped(client,
AD7418_REG_TEMP[attr->index],
data->temp[attr->index]);
mutex_unlock(&data->lock);
return count;
}
Expand Down
21 changes: 4 additions & 17 deletions drivers/hwmon/ads1015.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,6 @@ struct ads1015_data {
struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
};

static s32 ads1015_read_reg(struct i2c_client *client, unsigned int reg)
{
s32 data = i2c_smbus_read_word_data(client, reg);

return (data < 0) ? data : swab16(data);
}

static s32 ads1015_write_reg(struct i2c_client *client, unsigned int reg,
u16 val)
{
return i2c_smbus_write_word_data(client, reg, swab16(val));
}

static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
int *value)
{
Expand All @@ -87,7 +74,7 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
mutex_lock(&data->update_lock);

/* get channel parameters */
res = ads1015_read_reg(client, ADS1015_CONFIG);
res = i2c_smbus_read_word_swapped(client, ADS1015_CONFIG);
if (res < 0)
goto err_unlock;
config = res;
Expand All @@ -101,13 +88,13 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
config |= (pga & 0x0007) << 9;
config |= (data_rate & 0x0007) << 5;

res = ads1015_write_reg(client, ADS1015_CONFIG, config);
res = i2c_smbus_write_word_swapped(client, ADS1015_CONFIG, config);
if (res < 0)
goto err_unlock;

/* wait until conversion finished */
msleep(conversion_time_ms);
res = ads1015_read_reg(client, ADS1015_CONFIG);
res = i2c_smbus_read_word_swapped(client, ADS1015_CONFIG);
if (res < 0)
goto err_unlock;
config = res;
Expand All @@ -117,7 +104,7 @@ static int ads1015_read_value(struct i2c_client *client, unsigned int channel,
goto err_unlock;
}

res = ads1015_read_reg(client, ADS1015_CONVERSION);
res = i2c_smbus_read_word_swapped(client, ADS1015_CONVERSION);
if (res < 0)
goto err_unlock;
conversion = res;
Expand Down
12 changes: 3 additions & 9 deletions drivers/hwmon/ads7828.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,6 @@ static int ads7828_detect(struct i2c_client *client,
static int ads7828_probe(struct i2c_client *client,
const struct i2c_device_id *id);

/* The ADS7828 returns the 12-bit sample in two bytes,
these are read as a word then byte-swapped */
static u16 ads7828_read_value(struct i2c_client *client, u8 reg)
{
return swab16(i2c_smbus_read_word_data(client, reg));
}

static inline u8 channel_cmd_byte(int ch)
{
/* cmd byte C2,C1,C0 - see datasheet */
Expand All @@ -104,7 +97,8 @@ static struct ads7828_data *ads7828_update_device(struct device *dev)

for (ch = 0; ch < ADS7828_NCH; ch++) {
u8 cmd = channel_cmd_byte(ch);
data->adc_input[ch] = ads7828_read_value(client, cmd);
data->adc_input[ch] =
i2c_smbus_read_word_swapped(client, cmd);
}
data->last_updated = jiffies;
data->valid = 1;
Expand Down Expand Up @@ -203,7 +197,7 @@ static int ads7828_detect(struct i2c_client *client,
for (ch = 0; ch < ADS7828_NCH; ch++) {
u16 in_data;
u8 cmd = channel_cmd_byte(ch);
in_data = ads7828_read_value(client, cmd);
in_data = i2c_smbus_read_word_swapped(client, cmd);
if (in_data & 0xF000) {
pr_debug("%s : Doesn't look like an ads7828 device\n",
__func__);
Expand Down
10 changes: 5 additions & 5 deletions drivers/hwmon/asb100.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,17 +829,17 @@ static int asb100_read_value(struct i2c_client *client, u16 reg)
/* convert from ISA to LM75 I2C addresses */
switch (reg & 0xff) {
case 0x50: /* TEMP */
res = swab16(i2c_smbus_read_word_data(cl, 0));
res = i2c_smbus_read_word_swapped(cl, 0);
break;
case 0x52: /* CONFIG */
res = i2c_smbus_read_byte_data(cl, 1);
break;
case 0x53: /* HYST */
res = swab16(i2c_smbus_read_word_data(cl, 2));
res = i2c_smbus_read_word_swapped(cl, 2);
break;
case 0x55: /* MAX */
default:
res = swab16(i2c_smbus_read_word_data(cl, 3));
res = i2c_smbus_read_word_swapped(cl, 3);
break;
}
}
Expand Down Expand Up @@ -877,10 +877,10 @@ static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value)
i2c_smbus_write_byte_data(cl, 1, value & 0xff);
break;
case 0x53: /* HYST */
i2c_smbus_write_word_data(cl, 2, swab16(value));
i2c_smbus_write_word_swapped(cl, 2, value);
break;
case 0x55: /* MAX */
i2c_smbus_write_word_data(cl, 3, swab16(value));
i2c_smbus_write_word_swapped(cl, 3, value);
break;
}
}
Expand Down
Loading

0 comments on commit 46e85f5

Please sign in to comment.