@@ -233,7 +233,6 @@ struct fsi_stream {
233233 */
234234 struct dma_chan * chan ;
235235 struct work_struct work ;
236- dma_addr_t dma ;
237236 int dma_id ;
238237 int loop_cnt ;
239238 int additional_pos ;
@@ -1279,11 +1278,6 @@ static irqreturn_t fsi_interrupt(int irq, void *data)
12791278 */
12801279static int fsi_dma_init (struct fsi_priv * fsi , struct fsi_stream * io )
12811280{
1282- struct snd_pcm_runtime * runtime = io -> substream -> runtime ;
1283- struct snd_soc_dai * dai = fsi_get_dai (io -> substream );
1284- enum dma_data_direction dir = fsi_stream_is_play (fsi , io ) ?
1285- DMA_TO_DEVICE : DMA_FROM_DEVICE ;
1286-
12871281 /*
12881282 * 24bit data : 24bit bus / package in back
12891283 * 16bit data : 16bit bus / stream mode
@@ -1293,19 +1287,7 @@ static int fsi_dma_init(struct fsi_priv *fsi, struct fsi_stream *io)
12931287
12941288 io -> loop_cnt = 2 ; /* push 1st, 2nd period first, then 3rd, 4th... */
12951289 io -> additional_pos = 0 ;
1296- io -> dma = dma_map_single (dai -> dev , runtime -> dma_area ,
1297- snd_pcm_lib_buffer_bytes (io -> substream ), dir );
1298- return 0 ;
1299- }
1300-
1301- static int fsi_dma_quit (struct fsi_priv * fsi , struct fsi_stream * io )
1302- {
1303- struct snd_soc_dai * dai = fsi_get_dai (io -> substream );
1304- enum dma_data_direction dir = fsi_stream_is_play (fsi , io ) ?
1305- DMA_TO_DEVICE : DMA_FROM_DEVICE ;
13061290
1307- dma_unmap_single (dai -> dev , io -> dma ,
1308- snd_pcm_lib_buffer_bytes (io -> substream ), dir );
13091291 return 0 ;
13101292}
13111293
@@ -1317,20 +1299,15 @@ static dma_addr_t fsi_dma_get_area(struct fsi_stream *io, int additional)
13171299 if (period >= runtime -> periods )
13181300 period = 0 ;
13191301
1320- return io -> dma + samples_to_bytes (runtime , period * io -> period_samples );
1302+ return runtime -> dma_addr +
1303+ samples_to_bytes (runtime , period * io -> period_samples );
13211304}
13221305
13231306static void fsi_dma_complete (void * data )
13241307{
13251308 struct fsi_stream * io = (struct fsi_stream * )data ;
13261309 struct fsi_priv * fsi = fsi_stream_to_priv (io );
13271310 struct snd_pcm_runtime * runtime = io -> substream -> runtime ;
1328- struct snd_soc_dai * dai = fsi_get_dai (io -> substream );
1329- enum dma_data_direction dir = fsi_stream_is_play (fsi , io ) ?
1330- DMA_TO_DEVICE : DMA_FROM_DEVICE ;
1331-
1332- dma_sync_single_for_cpu (dai -> dev , fsi_dma_get_area (io , 0 ),
1333- samples_to_bytes (runtime , io -> period_samples ), dir );
13341311
13351312 io -> buff_sample_pos += io -> period_samples ;
13361313 io -> period_pos ++ ;
@@ -1369,8 +1346,6 @@ static void fsi_dma_do_work(struct work_struct *work)
13691346 for (i = 0 ; i < io -> loop_cnt ; i ++ ) {
13701347 buf = fsi_dma_get_area (io , io -> additional_pos );
13711348
1372- dma_sync_single_for_device (dai -> dev , buf , len , dir );
1373-
13741349 desc = dmaengine_prep_slave_single (io -> chan , buf , len , dir ,
13751350 DMA_PREP_INTERRUPT | DMA_CTRL_ACK );
13761351 if (!desc ) {
@@ -1495,7 +1470,6 @@ static int fsi_dma_remove(struct fsi_priv *fsi, struct fsi_stream *io)
14951470
14961471static struct fsi_stream_handler fsi_dma_push_handler = {
14971472 .init = fsi_dma_init ,
1498- .quit = fsi_dma_quit ,
14991473 .probe = fsi_dma_probe ,
15001474 .transfer = fsi_dma_transfer ,
15011475 .remove = fsi_dma_remove ,
@@ -1850,16 +1824,10 @@ static void fsi_pcm_free(struct snd_pcm *pcm)
18501824
18511825static int fsi_pcm_new (struct snd_soc_pcm_runtime * rtd )
18521826{
1853- struct snd_pcm * pcm = rtd -> pcm ;
1854-
1855- /*
1856- * dont use SNDRV_DMA_TYPE_DEV, since it will oops the SH kernel
1857- * in MMAP mode (i.e. aplay -M)
1858- */
18591827 return snd_pcm_lib_preallocate_pages_for_all (
1860- pcm ,
1861- SNDRV_DMA_TYPE_CONTINUOUS ,
1862- snd_dma_continuous_data ( GFP_KERNEL ) ,
1828+ rtd -> pcm ,
1829+ SNDRV_DMA_TYPE_DEV ,
1830+ rtd -> card -> snd_card -> dev ,
18631831 PREALLOC_BUFFER , PREALLOC_BUFFER_MAX );
18641832}
18651833
0 commit comments