Commit 59bfeaba authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Jonathan Cameron

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: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent f0ca9749
...@@ -138,19 +138,6 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *data, ...@@ -138,19 +138,6 @@ static int kxcjk1013_set_mode(struct kxcjk1013_data *data,
return 0; return 0;
} }
static int kxcjk1013_chip_ack_intr(struct kxcjk1013_data *data)
{
int ret;
ret = i2c_smbus_read_byte_data(data->client, KXCJK1013_REG_INT_REL);
if (ret < 0) {
dev_err(&data->client->dev, "Error writing reg_int_rel\n");
return ret;
}
return ret;
}
static int kxcjk1013_chip_init(struct kxcjk1013_data *data) static int kxcjk1013_chip_init(struct kxcjk1013_data *data)
{ {
int ret; int ret;
...@@ -498,15 +485,11 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ...@@ -498,15 +485,11 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
indio_dev->masklength) { indio_dev->masklength) {
ret = kxcjk1013_get_acc_reg(data, bit); ret = kxcjk1013_get_acc_reg(data, bit);
if (ret < 0) { if (ret < 0) {
kxcjk1013_chip_ack_intr(data);
mutex_unlock(&data->mutex); mutex_unlock(&data->mutex);
goto err; goto err;
} }
data->buffer[i++] = ret; data->buffer[i++] = ret;
} }
kxcjk1013_chip_ack_intr(data);
mutex_unlock(&data->mutex); mutex_unlock(&data->mutex);
iio_push_to_buffers_with_timestamp(indio_dev, data->buffer, iio_push_to_buffers_with_timestamp(indio_dev, data->buffer,
...@@ -517,6 +500,21 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p) ...@@ -517,6 +500,21 @@ static irqreturn_t kxcjk1013_trigger_handler(int irq, void *p)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int kxcjk1013_trig_try_reen(struct iio_trigger *trig)
{
struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
struct kxcjk1013_data *data = iio_priv(indio_dev);
int ret;
ret = i2c_smbus_read_byte_data(data->client, KXCJK1013_REG_INT_REL);
if (ret < 0) {
dev_err(&data->client->dev, "Error reading reg_int_rel\n");
return ret;
}
return 0;
}
static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig, static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig,
bool state) bool state)
{ {
...@@ -543,6 +541,7 @@ static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig, ...@@ -543,6 +541,7 @@ static int kxcjk1013_data_rdy_trigger_set_state(struct iio_trigger *trig,
static const struct iio_trigger_ops kxcjk1013_trigger_ops = { static const struct iio_trigger_ops kxcjk1013_trigger_ops = {
.set_trigger_state = kxcjk1013_data_rdy_trigger_set_state, .set_trigger_state = kxcjk1013_data_rdy_trigger_set_state,
.try_reenable = kxcjk1013_trig_try_reen,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
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