Commit 09cf1b32 authored by Adriana Reus's avatar Adriana Reus Committed by Jonathan Cameron

iio: accel: kxcjk-1013: use available_scan_masks

Use available_scan_masks to allow the iio core to select
the data to send to userspace depending on which axes are
enabled, instead of doing this in the driver's interrupt
handler.
Signed-off-by: default avatarAdriana Reus <adriana.reus@intel.com>
Signed-off-by: default avatarIrina Tirdea <irina.tirdea@intel.com>
Acked-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 7e3d1eb1
...@@ -115,6 +115,7 @@ enum kxcjk1013_axis { ...@@ -115,6 +115,7 @@ enum kxcjk1013_axis {
AXIS_X, AXIS_X,
AXIS_Y, AXIS_Y,
AXIS_Z, AXIS_Z,
AXIS_MAX,
}; };
enum kxcjk1013_mode { enum kxcjk1013_mode {
...@@ -953,6 +954,8 @@ static const struct iio_info kxcjk1013_info = { ...@@ -953,6 +954,8 @@ static const struct iio_info kxcjk1013_info = {
.driver_module = THIS_MODULE, .driver_module = THIS_MODULE,
}; };
static const unsigned long kxcjk1013_scan_masks[] = {0x7, 0};
static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
{ {
struct iio_poll_func *pf = p; struct iio_poll_func *pf = p;
...@@ -962,8 +965,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ...@@ -962,8 +965,7 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
mutex_lock(&data->mutex); mutex_lock(&data->mutex);
for_each_set_bit(bit, indio_dev->active_scan_mask, for (bit = 0; bit < AXIS_MAX; bit++) {
indio_dev->masklength) {
ret = kxcjk1013_get_acc_reg(data, bit); ret = kxcjk1013_get_acc_reg(data, bit);
if (ret < 0) { if (ret < 0) {
mutex_unlock(&data->mutex); mutex_unlock(&data->mutex);
...@@ -1204,6 +1206,7 @@ static int kxcjk1013_probe(struct i2c_client *client, ...@@ -1204,6 +1206,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
indio_dev->dev.parent = &client->dev; indio_dev->dev.parent = &client->dev;
indio_dev->channels = kxcjk1013_channels; indio_dev->channels = kxcjk1013_channels;
indio_dev->num_channels = ARRAY_SIZE(kxcjk1013_channels); indio_dev->num_channels = ARRAY_SIZE(kxcjk1013_channels);
indio_dev->available_scan_masks = kxcjk1013_scan_masks;
indio_dev->name = name; indio_dev->name = name;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &kxcjk1013_info; indio_dev->info = &kxcjk1013_info;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment