History log of /drivers/iio/accel/kxcjk-1013.c
Revision Date Author Comments
e90dea6aafa14eb60ab0927f6fe54c620f61ef74 10-Nov-2014 Daniel Baluta <daniel.baluta@intel.com> iio: accel: kxcjk-1013: Fix kxcjk10013_set_range

Currently, we get the new GSEL bits by OR-ing the old values
with the new ones. This only works first time when the old
values are 0.

Startup:
* GSEL0 = 0, GSEL1 = 0

Set range to 4G: (GSEL0 = 1, GSEL1 = 0)
* GSEL0 = 0 | 1 = 1
* GSEL1 = 0 | 0 = 0
* correct

Change range to 2G: (GSEL0 = 0, GSEL1 = 0)
* GSEL0 = 1 | 0 = 1
* GSEL1 = 0 | 0 = 0
* wrong, GSEL0 should be 0

This has the nice effect that we can use the full scale range,
exported in in_accel_scale_available.

Fixes: a735e3d7f03 (iio: accel: kxcjk-1013: Set adjustable range)
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
25afffe16d07909197f99163ca7cd1f80fb5cbdd 10-Oct-2014 Daniel Baluta <daniel.baluta@intel.com> io: accel: kxcjk-1013: Fix iio_event_spec direction

Because IIO_EV_DIR_* are not bitmasks but enums,
IIO_EV_DIR_RISING | IIO_EV_DIR_FALLING is not equal
with IIO_EV_DIR_EITHER.

This could lead to potential misformatted sysfs attributes
like:
* in_accel_x_thresh_(null)_en
* in_accel_x_thresh_(null)_period
* in_accel_x_thresh_(null)_value

or even memory corruption.

Fixes: b4b491c083 (iio: accel: kxcjk-1013: Support threshold)
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
c9bf2373da2144dec511503cebf5f8a63b0dcff3 09-Mar-2014 Daniel Baluta <daniel.baluta@intel.com> iio: accel: kxcjk-1013: Fix defined but unused warning

Noticed when compiling with CONFIG_PM_RUNTIME not set:
kxcjk-1013.c: warning: ‘kxcjk1013_get_startup_times’ defined but not used [-Wunused-function]

Introduced by commit 124e1b1d (iio: accel: kxcjk-1013: support runtime pm).

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
c68613777517e538ace751e4e738e238eb216f86 09-Mar-2014 Daniel Baluta <daniel.baluta@intel.com> iio: accel: kxcjk-1013: add support for kxtj2-1009

This patch adds support for KXTJ2-1009 3-axis acceleromenter sensor.
KXTJ2-1009 uses the same register definitions as KXCJK-1013.

The specification for KXTJ2-1009 can be downloaded from:
http://www.kionix.com/sites/default/files/KXTJ2-1009%20Specifications%20Rev%204.pdf

Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
ca801795b17b13a105b5209cf451abac3a6529ff 19-Aug-2014 Daniel Baluta <daniel.baluta@intel.com> iio: accel: kxcjk-1013: add support for kxcj9-1008

This patch adds support for KXCJ9-1008 3-axis acceleromenter sensor.
KXCJ9-1008 uses the same register definitions as KXCJK-1013.

The specification for KXCJ9-1008 can be downloaded from:
http://www.kionix.com/sites/default/files/KXCJ9-1008%20Specifications%20Rev%205.pdf

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
b4b491c0832ef90a7a5070e5975bc8427f2049ca 22-Aug-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk-1013: Support thresholds

This chip has a motion detect capability. Using IIO events to
specify thresholds and pushing events.
In addition a new trigger of type any-motion is added, which
pushes data to buffer only when there is any movement.

Change list:
Comments addressed for
Re: [PATCH 5/6] iio: accel: kxcjk-1013: Support thresholds
Date: 07/20/2014

- Both motion detect and data ready can be enabled together
- Sending RISING/FALLING events based on int status
- Separate interrupt configuration for data ready and motion detect

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
b5faca4b59ab604cd3ff367683a96c330b78d25f 22-Aug-2014 Daniel Baluta <daniel.baluta@intel.com> io: accel: kxcjk1013: Remove redundant assignment

data->range is already set by kxcjk1013_set_range.

Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
a735e3d7f03ab40d746290954baaf535719d9025 08-May-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk-1013: Set adjustable range

This chip can support 3 different ranges. Allowing range specification.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
124e1b1d0924ca51ded8bb6f52844b2bc9e485f7 08-May-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk-1013: support runtime pm

In an effort to improve raw read performance and at the same time enter
low power state at every possible chance.
For raw reads, it will keep the system powered on for a default or user
specified time, via autosuspend_delay attribute of device power.
This will help read multiple samples without power on/off sequence.
For triggers it will keep the system on till, requested to be turned
off by trigger state by utilizing run time PM usage counters.

When runtime pm is not enabled, then it keeps the chip in operation
mode always.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
f4e2f94d8c1057154728eff974c8ce8688e1ea2d 14-Jul-2014 Peter Meerwald <pmeerw@pmeerw.net> iio:kxcjk-1013: Fix endianness in scan_type

driver uses i2c_smbus_read_word_data() to the data in the trigger handler and hence
already does endianness conversion; the I2C chip has data in little endian, but the
value is provides in CPU endianness

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
c1288b8338815d6d17577b6b6a1267e7be8bc409 17-Jul-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk-1013: Increment ref counter for indio_dev->trig

Assigning indio_dev->trig is not a good idea, as this can result in
wrong reference count for trigger device. If assigned, it is better to
increment reference counter by calling iio_trigger_get.
Refer to http://www.spinics.net/lists/linux-iio/msg13669.html for discussion
with Jonathan.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
59bfeaba3b62089f98952fe689d44a093275b1a0 17-Jul-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk-1013: Use try_reenable to ack intr

This chip needs explicit interrupt ack, introducing try_reenable
callback. Also removed separate function to ack interrupt as this
doesn't add any value.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
f0ca974920686d53cf2330ef8abcc6e4489201d6 17-Jul-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk-1013: Fix setting frequency

Fix issue with setting of 12.5 and 6.25 HZ. The match of val2 fails.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
88f6da779a37a3579e580296776ba86d6c6bd980 16-Jun-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk1013 Fix missing unlock errors

Fix unlock at two places. One when i2c error occurs and other
when trigger set state when raw read is in progress.

kbuild test robot errors:
>> >> drivers/iio/accel/kxcjk-1013.c:531:3-9: preceding lock on line 524
>> >> drivers/iio/accel/kxcjk-1013.c:376:4-10: preceding lock on line 368

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1a4fbf6a9286a6e3db497bc7bbae2024f0f1ad90 07-Nov-2014 Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> iio: accel: kxcjk1013 3-axis accelerometer driver

This patch adds IIO driver for KXCJK 1013 triaxis accelerometer sensor.
The specifications for this driver is downloaded from:
http://www.kionix.com/sites/default/files/KXCJK-1013%20Specifications%20Rev%202.pdf

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>