mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 13:49:24 -04:00
aw8624: Upgrade driver from 1.0.7 to 1.3.9
Upgrade driver of aw8624 from 1.0.7 to 1.3.9, which was suggested by Awinic. NO_PROP_NEEDED: Only for a new product Kiev JAPAN. Change-Id: I31d665574d135836496fd14c0bc54428db9eaff7 Signed-off-by: yangjq <yangjq@lenovo.com> Reviewed-on: https://gerrit.mot.com/1659051 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
73318b8fb7
commit
207ef8d65a
3 changed files with 2050 additions and 914 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -6,6 +6,9 @@
|
|||
* kernel version
|
||||
*
|
||||
********************************************************/
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(4, 4, 1)
|
||||
#define TIMED_OUTPUT
|
||||
#endif
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
|
|
@ -18,7 +21,12 @@
|
|||
#include <linux/hrtimer.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/cdev.h>
|
||||
#ifdef TIMED_OUTPUT
|
||||
#include <../../../drivers/staging/android/timed_output.h>
|
||||
#else
|
||||
#include <linux/leds.h>
|
||||
#endif
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* marco
|
||||
|
|
@ -39,7 +47,15 @@
|
|||
#define AW8624_VBAT_MIN 3000
|
||||
#define AW8624_VBAT_MAX 4500
|
||||
|
||||
/*
|
||||
* aw8624 dts info
|
||||
*
|
||||
* aw8624_brake_local[3][8]
|
||||
* [0][0-7] is en_brake1,en_brake2,brake0_level,
|
||||
* brake1_level,brake2_level,brake0_p_num,brake1_p_num,brake0_level;
|
||||
*/
|
||||
struct aw8624_dts_info {
|
||||
int aw8624_mode;
|
||||
int aw8624_f0_pre; /* AW8624_HAPTIC_F0_PRE 2600 */
|
||||
int aw8624_f0_cali_percen; /* AW8624_HAPTIC_F0_CALI_PERCEN 7 */
|
||||
int aw8624_cont_drv_lvl; /* AW8624_HAPTIC_CONT_DRV_LVL 125 */
|
||||
|
|
@ -50,24 +66,17 @@ struct aw8624_dts_info {
|
|||
int aw8624_f0_coeff; /* AW8624_HAPTIC_F0_COEFF 260 */
|
||||
|
||||
int aw8624_duration_time[5];
|
||||
int aw8624_ram_brake[3][8];
|
||||
int aw8624_cont_brake[3][8];
|
||||
|
||||
int aw8624_f0_trace_parameter[4];
|
||||
int aw8624_bemf_config[4];
|
||||
int aw8624_sw_brake;
|
||||
int aw8624_sw_brake[2];
|
||||
int aw8624_wavseq[16];
|
||||
int aw8624_wavloop[10];
|
||||
int aw8624_td_brake[3];
|
||||
int aw8624_tset;
|
||||
int aw8624_parameter1;
|
||||
int aw8624_timed_output;
|
||||
int aw8624_ram_config;
|
||||
int aw8624_vbat_comp;
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum aw8624_flags {
|
||||
AW8624_FLAG_NONR = 0,
|
||||
AW8624_FLAG_SKIP_INTERRUPTS = 1,
|
||||
|
|
@ -82,7 +91,6 @@ enum aw8624_haptic_read_write {
|
|||
AW8624_HAPTIC_CMD_WRITE_REG = 1,
|
||||
};
|
||||
|
||||
|
||||
enum aw8624_haptic_work_mode {
|
||||
AW8624_HAPTIC_STANDBY_MODE = 0,
|
||||
AW8624_HAPTIC_RAM_MODE = 1,
|
||||
|
|
@ -145,11 +153,13 @@ struct ram {
|
|||
};
|
||||
|
||||
struct haptic_ctr {
|
||||
unsigned char cnt;
|
||||
unsigned char cmd;
|
||||
unsigned char play;
|
||||
unsigned char wavseq;
|
||||
unsigned char loop;
|
||||
unsigned char gain;
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
struct haptic_audio {
|
||||
|
|
@ -163,24 +173,39 @@ struct haptic_audio {
|
|||
};
|
||||
|
||||
struct aw8624 {
|
||||
struct regmap *regmap;
|
||||
struct i2c_client *i2c;
|
||||
struct device *dev;
|
||||
struct input_dev *input;
|
||||
|
||||
struct mutex lock;
|
||||
struct mutex rtp_lock;
|
||||
struct wakeup_source *ws;
|
||||
unsigned char wk_lock_flag;
|
||||
struct hrtimer timer;
|
||||
struct work_struct vibrator_work;
|
||||
struct work_struct irq_work;
|
||||
struct work_struct rtp_work;
|
||||
struct delayed_work ram_work;
|
||||
struct delayed_work stop_work;
|
||||
struct timeval current_time;
|
||||
struct timeval pre_enter_time;
|
||||
struct led_classdev to_dev;
|
||||
|
||||
#ifdef TIMED_OUTPUT
|
||||
struct timed_output_dev to_dev;
|
||||
#else
|
||||
struct led_classdev cdev;
|
||||
#endif
|
||||
struct fileops fileops;
|
||||
struct ram ram;
|
||||
|
||||
bool haptic_ready;
|
||||
bool audio_ready;
|
||||
int pre_haptic_number;
|
||||
struct timeval current_time;
|
||||
struct timeval pre_enter_time;
|
||||
struct timeval start, end;
|
||||
unsigned int timeval_flags;
|
||||
unsigned int osc_cali_flag;
|
||||
unsigned long int microsecond;
|
||||
unsigned int theory_time;
|
||||
unsigned int rtp_len;
|
||||
int reset_gpio;
|
||||
int irq_gpio;
|
||||
int reset_gpio_ret;
|
||||
|
|
@ -190,9 +215,10 @@ struct aw8624 {
|
|||
unsigned char flags;
|
||||
unsigned char chipid;
|
||||
unsigned char chipid_flag;
|
||||
|
||||
unsigned char singlecycle;
|
||||
unsigned char play_mode;
|
||||
unsigned char activate_mode;
|
||||
unsigned char auto_boost;
|
||||
|
||||
int state;
|
||||
int duration;
|
||||
|
|
@ -210,6 +236,7 @@ struct aw8624 {
|
|||
|
||||
unsigned char rtp_init;
|
||||
unsigned char ram_init;
|
||||
unsigned char rtp_routine_on;
|
||||
|
||||
unsigned int f0;
|
||||
unsigned int f0_pre;
|
||||
|
|
@ -224,13 +251,19 @@ struct aw8624 {
|
|||
unsigned char f0_cali_flag;
|
||||
bool IsUsedIRQ;
|
||||
bool ram_update_delay;
|
||||
bool dts_addr_real;
|
||||
unsigned int real_i2c_addr;
|
||||
bool dts_add_real;
|
||||
unsigned int reg_real_addr;
|
||||
struct haptic_audio haptic_audio;
|
||||
|
||||
unsigned char ram_vbat_comp;
|
||||
unsigned int vbat;
|
||||
unsigned int lra;
|
||||
unsigned int interval_us;
|
||||
unsigned int ramupdate_flag;
|
||||
unsigned int rtpupdate_flag;
|
||||
unsigned int osc_cali_run;
|
||||
unsigned int lra_calib_data;
|
||||
unsigned int f0_calib_data;
|
||||
};
|
||||
|
||||
struct aw8624_container {
|
||||
|
|
@ -238,7 +271,6 @@ struct aw8624_container {
|
|||
unsigned char data[];
|
||||
};
|
||||
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* ioctl
|
||||
|
|
@ -252,16 +284,21 @@ struct aw8624_que_seq {
|
|||
unsigned char index[AW8624_SEQUENCER_SIZE];
|
||||
};
|
||||
|
||||
|
||||
#define AW8624_HAPTIC_IOCTL_MAGIC 'h'
|
||||
|
||||
#define AW8624_HAPTIC_SET_QUE_SEQ _IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 1, struct aw8624_que_seq*)
|
||||
#define AW8624_HAPTIC_SET_SEQ_LOOP _IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 2, struct aw8624_seq_loop*)
|
||||
#define AW8624_HAPTIC_PLAY_QUE_SEQ _IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 3, unsigned int)
|
||||
#define AW8624_HAPTIC_SET_BST_VOL _IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 4, unsigned int)
|
||||
#define AW8624_HAPTIC_SET_BST_PEAK_CUR _IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 5, unsigned int)
|
||||
#define AW8624_HAPTIC_SET_GAIN _IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 6, unsigned int)
|
||||
#define AW8624_HAPTIC_PLAY_REPEAT_SEQ _IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 7, unsigned int)
|
||||
#define AW8624_HAPTIC_IOCTL_MAGIC 'h'
|
||||
#define AW8624_HAPTIC_SET_QUE_SEQ \
|
||||
_IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 1, struct aw8624_que_seq*)
|
||||
#define AW8624_HAPTIC_SET_SEQ_LOOP \
|
||||
_IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 2, struct aw8624_seq_loop*)
|
||||
#define AW8624_HAPTIC_PLAY_QUE_SEQ \
|
||||
_IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 3, unsigned int)
|
||||
#define AW8624_HAPTIC_SET_BST_VOL \
|
||||
_IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 4, unsigned int)
|
||||
#define AW8624_HAPTIC_SET_BST_PEAK_CUR \
|
||||
_IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 5, unsigned int)
|
||||
#define AW8624_HAPTIC_SET_GAIN \
|
||||
_IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 6, unsigned int)
|
||||
#define AW8624_HAPTIC_PLAY_REPEAT_SEQ \
|
||||
_IOWR(AW8624_HAPTIC_IOCTL_MAGIC, 7, unsigned int)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@
|
|||
* Register Access
|
||||
*******************************************/
|
||||
#define REG_NONE_ACCESS 0
|
||||
#define REG_RD_ACCESS 1 << 0
|
||||
#define REG_WR_ACCESS 1 << 1
|
||||
#define REG_RD_ACCESS (1 << 0)
|
||||
#define REG_WR_ACCESS (1 << 1)
|
||||
|
||||
|
||||
const unsigned char aw8624_reg_access[AW8624_REG_MAX] = {
|
||||
|
|
@ -455,6 +455,11 @@ const unsigned char aw8624_reg_access[AW8624_REG_MAX] = {
|
|||
#define AW8624_BIT_DBGCTRL_INTN_TRG_SEL_MASK (~(1<<5))
|
||||
#define AW8624_BIT_DBGCTRL_INTN_SEL_ENABLE (1<<5)
|
||||
#define AW8624_BIT_DBGCTRL_TRG_SEL_ENABLE (0<<5)
|
||||
#define AW8624_BIT_DBGCTRL_INT_MODE_MASK (~(3<<2))
|
||||
#define AW8624_BIT_DBGCTRL_INTN_LEVEL_MODE (0<<2)
|
||||
#define AW8624_BIT_DBGCTRL_INT_MODE_EDGE (1<<2)
|
||||
#define AW8624_BIT_DBGCTRL_INTN_POSEDGE_MODE (2<<2)
|
||||
#define AW8624_BIT_DBGCTRL_INTN_BOTH_EDGE_MODE (3<<2)
|
||||
|
||||
/*
|
||||
* DATCTRL
|
||||
|
|
@ -522,8 +527,8 @@ const unsigned char aw8624_reg_access[AW8624_REG_MAX] = {
|
|||
#define AW8624_BIT_CONT_CTRL_AUTO_BRK_ENABLE (1<<0)
|
||||
#define AW8624_BIT_CONT_CTRL_AUTO_BRK_DISABLE (0<<0)
|
||||
|
||||
#define AW8624_BIT_D2SCFG_CLK_ADC_MASK (~(7<<4))
|
||||
#define AW8624_BIT_D2SCFG_CLK_ASC_1P5MHZ (3<<4)
|
||||
#define AW8624_BIT_D2SCFG_CLK_ADC_MASK (~(7<<5))
|
||||
#define AW8624_BIT_D2SCFG_CLK_ASC_1P5MHZ (3<<5)
|
||||
|
||||
/*
|
||||
* DETCTRL
|
||||
|
|
@ -590,6 +595,10 @@ const unsigned char aw8624_reg_access[AW8624_REG_MAX] = {
|
|||
#define AW8624_BIT_PRTIME_PRTIME_MASK (~(0xff<<0))
|
||||
|
||||
#define AW8624_BIT_BEMF_NUM_BRK_MASK (~(0xf<<0))
|
||||
|
||||
/*
|
||||
*TD_H 0x4b TD_brake
|
||||
*/
|
||||
#define AW8624_BIT_TDH_TD_BRAKE_MASK (~(0xF<<4))
|
||||
#define AW8624_BIT_R_SPARE_MASK (~(1<<7))
|
||||
#define AW8624_BIT_R_SPARE_ENABLE (1<<7)
|
||||
|
|
|
|||
Loading…
Reference in a new issue