drivers: input: sensors: reset sensor rate if rate is out of range

Change-Id: I7d78b0bf3bab24c18a13ba72b0868fb609a6ceb3
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
This commit is contained in:
Zorro Liu
2018-01-03 20:58:14 +08:00
committed by Tao Huang
parent 26c69f0334
commit 48ce086873

View File

@@ -483,10 +483,11 @@ static int sensor_reset_rate(struct i2c_client *client, int rate)
struct sensor_private_data *sensor = (struct sensor_private_data *) i2c_get_clientdata(client);
int result = 0;
if ((rate < 5) || (rate > 250)) {
dev_err(&client->dev, "sensor rate %d out of rang\n", rate);
return -1;
}
if (rate < 5)
rate = 5;
else if (rate > 200)
rate = 200;
dev_info(&client->dev, "set sensor poll time to %dms\n", rate);
/* work queue is always slow, we need more quickly to match hal rate */