Commit 2e71ff5e authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/kirkwood' into asoc-next

parents 8ff9f38b 75b9b65e
...@@ -29,9 +29,7 @@ ...@@ -29,9 +29,7 @@
#define KIRKWOOD_FORMATS \ #define KIRKWOOD_FORMATS \
(SNDRV_PCM_FMTBIT_S16_LE | \ (SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_S24_LE | \ SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_S32_LE | \ SNDRV_PCM_FMTBIT_S32_LE)
SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE | \
SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE)
static struct kirkwood_dma_data *kirkwood_priv(struct snd_pcm_substream *subs) static struct kirkwood_dma_data *kirkwood_priv(struct snd_pcm_substream *subs)
{ {
...@@ -161,7 +159,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream) ...@@ -161,7 +159,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
* Enable Error interrupts. We're only ack'ing them but * Enable Error interrupts. We're only ack'ing them but
* it's useful for diagnostics * it's useful for diagnostics
*/ */
writel((unsigned long)-1, priv->io + KIRKWOOD_ERR_MASK); writel((unsigned int)-1, priv->io + KIRKWOOD_ERR_MASK);
} }
dram = mv_mbus_dram_info(); dram = mv_mbus_dram_info();
......
...@@ -103,7 +103,7 @@ static void kirkwood_set_rate(struct snd_soc_dai *dai, ...@@ -103,7 +103,7 @@ static void kirkwood_set_rate(struct snd_soc_dai *dai,
{ {
uint32_t clks_ctrl; uint32_t clks_ctrl;
if (rate == 44100 || rate == 48000 || rate == 96000) { if (IS_ERR(priv->extclk)) {
/* use internal dco for the supported rates /* use internal dco for the supported rates
* defined in kirkwood_i2s_dai */ * defined in kirkwood_i2s_dai */
dev_dbg(dai->dev, "%s: dco set rate = %lu\n", dev_dbg(dai->dev, "%s: dco set rate = %lu\n",
...@@ -160,9 +160,11 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -160,9 +160,11 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
case SNDRV_PCM_FORMAT_S16_LE: case SNDRV_PCM_FORMAT_S16_LE:
i2s_value |= KIRKWOOD_I2S_CTL_SIZE_16; i2s_value |= KIRKWOOD_I2S_CTL_SIZE_16;
ctl_play = KIRKWOOD_PLAYCTL_SIZE_16_C | ctl_play = KIRKWOOD_PLAYCTL_SIZE_16_C |
KIRKWOOD_PLAYCTL_I2S_EN; KIRKWOOD_PLAYCTL_I2S_EN |
KIRKWOOD_PLAYCTL_SPDIF_EN;
ctl_rec = KIRKWOOD_RECCTL_SIZE_16_C | ctl_rec = KIRKWOOD_RECCTL_SIZE_16_C |
KIRKWOOD_RECCTL_I2S_EN; KIRKWOOD_RECCTL_I2S_EN |
KIRKWOOD_RECCTL_SPDIF_EN;
break; break;
/* /*
* doesn't work... S20_3LE != kirkwood 20bit format ? * doesn't work... S20_3LE != kirkwood 20bit format ?
...@@ -178,9 +180,11 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -178,9 +180,11 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
case SNDRV_PCM_FORMAT_S24_LE: case SNDRV_PCM_FORMAT_S24_LE:
i2s_value |= KIRKWOOD_I2S_CTL_SIZE_24; i2s_value |= KIRKWOOD_I2S_CTL_SIZE_24;
ctl_play = KIRKWOOD_PLAYCTL_SIZE_24 | ctl_play = KIRKWOOD_PLAYCTL_SIZE_24 |
KIRKWOOD_PLAYCTL_I2S_EN; KIRKWOOD_PLAYCTL_I2S_EN |
KIRKWOOD_PLAYCTL_SPDIF_EN;
ctl_rec = KIRKWOOD_RECCTL_SIZE_24 | ctl_rec = KIRKWOOD_RECCTL_SIZE_24 |
KIRKWOOD_RECCTL_I2S_EN; KIRKWOOD_RECCTL_I2S_EN |
KIRKWOOD_RECCTL_SPDIF_EN;
break; break;
case SNDRV_PCM_FORMAT_S32_LE: case SNDRV_PCM_FORMAT_S32_LE:
i2s_value |= KIRKWOOD_I2S_CTL_SIZE_32; i2s_value |= KIRKWOOD_I2S_CTL_SIZE_32;
...@@ -240,6 +244,11 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, ...@@ -240,6 +244,11 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
ctl); ctl);
} }
if (dai->id == 0)
ctl &= ~KIRKWOOD_PLAYCTL_SPDIF_EN; /* i2s */
else
ctl &= ~KIRKWOOD_PLAYCTL_I2S_EN; /* spdif */
switch (cmd) { switch (cmd) {
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
/* configure */ /* configure */
...@@ -258,7 +267,8 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, ...@@ -258,7 +267,8 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_STOP:
/* stop audio, disable interrupts */ /* stop audio, disable interrupts */
ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE |
KIRKWOOD_PLAYCTL_SPDIF_MUTE;
writel(ctl, priv->io + KIRKWOOD_PLAYCTL); writel(ctl, priv->io + KIRKWOOD_PLAYCTL);
value = readl(priv->io + KIRKWOOD_INT_MASK); value = readl(priv->io + KIRKWOOD_INT_MASK);
...@@ -272,13 +282,15 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream, ...@@ -272,13 +282,15 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_SUSPEND:
ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; ctl |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE |
KIRKWOOD_PLAYCTL_SPDIF_MUTE;
writel(ctl, priv->io + KIRKWOOD_PLAYCTL); writel(ctl, priv->io + KIRKWOOD_PLAYCTL);
break; break;
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
ctl &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE); ctl &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE |
KIRKWOOD_PLAYCTL_SPDIF_MUTE);
writel(ctl, priv->io + KIRKWOOD_PLAYCTL); writel(ctl, priv->io + KIRKWOOD_PLAYCTL);
break; break;
...@@ -301,7 +313,13 @@ static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream, ...@@ -301,7 +313,13 @@ static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_START:
/* configure */ /* configure */
ctl = priv->ctl_rec; ctl = priv->ctl_rec;
value = ctl & ~KIRKWOOD_RECCTL_I2S_EN; if (dai->id == 0)
ctl &= ~KIRKWOOD_RECCTL_SPDIF_EN; /* i2s */
else
ctl &= ~KIRKWOOD_RECCTL_I2S_EN; /* spdif */
value = ctl & ~(KIRKWOOD_RECCTL_I2S_EN |
KIRKWOOD_RECCTL_SPDIF_EN);
writel(value, priv->io + KIRKWOOD_RECCTL); writel(value, priv->io + KIRKWOOD_RECCTL);
/* enable interrupts */ /* enable interrupts */
...@@ -361,9 +379,8 @@ static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -361,9 +379,8 @@ static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
return 0; return 0;
} }
static int kirkwood_i2s_probe(struct snd_soc_dai *dai) static int kirkwood_i2s_init(struct kirkwood_dma_data *priv)
{ {
struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
unsigned long value; unsigned long value;
unsigned int reg_data; unsigned int reg_data;
...@@ -404,9 +421,10 @@ static const struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { ...@@ -404,9 +421,10 @@ static const struct snd_soc_dai_ops kirkwood_i2s_dai_ops = {
.set_fmt = kirkwood_i2s_set_fmt, .set_fmt = kirkwood_i2s_set_fmt,
}; };
static struct snd_soc_dai_driver kirkwood_i2s_dai[2] = {
static struct snd_soc_dai_driver kirkwood_i2s_dai = { {
.probe = kirkwood_i2s_probe, .name = "i2s",
.id = 0,
.playback = { .playback = {
.channels_min = 1, .channels_min = 1,
.channels_max = 2, .channels_max = 2,
...@@ -422,10 +440,53 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai = { ...@@ -422,10 +440,53 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai = {
.formats = KIRKWOOD_I2S_FORMATS, .formats = KIRKWOOD_I2S_FORMATS,
}, },
.ops = &kirkwood_i2s_dai_ops, .ops = &kirkwood_i2s_dai_ops,
},
{
.name = "spdif",
.id = 1,
.playback = {
.channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_96000,
.formats = KIRKWOOD_I2S_FORMATS,
},
.capture = {
.channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
SNDRV_PCM_RATE_96000,
.formats = KIRKWOOD_I2S_FORMATS,
},
.ops = &kirkwood_i2s_dai_ops,
},
}; };
static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk = { static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = {
.probe = kirkwood_i2s_probe, {
.name = "i2s",
.id = 0,
.playback = {
.channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_CONTINUOUS |
SNDRV_PCM_RATE_KNOT,
.formats = KIRKWOOD_I2S_FORMATS,
},
.capture = {
.channels_min = 1,
.channels_max = 2,
.rates = SNDRV_PCM_RATE_8000_192000 |
SNDRV_PCM_RATE_CONTINUOUS |
SNDRV_PCM_RATE_KNOT,
.formats = KIRKWOOD_I2S_FORMATS,
},
.ops = &kirkwood_i2s_dai_ops,
},
{
.name = "spdif",
.id = 1,
.playback = { .playback = {
.channels_min = 1, .channels_min = 1,
.channels_max = 2, .channels_max = 2,
...@@ -443,6 +504,7 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk = { ...@@ -443,6 +504,7 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk = {
.formats = KIRKWOOD_I2S_FORMATS, .formats = KIRKWOOD_I2S_FORMATS,
}, },
.ops = &kirkwood_i2s_dai_ops, .ops = &kirkwood_i2s_dai_ops,
},
}; };
static const struct snd_soc_component_driver kirkwood_i2s_component = { static const struct snd_soc_component_driver kirkwood_i2s_component = {
...@@ -452,7 +514,7 @@ static const struct snd_soc_component_driver kirkwood_i2s_component = { ...@@ -452,7 +514,7 @@ static const struct snd_soc_component_driver kirkwood_i2s_component = {
static int kirkwood_i2s_dev_probe(struct platform_device *pdev) static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
{ {
struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data; struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data;
struct snd_soc_dai_driver *soc_dai = &kirkwood_i2s_dai; struct snd_soc_dai_driver *soc_dai = kirkwood_i2s_dai;
struct kirkwood_dma_data *priv; struct kirkwood_dma_data *priv;
struct resource *mem; struct resource *mem;
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
...@@ -496,7 +558,10 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) ...@@ -496,7 +558,10 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
return err; return err;
priv->extclk = devm_clk_get(&pdev->dev, "extclk"); priv->extclk = devm_clk_get(&pdev->dev, "extclk");
if (!IS_ERR(priv->extclk)) { if (IS_ERR(priv->extclk)) {
if (PTR_ERR(priv->extclk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
} else {
if (priv->extclk == priv->clk) { if (priv->extclk == priv->clk) {
devm_clk_put(&pdev->dev, priv->extclk); devm_clk_put(&pdev->dev, priv->extclk);
priv->extclk = ERR_PTR(-EINVAL); priv->extclk = ERR_PTR(-EINVAL);
...@@ -521,7 +586,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) ...@@ -521,7 +586,7 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
} }
err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component, err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component,
soc_dai, 1); soc_dai, 2);
if (err) { if (err) {
dev_err(&pdev->dev, "snd_soc_register_component failed\n"); dev_err(&pdev->dev, "snd_soc_register_component failed\n");
goto err_component; goto err_component;
...@@ -532,6 +597,9 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) ...@@ -532,6 +597,9 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "snd_soc_register_platform failed\n"); dev_err(&pdev->dev, "snd_soc_register_platform failed\n");
goto err_platform; goto err_platform;
} }
kirkwood_i2s_init(priv);
return 0; return 0;
err_platform: err_platform:
snd_soc_unregister_component(&pdev->dev); snd_soc_unregister_component(&pdev->dev);
......
...@@ -52,7 +52,7 @@ static struct snd_soc_dai_link openrd_client_dai[] = { ...@@ -52,7 +52,7 @@ static struct snd_soc_dai_link openrd_client_dai[] = {
{ {
.name = "CS42L51", .name = "CS42L51",
.stream_name = "CS42L51 HiFi", .stream_name = "CS42L51 HiFi",
.cpu_dai_name = "mvebu-audio", .cpu_dai_name = "i2s",
.platform_name = "mvebu-audio", .platform_name = "mvebu-audio",
.codec_dai_name = "cs42l51-hifi", .codec_dai_name = "cs42l51-hifi",
.codec_name = "cs42l51-codec.0-004a", .codec_name = "cs42l51-codec.0-004a",
......
...@@ -68,7 +68,7 @@ static struct snd_soc_dai_link t5325_dai[] = { ...@@ -68,7 +68,7 @@ static struct snd_soc_dai_link t5325_dai[] = {
{ {
.name = "ALC5621", .name = "ALC5621",
.stream_name = "ALC5621 HiFi", .stream_name = "ALC5621 HiFi",
.cpu_dai_name = "mvebu-audio", .cpu_dai_name = "i2s",
.platform_name = "mvebu-audio", .platform_name = "mvebu-audio",
.codec_dai_name = "alc5621-hifi", .codec_dai_name = "alc5621-hifi",
.codec_name = "alc562x-codec.0-001a", .codec_name = "alc562x-codec.0-001a",
......
...@@ -123,8 +123,8 @@ ...@@ -123,8 +123,8 @@
/* need to find where they come from */ /* need to find where they come from */
#define KIRKWOOD_SND_MIN_PERIODS 8 #define KIRKWOOD_SND_MIN_PERIODS 8
#define KIRKWOOD_SND_MAX_PERIODS 16 #define KIRKWOOD_SND_MAX_PERIODS 16
#define KIRKWOOD_SND_MIN_PERIOD_BYTES 0x4000 #define KIRKWOOD_SND_MIN_PERIOD_BYTES 0x800
#define KIRKWOOD_SND_MAX_PERIOD_BYTES 0x4000 #define KIRKWOOD_SND_MAX_PERIOD_BYTES 0x8000
#define KIRKWOOD_SND_MAX_BUFFER_BYTES (KIRKWOOD_SND_MAX_PERIOD_BYTES \ #define KIRKWOOD_SND_MAX_BUFFER_BYTES (KIRKWOOD_SND_MAX_PERIOD_BYTES \
* KIRKWOOD_SND_MAX_PERIODS) * KIRKWOOD_SND_MAX_PERIODS)
......
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