Skip to content

Commit

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

Pull hwmon updates from Guenter Roeck:
 - new driver for HTU21D (humidity sensor)
 - add support for Fam16h (Kabini) to k10temp
 - add support for NCT6102D/6106D and NCT6791D to nct6775 driver
 - add support for ADS1115 to ads1015 driver
 - add support for hibernate to w83627ehf and nct6775 drivers
 - some minor cleanups

* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
  hwmon: (htu21) Add Measurement Specialties HTU21D support
  hwmon: Change my email address.
  hwmon: (k10temp) Add support for Fam16h (Kabini)
  hwmon: (adt7462) ADT7462_REG_VOLT_MAX() should return 0
  hwmon: (ads1015) Add support for ADS1115
  hwmon: (w83627ehf) Add support for hibernate
  hwmon: (nct6775) Add support for hibernate
  hwmon: use dev_get_platdata()
  hwmon: (nct6775) Fix size of data->temp array
  hwmon: (nct6775) Avoid using device platform data outside probe function
  hwmon: (nct6775) Add support for NCT6791D
  hwmon: (nct6775) Add support for beep attributes
  hwmon: (nct6775) Add support for critical low/high temperature limits on NCT6106
  hwmon: (nct6775) Add support for NCT6102D/6106D
  hwmon: (nct6775) Support two SuperIO chips in the same system
  hwmon: (nct6775) Allocate attributes dynamically from templates
  hwmon: (coretemp) Atom CPUs don't support TjMax; no warning needed
  • Loading branch information
Linus Torvalds committed Sep 3, 2013
2 parents bebcb92 + f060c65 commit 7e75224
Show file tree
Hide file tree
Showing 38 changed files with 1,618 additions and 1,352 deletions.
8 changes: 6 additions & 2 deletions Documentation/hwmon/ads1015
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,20 @@ Supported chips:
Prefix: 'ads1015'
Datasheet: Publicly available at the Texas Instruments website :
http://focus.ti.com/lit/ds/symlink/ads1015.pdf
* Texas Instruments ADS1115
Prefix: 'ads1115'
Datasheet: Publicly available at the Texas Instruments website :
http://focus.ti.com/lit/ds/symlink/ads1115.pdf

Authors:
Dirk Eibach, Guntermann & Drunck GmbH <eibach@gdsys.de>

Description
-----------

This driver implements support for the Texas Instruments ADS1015.
This driver implements support for the Texas Instruments ADS1015/ADS1115.

This device is a 12-bit A-D converter with 4 inputs.
This device is a 12/16-bit A-D converter with 4 inputs.

The inputs can be used single ended or in certain differential combinations.

Expand Down
46 changes: 46 additions & 0 deletions Documentation/hwmon/htu21
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
Kernel driver htu21
===================

Supported chips:
* Measurement Specialties HTU21D
Prefix: 'htu21'
Addresses scanned: none
Datasheet: Publicly available at the Measurement Specialties website
http://www.meas-spec.com/downloads/HTU21D.pdf


Author:
William Markezana <william.markezana@meas-spec.com>

Description
-----------

The HTU21D is a humidity and temperature sensor in a DFN package of
only 3 x 3 mm footprint and 0.9 mm height.

The devices communicate with the I2C protocol. All sensors are set to the
same I2C address 0x40, so an entry with I2C_BOARD_INFO("htu21", 0x40) can
be used in the board setup code.

This driver does not auto-detect devices. You will have to instantiate the
devices explicitly. Please see Documentation/i2c/instantiating-devices
for details.

sysfs-Interface
---------------

temp1_input - temperature input
humidity1_input - humidity input

Notes
-----

The driver uses the default resolution settings of 12 bit for humidity and 14
bit for temperature, which results in typical measurement times of 11 ms for
humidity and 44 ms for temperature. To keep self heating below 0.1 degree
Celsius, the device should not be active for more than 10% of the time. For
this reason, the driver performs no more than two measurements per second and
reports cached information if polled more frequently.

Different resolutions, the on-chip heater, using the CRC checksum and reading
the serial number are not supported yet.
1 change: 1 addition & 0 deletions Documentation/hwmon/k10temp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Supported chips:
* AMD Family 12h processors: "Llano" (E2/A4/A6/A8-Series)
* AMD Family 14h processors: "Brazos" (C/E/G/Z-Series)
* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity"
* AMD Family 16h processors: "Kabini"

Prefix: 'k10temp'
Addresses scanned: PCI space
Expand Down
18 changes: 14 additions & 4 deletions drivers/hwmon/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ config SENSORS_K10TEMP
If you say yes here you get support for the temperature
sensor(s) inside your CPU. Supported are later revisions of
the AMD Family 10h and all revisions of the AMD Family 11h,
12h (Llano), 14h (Brazos) and 15h (Bulldozer/Trinity)
microarchitectures.
12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity) and
16h (Kabini) microarchitectures.

This driver can also be built as a module. If so, the module
will be called k10temp.
Expand Down Expand Up @@ -511,6 +511,16 @@ config SENSORS_HIH6130
This driver can also be built as a module. If so, the module
will be called hih6130.

config SENSORS_HTU21
tristate "Measurement Specialties HTU21D humidity/temperature sensors"
depends on I2C
help
If you say yes here you get support for the Measurement Specialties
HTU21D humidity and temperature sensors.

This driver can also be built as a module. If so, the module
will be called htu21.

config SENSORS_CORETEMP
tristate "Intel Core/Core2/Atom temperature sensor"
depends on X86
Expand Down Expand Up @@ -1202,8 +1212,8 @@ config SENSORS_ADS1015
tristate "Texas Instruments ADS1015"
depends on I2C
help
If you say yes here you get support for Texas Instruments ADS1015
12-bit 4-input ADC device.
If you say yes here you get support for Texas Instruments
ADS1015/ADS1115 12/16-bit 4-input ADC device.

This driver can also be built as a module. If so, the module
will be called ads1015.
Expand Down
1 change: 1 addition & 0 deletions drivers/hwmon/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ obj-$(CONFIG_SENSORS_GL518SM) += gl518sm.o
obj-$(CONFIG_SENSORS_GL520SM) += gl520sm.o
obj-$(CONFIG_SENSORS_GPIO_FAN) += gpio-fan.o
obj-$(CONFIG_SENSORS_HIH6130) += hih6130.o
obj-$(CONFIG_SENSORS_HTU21) += htu21.o
obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o
obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
obj-$(CONFIG_SENSORS_IBMAEM) += ibmaem.o
Expand Down
4 changes: 2 additions & 2 deletions drivers/hwmon/acpi_power_meter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A hwmon driver for ACPI 4.0 power meters
* Copyright (C) 2009 IBM
*
* Author: Darrick J. Wong <djwong@us.ibm.com>
* Author: Darrick J. Wong <darrick.wong@oracle.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1001,7 +1001,7 @@ static void __exit acpi_power_meter_exit(void)
acpi_bus_unregister_driver(&acpi_power_meter_driver);
}

MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
MODULE_AUTHOR("Darrick J. Wong <darrick.wong@oracle.com>");
MODULE_DESCRIPTION("ACPI 4.0 power meter driver");
MODULE_LICENSE("GPL");

Expand Down
27 changes: 21 additions & 6 deletions drivers/hwmon/ads1015.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,28 @@ static const unsigned int fullscale_table[8] = {
6144, 4096, 2048, 1024, 512, 256, 256, 256 };

/* Data rates in samples per second */
static const unsigned int data_rate_table[8] = {
128, 250, 490, 920, 1600, 2400, 3300, 3300 };
static const unsigned int data_rate_table_1015[8] = {
128, 250, 490, 920, 1600, 2400, 3300, 3300
};

static const unsigned int data_rate_table_1115[8] = {
8, 16, 32, 64, 128, 250, 475, 860
};

#define ADS1015_DEFAULT_CHANNELS 0xff
#define ADS1015_DEFAULT_PGA 2
#define ADS1015_DEFAULT_DATA_RATE 4

enum ads1015_chips {
ads1015,
ads1115,
};

struct ads1015_data {
struct device *hwmon_dev;
struct mutex update_lock; /* mutex protect updates */
struct ads1015_channel_data channel_data[ADS1015_CHANNELS];
enum ads1015_chips id;
};

static int ads1015_read_adc(struct i2c_client *client, unsigned int channel)
Expand All @@ -66,6 +77,8 @@ static int ads1015_read_adc(struct i2c_client *client, unsigned int channel)
unsigned int pga = data->channel_data[channel].pga;
unsigned int data_rate = data->channel_data[channel].data_rate;
unsigned int conversion_time_ms;
const unsigned int * const rate_table = data->id == ads1115 ?
data_rate_table_1115 : data_rate_table_1015;
int res;

mutex_lock(&data->update_lock);
Expand All @@ -75,7 +88,7 @@ static int ads1015_read_adc(struct i2c_client *client, unsigned int channel)
if (res < 0)
goto err_unlock;
config = res;
conversion_time_ms = DIV_ROUND_UP(1000, data_rate_table[data_rate]);
conversion_time_ms = DIV_ROUND_UP(1000, rate_table[data_rate]);

/* setup and start single conversion */
config &= 0x001f;
Expand Down Expand Up @@ -113,8 +126,9 @@ static int ads1015_reg_to_mv(struct i2c_client *client, unsigned int channel,
struct ads1015_data *data = i2c_get_clientdata(client);
unsigned int pga = data->channel_data[channel].pga;
int fullscale = fullscale_table[pga];
const unsigned mask = data->id == ads1115 ? 0x7fff : 0x7ff0;

return DIV_ROUND_CLOSEST(reg * fullscale, 0x7ff0);
return DIV_ROUND_CLOSEST(reg * fullscale, mask);
}

/* sysfs callback function */
Expand Down Expand Up @@ -257,7 +271,7 @@ static int ads1015_probe(struct i2c_client *client,
GFP_KERNEL);
if (!data)
return -ENOMEM;

data->id = id->driver_data;
i2c_set_clientdata(client, data);
mutex_init(&data->update_lock);

Expand Down Expand Up @@ -286,7 +300,8 @@ static int ads1015_probe(struct i2c_client *client,
}

static const struct i2c_device_id ads1015_id[] = {
{ "ads1015", 0 },
{ "ads1015", ads1015},
{ "ads1115", ads1115},
{ }
};
MODULE_DEVICE_TABLE(i2c, ads1015_id);
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/ads7828.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ static int ads7828_remove(struct i2c_client *client)
static int ads7828_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct ads7828_platform_data *pdata = client->dev.platform_data;
struct ads7828_platform_data *pdata = dev_get_platdata(&client->dev);
struct ads7828_data *data;
int err;

Expand Down
8 changes: 4 additions & 4 deletions drivers/hwmon/adt7462.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A hwmon driver for the Analog Devices ADT7462
* Copyright (C) 2008 IBM
*
* Author: Darrick J. Wong <djwong@us.ibm.com>
* Author: Darrick J. Wong <darrick.wong@oracle.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -333,7 +333,7 @@ static int ADT7462_REG_VOLT_MAX(struct adt7462_data *data, int which)
return 0x4C;
break;
}
return -ENODEV;
return 0;
}

static int ADT7462_REG_VOLT_MIN(struct adt7462_data *data, int which)
Expand Down Expand Up @@ -392,7 +392,7 @@ static int ADT7462_REG_VOLT_MIN(struct adt7462_data *data, int which)
return 0x77;
break;
}
return -ENODEV;
return 0;
}

static int ADT7462_REG_VOLT(struct adt7462_data *data, int which)
Expand Down Expand Up @@ -1970,6 +1970,6 @@ static int adt7462_remove(struct i2c_client *client)

module_i2c_driver(adt7462_driver);

MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
MODULE_AUTHOR("Darrick J. Wong <darrick.wong@oracle.com>");
MODULE_DESCRIPTION("ADT7462 driver");
MODULE_LICENSE("GPL");
4 changes: 2 additions & 2 deletions drivers/hwmon/adt7470.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A hwmon driver for the Analog Devices ADT7470
* Copyright (C) 2007 IBM
*
* Author: Darrick J. Wong <djwong@us.ibm.com>
* Author: Darrick J. Wong <darrick.wong@oracle.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1314,6 +1314,6 @@ static int adt7470_remove(struct i2c_client *client)

module_i2c_driver(adt7470_driver);

MODULE_AUTHOR("Darrick J. Wong <djwong@us.ibm.com>");
MODULE_AUTHOR("Darrick J. Wong <darrick.wong@oracle.com>");
MODULE_DESCRIPTION("ADT7470 driver");
MODULE_LICENSE("GPL");
14 changes: 13 additions & 1 deletion drivers/hwmon/coretemp.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,18 @@ static int adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
return tjmax;
}

static bool cpu_has_tjmax(struct cpuinfo_x86 *c)
{
u8 model = c->x86_model;

return model > 0xe &&
model != 0x1c &&
model != 0x26 &&
model != 0x27 &&
model != 0x35 &&
model != 0x36;
}

static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
{
int err;
Expand All @@ -328,7 +340,7 @@ static int get_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *dev)
*/
err = rdmsr_safe_on_cpu(id, MSR_IA32_TEMPERATURE_TARGET, &eax, &edx);
if (err) {
if (c->x86_model > 0xe && c->x86_model != 0x1c)
if (cpu_has_tjmax(c))
dev_warn(dev, "Unable to read TjMax from CPU %u\n", id);
} else {
val = (eax >> 16) & 0xff;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/ds620.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct ds620_data {

static void ds620_init_client(struct i2c_client *client)
{
struct ds620_platform_data *ds620_info = client->dev.platform_data;
struct ds620_platform_data *ds620_info = dev_get_platdata(&client->dev);
u16 conf, new_conf;

new_conf = conf =
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/f71805f.c
Original file line number Diff line number Diff line change
Expand Up @@ -1375,7 +1375,7 @@ static void f71805f_init_device(struct f71805f_data *data)

static int f71805f_probe(struct platform_device *pdev)
{
struct f71805f_sio_data *sio_data = pdev->dev.platform_data;
struct f71805f_sio_data *sio_data = dev_get_platdata(&pdev->dev);
struct f71805f_data *data;
struct resource *res;
int i, err;
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/f71882fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2267,7 +2267,7 @@ static int f71882fg_create_fan_sysfs_files(
static int f71882fg_probe(struct platform_device *pdev)
{
struct f71882fg_data *data;
struct f71882fg_sio_data *sio_data = pdev->dev.platform_data;
struct f71882fg_sio_data *sio_data = dev_get_platdata(&pdev->dev);
int nr_fans = f71882fg_nr_fans[sio_data->type];
int nr_temps = f71882fg_nr_temps[sio_data->type];
int err, i;
Expand Down
3 changes: 2 additions & 1 deletion drivers/hwmon/f75375s.c
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,8 @@ static int f75375_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct f75375_data *data;
struct f75375s_platform_data *f75375s_pdata = client->dev.platform_data;
struct f75375s_platform_data *f75375s_pdata =
dev_get_platdata(&client->dev);
int err;

if (!i2c_check_functionality(client->adapter,
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/g762.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ static void g762_of_clock_disable(struct i2c_client *client) { }

static int g762_pdata_prop_import(struct i2c_client *client)
{
struct g762_platform_data *pdata = client->dev.platform_data;
struct g762_platform_data *pdata = dev_get_platdata(&client->dev);
int ret;

if (!pdata)
Expand Down
2 changes: 1 addition & 1 deletion drivers/hwmon/gpio-fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ static int gpio_fan_probe(struct platform_device *pdev)
{
int err;
struct gpio_fan_data *fan_data;
struct gpio_fan_platform_data *pdata = pdev->dev.platform_data;
struct gpio_fan_platform_data *pdata = dev_get_platdata(&pdev->dev);

#ifdef CONFIG_OF_GPIO
if (!pdata) {
Expand Down
Loading

0 comments on commit 7e75224

Please sign in to comment.