Commit 699994d0 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/ad193x', 'asoc/topic/alc5632',...

Merge remote-tracking branches 'asoc/topic/ad193x', 'asoc/topic/alc5632', 'asoc/topic/atmel' and 'asoc/topic/au1x' into asoc-next
...@@ -45,7 +45,7 @@ config SND_ATMEL_SOC_WM8904 ...@@ -45,7 +45,7 @@ config SND_ATMEL_SOC_WM8904
config SND_AT91_SOC_SAM9X5_WM8731 config SND_AT91_SOC_SAM9X5_WM8731
tristate "SoC Audio support for WM8731-based at91sam9x5 board" tristate "SoC Audio support for WM8731-based at91sam9x5 board"
depends on ATMEL_SSC && SND_ATMEL_SOC && SOC_AT91SAM9X5 depends on ARCH_AT91 && ATMEL_SSC && SND_ATMEL_SOC
select SND_ATMEL_SOC_SSC select SND_ATMEL_SOC_SSC
select SND_ATMEL_SOC_DMA select SND_ATMEL_SOC_DMA
select SND_SOC_WM8731 select SND_SOC_WM8731
......
...@@ -105,13 +105,11 @@ static int atmel_pcm_configure_dma(struct snd_pcm_substream *substream, ...@@ -105,13 +105,11 @@ static int atmel_pcm_configure_dma(struct snd_pcm_substream *substream,
return ret; return ret;
} }
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { slave_config->dst_addr = ssc->phybase + SSC_THR;
slave_config->dst_addr = ssc->phybase + SSC_THR; slave_config->dst_maxburst = 1;
slave_config->dst_maxburst = 1;
} else { slave_config->src_addr = ssc->phybase + SSC_RHR;
slave_config->src_addr = ssc->phybase + SSC_RHR; slave_config->src_maxburst = 1;
slave_config->src_maxburst = 1;
}
prtd->dma_intr_handler = atmel_pcm_dma_irq; prtd->dma_intr_handler = atmel_pcm_dma_irq;
......
...@@ -204,6 +204,13 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream, ...@@ -204,6 +204,13 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream,
pr_debug("atmel_ssc_startup: SSC_SR=0x%u\n", pr_debug("atmel_ssc_startup: SSC_SR=0x%u\n",
ssc_readl(ssc_p->ssc->regs, SR)); ssc_readl(ssc_p->ssc->regs, SR));
/* Enable PMC peripheral clock for this SSC */
pr_debug("atmel_ssc_dai: Starting clock\n");
clk_enable(ssc_p->ssc->clk);
/* Reset the SSC to keep it at a clean status */
ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST));
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
dir = 0; dir = 0;
dir_mask = SSC_DIR_MASK_PLAYBACK; dir_mask = SSC_DIR_MASK_PLAYBACK;
...@@ -250,11 +257,6 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream, ...@@ -250,11 +257,6 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
dma_params = ssc_p->dma_params[dir]; dma_params = ssc_p->dma_params[dir];
if (dma_params != NULL) { if (dma_params != NULL) {
ssc_writel(ssc_p->ssc->regs, CR, dma_params->mask->ssc_disable);
pr_debug("atmel_ssc_shutdown: %s disabled SSC_SR=0x%08x\n",
(dir ? "receive" : "transmit"),
ssc_readl(ssc_p->ssc->regs, SR));
dma_params->ssc = NULL; dma_params->ssc = NULL;
dma_params->substream = NULL; dma_params->substream = NULL;
ssc_p->dma_params[dir] = NULL; ssc_p->dma_params[dir] = NULL;
...@@ -266,10 +268,6 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream, ...@@ -266,10 +268,6 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
ssc_p->dir_mask &= ~dir_mask; ssc_p->dir_mask &= ~dir_mask;
if (!ssc_p->dir_mask) { if (!ssc_p->dir_mask) {
if (ssc_p->initialized) { if (ssc_p->initialized) {
/* Shutdown the SSC clock. */
pr_debug("atmel_ssc_dai: Stopping clock\n");
clk_disable(ssc_p->ssc->clk);
free_irq(ssc_p->ssc->irq, ssc_p); free_irq(ssc_p->ssc->irq, ssc_p);
ssc_p->initialized = 0; ssc_p->initialized = 0;
} }
...@@ -280,6 +278,10 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream, ...@@ -280,6 +278,10 @@ static void atmel_ssc_shutdown(struct snd_pcm_substream *substream,
ssc_p->cmr_div = ssc_p->tcmr_period = ssc_p->rcmr_period = 0; ssc_p->cmr_div = ssc_p->tcmr_period = ssc_p->rcmr_period = 0;
} }
spin_unlock_irq(&ssc_p->lock); spin_unlock_irq(&ssc_p->lock);
/* Shutdown the SSC clock. */
pr_debug("atmel_ssc_dai: Stopping clock\n");
clk_disable(ssc_p->ssc->clk);
} }
...@@ -450,13 +452,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, ...@@ -450,13 +452,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
break; break;
case SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM:
/* /* I2S format, CODEC supplies BCLK and LRC clocks. */
* I2S format, CODEC supplies BCLK and LRC clocks.
*
* The SSC transmit clock is obtained from the BCLK signal on
* on the TK line, and the SSC receive clock is
* generated from the transmit clock.
*/
rcmr = SSC_BF(RCMR_PERIOD, 0) rcmr = SSC_BF(RCMR_PERIOD, 0)
| SSC_BF(RCMR_STTDLY, START_DELAY) | SSC_BF(RCMR_STTDLY, START_DELAY)
| SSC_BF(RCMR_START, SSC_START_FALLING_RF) | SSC_BF(RCMR_START, SSC_START_FALLING_RF)
...@@ -491,6 +487,54 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, ...@@ -491,6 +487,54 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
| SSC_BF(TFMR_DATLEN, (bits - 1)); | SSC_BF(TFMR_DATLEN, (bits - 1));
break; break;
case SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFS:
/* I2S format, CODEC supplies BCLK, SSC supplies LRCLK. */
if (bits > 16 && !ssc->pdata->has_fslen_ext) {
dev_err(dai->dev,
"sample size %d is too large for SSC device\n",
bits);
return -EINVAL;
}
fslen_ext = (bits - 1) / 16;
fslen = (bits - 1) % 16;
rcmr = SSC_BF(RCMR_PERIOD, ssc_p->rcmr_period)
| SSC_BF(RCMR_STTDLY, START_DELAY)
| SSC_BF(RCMR_START, SSC_START_FALLING_RF)
| SSC_BF(RCMR_CKI, SSC_CKI_RISING)
| SSC_BF(RCMR_CKO, SSC_CKO_NONE)
| SSC_BF(RCMR_CKS, ssc->clk_from_rk_pin ?
SSC_CKS_PIN : SSC_CKS_CLOCK);
rfmr = SSC_BF(RFMR_FSLEN_EXT, fslen_ext)
| SSC_BF(RFMR_FSEDGE, SSC_FSEDGE_POSITIVE)
| SSC_BF(RFMR_FSOS, SSC_FSOS_NEGATIVE)
| SSC_BF(RFMR_FSLEN, fslen)
| SSC_BF(RFMR_DATNB, (channels - 1))
| SSC_BIT(RFMR_MSBF)
| SSC_BF(RFMR_LOOP, 0)
| SSC_BF(RFMR_DATLEN, (bits - 1));
tcmr = SSC_BF(TCMR_PERIOD, ssc_p->tcmr_period)
| SSC_BF(TCMR_STTDLY, START_DELAY)
| SSC_BF(TCMR_START, SSC_START_FALLING_RF)
| SSC_BF(TCMR_CKI, SSC_CKI_FALLING)
| SSC_BF(TCMR_CKO, SSC_CKO_NONE)
| SSC_BF(TCMR_CKS, ssc->clk_from_rk_pin ?
SSC_CKS_CLOCK : SSC_CKS_PIN);
tfmr = SSC_BF(TFMR_FSLEN_EXT, fslen_ext)
| SSC_BF(TFMR_FSEDGE, SSC_FSEDGE_NEGATIVE)
| SSC_BF(TFMR_FSDEN, 0)
| SSC_BF(TFMR_FSOS, SSC_FSOS_NEGATIVE)
| SSC_BF(TFMR_FSLEN, fslen)
| SSC_BF(TFMR_DATNB, (channels - 1))
| SSC_BIT(TFMR_MSBF)
| SSC_BF(TFMR_DATDEF, 0)
| SSC_BF(TFMR_DATLEN, (bits - 1));
break;
case SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_CBS_CFS:
/* /*
* DSP/PCM Mode A format, SSC provides BCLK and LRC clocks. * DSP/PCM Mode A format, SSC provides BCLK and LRC clocks.
...@@ -535,10 +579,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, ...@@ -535,10 +579,6 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
/* /*
* DSP/PCM Mode A format, CODEC supplies BCLK and LRC clocks. * DSP/PCM Mode A format, CODEC supplies BCLK and LRC clocks.
* *
* The SSC transmit clock is obtained from the BCLK signal on
* on the TK line, and the SSC receive clock is
* generated from the transmit clock.
*
* Data is transferred on first BCLK after LRC pulse rising * Data is transferred on first BCLK after LRC pulse rising
* edge.If stereo, the right channel data is contiguous with * edge.If stereo, the right channel data is contiguous with
* the left channel data. * the left channel data.
...@@ -587,23 +627,17 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, ...@@ -587,23 +627,17 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream,
rcmr, rfmr, tcmr, tfmr); rcmr, rfmr, tcmr, tfmr);
if (!ssc_p->initialized) { if (!ssc_p->initialized) {
if (!ssc_p->ssc->pdata->use_dma) {
/* Enable PMC peripheral clock for this SSC */ ssc_writel(ssc_p->ssc->regs, PDC_RPR, 0);
pr_debug("atmel_ssc_dai: Starting clock\n"); ssc_writel(ssc_p->ssc->regs, PDC_RCR, 0);
clk_enable(ssc_p->ssc->clk); ssc_writel(ssc_p->ssc->regs, PDC_RNPR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_RNCR, 0);
/* Reset the SSC and its PDC registers */
ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST)); ssc_writel(ssc_p->ssc->regs, PDC_TPR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_TCR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_RPR, 0); ssc_writel(ssc_p->ssc->regs, PDC_TNPR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_RCR, 0); ssc_writel(ssc_p->ssc->regs, PDC_TNCR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_RNPR, 0); }
ssc_writel(ssc_p->ssc->regs, PDC_RNCR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_TPR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_TCR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_TNPR, 0);
ssc_writel(ssc_p->ssc->regs, PDC_TNCR, 0);
ret = request_irq(ssc_p->ssc->irq, atmel_ssc_interrupt, 0, ret = request_irq(ssc_p->ssc->irq, atmel_ssc_interrupt, 0,
ssc_p->name, ssc_p); ssc_p->name, ssc_p);
......
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
#include <sound/soc.h> #include <sound/soc.h>
#include <asm/mach-types.h> #include <asm/mach-types.h>
#include <mach/hardware.h>
#include "../codecs/wm8731.h" #include "../codecs/wm8731.h"
#include "atmel-pcm.h" #include "atmel-pcm.h"
......
...@@ -315,11 +315,6 @@ static struct snd_pcm_ops au1xpsc_pcm_ops = { ...@@ -315,11 +315,6 @@ static struct snd_pcm_ops au1xpsc_pcm_ops = {
.pointer = au1xpsc_pcm_pointer, .pointer = au1xpsc_pcm_pointer,
}; };
static void au1xpsc_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
snd_pcm_lib_preallocate_free_for_all(pcm);
}
static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd) static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_card *card = rtd->card->snd_card; struct snd_card *card = rtd->card->snd_card;
...@@ -335,7 +330,6 @@ static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -335,7 +330,6 @@ static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd)
static struct snd_soc_platform_driver au1xpsc_soc_platform = { static struct snd_soc_platform_driver au1xpsc_soc_platform = {
.ops = &au1xpsc_pcm_ops, .ops = &au1xpsc_pcm_ops,
.pcm_new = au1xpsc_pcm_new, .pcm_new = au1xpsc_pcm_new,
.pcm_free = au1xpsc_pcm_free_dma_buffers,
}; };
static int au1xpsc_pcm_drvprobe(struct platform_device *pdev) static int au1xpsc_pcm_drvprobe(struct platform_device *pdev)
......
...@@ -287,11 +287,6 @@ static struct snd_pcm_ops alchemy_pcm_ops = { ...@@ -287,11 +287,6 @@ static struct snd_pcm_ops alchemy_pcm_ops = {
.pointer = alchemy_pcm_pointer, .pointer = alchemy_pcm_pointer,
}; };
static void alchemy_pcm_free_dma_buffers(struct snd_pcm *pcm)
{
snd_pcm_lib_preallocate_free_for_all(pcm);
}
static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd) static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd)
{ {
struct snd_pcm *pcm = rtd->pcm; struct snd_pcm *pcm = rtd->pcm;
...@@ -305,7 +300,6 @@ static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd) ...@@ -305,7 +300,6 @@ static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd)
static struct snd_soc_platform_driver alchemy_pcm_soc_platform = { static struct snd_soc_platform_driver alchemy_pcm_soc_platform = {
.ops = &alchemy_pcm_ops, .ops = &alchemy_pcm_ops,
.pcm_new = alchemy_pcm_new, .pcm_new = alchemy_pcm_new,
.pcm_free = alchemy_pcm_free_dma_buffers,
}; };
static int alchemy_pcm_drvprobe(struct platform_device *pdev) static int alchemy_pcm_drvprobe(struct platform_device *pdev)
......
...@@ -333,8 +333,8 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec) ...@@ -333,8 +333,8 @@ static int ad193x_codec_probe(struct snd_soc_codec *codec)
regmap_write(ad193x->regmap, AD193X_DAC_CHNL_MUTE, 0x0); regmap_write(ad193x->regmap, AD193X_DAC_CHNL_MUTE, 0x0);
/* de-emphasis: 48kHz, powedown dac */ /* de-emphasis: 48kHz, powedown dac */
regmap_write(ad193x->regmap, AD193X_DAC_CTRL2, 0x1A); regmap_write(ad193x->regmap, AD193X_DAC_CTRL2, 0x1A);
/* powerdown dac, dac in tdm mode */ /* dac in tdm mode */
regmap_write(ad193x->regmap, AD193X_DAC_CTRL0, 0x41); regmap_write(ad193x->regmap, AD193X_DAC_CTRL0, 0x40);
/* high-pass filter enable */ /* high-pass filter enable */
regmap_write(ad193x->regmap, AD193X_ADC_CTRL0, 0x3); regmap_write(ad193x->regmap, AD193X_ADC_CTRL0, 0x3);
/* sata delay=1, adc aux mode */ /* sata delay=1, adc aux mode */
......
...@@ -1068,7 +1068,7 @@ static int alc5632_probe(struct snd_soc_codec *codec) ...@@ -1068,7 +1068,7 @@ static int alc5632_probe(struct snd_soc_codec *codec)
return 0; return 0;
} }
static struct snd_soc_codec_driver soc_codec_device_alc5632 = { static const struct snd_soc_codec_driver soc_codec_device_alc5632 = {
.probe = alc5632_probe, .probe = alc5632_probe,
.resume = alc5632_resume, .resume = alc5632_resume,
.set_bias_level = alc5632_set_bias_level, .set_bias_level = alc5632_set_bias_level,
...@@ -1082,7 +1082,7 @@ static struct snd_soc_codec_driver soc_codec_device_alc5632 = { ...@@ -1082,7 +1082,7 @@ static struct snd_soc_codec_driver soc_codec_device_alc5632 = {
.num_dapm_routes = ARRAY_SIZE(alc5632_dapm_routes), .num_dapm_routes = ARRAY_SIZE(alc5632_dapm_routes),
}; };
static struct regmap_config alc5632_regmap = { static const struct regmap_config alc5632_regmap = {
.reg_bits = 8, .reg_bits = 8,
.val_bits = 16, .val_bits = 16,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment