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 "../../arm/pxa2xx-pcm.h"
41 * SSP audio private data
44 struct ssp_device
*ssp
;
55 static void dump_registers(struct ssp_device
*ssp
)
57 dev_dbg(&ssp
->pdev
->dev
, "SSCR0 0x%08x SSCR1 0x%08x SSTO 0x%08x\n",
58 pxa_ssp_read_reg(ssp
, SSCR0
), pxa_ssp_read_reg(ssp
, SSCR1
),
59 pxa_ssp_read_reg(ssp
, SSTO
));
61 dev_dbg(&ssp
->pdev
->dev
, "SSPSP 0x%08x SSSR 0x%08x SSACD 0x%08x\n",
62 pxa_ssp_read_reg(ssp
, SSPSP
), pxa_ssp_read_reg(ssp
, SSSR
),
63 pxa_ssp_read_reg(ssp
, SSACD
));
66 static void pxa_ssp_enable(struct ssp_device
*ssp
)
70 sscr0
= __raw_readl(ssp
->mmio_base
+ SSCR0
) | SSCR0_SSE
;
71 __raw_writel(sscr0
, ssp
->mmio_base
+ SSCR0
);
74 static void pxa_ssp_disable(struct ssp_device
*ssp
)
78 sscr0
= __raw_readl(ssp
->mmio_base
+ SSCR0
) & ~SSCR0_SSE
;
79 __raw_writel(sscr0
, ssp
->mmio_base
+ SSCR0
);
82 static void pxa_ssp_set_dma_params(struct ssp_device
*ssp
, int width4
,
83 int out
, struct snd_dmaengine_dai_dma_data
*dma
)
85 dma
->addr_width
= width4
? DMA_SLAVE_BUSWIDTH_4_BYTES
:
86 DMA_SLAVE_BUSWIDTH_2_BYTES
;
88 dma
->addr
= ssp
->phys_base
+ SSDR
;
91 static int pxa_ssp_startup(struct snd_pcm_substream
*substream
,
92 struct snd_soc_dai
*cpu_dai
)
94 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
95 struct ssp_device
*ssp
= priv
->ssp
;
96 struct snd_dmaengine_dai_dma_data
*dma
;
99 if (!cpu_dai
->active
) {
100 clk_prepare_enable(ssp
->clk
);
101 pxa_ssp_disable(ssp
);
104 dma
= kzalloc(sizeof(struct snd_dmaengine_dai_dma_data
), GFP_KERNEL
);
108 dma
->filter_data
= substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
?
109 &ssp
->drcmr_tx
: &ssp
->drcmr_rx
;
111 snd_soc_dai_set_dma_data(cpu_dai
, substream
, dma
);
116 static void pxa_ssp_shutdown(struct snd_pcm_substream
*substream
,
117 struct snd_soc_dai
*cpu_dai
)
119 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
120 struct ssp_device
*ssp
= priv
->ssp
;
122 if (!cpu_dai
->active
) {
123 pxa_ssp_disable(ssp
);
124 clk_disable_unprepare(ssp
->clk
);
127 kfree(snd_soc_dai_get_dma_data(cpu_dai
, substream
));
128 snd_soc_dai_set_dma_data(cpu_dai
, substream
, NULL
);
133 static int pxa_ssp_suspend(struct snd_soc_dai
*cpu_dai
)
135 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
136 struct ssp_device
*ssp
= priv
->ssp
;
138 if (!cpu_dai
->active
)
139 clk_prepare_enable(ssp
->clk
);
141 priv
->cr0
= __raw_readl(ssp
->mmio_base
+ SSCR0
);
142 priv
->cr1
= __raw_readl(ssp
->mmio_base
+ SSCR1
);
143 priv
->to
= __raw_readl(ssp
->mmio_base
+ SSTO
);
144 priv
->psp
= __raw_readl(ssp
->mmio_base
+ SSPSP
);
146 pxa_ssp_disable(ssp
);
147 clk_disable_unprepare(ssp
->clk
);
151 static int pxa_ssp_resume(struct snd_soc_dai
*cpu_dai
)
153 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
154 struct ssp_device
*ssp
= priv
->ssp
;
155 uint32_t sssr
= SSSR_ROR
| SSSR_TUR
| SSSR_BCE
;
157 clk_prepare_enable(ssp
->clk
);
159 __raw_writel(sssr
, ssp
->mmio_base
+ SSSR
);
160 __raw_writel(priv
->cr0
& ~SSCR0_SSE
, ssp
->mmio_base
+ SSCR0
);
161 __raw_writel(priv
->cr1
, ssp
->mmio_base
+ SSCR1
);
162 __raw_writel(priv
->to
, ssp
->mmio_base
+ SSTO
);
163 __raw_writel(priv
->psp
, ssp
->mmio_base
+ SSPSP
);
168 clk_disable_unprepare(ssp
->clk
);
174 #define pxa_ssp_suspend NULL
175 #define pxa_ssp_resume NULL
179 * ssp_set_clkdiv - set SSP clock divider
180 * @div: serial clock rate divider
182 static void pxa_ssp_set_scr(struct ssp_device
*ssp
, u32 div
)
184 u32 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
186 if (ssp
->type
== PXA25x_SSP
) {
187 sscr0
&= ~0x0000ff00;
188 sscr0
|= ((div
- 2)/2) << 8; /* 2..512 */
190 sscr0
&= ~0x000fff00;
191 sscr0
|= (div
- 1) << 8; /* 1..4096 */
193 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
197 * pxa_ssp_get_clkdiv - get SSP clock divider
199 static u32
pxa_ssp_get_scr(struct ssp_device
*ssp
)
201 u32 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
204 if (ssp
->type
== PXA25x_SSP
)
205 div
= ((sscr0
>> 8) & 0xff) * 2 + 2;
207 div
= ((sscr0
>> 8) & 0xfff) + 1;
212 * Set the SSP ports SYSCLK.
214 static int pxa_ssp_set_dai_sysclk(struct snd_soc_dai
*cpu_dai
,
215 int clk_id
, unsigned int freq
, int dir
)
217 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
218 struct ssp_device
*ssp
= priv
->ssp
;
221 u32 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
) &
222 ~(SSCR0_ECS
| SSCR0_NCS
| SSCR0_MOD
| SSCR0_ACS
);
224 dev_dbg(&ssp
->pdev
->dev
,
225 "pxa_ssp_set_dai_sysclk id: %d, clk_id %d, freq %u\n",
226 cpu_dai
->id
, clk_id
, freq
);
229 case PXA_SSP_CLK_NET_PLL
:
232 case PXA_SSP_CLK_PLL
:
233 /* Internal PLL is fixed */
234 if (ssp
->type
== PXA25x_SSP
)
235 priv
->sysclk
= 1843200;
237 priv
->sysclk
= 13000000;
239 case PXA_SSP_CLK_EXT
:
243 case PXA_SSP_CLK_NET
:
245 sscr0
|= SSCR0_NCS
| SSCR0_MOD
;
247 case PXA_SSP_CLK_AUDIO
:
249 pxa_ssp_set_scr(ssp
, 1);
256 /* The SSP clock must be disabled when changing SSP clock mode
257 * on PXA2xx. On PXA3xx it must be enabled when doing so. */
258 if (ssp
->type
!= PXA3xx_SSP
)
259 clk_disable_unprepare(ssp
->clk
);
260 val
= pxa_ssp_read_reg(ssp
, SSCR0
) | sscr0
;
261 pxa_ssp_write_reg(ssp
, SSCR0
, val
);
262 if (ssp
->type
!= PXA3xx_SSP
)
263 clk_prepare_enable(ssp
->clk
);
269 * Set the SSP clock dividers.
271 static int pxa_ssp_set_dai_clkdiv(struct snd_soc_dai
*cpu_dai
,
274 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
275 struct ssp_device
*ssp
= priv
->ssp
;
279 case PXA_SSP_AUDIO_DIV_ACDS
:
280 val
= (pxa_ssp_read_reg(ssp
, SSACD
) & ~0x7) | SSACD_ACDS(div
);
281 pxa_ssp_write_reg(ssp
, SSACD
, val
);
283 case PXA_SSP_AUDIO_DIV_SCDB
:
284 val
= pxa_ssp_read_reg(ssp
, SSACD
);
286 if (ssp
->type
== PXA3xx_SSP
)
289 case PXA_SSP_CLK_SCDB_1
:
292 case PXA_SSP_CLK_SCDB_4
:
294 case PXA_SSP_CLK_SCDB_8
:
295 if (ssp
->type
== PXA3xx_SSP
)
303 pxa_ssp_write_reg(ssp
, SSACD
, val
);
305 case PXA_SSP_DIV_SCR
:
306 pxa_ssp_set_scr(ssp
, div
);
316 * Configure the PLL frequency pxa27x and (afaik - pxa320 only)
318 static int pxa_ssp_set_dai_pll(struct snd_soc_dai
*cpu_dai
, int pll_id
,
319 int source
, unsigned int freq_in
, unsigned int freq_out
)
321 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
322 struct ssp_device
*ssp
= priv
->ssp
;
323 u32 ssacd
= pxa_ssp_read_reg(ssp
, SSACD
) & ~0x70;
325 if (ssp
->type
== PXA3xx_SSP
)
326 pxa_ssp_write_reg(ssp
, SSACDD
, 0);
351 /* PXA3xx has a clock ditherer which can be used to generate
352 * a wider range of frequencies - calculate a value for it.
354 if (ssp
->type
== PXA3xx_SSP
) {
359 do_div(tmp
, freq_out
);
362 val
= (val
<< 16) | 64;
363 pxa_ssp_write_reg(ssp
, SSACDD
, val
);
367 dev_dbg(&ssp
->pdev
->dev
,
368 "Using SSACDD %x to supply %uHz\n",
376 pxa_ssp_write_reg(ssp
, SSACD
, ssacd
);
382 * Set the active slots in TDM/Network mode
384 static int pxa_ssp_set_dai_tdm_slot(struct snd_soc_dai
*cpu_dai
,
385 unsigned int tx_mask
, unsigned int rx_mask
, int slots
, int slot_width
)
387 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
388 struct ssp_device
*ssp
= priv
->ssp
;
391 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
392 sscr0
&= ~(SSCR0_MOD
| SSCR0_SlotsPerFrm(8) | SSCR0_EDSS
| SSCR0_DSS
);
396 sscr0
|= SSCR0_EDSS
| SSCR0_DataSize(slot_width
- 16);
398 sscr0
|= SSCR0_DataSize(slot_width
);
401 /* enable network mode */
404 /* set number of active slots */
405 sscr0
|= SSCR0_SlotsPerFrm(slots
);
407 /* set active slot mask */
408 pxa_ssp_write_reg(ssp
, SSTSA
, tx_mask
);
409 pxa_ssp_write_reg(ssp
, SSRSA
, rx_mask
);
411 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
417 * Tristate the SSP DAI lines
419 static int pxa_ssp_set_dai_tristate(struct snd_soc_dai
*cpu_dai
,
422 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
423 struct ssp_device
*ssp
= priv
->ssp
;
426 sscr1
= pxa_ssp_read_reg(ssp
, SSCR1
);
431 pxa_ssp_write_reg(ssp
, SSCR1
, sscr1
);
437 * Set up the SSP DAI format.
438 * The SSP Port must be inactive before calling this function as the
439 * physical interface format is changed.
441 static int pxa_ssp_set_dai_fmt(struct snd_soc_dai
*cpu_dai
,
444 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
445 struct ssp_device
*ssp
= priv
->ssp
;
446 u32 sscr0
, sscr1
, sspsp
, scfr
;
448 /* check if we need to change anything at all */
449 if (priv
->dai_fmt
== fmt
)
452 /* we can only change the settings if the port is not in use */
453 if (pxa_ssp_read_reg(ssp
, SSCR0
) & SSCR0_SSE
) {
454 dev_err(&ssp
->pdev
->dev
,
455 "can't change hardware dai format: stream is in use");
459 /* reset port settings */
460 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
) &
461 ~(SSCR0_ECS
| SSCR0_NCS
| SSCR0_MOD
| SSCR0_ACS
);
462 sscr1
= SSCR1_RxTresh(8) | SSCR1_TxTresh(7);
465 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
466 case SND_SOC_DAIFMT_CBM_CFM
:
467 sscr1
|= SSCR1_SCLKDIR
| SSCR1_SFRMDIR
| SSCR1_SCFR
;
469 case SND_SOC_DAIFMT_CBM_CFS
:
470 sscr1
|= SSCR1_SCLKDIR
| SSCR1_SCFR
;
472 case SND_SOC_DAIFMT_CBS_CFS
:
478 switch (fmt
& SND_SOC_DAIFMT_INV_MASK
) {
479 case SND_SOC_DAIFMT_NB_NF
:
480 sspsp
|= SSPSP_SFRMP
;
482 case SND_SOC_DAIFMT_NB_IF
:
484 case SND_SOC_DAIFMT_IB_IF
:
485 sspsp
|= SSPSP_SCMODE(2);
487 case SND_SOC_DAIFMT_IB_NF
:
488 sspsp
|= SSPSP_SCMODE(2) | SSPSP_SFRMP
;
494 switch (fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
495 case SND_SOC_DAIFMT_I2S
:
497 sscr1
|= SSCR1_RWOT
| SSCR1_TRAIL
;
498 /* See hw_params() */
501 case SND_SOC_DAIFMT_DSP_A
:
503 case SND_SOC_DAIFMT_DSP_B
:
504 sscr0
|= SSCR0_MOD
| SSCR0_PSP
;
505 sscr1
|= SSCR1_TRAIL
| SSCR1_RWOT
;
512 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
513 pxa_ssp_write_reg(ssp
, SSCR1
, sscr1
);
514 pxa_ssp_write_reg(ssp
, SSPSP
, sspsp
);
516 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
517 case SND_SOC_DAIFMT_CBM_CFM
:
518 case SND_SOC_DAIFMT_CBM_CFS
:
519 scfr
= pxa_ssp_read_reg(ssp
, SSCR1
) | SSCR1_SCFR
;
520 pxa_ssp_write_reg(ssp
, SSCR1
, scfr
);
522 while (pxa_ssp_read_reg(ssp
, SSSR
) & SSSR_BSY
)
529 /* Since we are configuring the timings for the format by hand
530 * we have to defer some things until hw_params() where we
531 * know parameters like the sample size.
539 * Set the SSP audio DMA parameters and sample size.
540 * Can be called multiple times by oss emulation.
542 static int pxa_ssp_hw_params(struct snd_pcm_substream
*substream
,
543 struct snd_pcm_hw_params
*params
,
544 struct snd_soc_dai
*cpu_dai
)
546 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
547 struct ssp_device
*ssp
= priv
->ssp
;
548 int chn
= params_channels(params
);
551 int width
= snd_pcm_format_physical_width(params_format(params
));
552 int ttsa
= pxa_ssp_read_reg(ssp
, SSTSA
) & 0xf;
553 struct snd_dmaengine_dai_dma_data
*dma_data
;
555 dma_data
= snd_soc_dai_get_dma_data(cpu_dai
, substream
);
557 /* Network mode with one active slot (ttsa == 1) can be used
558 * to force 16-bit frame width on the wire (for S16_LE), even
559 * with two channels. Use 16-bit DMA transfers for this case.
561 pxa_ssp_set_dma_params(ssp
,
562 ((chn
== 2) && (ttsa
!= 1)) || (width
== 32),
563 substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
, dma_data
);
565 /* we can only change the settings if the port is not in use */
566 if (pxa_ssp_read_reg(ssp
, SSCR0
) & SSCR0_SSE
)
569 /* clear selected SSP bits */
570 sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
) & ~(SSCR0_DSS
| SSCR0_EDSS
);
573 switch (params_format(params
)) {
574 case SNDRV_PCM_FORMAT_S16_LE
:
575 if (ssp
->type
== PXA3xx_SSP
)
576 sscr0
|= SSCR0_FPCKE
;
577 sscr0
|= SSCR0_DataSize(16);
579 case SNDRV_PCM_FORMAT_S24_LE
:
580 sscr0
|= (SSCR0_EDSS
| SSCR0_DataSize(8));
582 case SNDRV_PCM_FORMAT_S32_LE
:
583 sscr0
|= (SSCR0_EDSS
| SSCR0_DataSize(16));
586 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
);
588 switch (priv
->dai_fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
589 case SND_SOC_DAIFMT_I2S
:
590 sspsp
= pxa_ssp_read_reg(ssp
, SSPSP
);
592 if ((pxa_ssp_get_scr(ssp
) == 4) && (width
== 16)) {
593 /* This is a special case where the bitclk is 64fs
594 * and we're not dealing with 2*32 bits of audio
597 * The SSP values used for that are all found out by
598 * trying and failing a lot; some of the registers
599 * needed for that mode are only available on PXA3xx.
601 if (ssp
->type
!= PXA3xx_SSP
)
604 sspsp
|= SSPSP_SFRMWDTH(width
* 2);
605 sspsp
|= SSPSP_SFRMDLY(width
* 4);
606 sspsp
|= SSPSP_EDMYSTOP(3);
607 sspsp
|= SSPSP_DMYSTOP(3);
608 sspsp
|= SSPSP_DMYSTRT(1);
610 /* The frame width is the width the LRCLK is
611 * asserted for; the delay is expressed in
612 * half cycle units. We need the extra cycle
613 * because the data starts clocking out one BCLK
614 * after LRCLK changes polarity.
616 sspsp
|= SSPSP_SFRMWDTH(width
+ 1);
617 sspsp
|= SSPSP_SFRMDLY((width
+ 1) * 2);
618 sspsp
|= SSPSP_DMYSTRT(1);
621 pxa_ssp_write_reg(ssp
, SSPSP
, sspsp
);
627 /* When we use a network mode, we always require TDM slots
628 * - complain loudly and fail if they've not been set up yet.
630 if ((sscr0
& SSCR0_MOD
) && !ttsa
) {
631 dev_err(&ssp
->pdev
->dev
, "No TDM timeslot configured\n");
640 static void pxa_ssp_set_running_bit(struct snd_pcm_substream
*substream
,
641 struct ssp_device
*ssp
, int value
)
643 uint32_t sscr0
= pxa_ssp_read_reg(ssp
, SSCR0
);
644 uint32_t sscr1
= pxa_ssp_read_reg(ssp
, SSCR1
);
645 uint32_t sspsp
= pxa_ssp_read_reg(ssp
, SSPSP
);
646 uint32_t sssr
= pxa_ssp_read_reg(ssp
, SSSR
);
648 if (value
&& (sscr0
& SSCR0_SSE
))
649 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
& ~SSCR0_SSE
);
651 if (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
) {
655 sscr1
&= ~SSCR1_TSRE
;
660 sscr1
&= ~SSCR1_RSRE
;
663 pxa_ssp_write_reg(ssp
, SSCR1
, sscr1
);
666 pxa_ssp_write_reg(ssp
, SSSR
, sssr
);
667 pxa_ssp_write_reg(ssp
, SSPSP
, sspsp
);
668 pxa_ssp_write_reg(ssp
, SSCR0
, sscr0
| SSCR0_SSE
);
672 static int pxa_ssp_trigger(struct snd_pcm_substream
*substream
, int cmd
,
673 struct snd_soc_dai
*cpu_dai
)
676 struct ssp_priv
*priv
= snd_soc_dai_get_drvdata(cpu_dai
);
677 struct ssp_device
*ssp
= priv
->ssp
;
681 case SNDRV_PCM_TRIGGER_RESUME
:
684 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE
:
685 pxa_ssp_set_running_bit(substream
, ssp
, 1);
686 val
= pxa_ssp_read_reg(ssp
, SSSR
);
687 pxa_ssp_write_reg(ssp
, SSSR
, val
);
689 case SNDRV_PCM_TRIGGER_START
:
690 pxa_ssp_set_running_bit(substream
, ssp
, 1);
692 case SNDRV_PCM_TRIGGER_STOP
:
693 pxa_ssp_set_running_bit(substream
, ssp
, 0);
695 case SNDRV_PCM_TRIGGER_SUSPEND
:
696 pxa_ssp_disable(ssp
);
698 case SNDRV_PCM_TRIGGER_PAUSE_PUSH
:
699 pxa_ssp_set_running_bit(substream
, ssp
, 0);
711 static int pxa_ssp_probe(struct snd_soc_dai
*dai
)
713 struct device
*dev
= dai
->dev
;
714 struct ssp_priv
*priv
;
717 priv
= kzalloc(sizeof(struct ssp_priv
), GFP_KERNEL
);
722 struct device_node
*ssp_handle
;
724 ssp_handle
= of_parse_phandle(dev
->of_node
, "port", 0);
726 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 | SNDRV_PCM_FMTBIT_S32_LE)
771 static const struct snd_soc_dai_ops pxa_ssp_dai_ops
= {
772 .startup
= pxa_ssp_startup
,
773 .shutdown
= pxa_ssp_shutdown
,
774 .trigger
= pxa_ssp_trigger
,
775 .hw_params
= pxa_ssp_hw_params
,
776 .set_sysclk
= pxa_ssp_set_dai_sysclk
,
777 .set_clkdiv
= pxa_ssp_set_dai_clkdiv
,
778 .set_pll
= pxa_ssp_set_dai_pll
,
779 .set_fmt
= pxa_ssp_set_dai_fmt
,
780 .set_tdm_slot
= pxa_ssp_set_dai_tdm_slot
,
781 .set_tristate
= pxa_ssp_set_dai_tristate
,
784 static struct snd_soc_dai_driver pxa_ssp_dai
= {
785 .probe
= pxa_ssp_probe
,
786 .remove
= pxa_ssp_remove
,
787 .suspend
= pxa_ssp_suspend
,
788 .resume
= pxa_ssp_resume
,
792 .rates
= PXA_SSP_RATES
,
793 .formats
= PXA_SSP_FORMATS
,
798 .rates
= PXA_SSP_RATES
,
799 .formats
= PXA_SSP_FORMATS
,
801 .ops
= &pxa_ssp_dai_ops
,
804 static const struct snd_soc_component_driver pxa_ssp_component
= {
809 static const struct of_device_id pxa_ssp_of_ids
[] = {
810 { .compatible
= "mrvl,pxa-ssp-dai" },
813 MODULE_DEVICE_TABLE(of
, pxa_ssp_of_ids
);
816 static int asoc_ssp_probe(struct platform_device
*pdev
)
818 return devm_snd_soc_register_component(&pdev
->dev
, &pxa_ssp_component
,
822 static struct platform_driver asoc_ssp_driver
= {
824 .name
= "pxa-ssp-dai",
825 .of_match_table
= of_match_ptr(pxa_ssp_of_ids
),
828 .probe
= asoc_ssp_probe
,
831 module_platform_driver(asoc_ssp_driver
);
833 /* Module information */
834 MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
835 MODULE_DESCRIPTION("PXA SSP/PCM SoC Interface");
836 MODULE_LICENSE("GPL");
837 MODULE_ALIAS("platform:pxa-ssp-dai");