Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 885170fb authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: sensors: fix batching can't be disabled issue"

parents 2632fea9 12ef9356
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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;
}

+1 −1
Original line number Diff line number Diff line
@@ -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;
	}