Skip to content

Commit

Permalink
Merge tag 'iio-for-v4.2a' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/jic23/iio into staging-next

Jonathan writes:

First round of new drivers, functionality and cleanups for the 4.2 cycle

New drivers / device support
* st sensors driver, lsm303dlh magnetometer support.
* ltr501 - support ltr301 and ltr559 chips.

New functionality
* IIO_CHAN_INFO_CALIBEMISSIVITY for thermopile sensors.
* kxcjk1013 - make driver operational with external trigger.
* Add iio targets to the tools Makefile.

Cleanups
* st sensors - more helpful error message if device id wrong or irq request
  fails, explicitly make the Block Data Update optional rather
  than relying on writes to address 0 not doing anything, make interrupt
  support optional (Not always wired, and not all devices actually have
  an interrupt line.)
* kxcjk-1013 white space additions for readability, add the KXCJ9000 ACPI
  id as seen in the wild.
* sx9500 - GPIO reset support, refactor the GPIO interrupt code, add power
  management, optimize power usage by powering down when possible, rename
  the gpio interrupt pin to be more useful, trivial return path simplification,
  trivial formatting fixes.
* isl29018 -  move towards ABI compliance with a view to moving this driver
  out of staging, add some brackets to ensure code works as expected.  Note
  there is no actual bug as the condition being tested is always true
  (with current devices).
* ltr501 - add regmap support to get caching etc for later patches,
  fix a parameter sanity check that always fails (bug introduced
  earlier in this series), ACPI enumeration support,
  interrupt rate control support, interrupt support in general and
  integration time control support, code alignment cleanups.
* mma9553 - a number of little cleanups following a review from Hartmut
  after I'd already applied the original driver patch.
* tmp006 - prefix some defines with TMP006 for consistency.
* tsl4531 - cleanup some wrong prefixes, presumably from copy and paste.
* mlx90614 - check for errors in read values, add power management,
  add emissivity setting, add device tree binding documentation,
  fix a duplicate const warning.
* ti_am335x_adc - refactor the DT parsing into a separate function.
  • Loading branch information
Greg Kroah-Hartman committed May 9, 2015
2 parents 7192a5d + 1038a68 commit 5ccca15
Show file tree
Hide file tree
Showing 25 changed files with 2,373 additions and 448 deletions.
11 changes: 11 additions & 0 deletions Documentation/ABI/testing/sysfs-bus-iio
Original file line number Diff line number Diff line change
Expand Up @@ -1364,3 +1364,14 @@ Description:
hwfifo_watermak_min but not equal to any of the values in this
list, the driver will chose an appropriate value for the
hardware fifo watermark level.

What: /sys/bus/iio/devices/iio:deviceX/in_temp_calibemissivity
What: /sys/bus/iio/devices/iio:deviceX/in_tempX_calibemissivity
What: /sys/bus/iio/devices/iio:deviceX/in_temp_object_calibemissivity
What: /sys/bus/iio/devices/iio:deviceX/in_tempX_object_calibemissivity
KernelVersion: 4.1
Contact: linux-iio@vger.kernel.org
Description:
The emissivity ratio of the surface in the field of view of the
contactless temperature sensor. Emissivity varies from 0 to 1,
with 1 being the emissivity of a black body.
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/iio/st-sensors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Gyroscopes:
- st,lsm330-gyro

Magnetometers:
- st,lsm303dlh-magn
- st,lsm303dlhc-magn
- st,lsm303dlm-magn
- st,lis3mdl-magn
Expand Down
24 changes: 24 additions & 0 deletions Documentation/devicetree/bindings/iio/temperature/mlx90614.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
* Melexis MLX90614 contactless IR temperature sensor

http://melexis.com/Infrared-Thermometer-Sensors/Infrared-Thermometer-Sensors/MLX90614-615.aspx

Required properties:

- compatible: should be "melexis,mlx90614"
- reg: the I2C address of the sensor

Optional properties:

- wakeup-gpios: device tree identifier of the GPIO connected to the SDA line
to hold low in order to wake up the device. In normal operation, the
GPIO is set as input and will not interfere in I2C communication. There
is no need for a GPIO driving the SCL line. If no GPIO is given, power
management is disabled.

Example:

mlx90614@5a {
compatible = "melexis,mlx90614";
reg = <0x5a>;
wakeup-gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
};
1 change: 1 addition & 0 deletions Documentation/devicetree/bindings/vendor-prefixes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ lltc Linear Technology Corporation
marvell Marvell Technology Group Ltd.
maxim Maxim Integrated Products
mediatek MediaTek Inc.
melexis Melexis N.V.
merrii Merrii Technology Co., Ltd.
micrel Micrel Inc.
microchip Microchip Technology Inc.
Expand Down
42 changes: 27 additions & 15 deletions drivers/iio/accel/kxcjk-1013.c
Original file line number Diff line number Diff line change
Expand Up @@ -875,15 +875,18 @@ static int kxcjk1013_write_event_config(struct iio_dev *indio_dev,
return 0;
}

static int kxcjk1013_validate_trigger(struct iio_dev *indio_dev,
struct iio_trigger *trig)
static int kxcjk1013_buffer_preenable(struct iio_dev *indio_dev)
{
struct kxcjk1013_data *data = iio_priv(indio_dev);

if (data->dready_trig != trig && data->motion_trig != trig)
return -EINVAL;
return kxcjk1013_set_power_state(data, true);
}

return 0;
static int kxcjk1013_buffer_postdisable(struct iio_dev *indio_dev)
{
struct kxcjk1013_data *data = iio_priv(indio_dev);

return kxcjk1013_set_power_state(data, false);
}

static IIO_CONST_ATTR_SAMP_FREQ_AVAIL(
Expand Down Expand Up @@ -935,6 +938,13 @@ static const struct iio_chan_spec kxcjk1013_channels[] = {
IIO_CHAN_SOFT_TIMESTAMP(3),
};

static const struct iio_buffer_setup_ops kxcjk1013_buffer_setup_ops = {
.preenable = kxcjk1013_buffer_preenable,
.postenable = iio_triggered_buffer_postenable,
.postdisable = kxcjk1013_buffer_postdisable,
.predisable = iio_triggered_buffer_predisable,
};

static const struct iio_info kxcjk1013_info = {
.attrs = &kxcjk1013_attrs_group,
.read_raw = kxcjk1013_read_raw,
Expand All @@ -943,7 +953,6 @@ static const struct iio_info kxcjk1013_info = {
.write_event_value = kxcjk1013_write_event,
.write_event_config = kxcjk1013_write_event_config,
.read_event_config = kxcjk1013_read_event_config,
.validate_trigger = kxcjk1013_validate_trigger,
.driver_module = THIS_MODULE,
};

Expand Down Expand Up @@ -1147,8 +1156,10 @@ static const char *kxcjk1013_match_acpi_device(struct device *dev,
id = acpi_match_device(dev->driver->acpi_match_table, dev);
if (!id)
return NULL;

if (strcmp(id->id, "SMO8500") == 0)
*is_smo8500_device = true;

*chipset = (enum kx_chipset)id->driver_data;

return dev_name(dev);
Expand All @@ -1163,6 +1174,7 @@ static int kxcjk1013_gpio_probe(struct i2c_client *client,

if (!client)
return -EINVAL;

if (data->is_smo8500_device)
return -ENOTSUPP;

Expand Down Expand Up @@ -1276,16 +1288,15 @@ static int kxcjk1013_probe(struct i2c_client *client,
data->motion_trig = NULL;
goto err_trigger_unregister;
}
}

ret = iio_triggered_buffer_setup(indio_dev,
&iio_pollfunc_store_time,
kxcjk1013_trigger_handler,
NULL);
if (ret < 0) {
dev_err(&client->dev,
"iio triggered buffer setup failed\n");
goto err_trigger_unregister;
}
ret = iio_triggered_buffer_setup(indio_dev,
&iio_pollfunc_store_time,
kxcjk1013_trigger_handler,
&kxcjk1013_buffer_setup_ops);
if (ret < 0) {
dev_err(&client->dev, "iio triggered buffer setup failed\n");
goto err_trigger_unregister;
}

ret = iio_device_register(indio_dev);
Expand Down Expand Up @@ -1418,6 +1429,7 @@ static const struct dev_pm_ops kxcjk1013_pm_ops = {
static const struct acpi_device_id kx_acpi_match[] = {
{"KXCJ1013", KXCJK1013},
{"KXCJ1008", KXCJ91008},
{"KXCJ9000", KXCJ91008},
{"KXTJ1009", KXTJ21009},
{"SMO8500", KXCJ91008},
{ },
Expand Down
8 changes: 4 additions & 4 deletions drivers/iio/accel/mma9551_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ EXPORT_SYMBOL(mma9551_read_status_word);
* @app_id: Application ID
* @reg: Application register
* @len: Length of array to read in bytes
* @val: Array of words to read
* @buf: Array of words to read
*
* Read multiple configuration registers (word-sized registers).
*
Expand Down Expand Up @@ -409,7 +409,7 @@ EXPORT_SYMBOL(mma9551_read_config_words);
* @app_id: Application ID
* @reg: Application register
* @len: Length of array to read in bytes
* @val: Array of words to read
* @buf: Array of words to read
*
* Read multiple status registers (word-sized registers).
*
Expand Down Expand Up @@ -444,7 +444,7 @@ EXPORT_SYMBOL(mma9551_read_status_words);
* @app_id: Application ID
* @reg: Application register
* @len: Length of array to write in bytes
* @val: Array of words to write
* @buf: Array of words to write
*
* Write multiple configuration registers (word-sized registers).
*
Expand Down Expand Up @@ -785,7 +785,7 @@ EXPORT_SYMBOL(mma9551_read_accel_scale);
*/
int mma9551_app_reset(struct i2c_client *client, u32 app_mask)
{
return mma9551_write_config_byte(client, MMA9551_APPID_RCS,
return mma9551_write_config_byte(client, MMA9551_APPID_RSC,
MMA9551_RSC_RESET +
MMA9551_RSC_OFFSET(app_mask),
MMA9551_RSC_VAL(app_mask));
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/accel/mma9551_core.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#define MMA9551_APPID_TILT 0x0B
#define MMA9551_APPID_SLEEP_WAKE 0x12
#define MMA9551_APPID_PEDOMETER 0x15
#define MMA9551_APPID_RCS 0x17
#define MMA9551_APPID_RSC 0x17
#define MMA9551_APPID_NONE 0xff

/* Reset/Suspend/Clear application app masks */
Expand Down
Loading

0 comments on commit 5ccca15

Please sign in to comment.