2 * pxa-ssp.c -- ALSA Soc Audio Layer
4 * Copyright 2005,2008 Wolfson Microelectronics PLC.
5 * Author: Liam Girdwood
6 * Mark Brown <broonie@opensource.wolfsonmicro.com>
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
14 * o Test network mode for > 16bit sample size
17 #include <linux/init.h>
18 #include <linux/module.h>
19 #include <linux/slab.h>
20 #include <linux/platform_device.h>
21 #include <linux/clk.h>
23 #include <linux/pxa2xx_ssp.h>
25 #include <linux/dmaengine.h>
29 #include <sound/core.h>
30 #include <sound/pcm.h>
31 #include <sound/initval.h>
32 #include <sound/pcm_params.h>
33 #include <sound/soc.h>
34 #include <sound/pxa2xx-lib.h>
35 #include <sound/dmaengine_pcm.h>
37 #include <mach/hardware.h>
39 #include "../../arm/pxa2xx-pcm.h"
43 * SSP audio private data
46 struct ssp_device
*ssp
;
57 static void dump_registers(struct ssp_device
*ssp
)
59 dev_dbg(&ssp
->pdev
->dev
, "SSCR0 0x%08x SSCR1 0x%08x SSTO 0x%08x\n",
60 pxa_ssp_read_reg(ssp
, SSCR0
), pxa_ssp_read_reg(ssp
, SSCR1
),
61 pxa_ssp_read_reg(ssp
, SSTO
));
63 dev_dbg(&ssp
->pdev
->dev
, "SSPSP 0x%08x SSSR 0x%08x SSACD 0x%08x\n",
64 pxa_ssp_read_reg(ssp
, SSPSP
), pxa_ssp_read_reg(ssp
, SSSR
),
65 pxa_ssp_read_reg(ssp
, SSACD
));
68 static void pxa_ssp_enable(struct ssp_device
*ssp
)
72 sscr0
= __raw_readl(ssp
->mmio_base
+ SSCR0
) | SSCR0_SSE
;
73 __raw_writel(sscr0
, ssp
->mmio_base
+ SSCR0
);
76 static void pxa_ssp_disable(struct ssp_device
*ssp
)
80 sscr0
= __raw_readl(ssp
->mmio_base
+ SSCR0
) & ~SSCR0_SSE
;
81 __raw_writel(sscr0
, ssp
->mmio_base
+ SSCR0
);
84 static void pxa_ssp_set_dma_params(struct ssp_device
*ssp
, int width4
,
85 int out
, struct snd_dmaengine_dai_dma_data
*dma
)
87 dma
->addr_width
= width4
? DMA_SLAVE_BUSWIDTH_4_BYTES
:
88 DMA_SLAVE_BUSWIDTH_2_BYTES
;
90 dma
->addr
= ssp
->phys_base
+ SSDR
;
93 static int pxa_ssp_startup(struct snd_pcm_substream
*substream
,
94 struct snd_soc_dai
*cpu_dai
)
96 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
97 struct ssp_device
*ssp
= priv
->ssp
;
98 struct snd_dmaengine_dai_dma_data
*dma
;
101 if (!cpu_dai
->active
) {
102 clk_enable(ssp
->clk
);
103 pxa_ssp_disable(ssp
);
106 dma
= kzalloc(sizeof(struct snd_dmaengine_dai_dma_data
), GFP_KERNEL
);
110 dma
->filter_data
= substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
?
111 &ssp
->drcmr_tx
: &ssp
->drcmr_rx
;
113 snd_soc_dai_set_dma_data(cpu_dai
, substream
, dma
);
118 static void pxa_ssp_shutdown(struct snd_pcm_substream
*substream
,
119 struct snd_soc_dai
*cpu_dai
)
121 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
122 struct ssp_device
*ssp
= priv
->ssp
;
124 if (!cpu_dai
->active
) {
125 pxa_ssp_disable(ssp
);
126 clk_disable(ssp
->clk
);
129 kfree(snd_soc_dai_get_dma_data(cpu_dai
, substream
));
130 snd_soc_dai_set_dma_data(cpu_dai
, substream
, NULL
);
135 static int pxa_ssp_suspend(struct snd_soc_dai
*cpu_dai
)
137 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
138 struct ssp_device
*ssp
= priv
->ssp
;
140 if (!cpu_dai
->active
)
141 clk_enable(ssp
->clk
);
143 priv
->cr0
= __raw_readl(ssp
->mmio_base
+ SSCR0
);
144 priv
->cr1
= __raw_readl(ssp
->mmio_base
+ SSCR1
);
145 priv
->to
= __raw_readl(ssp
->mmio_base
+ SSTO
);
146 priv
->psp
= __raw_readl(ssp
->mmio_base
+ SSPSP
);
148 pxa_ssp_disable(ssp
);
149 clk_disable(ssp
->clk
);
153 static int pxa_ssp_resume(struct snd_soc_dai
*cpu_dai
)
155 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
156 struct ssp_device
*ssp
= priv
->ssp
;
157 uint32_t sssr
= SSSR_ROR
| SSSR_TUR
| SSSR_BCE
;
159 clk_enable(ssp
->clk
);
161 __raw_writel(sssr
, ssp
->mmio_base
+ SSSR
);
162 __raw_writel(priv
->cr0
& ~SSCR0_SSE
, ssp
->mmio_base
+ SSCR0
);
163 __raw_writel(priv
->cr1
, ssp
->mmio_base
+ SSCR1
);
164 __raw_writel(priv
->to
, ssp
->mmio_base
+ SSTO
);
165 __raw_writel(priv
->psp
, ssp
->mmio_base
+ SSPSP
);
170 clk_disable(ssp
->clk
);
176 #define pxa_ssp_suspend NULL
177 #define pxa_ssp_resume NULL
181 * ssp_set_clkdiv - set SSP clock divider
182 * @div: serial clock rate divider
184 static void pxa_ssp_set_scr(struct ssp_device
*ssp
, u32 div
)
186 u32 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
188 if (ssp
->type
== PXA25x_SSP
) {
189 sscr0
&= ~0x0000ff00;
190 sscr0
|= ((div
- 2)/2) << 8; /* 2..512 */
192 sscr0
&= ~0x000fff00;
193 sscr0
|= (div
- 1) << 8; /* 1..4096 */
195 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
199 * pxa_ssp_get_clkdiv - get SSP clock divider
201 static u32
pxa_ssp_get_scr(struct ssp_device
*ssp
)
203 u32 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
206 if (ssp
->type
== PXA25x_SSP
)
207 div
= ((sscr0
>> 8) & 0xff) * 2 + 2;
209 div
= ((sscr0
>> 8) & 0xfff) + 1;
214 * Set the SSP ports SYSCLK.
216 static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai
*cpu_dai
,
217 int clk_id
, unsigned int freq
, int dir
)
219 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
220 struct ssp_device
*ssp
= priv
->ssp
;
223 u32 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
) &
224 ~(SSCR0_ECS
| SSCR0_NCS
| SSCR0_MOD
| SSCR0_ACS
);
226 dev_dbg(&ssp
->pdev
->dev
,
227 "pxa_ssp_set_dai_sysclk id: %d, clk_id %d, freq %u\n",
228 cpu_dai
->id
, clk_id
, freq
);
231 case PXA_SSP_CLK_NET_PLL
:
234 case PXA_SSP_CLK_PLL
:
235 /* Internal PLL is fixed */
236 if (ssp
->type
== PXA25x_SSP
)
237 priv
->sysclk
= 1843200;
239 priv
->sysclk
= 13000000;
241 case PXA_SSP_CLK_EXT
:
245 case PXA_SSP_CLK_NET
:
247 sscr0
|= SSCR0_NCS
| SSCR0_MOD
;
249 case PXA_SSP_CLK_AUDIO
:
251 pxa_ssp_set_scr(ssp
, 1);
258 /* The SSP clock must be disabled when changing SSP clock mode
259 * on PXA2xx. On PXA3xx it must be enabled when doing so. */
260 if (ssp
->type
!= PXA3xx_SSP
)
261 clk_disable(ssp
->clk
);
262 val
= pxa_ssp_read_reg(ssp
, SSCR0
) | sscr0
;
263 pxa_ssp_write_reg(ssp
, SSCR0
, val
);
264 if (ssp
->type
!= PXA3xx_SSP
)
265 clk_enable(ssp
->clk
);
271 * Set the SSP clock dividers.
273 static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai
*cpu_dai
,
276 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
277 struct ssp_device
*ssp
= priv
->ssp
;
281 case PXA_SSP_AUDIO_DIV_ACDS
:
282 val
= (pxa_ssp_read_reg(ssp
, SSACD
) & ~0x7) | SSACD_ACDS(div
);
283 pxa_ssp_write_reg(ssp
, SSACD
, val
);
285 case PXA_SSP_AUDIO_DIV_SCDB
:
286 val
= pxa_ssp_read_reg(ssp
, SSACD
);
288 if (ssp
->type
== PXA3xx_SSP
)
291 case PXA_SSP_CLK_SCDB_1
:
294 case PXA_SSP_CLK_SCDB_4
:
296 case PXA_SSP_CLK_SCDB_8
:
297 if (ssp
->type
== PXA3xx_SSP
)
305 pxa_ssp_write_reg(ssp
, SSACD
, val
);
307 case PXA_SSP_DIV_SCR
:
308 pxa_ssp_set_scr(ssp
, div
);
318 * Configure the PLL frequency pxa27x and (afaik - pxa320 only)
320 static int pxa_ssp_set_dai_pll(struct snd_soc_dai
*cpu_dai
, int pll_id
,
321 int source
, unsigned int freq_in
, unsigned int freq_out
)
323 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
324 struct ssp_device
*ssp
= priv
->ssp
;
325 u32 ssacd
= pxa_ssp_read_reg(ssp
, SSACD
) & ~0x70;
327 if (ssp
->type
== PXA3xx_SSP
)
328 pxa_ssp_write_reg(ssp
, SSACDD
, 0);
353 /* PXA3xx has a clock ditherer which can be used to generate
354 * a wider range of frequencies - calculate a value for it.
356 if (ssp
->type
== PXA3xx_SSP
) {
360 do_div(tmp
, freq_out
);
363 val
= (val
<< 16) | 64;
364 pxa_ssp_write_reg(ssp
, SSACDD
, val
);
368 dev_dbg(&ssp
->pdev
->dev
,
369 "Using SSACDD %x to supply %uHz\n",
377 pxa_ssp_write_reg(ssp
, SSACD
, ssacd
);
383 * Set the active slots in TDM/Network mode
385 static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai
*cpu_dai
,
386 unsigned int tx_mask
, unsigned int rx_mask
, int slots
, int slot_width
)
388 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
389 struct ssp_device
*ssp
= priv
->ssp
;
392 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
393 sscr0
&= ~(SSCR0_MOD
| SSCR0_SlotsPerFrm(8) | SSCR0_EDSS
| SSCR0_DSS
);
397 sscr0
|= SSCR0_EDSS
| SSCR0_DataSize(slot_width
- 16);
399 sscr0
|= SSCR0_DataSize(slot_width
);
402 /* enable network mode */
405 /* set number of active slots */
406 sscr0
|= SSCR0_SlotsPerFrm(slots
);
408 /* set active slot mask */
409 pxa_ssp_write_reg(ssp
, SSTSA
, tx_mask
);
410 pxa_ssp_write_reg(ssp
, SSRSA
, rx_mask
);
412 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
418 * Tristate the SSP DAI lines
420 static int pxa_ssp_set_dai_tristate(struct snd_soc_dai
*cpu_dai
,
423 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
424 struct ssp_device
*ssp
= priv
->ssp
;
427 sscr1
= pxa_ssp_read_reg(ssp
, SSCR1
);
432 pxa_ssp_write_reg(ssp
, SSCR1
, sscr1
);
438 * Set up the SSP DAI format.
439 * The SSP Port must be inactive before calling this function as the
440 * physical interface format is changed.
442 static int pxa_ssp_set_dai_fmt(struct snd_soc_dai
*cpu_dai
,
445 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
446 struct ssp_device
*ssp
= priv
->ssp
;
447 u32 sscr0
, sscr1
, sspsp
, scfr
;
449 /* check if we need to change anything at all */
450 if (priv
->dai_fmt
== fmt
)
453 /* we can only change the settings if the port is not in use */
454 if (pxa_ssp_read_reg(ssp
, SSCR0
) & SSCR0_SSE
) {
455 dev_err(&ssp
->pdev
->dev
,
456 "can't change hardware dai format: stream is in use");
460 /* reset port settings */
461 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
) &
462 ~(SSCR0_ECS
| SSCR0_NCS
| SSCR0_MOD
| SSCR0_ACS
);
463 sscr1
= SSCR1_RxTresh(8) | SSCR1_TxTresh(7);
466 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
467 case SND_SOC_DAIFMT_CBM_CFM
:
468 sscr1
|= SSCR1_SCLKDIR
| SSCR1_SFRMDIR
| SSCR1_SCFR
;
470 case SND_SOC_DAIFMT_CBM_CFS
:
471 sscr1
|= SSCR1_SCLKDIR
| SSCR1_SCFR
;
473 case SND_SOC_DAIFMT_CBS_CFS
:
479 switch (fmt
& SND_SOC_DAIFMT_INV_MASK
) {
480 case SND_SOC_DAIFMT_NB_NF
:
481 sspsp
|= SSPSP_SFRMP
;
483 case SND_SOC_DAIFMT_NB_IF
:
485 case SND_SOC_DAIFMT_IB_IF
:
486 sspsp
|= SSPSP_SCMODE(2);
488 case SND_SOC_DAIFMT_IB_NF
:
489 sspsp
|= SSPSP_SCMODE(2) | SSPSP_SFRMP
;
495 switch (fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
496 case SND_SOC_DAIFMT_I2S
:
498 sscr1
|= SSCR1_RWOT
| SSCR1_TRAIL
;
499 /* See hw_params() */
502 case SND_SOC_DAIFMT_DSP_A
:
504 case SND_SOC_DAIFMT_DSP_B
:
505 sscr0
|= SSCR0_MOD
| SSCR0_PSP
;
506 sscr1
|= SSCR1_TRAIL
| SSCR1_RWOT
;
513 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
514 pxa_ssp_write_reg(ssp
, SSCR1
, sscr1
);
515 pxa_ssp_write_reg(ssp
, SSPSP
, sspsp
);
517 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
518 case SND_SOC_DAIFMT_CBM_CFM
:
519 case SND_SOC_DAIFMT_CBM_CFS
:
520 scfr
= pxa_ssp_read_reg(ssp
, SSCR1
) | SSCR1_SCFR
;
521 pxa_ssp_write_reg(ssp
, SSCR1
, scfr
);
523 while (pxa_ssp_read_reg(ssp
, SSSR
) & SSSR_BSY
)
530 /* Since we are configuring the timings for the format by hand
531 * we have to defer some things until hw_params() where we
532 * know parameters like the sample size.
540 * Set the SSP audio DMA parameters and sample size.
541 * Can be called multiple times by oss emulation.
543 static int pxa_ssp_hw_params(struct snd_pcm_substream
*substream
,
544 struct snd_pcm_hw_params
*params
,
545 struct snd_soc_dai
*cpu_dai
)
547 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
548 struct ssp_device
*ssp
= priv
->ssp
;
549 int chn
= params_channels(params
);
552 int width
= snd_pcm_format_physical_width(params_format(params
));
553 int ttsa
= pxa_ssp_read_reg(ssp
, SSTSA
) & 0xf;
554 struct snd_dmaengine_dai_dma_data
*dma_data
;
556 dma_data
= snd_soc_dai_get_dma_data(cpu_dai
, substream
);
558 /* Network mode with one active slot (ttsa == 1) can be used
559 * to force 16-bit frame width on the wire (for S16_LE), even
560 * with two channels. Use 16-bit DMA transfers for this case.
562 pxa_ssp_set_dma_params(ssp
,
563 ((chn
== 2) && (ttsa
!= 1)) || (width
== 32),
564 substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
, dma_data
);
566 /* we can only change the settings if the port is not in use */
567 if (pxa_ssp_read_reg(ssp
, SSCR0
) & SSCR0_SSE
)
570 /* clear selected SSP bits */
571 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
) & ~(SSCR0_DSS
| SSCR0_EDSS
);
574 switch (params_format(params
)) {
575 case SNDRV_PCM_FORMAT_S16_LE
:
576 if (ssp
->type
== PXA3xx_SSP
)
577 sscr0
|= SSCR0_FPCKE
;
578 sscr0
|= SSCR0_DataSize(16);
580 case SNDRV_PCM_FORMAT_S24_LE
:
581 sscr0
|= (SSCR0_EDSS
| SSCR0_DataSize(8));
583 case SNDRV_PCM_FORMAT_S32_LE
:
584 sscr0
|= (SSCR0_EDSS
| SSCR0_DataSize(16));
587 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
589 switch (priv
->dai_fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
590 case SND_SOC_DAIFMT_I2S
:
591 sspsp
= pxa_ssp_read_reg(ssp
, SSPSP
);
593 if ((pxa_ssp_get_scr(ssp
) == 4) && (width
== 16)) {
594 /* This is a special case where the bitclk is 64fs
595 * and we're not dealing with 2*32 bits of audio
598 * The SSP values used for that are all found out by
599 * trying and failing a lot; some of the registers
600 * needed for that mode are only available on PXA3xx.
602 if (ssp
->type
!= PXA3xx_SSP
)
605 sspsp
|= SSPSP_SFRMWDTH(width
* 2);
606 sspsp
|= SSPSP_SFRMDLY(width
* 4);
607 sspsp
|= SSPSP_EDMYSTOP(3);
608 sspsp
|= SSPSP_DMYSTOP(3);
609 sspsp
|= SSPSP_DMYSTRT(1);
611 /* The frame width is the width the LRCLK is
612 * asserted for; the delay is expressed in
613 * half cycle units. We need the extra cycle
614 * because the data starts clocking out one BCLK
615 * after LRCLK changes polarity.
617 sspsp
|= SSPSP_SFRMWDTH(width
+ 1);
618 sspsp
|= SSPSP_SFRMDLY((width
+ 1) * 2);
619 sspsp
|= SSPSP_DMYSTRT(1);
622 pxa_ssp_write_reg(ssp
, SSPSP
, sspsp
);
628 /* When we use a network mode, we always require TDM slots
629 * - complain loudly and fail if they've not been set up yet.
631 if ((sscr0
& SSCR0_MOD
) && !ttsa
) {
632 dev_err(&ssp
->pdev
->dev
, "No TDM timeslot configured\n");
641 static void pxa_ssp_set_running_bit(struct snd_pcm_substream
*substream
,
642 struct ssp_device
*ssp
, int value
)
644 uint32_t sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
645 uint32_t sscr1
= pxa_ssp_read_reg(ssp
, SSCR1
);
646 uint32_t sspsp
= pxa_ssp_read_reg(ssp
, SSPSP
);
647 uint32_t sssr
= pxa_ssp_read_reg(ssp
, SSSR
);
649 if (value
&& (sscr0
& SSCR0_SSE
))
650 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
& ~SSCR0_SSE
);
652 if (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
) {
656 sscr1
&= ~SSCR1_TSRE
;
661 sscr1
&= ~SSCR1_RSRE
;
664 pxa_ssp_write_reg(ssp
, SSCR1
, sscr1
);
667 pxa_ssp_write_reg(ssp
, SSSR
, sssr
);
668 pxa_ssp_write_reg(ssp
, SSPSP
, sspsp
);
669 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
| SSCR0_SSE
);
673 static int pxa_ssp_trigger(struct snd_pcm_substream
*substream
, int cmd
,
674 struct snd_soc_dai
*cpu_dai
)
677 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
678 struct ssp_device
*ssp
= priv
->ssp
;
682 case SNDRV_PCM_TRIGGER_RESUME
:
685 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE
:
686 pxa_ssp_set_running_bit(substream
, ssp
, 1);
687 val
= pxa_ssp_read_reg(ssp
, SSSR
);
688 pxa_ssp_write_reg(ssp
, SSSR
, val
);
690 case SNDRV_PCM_TRIGGER_START
:
691 pxa_ssp_set_running_bit(substream
, ssp
, 1);
693 case SNDRV_PCM_TRIGGER_STOP
:
694 pxa_ssp_set_running_bit(substream
, ssp
, 0);
696 case SNDRV_PCM_TRIGGER_SUSPEND
:
697 pxa_ssp_disable(ssp
);
699 case SNDRV_PCM_TRIGGER_PAUSE_PUSH
:
700 pxa_ssp_set_running_bit(substream
, ssp
, 0);
712 static int pxa_ssp_probe(struct snd_soc_dai
*dai
)
714 struct device
*dev
= dai
->dev
;
715 struct ssp_priv
*priv
;
718 priv
= kzalloc(sizeof(struct ssp_priv
), GFP_KERNEL
);
723 struct device_node
*ssp_handle
;
725 ssp_handle
= of_parse_phandle(dev
->of_node
, "port", 0);
727 dev_err(dev
, "unable to get 'port' phandle\n");
731 priv
->ssp
= pxa_ssp_request_of(ssp_handle
, "SoC audio");
732 if (priv
->ssp
== NULL
) {
737 priv
->ssp
= pxa_ssp_request(dai
->id
+ 1, "SoC audio");
738 if (priv
->ssp
== NULL
) {
744 priv
->dai_fmt
= (unsigned int) -1;
745 snd_soc_dai_set_drvdata(dai
, priv
);
754 static int pxa_ssp_remove(struct snd_soc_dai
*dai
)
756 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(dai
);
758 pxa_ssp_free(priv
->ssp
);
763 #define PXA_SSP_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 |\
764 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | \
765 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
766 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \
767 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
769 #define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
770 SNDRV_PCM_FMTBIT_S24_LE | \
771 SNDRV_PCM_FMTBIT_S32_LE)
773 static const struct snd_soc_dai_ops pxa_ssp_dai_ops
= {
774 .startup
= pxa_ssp_startup
,
775 .shutdown
= pxa_ssp_shutdown
,
776 .trigger
= pxa_ssp_trigger
,
777 .hw_params
= pxa_ssp_hw_params
,
778 .set_sysclk
= pxa_ssp_set_dai_sysclk
,
779 .set_clkdiv
= pxa_ssp_set_dai_clkdiv
,
780 .set_pll
= pxa_ssp_set_dai_pll
,
781 .set_fmt
= pxa_ssp_set_dai_fmt
,
782 .set_tdm_slot
= pxa_ssp_set_dai_tdm_slot
,
783 .set_tristate
= pxa_ssp_set_dai_tristate
,
786 static struct snd_soc_dai_driver pxa_ssp_dai
= {
787 .probe
= pxa_ssp_probe
,
788 .remove
= pxa_ssp_remove
,
789 .suspend
= pxa_ssp_suspend
,
790 .resume
= pxa_ssp_resume
,
794 .rates
= PXA_SSP_RATES
,
795 .formats
= PXA_SSP_FORMATS
,
800 .rates
= PXA_SSP_RATES
,
801 .formats
= PXA_SSP_FORMATS
,
803 .ops
= &pxa_ssp_dai_ops
,
806 static const struct snd_soc_component_driver pxa_ssp_component
= {
811 static const struct of_device_id pxa_ssp_of_ids
[] = {
812 { .compatible
= "mrvl,pxa-ssp-dai" },
816 static int asoc_ssp_probe(struct platform_device
*pdev
)
818 return snd_soc_register_component(&pdev
->dev
, &pxa_ssp_component
,
822 static int asoc_ssp_remove(struct platform_device
*pdev
)
824 snd_soc_unregister_component(&pdev
->dev
);
828 static struct platform_driver asoc_ssp_driver
= {
830 .name
= "pxa-ssp-dai",
831 .owner
= THIS_MODULE
,
832 .of_match_table
= of_match_ptr(pxa_ssp_of_ids
),
835 .probe
= asoc_ssp_probe
,
836 .remove
= asoc_ssp_remove
,
839 module_platform_driver(asoc_ssp_driver
);
841 /* Module information */
842 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
843 MODULE_DESCRIPTION("PXA SSP/PCM SoC Interface");
844 MODULE_LICENSE("GPL");