[alsa-devel] [patch 0/2] Kirkwood audio fixes
Hi,
While working on the t5325 audio support, I found two small buglets in the kirkwood ASoC support.
The first one is aiming at fixing mono audio playback and should fix mono playback for all platforms. The second is adding support for muting/unmuting kirkwood audio. It's mainly usefull for the t5325 which has a bootloader playing with this (hardware default is not muted).
Arnaud
Kirkwood controller needs to be informed if the audio stream is mono or not. Failing to do so will result in playing at the wrong speed.
Signed-off-by: Arnaud Patard arnaud.patard@rtp-net.org Index: sound-2.6/sound/soc/kirkwood/kirkwood-i2s.c =================================================================== --- sound-2.6.orig/sound/soc/kirkwood/kirkwood-i2s.c 2010-07-10 21:53:35.000000000 +0200 +++ sound-2.6/sound/soc/kirkwood/kirkwood-i2s.c 2010-07-11 13:01:55.000000000 +0200 @@ -153,6 +153,15 @@ default: return -EINVAL; } + + if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + value &= ~KIRKWOOD_PLAYCTL_MONO_MASK; + if (params_channels(params) == 1) + value |= KIRKWOOD_PLAYCTL_MONO_BOTH; + else + value |= KIRKWOOD_PLAYCTL_MONO_OFF; + } + writel(i2s_value, priv->io+i2s_reg); writel(value, priv->io+reg);
Index: sound-2.6/sound/soc/kirkwood/kirkwood.h =================================================================== --- sound-2.6.orig/sound/soc/kirkwood/kirkwood.h 2010-07-11 12:08:30.000000000 +0200 +++ sound-2.6/sound/soc/kirkwood/kirkwood.h 2010-07-11 12:10:56.000000000 +0200 @@ -49,6 +49,9 @@ #define KIRKWOOD_PLAYCTL_BURST_32 (1<<11) #define KIRKWOOD_PLAYCTL_PAUSE (1<<9) #define KIRKWOOD_PLAYCTL_SPDIF_MUTE (1<<8) +#define KIRKWOOD_PLAYCTL_MONO_MASK (3<<5) +#define KIRKWOOD_PLAYCTL_MONO_BOTH (3<<5) +#define KIRKWOOD_PLAYCTL_MONO_OFF (0<<5) #define KIRKWOOD_PLAYCTL_I2S_MUTE (1<<7) #define KIRKWOOD_PLAYCTL_SPDIF_EN (1<<4) #define KIRKWOOD_PLAYCTL_I2S_EN (1<<3)
On Sun, Jul 11, 2010 at 11:28:31PM +0200, arnaud.patard@rtp-net.org wrote:
Kirkwood controller needs to be informed if the audio stream is mono or not. Failing to do so will result in playing at the wrong speed.
Applied both, thanks.
The controller has mute/unmute capability and some bootloader may mute them at boot. If it's not handled, all things will seem to be working but no sound will come out of the speaker/headphone.
Signed-off-by: Arnaud Patard arnaud.patard@rtp-net.org Index: sound-2.6/sound/soc/kirkwood/kirkwood-i2s.c =================================================================== --- sound-2.6.orig/sound/soc/kirkwood/kirkwood-i2s.c 2010-07-11 14:22:06.000000000 +0200 +++ sound-2.6/sound/soc/kirkwood/kirkwood-i2s.c 2010-07-11 14:36:54.000000000 +0200 @@ -193,7 +193,8 @@ /* configure audio & enable i2s playback */ value = readl(priv->io + KIRKWOOD_PLAYCTL); value &= ~KIRKWOOD_PLAYCTL_BURST_MASK; - value &= ~(KIRKWOOD_PLAYCTL_PAUSE|KIRKWOOD_PLAYCTL_SPDIF_EN); + value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE + | KIRKWOOD_PLAYCTL_SPDIF_EN);
if (priv->burst == 32) value |= KIRKWOOD_PLAYCTL_BURST_32; @@ -206,7 +207,7 @@ case SNDRV_PCM_TRIGGER_STOP: /* stop audio, disable interrupts */ value = readl(priv->io + KIRKWOOD_PLAYCTL); - value |= KIRKWOOD_PLAYCTL_PAUSE; + value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; writel(value, priv->io + KIRKWOOD_PLAYCTL);
value = readl(priv->io + KIRKWOOD_INT_MASK); @@ -222,14 +223,14 @@ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_SUSPEND: value = readl(priv->io + KIRKWOOD_PLAYCTL); - value |= KIRKWOOD_PLAYCTL_PAUSE; + value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE; writel(value, priv->io + KIRKWOOD_PLAYCTL); break;
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: value = readl(priv->io + KIRKWOOD_PLAYCTL); - value &= ~KIRKWOOD_PLAYCTL_PAUSE; + value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE); writel(value, priv->io + KIRKWOOD_PLAYCTL); break;
@@ -262,7 +263,8 @@ value = readl(priv->io + KIRKWOOD_RECCTL); value &= ~KIRKWOOD_RECCTL_BURST_MASK; value &= ~KIRKWOOD_RECCTL_MONO; - value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_SPDIF_EN); + value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE + | KIRKWOOD_RECCTL_SPDIF_EN);
if (priv->burst == 32) value |= KIRKWOOD_RECCTL_BURST_32; @@ -276,7 +278,7 @@ case SNDRV_PCM_TRIGGER_STOP: /* stop audio, disable interrupts */ value = readl(priv->io + KIRKWOOD_RECCTL); - value |= KIRKWOOD_RECCTL_PAUSE; + value |= KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE; writel(value, priv->io + KIRKWOOD_RECCTL);
value = readl(priv->io + KIRKWOOD_INT_MASK); @@ -292,14 +294,14 @@ case SNDRV_PCM_TRIGGER_PAUSE_PUSH: case SNDRV_PCM_TRIGGER_SUSPEND: value = readl(priv->io + KIRKWOOD_RECCTL); - value |= KIRKWOOD_RECCTL_PAUSE; + value |= KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE; writel(value, priv->io + KIRKWOOD_RECCTL); break;
case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: value = readl(priv->io + KIRKWOOD_RECCTL); - value &= ~KIRKWOOD_RECCTL_PAUSE; + value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE); writel(value, priv->io + KIRKWOOD_RECCTL); break;
On Sun, 2010-07-11 at 23:28 +0200, arnaud.patard@rtp-net.org wrote:
Hi,
While working on the t5325 audio support, I found two small buglets in the kirkwood ASoC support.
The first one is aiming at fixing mono audio playback and should fix mono playback for all platforms. The second is adding support for muting/unmuting kirkwood audio. It's mainly usefull for the t5325 which has a bootloader playing with this (hardware default is not muted).
All
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
On Sun, 2010-07-11 at 23:28 +0200, arnaud.patard@rtp-net.org wrote:
Hi,
While working on the t5325 audio support, I found two small buglets in the kirkwood ASoC support.
The first one is aiming at fixing mono audio playback and should fix mono playback for all platforms. The second is adding support for muting/unmuting kirkwood audio. It's mainly usefull for the t5325 which has a bootloader playing with this (hardware default is not muted).
Acked-by: Liam Girdwood lrg@slimlogic.co.uk
participants (3)
-
arnaud.patard@rtp-net.org
-
Liam Girdwood
-
Mark Brown