haptic: update aw8624 vibrator driver

Bug2go turns on the vibrator,Kenel is in suspend process at this time.
After the vibration time is over,Kenel suspend the I2C bus.
Causes the driver to shut down the vibrator to fail.

Change-Id: If6a5c7ca42be7a55c17f45c47748f785dbc317b1
Signed-off-by: Wen Xie <xiewen3@motorola.com>
Reviewed-on: https://gerrit.mot.com/1309316
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Weilong Wu <wuwl10@motorola.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Wen Xie 2019-02-15 16:34:21 +08:00
commit 36cbda5bb6
2 changed files with 16 additions and 1 deletions

View file

@ -28,6 +28,8 @@
#include <asm/uaccess.h>
#include <linux/syscalls.h>
#include <linux/power_supply.h>
#include <linux/wakelock.h>
#include <linux/jiffies.h>
#include "aw8624.h"
#include "aw8624_reg.h"
@ -38,7 +40,7 @@
******************************************************/
#define AW8624_I2C_NAME "aw8624_haptic"
#define AW8624_HAPTIC_NAME "aw8624_haptic"
#define AW8624_VERSION "v1.0.4"
#define AW8624_VERSION "v1.0.5"
#define AWINIC_RAM_UPDATE_DELAY
#define AW_I2C_RETRIES 2
#define AW_I2C_RETRY_DELAY 2
@ -2337,6 +2339,13 @@ static void aw8624_vibrator_work_routine(struct work_struct *work)
hrtimer_start(&aw8624->timer,
ktime_set(aw8624->duration / 1000, (aw8624->duration % 1000) * 1000000),
HRTIMER_MODE_REL);
wake_lock(&aw8624->wk_lock);
aw8624->wk_lock_flag = 1;
} else {
if (aw8624->wk_lock_flag == 1) {
wake_unlock(&aw8624->wk_lock);
aw8624->wk_lock_flag = 0;
}
}
mutex_unlock(&aw8624->lock);
@ -2780,6 +2789,8 @@ static int aw8624_i2c_probe(struct i2c_client *i2c, const struct i2c_device_id *
g_aw8624 = aw8624;
wake_lock_init(&aw8624->wk_lock, WAKE_LOCK_SUSPEND, "aw8624_wakelock");
aw8624_vibrator_init(aw8624);
aw8624_haptic_init(aw8624);
aw8624_ram_init(aw8624);
@ -2819,6 +2830,8 @@ static int aw8624_i2c_remove(struct i2c_client *i2c)
mutex_destroy(&aw8624->lock);
mutex_destroy(&aw8624->haptic_audio.lock);
wake_lock_destroy(&aw8624->wk_lock);
sysfs_remove_group(&i2c->dev.kobj, &aw8624_attribute_group);
sysfs_remove_group(&i2c->dev.kobj, &aw8624_vibrator_attribute_group);

View file

@ -164,6 +164,8 @@ struct aw8624 {
struct device *dev;
struct mutex lock;
struct wake_lock wk_lock;
unsigned char wk_lock_flag;
struct hrtimer timer;
struct work_struct vibrator_work;
struct work_struct irq_work;