Skip to contentSkip to conversation

ARM: DaVinci: ASoC: Adds ALSA SoC DIT/DIR driver support for DM646X

PATCH In review Naresh Medisetty 2 participants 3 messages Mar 16, 2009 – Mar 18, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 7/9 ARM: DaVinci: ASoC: Adds ALSA SoC DIT/DIR driver support for DM646X

Adds ALSA SoC DIT/DIR driver support for DM646X

---
This patch applies on the ASoC tree available at http://opensource.wolfsonmicro.com/cgi-bin/gitweb.cgi?p=linux-2.6-asoc.git;a=commit;h=168776ef58d38503f8ac4f8a7eb1039137208032.

 sound/soc/codecs/codec_stubs.c |   63 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 63 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/codec_stubs.c
sound/soc/codecs/codec_stubs.c new file +63 -0
new file mode 100644
index 0000000..60d3446
@@ -0,0 +1,63 @@
+/*
+ * ALSA SoC DaVinci DIT/DIR driver
+ *
+ *  TI DaVinci audio controller can operate in DIT/DIR (SPDI/F) where
+ *  no codec is needed.  This file provides stub codec that can be used
+ *  in these configurations.
+ *
+ * Author:      Steve Chen,  <[email protected]>
+ * Copyright:   (C) 2008 MontaVista Software, Inc., <[email protected]>
+ * Copyright:   (C) 2008  Texas Instruments, India
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <sound/soc.h>
+#include <sound/pcm.h>
+
+#define STUB_RATES	SNDRV_PCM_RATE_8000_96000
+#define STUB_FORMATS	(SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
+			SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
+
+struct snd_soc_dai dit_stub_dai[] = {
+	{
+		.name = "DIT",
+		.playback = {
+			.stream_name = "Playback",
+			.channels_min = 1,
+			.channels_max = 384,
+			.rates = STUB_RATES,
+			.formats = STUB_FORMATS,
+		},
+	}
+};
+
+struct snd_soc_dai dir_stub_dai[] = {
+	{
+		.name = "DIR",
+		.capture = {
+			.stream_name = "Capture",
+			.channels_min = 1,
+			.channels_max = 384,
+			.rates = STUB_RATES,
+			.formats = STUB_FORMATS,
+		},
+	}
+};
+
+static int __init dit_modinit(void)
+{
+	return snd_soc_register_dai(dit_stub_dai);
+}
+module_init(dit_modinit);
+
+static void __exit dit_exit(void)
+{
+	snd_soc_unregister_dai(dit_stub_dai);
+}
+module_exit(dit_exit);
+
Signature · 1 line
1.5.6
#1 lore raw

sound/soc/codecs/codec_stubs.c line 6

Quoted 9 lines · Naresh Medisetty
sound/soc/codecs/codec_stubs.c new file +6 -0
@@ -0,0 +1,63 @@
+/*
+ * ALSA SoC DaVinci DIT/DIR driver
+ *
+ *  TI DaVinci audio controller can operate in DIT/DIR (SPDI/F) where
+ *  no codec is needed.  This file provides stub codec that can be used
+ *  in these configurations.

Either the driver is a generic driver (in which case this comment should reflect that) or it's specific to this hardware (in which case the name is entirely inappropriate)...

sound/soc/codecs/codec_stubs.c line 24

Quoted 3 lines
sound/soc/codecs/codec_stubs.c new file +3 -0
+#define STUB_RATES	SNDRV_PCM_RATE_8000_96000
+#define STUB_FORMATS	(SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
+			SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)

...looking at this and the rest of the definitions I'd suggest that the driver is specific to a particular device at the minute.

sound/soc/codecs/codec_stubs.c line 62

Quoted 11 lines
sound/soc/codecs/codec_stubs.c new file +10 -0
+static int __init dit_modinit(void)
+{
+	return snd_soc_register_dai(dit_stub_dai);
+}
+module_init(dit_modinit);
 
+static void __exit dit_exit(void)
+{
+	snd_soc_unregister_dai(dit_stub_dai);
+}
+module_exit(dit_exit);

It should really probe as a platform device and register the DAIs when that happens (see wm8350 and wm8400 for examples). You could make the driver more generic by passing in the parameters as platform data.

#2 lore raw
Quoted 12 lines

sound/soc/codecs/codec_stubs.c line 4

Quoted 11 lines · Naresh Medisetty
sound/soc/codecs/codec_stubs.c new file +4 -0
@@ -0,0 +1,63 @@
+/*
+ * ALSA SoC DaVinci DIT/DIR driver
+ *
+ *  TI DaVinci audio controller can operate in DIT/DIR (SPDI/F)

where

Quoted 8 lines

sound/soc/codecs/codec_stubs.c line 5

Quoted 1 line
sound/soc/codecs/codec_stubs.c new file +1 -0
+ *  no codec is needed.  This file provides stub codec that can be

used

sound/soc/codecs/codec_stubs.c line 6

Quoted 1 line
sound/soc/codecs/codec_stubs.c new file +1 -0
+ *  in these configurations.

Either the driver is a generic driver (in which case this comment should
reflect that) or it's specific to this hardware (in which case the name is entirely inappropriate)...

It's specific to dm646x, I will rename this while re-submitting the Patch

Quoted 16 lines

sound/soc/codecs/codec_stubs.c line 8

Quoted 3 lines
sound/soc/codecs/codec_stubs.c new file +2 -0
+#define STUB_RATES   SNDRV_PCM_RATE_8000_96000
+#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |

SNDRV_PCM_FMTBIT_S20_3LE | \

sound/soc/codecs/codec_stubs.c line 9

Quoted 1 line
sound/soc/codecs/codec_stubs.c new file +1 -0
+                     SNDRV_PCM_FMTBIT_S24_3LE |

SNDRV_PCM_FMTBIT_S32_LE)

...looking at this and the rest of the definitions I'd suggest that the driver is specific to a particular device at the minute.

Quoted 5 lines
sound/soc/codecs/codec_stubs.c new file +5 -0
+static int __init dit_modinit(void)
+{
+     return snd_soc_register_dai(dit_stub_dai);
+}
+module_init(dit_modinit);
Quoted 9 lines

sound/soc/codecs/codec_stubs.c line 62

Quoted 5 lines
sound/soc/codecs/codec_stubs.c new file +5 -0
+static void __exit dit_exit(void)
+{
+     snd_soc_unregister_dai(dit_stub_dai);
+}
+module_exit(dit_exit);

It should really probe as a platform device and register the DAIs when that happens (see wm8350 and wm8400 for examples). You could make the driver more generic by passing in the parameters as platform data.

I will re-submit this patch by fixing this.