@@ -38,26 +38,25 @@ EXPORT_SYMBOL_NS_GPL(acp_common_hw_ops, "SND_SOC_ACP_COMMON");
38
38
irqreturn_t acp_irq_handler (int irq , void * data )
39
39
{
40
40
struct acp_chip_info * chip = data ;
41
- struct acp_dev_data * adata = chip -> adata ;
42
- struct acp_resource * rsrc = adata -> rsrc ;
41
+ struct acp_resource * rsrc = chip -> rsrc ;
43
42
struct acp_stream * stream ;
44
43
u16 i2s_flag = 0 ;
45
44
u32 ext_intr_stat , ext_intr_stat1 ;
46
45
47
- if (adata -> rsrc -> no_of_ctrls == 2 )
46
+ if (rsrc -> no_of_ctrls == 2 )
48
47
ext_intr_stat1 = readl (ACP_EXTERNAL_INTR_STAT (chip , (rsrc -> irqp_used - 1 )));
49
48
50
49
ext_intr_stat = readl (ACP_EXTERNAL_INTR_STAT (chip , rsrc -> irqp_used ));
51
50
52
- spin_lock (& adata -> acp_lock );
53
- list_for_each_entry (stream , & adata -> stream_list , list ) {
51
+ spin_lock (& chip -> acp_lock );
52
+ list_for_each_entry (stream , & chip -> stream_list , list ) {
54
53
if (ext_intr_stat & stream -> irq_bit ) {
55
54
writel (stream -> irq_bit ,
56
55
ACP_EXTERNAL_INTR_STAT (chip , rsrc -> irqp_used ));
57
56
snd_pcm_period_elapsed (stream -> substream );
58
57
i2s_flag = 1 ;
59
58
}
60
- if (adata -> rsrc -> no_of_ctrls == 2 ) {
59
+ if (chip -> rsrc -> no_of_ctrls == 2 ) {
61
60
if (ext_intr_stat1 & stream -> irq_bit ) {
62
61
writel (stream -> irq_bit , ACP_EXTERNAL_INTR_STAT (chip ,
63
62
(rsrc -> irqp_used - 1 )));
@@ -66,7 +65,7 @@ irqreturn_t acp_irq_handler(int irq, void *data)
66
65
}
67
66
}
68
67
}
69
- spin_unlock (& adata -> acp_lock );
68
+ spin_unlock (& chip -> acp_lock );
70
69
if (i2s_flag )
71
70
return IRQ_HANDLED ;
72
71
@@ -106,7 +105,7 @@ static void set_acp_pdm_ring_buffer(struct snd_pcm_substream *substream,
106
105
struct snd_pcm_runtime * runtime = substream -> runtime ;
107
106
struct acp_stream * stream = runtime -> private_data ;
108
107
struct device * dev = dai -> component -> dev ;
109
- struct acp_dev_data * adata = dev_get_drvdata (dev );
108
+ struct acp_chip_info * chip = dev_get_platdata (dev );
110
109
111
110
u32 physical_addr , pdm_size , period_bytes ;
112
111
@@ -115,43 +114,40 @@ static void set_acp_pdm_ring_buffer(struct snd_pcm_substream *substream,
115
114
physical_addr = stream -> reg_offset + MEM_WINDOW_START ;
116
115
117
116
/* Init ACP PDM Ring buffer */
118
- writel (physical_addr , adata -> acp_base + ACP_WOV_RX_RINGBUFADDR );
119
- writel (pdm_size , adata -> acp_base + ACP_WOV_RX_RINGBUFSIZE );
120
- writel (period_bytes , adata -> acp_base + ACP_WOV_RX_INTR_WATERMARK_SIZE );
121
- writel (0x01 , adata -> acp_base + ACPAXI2AXI_ATU_CTRL );
117
+ writel (physical_addr , chip -> base + ACP_WOV_RX_RINGBUFADDR );
118
+ writel (pdm_size , chip -> base + ACP_WOV_RX_RINGBUFSIZE );
119
+ writel (period_bytes , chip -> base + ACP_WOV_RX_INTR_WATERMARK_SIZE );
120
+ writel (0x01 , chip -> base + ACPAXI2AXI_ATU_CTRL );
122
121
}
123
122
124
123
static void set_acp_pdm_clk (struct snd_pcm_substream * substream ,
125
124
struct snd_soc_dai * dai )
126
125
{
127
126
struct device * dev = dai -> component -> dev ;
128
- struct acp_dev_data * adata = dev_get_drvdata (dev );
127
+ struct acp_chip_info * chip = dev_get_platdata (dev );
129
128
unsigned int pdm_ctrl ;
130
129
131
130
/* Enable default ACP PDM clk */
132
- writel (PDM_CLK_FREQ_MASK , adata -> acp_base + ACP_WOV_CLK_CTRL );
133
- pdm_ctrl = readl (adata -> acp_base + ACP_WOV_MISC_CTRL );
131
+ writel (PDM_CLK_FREQ_MASK , chip -> base + ACP_WOV_CLK_CTRL );
132
+ pdm_ctrl = readl (chip -> base + ACP_WOV_MISC_CTRL );
134
133
pdm_ctrl |= PDM_MISC_CTRL_MASK ;
135
- writel (pdm_ctrl , adata -> acp_base + ACP_WOV_MISC_CTRL );
134
+ writel (pdm_ctrl , chip -> base + ACP_WOV_MISC_CTRL );
136
135
set_acp_pdm_ring_buffer (substream , dai );
137
136
}
138
137
139
138
void restore_acp_pdm_params (struct snd_pcm_substream * substream ,
140
- struct acp_dev_data * adata )
139
+ struct acp_chip_info * chip )
141
140
{
142
141
struct snd_soc_dai * dai ;
143
- struct device * dev ;
144
- struct acp_chip_info * chip ;
145
142
struct snd_soc_pcm_runtime * soc_runtime ;
146
143
u32 ext_int_ctrl ;
147
144
148
145
soc_runtime = snd_soc_substream_to_rtd (substream );
149
146
dai = snd_soc_rtd_to_cpu (soc_runtime , 0 );
150
- dev = dai -> component -> dev ;
151
- chip = dev_get_platdata (dev );
147
+
152
148
/* Programming channel mask and sampling rate */
153
- writel (adata -> ch_mask , adata -> acp_base + ACP_WOV_PDM_NO_OF_CHANNELS );
154
- writel (PDM_DEC_64 , adata -> acp_base + ACP_WOV_PDM_DECIMATION_FACTOR );
149
+ writel (chip -> ch_mask , chip -> base + ACP_WOV_PDM_NO_OF_CHANNELS );
150
+ writel (PDM_DEC_64 , chip -> base + ACP_WOV_PDM_DECIMATION_FACTOR );
155
151
156
152
/* Enabling ACP Pdm interuppts */
157
153
ext_int_ctrl = readl (ACP_EXTERNAL_INTR_CNTL (chip , 0 ));
@@ -165,9 +161,8 @@ static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
165
161
struct snd_soc_dai * dai )
166
162
{
167
163
struct device * dev = dai -> component -> dev ;
168
- struct acp_dev_data * adata = dev_get_drvdata (dev );
169
- struct acp_resource * rsrc = adata -> rsrc ;
170
164
struct acp_chip_info * chip = dev_get_platdata (dev );
165
+ struct acp_resource * rsrc = chip -> rsrc ;
171
166
struct acp_stream * stream = substream -> runtime -> private_data ;
172
167
u32 reg_dma_size , reg_fifo_size , reg_fifo_addr ;
173
168
u32 phy_addr , acp_fifo_addr , ext_int_ctrl ;
@@ -176,40 +171,40 @@ static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
176
171
switch (dai -> driver -> id ) {
177
172
case I2S_SP_INSTANCE :
178
173
if (dir == SNDRV_PCM_STREAM_PLAYBACK ) {
179
- reg_dma_size = ACP_I2S_TX_DMA_SIZE (adata );
174
+ reg_dma_size = ACP_I2S_TX_DMA_SIZE (chip );
180
175
acp_fifo_addr = rsrc -> sram_pte_offset +
181
176
SP_PB_FIFO_ADDR_OFFSET ;
182
- reg_fifo_addr = ACP_I2S_TX_FIFOADDR (adata );
183
- reg_fifo_size = ACP_I2S_TX_FIFOSIZE (adata );
177
+ reg_fifo_addr = ACP_I2S_TX_FIFOADDR (chip );
178
+ reg_fifo_size = ACP_I2S_TX_FIFOSIZE (chip );
184
179
phy_addr = I2S_SP_TX_MEM_WINDOW_START + stream -> reg_offset ;
185
- writel (phy_addr , adata -> acp_base + ACP_I2S_TX_RINGBUFADDR (adata ));
180
+ writel (phy_addr , chip -> base + ACP_I2S_TX_RINGBUFADDR (chip ));
186
181
} else {
187
- reg_dma_size = ACP_I2S_RX_DMA_SIZE (adata );
182
+ reg_dma_size = ACP_I2S_RX_DMA_SIZE (chip );
188
183
acp_fifo_addr = rsrc -> sram_pte_offset +
189
184
SP_CAPT_FIFO_ADDR_OFFSET ;
190
- reg_fifo_addr = ACP_I2S_RX_FIFOADDR (adata );
191
- reg_fifo_size = ACP_I2S_RX_FIFOSIZE (adata );
185
+ reg_fifo_addr = ACP_I2S_RX_FIFOADDR (chip );
186
+ reg_fifo_size = ACP_I2S_RX_FIFOSIZE (chip );
192
187
phy_addr = I2S_SP_RX_MEM_WINDOW_START + stream -> reg_offset ;
193
- writel (phy_addr , adata -> acp_base + ACP_I2S_RX_RINGBUFADDR (adata ));
188
+ writel (phy_addr , chip -> base + ACP_I2S_RX_RINGBUFADDR (chip ));
194
189
}
195
190
break ;
196
191
case I2S_BT_INSTANCE :
197
192
if (dir == SNDRV_PCM_STREAM_PLAYBACK ) {
198
- reg_dma_size = ACP_BT_TX_DMA_SIZE (adata );
193
+ reg_dma_size = ACP_BT_TX_DMA_SIZE (chip );
199
194
acp_fifo_addr = rsrc -> sram_pte_offset +
200
195
BT_PB_FIFO_ADDR_OFFSET ;
201
- reg_fifo_addr = ACP_BT_TX_FIFOADDR (adata );
202
- reg_fifo_size = ACP_BT_TX_FIFOSIZE (adata );
196
+ reg_fifo_addr = ACP_BT_TX_FIFOADDR (chip );
197
+ reg_fifo_size = ACP_BT_TX_FIFOSIZE (chip );
203
198
phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream -> reg_offset ;
204
- writel (phy_addr , adata -> acp_base + ACP_BT_TX_RINGBUFADDR (adata ));
199
+ writel (phy_addr , chip -> base + ACP_BT_TX_RINGBUFADDR (chip ));
205
200
} else {
206
- reg_dma_size = ACP_BT_RX_DMA_SIZE (adata );
201
+ reg_dma_size = ACP_BT_RX_DMA_SIZE (chip );
207
202
acp_fifo_addr = rsrc -> sram_pte_offset +
208
203
BT_CAPT_FIFO_ADDR_OFFSET ;
209
- reg_fifo_addr = ACP_BT_RX_FIFOADDR (adata );
210
- reg_fifo_size = ACP_BT_RX_FIFOSIZE (adata );
204
+ reg_fifo_addr = ACP_BT_RX_FIFOADDR (chip );
205
+ reg_fifo_size = ACP_BT_RX_FIFOSIZE (chip );
211
206
phy_addr = I2S_BT_TX_MEM_WINDOW_START + stream -> reg_offset ;
212
- writel (phy_addr , adata -> acp_base + ACP_BT_RX_RINGBUFADDR (adata ));
207
+ writel (phy_addr , chip -> base + ACP_BT_RX_RINGBUFADDR (chip ));
213
208
}
214
209
break ;
215
210
case I2S_HS_INSTANCE :
@@ -220,25 +215,25 @@ static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
220
215
reg_fifo_addr = ACP_HS_TX_FIFOADDR ;
221
216
reg_fifo_size = ACP_HS_TX_FIFOSIZE ;
222
217
phy_addr = I2S_HS_TX_MEM_WINDOW_START + stream -> reg_offset ;
223
- writel (phy_addr , adata -> acp_base + ACP_HS_TX_RINGBUFADDR );
218
+ writel (phy_addr , chip -> base + ACP_HS_TX_RINGBUFADDR );
224
219
} else {
225
220
reg_dma_size = ACP_HS_RX_DMA_SIZE ;
226
221
acp_fifo_addr = rsrc -> sram_pte_offset +
227
222
HS_CAPT_FIFO_ADDR_OFFSET ;
228
223
reg_fifo_addr = ACP_HS_RX_FIFOADDR ;
229
224
reg_fifo_size = ACP_HS_RX_FIFOSIZE ;
230
225
phy_addr = I2S_HS_RX_MEM_WINDOW_START + stream -> reg_offset ;
231
- writel (phy_addr , adata -> acp_base + ACP_HS_RX_RINGBUFADDR );
226
+ writel (phy_addr , chip -> base + ACP_HS_RX_RINGBUFADDR );
232
227
}
233
228
break ;
234
229
default :
235
230
dev_err (dev , "Invalid dai id %x\n" , dai -> driver -> id );
236
231
return - EINVAL ;
237
232
}
238
233
239
- writel (DMA_SIZE , adata -> acp_base + reg_dma_size );
240
- writel (acp_fifo_addr , adata -> acp_base + reg_fifo_addr );
241
- writel (FIFO_SIZE , adata -> acp_base + reg_fifo_size );
234
+ writel (DMA_SIZE , chip -> base + reg_dma_size );
235
+ writel (acp_fifo_addr , chip -> base + reg_fifo_addr );
236
+ writel (FIFO_SIZE , chip -> base + reg_fifo_size );
242
237
243
238
ext_int_ctrl = readl (ACP_EXTERNAL_INTR_CNTL (chip , rsrc -> irqp_used ));
244
239
ext_int_ctrl |= BIT (I2S_RX_THRESHOLD (rsrc -> offset )) |
@@ -253,7 +248,7 @@ static int set_acp_i2s_dma_fifo(struct snd_pcm_substream *substream,
253
248
}
254
249
255
250
int restore_acp_i2s_params (struct snd_pcm_substream * substream ,
256
- struct acp_dev_data * adata ,
251
+ struct acp_chip_info * chip ,
257
252
struct acp_stream * stream )
258
253
{
259
254
struct snd_soc_dai * dai ;
@@ -263,7 +258,7 @@ int restore_acp_i2s_params(struct snd_pcm_substream *substream,
263
258
soc_runtime = snd_soc_substream_to_rtd (substream );
264
259
dai = snd_soc_rtd_to_cpu (soc_runtime , 0 );
265
260
if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK ) {
266
- tdm_fmt = adata -> tdm_tx_fmt [stream -> dai_id - 1 ];
261
+ tdm_fmt = chip -> tdm_tx_fmt [stream -> dai_id - 1 ];
267
262
switch (stream -> dai_id ) {
268
263
case I2S_BT_INSTANCE :
269
264
reg_val = ACP_BTTDM_ITER ;
@@ -281,9 +276,9 @@ int restore_acp_i2s_params(struct snd_pcm_substream *substream,
281
276
pr_err ("Invalid dai id %x\n" , stream -> dai_id );
282
277
return - EINVAL ;
283
278
}
284
- val = adata -> xfer_tx_resolution [stream -> dai_id - 1 ] << 3 ;
279
+ val = chip -> xfer_tx_resolution [stream -> dai_id - 1 ] << 3 ;
285
280
} else {
286
- tdm_fmt = adata -> tdm_rx_fmt [stream -> dai_id - 1 ];
281
+ tdm_fmt = chip -> tdm_rx_fmt [stream -> dai_id - 1 ];
287
282
switch (stream -> dai_id ) {
288
283
case I2S_BT_INSTANCE :
289
284
reg_val = ACP_BTTDM_IRER ;
@@ -301,13 +296,13 @@ int restore_acp_i2s_params(struct snd_pcm_substream *substream,
301
296
pr_err ("Invalid dai id %x\n" , stream -> dai_id );
302
297
return - EINVAL ;
303
298
}
304
- val = adata -> xfer_rx_resolution [stream -> dai_id - 1 ] << 3 ;
299
+ val = chip -> xfer_rx_resolution [stream -> dai_id - 1 ] << 3 ;
305
300
}
306
- writel (val , adata -> acp_base + reg_val );
307
- if (adata -> tdm_mode == TDM_ENABLE ) {
308
- writel (tdm_fmt , adata -> acp_base + fmt_reg );
309
- val = readl (adata -> acp_base + reg_val );
310
- writel (val | 0x2 , adata -> acp_base + reg_val );
301
+ writel (val , chip -> base + reg_val );
302
+ if (chip -> tdm_mode == TDM_ENABLE ) {
303
+ writel (tdm_fmt , chip -> base + fmt_reg );
304
+ val = readl (chip -> base + reg_val );
305
+ writel (val | 0x2 , chip -> base + reg_val );
311
306
}
312
307
return set_acp_i2s_dma_fifo (substream , dai );
313
308
}
0 commit comments