change source file mode to 0644 instead of 0755
[profile/mobile/platform/kernel/u-boot-tm1.git] / arch / arm / cpu / armv7 / sc9630 / vibrator.c
1 #include <config.h>
2 #include <asm/io.h>
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
10 #define ANA_VIBRATOR_CTRL0_U      (ANA_REGS_GLB_BASE + 0xf8)
11
12 #define CUR_DRV_CAL_SEL_U       (0x0 << 12)
13 #define SLP_LDOVIBR_PD_EN_U     (0x1 << 9)
14 #define LDO_VIBR_PD_U   (0x1 << 8)
15 #define LDO_VIBR_V_U    (0xB4)
16
17 void set_vibrator(int on)
18 {
19         if (on){
20                 ANA_REG_AND(ANA_VIBRATOR_CTRL0_U, ~LDO_VIBR_PD_U);
21                 ANA_REG_AND(ANA_VIBRATOR_CTRL0_U, ~SLP_LDOVIBR_PD_EN_U);
22                 }
23         else{
24                         ANA_REG_MSK_OR(ANA_VIBRATOR_CTRL0_U, LDO_VIBR_PD_U, LDO_VIBR_PD_U);
25                         ANA_REG_MSK_OR(ANA_VIBRATOR_CTRL0_U, SLP_LDOVIBR_PD_EN_U, SLP_LDOVIBR_PD_EN_U);
26                 }
27 }
28
29 void vibrator_hw_init(void)
30 {
31         ANA_REG_OR(ANA_REG_GLB_RTC_CLK_EN, BIT_RTC_VIBR_EN);
32         ANA_REG_MSK_OR(ANA_VIBRATOR_CTRL0_U,CUR_DRV_CAL_SEL_U,CUR_DRV_CAL_SEL_U);
33         ANA_REG_MSK_OR(ANA_VIBRATOR_CTRL0_U,LDO_VIBR_V_U,LDO_VIBR_V_U);
34 }