forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/ker…
…nel/git/groeck/linux-staging Pull hwmon updates from Guenter Roeck: - new driver for Sensirion SHTC1 humidity / temperature sensor - convert ltc4151 and vexpress drivers to use devm functions - drop generic chip detection from lm85 driver - avoid forward declarations in atxp1 driver - fix sign extensions in ina2xx driver * tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: hwmon: vexpress: Use devm helper for hwmon device registration hwmon: (atxp1) Avoid forward declaration hwmon: add support for Sensirion SHTC1 sensor hwmon: (ltc4151) Convert to devm_hwmon_device_register_with_groups hwmon: (lm85) Drop generic detection hwmon: (ina2xx) Cast to s16 on shunt and current regs
- Loading branch information
Showing
10 changed files
with
401 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
Kernel driver shtc1 | ||
=================== | ||
|
||
Supported chips: | ||
* Sensirion SHTC1 | ||
Prefix: 'shtc1' | ||
Addresses scanned: none | ||
Datasheet: http://www.sensirion.com/file/datasheet_shtc1 | ||
|
||
* Sensirion SHTW1 | ||
Prefix: 'shtw1' | ||
Addresses scanned: none | ||
Datasheet: Not publicly available | ||
|
||
Author: | ||
Johannes Winkelmann <[email protected]> | ||
|
||
Description | ||
----------- | ||
|
||
This driver implements support for the Sensirion SHTC1 chip, a humidity and | ||
temperature sensor. Temperature is measured in degrees celsius, relative | ||
humidity is expressed as a percentage. Driver can be used as well for SHTW1 | ||
chip, which has the same electrical interface. | ||
|
||
The device communicates with the I2C protocol. All sensors are set to I2C | ||
address 0x70. See Documentation/i2c/instantiating-devices for methods to | ||
instantiate the device. | ||
|
||
There are two options configurable by means of shtc1_platform_data: | ||
1. blocking (pull the I2C clock line down while performing the measurement) or | ||
non-blocking mode. Blocking mode will guarantee the fastest result but | ||
the I2C bus will be busy during that time. By default, non-blocking mode | ||
is used. Make sure clock-stretching works properly on your device if you | ||
want to use blocking mode. | ||
2. high or low accuracy. High accuracy is used by default and using it is | ||
strongly recommended. | ||
|
||
sysfs-Interface | ||
--------------- | ||
|
||
temp1_input - temperature input | ||
humidity1_input - humidity input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,30 +45,6 @@ MODULE_AUTHOR("Sebastian Witt <[email protected]>"); | |
|
||
static const unsigned short normal_i2c[] = { 0x37, 0x4e, I2C_CLIENT_END }; | ||
|
||
static int atxp1_probe(struct i2c_client *client, | ||
const struct i2c_device_id *id); | ||
static int atxp1_remove(struct i2c_client *client); | ||
static struct atxp1_data *atxp1_update_device(struct device *dev); | ||
static int atxp1_detect(struct i2c_client *client, struct i2c_board_info *info); | ||
|
||
static const struct i2c_device_id atxp1_id[] = { | ||
{ "atxp1", 0 }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(i2c, atxp1_id); | ||
|
||
static struct i2c_driver atxp1_driver = { | ||
.class = I2C_CLASS_HWMON, | ||
.driver = { | ||
.name = "atxp1", | ||
}, | ||
.probe = atxp1_probe, | ||
.remove = atxp1_remove, | ||
.id_table = atxp1_id, | ||
.detect = atxp1_detect, | ||
.address_list = normal_i2c, | ||
}; | ||
|
||
struct atxp1_data { | ||
struct device *hwmon_dev; | ||
struct mutex update_lock; | ||
|
@@ -386,4 +362,22 @@ static int atxp1_remove(struct i2c_client *client) | |
return 0; | ||
}; | ||
|
||
static const struct i2c_device_id atxp1_id[] = { | ||
{ "atxp1", 0 }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(i2c, atxp1_id); | ||
|
||
static struct i2c_driver atxp1_driver = { | ||
.class = I2C_CLASS_HWMON, | ||
.driver = { | ||
.name = "atxp1", | ||
}, | ||
.probe = atxp1_probe, | ||
.remove = atxp1_remove, | ||
.id_table = atxp1_id, | ||
.detect = atxp1_detect, | ||
.address_list = normal_i2c, | ||
}; | ||
|
||
module_i2c_driver(atxp1_driver); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
* Copyright (c) 2002, 2003 Philip Pokorny <[email protected]> | ||
* Copyright (c) 2003 Margit Schubert-While <[email protected]> | ||
* Copyright (c) 2004 Justin Thiessen <[email protected]> | ||
* Copyright (C) 2007--2009 Jean Delvare <[email protected]> | ||
* Copyright (C) 2007--2014 Jean Delvare <[email protected]> | ||
* | ||
* Chip details at <http://www.national.com/ds/LM/LM85.pdf> | ||
* | ||
|
@@ -39,7 +39,7 @@ | |
static const unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END }; | ||
|
||
enum chips { | ||
any_chip, lm85b, lm85c, | ||
lm85, | ||
adm1027, adt7463, adt7468, | ||
emc6d100, emc6d102, emc6d103, emc6d103s | ||
}; | ||
|
@@ -75,9 +75,6 @@ enum chips { | |
#define LM85_COMPANY_NATIONAL 0x01 | ||
#define LM85_COMPANY_ANALOG_DEV 0x41 | ||
#define LM85_COMPANY_SMSC 0x5c | ||
#define LM85_VERSTEP_VMASK 0xf0 | ||
#define LM85_VERSTEP_GENERIC 0x60 | ||
#define LM85_VERSTEP_GENERIC2 0x70 | ||
#define LM85_VERSTEP_LM85C 0x60 | ||
#define LM85_VERSTEP_LM85B 0x62 | ||
#define LM85_VERSTEP_LM96000_1 0x68 | ||
|
@@ -351,9 +348,9 @@ static const struct i2c_device_id lm85_id[] = { | |
{ "adm1027", adm1027 }, | ||
{ "adt7463", adt7463 }, | ||
{ "adt7468", adt7468 }, | ||
{ "lm85", any_chip }, | ||
{ "lm85b", lm85b }, | ||
{ "lm85c", lm85c }, | ||
{ "lm85", lm85 }, | ||
{ "lm85b", lm85 }, | ||
{ "lm85c", lm85 }, | ||
{ "emc6d100", emc6d100 }, | ||
{ "emc6d101", emc6d100 }, | ||
{ "emc6d102", emc6d102 }, | ||
|
@@ -1281,7 +1278,7 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) | |
{ | ||
struct i2c_adapter *adapter = client->adapter; | ||
int address = client->addr; | ||
const char *type_name; | ||
const char *type_name = NULL; | ||
int company, verstep; | ||
|
||
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { | ||
|
@@ -1297,16 +1294,6 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) | |
"Detecting device at 0x%02x with COMPANY: 0x%02x and VERSTEP: 0x%02x\n", | ||
address, company, verstep); | ||
|
||
/* All supported chips have the version in common */ | ||
if ((verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC && | ||
(verstep & LM85_VERSTEP_VMASK) != LM85_VERSTEP_GENERIC2) { | ||
dev_dbg(&adapter->dev, | ||
"Autodetection failed: unsupported version\n"); | ||
return -ENODEV; | ||
} | ||
type_name = "lm85"; | ||
|
||
/* Now, refine the detection */ | ||
if (company == LM85_COMPANY_NATIONAL) { | ||
switch (verstep) { | ||
case LM85_VERSTEP_LM85C: | ||
|
@@ -1323,6 +1310,7 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) | |
"Found Winbond WPCD377I, ignoring\n"); | ||
return -ENODEV; | ||
} | ||
type_name = "lm85"; | ||
break; | ||
} | ||
} else if (company == LM85_COMPANY_ANALOG_DEV) { | ||
|
@@ -1357,12 +1345,11 @@ static int lm85_detect(struct i2c_client *client, struct i2c_board_info *info) | |
type_name = "emc6d103s"; | ||
break; | ||
} | ||
} else { | ||
dev_dbg(&adapter->dev, | ||
"Autodetection failed: unknown vendor\n"); | ||
return -ENODEV; | ||
} | ||
|
||
if (!type_name) | ||
return -ENODEV; | ||
|
||
strlcpy(info->type, type_name, I2C_NAME_SIZE); | ||
|
||
return 0; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.