All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Jarkko Nikula <jarkko.nikula@nokia.com>
Subject: [PATCH 10/13] ASoC: OMAP: Add support for mono audio links in McBSP DAI
Date: Tue, 25 Nov 2008 15:44:46 +0000	[thread overview]
Message-ID: <1227627889-8373-10-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1227627889-8373-9-git-send-email-broonie@opensource.wolfsonmicro.com>

From: Jarkko Nikula <jarkko.nikula@nokia.com>

Patch adds support for mono audio links so that McBSP DAI can operate with
real mono codecs. In I2S, the signalling remains the same but only first
frame (left channel) is transmitting audio data and second frame having null
data. In DSP_A, only first frame is transmitted.

Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/omap/omap-mcbsp.c |   23 ++++++++++++++---------
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 252bc7e..e8f1314 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -203,7 +203,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
 	struct omap_mcbsp_data *mcbsp_data = to_mcbsp(cpu_dai->private_data);
 	struct omap_mcbsp_reg_cfg *regs = &mcbsp_data->regs;
 	int dma, bus_id = mcbsp_data->bus_id, id = cpu_dai->id;
-	int wlen;
+	int wlen, channels;
 	unsigned long port;
 
 	if (cpu_class_is_omap1()) {
@@ -232,12 +232,17 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
 		return 0;
 	}
 
-	switch (params_channels(params)) {
+	channels = params_channels(params);
+	switch (channels) {
 	case 2:
-		/* Set 1 word per (McBPSP) frame and use dual-phase frames */
-		regs->rcr2	|= RFRLEN2(1 - 1) | RPHASE;
+		/* Use dual-phase frames */
+		regs->rcr2	|= RPHASE;
+		regs->xcr2	|= XPHASE;
+	case 1:
+		/* Set 1 word per (McBSP) frame */
+		regs->rcr2	|= RFRLEN2(1 - 1);
 		regs->rcr1	|= RFRLEN1(1 - 1);
-		regs->xcr2	|= XFRLEN2(1 - 1) | XPHASE;
+		regs->xcr2	|= XFRLEN2(1 - 1);
 		regs->xcr1	|= XFRLEN1(1 - 1);
 		break;
 	default:
@@ -266,8 +271,8 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
 		regs->srgr1	|= FWID(wlen - 1);
 		break;
 	case SND_SOC_DAIFMT_DSP_A:
-		regs->srgr2	|= FPER(wlen * 2 - 1);
-		regs->srgr1	|= FWID(wlen * 2 - 2);
+		regs->srgr2	|= FPER(wlen * channels - 1);
+		regs->srgr1	|= FWID(wlen * channels - 2);
 		break;
 	}
 
@@ -457,13 +462,13 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	.name = "omap-mcbsp-dai-"#link_id,			\
 	.id = (link_id),					\
 	.playback = {						\
-		.channels_min = 2,				\
+		.channels_min = 1,				\
 		.channels_max = 2,				\
 		.rates = OMAP_MCBSP_RATES,			\
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,		\
 	},							\
 	.capture = {						\
-		.channels_min = 2,				\
+		.channels_min = 1,				\
 		.channels_max = 2,				\
 		.rates = OMAP_MCBSP_RATES,			\
 		.formats = SNDRV_PCM_FMTBIT_S16_LE,		\
-- 
1.5.6.5

  reply	other threads:[~2008-11-25 15:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-25 15:43 [PATCH 00/13] ASoC updates Mark Brown
2008-11-25 15:44 ` [PATCH 01/13] ASoC: Use supplied DAI for WM9713 rather than substream Mark Brown
2008-11-25 15:44   ` [PATCH 02/13] ASoC: TWL4030: Disable soft-volume Mark Brown
2008-11-25 15:44     ` [PATCH 03/13] ASoC: TWL4030: Change the Master volume control to TLV Mark Brown
2008-11-25 15:44       ` [PATCH 04/13] ASoC: TWL4030: Add CGAIN volume control Mark Brown
2008-11-25 15:44         ` [PATCH 05/13] ASoC: TWL4030: Add helper function for output gain controls Mark Brown
2008-11-25 15:44           ` [PATCH 06/13] ASoC: Remove DAI type information Mark Brown
2008-11-25 15:44             ` [PATCH 07/13] ASoC: Flag AD1980 as an AC97 interface Mark Brown
2008-11-25 15:44               ` [PATCH 08/13] ASoC: Lower priority of resume work logging Mark Brown
2008-11-25 15:44                 ` [PATCH 09/13] ASoC: OMAP: Apply channel constrains to N810 machine driver Mark Brown
2008-11-25 15:44                   ` Mark Brown [this message]
2008-11-25 15:44                     ` [PATCH 11/13] ASoC: Fix TWL4030 Kconfig dependency Mark Brown
2008-11-25 15:44                       ` [PATCH 12/13] ASoC: Add support for TI SDP3430 Mark Brown
2008-11-25 15:44                         ` [PATCH 13/13] ASoC: tosa: move gpio probing to machine callbacks Mark Brown
2008-11-25 15:58 ` [PATCH 00/13] ASoC updates Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1227627889-8373-10-git-send-email-broonie@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jarkko.nikula@nokia.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.