linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Couple of fixes to davinci-mcasp driver
@ 2014-06-13  9:49 Jyri Sarha
  2014-06-13  9:49 ` [PATCH 1/2] ASoC: davinci-mcasp: Add dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC Jyri Sarha
  2014-06-13  9:50 ` [PATCH 2/2] ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider Jyri Sarha
  0 siblings, 2 replies; 5+ messages in thread
From: Jyri Sarha @ 2014-06-13  9:49 UTC (permalink / raw)
  To: alsa-devel, linux-omap
  Cc: peter.ujfalusi, broonie, liam.r.girdwood, detheridge, Jyri Sarha

These changes target to sii9022 HDMI audio support, but are
independent fixes.

Jyri Sarha (2):
  ASoC: davinci-mcasp: Add dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC
  ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider

 sound/soc/davinci/Kconfig         |    1 +
 sound/soc/davinci/davinci-mcasp.c |   22 +++++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

-- 
1.7.9.5


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

* [PATCH 1/2] ASoC: davinci-mcasp: Add dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC
  2014-06-13  9:49 [PATCH 0/2] Couple of fixes to davinci-mcasp driver Jyri Sarha
@ 2014-06-13  9:49 ` Jyri Sarha
  2014-06-21 10:03   ` Mark Brown
  2014-06-13  9:50 ` [PATCH 2/2] ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider Jyri Sarha
  1 sibling, 1 reply; 5+ messages in thread
From: Jyri Sarha @ 2014-06-13  9:49 UTC (permalink / raw)
  To: alsa-devel, linux-omap
  Cc: peter.ujfalusi, broonie, liam.r.girdwood, detheridge, Jyri Sarha

Fixes build with SND_DAVINCI_SOC or SND_OMAP_SOC alone and adds build
dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 sound/soc/davinci/Kconfig         |    1 +
 sound/soc/davinci/davinci-mcasp.c |    8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig
index 50a0987..fdbb16f 100644
--- a/sound/soc/davinci/Kconfig
+++ b/sound/soc/davinci/Kconfig
@@ -6,6 +6,7 @@ config SND_DAVINCI_SOC_I2S
 	tristate
 
 config SND_DAVINCI_SOC_MCASP
+	depends on SND_DAVINCI_SOC || SND_OMAP_SOC
 	tristate
 
 config SND_DAVINCI_SOC_VCIF
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 9afb146..0ee4986 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -1223,14 +1223,22 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		goto err;
 
 	switch (mcasp->version) {
+#if IS_BUILTIN(CONFIG_SND_DAVINCI_SOC) || \
+	(IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
+	 IS_MODULE(CONFIG_SND_DAVINCI_SOC))
 	case MCASP_VERSION_1:
 	case MCASP_VERSION_2:
 	case MCASP_VERSION_3:
 		ret = davinci_soc_platform_register(&pdev->dev);
 		break;
+#endif
+#if IS_BUILTIN(CONFIG_SND_OMAP_SOC) || \
+	(IS_MODULE(CONFIG_SND_DAVINCI_SOC_MCASP) && \
+	 IS_MODULE(CONFIG_SND_OMAP_SOC))
 	case MCASP_VERSION_4:
 		ret = omap_pcm_platform_register(&pdev->dev);
 		break;
+#endif
 	default:
 		dev_err(&pdev->dev, "Invalid McASP version: %d\n",
 			mcasp->version);
-- 
1.7.9.5


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

* [PATCH 2/2] ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider
  2014-06-13  9:49 [PATCH 0/2] Couple of fixes to davinci-mcasp driver Jyri Sarha
  2014-06-13  9:49 ` [PATCH 1/2] ASoC: davinci-mcasp: Add dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC Jyri Sarha
@ 2014-06-13  9:50 ` Jyri Sarha
  2014-06-21 10:04   ` Mark Brown
  1 sibling, 1 reply; 5+ messages in thread
From: Jyri Sarha @ 2014-06-13  9:50 UTC (permalink / raw)
  To: alsa-devel, linux-omap
  Cc: peter.ujfalusi, broonie, liam.r.girdwood, detheridge, Jyri Sarha

Do not fail if the exact BLCK rate can not be produced, just print a
warning. Check that sysclk frequency is set before implicitly setting
the BCLK divider.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 sound/soc/davinci/davinci-mcasp.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 0ee4986..e26a89d 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -676,14 +676,18 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
 	int ret;
 
 	/* If mcasp is BCLK master we need to set BCLK divider */
-	if (mcasp->bclk_master) {
+	if (mcasp->bclk_master && mcasp->sysclk_freq) {
 		unsigned int bclk_freq = snd_soc_params_to_bclk(params);
+		unsigned int div = mcasp->sysclk_freq / bclk_freq;
 		if (mcasp->sysclk_freq % bclk_freq != 0) {
-			dev_err(mcasp->dev, "Can't produce required BCLK\n");
-			return -EINVAL;
+			if (((mcasp->sysclk_freq / div) - bclk_freq) >
+			    (bclk_freq - (mcasp->sysclk_freq / (div+1))))
+				div++;
+			dev_warn(mcasp->dev,
+				 "Inaccurate BCLK: %u Hz / %u != %u Hz\n",
+				 mcasp->sysclk_freq, div, bclk_freq);
 		}
-		davinci_mcasp_set_clkdiv(
-			cpu_dai, 1, mcasp->sysclk_freq / bclk_freq);
+		davinci_mcasp_set_clkdiv(cpu_dai, 1, div);
 	}
 
 	ret = mcasp_common_hw_param(mcasp, substream->stream,
-- 
1.7.9.5


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

* Re: [PATCH 1/2] ASoC: davinci-mcasp: Add dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC
  2014-06-13  9:49 ` [PATCH 1/2] ASoC: davinci-mcasp: Add dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC Jyri Sarha
@ 2014-06-21 10:03   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-06-21 10:03 UTC (permalink / raw)
  To: Jyri Sarha
  Cc: alsa-devel, linux-omap, peter.ujfalusi, liam.r.girdwood,
	detheridge

[-- Attachment #1: Type: text/plain, Size: 198 bytes --]

On Fri, Jun 13, 2014 at 12:49:59PM +0300, Jyri Sarha wrote:
> Fixes build with SND_DAVINCI_SOC or SND_OMAP_SOC alone and adds build
> dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC.

Applied, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 2/2] ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider
  2014-06-13  9:50 ` [PATCH 2/2] ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider Jyri Sarha
@ 2014-06-21 10:04   ` Mark Brown
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2014-06-21 10:04 UTC (permalink / raw)
  To: Jyri Sarha
  Cc: peter.ujfalusi, liam.r.girdwood, alsa-devel, linux-omap,
	detheridge


[-- Attachment #1.1: Type: text/plain, Size: 426 bytes --]

On Fri, Jun 13, 2014 at 12:50:00PM +0300, Jyri Sarha wrote:
> Do not fail if the exact BLCK rate can not be produced, just print a
> warning. Check that sysclk frequency is set before implicitly setting
> the BCLK divider.

I've appled this but not as a fix - it's kind of on the edge if we
should be doing this at all, it's helpful for interoperability but
getting an inexact frequency obviously impacts the resulting audio.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



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

end of thread, other threads:[~2014-06-21 10:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13  9:49 [PATCH 0/2] Couple of fixes to davinci-mcasp driver Jyri Sarha
2014-06-13  9:49 ` [PATCH 1/2] ASoC: davinci-mcasp: Add dependecy to SND_DAVINCI_SOC or SND_OMAP_SOC Jyri Sarha
2014-06-21 10:03   ` Mark Brown
2014-06-13  9:50 ` [PATCH 2/2] ASoC: davinci-mcasp: Allow best effort in selecting BCLK divider Jyri Sarha
2014-06-21 10:04   ` Mark Brown

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).