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

Commit c037d562 authored by Daqing Chen's avatar Daqing Chen Committed by Gerrit - the friendly Code Review server
Browse files

input: sensors: add sensors max delay time



Max delay is the delay between two sensor events
corresponding to the lowest frequency that this
sensor supports. When lower frequencies are requested
through batch()/setDelay() the events will be generated
at this frequency instead. It can be used by the
framework or applications to estimate when the batch
FIFO may be full.

Change-Id: Ic8b4bd78061801a48b2774c648758c87b2e20bfc
Signed-off-by: default avatarDaqing Chen <chendaqing@codeaurora.org>
parent 6d7d069f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ static struct sensors_classdev sensors_cdev = {
	.resolution = "0.6",
	.sensor_power = "0.35",
	.min_delay = 10000,
	.max_delay = 10000,
	.fifo_reserved_event_count = 0,
	.fifo_max_event_count = 0,
	.enabled = 0,
+1 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ static struct sensors_classdev sensors_cdev = {
	.resolution = "0.15",
	.sensor_power = "0.35",
	.min_delay = 10000,
	.max_delay = 10000,
	.fifo_reserved_event_count = 0,
	.fifo_max_event_count = 0,
	.enabled = 0,
+2 −0
Original line number Diff line number Diff line
@@ -194,6 +194,7 @@ static struct sensors_classdev als_cdev = {
	.resolution = "1.0",
	.sensor_power = "0.35",
	.min_delay = 100000,
	.max_delay = 1375,
	.fifo_reserved_event_count = 0,
	.fifo_max_event_count = 0,
	.flags = 2,
@@ -216,6 +217,7 @@ static struct sensors_classdev ps_cdev = {
	.resolution = "1.0",
	.sensor_power = "0.35",
	.min_delay = 5000,
	.max_delay = 1280,
	.fifo_reserved_event_count = 0,
	.fifo_max_event_count = 0,
	.flags = 3,
+6 −0
Original line number Diff line number Diff line
@@ -1375,6 +1375,9 @@ static const struct interrupt_map_t int_map[] = {
#define POLL_INTERVAL_MAX_MS	4000
#define POLL_DEFAULT_INTERVAL_MS 200

/* Interrupt delay in msecs */
#define BMA_INT_MAX_DELAY	64

#define MAX_RANGE_MAP	4

struct bma2x2_type_map_t {
@@ -1539,6 +1542,7 @@ static struct sensors_classdev sensors_cdev = {
		.resolution = "0.153125",	/* 15.6mg */
		.sensor_power = "0.13",	/* typical value */
		.min_delay = POLL_INTERVAL_MIN_MS * 1000, /* in microseconds */
		.max_delay = POLL_INTERVAL_MAX_MS,
		.max_latency = POLL_INTERVAL_MAX_MS,
		.fifo_reserved_event_count = 0,
		.fifo_max_event_count = 0,
@@ -7450,6 +7454,8 @@ static int bma2x2_probe(struct i2c_client *client,
	data->cdev.sensors_poll_delay = bma2x2_cdev_poll_delay;
	data->cdev.sensors_self_test = bma2x2_self_calibration_xyz;
	data->cdev.resolution = sensor_type_map[data->chip_type].resolution;
	if (pdata->use_int)
		data->cdev.max_delay = BMA_INT_MAX_DELAY;
	err = sensors_classdev_register(&client->dev, &data->cdev);
	if (err) {
		dev_err(&client->dev, "create class device file failed!\n");
+4 −0
Original line number Diff line number Diff line
@@ -230,6 +230,9 @@
#define BATCH_MODE_NORMAL		0
#define BATCH_MODE_WAKE_UPON_FIFO_FULL	2

/* interrput mode for sensor max delay ms */
#define LIS_INT_MAX_DELAY	1000

enum {
	LIS3DH_BYPASS_MODE = 0,
	LIS3DH_FIFO_MODE,
@@ -2185,6 +2188,7 @@ static int lis3dh_acc_probe(struct i2c_client *client,
		acc->cdev.sensors_flush = lis3dh_acc_flush;
		acc->cdev.fifo_reserved_event_count = LIS3DH_FIFO_SIZE;
		acc->cdev.fifo_max_event_count = LIS3DH_FIFO_SIZE;
		acc->cdev.max_delay = LIS_INT_MAX_DELAY;
	}
	err = sensors_classdev_register(&client->dev, &acc->cdev);
	if (err) {
Loading