3 #include <asm/arch/chip_drv_config_extern.h>
4 #include <asm/arch/bits.h>
5 #include <linux/types.h>
6 #include <asm/arch/regs_adi.h>
7 #include <asm/arch/adi_hal_internal.h>
8 #include <asm/arch/sprd_reg.h>
9 //#include <asm/arch/analog_reg_v3.h>
11 #define VIBRATOR_REG_UNLOCK (0x1A2B)
12 #define VIBRATOR_REG_LOCK (~VIBRATOR_REG_UNLOCK)
13 #define VIBRATOR_STABLE_LEVEL (4)
14 #define VIBRATOR_INIT_LEVEL (11) //init level must larger than stable level
15 #define VIBRATOR_INIT_STATE_CNT (2)
17 #define mdelay(_ms) udelay(_ms*1000)
19 void set_vibrator(int on)
22 ANA_REG_SET(ANA_REG_GLB_VIBR_WR_PROT_VALUE, VIBRATOR_REG_UNLOCK); //unlock vibrator registor
26 ANA_REG_AND (ANA_REG_GLB_VIBR_CTRL0, ~(BIT_VIBR_PON));
30 ANA_REG_OR (ANA_REG_GLB_VIBR_CTRL0, BIT_VIBR_PON);
32 ANA_REG_SET(ANA_REG_GLB_VIBR_WR_PROT_VALUE, VIBRATOR_REG_LOCK); //lock vibrator registor
35 #define VIBR_STABLE_V_SHIFT 12
36 #define VIBR_STABLE_V_MSK (0x0F << VIBR_STABLE_V_SHIFT)
37 #define VIBR_INIT_V_SHIFT 8
38 #define VIBR_INIT_V_MSK (0x0F << VIBR_INIT_V_SHIFT)
39 #define VIBR_V_BP_SHIFT 4
40 #define VIBR_V_BP_MSK (0x0F << VIBR_V_BP_SHIFT)
42 void vibrator_hw_init(void)
44 ANA_REG_SET(ANA_REG_GLB_VIBR_WR_PROT_VALUE, VIBRATOR_REG_UNLOCK); //unlock vibrator registor
45 ANA_REG_OR(ANA_REG_GLB_RTC_CLK_EN, BIT_RTC_VIBR_EN);
46 ANA_REG_MSK_OR(ANA_REG_GLB_VIBR_CTRL0, (VIBRATOR_INIT_LEVEL << VIBR_INIT_V_SHIFT), VIBR_INIT_V_MSK); //set init current level
47 ANA_REG_MSK_OR(ANA_REG_GLB_VIBR_CTRL0, (VIBRATOR_STABLE_LEVEL << VIBR_STABLE_V_SHIFT), VIBR_STABLE_V_MSK); //set stable current level
48 ANA_REG_SET(ANA_REG_GLB_VIBR_CTRL1, VIBRATOR_INIT_STATE_CNT); //set convert count
50 ANA_REG_SET(ANA_REG_GLB_VIBR_WR_PROT_VALUE, VIBRATOR_REG_LOCK); //lock vibrator registor