If anyone is having a problem with their audio cape quality try applying
this patch to your 3.8 kernel and let me know if it solves your problem.  I
have tested it and it seems to do the job for me but I would like to get
input from others.


On Tue, Nov 12, 2013 at 8:46 PM, Walter Schilling <[email protected]>wrote:

> Daniel:
>
> I'm curious as to whether you can shed any additional light on BBB
> compatibility with the audio cape.  I'm trying to prepare for a course that
> will run in the spring, and we're looking to use audio, lcd screen, and
> camera cape.  I'd like to go with the black for cost reasons, but I'm not
> sure of the support for the devices.
>
> Walt
>
>
> On Sunday, July 28, 2013 1:43:31 AM UTC-5, Daniel Nilsson wrote:
>>
>> Hi,
>>
>> Darren has been working on restoring support for the audio cape, this
>> is done by reworking the HDMI support patch. There is nothing wrong
>> with the audio cape or the support for it in mainline 3.8, it is the
>> patch that adds support for HDMI on the beaglebone black that was
>> implemented in a way that didn't take other audio peripherals into
>> account. Darren has reworked this and sent an updated HDMI patch that
>> restored audio support, but he wanted to do some more work on it
>> before considering it done. Haven't heard since then, I'll ping him
>> and check if he is still working on it.
>>
>> Regards
>> Daniel
>>
>>
>> On Sun, Jul 28, 2013 at 4:00 AM, Gerald Coley <[email protected]>
>> wrote:
>> > Audio cape still does not work from what I can see. Darren never was
>> working
>> > on it. He is working on HDMI issues
>> >
>> > I suggest you contact [email protected] direct for help with
>> their
>> > product.
>> >
>> > Gerald
>> >
>> >
>> >
>> > On Sat, Jul 27, 2013 at 5:55 PM, <[email protected]> wrote:
>> >>
>> >> It's been a month since it was mentioned that the audio cape
>> compatibility
>> >> problem was being looked at by "Darren". In addition, there have been
>> no
>> >> updates since 6-20 for the flasher (BBB-eMMC-flasher-2013.06.20.img.xz).
>> Has
>> >> there been any progress on the BBB lately? Thanks.
>> >>
>> >> --
>> >> For more options, visit http://beagleboard.org/discuss
>> >> ---
>> >> You received this message because you are subscribed to the Google
>> Groups
>> >> "BeagleBoard" group.
>> >> To unsubscribe from this group and stop receiving emails from it, send
>> an
>> >> email to [email protected].
>> >> For more options, visit https://groups.google.com/groups/opt_out.
>> >>
>> >>
>> >
>> >
>> > --
>> > For more options, visit http://beagleboard.org/discuss
>> > ---
>> > You received this message because you are subscribed to a topic in the
>> > Google Groups "BeagleBoard" group.
>> > To unsubscribe from this topic, visit
>> > https://groups.google.com/d/topic/beagleboard/ZJGwxA7BG4E/unsubscribe.
>> > To unsubscribe from this group and all its topics, send an email to
>> > [email protected].
>> > For more options, visit https://groups.google.com/groups/opt_out.
>> >
>> >
>>
>  --
> For more options, visit http://beagleboard.org/discuss
> ---
> You received this message because you are subscribed to the Google Groups
> "BeagleBoard" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
For more options, visit http://beagleboard.org/discuss
--- 
You received this message because you are subscribed to the Google Groups 
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
From 33e9ace7e6bc432ee4455ffcb827246e2df8fb54 Mon Sep 17 00:00:00 2001
From: Darren Etheridge <[email protected]>
Date: Mon, 1 Jul 2013 16:06:55 -0500
Subject: [PATCH] Make the McASP code generic again, remove all hardcoding

After adding the HDMI audio, the McASP driver was left in
a mess, and broken when used with other capes.  This patch
puts things right, and moves the necessary config code into
davinci-evm.c where it belongs.

Signed-off-by: Darren Etheridge <[email protected]>
---
 sound/soc/davinci/davinci-evm.c   |   48 +++++++++++++++++++++++++++----------
 sound/soc/davinci/davinci-mcasp.c |   12 ++++-----
 2 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 7a7fc47..421feb0 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -146,6 +146,32 @@ static const struct snd_soc_dapm_route audio_map[] = {
 };
 
 /* Logic for a aic3x as connected on a davinci-evm */
+static int evm_tda998x_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct snd_soc_dai *codec_dai = rtd->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	int ret;
+
+	ret = snd_soc_dai_set_clkdiv(cpu_dai, 0, 1);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_clkdiv(cpu_dai, 1, 8);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_sysclk(cpu_dai, 0, 0, SND_SOC_CLOCK_IN);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_IB_NF);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+/* Logic for a aic3x as connected on a davinci-evm */
 static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
@@ -380,11 +406,12 @@ static int davinci_evm_probe(struct platform_device *pdev)
 		evm_dai.name		= "NXP TDA HDMI Chip";
 		evm_dai.stream_name	= "HDMI";
 		evm_dai.codec_dai_name	= "nxp-hdmi-hifi";
+		evm_dai.init = evm_tda998x_init;
 
-		/* 
-		 * Move GPIO handling out of the probe, if probe gets 
+		/*
+		 * Move GPIO handling out of the probe, if probe gets
 		 * deferred, the gpio will have been claimed on previous
-		 * probe and will fail on the second and susequent probes 
+		 * probe and will fail on the second and susequent probes
 		 */
 		clk_gpio = of_get_named_gpio(np, "mcasp_clock_enable", 0);
 		if (clk_gpio < 0) {
@@ -398,11 +425,8 @@ static int davinci_evm_probe(struct platform_device *pdev)
 		  return -EINVAL;
 		}
 		gpio_set_value(clk_gpio, 1);
-		evm_dai.dai_fmt = SND_SOC_DAIFMT_CBS_CFS | SND_SOC_DAIFMT_DSP_B | SND_SOC_DAIFMT_IB_NF;
 		break;
-	  
 	}
-	
 
 	evm_dai.codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);
 	if (!evm_dai.codec_of_node)
@@ -421,9 +445,9 @@ static int davinci_evm_probe(struct platform_device *pdev)
 		return ret;
 
 	ret = snd_soc_register_card(&evm_soc_card);
-	if (ret) {
+	if (ret)
 		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
-	} 
+
 	return ret;
 }
 
@@ -460,9 +484,8 @@ static int __init evm_init(void)
 	 * If dtb is there, the devices will be created dynamically.
 	 * Only register platfrom driver structure.
 	 */
-	if (of_have_populated_dt()) {
-	  return platform_driver_register(&davinci_evm_driver);
-	}
+	if (of_have_populated_dt())
+		return platform_driver_register(&davinci_evm_driver);
 #endif
 
 	if (machine_is_davinci_evm()) {
@@ -483,9 +506,8 @@ static int __init evm_init(void)
 	} else if (machine_is_davinci_da850_evm()) {
 		evm_snd_dev_data = &da850_snd_soc_card;
 		index = 0;
-	} else {
+	} else
 		return -EINVAL;
-	}
 
 	evm_snd_device = platform_device_alloc("soc-audio", index);
 	if (!evm_snd_device)
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index bef4e72..83232c6 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -484,6 +484,10 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 		mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
 		mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
 		break;
+	case SND_SOC_DAIFMT_I2S:
+		mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
+		mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
+		break;
 	default:
 		/* configure a full-word SYNC pulse (LRCLK) */
 		mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
@@ -498,16 +502,13 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
 	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
 	case SND_SOC_DAIFMT_CBS_CFS:
 		/* codec is clock and frame slave */
-	  	mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE | ACLKXDIV(7));
-	  	mcasp_set_bits(base + DAVINCI_MCASP_AHCLKXCTL_REG,  AHCLKXDIV(0));
-	  	mcasp_clr_bits(base + DAVINCI_MCASP_AHCLKXCTL_REG,  AHCLKXE);
+		mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
 		mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
 
 		mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
 		mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE);
 
 		mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, ACLKX | AFSX);
-		mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG, AHCLKX);
 		break;
 	case SND_SOC_DAIFMT_CBM_CFS:
 		/* codec is clock master and frame slave */
@@ -749,7 +750,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
 	if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		/* bit stream is MSB first  with no delay */
 		/* DSP_B mode */
-	  	mcasp_clr_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
 		mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask);
 		mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD);
 
@@ -759,8 +759,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
 		else
 			printk(KERN_ERR "playback tdm slot %d not supported\n",
 				dev->tdm_slots);
-		mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
-		mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
 	} else {
 		/* bit stream is MSB first with no delay */
 		/* DSP_B mode */
-- 
1.7.0.4

Reply via email to