Skip to contentSkip to conversation

ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers

PATCH Superseded Grant Likely 7 participants 46 messages Jul 12, 2008 – Jul 18, 2008

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 ALSA SoC: Add OpenFirmware helper for matching bus and codec drivers

From: Grant Likely <[email protected]>

Simple utility layer for creating ASoC machine instances based on data in the OpenFirmware device tree. OF aware platform drivers and codec drivers register themselves with this framework and the framework automatically instantiates a machine driver.

This is most likely temporary glue code to work around limitations in the ASoC v1 framework. I expect ASoC v2 won't need this.
---

 include/sound/soc-of.h |   21 ++++++
 sound/soc/Kconfig      |    3 +
 sound/soc/Makefile     |    1 
 sound/soc/soc-of.c     |  171 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 196 insertions(+), 0 deletions(-)
include/sound/soc-of.h new file +21 -0
new file mode 100644
index 0000000..a963032
@@ -0,0 +1,21 @@
+/*
+ * OF helpers for ALSA SoC
+ *
+ * Copyright (C) 2008, Secret Lab Technologies Ltd.
+ */
+
+#ifndef _INCLUDE_SOC_OF_H_
+#define _INCLUDE_SOC_OF_H_
+
+#include <linux/of.h>
+#include <sound/soc.h>
+
+int of_snd_soc_register_codec(struct snd_soc_codec_device *codec_dev,
+			      void *codec_data, struct snd_soc_codec_dai *dai,
+			      struct device_node *node);
+
+int of_snd_soc_register_platform(struct snd_soc_platform *platform,
+				 struct device_node *node,
+				 struct snd_soc_cpu_dai *cpu_dai);
+
+#endif /* _INCLUDE_SOC_OF_H_ */
sound/soc/Kconfig +3 -0
index 18f28ac..99118ed 100644
@@ -23,6 +23,9 @@ config SND_SOC
 	  This ASoC audio support can also be built as a module.  If so, the module
 	  will be called snd-soc-core.
 
+config SND_SOC_OF
+	tristate
+
 # All the supported Soc's
 source "sound/soc/at91/Kconfig"
 source "sound/soc/pxa/Kconfig"
sound/soc/Makefile +1 -0
index 782db21..191c2e5 100644
@@ -2,3 +2,4 @@ snd-soc-core-objs := soc-core.o soc-dapm.o
 
 obj-$(CONFIG_SND_SOC)	+= snd-soc-core.o
 obj-$(CONFIG_SND_SOC)	+= codecs/ at91/ pxa/ s3c24xx/ sh/ fsl/ davinci/ omap/
+obj-$(CONFIG_SND_SOC_OF)	+= soc-of.o
sound/soc/soc-of.c new file +171 -0

171 lines not on this page · raw message

#1 lore raw

PATCH v2 2/3 ALSA SoC: Add mpc5200-psc I2S driver

From: Grant Likely <[email protected]>

This is an I2S bus driver for the MPC5200 PSC device. It is probably will not be merged as-is because it uses v1 of the ASoC API, but I want to get it out there for comments.
---

 include/asm-powerpc/mpc52xx_psc.h |   32 +
 sound/soc/fsl/Kconfig             |    7 
 sound/soc/fsl/Makefile            |    2 
 sound/soc/fsl/mpc5200_psc_i2s.c   |  896 +++++++++++++++++++++++++++++++++++++
 4 files changed, 936 insertions(+), 1 deletions(-)
include/asm-powerpc/mpc52xx_psc.h +31 -1
index 710c5d3..0985dc8 100644
@@ -60,10 +60,12 @@
 #define MPC52xx_PSC_RXTX_FIFO_ALARM	0x0002
 #define MPC52xx_PSC_RXTX_FIFO_EMPTY	0x0001
 
-/* PSC interrupt mask bits */
+/* PSC interrupt status/mask bits */
 #define MPC52xx_PSC_IMR_TXRDY		0x0100
 #define MPC52xx_PSC_IMR_RXRDY		0x0200
 #define MPC52xx_PSC_IMR_DB		0x0400
+#define MPC52xx_PSC_IMR_TXEMP		0x0800
+#define MPC52xx_PSC_IMR_ORERR		0x1000
 #define MPC52xx_PSC_IMR_IPC		0x8000
 
 /* PSC input port change bit */
@@ -92,6 +94,34 @@
 
 #define MPC52xx_PSC_RFNUM_MASK	0x01ff
 
+#define MPC52xx_PSC_SICR_DTS1			(1 << 29)
+#define MPC52xx_PSC_SICR_SHDR			(1 << 28)
+#define MPC52xx_PSC_SICR_SIM_MASK		(0xf << 24)
+#define MPC52xx_PSC_SICR_SIM_UART		(0x0 << 24)
+#define MPC52xx_PSC_SICR_SIM_UART_DCD		(0x8 << 24)
+#define MPC52xx_PSC_SICR_SIM_CODEC_8		(0x1 << 24)
+#define MPC52xx_PSC_SICR_SIM_CODEC_16		(0x2 << 24)
+#define MPC52xx_PSC_SICR_SIM_AC97		(0x3 << 24)
+#define MPC52xx_PSC_SICR_SIM_SIR		(0x8 << 24)
+#define MPC52xx_PSC_SICR_SIM_SIR_DCD		(0xc << 24)
+#define MPC52xx_PSC_SICR_SIM_MIR		(0x5 << 24)
+#define MPC52xx_PSC_SICR_SIM_FIR		(0x6 << 24)
+#define MPC52xx_PSC_SICR_SIM_CODEC_24		(0x7 << 24)
+#define MPC52xx_PSC_SICR_SIM_CODEC_32		(0xf << 24)
+#define MPC52xx_PSC_SICR_GENCLK			(1 << 23)
+#define MPC52xx_PSC_SICR_I2S			(1 << 22)
+#define MPC52xx_PSC_SICR_CLKPOL			(1 << 21)
+#define MPC52xx_PSC_SICR_SYNCPOL		(1 << 20)
+#define MPC52xx_PSC_SICR_CELLSLAVE		(1 << 19)
+#define MPC52xx_PSC_SICR_CELL2XCLK		(1 << 18)
+#define MPC52xx_PSC_SICR_ESAI			(1 << 17)
+#define MPC52xx_PSC_SICR_ENAC97			(1 << 16)
+#define MPC52xx_PSC_SICR_SPI			(1 << 15)
+#define MPC52xx_PSC_SICR_MSTR			(1 << 14)
+#define MPC52xx_PSC_SICR_CPOL			(1 << 13)
+#define MPC52xx_PSC_SICR_CPHA			(1 << 12)
+#define MPC52xx_PSC_SICR_USEEOF			(1 << 11)
+#define MPC52xx_PSC_SICR_DISABLEEOF		(1 << 10)
 
 /* Structure of the hardware registers */
 struct mpc52xx_psc {
sound/soc/fsl/Kconfig +7 -0
index 257101f..9ac970e 100644
@@ -17,4 +17,11 @@ config SND_SOC_MPC8610_HPCD
 	help
 	  Say Y if you want to enable audio on the Freescale MPC8610 HPCD.
 
+config SND_SOC_MPC5200_I2S
+	tristate "Freescale MPC5200 PSC in I2S mode driver"
+	select SND_SOC_OF
+	depends on SND_SOC && PPC_MPC52xx
+	help
+	  Say Y here to support the MPC5200 PSCs in I2S mode.
+
 endmenu
sound/soc/fsl/Makefile +2 -0
index 62f680a..98729a1 100644
@@ -4,3 +4,5 @@ obj-$(CONFIG_SND_SOC_MPC8610_HPCD) += mpc8610_hpcd.o
 # MPC8610 Platform Support
 obj-$(CONFIG_SND_SOC_MPC8610) += fsl_ssi.o fsl_dma.o
 
+obj-$(CONFIG_SND_SOC_MPC5200_I2S) += mpc5200_psc_i2s.o
+
sound/soc/fsl/mpc5200_psc_i2s.c new file +896 -0

896 lines not on this page · raw message

#2 lore raw

Re: [PATCH v2 2/3] ALSA SoC: Add mpc5200-psc I2S driver

Quoted 3 lines · Grant Likely

This is an I2S bus driver for the MPC5200 PSC device. It is probably will not be merged as-is because it uses v1 of the ASoC API, but I want to get it out there for comments.

Looks basically good. A few things below, plus you probably want to run checkpatch over it.

sound/soc/fsl/mpc5200_psc_i2s.c line 164

Quoted 6 lines
sound/soc/fsl/mpc5200_psc_i2s.c new file +6 -0
+/* Bestcomm DMA irq handler */
+static irqreturn_t psc_i2s_bcom_irq(int irq, void *_psc_i2s_stream)
+{
+	struct psc_i2s_stream *s = _psc_i2s_stream;
+
+	//spin_lock(&s->psc_i2s->lock);

Either the lock is needed or it isn't :) .

Review

Quoted 5 lines

+ * If this is the first stream open, then grab the IRQ and program most of
+ * the PSC registers.

(quoted diff) +2 -0
+static int psc_i2s_startup(struct snd_pcm_substream *substream)
+{

The comment here doesn't seem to reflect what the function does - it looks to just unconditionally reinitialise the controller with things like this:

sound/soc/fsl/mpc5200_psc_i2s.c line 210

Quoted 6 lines
sound/soc/fsl/mpc5200_psc_i2s.c new file +6 -0
+	/* Disable all interrupts and reset the PSC */
+	out_be16(&regs->mpc52xx_psc_imr, 0);
+	out_8(&regs->command, 3 << 4); /* reset transmitter */
+	out_8(&regs->command, 2 << 4); /* reset receiver */
+	out_8(&regs->command, 1 << 4); /* reset mode */
+	out_8(&regs->command, 4 << 4); /* reset error */

which I'd imagine might upset running streams?

Review

Quoted 11 lines
(quoted diff) +8 -0
+static int psc_i2s_trigger(struct snd_pcm_substream *substream, int cmd)
+{
 
+       case SNDRV_PCM_TRIGGER_STOP:
 
+       case SNDRV_PCM_TRIGGER_STOP:
 
+	default:
+		dev_dbg(psc_i2s->dev, "invalid command\n");
+		return -EINVAL;
+	}

This doesn't handle the pause, suspend, resume or pause_release triggers. If there's really nothing to do for those it should ignore them, especially given the default: behaviour.

#3 lore raw

PATCH v2 3/3 ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

In reply to Grant Likely

From: Grant Likely <[email protected]>

ASoC Codec driver for the TLV320AIC26 device. This driver uses the ASoC v1 API, so I don't expect it to get merged as-is, but I want to get it out there for review.
---

 sound/soc/codecs/Kconfig       |    4 
 sound/soc/codecs/Makefile      |    2 
 sound/soc/codecs/tlv320aic26.c |  546 ++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tlv320aic26.h |  103 ++++++++
 4 files changed, 655 insertions(+), 0 deletions(-)
sound/soc/codecs/Kconfig +4 -0
index 3903ab7..96c7bfe 100644
@@ -41,6 +41,10 @@ config SND_SOC_CS4270_VD33_ERRATA
 	bool
 	depends on SND_SOC_CS4270
 
+config SND_SOC_TLV320AIC26
+	tristate "TI TLB320AIC26 Codec support"
+	depends on SND_SOC && SPI
+
 config SND_SOC_TLV320AIC3X
 	tristate
 	depends on SND_SOC && I2C
sound/soc/codecs/Makefile +2 -0
index 4e1314c..ec0cd93 100644
@@ -5,6 +5,7 @@ snd-soc-wm8753-objs := wm8753.o
 snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 snd-soc-cs4270-objs := cs4270.o
+snd-soc-tlv320aic26-objs := tlv320aic26.o
 snd-soc-tlv320aic3x-objs := tlv320aic3x.o
 
 obj-$(CONFIG_SND_SOC_AC97_CODEC)	+= snd-soc-ac97.o
@@ -14,4 +15,5 @@ obj-$(CONFIG_SND_SOC_WM8753)	+= snd-soc-wm8753.o
 obj-$(CONFIG_SND_SOC_WM9712)	+= snd-soc-wm9712.o
 obj-$(CONFIG_SND_SOC_WM9713)	+= snd-soc-wm9713.o
 obj-$(CONFIG_SND_SOC_CS4270)	+= snd-soc-cs4270.o
+obj-$(CONFIG_SND_SOC_TLV320AIC26)	+= snd-soc-tlv320aic26.o
 obj-$(CONFIG_SND_SOC_TLV320AIC3X)	+= snd-soc-tlv320aic3x.o
sound/soc/codecs/tlv320aic26.c new file +546 -0

546 lines not on this page · raw message

sound/soc/codecs/tlv320aic26.h new file +103 -0

103 lines not on this page · raw message

#4 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

Quoted 3 lines · Grant Likely

ASoC Codec driver for the TLV320AIC26 device. This driver uses the ASoC v1 API, so I don't expect it to get merged as-is, but I want to get it out there for review.

I've not reviewed this revision of these drivers yet but I just wanted to point out that there's absoluely no problem with merging v1 drivers - so long as a driver uses the existing merged APIs there's no issue from that point of view.

#5 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

Quoted 10 lines · Mark Brown
Quoted 3 lines · Grant Likely

ASoC Codec driver for the TLV320AIC26 device. This driver uses the ASoC v1 API, so I don't expect it to get merged as-is, but I want to get it out there for review.

I've not reviewed this revision of these drivers yet but I just wanted to point out that there's absoluely no problem with merging v1 drivers - so long as a driver uses the existing merged APIs there's no issue from that point of view.

Oops, I forgot to update my commit messages. I'll probably repost v3 of the series this evening and I'll fix this.

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#6 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

In reply to Grant Likely
Quoted 3 lines · Grant Likely

ASoC Codec driver for the TLV320AIC26 device. This driver uses the ASoC v1 API, so I don't expect it to get merged as-is, but I want to get it out there for review.

This looks basically good - most of the issues below are nitpicky.

sound/soc/codecs/tlv320aic26.c line 177

Quoted 9 lines
sound/soc/codecs/tlv320aic26.c new file +9 -0
+	/* Configure PLL */
+	pval = 1;
+	jval = (fsref == 44100) ? 7 : 8;
+	dval = (fsref == 44100) ? 5264 : 1920;
+	qval = 0;
+	reg = 0x8000 | qval << 11 | pval << 8 | jval << 2;
+	aic26_reg_write(codec, AIC26_REG_PLL_PROG1, reg);
+	reg = dval << 2;
+	aic26_reg_write(codec, AIC26_REG_PLL_PROG2, reg);

Does the PLL configuration not depend on the input clock frequency? You have a set_sysclk() method to configure the MCLK supplied but the driver never appears to reference the value anywhere.

sound/soc/codecs/tlv320aic26.c line 180

Quoted 2 lines
sound/soc/codecs/tlv320aic26.c new file +2 -0
+	/* Power up CODEC */
+	aic26_reg_write(codec, AIC26_REG_POWER_CTRL, 0);

As discussed this should probably just be removed from hw_params().

sound/soc/codecs/tlv320aic26.c line 261

Quoted 11 lines
sound/soc/codecs/tlv320aic26.c new file +10 -0
+static int aic26_set_fmt(struct snd_soc_codec_dai *codec_dai, unsigned int fmt)
+{
 
+	/* interface format */
+	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+	case SND_SOC_DAIFMT_I2S: aic26->datfm = AIC26_DATFM_I2S; break;
+	case SND_SOC_DAIFMT_DSP_A: aic26->datfm = AIC26_DATFM_DSP; break;
+	case SND_SOC_DAIFMT_RIGHT_J: aic26->datfm = AIC26_DATFM_RIGHTJ; break;
+	case SND_SOC_DAIFMT_LEFT_J: aic26->datfm = AIC26_DATFM_LEFTJ; break;
+	default: dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL;
+	}

I'm having a hard time liking this indentation style. It's not an obstacle to merging but it doesn't really help legibility - there's not enough white space and once you have a non-standard line like the
default: one.

sound/soc/codecs/tlv320aic26.c line 301

Quoted 3 lines
sound/soc/codecs/tlv320aic26.c new file +3 -0
+static const char *aic26_capture_src_text[] = {"Mic", "Aux"};
+static const struct soc_enum aic26_capture_src_enum =
+	SOC_ENUM_SINGLE(AIC26_REG_AUDIO_CTRL1, 12,2, aic26_capture_src_text);

checkpatch complains about the 12,2 here and a bunch of other stuff - ALSA is generally very strict about that.

sound/soc/codecs/tlv320aic26.c line 312

Quoted 4 lines
sound/soc/codecs/tlv320aic26.c new file +4 -0
+	SOC_SINGLE("Keyclick activate", AIC26_REG_AUDIO_CTRL2, 15, 0x1, 0),
+	SOC_SINGLE("Keyclick amplitude", AIC26_REG_AUDIO_CTRL2, 12, 0x7, 0),
+	SOC_SINGLE("Keyclick frequency", AIC26_REG_AUDIO_CTRL2, 8, 0x7, 0),
+	SOC_SINGLE("Keyclick period", AIC26_REG_AUDIO_CTRL2, 4, 0xf, 0),

This configuration is also exposed via a sysfs file, including some of the configurability. Exposing the information via sysfs isn't a particular problem but allowing it to be written to without going through ALSA seems wrong.

sound/soc/codecs/tlv320aic26.c line 390

Quoted 3 lines
sound/soc/codecs/tlv320aic26.c new file +3 -0
+static ssize_t aic26_regs_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{

As discussed this is replicating the existing codec register display sysfs file.

sound/soc/codecs/tlv320aic26.c line 512

Quoted 5 lines
sound/soc/codecs/tlv320aic26.c new file +5 -0
+#if defined(CONFIG_SND_SOC_OF)
+	/* Tell the of_soc helper about this codec */
+	of_snd_soc_register_codec(&aic26_soc_codec_dev, aic26, &aic26_dai,
+				  spi->dev.archdata.of_node);
+#endif

CONFIG_SND_SOC_OF could be a module - this needs to also check for it being a module.

sound/soc/codecs/tlv320aic26.h line 73

Quoted 6 lines
sound/soc/codecs/tlv320aic26.h new file +6 -0
+#define AIC26_RATES	(SNDRV_PCM_RATE_8000  | SNDRV_PCM_RATE_11025 |\
+			 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\
+			 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
+			 SNDRV_PCM_RATE_48000)
+#define AIC26_FORMATS	(SNDRV_PCM_FMTBIT_S8     | SNDRV_PCM_FMTBIT_S16_BE |\
+			 SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE)

These are usually kept in the driver code.

#7 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

Quoted 8 lines · Mark Brown
Quoted 3 lines · Grant Likely

ASoC Codec driver for the TLV320AIC26 device. This driver uses the ASoC v1 API, so I don't expect it to get merged as-is, but I want to get it out there for review.

This looks basically good - most of the issues below are nitpicky.

Quoted 13 lines

sound/soc/codecs/tlv320aic26.c line 177

Quoted 9 lines
sound/soc/codecs/tlv320aic26.c new file +9 -0
+	/* Configure PLL */
+	pval = 1;
+	jval = (fsref == 44100) ? 7 : 8;
+	dval = (fsref == 44100) ? 5264 : 1920;
+	qval = 0;
+	reg = 0x8000 | qval << 11 | pval << 8 | jval << 2;
+	aic26_reg_write(codec, AIC26_REG_PLL_PROG1, reg);
+	reg = dval << 2;
+	aic26_reg_write(codec, AIC26_REG_PLL_PROG2, reg);

Does the PLL configuration not depend on the input clock frequency? You have a set_sysclk() method to configure the MCLK supplied but the driver never appears to reference the value anywhere.

Yes, this should be done better. I'm working on making this better, but I'm hoping it is okay to have that as follow-on patches.

Quoted 4 lines

sound/soc/codecs/tlv320aic26.c line 180

Quoted 2 lines
sound/soc/codecs/tlv320aic26.c new file +2 -0
+	/* Power up CODEC */
+	aic26_reg_write(codec, AIC26_REG_POWER_CTRL, 0);

As discussed this should probably just be removed from hw_params().

done

Quoted 16 lines

sound/soc/codecs/tlv320aic26.c line 261

Quoted 11 lines
sound/soc/codecs/tlv320aic26.c new file +10 -0
+static int aic26_set_fmt(struct snd_soc_codec_dai *codec_dai, unsigned int fmt)
+{
 
+	/* interface format */
+	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+	case SND_SOC_DAIFMT_I2S: aic26->datfm = AIC26_DATFM_I2S; break;
+	case SND_SOC_DAIFMT_DSP_A: aic26->datfm = AIC26_DATFM_DSP; break;
+	case SND_SOC_DAIFMT_RIGHT_J: aic26->datfm = AIC26_DATFM_RIGHTJ; break;
+	case SND_SOC_DAIFMT_LEFT_J: aic26->datfm = AIC26_DATFM_LEFTJ; break;
+	default: dev_dbg(&aic26->spi->dev, "bad format\n"); return -EINVAL;
+	}

I'm having a hard time liking this indentation style. It's not an obstacle to merging but it doesn't really help legibility - there's not enough white space and once you have a non-standard line like the
default: one.

Cleaned up.

Quoted 6 lines

sound/soc/codecs/tlv320aic26.c line 301

Quoted 3 lines
sound/soc/codecs/tlv320aic26.c new file +3 -0
+static const char *aic26_capture_src_text[] = {"Mic", "Aux"};
+static const struct soc_enum aic26_capture_src_enum =
+	SOC_ENUM_SINGLE(AIC26_REG_AUDIO_CTRL1, 12,2, aic26_capture_src_text);

checkpatch complains about the 12,2 here and a bunch of other stuff - ALSA is generally very strict about that.

Originally, that had been to keep the line under 80 chars, but some of the names have changed since then to make it no longer necessary. I'll clean up the checkpatch stuff.

Quoted 10 lines

sound/soc/codecs/tlv320aic26.c line 312

Quoted 5 lines
sound/soc/codecs/tlv320aic26.c new file +4 -0
+	SOC_SINGLE("Keyclick activate", AIC26_REG_AUDIO_CTRL2, 15, 0x1, 0),
+	SOC_SINGLE("Keyclick amplitude", AIC26_REG_AUDIO_CTRL2, 12, 0x7, 0),
+	SOC_SINGLE("Keyclick frequency", AIC26_REG_AUDIO_CTRL2, 8, 0x7, 0),
+	SOC_SINGLE("Keyclick period", AIC26_REG_AUDIO_CTRL2, 4, 0xf, 0),

This configuration is also exposed via a sysfs file, including some of the configurability. Exposing the information via sysfs isn't a particular problem but allowing it to be written to without going through ALSA seems wrong.

All the written bit does is trigger the keyclick event. It doesn't adjust the parameters in any way.

Quoted 6 lines

sound/soc/codecs/tlv320aic26.c line 390

Quoted 3 lines
sound/soc/codecs/tlv320aic26.c new file +3 -0
+static ssize_t aic26_regs_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{

As discussed this is replicating the existing codec register display sysfs file.

removed

Quoted 8 lines

sound/soc/codecs/tlv320aic26.c line 512

Quoted 5 lines
sound/soc/codecs/tlv320aic26.c new file +5 -0
+#if defined(CONFIG_SND_SOC_OF)
+	/* Tell the of_soc helper about this codec */
+	of_snd_soc_register_codec(&aic26_soc_codec_dev, aic26, &aic26_dai,
+				  spi->dev.archdata.of_node);
+#endif

CONFIG_SND_SOC_OF could be a module - this needs to also check for it being a module.

Doesn't #if defined() match on both static and module selection?

Quoted 8 lines

sound/soc/codecs/tlv320aic26.h line 73

Quoted 6 lines
sound/soc/codecs/tlv320aic26.h new file +6 -0
+#define AIC26_RATES	(SNDRV_PCM_RATE_8000  | SNDRV_PCM_RATE_11025 |\
+			 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\
+			 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
+			 SNDRV_PCM_RATE_48000)
+#define AIC26_FORMATS	(SNDRV_PCM_FMTBIT_S8     | SNDRV_PCM_FMTBIT_S16_BE |\
+			 SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE)

These are usually kept in the driver code.

fixed.

Thanks,
g.

#8 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

Quoted 10 lines · Grant Likely
Quoted 6 lines · Mark Brown

On Sat, Jul 12, 2008 at 02:39:39AM -0600, Grant Likely wrote:

This configuration is also exposed via a sysfs file, including some of the configurability. Exposing the information via sysfs isn't a particular problem but allowing it to be written to without going through ALSA seems wrong.

All the written bit does is trigger the keyclick event. It doesn't adjust the parameters in any way.

That should be OK for now but we ought to work out a way of doing this via an ALSA control so it can be standardised over the devices that support it. I can't see anything suitable currently, though.

Quoted 10 lines
Quoted 8 lines

sound/soc/codecs/tlv320aic26.c line 512

Quoted 5 lines
sound/soc/codecs/tlv320aic26.c new file +5 -0
+#if defined(CONFIG_SND_SOC_OF)
+	/* Tell the of_soc helper about this codec */
+	of_snd_soc_register_codec(&aic26_soc_codec_dev, aic26, &aic26_dai,
+				  spi->dev.archdata.of_node);
+#endif

CONFIG_SND_SOC_OF could be a module - this needs to also check for it being a module.

Doesn't #if defined() match on both static and module selection?

Sadly not.

#9 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

In reply to Grant Likely

Hi
I have one query about this soc driver.
I want to know when u will merge it with kernel then
where and by which name this device will be available
in /dev directory of your file system.

As i am following the same structure for my driver so please help me. I am ot able to recognise the device in the file system.

-----Original Message-----
From: Grant Likely <[email protected]>
To: [email protected], [email protected], [email protected], [email protected]
Subject: [alsa-devel] [PATCH v2 3/3] ALSA SoC: Add Texas Instruments
TLV320AIC26 codec driver
Date: Sat, 12 Jul 2008 02:39:39 -0600

From: Grant Likely <[email protected]>

ASoC Codec driver for the TLV320AIC26 device. This driver uses the ASoC v1 API, so I don't expect it to get merged as-is, but I want to get it out there for review.
---

 sound/soc/codecs/Kconfig       |    4 
 sound/soc/codecs/Makefile      |    2 
 sound/soc/codecs/tlv320aic26.c |  546 ++++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tlv320aic26.h |  103 ++++++++
 4 files changed, 655 insertions(+), 0 deletions(-)
sound/soc/codecs/Kconfig +4 -0
index 3903ab7..96c7bfe 100644
@@ -41,6 +41,10 @@ config SND_SOC_CS4270_VD33_ERRATA
 	bool
 	depends on SND_SOC_CS4270
 
+config SND_SOC_TLV320AIC26
+	tristate "TI TLB320AIC26 Codec support"
+	depends on SND_SOC && SPI
+
 config SND_SOC_TLV320AIC3X
 	tristate
 	depends on SND_SOC && I2C
sound/soc/codecs/Makefile +2 -0
index 4e1314c..ec0cd93 100644
@@ -5,6 +5,7 @@ snd-soc-wm8753-objs := wm8753.o
 snd-soc-wm9712-objs := wm9712.o
 snd-soc-wm9713-objs := wm9713.o
 snd-soc-cs4270-objs := cs4270.o
+snd-soc-tlv320aic26-objs := tlv320aic26.o
 snd-soc-tlv320aic3x-objs := tlv320aic3x.o
 
 obj-$(CONFIG_SND_SOC_AC97_CODEC)	+= snd-soc-ac97.o
@@ -14,4 +15,5 @@ obj-$(CONFIG_SND_SOC_WM8753)	+= snd-soc-wm8753.o
 obj-$(CONFIG_SND_SOC_WM9712)	+= snd-soc-wm9712.o
 obj-$(CONFIG_SND_SOC_WM9713)	+= snd-soc-wm9713.o
 obj-$(CONFIG_SND_SOC_CS4270)	+= snd-soc-cs4270.o
+obj-$(CONFIG_SND_SOC_TLV320AIC26)	+= snd-soc-tlv320aic26.o
 obj-$(CONFIG_SND_SOC_TLV320AIC3X)	+= snd-soc-tlv320aic3x.o
sound/soc/codecs/tlv320aic26.c new file +546 -0

546 lines not on this page · raw message

sound/soc/codecs/tlv320aic26.h new file +103 -0

103 lines not on this page · raw message

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#10 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

Quoted 7 lines · dinesh

I have one query about this soc driver.
I want to know when u will merge it with kernel then
where and by which name this device will be available
in /dev directory of your file system.

As i am following the same structure for my driver so please help me. I am ot able to recognise the device in the file system.

It will appear via the standard ALSA interfaces (and OSS interfaces if you enable OSS compatibility). The standard location for ALSA device files is under /dev/snd where you'll see several files per device.

#11 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

thanks for your response but there is no /dev/snd directory in my file structure is there any special method to create it please tell in detail.

-----Original Message-----
From: Mark Brown <[email protected]>
To: dinesh <[email protected]>
Cc: Grant Likely <[email protected]>, [email protected], [email protected], [email protected]
Subject: Re: [alsa-devel] [PATCH v2 3/3] ALSA SoC: Add Texas Instruments
TLV320AIC26 codec driver
Date: Tue, 15 Jul 2008 11:33:34 +0100

Quoted 7 lines · dinesh

I have one query about this soc driver.
I want to know when u will merge it with kernel then
where and by which name this device will be available
in /dev directory of your file system.

As i am following the same structure for my driver so please help me. I am ot able to recognise the device in the file system.

It will appear via the standard ALSA interfaces (and OSS interfaces if you enable OSS compatibility). The standard location for ALSA device files is under /dev/snd where you'll see several files per device.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#12 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

Quoted 3 lines · dinesh

thanks for your response but there is no /dev/snd directory in my file structure is there any special method to create it please tell in detail.

The devices appear via the standard kernel interfaces so if you are using udev or mdev they should be created automatically. Otherwise you'll need to create them statically using whatever method you usually use (eg, a MAKEDEV script supplied by your distribution or manually by reference to the device numbers exposed in /sys/class/sound/*/dev).

The ALSA devices use the standard Linux mechanisms to create their devices so whatever you normally use to create devices should work for ALSA too.

#13 lore raw

WRITING AN SOC DRIVER WITHOUT DMA

In reply to Grant Likely

Hi,
I am writing a soc sound driver for MPC8323 board linux 2.6.24 in which i want to do data transfer to and from device myself using BUFFER DESCRIPTOR not with the usual DMA transfer. Please help me.

#14 lore raw

Re: WRITING AN SOC DRIVER WITHOUT DMA

Hi dinesh,

If you are working on ARM, see the ARM AACi code, in sound/arm/aaci.c

Thanks
Nobin Mathew.

Quoted 11 lines · dinesh

Hi,
I am writing a soc sound driver for MPC8323 board linux 2.6.24 in which i want to do data transfer to and from device myself using BUFFER DESCRIPTOR not with the usual DMA transfer.
Please help me.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#15 lore raw

Re: WRITING AN SOC DRIVER WITHOUT DMA

no i am working on powerpc. MPC8323

-----Original Message-----
From: Nobin Mathew <[email protected]>
To: dinesh <[email protected]>
Cc: Grant Likely <[email protected]>, [email protected], [email protected], [email protected]
Subject: Re: [alsa-devel] WRITING AN SOC DRIVER WITHOUT DMA
Date: Wed, 16 Jul 2008 15:37:54 +0530

Hi dinesh,

If you are working on ARM, see the ARM AACi code, in sound/arm/aaci.c

Thanks
Nobin Mathew.

Quoted 11 lines · dinesh

Hi,
I am writing a soc sound driver for MPC8323 board linux 2.6.24 in which i want to do data transfer to and from device myself using BUFFER DESCRIPTOR not with the usual DMA transfer.
Please help me.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#16 lore raw

Re: WRITING AN SOC DRIVER WITHOUT DMA

Hi,
I think no one is able to understand my problem, let me break it to low level.
What i want is that i have a buffer in driver code which is also handled by some other application i want that this buffer data is to be used for capture and playback stream fills data to another buffer which i can passover to my other application.
If someone can help me please.
Regards,
Dinesh

-----Original Message-----
From: dinesh <[email protected]>
To: Nobin Mathew <[email protected]>
Cc: Grant Likely <[email protected]>, [email protected], [email protected], [email protected]
Subject: Re: [alsa-devel] WRITING AN SOC DRIVER WITHOUT DMA
Date: Wed, 16 Jul 2008 15:43:26 +0530

no i am working on powerpc. MPC8323

-----Original Message-----
From: Nobin Mathew <[email protected]>
To: dinesh <[email protected]>
Cc: Grant Likely <[email protected]>, [email protected], [email protected], [email protected]
Subject: Re: [alsa-devel] WRITING AN SOC DRIVER WITHOUT DMA
Date: Wed, 16 Jul 2008 15:37:54 +0530

Hi dinesh,

If you are working on ARM, see the ARM AACi code, in sound/arm/aaci.c

Thanks
Nobin Mathew.

Quoted 11 lines · dinesh

Hi,
I am writing a soc sound driver for MPC8323 board linux 2.6.24 in which i want to do data transfer to and from device myself using BUFFER DESCRIPTOR not with the usual DMA transfer.
Please help me.
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#17 lore raw

Re: WRITING AN SOC DRIVER WITHOUT DMA

Quoted 4 lines · dinesh

What i want is that i have a buffer in driver code which is also handled by some other application i want that this buffer data is to be used for capture and playback stream fills data to another buffer which i can passover to my other application.

Depending on what exactly you're doing here you may find that this is best implemented in user space with an ALSA plugin rather than doing it as part of a driver. If you do want to do this in kernel space then the parts of an ASoC driver which transfer audio data are just the same as those for any other ALSA driver so things like sound/arm/aaci.c may provide useful examples.

#18 lore raw

Re: WRITING AN SOC DRIVER WITHOUT DMA

Hi Dinesh,

If that is your requirement then go and see the actual code sound/arm/aaci.c. They are not using DMA. It is programmed IO.

Thanks
Nobin Mathew

Quoted 15 lines · Mark Brown
Quoted 4 lines · dinesh

What i want is that i have a buffer in driver code which is also handled by some other application i want that this buffer data is to be used for capture and playback stream fills data to another buffer which i can passover to my other application.

Depending on what exactly you're doing here you may find that this is best implemented in user space with an ALSA plugin rather than doing it as part of a driver. If you do want to do this in kernel space then the parts of an ASoC driver which transfer audio data are just the same as those for any other ALSA driver so things like sound/arm/aaci.c may provide useful examples.

#19 lore raw

Re: WRITING AN SOC DRIVER WITHOUT DMA

Quoted 4 lines · Nobin Mathew

Hi Dinesh,

If that is your requirement then go and see the actual code sound/arm/aaci.c. They are not using DMA. It is programmed IO.

Search around the list archives, the first version of the Efika/mpc5200 ac97 driver was programmed IO. The next version updated it to DMA.

Quoted 29 lines

Thanks
Nobin Mathew

Quoted 7 lines · Mark Brown
Quoted 4 lines · dinesh

What i want is that i have a buffer in driver code which is also handled by some other application i want that this buffer data is to be used for capture and playback stream fills data to another buffer which i can passover to my other application.

Quoted 7 lines

Depending on what exactly you're doing here you may find that this is best implemented in user space with an ALSA plugin rather than doing it as part of a driver. If you do want to do this in kernel space then the parts of an ASoC driver which transfer audio data are just the same as those for any other ALSA driver so things like sound/arm/aaci.c may provide useful examples.

_______________________________________________
Linuxppc-dev mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Signature · 2 lines
Jon Smirl
[email protected]
#20 lore raw

Re: [PATCH v2 3/3] ALSA SoC: Add Texas Instruments TLV320AIC26 codec driver

In reply to Grant Likely
Quoted 2 lines · Grant Likely
sound/soc/codecs/tlv320aic26.c new file +2 -0
+	aic26->codec.reg_cache_size = sizeof(aic26->reg_cache);
+	aic26->codec.reg_cache = aic26->reg_cache;

...

sound/soc/codecs/tlv320aic26.c line 506

Quoted 7 lines
sound/soc/codecs/tlv320aic26.c new file +7 -0
+	/* Register the sysfs files for debugging */
+	/* Create SysFS files */
+	rc = device_create_file(&spi->dev, &dev_attr_regs);
+	rc |= device_create_file(&spi->dev, &dev_attr_regs_cache);
+	rc |= device_create_file(&spi->dev, &dev_attr_keyclick);
+	if (rc)
+		dev_info(&spi->dev, "error creating sysfs files\n");

I believe ASoC creates sysfs entries if you use reg_cache and reg_cache_size, so you should not be creating your own sysfs entries if you use these variables.

sound/soc/codecs/tlv320aic26.c line 512

Quoted 6 lines
sound/soc/codecs/tlv320aic26.c new file +6 -0
+
+#if defined(CONFIG_SND_SOC_OF)
+	/* Tell the of_soc helper about this codec */
+	of_snd_soc_register_codec(&aic26_soc_codec_dev, aic26, &aic26_dai,
+				  spi->dev.archdata.of_node);
+#endif

I haven't paid any attention to the of_soc helper, because it's for ASoC V1 only. However, I don't understand why you need to reference it in the codec driver. My CS4270 codec driver knows nothing about OF and works fine in arch/powerpc.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#21 lore raw
In reply to Grant Likely
Quoted 4 lines · Grant Likely

Simple utility layer for creating ASoC machine instances based on data in the OpenFirmware device tree. OF aware platform drivers and codec drivers register themselves with this framework and the framework automatically instantiates a machine driver.

Ideally someone from the PowerPC community would sign off on this - given the nature and volume of discussion people obviously have very strong opinions about how machine drivers should be done so I'd really like to see some community buy in for something like this. From an ASoC point of view if this works it's fine.

Quoted 2 lines

This is most likely temporary glue code to work around limitations in the ASoC v1 framework. I expect ASoC v2 won't need this.

It will need some way of providing a machine driver, generic (like this one) or otherwise.

sound/soc/soc-of.c line 80

Quoted 11 lines
sound/soc/soc-of.c new file +11 -0
+static void of_snd_soc_register_device(struct of_snd_soc_device *of_soc)
+{
+	struct platform_device *pdev;
+	int rc;
+
+	/* Only register the device if both the codec and platform have
+	 * been registered */
+	if ((!of_soc->device.codec_data) || (!of_soc->platform_node))
+		return;
+
+	pr_info("platform<-->codec match achieved; registering machine\n");

So what this does is add an extremely simple machine driver which matches up the first DAI on a single codec and platform with no facility for setting up any configurable clocking or anything? This is fine in so far as it goes but it's going to work for very few systems as it is - most codecs will need some additional configuration. This could be added later, though.

Given this it might be worth renaming it to something less generic and perhaps pushing it down into an of directory below the main ASoC directory to parallel existing machine drivers. I'm happy with the code from an ASoC point of view.

#22 lore raw
Quoted 8 lines · Mark Brown
Quoted 4 lines · Grant Likely

Simple utility layer for creating ASoC machine instances based on data in the OpenFirmware device tree. OF aware platform drivers and codec drivers register themselves with this framework and the framework automatically instantiates a machine driver.

Quoted 5 lines

Ideally someone from the PowerPC community would sign off on this -
given the nature and volume of discussion people obviously have very strong opinions about how machine drivers should be done so I'd really like to see some community buy in for something like this. From an ASoC point of view if this works it's fine.

Grant is one of the core PowerPC developers. There's no big disagreement on the driver model, there just isn't a clean solution for building a PowerPC ASoC driver under ASoC v1. The ASoC v1 driver model is simply not compatible with the PowerPC device tree model. That's why all of this glue code is needed.

Hopefully we can get the driver model sorted out in v2. If the ASoC driver model is fixed all of this glue code disappears.

The PowerPC side isn't without fault too. PowerPC still doesn't have a good way to load the fabric/machine driver.

Which are we going to call it, fabric or machine? I had been working on the Apple code in sound/aoa. It is called fabric in that code. The equivalent driver is called machine in ASoC v1.

Quoted 35 lines
Quoted 4 lines

This is most likely temporary glue code to work around limitations in the ASoC v1 framework. I expect ASoC v2 won't need this.

It will need some way of providing a machine driver, generic (like this
one) or otherwise.

sound/soc/soc-of.c line 80

Quoted 11 lines
sound/soc/soc-of.c new file +11 -0
+static void of_snd_soc_register_device(struct of_snd_soc_device *of_soc)
+{
+     struct platform_device *pdev;
+     int rc;
+
+     /* Only register the device if both the codec and platform have
+      * been registered */
+     if ((!of_soc->device.codec_data) || (!of_soc->platform_node))
+             return;
+
+     pr_info("platform<-->codec match achieved; registering machine\n");

So what this does is add an extremely simple machine driver which
matches up the first DAI on a single codec and platform with no facility for setting up any configurable clocking or anything? This is fine in so far as it goes but it's going to work for very few systems as it is - most codecs will need some additional configuration. This could be added later, though.

Given this it might be worth renaming it to something less generic and perhaps pushing it down into an of directory below the main ASoC directory to parallel existing machine drivers. I'm happy with the code from an ASoC point of view.

Signature · 2 lines
Jon Smirl
[email protected]
#23 lore raw
Quoted 6 lines · Jon Smirl
Quoted 2 lines · Mark Brown

Ideally someone from the PowerPC community would sign off on this -
given the nature and volume of discussion people obviously have very

Grant is one of the core PowerPC developers. There's no big

OK, fair enough...

Quoted 5 lines

Hopefully we can get the driver model sorted out in v2. If the ASoC driver model is fixed all of this glue code disappears.

The PowerPC side isn't without fault too. PowerPC still doesn't have a good way to load the fabric/machine driver.

I'm finding it difficult to square these two statements - from an ASoC point of view the main thing this patch is doing is adding a machine driver and that's not something that's going to go away. With version 2 you will get the wait for all components to come on-line logic that's implemented here from the ASoC core but that doesn't remove the need for a machine driver to tell the core what to wait for and arrange any machine specific things like clocking. It's this debate about machine drivers that makes me nervous here.

Like I say, from an ASoC point of view it's not an issue and the current approach is fine.

Quoted 3 lines

Which are we going to call it, fabric or machine? I had been working on the Apple code in sound/aoa. It is called fabric in that code. The equivalent driver is called machine in ASoC v1.

ASoC has always called it a machine driver.

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

This is most likely temporary glue code to work around limitations in the ASoC v1 framework. I expect ASoC v2 won't need this.

It will need some way of providing a machine driver, generic (like this
one) or otherwise.

[BTW, it'd be helpful if you could delete unreferenced quotes when you reply - it makes things much easier to read, especially when reviewing lengthy patches. Unfortunately the GMail UI encourages doing this :(]

#24 lore raw
Quoted 6 lines · Mark Brown
Quoted 2 lines

The PowerPC side isn't without fault too. PowerPC still doesn't have a good way to load the fabric/machine driver.

I'm finding it difficult to square these two statements - from an ASoC point of view the main thing this patch is doing is adding a machine driver and that's not something that's going to go away.

Jon's concern is that there is no straightforward way to build a kernel with multiple fabric drivers and have the right one chosen via the device tree. This is just a limitation of the device tree model, and no one has come up with a good solution yet.

The problem still exists in ASoC V2. However, it's not anything that ASoC itself needs to be concerned with. It's purely a PowerPC problem.

Quoted 5 lines
Quoted 3 lines

Which are we going to call it, fabric or machine? I had been working on the Apple code in sound/aoa. It is called fabric in that code. The equivalent driver is called machine in ASoC v1.

ASoC has always called it a machine driver.

Wait, I thought it's supposed to be called a fabric driver now? On PowerPC, it should be called a fabric driver because we already have machine drivers.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#25 lore raw
Quoted 9 lines · Timur Tabi
Quoted 6 lines · Mark Brown
Quoted 2 lines

The PowerPC side isn't without fault too. PowerPC still doesn't have a good way to load the fabric/machine driver.

I'm finding it difficult to square these two statements - from an ASoC point of view the main thing this patch is doing is adding a machine driver and that's not something that's going to go away.

Quoted 7 lines

Jon's concern is that there is no straightforward way to build a kernel with multiple fabric drivers and have the right one chosen via the device tree. This is just a limitation of the device tree model, and no one has come up with a good solution yet.

The problem still exists in ASoC V2. However, it's not anything that ASoC itself needs to be concerned with. It's purely a PowerPC problem.

It's purely an *OF Device Tree* problem. PowerPC isn't the only platform using the device tree. :-)

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#26 lore raw
In reply to Timur Tabi
Quoted 10 lines · Timur Tabi
Quoted 3 lines · Mark Brown

I'm finding it difficult to square these two statements - from an ASoC point of view the main thing this patch is doing is adding a machine driver and that's not something that's going to go away.

Jon's concern is that there is no straightforward way to build a kernel with multiple fabric drivers and have the right one chosen via the device tree. This is just a limitation of the device tree model, and no one has come up with a good solution yet.

Indeed - I understand what the problem you guys have is, I just want to make sure that there is a reasonable consensus among the PowerPC people that this approach is OK to go in and won't create ructions. The lack of resolution on this issue makes me nervous about any proposed solution where I haven't seen any explicit indication that the community is OK with it.

Incidentally, nobody ever really commented on my suggestion to do something DMI-like - you've already got the board type information present in the device trees (in the model and compatible information in the root nodes), all that's needed is an API to allow matching on it.

Quoted 2 lines

The problem still exists in ASoC V2. However, it's not anything that ASoC itself needs to be concerned with. It's purely a PowerPC problem.

Right, I just want to be clear that you guys all understand what this code does and that there won't be too many complaints after the fact.

Quoted 4 lines
Quoted 1 line

ASoC has always called it a machine driver.

Wait, I thought it's supposed to be called a fabric driver now? On PowerPC, it should be called a fabric driver because we already have machine drivers.

I don't mind - you can call it what you like inside PowerPC-specific code.

#27 lore raw
Quoted 19 lines · Mark Brown
Quoted 10 lines · Timur Tabi
Quoted 3 lines · Mark Brown

I'm finding it difficult to square these two statements - from an ASoC point of view the main thing this patch is doing is adding a machine driver and that's not something that's going to go away.

Jon's concern is that there is no straightforward way to build a kernel with multiple fabric drivers and have the right one chosen via the device tree. This is just a limitation of the device tree model, and no one has come up with a good solution yet.

Indeed - I understand what the problem you guys have is, I just want to make sure that there is a reasonable consensus among the PowerPC people that this approach is OK to go in and won't create ructions. The lack of resolution on this issue makes me nervous about any proposed solution where I haven't seen any explicit indication that the community is OK with it.

Quoted 2 lines

Incidentally, nobody ever really commented on my suggestion to do something DMI-like

I'm feeling stupid; what does "DMI" stand for?

Quoted 3 lines

- you've already got the board type information
present in the device trees (in the model and compatible information in the root nodes), all that's needed is an API to allow matching on it.

Yes, we have APIs for matching against device trees. Personally, I'm leaning towards having the powerpc platform code (arch/powerpc/platforms/* stuff; not ASoC platform stuff) register a platform device for the machine driver and let as many machine drivers as needed be written. Hopefully we'll be able to do at least one generic machine driver that will be usable by most PowerPC boards, but I don't think it is a requirement or even realistic to shoehorn all powerpc sound circuits into a single driver.

Quoted 5 lines
Quoted 2 lines

The problem still exists in ASoC V2. However, it's not anything that ASoC itself needs to be concerned with. It's purely a PowerPC problem.

Right, I just want to be clear that you guys all understand what this code does and that there won't be too many complaints after the fact.

Shouldn't be. I'm certainly not pushing this as the end-all be-all powerpc sound machine driver.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

ASoC has always called it a machine driver.

Wait, I thought it's supposed to be called a fabric driver now? On PowerPC, it should be called a fabric driver because we already have machine drivers.

I don't mind - you can call it what you like inside PowerPC-specific code.

Oh help! Don't tell us that! Otherwise we'll always be talking across purposes. When ambiguous, let's just be sure to always refer to them as "ASoC machine drivers". :-)

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#28 lore raw
Quoted 6 lines · Grant Likely

On Mon, Jul 14, 2008 at 10:53 AM, Mark Brown

Quoted 2 lines

Incidentally, nobody ever really commented on my suggestion to do something DMI-like

I'm feeling stupid; what does "DMI" stand for?

Desktop Management Interface, a standard BIOS interface for getting system data on x86 class hardware. Of particular interest here is the fact that it contains various ID strings for things like motherboard and chassis - on Linux drivers can be automatically loaded based on these strings. See drivers/misc/thinkpad_acpi.c for an example of a driver that does this.

Note that it's *not* binding a driver, it just provides the hooks to enable the modules to be automatically loaded and to let drivers query information in DMI.

Quoted 5 lines

Yes, we have APIs for matching against device trees. Personally, I'm leaning towards having the powerpc platform code (arch/powerpc/platforms/* stuff; not ASoC platform stuff) register a platform device for the machine driver and let as many machine drivers as needed be written. Hopefully we'll be able to do at least one

That would be what I'd expected initially - it is, after all, what other platforms are doing here.

Quoted 3 lines

generic machine driver that will be usable by most PowerPC boards, but I don't think it is a requirement or even realistic to shoehorn all powerpc sound circuits into a single driver.

Yes, that'd be completely unrealistic.

Quoted 6 lines
Quoted 2 lines

I don't mind - you can call it what you like inside PowerPC-specific code.

Oh help! Don't tell us that! Otherwise we'll always be talking across purposes. When ambiguous, let's just be sure to always refer to them as "ASoC machine drivers". :-)

Feh, from now on I shall me naming all new concepts with pwgen :) .

#29 lore raw
Quoted 6 lines · Mark Brown

Desktop Management Interface, a standard BIOS interface for getting system data on x86 class hardware. Of particular interest here is the fact that it contains various ID strings for things like motherboard and chassis - on Linux drivers can be automatically loaded based on these strings. See drivers/misc/thinkpad_acpi.c for an example of a driver that does this.

The only problem with this is that the OF probing code in the kernel binds drivers to device tree nodes. So when a driver claims a node, no other driver will be probed with it.

So we can't have generic nodes that classify the motherboard and just let everyone get probed on it.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#30 lore raw
Quoted 9 lines · Timur Tabi
Quoted 6 lines · Mark Brown

Desktop Management Interface, a standard BIOS interface for getting system data on x86 class hardware. Of particular interest here is the fact that it contains various ID strings for things like motherboard and chassis - on Linux drivers can be automatically loaded based on these strings. See drivers/misc/thinkpad_acpi.c for an example of a driver that does this.

Quoted 6 lines

The only problem with this is that the OF probing code in the kernel binds drivers to device tree nodes. So when a driver claims a node, no other driver will be probed with it.

So we can't have generic nodes that classify the motherboard and just let everyone get probed on it.

My suggestion is that you change this for the root node. It's already got the information required in there, it's just there's no way to use it to load modules at the minute. You could presumably read the information out of the device tree using existing APIs to check you're running on the right board once code is loaded?

#31 lore raw
Quoted 8 lines · Mark Brown
Quoted 6 lines

The only problem with this is that the OF probing code in the kernel binds drivers to device tree nodes. So when a driver claims a node, no other driver will be probed with it.

So we can't have generic nodes that classify the motherboard and just let everyone get probed on it.

My suggestion is that you change this for the root node.

That's an interesting idea.

Quoted 3 lines

It's already
got the information required in there, it's just there's no way to use it to load modules at the minute.

Correct.

Quoted 3 lines

You could presumably read the
information out of the device tree using existing APIs to check you're running on the right board once code is loaded?

Yes. The driver <-> node binding is only for probing. Any driver can scan the entire tree at any time.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#32 lore raw
In reply to Timur Tabi
Quoted 9 lines · Timur Tabi
Quoted 6 lines · Mark Brown

Desktop Management Interface, a standard BIOS interface for getting system data on x86 class hardware. Of particular interest here is the fact that it contains various ID strings for things like motherboard and chassis - on Linux drivers can be automatically loaded based on these strings. See drivers/misc/thinkpad_acpi.c for an example of a driver that does this.

Quoted 3 lines

The only problem with this is that the OF probing code in the kernel binds drivers to device tree nodes. So when a driver claims a node, no other driver will be probed with it.

Yes, but that is only for the of_platform bus which is just one way to setup device drivers from the device tree. Setting it up from the platform code is just as valid an option. Or, each ASoC machine driver could read the device tree itself in the module_init hook to decide whether or not to instantiate itself.

Cheers,
g.

#33 lore raw
In reply to Timur Tabi
Quoted 10 lines · Timur Tabi
Quoted 6 lines · Mark Brown

Desktop Management Interface, a standard BIOS interface for getting system data on x86 class hardware. Of particular interest here is the fact that it contains various ID strings for things like motherboard and chassis - on Linux drivers can be automatically loaded based on these strings. See drivers/misc/thinkpad_acpi.c for an example of a driver that does this.

Quoted 6 lines

The only problem with this is that the OF probing code in the kernel binds
drivers to device tree nodes. So when a driver claims a node, no other driver will be probed with it.

So we can't have generic nodes that classify the motherboard and just let everyone get probed on it.

Allowing multiple binds at the root causes the problem of something like compatible="lite5200b,mpc5200-simple". Both platforms would bind and that's not what you want.

I'm not a fan of each platform creating a platform device in arch/powerpc/platforms/*. That implies that each platform would cause another source file to be added each containing pretty much identical code. It also makes the mpc5200-simple platform pointless. Of course this scheme works and I'm doing it right now, but it's clearly not an optimal solution.

Another scheme would be to add kernel code to always create virtual OF devices like "lite5200b-fabric" that are derived off from the machine name that achieved a bind.

A third scheme would be to convert the powerpc machine drivers themselves to device drivers and move them out of arch/powerpc/platforms/* into drivers/whatever. Then add the ASoC fabric code to them. I don't know if you can load device drivers early enough to load a powerpc machine driver from initrd.

A fourth scheme is to do it at compile time. But that means no universal firmware images that support multiple hardware revisions. We have this one today too.

Signature · 2 lines
Jon Smirl
[email protected]
#34 lore raw
Quoted 10 lines · Jon Smirl
Quoted 5 lines · Timur Tabi
Quoted 3 lines · Mark Brown

chassis - on Linux drivers can be automatically loaded based on these strings. See drivers/misc/thinkpad_acpi.c for an example of a driver that does this.

Allowing multiple binds at the root causes the problem of something like compatible="lite5200b,mpc5200-simple". Both platforms would bind and that's not what you want.

Binding isn't the issue here - it's loading the driver in the first place. Once the drivers are loaded they can (hopefully) figure out if they are running on appropriate hardware.

Quoted 3 lines

Another scheme would be to add kernel code to always create virtual OF devices like "lite5200b-fabric" that are derived off from the machine name that achieved a bind.

This is what I'm suggesting, modulo the fact that I'm suggesting *not* creating virtual devices but rather providing a mechanism for drivers to load without binding to anything. It strikes me that you're going to run into similar situations with other hardware at some point - either for undocumented extras that you happen to know exist on the system (like much of the DMI usage on x86) or for other things where you've got on-board hardware structured like sound hardware tends to be.

#35 lore raw
Quoted 10 lines · Mark Brown
Quoted 7 lines · Jon Smirl
Quoted 6 lines · Timur Tabi
Quoted 3 lines · Mark Brown

chassis - on Linux drivers can be automatically loaded based on these strings. See drivers/misc/thinkpad_acpi.c for an example of a driver that does this.

Quoted 7 lines
Quoted 3 lines

Allowing multiple binds at the root causes the problem of something like compatible="lite5200b,mpc5200-simple". Both platforms would bind and that's not what you want.

Binding isn't the issue here - it's loading the driver in the first
place. Once the drivers are loaded they can (hopefully) figure out if they are running on appropriate hardware.

In this case we would end up with two core PowerPC machine drivers bound, not ALSA ones. We have machine drivers in the PowerPC core, that's one reason why it is confusing to call the ALSA drivers machine drivers too.

If we allow multiple bindings both lite5200b and mpc5200-simple would bind. The compatible list is a priority list from most specific to most general. First you check for the specific driver lite5200b, if it's not found then load the generic one mpc5200-simple.

Quoted 8 lines
Quoted 3 lines

Another scheme would be to add kernel code to always create virtual OF devices like "lite5200b-fabric" that are derived off from the machine name that achieved a bind.

This is what I'm suggesting, modulo the fact that I'm suggesting *not*
creating virtual devices but rather providing a mechanism for drivers to load without binding to anything. It strikes me that you're going to

If you have drivers for four different hardware releases compiled into your kernel, the only kernel mechanism I know of to trigger only one of these to initialize is to create a device and then let the probe mechanism sort it out. This is even more true when the drivers are on initrd and need to be dynamically loaded. The module load code will search through the alias lists in the module .ko files.

It has been pointed out that a lite5200b-fabric device isn't really a virtual devices. It's a device that represents the traces on the PCB wiring the generic chip drivers together.

Quoted 4 lines

run into similar situations with other hardware at some point - either for undocumented extras that you happen to know exist on the system (like much of the DMI usage on x86) or for other things where you've got on-board hardware structured like sound hardware tends to be.

This makes sense, it is possible that other areas we aren't familiar with will need fabric drivers too. The problem is easily exposed in audio hardware since we use external clock and amp chips.

Signature · 2 lines
Jon Smirl
[email protected]
#36 lore raw
Quoted 10 lines · Jon Smirl
Quoted 3 lines · Mark Brown

Binding isn't the issue here - it's loading the driver in the first
place. Once the drivers are loaded they can (hopefully) figure out if they are running on appropriate hardware.

In this case we would end up with two core PowerPC machine drivers bound, not ALSA ones. We have machine drivers in the PowerPC core, that's one reason why it is confusing to call the ALSA drivers machine drivers too.

Again, I'm not talking about binding anything.

Quoted 10 lines
Quoted 3 lines

This is what I'm suggesting, modulo the fact that I'm suggesting *not*
creating virtual devices but rather providing a mechanism for drivers to load without binding to anything. It strikes me that you're going to

If you have drivers for four different hardware releases compiled into your kernel, the only kernel mechanism I know of to trigger only one of these to initialize is to create a device and then let the probe mechanism sort it out. This is even more true when the drivers are on initrd and need to be dynamically loaded. The module load code will search through the alias lists in the module .ko files.

This can be handled in the module initialisation (rather than driver probe) - providing something can arrange for the driver to get loaded then the drivers can check the system they're running on when that happens and fail if it's inappropriate. The ARM ASoC drivers and x86 DMI based stuff do things this way, for example (ARM doesn't have the automatic module load stuff implemented, though).

The infrastructure for automatically loading modules is usable separately from device registration, though normally the two do go hand in hand.

Quoted 3 lines

It has been pointed out that a lite5200b-fabric device isn't really a virtual devices. It's a device that represents the traces on the PCB wiring the generic chip drivers together.

This was brought up very early on when you guys first started working on it. :/

#37 lore raw
In reply to Jon Smirl
Quoted 1 line · Jon Smirl

Which are we going to call it, fabric or machine?

Fabric.

Signature · 2 lines
Timur Tabi
Linux kernel developer at Freescale
#38 lore raw
In reply to Mark Brown
Quoted 11 lines · Mark Brown
Quoted 10 lines · Grant Likely
sound/soc/soc-of.c new file +10 -0
+static void of_snd_soc_register_device(struct of_snd_soc_device *of_soc)
+{
+     struct platform_device *pdev;
+     int rc;
+
+     /* Only register the device if both the codec and platform have
+      * been registered */
+     if ((!of_soc->device.codec_data) || (!of_soc->platform_node))
+             return;
+
Quoted 8 lines
Quoted 1 line

+ pr_info("platform<-->codec match achieved; registering machine\n");

So what this does is add an extremely simple machine driver which matches up the first DAI on a single codec and platform with no facility for setting up any configurable clocking or anything? This is fine in so far as it goes but it's going to work for very few systems as it is - most codecs will need some additional configuration. This could be added later, though.

Yes, that is pretty much exactly what it is. When I wrote this my goal was just to get something working that had some semblance of cleanliness. Since it is now looking like something that could get merged, I'll clean up the documentation describing exactly what it is and what the limitations are. I fully expect that if others find it useful then they will need to extend it to extract additional configuration information out of the device tree.

That being said, I expect this code to be completely rewritten when ASoC v2 hits mainline. Most of the code is devoted to matching platforms with codecs. The mechanism will be completely different when the ASoC layer handles making sure all devices are present before setting up the machine driver. I expect that some machines can be handled with some form of generic of-asoc driver, while more complex ones will need custom code.

Quoted 4 lines

Given this it might be worth renaming it to something less generic and perhaps pushing it down into an of directory below the main ASoC directory to parallel existing machine drivers. I'm happy with the code from an ASoC point of view.

I'm okay with that. How about fsl/mpc5200-of-machine.c for now? (only the mpc5200 i2s driver uses it at the moment). It can always be renamed if other folks want to use it for other chips.

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#39 lore raw
Quoted 3 lines · Grant Likely

I'm okay with that. How about fsl/mpc5200-of-machine.c for now? (only the mpc5200 i2s driver uses it at the moment). It can always be renamed if other folks want to use it for other chips.

That seems reasonable so long as you're happy with it, though it does seem to be going to the other extreme in terms of broadness :)

#40 lore raw
Quoted 8 lines · Mark Brown
Quoted 3 lines · Grant Likely

I'm okay with that. How about fsl/mpc5200-of-machine.c for now? (only the mpc5200 i2s driver uses it at the moment). It can always be renamed if other folks want to use it for other chips.

That seems reasonable so long as you're happy with it, though it does seem to be going to the other extreme in terms of broadness :)

heh; I don't care. This stuff is all going to be in flux anyway, so change is inevitable whatever is chosen now. :-)

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
#41 lore raw
In reply to Mark Brown
Quoted 8 lines · Mark Brown
Quoted 3 lines · Grant Likely

I'm okay with that. How about fsl/mpc5200-of-machine.c for now? (only the mpc5200 i2s driver uses it at the moment). It can always be renamed if other folks want to use it for other chips.

That seems reasonable so long as you're happy with it, though it does seem to be going to the other extreme in terms of broadness :)

Okay, I've changed my mind. :-) I'll back off a bit from this extreme and call it:

sound/soc/fsl/soc-of-simple.c

Does that sound okay? If non-freescale chips decide to use it then it can be moved out of the freescale director.

Cheers,
g.

#42 lore raw
Quoted 7 lines · Grant Likely

Okay, I've changed my mind. :-) I'll back off a bit from this extreme and call it:

sound/soc/fsl/soc-of-simple.c

Does that sound okay? If non-freescale chips decide to use it then it can be moved out of the freescale director.

Fine by me - you could add an of directory but I don't mind either way so long as the people actually using the code are happy.

#43 lore raw
In reply to Grant Likely
Quoted 4 lines · Grant Likely

Okay, I've changed my mind. :-) I'll back off a bit from this extreme and call it:

sound/soc/fsl/soc-of-simple.c

That works for me.

And please don't forget to CC: me on any discussion involving sound/soc/fsl.

Signature · 2 lines
Timur Tabi
Linux Kernel Developer @ Freescale
#44 lore raw
In reply to Grant Likely
Quoted 10 lines · Grant Likely

From: Grant Likely <[email protected]>

Simple utility layer for creating ASoC machine instances based on data in the OpenFirmware device tree. OF aware platform drivers and codec drivers register themselves with this framework and the framework automatically instantiates a machine driver.

This is most likely temporary glue code to work around limitations in the ASoC v1 framework. I expect ASoC v2 won't need this.
---

[...]

sound/soc/soc-of.c

Quoted 2 lines
sound/soc/soc-of.c new file +0 -0

It's quite inconvenient to spread the firmware-specific bits over the whole kernel source tree. So, can we place this in driver/of/, just as we did for i2c, spi and gpio?

Quoted 162 lines
sound/soc/soc-of.c new file +161 -0
@@ -0,0 +1,171 @@
+/*
+ * OF helpers for ALSA SoC Layer
+ *
+ * Copyright (C) 2008, Secret Lab Technologies Ltd.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/pm.h>
+#include <linux/bitops.h>
+#include <linux/platform_device.h>
+#include <linux/of.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/soc-of.h>
+#include <sound/initval.h>
+
+MODULE_AUTHOR("Grant Likely <[email protected]>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("ALSA SoC OpenFirmware bindings");
+
+static DEFINE_MUTEX(of_snd_soc_mutex);
+static LIST_HEAD(of_snd_soc_device_list);
+static int of_snd_soc_next_index;
+
+struct of_snd_soc_device {
+	int id;
+	struct list_head list;
+	struct snd_soc_device device;
+	struct snd_soc_machine machine;
+	struct snd_soc_dai_link dai_link;
+	struct platform_device *pdev;
+	struct device_node *platform_node;
+	struct device_node *codec_node;
+};
+
+static struct snd_soc_ops of_snd_soc_ops = {
+};
+
+static struct of_snd_soc_device *
+of_snd_soc_get_device(struct device_node *codec_node)
+{
+	struct of_snd_soc_device *of_soc;
+
+	list_for_each_entry(of_soc, &of_snd_soc_device_list, list) {
+		if (of_soc->codec_node == codec_node)
+			return of_soc;
+	}
+
+	of_soc = kzalloc(sizeof(struct of_snd_soc_device), GFP_KERNEL);
+	if (!of_soc)
+		return NULL;
+
+	/* Initialize the structure and add it to the global list */
+	of_soc->codec_node = codec_node;
+	of_soc->id = of_snd_soc_next_index++;
+	of_soc->machine.dai_link = &of_soc->dai_link;
+	of_soc->machine.num_links = 1;
+	of_soc->device.machine = &of_soc->machine;
+	of_soc->dai_link.ops = &of_snd_soc_ops;
+	list_add(&of_soc->list, &of_snd_soc_device_list);
+
+	return of_soc;
+}
+
+static void of_snd_soc_register_device(struct of_snd_soc_device *of_soc)
+{
+	struct platform_device *pdev;
+	int rc;
+
+	/* Only register the device if both the codec and platform have
+	 * been registered */
+	if ((!of_soc->device.codec_data) || (!of_soc->platform_node))
+		return;
+
+	pr_info("platform<-->codec match achieved; registering machine\n");
+
+	pdev = platform_device_alloc("soc-audio", of_soc->id);
+	if (!pdev) {
+		pr_err("of_soc: platform_device_alloc() failed\n");
+		return;
+	}
+
+	pdev->dev.platform_data = of_soc;
+	platform_set_drvdata(pdev, &of_soc->device);
+	of_soc->device.dev = &pdev->dev;
+
+	/* The ASoC device is complete; register it */
+	rc = platform_device_add(pdev);
+	if (rc) {
+		pr_err("of_soc: platform_device_add() failed\n");
+		return;
+	}
+
+}
+
+int of_snd_soc_register_codec(struct snd_soc_codec_device *codec_dev,
+			      void *codec_data, struct snd_soc_codec_dai *dai,
+			      struct device_node *node)
+{
+	struct of_snd_soc_device *of_soc;
+	int rc = 0;
+
+	pr_info("registering ASoC codec driver: %s\n", node->full_name);
+
+	mutex_lock(&of_snd_soc_mutex);
+	of_soc = of_snd_soc_get_device(node);
+	if (!of_soc) {
+		rc = -ENOMEM;
+		goto out;
+	}
+
+	/* Store the codec data */
+	of_soc->device.codec_data = codec_data;
+	of_soc->device.codec_dev = codec_dev;
+	of_soc->dai_link.name = node->name;
+	of_soc->dai_link.stream_name = node->name;
+	of_soc->dai_link.codec_dai = dai;
+
+	/* Now try to register the SoC device */
+	of_snd_soc_register_device(of_soc);
+
+ out:
+	mutex_unlock(&of_snd_soc_mutex);
+	return rc;
+}
+EXPORT_SYMBOL_GPL(of_snd_soc_register_codec);
+
+int of_snd_soc_register_platform(struct snd_soc_platform *platform,
+				 struct device_node *node,
+				 struct snd_soc_cpu_dai *cpu_dai)
+{
+	struct of_snd_soc_device *of_soc;
+	struct device_node *codec_node;
+	const phandle *handle;
+	int len, rc = 0;
+
+	pr_info("registering ASoC platform driver: %s\n", node->full_name);
+
+	handle = of_get_property(node, "codec-handle", &len);
+	if (!handle || len < sizeof(handle))
+		return -ENODEV;
+	codec_node = of_find_node_by_phandle(*handle);
+	if (!codec_node)
+		return -ENODEV;
+	pr_info("looking for codec: %s\n", codec_node->full_name);
+
+	mutex_lock(&of_snd_soc_mutex);
+	of_soc = of_snd_soc_get_device(codec_node);
+	if (!of_soc) {
+		rc = -ENOMEM;
+		goto out;
+	}
+
+	of_soc->platform_node = node;
+	of_soc->dai_link.cpu_dai = cpu_dai;
+	of_soc->device.platform = platform;

sound/soc/soc-of.c line 171

Quoted 10 lines
sound/soc/soc-of.c new file +10 -0
+	of_soc->machine.name = of_soc->dai_link.cpu_dai->name;
+
+	/* Now try to register the SoC device */
+	of_snd_soc_register_device(of_soc);
+
+ out:
+	mutex_unlock(&of_snd_soc_mutex);
+	return rc;
+}
+EXPORT_SYMBOL_GPL(of_snd_soc_register_platform);

Thanks,

Signature · 3 lines
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2
#45 lore raw
Quoted 7 lines · Anton Vorontsov

sound/soc/soc-of.c

Quoted 2 lines · Grant Likely
sound/soc/soc-of.c new file +0 -0

It's quite inconvenient to spread the firmware-specific bits over the whole kernel source tree. So, can we place this in driver/of/, just as we did for i2c, spi and gpio?

This isn't any more specific than say how device drivers are specific for particular devices. This is an ASoC machine driver and should live with all the other ASoC machine drivers.

g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.