Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 503698e1 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 6391f34e 78cebd08
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
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 <johannes.winkelmann@sensirion.com>

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
+10 −0
Original line number Diff line number Diff line
@@ -1124,6 +1124,16 @@ config SENSORS_SHT21
	  This driver can also be built as a module.  If so, the module
	  will be called sht21.

config SENSORS_SHTC1
	tristate "Sensiron humidity and temperature sensors. SHTC1 and compat."
	depends on I2C
	help
	  If you say yes here you get support for the Sensiron SHTC1 and SHTW1
	  humidity and temperature sensors.

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

config SENSORS_S3C
	tristate "Samsung built-in ADC"
	depends on S3C_ADC
+1 −0
Original line number Diff line number Diff line
@@ -126,6 +126,7 @@ obj-$(CONFIG_SENSORS_SCH5627) += sch5627.o
obj-$(CONFIG_SENSORS_SCH5636)	+= sch5636.o
obj-$(CONFIG_SENSORS_SHT15)	+= sht15.o
obj-$(CONFIG_SENSORS_SHT21)	+= sht21.o
obj-$(CONFIG_SENSORS_SHTC1)	+= shtc1.o
obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595.o
obj-$(CONFIG_SENSORS_SMM665)	+= smm665.o
obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
+18 −24
Original line number Diff line number Diff line
@@ -45,30 +45,6 @@ MODULE_AUTHOR("Sebastian Witt <se.witt@gmx.net>");

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);
+4 −3
Original line number Diff line number Diff line
@@ -148,7 +148,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg)

	switch (reg) {
	case INA2XX_SHUNT_VOLTAGE:
		val = DIV_ROUND_CLOSEST(data->regs[reg],
		/* signed register */
		val = DIV_ROUND_CLOSEST((s16)data->regs[reg],
					data->config->shunt_div);
		break;
	case INA2XX_BUS_VOLTAGE:
@@ -160,8 +161,8 @@ static int ina2xx_get_value(struct ina2xx_data *data, u8 reg)
		val = data->regs[reg] * data->config->power_lsb;
		break;
	case INA2XX_CURRENT:
		/* LSB=1mA (selected). Is in mA */
		val = data->regs[reg];
		/* signed register, LSB=1mA (selected), in mA */
		val = (s16)data->regs[reg];
		break;
	default:
		/* programmer goofed */
Loading