From 93faa31b33a9a473fa0d9fe57335e617a3277d92 Mon Sep 17 00:00:00 2001 From: fsd017 Date: Thu, 18 Sep 2014 12:32:47 -0500 Subject: IKXCLOCK-3821 : Remove Compass Calibration during Init Revert "IKXCLOCK-3546: Fix for current drain when display on" This reverts commit 83d8dbe505092e9c5fc99e8f00552ef5b3470a41. --- drivers/misc/m4sensorhub_mpu9150.c | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) (limited to 'drivers/misc/m4sensorhub_mpu9150.c') diff --git a/drivers/misc/m4sensorhub_mpu9150.c b/drivers/misc/m4sensorhub_mpu9150.c index a2411c27d4f..ea136fea978 100644 --- a/drivers/misc/m4sensorhub_mpu9150.c +++ b/drivers/misc/m4sensorhub_mpu9150.c @@ -142,23 +142,6 @@ static void m4_report_mpu9150_inputevent( } } -static void m4_queue_delayed_work(struct mpu9150_client *dd, - int delay, enum mpu9150_sensor type) -{ - if (type == TYPE_COMPASS) { - /* initial calibration is not done and there is - no app requesting compass data */ - if ((!dd->calibration_done) && (!dd->app_override)) - /* For current drain saving, m4 is sampling - compass at 40ms while omap is polling - for compass data at 15 secs */ - delay = 15000; - } - queue_delayed_work(system_freezable_wq, - &(dd->mpu9150_work[type]), - msecs_to_jiffies(delay)); -} - static void m4_set_mpu9150_delay(struct mpu9150_client *mpu9150_client_data, int delay, enum mpu9150_sensor type) { @@ -197,11 +180,13 @@ static void m4_set_mpu9150_delay(struct mpu9150_client *mpu9150_client_data, cancel_delayed_work(&(dd->mpu9150_work[type])); dd->samplerate[type] = delay; if (dd->samplerate[type] > 0) - m4_queue_delayed_work(dd, delay, type); + queue_delayed_work(system_freezable_wq, + &(dd->mpu9150_work[type]), + msecs_to_jiffies(delay)); + } } - static void m4_read_mpu9150_data(struct mpu9150_client *mpu9150_client_data, enum mpu9150_sensor type) { @@ -252,7 +237,6 @@ static void m4_read_mpu9150_data(struct mpu9150_client *mpu9150_client_data, /* Check if calibration is complete */ if ((!(dd->calibration_done)) && (compassdata.accuracy)) { dd->calibration_done = 1; - KDEBUG(M4SH_INFO, "Calibration complete\n"); /* Stop compass sampling if no app is using the data */ if (dd->app_override == 0) { m4_set_mpu9150_delay(dd, @@ -320,7 +304,9 @@ static void m4compass_work_func(struct work_struct *work) m4_report_mpu9150_inputevent(dd, TYPE_COMPASS); rate = dd->samplerate[TYPE_COMPASS]; if (rate > 0) - m4_queue_delayed_work(dd, rate, TYPE_COMPASS); + queue_delayed_work(system_freezable_wq, + &(dd->mpu9150_work[TYPE_COMPASS]), + msecs_to_jiffies(rate)); mutex_unlock(&(dd->mutex)); } @@ -611,7 +597,9 @@ static void mpu9150_panic_restore(struct m4sensorhub_data *m4sensorhub, m4_set_mpu9150_delay(dd, rate, type); cancel_delayed_work(&(dd->mpu9150_work[type])); if (rate > 0) - m4_queue_delayed_work(dd, rate, type); + queue_delayed_work(system_freezable_wq, + &(dd->mpu9150_work[type]), + msecs_to_jiffies(rate)); } mutex_unlock(&(dd->mutex)); } -- cgit v1.2.3-70-g09d2 From ea8917ce24cf45b4bd6619be9d720267d8e941f1 Mon Sep 17 00:00:00 2001 From: fsd017 Date: Thu, 18 Sep 2014 12:33:10 -0500 Subject: IKXCLOCK-3821 : Remove Compass Calibration during Init Revert "IKXCLOCK-3495 : Compass calibration routine on boot" This reverts commit 5bd84dd403d6c7feb57e5a41f4db50fd66b3d63b. --- drivers/misc/m4sensorhub_mpu9150.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) (limited to 'drivers/misc/m4sensorhub_mpu9150.c') diff --git a/drivers/misc/m4sensorhub_mpu9150.c b/drivers/misc/m4sensorhub_mpu9150.c index ea136fea978..55d160bc607 100644 --- a/drivers/misc/m4sensorhub_mpu9150.c +++ b/drivers/misc/m4sensorhub_mpu9150.c @@ -79,8 +79,6 @@ struct mpu9150_client { struct mutex mutex; /* prevent concurrent thread access */ struct delayed_work mpu9150_work[NUM_TYPES]; signed short fastest_rate[NUM_TYPES]; - int calibration_done; - int app_override; }; struct mpu9150_client *misc_mpu9150_data; @@ -193,7 +191,6 @@ static void m4_read_mpu9150_data(struct mpu9150_client *mpu9150_client_data, sCompassData compassdata; sAccelData acceldata; sGyroData gyrodata; - struct mpu9150_client *dd = mpu9150_client_data; switch (type) { case TYPE_GYRO: @@ -234,17 +231,6 @@ static void m4_read_mpu9150_data(struct mpu9150_client *mpu9150_client_data, mpu9150_client_data->compass_data.cz = compassdata.z; mpu9150_client_data->compass_data.ca = compassdata.accuracy; - /* Check if calibration is complete */ - if ((!(dd->calibration_done)) && (compassdata.accuracy)) { - dd->calibration_done = 1; - /* Stop compass sampling if no app is using the data */ - if (dd->app_override == 0) { - m4_set_mpu9150_delay(dd, - -1, - TYPE_COMPASS); - KDEBUG(M4SH_INFO, "Init cal done. Turning off compass"); - } - } break; default: @@ -393,20 +379,8 @@ static ssize_t m4_mpu9150_write_compass_setdelay(struct device *dev, mutex_lock(&(misc_mpu9150_data->mutex)); - if (misc_mpu9150_data->calibration_done == 0) { - /* If calibration is not complete and app tries to - turn off ignore */ - if (scanresult < 0) { - misc_mpu9150_data->app_override = 0; - goto compass_setdelay_exit; - } else { - misc_mpu9150_data->app_override = 1; - } - } m4_set_mpu9150_delay(misc_mpu9150_data, scanresult, TYPE_COMPASS); -compass_setdelay_exit: - mutex_unlock(&(misc_mpu9150_data->mutex)); return count; @@ -621,9 +595,7 @@ static int mpu9150_driver_init(struct init_calldata *p_arg) dd); if (ret < 0) KDEBUG(M4SH_ERROR, "HR panic callback register failed\n"); - m4_set_mpu9150_delay(dd, - 40, - TYPE_COMPASS); + mutex_unlock(&(dd->mutex)); return ret; } @@ -656,8 +628,6 @@ static int mpu9150_client_probe(struct platform_device *pdev) mpu9150_client_data->fastest_rate[TYPE_ACCEL] = 40; mpu9150_client_data->fastest_rate[TYPE_GYRO] = 40; mpu9150_client_data->fastest_rate[TYPE_COMPASS] = 40; - mpu9150_client_data->calibration_done = 0; - mpu9150_client_data->app_override = 0; mpu9150_client_data->input_dev = input_allocate_device(); if (!mpu9150_client_data->input_dev) { -- cgit v1.2.3-70-g09d2