drivers: input: sensor: update for akmxxxx compass chips

Change-Id: Iba164016e01c7741d5cf99f207829e6654ab43ff
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
This commit is contained in:
Zorro Liu
2018-06-05 20:37:45 +08:00
committed by Tao Huang
parent d362c39d5d
commit be49c6964e
4 changed files with 19 additions and 4 deletions

View File

@@ -367,6 +367,9 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
case AK09911_MODE_FUSE_ACCESS:
if(sensor->status_cur == SENSOR_OFF)
{
sensor->stop_work = 0;
sensor->status_cur = SENSOR_ON;
if(sensor->pdata->irq_enable)
{
//DBG("%s:enable irq=%d\n",__func__,client->irq);
@@ -377,7 +380,6 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
schedule_delayed_work(&sensor->delaywork, msecs_to_jiffies(sensor->pdata->poll_delay_ms));
}
sensor->status_cur = SENSOR_ON;
}
break;
@@ -385,6 +387,7 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
case AK09911_MODE_POWERDOWN:
if(sensor->status_cur == SENSOR_ON)
{
sensor->stop_work = 1;
if(sensor->pdata->irq_enable)
{
//DBG("%s:disable irq=%d\n",__func__,client->irq);

View File

@@ -367,6 +367,9 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
case AK8963_MODE_FUSE_ACCESS:
if(sensor->status_cur == SENSOR_OFF)
{
sensor->stop_work = 0;
sensor->status_cur = SENSOR_ON;
if(sensor->pdata->irq_enable)
{
//DBG("%s:enable irq=%d\n",__func__,client->irq);
@@ -377,7 +380,6 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
schedule_delayed_work(&sensor->delaywork, msecs_to_jiffies(sensor->pdata->poll_delay_ms));
}
sensor->status_cur = SENSOR_ON;
}
break;
@@ -385,6 +387,7 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
case AK8963_MODE_POWERDOWN:
if(sensor->status_cur == SENSOR_ON)
{
sensor->stop_work = 1;
if(sensor->pdata->irq_enable)
{
//DBG("%s:disable irq=%d\n",__func__,client->irq);

5
drivers/input/sensors/compass/ak8975.c Executable file → Normal file
View File

@@ -339,6 +339,8 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
case AK8975_MODE_FUSE_ACCESS:
if(sensor->status_cur == SENSOR_OFF)
{
sensor->stop_work = 0;
sensor->status_cur = SENSOR_ON;
if(sensor->pdata->irq_enable)
{
//DBG("%s:enable irq=%d\n",__func__,client->irq);
@@ -348,8 +350,6 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
{
schedule_delayed_work(&sensor->delaywork, msecs_to_jiffies(sensor->pdata->poll_delay_ms));
}
sensor->status_cur = SENSOR_ON;
}
break;
@@ -357,6 +357,7 @@ static int compass_akm_set_mode(struct i2c_client *client, char mode)
case AK8975_MODE_POWERDOWN:
if(sensor->status_cur == SENSOR_ON)
{
sensor->stop_work = 1;
if(sensor->pdata->irq_enable)
{
//DBG("%s:disable irq=%d\n",__func__,client->irq);

View File

@@ -966,6 +966,7 @@ static long compass_dev_ioctl(struct file *file,
unsigned int cmd, unsigned long arg)
{
struct sensor_private_data *sensor = g_sensor[SENSOR_TYPE_COMPASS];
struct i2c_client *client = sensor->client;
void __user *argp = (void __user *)arg;
int result = 0;
short flag;
@@ -1008,6 +1009,13 @@ static long compass_dev_ioctl(struct file *file,
break;
case ECS_IOCTL_APP_SET_DELAY:
sensor->flags.delay = flag;
mutex_lock(&sensor->operation_mutex);
result = sensor_reset_rate(client, flag);
if (result < 0) {
mutex_unlock(&sensor->operation_mutex);
return result;
}
mutex_unlock(&sensor->operation_mutex);
break;
case ECS_IOCTL_APP_GET_DELAY:
flag = sensor->flags.delay;