alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/2] Kirkwood audio fixes
@ 2010-07-11 21:28 arnaud.patard
  2010-07-11 21:28 ` [patch 1/2] ASoC: Fix kirkwood i2s mono playback arnaud.patard
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: arnaud.patard @ 2010-07-11 21:28 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, tbm, lrg



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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 1/2] ASoC: Fix kirkwood i2s mono playback
  2010-07-11 21:28 [patch 0/2] Kirkwood audio fixes arnaud.patard
@ 2010-07-11 21:28 ` arnaud.patard
  2010-07-13 11:38   ` Mark Brown
  2010-07-11 21:28 ` [patch 2/2] ASoC: kirkwood-i2s: Handle mute/unmute playback/record arnaud.patard
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: arnaud.patard @ 2010-07-11 21:28 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, tbm, Arnaud Patard, lrg

[-- Attachment #1: kirkwood_fix_mono_playback.patch --]
[-- Type: text/plain, Size: 1531 bytes --]

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)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch 2/2] ASoC: kirkwood-i2s: Handle mute/unmute playback/record
  2010-07-11 21:28 [patch 0/2] Kirkwood audio fixes arnaud.patard
  2010-07-11 21:28 ` [patch 1/2] ASoC: Fix kirkwood i2s mono playback arnaud.patard
@ 2010-07-11 21:28 ` arnaud.patard
  2010-07-12 11:03 ` [patch 0/2] Kirkwood audio fixes Liam Girdwood
  2010-07-13 11:34 ` Liam Girdwood
  3 siblings, 0 replies; 6+ messages in thread
From: arnaud.patard @ 2010-07-11 21:28 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie, tbm, Arnaud Patard, lrg

[-- Attachment #1: kirkwood_unmute.patch --]
[-- Type: text/plain, Size: 3104 bytes --]

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;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch 0/2] Kirkwood audio fixes
  2010-07-11 21:28 [patch 0/2] Kirkwood audio fixes arnaud.patard
  2010-07-11 21:28 ` [patch 1/2] ASoC: Fix kirkwood i2s mono playback arnaud.patard
  2010-07-11 21:28 ` [patch 2/2] ASoC: kirkwood-i2s: Handle mute/unmute playback/record arnaud.patard
@ 2010-07-12 11:03 ` Liam Girdwood
  2010-07-13 11:34 ` Liam Girdwood
  3 siblings, 0 replies; 6+ messages in thread
From: Liam Girdwood @ 2010-07-12 11:03 UTC (permalink / raw)
  To: arnaud.patard; +Cc: alsa-devel, broonie, tbm

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>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch 0/2] Kirkwood audio fixes
  2010-07-11 21:28 [patch 0/2] Kirkwood audio fixes arnaud.patard
                   ` (2 preceding siblings ...)
  2010-07-12 11:03 ` [patch 0/2] Kirkwood audio fixes Liam Girdwood
@ 2010-07-13 11:34 ` Liam Girdwood
  3 siblings, 0 replies; 6+ messages in thread
From: Liam Girdwood @ 2010-07-13 11:34 UTC (permalink / raw)
  To: arnaud.patard; +Cc: alsa-devel, broonie, tbm

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>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch 1/2] ASoC: Fix kirkwood i2s mono playback
  2010-07-11 21:28 ` [patch 1/2] ASoC: Fix kirkwood i2s mono playback arnaud.patard
@ 2010-07-13 11:38   ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2010-07-13 11:38 UTC (permalink / raw)
  To: arnaud.patard; +Cc: alsa-devel, tbm, lrg

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-07-13 11:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-11 21:28 [patch 0/2] Kirkwood audio fixes arnaud.patard
2010-07-11 21:28 ` [patch 1/2] ASoC: Fix kirkwood i2s mono playback arnaud.patard
2010-07-13 11:38   ` Mark Brown
2010-07-11 21:28 ` [patch 2/2] ASoC: kirkwood-i2s: Handle mute/unmute playback/record arnaud.patard
2010-07-12 11:03 ` [patch 0/2] Kirkwood audio fixes Liam Girdwood
2010-07-13 11:34 ` Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).