~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/sound/soc/pxa/pxa2xx-ac97.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /sound/soc/pxa/pxa2xx-ac97.c (Version linux-6.12-rc7) and /sound/soc/pxa/pxa2xx-ac97.c (Version ccs-tools-1.8.12)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /*                                                
  3  * linux/sound/pxa2xx-ac97.c -- AC97 support f    
  4  *                                                
  5  * Author:      Nicolas Pitre                     
  6  * Created:     Dec 02, 2004                      
  7  * Copyright:   MontaVista Software Inc.          
  8  */                                               
  9                                                   
 10 #include <linux/init.h>                           
 11 #include <linux/io.h>                             
 12 #include <linux/module.h>                         
 13 #include <linux/platform_device.h>                
 14 #include <linux/dmaengine.h>                      
 15 #include <linux/dma/pxa-dma.h>                    
 16                                                   
 17 #include <sound/ac97/controller.h>                
 18 #include <sound/core.h>                           
 19 #include <sound/ac97_codec.h>                     
 20 #include <sound/soc.h>                            
 21 #include <sound/pxa2xx-lib.h>                     
 22 #include <sound/dmaengine_pcm.h>                  
 23                                                   
 24 #include <linux/platform_data/asoc-pxa.h>         
 25                                                   
 26 #define PCDR    0x0040  /* PCM FIFO Data Regis    
 27 #define MODR    0x0140  /* Modem FIFO Data Reg    
 28 #define MCDR    0x0060  /* Mic-in FIFO Data Re    
 29                                                   
 30 static void pxa2xx_ac97_warm_reset(struct ac97    
 31 {                                                 
 32         pxa2xx_ac97_try_warm_reset();             
 33                                                   
 34         pxa2xx_ac97_finish_reset();               
 35 }                                                 
 36                                                   
 37 static void pxa2xx_ac97_cold_reset(struct ac97    
 38 {                                                 
 39         pxa2xx_ac97_try_cold_reset();             
 40                                                   
 41         pxa2xx_ac97_finish_reset();               
 42 }                                                 
 43                                                   
 44 static int pxa2xx_ac97_read_actrl(struct ac97_    
 45                                   unsigned sho    
 46 {                                                 
 47         return pxa2xx_ac97_read(slot, reg);       
 48 }                                                 
 49                                                   
 50 static int pxa2xx_ac97_write_actrl(struct ac97    
 51                                    unsigned sh    
 52 {                                                 
 53         return pxa2xx_ac97_write(slot, reg, va    
 54 }                                                 
 55                                                   
 56 static struct ac97_controller_ops pxa2xx_ac97_    
 57         .read   = pxa2xx_ac97_read_actrl,         
 58         .write  = pxa2xx_ac97_write_actrl,        
 59         .warm_reset     = pxa2xx_ac97_warm_res    
 60         .reset  = pxa2xx_ac97_cold_reset,         
 61 };                                                
 62                                                   
 63 static struct snd_dmaengine_dai_dma_data pxa2x    
 64         .addr_width     = DMA_SLAVE_BUSWIDTH_4    
 65         .chan_name      = "pcm_pcm_stereo_in",    
 66         .maxburst       = 32,                     
 67 };                                                
 68                                                   
 69 static struct snd_dmaengine_dai_dma_data pxa2x    
 70         .addr_width     = DMA_SLAVE_BUSWIDTH_4    
 71         .chan_name      = "pcm_pcm_stereo_out"    
 72         .maxburst       = 32,                     
 73 };                                                
 74                                                   
 75 static struct snd_dmaengine_dai_dma_data pxa2x    
 76         .addr_width     = DMA_SLAVE_BUSWIDTH_2    
 77         .chan_name      = "pcm_aux_mono_out",     
 78         .maxburst       = 16,                     
 79 };                                                
 80                                                   
 81 static struct snd_dmaengine_dai_dma_data pxa2x    
 82         .addr_width     = DMA_SLAVE_BUSWIDTH_2    
 83         .chan_name      = "pcm_aux_mono_in",      
 84         .maxburst       = 16,                     
 85 };                                                
 86                                                   
 87 static struct snd_dmaengine_dai_dma_data pxa2x    
 88         .addr_width     = DMA_SLAVE_BUSWIDTH_2    
 89         .chan_name      = "pcm_aux_mic_mono",     
 90         .maxburst       = 16,                     
 91 };                                                
 92                                                   
 93 static int pxa2xx_ac97_hifi_startup(struct snd    
 94                                     struct snd    
 95 {                                                 
 96         struct snd_dmaengine_dai_dma_data *dma    
 97                                                   
 98         if (substream->stream == SNDRV_PCM_STR    
 99                 dma_data = &pxa2xx_ac97_pcm_st    
100         else                                      
101                 dma_data = &pxa2xx_ac97_pcm_st    
102                                                   
103         snd_soc_dai_set_dma_data(cpu_dai, subs    
104                                                   
105         return 0;                                 
106 }                                                 
107                                                   
108 static int pxa2xx_ac97_aux_startup(struct snd_    
109                                    struct snd_    
110 {                                                 
111         struct snd_dmaengine_dai_dma_data *dma    
112                                                   
113         if (substream->stream == SNDRV_PCM_STR    
114                 dma_data = &pxa2xx_ac97_pcm_au    
115         else                                      
116                 dma_data = &pxa2xx_ac97_pcm_au    
117                                                   
118         snd_soc_dai_set_dma_data(cpu_dai, subs    
119                                                   
120         return 0;                                 
121 }                                                 
122                                                   
123 static int pxa2xx_ac97_mic_startup(struct snd_    
124                                    struct snd_    
125 {                                                 
126         if (substream->stream == SNDRV_PCM_STR    
127                 return -ENODEV;                   
128         snd_soc_dai_set_dma_data(cpu_dai, subs    
129                                  &pxa2xx_ac97_    
130                                                   
131         return 0;                                 
132 }                                                 
133                                                   
134 #define PXA2XX_AC97_RATES (SNDRV_PCM_RATE_8000    
135                 SNDRV_PCM_RATE_16000 | SNDRV_P    
136                 SNDRV_PCM_RATE_48000)             
137                                                   
138 static const struct snd_soc_dai_ops pxa_ac97_h    
139         .startup        = pxa2xx_ac97_hifi_sta    
140 };                                                
141                                                   
142 static const struct snd_soc_dai_ops pxa_ac97_a    
143         .startup        = pxa2xx_ac97_aux_star    
144 };                                                
145                                                   
146 static const struct snd_soc_dai_ops pxa_ac97_m    
147         .startup        = pxa2xx_ac97_mic_star    
148 };                                                
149                                                   
150 /*                                                
151  * There is only 1 physical AC97 interface for    
152  * has extra fifo's that can be used for aux D    
153  */                                               
154 static struct snd_soc_dai_driver pxa_ac97_dai_    
155 {                                                 
156         .name = "pxa2xx-ac97",                    
157         .playback = {                             
158                 .stream_name = "AC97 Playback"    
159                 .channels_min = 2,                
160                 .channels_max = 2,                
161                 .rates = PXA2XX_AC97_RATES,       
162                 .formats = SNDRV_PCM_FMTBIT_S1    
163         .capture = {                              
164                 .stream_name = "AC97 Capture",    
165                 .channels_min = 2,                
166                 .channels_max = 2,                
167                 .rates = PXA2XX_AC97_RATES,       
168                 .formats = SNDRV_PCM_FMTBIT_S1    
169         .ops = &pxa_ac97_hifi_dai_ops,            
170 },                                                
171 {                                                 
172         .name = "pxa2xx-ac97-aux",                
173         .playback = {                             
174                 .stream_name = "AC97 Aux Playb    
175                 .channels_min = 1,                
176                 .channels_max = 1,                
177                 .rates = PXA2XX_AC97_RATES,       
178                 .formats = SNDRV_PCM_FMTBIT_S1    
179         .capture = {                              
180                 .stream_name = "AC97 Aux Captu    
181                 .channels_min = 1,                
182                 .channels_max = 1,                
183                 .rates = PXA2XX_AC97_RATES,       
184                 .formats = SNDRV_PCM_FMTBIT_S1    
185         .ops = &pxa_ac97_aux_dai_ops,             
186 },                                                
187 {                                                 
188         .name = "pxa2xx-ac97-mic",                
189         .capture = {                              
190                 .stream_name = "AC97 Mic Captu    
191                 .channels_min = 1,                
192                 .channels_max = 1,                
193                 .rates = PXA2XX_AC97_RATES,       
194                 .formats = SNDRV_PCM_FMTBIT_S1    
195         .ops = &pxa_ac97_mic_dai_ops,             
196 },                                                
197 };                                                
198                                                   
199 static const struct snd_soc_component_driver p    
200         .name           = "pxa-ac97",             
201         .pcm_construct  = pxa2xx_soc_pcm_new,     
202         .open           = pxa2xx_soc_pcm_open,    
203         .close          = pxa2xx_soc_pcm_close    
204         .hw_params      = pxa2xx_soc_pcm_hw_pa    
205         .prepare        = pxa2xx_soc_pcm_prepa    
206         .trigger        = pxa2xx_soc_pcm_trigg    
207         .pointer        = pxa2xx_soc_pcm_point    
208 };                                                
209                                                   
210 #ifdef CONFIG_OF                                  
211 static const struct of_device_id pxa2xx_ac97_d    
212         { .compatible = "marvell,pxa250-ac97",    
213         { .compatible = "marvell,pxa270-ac97",    
214         { .compatible = "marvell,pxa300-ac97",    
215         { }                                       
216 };                                                
217 MODULE_DEVICE_TABLE(of, pxa2xx_ac97_dt_ids);      
218                                                   
219 #endif                                            
220                                                   
221 static int pxa2xx_ac97_dev_probe(struct platfo    
222 {                                                 
223         int ret;                                  
224         struct ac97_controller *ctrl;             
225         pxa2xx_audio_ops_t *pdata = pdev->dev.    
226         struct resource *regs;                    
227         void **codecs_pdata;                      
228                                                   
229         if (pdev->id != -1) {                     
230                 dev_err(&pdev->dev, "PXA2xx ha    
231                 return -ENXIO;                    
232         }                                         
233                                                   
234         regs = platform_get_resource(pdev, IOR    
235         if (!regs)                                
236                 return -ENXIO;                    
237                                                   
238         pxa2xx_ac97_pcm_stereo_in.addr = regs-    
239         pxa2xx_ac97_pcm_stereo_out.addr = regs    
240         pxa2xx_ac97_pcm_aux_mono_out.addr = re    
241         pxa2xx_ac97_pcm_aux_mono_in.addr = reg    
242         pxa2xx_ac97_pcm_mic_mono_in.addr = reg    
243                                                   
244         ret = pxa2xx_ac97_hw_probe(pdev);         
245         if (ret) {                                
246                 dev_err(&pdev->dev, "PXA2xx AC    
247                 return ret;                       
248         }                                         
249                                                   
250         codecs_pdata = pdata ? pdata->codec_pd    
251         ctrl = snd_ac97_controller_register(&p    
252                                             AC    
253                                             co    
254         if (IS_ERR(ctrl))                         
255                 return PTR_ERR(ctrl);             
256                                                   
257         platform_set_drvdata(pdev, ctrl);         
258         /* Punt most of the init to the SoC pr    
259          * driver to do interesting things wit    
260          * and running.                           
261          */                                       
262         return devm_snd_soc_register_component    
263                                           pxa_    
264 }                                                 
265                                                   
266 static void pxa2xx_ac97_dev_remove(struct plat    
267 {                                                 
268         struct ac97_controller *ctrl = platfor    
269                                                   
270         snd_ac97_controller_unregister(ctrl);     
271         pxa2xx_ac97_hw_remove(pdev);              
272 }                                                 
273                                                   
274 static int pxa2xx_ac97_dev_suspend(struct devi    
275 {                                                 
276         return pxa2xx_ac97_hw_suspend();          
277 }                                                 
278                                                   
279 static int pxa2xx_ac97_dev_resume(struct devic    
280 {                                                 
281         return pxa2xx_ac97_hw_resume();           
282 }                                                 
283                                                   
284 static DEFINE_SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm    
285                 pxa2xx_ac97_dev_suspend, pxa2x    
286                                                   
287 static struct platform_driver pxa2xx_ac97_driv    
288         .probe          = pxa2xx_ac97_dev_prob    
289         .remove         = pxa2xx_ac97_dev_remo    
290         .driver         = {                       
291                 .name   = "pxa2xx-ac97",          
292                 .pm     = &pxa2xx_ac97_pm_ops,    
293                 .of_match_table = of_match_ptr    
294         },                                        
295 };                                                
296                                                   
297 module_platform_driver(pxa2xx_ac97_driver);       
298                                                   
299 MODULE_AUTHOR("Nicolas Pitre");                   
300 MODULE_DESCRIPTION("AC97 driver for the Intel     
301 MODULE_LICENSE("GPL");                            
302 MODULE_ALIAS("platform:pxa2xx-ac97");             
303                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php