input: sensors: fix batching can't be disabled issue
Batching should be disabled after writing 0 to max_latency sysfs node. Fix it by correct the batching activation logic. Change-Id: Idbdc883fcbb9d4ad4042512068becf69725f4650 Signed-off-by: Oliver Wang <mengmeng@codeaurora.org>
This commit is contained in:
parent
4fe162d75e
commit
ec2e92b846
|
@ -1739,6 +1739,7 @@ static int lis3dh_latency_set(struct sensors_classdev *cdev,
|
|||
struct lis3dh_acc_data *acc = container_of(cdev,
|
||||
struct lis3dh_acc_data, cdev);
|
||||
struct i2c_client *client = acc->client;
|
||||
int ret;
|
||||
|
||||
/* Does not support batch in while interrupt is not enabled */
|
||||
if (!acc->pdata->enable_int) {
|
||||
|
@ -1746,8 +1747,16 @@ static int lis3dh_latency_set(struct sensors_classdev *cdev,
|
|||
"Cannot set batch mode, interrupt is not enabled!\n");
|
||||
return -EPERM;
|
||||
}
|
||||
acc->use_batch = max_latency ? true : false;
|
||||
|
||||
acc->fifo_timeout_ms = max_latency;
|
||||
acc->use_batch = max_latency ? true : false;
|
||||
|
||||
ret = lis3dh_acc_enable_batch(acc, max_latency);
|
||||
if (ret) {
|
||||
dev_err(&client->dev, "enable batch:%d failed\n", max_latency);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,7 +298,7 @@ static ssize_t sensors_max_latency_store(struct device *dev,
|
|||
}
|
||||
|
||||
/* Disable batching for this sensor */
|
||||
if (latency < sensors_cdev->delay_msec) {
|
||||
if ((latency < sensors_cdev->delay_msec) && (latency != 0)) {
|
||||
dev_err(dev, "max_latency is less than delay_msec\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue