diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-24 00:50:16 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-24 00:50:16 +0300 |
commit | d5bd1eba19230347acfc4960581a15bfb459a615 (patch) | |
tree | 8fc05e23b81792591d99550a93f463790e897e42 /drivers/staging/iio | |
parent | 1d9e3a07cb80ca7c8f4efcfcc6c4ca10790d9645 (diff) | |
parent | 87557ade38f3d465f4935d63d74a7590e7d69e1a (diff) | |
download | linux-d5bd1eba19230347acfc4960581a15bfb459a615.tar.xz |
Merge tag 'iio-for-4.9a' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into work-testing
Jonathan writes:
First round of new features, device support and cleanups for IIO in the 4.9 cycle.
Device support
* ak8974
- New driver and bindings for this 2009 vintage magnetometer (it was very
popular back then!)
* atlas-ph-sensor
- ORP sensor support(I had to look up what one of these was)
* cio-dac
- New driver for Measurement Computing DAC boards
* dmard06
- New driver for Domintech DMARDO6 accelerometer. Also vendor prefix.
* dmard09
- New driver for Domintech DMARD09 accelerometer.
* maxim-thermocouple
- max6675 and max31855 new driver
* mt6577 auxdac
- new driver for this Mediatek chip mt2701, mt6577 and mt8173 have this
hardware.
* ti-adc161s626
- new driver for this TI single channel differential ADC.
* vcnl4000
- support vcnl4010 and vcnl4020 which are compatible for all features
currently supported by this driver.
New features
* Core
- Allow retrieving of underlying iio_dev from a callback buffer handle.
This is needed to allow client drivers to perform operations such as
configuring the trigger used.
* hid-sensors
- asynchronous resume support to avoid really long resume times.
* kxcjk-1013
- add the mysterious KIOX000A ACPI id seen in the wild.
* Tools
- lsiio now enumerates processed as well as raw channels.
Cleanup
* ad7298
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
* ad7793
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
* ade7854
- checkpatch fixups (alignment of parameters)
* atlas-ph-sensor
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
- Switch to REGCACHE_NONE as there are no useful register to cache.
* bma180
- use iio_device_claim_direct_mode and friends to simplify locking around
mode switching and drop some boilerplate.
* hdc100x
- Add mention of the HDC1000 and HDC1008 to the Kconfig help text.
* isl29018
- Add driver specific prefixes to defines and function names.
- Remove excessive logging.
- Drop newlines which add nothing to readability.
- General tidying up of comments.
- Drop I2C_CLASS_HWMON as irrelevant to driver.
* isl29028
- Add driver specific prefixes to defines, enums and function names.
- Drop comma's from available attribute output as not ABI compliant.
- Drop I2C_CLASS_HWMON as irrelevant to driver.
* kxsd9
- devicetree bindings.
* mag3110
- This one wasn't locking to protect against mode switches during
raw_reads. Use the iio_claim_direct_mode function to fix this buglet.
* maxim-theromcouple
- Fix missing selects for triggered buffer support in Kconfig.
* nau7802
- Use complete instead of complete_all as only one completion at a time.
* sx9500
- Use complete instead of complete_all as only one completion at a time.
* us5182d
- Add a missing error code asignment instead of checking the result of
an already checked statement.
* vcnl4000
- Use BIT macro where appropriate.
- Refactor return codes in read_raw callback.
- Add some missing locking for concurrent accesses to the device.
Diffstat (limited to 'drivers/staging/iio')
-rw-r--r-- | drivers/staging/iio/light/isl29018.c | 134 | ||||
-rw-r--r-- | drivers/staging/iio/light/isl29028.c | 103 | ||||
-rw-r--r-- | drivers/staging/iio/meter/ade7854.c | 40 |
3 files changed, 129 insertions, 148 deletions
diff --git a/drivers/staging/iio/light/isl29018.c b/drivers/staging/iio/light/isl29018.c index 76d9f74e7dcb..f47a17d7f6b3 100644 --- a/drivers/staging/iio/light/isl29018.c +++ b/drivers/staging/iio/light/isl29018.c @@ -32,25 +32,25 @@ #include <linux/iio/sysfs.h> #include <linux/acpi.h> -#define CONVERSION_TIME_MS 100 +#define ISL29018_CONV_TIME_MS 100 #define ISL29018_REG_ADD_COMMAND1 0x00 -#define COMMMAND1_OPMODE_SHIFT 5 -#define COMMMAND1_OPMODE_MASK (7 << COMMMAND1_OPMODE_SHIFT) -#define COMMMAND1_OPMODE_POWER_DOWN 0 -#define COMMMAND1_OPMODE_ALS_ONCE 1 -#define COMMMAND1_OPMODE_IR_ONCE 2 -#define COMMMAND1_OPMODE_PROX_ONCE 3 +#define ISL29018_CMD1_OPMODE_SHIFT 5 +#define ISL29018_CMD1_OPMODE_MASK (7 << ISL29018_CMD1_OPMODE_SHIFT) +#define ISL29018_CMD1_OPMODE_POWER_DOWN 0 +#define ISL29018_CMD1_OPMODE_ALS_ONCE 1 +#define ISL29018_CMD1_OPMODE_IR_ONCE 2 +#define ISL29018_CMD1_OPMODE_PROX_ONCE 3 -#define ISL29018_REG_ADD_COMMANDII 0x01 -#define COMMANDII_RESOLUTION_SHIFT 2 -#define COMMANDII_RESOLUTION_MASK (0x3 << COMMANDII_RESOLUTION_SHIFT) +#define ISL29018_REG_ADD_COMMAND2 0x01 +#define ISL29018_CMD2_RESOLUTION_SHIFT 2 +#define ISL29018_CMD2_RESOLUTION_MASK (0x3 << ISL29018_CMD2_RESOLUTION_SHIFT) -#define COMMANDII_RANGE_SHIFT 0 -#define COMMANDII_RANGE_MASK (0x3 << COMMANDII_RANGE_SHIFT) +#define ISL29018_CMD2_RANGE_SHIFT 0 +#define ISL29018_CMD2_RANGE_MASK (0x3 << ISL29018_CMD2_RANGE_SHIFT) -#define COMMANDII_SCHEME_SHIFT 7 -#define COMMANDII_SCHEME_MASK (0x1 << COMMANDII_SCHEME_SHIFT) +#define ISL29018_CMD2_SCHEME_SHIFT 7 +#define ISL29018_CMD2_SCHEME_MASK (0x1 << ISL29018_CMD2_SCHEME_SHIFT) #define ISL29018_REG_ADD_DATA_LSB 0x02 #define ISL29018_REG_ADD_DATA_MSB 0x03 @@ -127,13 +127,13 @@ static int isl29018_set_integration_time(struct isl29018_chip *chip, if (i >= ARRAY_SIZE(isl29018_int_utimes[chip->type])) return -EINVAL; - ret = regmap_update_bits(chip->regmap, ISL29018_REG_ADD_COMMANDII, - COMMANDII_RESOLUTION_MASK, - i << COMMANDII_RESOLUTION_SHIFT); + ret = regmap_update_bits(chip->regmap, ISL29018_REG_ADD_COMMAND2, + ISL29018_CMD2_RESOLUTION_MASK, + i << ISL29018_CMD2_RESOLUTION_SHIFT); if (ret < 0) return ret; - /* keep the same range when integration time changes */ + /* Keep the same range when integration time changes */ int_time = chip->int_time; for (i = 0; i < ARRAY_SIZE(isl29018_scales[int_time]); ++i) { if (chip->scale.scale == isl29018_scales[int_time][i].scale && @@ -163,9 +163,9 @@ static int isl29018_set_scale(struct isl29018_chip *chip, int scale, int uscale) if (i >= ARRAY_SIZE(isl29018_scales[chip->int_time])) return -EINVAL; - ret = regmap_update_bits(chip->regmap, ISL29018_REG_ADD_COMMANDII, - COMMANDII_RANGE_MASK, - i << COMMANDII_RANGE_SHIFT); + ret = regmap_update_bits(chip->regmap, ISL29018_REG_ADD_COMMAND2, + ISL29018_CMD2_RANGE_MASK, + i << ISL29018_CMD2_RANGE_SHIFT); if (ret < 0) return ret; @@ -183,13 +183,13 @@ static int isl29018_read_sensor_input(struct isl29018_chip *chip, int mode) /* Set mode */ status = regmap_write(chip->regmap, ISL29018_REG_ADD_COMMAND1, - mode << COMMMAND1_OPMODE_SHIFT); + mode << ISL29018_CMD1_OPMODE_SHIFT); if (status) { dev_err(dev, "Error in setting operating mode err %d\n", status); return status; } - msleep(CONVERSION_TIME_MS); + msleep(ISL29018_CONV_TIME_MS); status = regmap_read(chip->regmap, ISL29018_REG_ADD_DATA_LSB, &lsb); if (status < 0) { dev_err(dev, @@ -213,8 +213,8 @@ static int isl29018_read_lux(struct isl29018_chip *chip, int *lux) int lux_data; unsigned int data_x_range; - lux_data = isl29018_read_sensor_input(chip, COMMMAND1_OPMODE_ALS_ONCE); - + lux_data = isl29018_read_sensor_input(chip, + ISL29018_CMD1_OPMODE_ALS_ONCE); if (lux_data < 0) return lux_data; @@ -230,8 +230,8 @@ static int isl29018_read_ir(struct isl29018_chip *chip, int *ir) { int ir_data; - ir_data = isl29018_read_sensor_input(chip, COMMMAND1_OPMODE_IR_ONCE); - + ir_data = isl29018_read_sensor_input(chip, + ISL29018_CMD1_OPMODE_IR_ONCE); if (ir_data < 0) return ir_data; @@ -249,16 +249,16 @@ static int isl29018_read_proximity_ir(struct isl29018_chip *chip, int scheme, struct device *dev = regmap_get_device(chip->regmap); /* Do proximity sensing with required scheme */ - status = regmap_update_bits(chip->regmap, ISL29018_REG_ADD_COMMANDII, - COMMANDII_SCHEME_MASK, - scheme << COMMANDII_SCHEME_SHIFT); + status = regmap_update_bits(chip->regmap, ISL29018_REG_ADD_COMMAND2, + ISL29018_CMD2_SCHEME_MASK, + scheme << ISL29018_CMD2_SCHEME_SHIFT); if (status) { dev_err(dev, "Error in setting operating mode\n"); return status; } prox_data = isl29018_read_sensor_input(chip, - COMMMAND1_OPMODE_PROX_ONCE); + ISL29018_CMD1_OPMODE_PROX_ONCE); if (prox_data < 0) return prox_data; @@ -267,8 +267,8 @@ static int isl29018_read_proximity_ir(struct isl29018_chip *chip, int scheme, return 0; } - ir_data = isl29018_read_sensor_input(chip, COMMMAND1_OPMODE_IR_ONCE); - + ir_data = isl29018_read_sensor_input(chip, + ISL29018_CMD1_OPMODE_IR_ONCE); if (ir_data < 0) return ir_data; @@ -280,7 +280,7 @@ static int isl29018_read_proximity_ir(struct isl29018_chip *chip, int scheme, return 0; } -static ssize_t show_scale_available(struct device *dev, +static ssize_t isl29018_show_scale_available(struct device *dev, struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -297,7 +297,7 @@ static ssize_t show_scale_available(struct device *dev, return len; } -static ssize_t show_int_time_available(struct device *dev, +static ssize_t isl29018_show_int_time_available(struct device *dev, struct device_attribute *attr, char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -313,8 +313,7 @@ static ssize_t show_int_time_available(struct device *dev, return len; } -/* proximity scheme */ -static ssize_t show_prox_infrared_suppression(struct device *dev, +static ssize_t isl29018_show_prox_infrared_suppression(struct device *dev, struct device_attribute *attr, char *buf) { @@ -322,13 +321,13 @@ static ssize_t show_prox_infrared_suppression(struct device *dev, struct isl29018_chip *chip = iio_priv(indio_dev); /* - * return the "proximity scheme" i.e. if the chip does on chip + * Return the "proximity scheme" i.e. if the chip does on chip * infrared suppression (1 means perform on chip suppression) */ return sprintf(buf, "%d\n", chip->prox_scheme); } -static ssize_t store_prox_infrared_suppression(struct device *dev, +static ssize_t isl29018_store_prox_infrared_suppression(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -338,13 +337,11 @@ static ssize_t store_prox_infrared_suppression(struct device *dev, if (kstrtoint(buf, 10, &val)) return -EINVAL; - if (!(val == 0 || val == 1)) { - dev_err(dev, "The mode is not supported\n"); + if (!(val == 0 || val == 1)) return -EINVAL; - } /* - * get the "proximity scheme" i.e. if the chip does on chip + * Get the "proximity scheme" i.e. if the chip does on chip * infrared suppression (1 means perform on chip suppression) */ mutex_lock(&chip->lock); @@ -354,7 +351,6 @@ static ssize_t store_prox_infrared_suppression(struct device *dev, return count; } -/* Channel IO */ static int isl29018_write_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan, int val, @@ -491,13 +487,13 @@ static const struct iio_chan_spec isl29023_channels[] = { }; static IIO_DEVICE_ATTR(in_illuminance_integration_time_available, S_IRUGO, - show_int_time_available, NULL, 0); + isl29018_show_int_time_available, NULL, 0); static IIO_DEVICE_ATTR(in_illuminance_scale_available, S_IRUGO, - show_scale_available, NULL, 0); + isl29018_show_scale_available, NULL, 0); static IIO_DEVICE_ATTR(proximity_on_chip_ambient_infrared_suppression, S_IRUGO | S_IWUSR, - show_prox_infrared_suppression, - store_prox_infrared_suppression, 0); + isl29018_show_prox_infrared_suppression, + isl29018_store_prox_infrared_suppression, 0); #define ISL29018_DEV_ATTR(name) (&iio_dev_attr_##name.dev_attr.attr) @@ -541,7 +537,7 @@ static int isl29035_detect(struct isl29018_chip *chip) if (id != ISL29035_DEVICE_ID) return -ENODEV; - /* clear out brownout bit */ + /* Clear brownout bit */ return regmap_update_bits(chip->regmap, ISL29035_REG_DEVICE_ID, ISL29035_BOUT_MASK, 0); } @@ -574,7 +570,7 @@ static int isl29018_chip_init(struct isl29018_chip *chip) * conversions, clear the test registers, and then rewrite all * registers to the desired values. * ... - * FOR ISL29011, ISL29018, ISL29021, ISL29023 + * For ISL29011, ISL29018, ISL29021, ISL29023 * 1. Write 0x00 to register 0x08 (TEST) * 2. Write 0x00 to register 0x00 (CMD1) * 3. Rewrite all registers to the desired values @@ -603,7 +599,7 @@ static int isl29018_chip_init(struct isl29018_chip *chip) usleep_range(1000, 2000); /* per data sheet, page 10 */ - /* set defaults */ + /* Set defaults */ status = isl29018_set_scale(chip, chip->scale.scale, chip->scale.uscale); if (status < 0) { @@ -635,7 +631,7 @@ static const struct iio_info isl29023_info = { .write_raw = isl29018_write_raw, }; -static bool is_volatile_reg(struct device *dev, unsigned int reg) +static bool isl29018_is_volatile_reg(struct device *dev, unsigned int reg) { switch (reg) { case ISL29018_REG_ADD_DATA_LSB: @@ -649,37 +645,32 @@ static bool is_volatile_reg(struct device *dev, unsigned int reg) } } -/* - * isl29018_regmap_config: regmap configuration. - * Use RBTREE mechanism for caching. - */ static const struct regmap_config isl29018_regmap_config = { .reg_bits = 8, .val_bits = 8, - .volatile_reg = is_volatile_reg, + .volatile_reg = isl29018_is_volatile_reg, .max_register = ISL29018_REG_TEST, .num_reg_defaults_raw = ISL29018_REG_TEST + 1, .cache_type = REGCACHE_RBTREE, }; -/* isl29035_regmap_config: regmap configuration for ISL29035 */ static const struct regmap_config isl29035_regmap_config = { .reg_bits = 8, .val_bits = 8, - .volatile_reg = is_volatile_reg, + .volatile_reg = isl29018_is_volatile_reg, .max_register = ISL29035_REG_DEVICE_ID, .num_reg_defaults_raw = ISL29035_REG_DEVICE_ID + 1, .cache_type = REGCACHE_RBTREE, }; -struct chip_info { +struct isl29018_chip_info { const struct iio_chan_spec *channels; int num_channels; const struct iio_info *indio_info; const struct regmap_config *regmap_cfg; }; -static const struct chip_info chip_info_tbl[] = { +static const struct isl29018_chip_info isl29018_chip_info_tbl[] = { [isl29018] = { .channels = isl29018_channels, .num_channels = ARRAY_SIZE(isl29018_channels), @@ -724,10 +715,8 @@ static int isl29018_probe(struct i2c_client *client, int dev_id = 0; indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); - if (!indio_dev) { - dev_err(&client->dev, "iio allocation fails\n"); + if (!indio_dev) return -ENOMEM; - } chip = iio_priv(indio_dev); i2c_set_clientdata(client, indio_dev); @@ -750,7 +739,7 @@ static int isl29018_probe(struct i2c_client *client, chip->suspended = false; chip->regmap = devm_regmap_init_i2c(client, - chip_info_tbl[dev_id].regmap_cfg); + isl29018_chip_info_tbl[dev_id].regmap_cfg); if (IS_ERR(chip->regmap)) { err = PTR_ERR(chip->regmap); dev_err(&client->dev, "regmap initialization fails: %d\n", err); @@ -761,19 +750,13 @@ static int isl29018_probe(struct i2c_client *client, if (err) return err; - indio_dev->info = chip_info_tbl[dev_id].indio_info; - indio_dev->channels = chip_info_tbl[dev_id].channels; - indio_dev->num_channels = chip_info_tbl[dev_id].num_channels; + indio_dev->info = isl29018_chip_info_tbl[dev_id].indio_info; + indio_dev->channels = isl29018_chip_info_tbl[dev_id].channels; + indio_dev->num_channels = isl29018_chip_info_tbl[dev_id].num_channels; indio_dev->name = name; indio_dev->dev.parent = &client->dev; indio_dev->modes = INDIO_DIRECT_MODE; - err = devm_iio_device_register(&client->dev, indio_dev); - if (err) { - dev_err(&client->dev, "iio registration fails\n"); - return err; - } - - return 0; + return devm_iio_device_register(&client->dev, indio_dev); } #ifdef CONFIG_PM_SLEEP @@ -840,7 +823,6 @@ static const struct of_device_id isl29018_of_match[] = { MODULE_DEVICE_TABLE(of, isl29018_of_match); static struct i2c_driver isl29018_driver = { - .class = I2C_CLASS_HWMON, .driver = { .name = "isl29018", .acpi_match_table = ACPI_PTR(isl29018_acpi_match), diff --git a/drivers/staging/iio/light/isl29028.c b/drivers/staging/iio/light/isl29028.c index 2e3b1d64e32a..aa413e5878b9 100644 --- a/drivers/staging/iio/light/isl29028.c +++ b/drivers/staging/iio/light/isl29028.c @@ -27,29 +27,27 @@ #include <linux/iio/iio.h> #include <linux/iio/sysfs.h> -#define CONVERSION_TIME_MS 100 +#define ISL29028_CONV_TIME_MS 100 #define ISL29028_REG_CONFIGURE 0x01 -#define CONFIGURE_ALS_IR_MODE_ALS 0 -#define CONFIGURE_ALS_IR_MODE_IR BIT(0) -#define CONFIGURE_ALS_IR_MODE_MASK BIT(0) +#define ISL29028_CONF_ALS_IR_MODE_ALS 0 +#define ISL29028_CONF_ALS_IR_MODE_IR BIT(0) +#define ISL29028_CONF_ALS_IR_MODE_MASK BIT(0) -#define CONFIGURE_ALS_RANGE_LOW_LUX 0 -#define CONFIGURE_ALS_RANGE_HIGH_LUX BIT(1) -#define CONFIGURE_ALS_RANGE_MASK BIT(1) +#define ISL29028_CONF_ALS_RANGE_LOW_LUX 0 +#define ISL29028_CONF_ALS_RANGE_HIGH_LUX BIT(1) +#define ISL29028_CONF_ALS_RANGE_MASK BIT(1) -#define CONFIGURE_ALS_DIS 0 -#define CONFIGURE_ALS_EN BIT(2) -#define CONFIGURE_ALS_EN_MASK BIT(2) +#define ISL29028_CONF_ALS_DIS 0 +#define ISL29028_CONF_ALS_EN BIT(2) +#define ISL29028_CONF_ALS_EN_MASK BIT(2) -#define CONFIGURE_PROX_DRIVE BIT(3) +#define ISL29028_CONF_PROX_SLP_SH 4 +#define ISL29028_CONF_PROX_SLP_MASK (7 << ISL29028_CONF_PROX_SLP_SH) -#define CONFIGURE_PROX_SLP_SH 4 -#define CONFIGURE_PROX_SLP_MASK (7 << CONFIGURE_PROX_SLP_SH) - -#define CONFIGURE_PROX_EN BIT(7) -#define CONFIGURE_PROX_EN_MASK BIT(7) +#define ISL29028_CONF_PROX_EN BIT(7) +#define ISL29028_CONF_PROX_EN_MASK BIT(7) #define ISL29028_REG_INTERRUPT 0x02 @@ -62,10 +60,10 @@ #define ISL29028_NUM_REGS (ISL29028_REG_TEST2_MODE + 1) -enum als_ir_mode { - MODE_NONE = 0, - MODE_ALS, - MODE_IR +enum isl29028_als_ir_mode { + ISL29028_MODE_NONE = 0, + ISL29028_MODE_ALS, + ISL29028_MODE_IR, }; struct isl29028_chip { @@ -76,7 +74,7 @@ struct isl29028_chip { bool enable_prox; int lux_scale; - int als_ir_mode; + enum isl29028_als_ir_mode als_ir_mode; }; static int isl29028_set_proxim_sampling(struct isl29028_chip *chip, @@ -91,7 +89,8 @@ static int isl29028_set_proxim_sampling(struct isl29028_chip *chip, break; } return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_PROX_SLP_MASK, sel << CONFIGURE_PROX_SLP_SH); + ISL29028_CONF_PROX_SLP_MASK, + sel << ISL29028_CONF_PROX_SLP_SH); } static int isl29028_enable_proximity(struct isl29028_chip *chip, bool enable) @@ -100,9 +99,9 @@ static int isl29028_enable_proximity(struct isl29028_chip *chip, bool enable) int val = 0; if (enable) - val = CONFIGURE_PROX_EN; + val = ISL29028_CONF_PROX_EN; ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_PROX_EN_MASK, val); + ISL29028_CONF_PROX_EN_MASK, val); if (ret < 0) return ret; @@ -113,40 +112,40 @@ static int isl29028_enable_proximity(struct isl29028_chip *chip, bool enable) static int isl29028_set_als_scale(struct isl29028_chip *chip, int lux_scale) { - int val = (lux_scale == 2000) ? CONFIGURE_ALS_RANGE_HIGH_LUX : - CONFIGURE_ALS_RANGE_LOW_LUX; + int val = (lux_scale == 2000) ? ISL29028_CONF_ALS_RANGE_HIGH_LUX : + ISL29028_CONF_ALS_RANGE_LOW_LUX; return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_RANGE_MASK, val); + ISL29028_CONF_ALS_RANGE_MASK, val); } static int isl29028_set_als_ir_mode(struct isl29028_chip *chip, - enum als_ir_mode mode) + enum isl29028_als_ir_mode mode) { int ret = 0; switch (mode) { - case MODE_ALS: + case ISL29028_MODE_ALS: ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_IR_MODE_MASK, - CONFIGURE_ALS_IR_MODE_ALS); + ISL29028_CONF_ALS_IR_MODE_MASK, + ISL29028_CONF_ALS_IR_MODE_ALS); if (ret < 0) return ret; ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_RANGE_MASK, - CONFIGURE_ALS_RANGE_HIGH_LUX); + ISL29028_CONF_ALS_RANGE_MASK, + ISL29028_CONF_ALS_RANGE_HIGH_LUX); break; - case MODE_IR: + case ISL29028_MODE_IR: ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_IR_MODE_MASK, - CONFIGURE_ALS_IR_MODE_IR); + ISL29028_CONF_ALS_IR_MODE_MASK, + ISL29028_CONF_ALS_IR_MODE_IR); break; - case MODE_NONE: + case ISL29028_MODE_NONE: return regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_EN_MASK, CONFIGURE_ALS_DIS); + ISL29028_CONF_ALS_EN_MASK, ISL29028_CONF_ALS_DIS); } if (ret < 0) @@ -154,12 +153,13 @@ static int isl29028_set_als_ir_mode(struct isl29028_chip *chip, /* Enable the ALS/IR */ ret = regmap_update_bits(chip->regmap, ISL29028_REG_CONFIGURE, - CONFIGURE_ALS_EN_MASK, CONFIGURE_ALS_EN); + ISL29028_CONF_ALS_EN_MASK, + ISL29028_CONF_ALS_EN); if (ret < 0) return ret; /* Need to wait for conversion time if ALS/IR mode enabled */ - mdelay(CONVERSION_TIME_MS); + mdelay(ISL29028_CONV_TIME_MS); return 0; } @@ -223,14 +223,14 @@ static int isl29028_als_get(struct isl29028_chip *chip, int *als_data) int ret; int als_ir_data; - if (chip->als_ir_mode != MODE_ALS) { - ret = isl29028_set_als_ir_mode(chip, MODE_ALS); + if (chip->als_ir_mode != ISL29028_MODE_ALS) { + ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_ALS); if (ret < 0) { dev_err(dev, "Error in enabling ALS mode err %d\n", ret); return ret; } - chip->als_ir_mode = MODE_ALS; + chip->als_ir_mode = ISL29028_MODE_ALS; } ret = isl29028_read_als_ir(chip, &als_ir_data); @@ -256,14 +256,14 @@ static int isl29028_ir_get(struct isl29028_chip *chip, int *ir_data) struct device *dev = regmap_get_device(chip->regmap); int ret; - if (chip->als_ir_mode != MODE_IR) { - ret = isl29028_set_als_ir_mode(chip, MODE_IR); + if (chip->als_ir_mode != ISL29028_MODE_IR) { + ret = isl29028_set_als_ir_mode(chip, ISL29028_MODE_IR); if (ret < 0) { dev_err(dev, "Error in enabling IR mode err %d\n", ret); return ret; } - chip->als_ir_mode = MODE_IR; + chip->als_ir_mode = ISL29028_MODE_IR; } return isl29028_read_als_ir(chip, ir_data); } @@ -383,8 +383,8 @@ static int isl29028_read_raw(struct iio_dev *indio_dev, } static IIO_CONST_ATTR(in_proximity_sampling_frequency_available, - "1, 3, 5, 10, 13, 20, 83, 100"); -static IIO_CONST_ATTR(in_illuminance_scale_available, "125, 2000"); + "1 3 5 10 13 20 83 100"); +static IIO_CONST_ATTR(in_illuminance_scale_available, "125 2000"); #define ISL29028_DEV_ATTR(name) (&iio_dev_attr_##name.dev_attr.attr) #define ISL29028_CONST_ATTR(name) (&iio_const_attr_##name.dev_attr.attr) @@ -428,7 +428,7 @@ static int isl29028_chip_init(struct isl29028_chip *chip) chip->enable_prox = false; chip->prox_sampling = 20; chip->lux_scale = 2000; - chip->als_ir_mode = MODE_NONE; + chip->als_ir_mode = ISL29028_MODE_NONE; ret = regmap_write(chip->regmap, ISL29028_REG_TEST1_MODE, 0x0); if (ret < 0) { @@ -462,7 +462,7 @@ static int isl29028_chip_init(struct isl29028_chip *chip) return ret; } -static bool is_volatile_reg(struct device *dev, unsigned int reg) +static bool isl29028_is_volatile_reg(struct device *dev, unsigned int reg) { switch (reg) { case ISL29028_REG_INTERRUPT: @@ -478,7 +478,7 @@ static bool is_volatile_reg(struct device *dev, unsigned int reg) static const struct regmap_config isl29028_regmap_config = { .reg_bits = 8, .val_bits = 8, - .volatile_reg = is_volatile_reg, + .volatile_reg = isl29028_is_volatile_reg, .max_register = ISL29028_NUM_REGS - 1, .num_reg_defaults_raw = ISL29028_NUM_REGS, .cache_type = REGCACHE_RBTREE, @@ -546,7 +546,6 @@ static const struct of_device_id isl29028_of_match[] = { MODULE_DEVICE_TABLE(of, isl29028_of_match); static struct i2c_driver isl29028_driver = { - .class = I2C_CLASS_HWMON, .driver = { .name = "isl29028", .of_match_table = isl29028_of_match, diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c index 75e8685e6df2..24edbc39ab4e 100644 --- a/drivers/staging/iio/meter/ade7854.c +++ b/drivers/staging/iio/meter/ade7854.c @@ -23,8 +23,8 @@ #include "ade7854.h" static ssize_t ade7854_read_8bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u8 val = 0; @@ -40,8 +40,8 @@ static ssize_t ade7854_read_8bit(struct device *dev, } static ssize_t ade7854_read_16bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u16 val = 0; @@ -57,8 +57,8 @@ static ssize_t ade7854_read_16bit(struct device *dev, } static ssize_t ade7854_read_24bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u32 val; @@ -74,8 +74,8 @@ static ssize_t ade7854_read_24bit(struct device *dev, } static ssize_t ade7854_read_32bit(struct device *dev, - struct device_attribute *attr, - char *buf) + struct device_attribute *attr, + char *buf) { int ret; u32 val = 0; @@ -91,9 +91,9 @@ static ssize_t ade7854_read_32bit(struct device *dev, } static ssize_t ade7854_write_8bit(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -112,9 +112,9 @@ error_ret: } static ssize_t ade7854_write_16bit(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -133,9 +133,9 @@ error_ret: } static ssize_t ade7854_write_24bit(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev *indio_dev = dev_to_iio_dev(dev); @@ -154,9 +154,9 @@ error_ret: } static ssize_t ade7854_write_32bit(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t len) + struct device_attribute *attr, + const char *buf, + size_t len) { struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); struct iio_dev *indio_dev = dev_to_iio_dev(dev); |