tizen 2.4 release
[kernel/u-boot-tm1.git] / drivers / sound / dai / vbc.h
1 /*
2  * sound/soc/sprd/dai/vbc/vbc.h
3  *
4  * SPRD SoC CPU-DAI -- SpreadTrum SOC DAI with EQ&ALC and some loop.
5  *
6  * Copyright (C) 2012 SpreadTrum Ltd.
7  *
8  * This software is licensed under the terms of the GNU General Public
9  * License version 2, as published by the Free Software Foundation, and
10  * may be copied, distributed, and modified under those terms.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY ork FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  */
17 #ifndef __VBC_H
18 #define __VBC_H
19
20 #include <asm/arch/sprd-audio.h>
21
22 #define VBC_FIFO_FRAME_NUM (160)
23
24 #define VBC_VERSION     "vbc.r0p0"
25
26 #define VBC_EQ_FIRMWARE_MAGIC_LEN       (4)
27 #define VBC_EQ_FIRMWARE_MAGIC_ID        ("VBEQ")
28 #define VBC_EQ_PROFILE_VERSION          (0x00000001)
29 #define VBC_EQ_PROFILE_CNT_MAX          (50)
30 #define VBC_EQ_PROFILE_NAME_MAX         (32)
31 #define VBC_EFFECT_PARAS_LEN            (61)
32
33 /* VBADBUFFDTA */
34 enum {
35         VBISADCK_INV = 9,
36         VBISDACK_INV,
37         VBLSB_EB,
38         VBIIS_DLOOP = 13,
39         VBPCM_MODE,
40         VBIIS_LRCK,
41 };
42 /* VBDABUFFDTA */
43 enum {
44         RAMSW_NUMB = 9,
45         RAMSW_EN,
46         VBAD0DMA_EN,
47         VBAD1DMA_EN,
48         VBDA0DMA_EN,
49         VBDA1DMA_EN,
50         VBENABLE,
51 };
52 /* -------------------------- */
53
54 #define PHYS_VBDA0              (VBC_PHY_BASE + 0x0000) /* 0x0000  Voice band DAC0 data buffer */
55 #define PHYS_VBDA1              (VBC_PHY_BASE + 0x0004) /* 0x0002  Voice band DAC1 data buffer */
56 #define PHYS_VBAD0              (VBC_PHY_BASE + 0x0008) /* 0x0004  Voice band ADC0 data buffer */
57 #define PHYS_VBAD1              (VBC_PHY_BASE + 0x000C) /* 0x0006  Voice band ADC1 data buffer */
58
59 #define ARM_VB_BASE             VBC_BASE
60 #define VBDA0                   (ARM_VB_BASE + 0x0000)  /* 0x0000  Voice band DAC0 data buffer */
61 #define VBDA1                   (ARM_VB_BASE + 0x0004)  /* 0x0002  Voice band DAC1 data buffer */
62 #define VBAD0                   (ARM_VB_BASE + 0x0008)  /* 0x0004  Voice band ADC0 data buffer */
63 #define VBAD1                   (ARM_VB_BASE + 0x000C)  /* 0x0006  Voice band ADC1 data buffer */
64 #define VBBUFFSIZE              (ARM_VB_BASE + 0x0010)  /* 0x0008  Voice band buffer size */
65 #define VBADBUFFDTA             (ARM_VB_BASE + 0x0014)  /* 0x000A  Voice band AD buffer control */
66 #define VBDABUFFDTA             (ARM_VB_BASE + 0x0018)  /* 0x000C  Voice band DA buffer control */
67 #define VBADCNT                 (ARM_VB_BASE + 0x001C)  /* 0x000E  Voice band AD buffer counter */
68 #define VBDACNT                 (ARM_VB_BASE + 0x0020)  /* 0x0010  Voice band DA buffer counter */
69 #define VBDAICTL                (ARM_VB_BASE + 0x0024)  /* 0x0012  Voice band DAI control */
70 #define VBDAIIN                 (ARM_VB_BASE + 0x0028)  /* 0x0014  Voice band DAI input */
71 #define VBDAIOUT                (ARM_VB_BASE + 0x002C)  /* 0x0016  Voice band DAI output */
72
73 #define DAPATCHCTL              (ARM_VB_BASE + 0x0040)
74 #define DADGCTL                 (ARM_VB_BASE + 0x0044)
75 #define DAHPCTL                 (ARM_VB_BASE + 0x0048)
76 #define DAALCCTL0               (ARM_VB_BASE + 0x004C)
77 #define DAALCCTL1               (ARM_VB_BASE + 0x0050)
78 #define DAALCCTL2               (ARM_VB_BASE + 0x0054)
79 #define DAALCCTL3               (ARM_VB_BASE + 0x0058)
80 #define DAALCCTL4               (ARM_VB_BASE + 0x005C)
81 #define DAALCCTL5               (ARM_VB_BASE + 0x0060)
82 #define DAALCCTL6               (ARM_VB_BASE + 0x0064)
83 #define DAALCCTL7               (ARM_VB_BASE + 0x0068)
84 #define DAALCCTL8               (ARM_VB_BASE + 0x006C)
85 #define DAALCCTL9               (ARM_VB_BASE + 0x0070)
86 #define DAALCCTL10              (ARM_VB_BASE + 0x0074)
87 #define STCTL0                  (ARM_VB_BASE + 0x0078)
88 #define STCTL1                  (ARM_VB_BASE + 0x007C)
89 #define ADPATCHCTL              (ARM_VB_BASE + 0x0080)
90 #define ADDGCTL                 (ARM_VB_BASE + 0x0084)
91 #define HPCOEF0                 (ARM_VB_BASE + 0x0100)
92 #define HPCOEF1                 (ARM_VB_BASE + 0x0104)
93 #define HPCOEF2                 (ARM_VB_BASE + 0x0108)
94 #define HPCOEF3                 (ARM_VB_BASE + 0x010C)
95 #define HPCOEF4                 (ARM_VB_BASE + 0x0110)
96 #define HPCOEF5                 (ARM_VB_BASE + 0x0114)
97 #define HPCOEF6                 (ARM_VB_BASE + 0x0118)
98 #define HPCOEF7                 (ARM_VB_BASE + 0x011C)
99 #define HPCOEF8                 (ARM_VB_BASE + 0x0120)
100 #define HPCOEF9                 (ARM_VB_BASE + 0x0124)
101 #define HPCOEF10                (ARM_VB_BASE + 0x0128)
102 #define HPCOEF11                (ARM_VB_BASE + 0x012C)
103 #define HPCOEF12                (ARM_VB_BASE + 0x0130)
104 #define HPCOEF13                (ARM_VB_BASE + 0x0134)
105 #define HPCOEF14                (ARM_VB_BASE + 0x0138)
106 #define HPCOEF15                (ARM_VB_BASE + 0x013C)
107 #define HPCOEF16                (ARM_VB_BASE + 0x0140)
108 #define HPCOEF17                (ARM_VB_BASE + 0x0144)
109 #define HPCOEF18                (ARM_VB_BASE + 0x0148)
110 #define HPCOEF19                (ARM_VB_BASE + 0x014C)
111 #define HPCOEF20                (ARM_VB_BASE + 0x0150)
112 #define HPCOEF21                (ARM_VB_BASE + 0x0154)
113 #define HPCOEF22                (ARM_VB_BASE + 0x0158)
114 #define HPCOEF23                (ARM_VB_BASE + 0x015C)
115 #define HPCOEF24                (ARM_VB_BASE + 0x0160)
116 #define HPCOEF25                (ARM_VB_BASE + 0x0164)
117 #define HPCOEF26                (ARM_VB_BASE + 0x0168)
118 #define HPCOEF27                (ARM_VB_BASE + 0x016C)
119 #define HPCOEF28                (ARM_VB_BASE + 0x0170)
120 #define HPCOEF29                (ARM_VB_BASE + 0x0174)
121 #define HPCOEF30                (ARM_VB_BASE + 0x0178)
122 #define HPCOEF31                (ARM_VB_BASE + 0x017C)
123 #define HPCOEF32                (ARM_VB_BASE + 0x0180)
124 #define HPCOEF33                (ARM_VB_BASE + 0x0184)
125 #define HPCOEF34                (ARM_VB_BASE + 0x0188)
126 #define HPCOEF35                (ARM_VB_BASE + 0x018C)
127 #define HPCOEF36                (ARM_VB_BASE + 0x0190)
128 #define HPCOEF37                (ARM_VB_BASE + 0x0194)
129 #define HPCOEF38                (ARM_VB_BASE + 0x0198)
130 #define HPCOEF39                (ARM_VB_BASE + 0x019C)
131 #define HPCOEF40                (ARM_VB_BASE + 0x01A0)
132 #define HPCOEF41                (ARM_VB_BASE + 0x01A4)
133 #define HPCOEF42                (ARM_VB_BASE + 0x01A8)
134
135 #define ARM_VB_END              (ARM_VB_BASE + 0x01AC)
136
137 #define VBADBUFFERSIZE_SHIFT    (0)
138 #define VBADBUFFERSIZE_MASK     (0xFF<<VBADBUFFERSIZE_SHIFT)
139 #define VBDABUFFERSIZE_SHIFT    (8)
140 #define VBDABUFFERSIZE_MASK     (0xFF<<VBDABUFFERSIZE_SHIFT)
141
142
143
144 enum {
145         VBC_LEFT = 0,
146         VBC_RIGHT = 1,
147 };
148
149 int vbc_init(void);
150 void vbc_exit(void);
151 int vbc_startup(int stream);
152 void vbc_shutdown(int stream);
153 int vbc_trigger(int stream, int enable);
154
155 #endif /* __VBC_H */