Skip to contentSkip to conversation

ALSA: ASoC: DaVinci: Fix SFFSDR init bug.

PATCH In review Hugo Villeneuve 4 participants 13 messages Jan 15, 2009 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/1 ALSA: ASoC: DaVinci: Fix SFFSDR init bug.

Removed call to machine_is_sffsdr() in module init function because it always returns zero and causes GCC to optimise and remove all functions of the module.

---
 sound/soc/davinci/davinci-sffsdr.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
sound/soc/davinci/davinci-sffsdr.c +0 -3
index 1bbde3e..3e8e6cd 100644
@@ -115,9 +115,6 @@ static int __init sffsdr_init(void)
 {
 	int ret;
 
-	if (!machine_is_sffsdr())
-		return -EINVAL;
-
 	sffsdr_snd_device = platform_device_alloc("soc-audio", 0);
 	if (!sffsdr_snd_device) {
 		printk(KERN_ERR "platform device allocation failed\n");
Signature · 1 line
1.5.4.5
#2 lore raw
Quoted 5 lines · Hugo Villeneuve

Removed call to machine_is_sffsdr() in module init function because it always returns zero and causes GCC to optimise and remove all functions of the module.

This should be replaced with the appropriate machine_is_() call for the system.

#3 lore raw
Quoted 9 lines · On Thu, 15 Jan 2009 20:57:53 +0000 Mark Brown <[email protected]> wrote:
Quoted 5 lines · Hugo Villeneuve

Removed call to machine_is_sffsdr() in module init function because it always returns zero and causes GCC to optimise and remove all functions of the module.

This should be replaced with the appropriate machine_is_() call for the system.

It is the appropriate call, but at compile time it always return false.

Hugo.

---------------
Hugo Villeneuve
www.hugovil.com
---------------

#4 lore raw
Quoted 7 lines · Hugo Villeneuve
Quoted 2 lines · On Thu, 15 Jan 2009 20:57:53 +0000 Mark Brown <[email protected]> wrote:

This should be replaced with the appropriate machine_is_() call for the system.

It is the appropriate call, but at compile time it always return false.

Sounds like that should be fixed instead, then?

#5 lore raw
Quoted 11 lines · On Thu, 15 Jan 2009 21:09:12 +0000 Mark Brown <[email protected]> wrote:
Quoted 8 lines · Hugo Villeneuve
Quoted 2 lines · On Thu, 15 Jan 2009 20:57:53 +0000 Mark Brown <[email protected]> wrote:

This should be replaced with the appropriate machine_is_() call for the system.

It is the appropriate call, but at compile time it always return false.

Sounds like that should be fixed instead, then?

If someone wants to fix it, fine. I tried but couldn´t find what is wrong. Maybe the person who added that piece of code (not me) should fix it...

Ciao, Hugo.

---------------
Hugo Villeneuve
www.hugovil.com
---------------

#6 lore raw
Quoted 7 lines · Hugo Villeneuve
Quoted 1 line · Mark Brown

Sounds like that should be fixed instead, then?

If someone wants to fix it, fine. I tried but couldn?t find what is wrong. Maybe the person who added that piece of code (not me) should fix it...

It was added by David Brownell to prevent the module being used on the wrong hardware, which is perfectly reasonable. The machine_is_foo() tests are a very standard part of the ARM infrastructure and are widely used - if they're not working that's where the fix is. Are you sure that your .config has MACH_SFFSDR set? There appears to be no mainline support for the core machine so you'd have to have patched that in...

#7 lore raw
Quoted 9 lines · On Thu, 15 Jan 2009 21:40:41 +0000 Mark Brown <[email protected]> wrote:
Quoted 7 lines · Hugo Villeneuve
Quoted 1 line · Mark Brown

Sounds like that should be fixed instead, then?

If someone wants to fix it, fine. I tried but couldn?t find what is wrong. Maybe the person who added that piece of code (not me) should fix it...

Quoted 7 lines

It was added by David Brownell to prevent the module being used on the wrong hardware, which is perfectly reasonable. The machine_is_foo() tests are a very standard part of the ARM infrastructure and are widely used - if they're not working that's where the fix is. Are you sure that your .config has MACH_SFFSDR set? There appears to be no mainline support for the core machine so you'd have to have patched that in...

I just found the cause. I created the SFFSDR machine on the ARM website, and this automatically defined the macro CONFIG_MACH_SFFSDR, and not CONFIG_MACH_DAVINCI_SFFSDR like it is currently in the Kconfig.

I will submit a patch to rename CONFIG_MACH_DAVINCI_SFFSDR to CONFIG_MACH_SFFSDR in the Kconfig file.

Thank-you everyone for your help.

Hugo.

---------------
Hugo Villeneuve
www.hugovil.com
---------------

A message that is not in the archive (sent off-list or not yet received): 20090115161700.4d671c05.hugo-rg2e/[email protected]

#9 lore raw
Quoted 10 lines · Hugo Villeneuve
Quoted 7 lines · On Thu, 15 Jan 2009 21:09:12 +0000 Mark Brown…
Quoted 5 lines · Hugo Villeneuve
Quoted 2 lines · On Thu, 15 Jan 2009 20:57:53 +0000 Mark Brown…

This should be replaced with the appropriate machine_is_() call for the system.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It is the appropriate call, but at compile time it always return false.

Sounds like that should be fixed instead, then?

If someone wants to fix it, fine. I tried but couldn´t find what is wrong. Maybe the person who added that piece of code (not me) should fix it...

Just to verify the obvious, the u-boot is supplying the correct machine type to the kernel right?

Quoted 12 lines

Ciao, Hugo.

---------------
Hugo Villeneuve
www.hugovil.com
---------------

_______________________________________________
Davinci-linux-open-source mailing list Davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/@public.gmane.org
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

#10 lore raw
In reply to Hugo Villeneuve
Quoted 5 lines · Hugo Villeneuve

Removed call to machine_is_sffsdr() in module init function because it always returns zero and causes GCC to optimise and remove all functions of the module.

NAK. Enable the SFF board in Kconfig, and it won't be returning false. If you don't enable it, you can't possibly be running on an SFF board, and so there's no reason to include any of these function...

Quoted 28 lines
---
 sound/soc/davinci/davinci-sffsdr.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)
sound/soc/davinci/davinci-sffsdr.c +0 -3
index 1bbde3e..3e8e6cd 100644
@@ -115,9 +115,6 @@ static int __init sffsdr_init(void)
 {
 	int ret;
 
-	if (!machine_is_sffsdr())
-		return -EINVAL;
-
 	sffsdr_snd_device = platform_device_alloc("soc-audio", 0);
 	if (!sffsdr_snd_device) {
 		printk(KERN_ERR "platform device allocation failed\n");
Signature · 7 lines
1.5.4.5


_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
#11 lore raw

PATCH 1/1 ALSA: ASoC: DaVinci: Fix SFFSDR compilation error.

In reply to a message not in the archive

Remove dependency on sffsdr_fpga_set_codec_fs() when the SFFSDR FPGA module is not selected.

---
 sound/soc/davinci/davinci-sffsdr.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
sound/soc/davinci/davinci-sffsdr.c +17 -3
index 3e8e6cd..e3ea07a 100644
@@ -25,7 +25,9 @@
 #include <asm/gpio.h>
 #include <asm/dma.h>
 #include <asm/mach-types.h>
+#ifdef CONFIG_SFFSDR_FPGA
 #include <asm/plat-sffsdr/sffsdr-fpga.h>
+#endif
 
 #include <mach/asp.h>
 #include <mach/edma.h>
@@ -42,6 +44,17 @@ static int sffsdr_hw_params(struct snd_pcm_substream *substream,
 	int fs;
 	int ret = 0;
 
+	/* Fsref can be 32000, 44100 or 48000. */
+	fs = params_rate(params);
+
+#ifndef CONFIG_SFFSDR_FPGA
+	/* Without the FPGA module, the Fs is fixed at 44100 Hz */
+	if (fs != 44100) {
+		pr_debug("warning: only 44.1 kHz is supported without SFFSDR FPGA module\n");
+		return -EINVAL;
+	}
+#endif
+
 	/* Set cpu DAI configuration:
 	 * CLKX and CLKR are the inputs for the Sample Rate Generator.
 	 * FSX and FSR are outputs, driven by the sample Rate Generator. */
@@ -52,12 +65,13 @@ static int sffsdr_hw_params(struct snd_pcm_substream *substream,
 	if (ret < 0)
 		return ret;
 
-	/* Fsref can be 32000, 44100 or 48000. */
-	fs = params_rate(params);
-
 	pr_debug("sffsdr_hw_params: rate = %d Hz\n", fs);
 
+#ifndef CONFIG_SFFSDR_FPGA
+	return 0;
+#else
 	return sffsdr_fpga_set_codec_fs(fs);
+#endif
 }
 
 static struct snd_soc_ops sffsdr_ops = {
Signature · 1 line
1.5.4.5
#12 lore raw

Re: [PATCH 1/1] ALSA: ASoC: DaVinci: Fix SFFSDR compilation error.

Quoted 4 lines · Hugo Villeneuve

Remove dependency on sffsdr_fpga_set_codec_fs() when the SFFSDR FPGA module is not selected.

Looks good, applied.

#13 lore raw

Re: [PATCH 1/1] ALSA: ASoC: DaVinci: Fix SFFSDR compilation error.

In reply to Hugo Villeneuve
Quoted 5 lines · Hugo Villeneuve

Remove dependency on sffsdr_fpga_set_codec_fs() when the SFFSDR FPGA module is not selected.

---

Something looks broken in the config you're building with. As in, very deeply broken. You should fix the config instead of hacking around those bugs with ifdefs.

Quoted 62 lines
 sound/soc/davinci/davinci-sffsdr.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)
sound/soc/davinci/davinci-sffsdr.c +17 -3
index 3e8e6cd..e3ea07a 100644
@@ -25,7 +25,9 @@
 #include <asm/gpio.h>
 #include <asm/dma.h>
 #include <asm/mach-types.h>
+#ifdef CONFIG_SFFSDR_FPGA
 #include <asm/plat-sffsdr/sffsdr-fpga.h>
+#endif
 
 #include <mach/asp.h>
 #include <mach/edma.h>
@@ -42,6 +44,17 @@ static int sffsdr_hw_params(struct snd_pcm_substream *substream,
 	int fs;
 	int ret = 0;
 
+	/* Fsref can be 32000, 44100 or 48000. */
+	fs = params_rate(params);
+
+#ifndef CONFIG_SFFSDR_FPGA
+	/* Without the FPGA module, the Fs is fixed at 44100 Hz */
+	if (fs != 44100) {
+		pr_debug("warning: only 44.1 kHz is supported without SFFSDR FPGA module\n");
+		return -EINVAL;
+	}
+#endif
+
 	/* Set cpu DAI configuration:
 	 * CLKX and CLKR are the inputs for the Sample Rate Generator.
 	 * FSX and FSR are outputs, driven by the sample Rate Generator. */
@@ -52,12 +65,13 @@ static int sffsdr_hw_params(struct snd_pcm_substream *substream,
 	if (ret < 0)
 		return ret;
 
-	/* Fsref can be 32000, 44100 or 48000. */
-	fs = params_rate(params);
-
 	pr_debug("sffsdr_hw_params: rate = %d Hz\n", fs);
 
+#ifndef CONFIG_SFFSDR_FPGA
+	return 0;
+#else
 	return sffsdr_fpga_set_codec_fs(fs);
+#endif
 }
 
 static struct snd_soc_ops sffsdr_ops = {
Signature · 7 lines
1.5.4.5


_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source
#14 lore raw

Re: [PATCH 1/1] ALSA: ASoC: DaVinci: Fix SFFSDR compilation error.

Quoted 10 lines · On Thu, 15 Jan 2009 13:23:09 -0800 David Brownell <[email protected]> wrote:
Quoted 5 lines · Hugo Villeneuve

Remove dependency on sffsdr_fpga_set_codec_fs() when the SFFSDR FPGA module is not selected.

---

Something looks broken in the config you're building with. As in, very deeply broken. You should fix the config instead of hacking around those bugs with ifdefs.

Nothing is broken, it is an optional feature.

Hugo.

---------------
Hugo Villeneuve
www.hugovil.com
---------------