Skip to content

Commit

Permalink
Revert "input: ewtzmu2: Fix gyro off status checks"
Browse files Browse the repository at this point in the history
This reverts commit e75b9c0.

Change-Id: I656e83f047cbd1df6458c465a788ce47d5cd1aa0
  • Loading branch information
intervigilium committed Aug 25, 2015
1 parent bdd6845 commit 0783b1d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 25 deletions.
30 changes: 6 additions & 24 deletions drivers/input/misc/ewtzmu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include <linux/gpio.h>
#include <linux/akm8975.h>
#include <linux/module.h>
#include <linux/mutex.h>

#ifndef HTC_VERSION
#include <linux/i2c/ak8973.h>
Expand All @@ -56,7 +55,6 @@ int Gyro_samplerate_status = 1;
static DECLARE_WAIT_QUEUE_HEAD(open_wq);
static atomic_t open_flag;
static bool Gyro_init_fail = 0;
static DEFINE_MUTEX(ewtzmu2_power_lock);

struct _ewtzmu_data {
rwlock_t lock;
Expand Down Expand Up @@ -352,12 +350,6 @@ static int EWTZMU2_ReadSensorData(char *buf, int bufsize)
return EW_CLIENT_ERROR;
}

if (atomic_read(&off_status_hal)) {
E("Fail to read sensor data. Device is powered off.\n");
*buf = 0;
return EW_DEVICE_POWERED_OFF;
}

read_lock(&ewtzmu_data.lock);
mode = ewtzmu_data.mode;
read_unlock(&ewtzmu_data.lock);
Expand Down Expand Up @@ -410,12 +402,6 @@ static int EWTZMU2_ReadSensorDataFIFO(unsigned char *buf, int bufsize)
return EW_CLIENT_ERROR;
}

if (atomic_read(&off_status_hal)) {
E("Failed to read sensor data. Device is powered off.\n");
*buf = 0;
return EW_DEVICE_POWERED_OFF;
}

read_lock(&ewtzmu_data.lock);
mode = ewtzmu_data.mode;
read_unlock(&ewtzmu_data.lock);
Expand Down Expand Up @@ -783,12 +769,9 @@ static int EWTZMU2_Power_Off(void)
{
u8 databuf[10];
int res = 0;

mutex_lock(&ewtzmu2_power_lock);
ewtzmumid_data.config_gyro_diag_gpios(1);
if (!ewtzmu_i2c_client) {
E("%s, ewtzmu_i2c_client < 0 \n", __func__);
mutex_unlock(&ewtzmu2_power_lock);
return -2;
}

Expand All @@ -801,8 +784,6 @@ static int EWTZMU2_Power_Off(void)
hr_msleep(10);
}
gpio_set_value(ewtzmumid_data.sleep_pin, 1);
atomic_set(&off_status_hal, 1);
mutex_unlock(&ewtzmu2_power_lock);
I("%s\n", __func__);
return 0;
}
Expand All @@ -813,12 +794,10 @@ static int EWTZMU2_Power_On(void)
int res = 0;
int i = 0;

mutex_lock(&ewtzmu2_power_lock);
ewtzmumid_data.config_gyro_diag_gpios(0);
if (!ewtzmu_i2c_client) {
E("%s, ewtzmu_i2c_client < 0 \n", __func__);
mutex_unlock(&ewtzmu2_power_lock);
return -2;
return -2;
}
gpio_set_value(ewtzmumid_data.sleep_pin, 0);
while (1) {
Expand All @@ -844,8 +823,6 @@ static int EWTZMU2_Power_On(void)
}
i = 0;
EWTZMU2_Chip_Set_SampleRate(Gyro_samplerate_status);
atomic_set(&off_status_hal, 0);
mutex_unlock(&ewtzmu2_power_lock);
I("%s end\n", __func__);
return 0;
}
Expand Down Expand Up @@ -1235,6 +1212,7 @@ static long ewtzmu2_ioctl(struct file *file, unsigned int cmd, unsigned long arg
!atomic_read(&la_status) && !atomic_read(&gv_status) &&
!atomic_read(&o_status) && !atomic_read(&off_status_hal)) {

atomic_set(&off_status_hal, 1);
I("cal_Gyro power off:g_status=%d"
"off_status_hal=%d\n",
atomic_read(&g_status),
Expand All @@ -1244,6 +1222,7 @@ static long ewtzmu2_ioctl(struct file *file, unsigned int cmd, unsigned long arg
atomic_read(&la_status) || atomic_read(&gv_status) ||
atomic_read(&o_status)) && atomic_read(&off_status_hal)) {

atomic_set(&off_status_hal, 0);
I("Cal_Gyro power on:g_status=%d"
"off_status_hal=%d\n",
atomic_read(&g_status),
Expand Down Expand Up @@ -2088,6 +2067,7 @@ static long ewtzmu2hal_ioctl(struct file *file, unsigned int cmd, unsigned long
atomic_read(&g_status),
atomic_read(&off_status_hal));
if (!atomic_read(&off_status_hal)) {
atomic_set(&off_status_hal, 1);
ret = EWTZMU2_Power_Off();
}
} else if ((atomic_read(&g_status) || atomic_read(&rv_status) || atomic_read(&la_status) || atomic_read(&gv_status) || atomic_read(&o_status))) {
Expand All @@ -2097,6 +2077,7 @@ static long ewtzmu2hal_ioctl(struct file *file, unsigned int cmd, unsigned long
atomic_read(&g_status),
atomic_read(&off_status_hal));
if (atomic_read(&off_status_hal)) {
atomic_set(&off_status_hal, 0);
ret = EWTZMU2_Power_On();
}
}
Expand Down Expand Up @@ -2516,6 +2497,7 @@ const struct i2c_device_id *id)
if (data->pdata->config_gyro_diag_gpios != NULL)
ewtzmumid_data.config_gyro_diag_gpios =
data->pdata->config_gyro_diag_gpios;
atomic_set(&off_status_hal, 1);
EWTZMU2_Power_Off();

init_waitqueue_head(&open_wq);
Expand Down
1 change: 0 additions & 1 deletion include/linux/ewtzmu2_cal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#define EW_DATA_REPEAT_ERROR_X -12
#define EW_DATA_REPEAT_ERROR_Y -13
#define EW_DATA_REPEAT_ERROR_Z -14
#define EW_DEVICE_POWERED_OFF -15



Expand Down

0 comments on commit 0783b1d

Please sign in to comment.