Skip to contentSkip to conversation

Add support for STA529 codec, spdif_receiver and SPEAr spdif_out controller

PATCH Applied Rajeev Kumar 3 participants 14 messages Jun 28, 2012 – Jul 3, 2012

Subsystems (2)

v3 of 5 Applied Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add support for STA529 codec, spdif_receiver and SPEAr spdif_out controller

Earlier I had circulated Patch set V2. Please find below the link for the same.

http://mailman.alsa-project.org/pipermail/alsa-devel/2012-June/052868.html.

Some of the patches got applied and for rest I am sending Version V3.

Patches that got applied(from V2 of patch set) are listed below:
1. [PATCH V2 3/9] sound:asoc: Add support for synopsys i2s controller as per ASoC framework.
2. [PATCH V2 4/9] sound:asoc: Add support for SPEAr ASoC pcm layer.
3. [PATCH V2 5/9] sound:asoc:spdif_in: Add spdif IN support

Changes since V2:
1. In-corporated review comments received on V2

Rajeev Kumar (2):
ASoC: STA529: Add support for STA529 Audio Codec
ASoC: SPEAr: Add Kconfig and Makefile to support SPEAr audio driver

Vipin Kumar (2):
ASoC: spdif_receiver: Add support for spdif in Audio Codec
ASoC: SPEAr spdif_out: Add spdif out support

 sound/soc/codecs/Kconfig          |    4 +
 sound/soc/codecs/Makefile         |    4 +-
 sound/soc/codecs/spdif_receiver.c |   67 ++++++
 sound/soc/codecs/sta529.c         |  441 +++++++++++++++++++++++++++++++++++++
 sound/soc/spear/Kconfig           |   22 ++
 sound/soc/spear/Makefile          |    4 +
 sound/soc/spear/spdif_out.c       |  387 ++++++++++++++++++++++++++++++++
 sound/soc/spear/spdif_out_regs.h  |   79 +++++++
 8 files changed, 1007 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/codecs/spdif_receiver.c
 create mode 100644 sound/soc/codecs/sta529.c
 create mode 100644 sound/soc/spear/Kconfig
 create mode 100644 sound/soc/spear/Makefile
 create mode 100644 sound/soc/spear/spdif_out.c
 create mode 100644 sound/soc/spear/spdif_out_regs.h
#1 lore raw

PATCH v3 1/4 ASoC: spdif_receiver: Add support for spdif in Audio Codec

From: Vipin Kumar <[email protected]>

This patch adds the support for spdif in audio codec.

---
 sound/soc/codecs/Makefile         |    2 +-
 sound/soc/codecs/spdif_receiver.c |   67 +++++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/codecs/spdif_receiver.c
sound/soc/codecs/Makefile +1 -1
index fc27fec..20b2d57 100644
@@ -41,7 +41,7 @@ snd-soc-alc5623-objs := alc5623.o
 snd-soc-alc5632-objs := alc5632.o
 snd-soc-sigmadsp-objs := sigmadsp.o
 snd-soc-sn95031-objs := sn95031.o
-snd-soc-spdif-objs := spdif_transciever.o
+snd-soc-spdif-objs := spdif_transciever.o spdif_receiver.o
 snd-soc-ssm2602-objs := ssm2602.o
 snd-soc-sta32x-objs := sta32x.o
 snd-soc-stac9766-objs := stac9766.o
sound/soc/codecs/spdif_receiver.c new file +67 -0

67 lines not on this page · raw message

Signature · 1 line
1.7.0.4
Applied
#2 lore raw

Re: [PATCH V3 1/4] ASoC: spdif_receiver: Add support for spdif in Audio Codec

Quoted 3 lines · Rajeev Kumar

From: Vipin Kumar <[email protected]>

This patch adds the support for spdif in audio codec.

Applied, thanks.

#3 lore raw

PATCH v3 2/4 ASoC: STA529: Add support for STA529 Audio Codec

In reply to Rajeev Kumar

This patch adds the support for STA529 audio codec.

---
 sound/soc/codecs/Kconfig  |    4 +
 sound/soc/codecs/Makefile |    2 +
 sound/soc/codecs/sta529.c |  441 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 447 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/codecs/sta529.c
sound/soc/codecs/Kconfig +4 -0
index 1e1613a..f06600b 100644
@@ -54,6 +54,7 @@ config SND_SOC_ALL_CODECS
 	select SND_SOC_SPDIF
 	select SND_SOC_SSM2602 if SND_SOC_I2C_AND_SPI
 	select SND_SOC_STA32X if I2C
+	select SND_SOC_STA529 if I2C
 	select SND_SOC_STAC9766 if SND_SOC_AC97_BUS
 	select SND_SOC_TLV320AIC23 if I2C
 	select SND_SOC_TLV320AIC26 if SPI_MASTER
@@ -266,6 +267,9 @@ config SND_SOC_SSM2602
 config SND_SOC_STA32X
 	tristate
 
+config SND_SOC_STA529
+	tristate
+
 config SND_SOC_STAC9766
 	tristate
 
sound/soc/codecs/Makefile +2 -0
index 20b2d57..09c2dd9 100644
@@ -44,6 +44,7 @@ snd-soc-sn95031-objs := sn95031.o
 snd-soc-spdif-objs := spdif_transciever.o spdif_receiver.o
 snd-soc-ssm2602-objs := ssm2602.o
 snd-soc-sta32x-objs := sta32x.o
+snd-soc-sta529-objs := sta529.o
 snd-soc-stac9766-objs := stac9766.o
 snd-soc-tlv320aic23-objs := tlv320aic23.o
 snd-soc-tlv320aic26-objs := tlv320aic26.o
@@ -153,6 +154,7 @@ obj-$(CONFIG_SND_SOC_SN95031)	+=snd-soc-sn95031.o
 obj-$(CONFIG_SND_SOC_SPDIF)	+= snd-soc-spdif.o
 obj-$(CONFIG_SND_SOC_SSM2602)	+= snd-soc-ssm2602.o
 obj-$(CONFIG_SND_SOC_STA32X)   += snd-soc-sta32x.o
+obj-$(CONFIG_SND_SOC_STA529)   += snd-soc-sta529.o
 obj-$(CONFIG_SND_SOC_STAC9766)	+= snd-soc-stac9766.o
 obj-$(CONFIG_SND_SOC_TLV320AIC23)	+= snd-soc-tlv320aic23.o
 obj-$(CONFIG_SND_SOC_TLV320AIC26)	+= snd-soc-tlv320aic26.o
sound/soc/codecs/sta529.c new file +441 -0

441 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#4 lore raw

Re: [PATCH V3 2/4] ASoC: STA529: Add support for STA529 Audio Codec

sound/soc/codecs/sta529.c line 255

Quoted 4 lines · Rajeev Kumar
sound/soc/codecs/sta529.c new file +4 -0
+	val = snd_soc_read(codec, STA529_MISC);
+	/* set FFX audio frequency range */
+	val = (((val & 0x83) | (play_freq_val << 4)) | (record_freq_val << 2));
+	snd_soc_update_bits(codec, STA529_MISC, FREQ_RANGE_MSK, val);

This is really odd, you're using update_bits() like write() - half the point of update_bits() is that you don't need to do the read to get the initial value. It also looks like the frequency range set should be being done in your playback/capture cases so that instead of

sound/soc/codecs/sta529.c line 267

Quoted 6 lines
sound/soc/codecs/sta529.c new file +6 -0
+	u8 val = snd_soc_read(dai->codec, STA529_FFXCFG0);
+
+	if (mute)
+		val |= CODEC_MUTE_VAL;
+
+	snd_soc_update_bits(dai->codec, STA529_FFXCFG0, AUDIO_MUTE_MSK, val);

This will never disable mute since you're using update_bits() badly again - once mute has been set then the read will have the bit set and nothing ever clears it. You shouldn't have the read at all.

#5 lore raw

PATCH v3 3/4 ASoC: SPEAr spdif_out: Add spdif out support

In reply to Rajeev Kumar

From: Vipin Kumar <[email protected]>

This patch implements the spdif out driver for ST peripheral. This peripheral implements IEC60958 standard

---
 sound/soc/spear/spdif_out.c      |  387 ++++++++++++++++++++++++++++++++++++++
 sound/soc/spear/spdif_out_regs.h |   79 ++++++++
 2 files changed, 466 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/spear/spdif_out.c
 create mode 100644 sound/soc/spear/spdif_out_regs.h
sound/soc/spear/spdif_out.c new file +387 -0
new file mode 100644
index 0000000..25a74f2
@@ -0,0 +1,387 @@
+/*
+ * ALSA SoC SPDIF Out Audio Layer for spear processors
+ *
+ * Copyright (C) 2012 ST Microelectronics
+ * Vipin Kumar <[email protected]>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/ioport.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <sound/soc.h>
+#include <sound/spear_dma.h>
+#include <sound/spear_spdif.h>
+#include "spdif_out_regs.h"
+
+static int spdif_out_mute;
+
+struct spdif_out_params {
+	u32 rate;
+	u32 core_freq;
+};
+
+struct spdif_out_dev {
+	struct clk *clk;
+	struct spear_dma_data dma_params;
+	struct spdif_out_params saved_params;
+	u32 running;
+	void *io_base;
+};
+
+static void spdif_out_configure(struct spdif_out_dev *host)
+{
+	writel(SPDIF_OUT_RESET, host->io_base + SPDIF_OUT_SOFT_RST);
+	mdelay(1);
+	writel(readl(host->io_base + SPDIF_OUT_SOFT_RST) & ~SPDIF_OUT_RESET,
+			host->io_base + SPDIF_OUT_SOFT_RST);
+
+	writel(SPDIF_OUT_FDMA_TRIG_16 | SPDIF_OUT_MEMFMT_16_16 |
+			SPDIF_OUT_VALID_HW | SPDIF_OUT_USER_HW |
+			SPDIF_OUT_CHNLSTA_HW | SPDIF_OUT_PARITY_HW,
+			host->io_base + SPDIF_OUT_CFG);
+
+	writel(0x7F, host->io_base + SPDIF_OUT_INT_STA_CLR);
+	writel(0x7F, host->io_base + SPDIF_OUT_INT_EN_CLR);
+}
+
+static int spdif_out_startup(struct snd_pcm_substream *substream,
+		struct snd_soc_dai *cpu_dai)
+{
+	struct spdif_out_dev *host = snd_soc_dai_get_drvdata(cpu_dai);
+	int ret;
+
+	if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+		return -EINVAL;
+
+	snd_soc_dai_set_dma_data(cpu_dai, substream, (void *)&host->dma_params);
+
+	ret = clk_enable(host->clk);
+	if (ret)
+		return ret;
+
+	host->running = true;
+	spdif_out_configure(host);
+
+	return 0;
+}
+
+static void spdif_out_shutdown(struct snd_pcm_substream *substream,
+		struct snd_soc_dai *dai)
+{
+	struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
+
+	if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+		return;
+
+	clk_disable(host->clk);
+	host->running = false;
+	snd_soc_dai_set_dma_data(dai, substream, NULL);
+}
+
+static void spdif_out_clock(struct spdif_out_dev *host, u32 core_freq,
+		u32 rate)
+{
+	u32 divider, ctrl;
+
+	clk_set_rate(host->clk, core_freq);
+	divider = DIV_ROUND_CLOSEST(clk_get_rate(host->clk), (rate * 128));
+
+	ctrl = readl(host->io_base + SPDIF_OUT_CTRL);
+	ctrl &= ~SPDIF_DIVIDER_MASK;
+	ctrl |= (divider << SPDIF_DIVIDER_SHIFT) & SPDIF_DIVIDER_MASK;
+	writel(ctrl, host->io_base + SPDIF_OUT_CTRL);
+}
+
+static int spdif_out_hw_params(struct snd_pcm_substream *substream,
+		struct snd_pcm_hw_params *params,
+		struct snd_soc_dai *dai)
+{
+	struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
+	u32 rate, core_freq;
+
+	if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+		return -EINVAL;
+
+	rate = params_rate(params);
+
+	switch (rate) {
+	case 8000:
+	case 16000:
+	case 32000:
+	case 64000:
+		/*
+		 * The clock is multiplied by 10 to bring it to feasible range
+		 * of frequencies for sscg
+		 */
+		core_freq = 64000 * 128 * 10;	/* 81.92 MHz */
+		break;
+	case 5512:
+	case 11025:
+	case 22050:
+	case 44100:
+	case 88200:
+	case 176400:
+		core_freq = 176400 * 128;	/* 22.5792 MHz */
+		break;
+	case 48000:
+	case 96000:
+	case 192000:
+	default:
+		core_freq = 192000 * 128;	/* 24.576 MHz */
+		break;
+	}
+
+	spdif_out_clock(host, core_freq, rate);
+	host->saved_params.core_freq = core_freq;
+	host->saved_params.rate = rate;
+
+	return 0;
+}
+
+static int spdif_out_trigger(struct snd_pcm_substream *substream, int cmd,
+		struct snd_soc_dai *dai)
+{
+	struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
+	u32 ctrl;
+	int ret = 0;
+
+	if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
+		return -EINVAL;
+
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_START:
+	case SNDRV_PCM_TRIGGER_RESUME:
+	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+			ctrl = readl(host->io_base + SPDIF_OUT_CTRL);
+			ctrl &= ~SPDIF_OPMODE_MASK;
+			if (!spdif_out_mute)
+				ctrl |= SPDIF_OPMODE_AUD_DATA |
+					SPDIF_STATE_NORMAL;
+			else
+				ctrl |= SPDIF_OPMODE_MUTE_PCM;
+			writel(ctrl, host->io_base + SPDIF_OUT_CTRL);
+		break;
+
+	case SNDRV_PCM_TRIGGER_STOP:
+	case SNDRV_PCM_TRIGGER_SUSPEND:
+	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+		ctrl = readl(host->io_base + SPDIF_OUT_CTRL);
+		ctrl &= ~SPDIF_OPMODE_MASK;
+		ctrl |= SPDIF_OPMODE_OFF;
+		writel(ctrl, host->io_base + SPDIF_OUT_CTRL);
+		break;
+
+	default:
+		ret = -EINVAL;
+		break;
+	}
+	return ret;
+}
+
+static int spdif_digital_mute(struct snd_soc_dai *dai, int mute)
+{
+	struct spdif_out_dev *host = snd_soc_dai_get_drvdata(dai);
+	u32 val;
+
+	spdif_out_mute = mute;
+	val = readl(host->io_base + SPDIF_OUT_CTRL);
+	val &= ~SPDIF_OPMODE_MASK;
+
+	if (mute)
+		val |= SPDIF_OPMODE_MUTE_PCM;
+	else {
+		if (host->running)
+			val |= SPDIF_OPMODE_AUD_DATA | SPDIF_STATE_NORMAL;
+		else
+			val |= SPDIF_OPMODE_OFF;
+	}
+
+	writel(val, host->io_base + SPDIF_OUT_CTRL);
+	return 0;
+}
+
+static int spdif_mute_get(struct snd_kcontrol *kcontrol,
+		struct snd_ctl_elem_value *ucontrol)
+{
+	ucontrol->value.integer.value[0] = spdif_out_mute;
+	return 0;
+}
+
+static int spdif_mute_put(struct snd_kcontrol *kcontrol,
+		struct snd_ctl_elem_value *ucontrol)
+{
+	struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct snd_soc_card *card = codec->card;
+	struct snd_soc_pcm_runtime *rtd = card->rtd;
+	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+
+	if (spdif_out_mute == ucontrol->value.integer.value[0])
+		return 0;
+
+	spdif_digital_mute(cpu_dai, ucontrol->value.integer.value[0]);
+
+	return 1;
+}
+static const struct snd_kcontrol_new spdif_out_controls[] = {
+	SOC_SINGLE_BOOL_EXT("SPDIF Play Mute", (unsigned long)&spdif_out_mute,
+			spdif_mute_get, spdif_mute_put),
+};
+
+int spdif_soc_dai_probe(struct snd_soc_dai *dai)
+{
+	struct snd_soc_card *card = dai->card;
+	struct snd_soc_pcm_runtime *rtd = card->rtd;
+	struct snd_soc_codec *codec = rtd->codec;
+
+	return snd_soc_add_codec_controls(codec, spdif_out_controls,
+				ARRAY_SIZE(spdif_out_controls));
+}
+
+static struct snd_soc_dai_ops spdif_out_dai_ops = {
+	.digital_mute	= spdif_digital_mute,
+	.startup	= spdif_out_startup,
+	.shutdown	= spdif_out_shutdown,
+	.trigger	= spdif_out_trigger,
+	.hw_params	= spdif_out_hw_params,
+};
+
+struct snd_soc_dai_driver spdif_out_dai = {
+	.playback = {
+		.channels_min = 2,
+		.channels_max = 2,
+		.rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
+				 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 | \
+				 SNDRV_PCM_RATE_192000),
+		.formats = SNDRV_PCM_FMTBIT_S16_LE,
+	},
+	.probe = spdif_soc_dai_probe,
+	.ops = (struct snd_soc_dai_ops *)&spdif_out_dai_ops,
+};
+
+static int spdif_out_probe(struct platform_device *pdev)
+{
+	struct spdif_out_dev *host;
+	struct spear_spdif_platform_data *pdata;
+	struct resource *res;
+	int ret;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
+
+	if (!devm_request_mem_region(&pdev->dev, res->start,
+				resource_size(res), pdev->name)) {
+		dev_warn(&pdev->dev, "Failed to get memory resourse\n");
+		return -ENOENT;
+	}
+
+	host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL);
+	if (!host) {
+		dev_warn(&pdev->dev, "kzalloc fail\n");
+		return -ENOMEM;
+	}
+
+	host->io_base = devm_ioremap(&pdev->dev, res->start,
+				resource_size(res));
+	if (!host->io_base) {
+		dev_warn(&pdev->dev, "ioremap failed\n");
+		return -ENOMEM;
+	}
+
+	host->clk = clk_get(&pdev->dev, NULL);
+	if (IS_ERR(host->clk))
+		return PTR_ERR(host->clk);
+
+	pdata = dev_get_platdata(&pdev->dev);
+
+	host->dma_params.data = pdata->dma_params;
+	host->dma_params.addr = res->start + SPDIF_OUT_FIFO_DATA;
+	host->dma_params.max_burst = 16;
+	host->dma_params.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
+	host->dma_params.filter = pdata->filter;
+
+	dev_set_drvdata(&pdev->dev, host);
+
+	ret = snd_soc_register_dai(&pdev->dev, &spdif_out_dai);
+	if (ret != 0) {
+		clk_put(host->clk);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int spdif_out_remove(struct platform_device *pdev)
+{
+	struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
+
+	snd_soc_unregister_dai(&pdev->dev);
+	dev_set_drvdata(&pdev->dev, NULL);
+
+	clk_put(host->clk);
+
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int spdif_out_suspend(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
+
+	if (host->running)
+		clk_disable(host->clk);
+
+	return 0;
+}
+
+static int spdif_out_resume(struct device *dev)
+{
+	struct platform_device *pdev = to_platform_device(dev);
+	struct spdif_out_dev *host = dev_get_drvdata(&pdev->dev);
+
+	if (host->running) {
+		clk_enable(host->clk);
+		spdif_out_configure(host);
+		spdif_out_clock(host, host->saved_params.core_freq,
+				host->saved_params.rate);
+	}
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(spdif_out_dev_pm_ops, spdif_out_suspend, \
+		spdif_out_resume);
+
+#define SPDIF_OUT_DEV_PM_OPS (&spdif_out_dev_pm_ops)
+
+#else
+#define SPDIF_OUT_DEV_PM_OPS NULL
+
+#endif
+
+static struct platform_driver spdif_out_driver = {
+	.probe		= spdif_out_probe,
+	.remove		= spdif_out_remove,
+	.driver		= {
+		.name	= "spdif-out",
+		.owner	= THIS_MODULE,
+		.pm	= SPDIF_OUT_DEV_PM_OPS,
+	},
+};
+
+module_platform_driver(spdif_out_driver);
+
+MODULE_AUTHOR("Vipin Kumar <[email protected]>");
+MODULE_DESCRIPTION("SPEAr SPDIF OUT SoC Interface");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:spdif_out");
sound/soc/spear/spdif_out_regs.h new file +79 -0

79 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#6 lore raw

Re: [PATCH V3 3/4] ASoC: SPEAr spdif_out: Add spdif out support

sound/soc/spear/spdif_out.c line 38

Quoted 1 line · Rajeev Kumar
sound/soc/spear/spdif_out.c new file +1 -0
+	void *io_base;

Should be __iomem. Looking at the code I suspect this might benefit from using regmap like Tegra, you'd save having to open code your mute control if nothing else.

sound/soc/spear/spdif_out.c line 237

Quoted 3 lines
sound/soc/spear/spdif_out.c new file +3 -0
+static const struct snd_kcontrol_new spdif_out_controls[] = {
+	SOC_SINGLE_BOOL_EXT("SPDIF Play Mute", (unsigned long)&spdif_out_mute,
+			spdif_mute_get, spdif_mute_put),

Should be "IEC958 Playback Switch".

sound/soc/spear/spdif_out.c line 247

Quoted 8 lines
sound/soc/spear/spdif_out.c new file +8 -0
+int spdif_soc_dai_probe(struct snd_soc_dai *dai)
+{
+	struct snd_soc_card *card = dai->card;
+	struct snd_soc_pcm_runtime *rtd = card->rtd;
+	struct snd_soc_codec *codec = rtd->codec;
+
+	return snd_soc_add_codec_controls(codec, spdif_out_controls,
+				ARRAY_SIZE(spdif_out_controls));

We should add a framework thing for this...

sound/soc/spear/spdif_out.c line 268

Quoted 1 line
sound/soc/spear/spdif_out.c new file +1 -0
+	.ops = (struct snd_soc_dai_ops *)&spdif_out_dai_ops,

Why do you need this cast?

#7 lore raw

Re: [PATCH V3 3/4] ASoC: SPEAr spdif_out: Add spdif out support

Quoted 8 lines · Mark Brown

sound/soc/spear/spdif_out.c line 38

Quoted 1 line · Rajeev Kumar
sound/soc/spear/spdif_out.c new file +1 -0
+	void *io_base;

Should be __iomem. Looking at the code I suspect this might benefit from using regmap like Tegra, you'd save having to open code your mute control if nothing else.

OK

Quoted 6 lines

sound/soc/spear/spdif_out.c line 237

Quoted 3 lines
sound/soc/spear/spdif_out.c new file +3 -0
+static const struct snd_kcontrol_new spdif_out_controls[] = {
+	SOC_SINGLE_BOOL_EXT("SPDIF Play Mute", (unsigned long)&spdif_out_mute,
+			spdif_mute_get, spdif_mute_put),

Should be "IEC958 Playback Switch".

OK

Quoted 11 lines

sound/soc/spear/spdif_out.c line 247

Quoted 8 lines
sound/soc/spear/spdif_out.c new file +8 -0
+int spdif_soc_dai_probe(struct snd_soc_dai *dai)
+{
+	struct snd_soc_card *card = dai->card;
+	struct snd_soc_pcm_runtime *rtd = card->rtd;
+	struct snd_soc_codec *codec = rtd->codec;
+
+	return snd_soc_add_codec_controls(codec, spdif_out_controls,
+				ARRAY_SIZE(spdif_out_controls));

We should add a framework thing for this...

Quoted 3 lines

sound/soc/spear/spdif_out.c line 268

Quoted 1 line
sound/soc/spear/spdif_out.c new file +1 -0
+	.ops = (struct snd_soc_dai_ops *)&spdif_out_dai_ops,

Why do you need this cast?

It was a const I think

Regards
Vipin

#8 lore raw

Re: [PATCH V3 3/4] ASoC: SPEAr spdif_out: Add spdif out support

Quoted 7 lines · Vipin Kumar
Quoted 3 lines · Mark Brown

sound/soc/spear/spdif_out.c line 268

Quoted 1 line
sound/soc/spear/spdif_out.c new file +1 -0
+	.ops = (struct snd_soc_dai_ops *)&spdif_out_dai_ops,

Why do you need this cast?

It was a const I think

So you've just introduced a bug, then - you're using a const variable in a non-const context. Don't cast away the const, either arrange for the ops pointer in the dai to be const or remove the const.

#9 lore raw

Re: [PATCH V3 3/4] ASoC: SPEAr spdif_out: Add spdif out support

Quoted 7 lines · Mark Brown
Quoted 5 lines · Vipin Kumar
Quoted 3 lines · Mark Brown

sound/soc/spear/spdif_out.c line 268

Quoted 1 line
sound/soc/spear/spdif_out.c new file +1 -0
+	.ops = (struct snd_soc_dai_ops *)&spdif_out_dai_ops,

Why do you need this cast?

Quoted 5 lines
Quoted 1 line

It was a const I think

So you've just introduced a bug, then - you're using a const variable in a non-const context. Don't cast away the const, either arrange for the ops pointer in the dai to be const or remove the const.

sure, i will do that...got it :)

#10 lore raw

Re: [PATCH V3 3/4] ASoC: SPEAr spdif_out: Add spdif out support

In reply to Mark Brown

Hello Mark,

Quoted 10 lines · Mark Brown
Quoted 8 lines

+int spdif_soc_dai_probe(struct snd_soc_dai *dai)

Quoted 7 lines

+{
+ struct snd_soc_card *card = dai->card;
+ struct snd_soc_pcm_runtime *rtd = card->rtd;
+ struct snd_soc_codec *codec = rtd->codec;
+
+ return snd_soc_add_codec_controls(codec, spdif_out_controls,
+ ARRAY_SIZE(spdif_out_controls));

We should add a framework thing for this...

I was going through the simaple-card.c file and I think that the above is possible if we have a pointer of "snd_kcontrol_new" in asoc_simple_card_info structure. In this case we can pass all the controls from board file (arch/arm/mach-*). Please share your opinion.

or,

Is there any other way to do this ?

Best Regards
Rajeev

#11 lore raw

Re: [PATCH V3 3/4] ASoC: SPEAr spdif_out: Add spdif out support

Hello Mark,

Quoted 14 lines · Rajeev kumar

Hello Mark,

Quoted 10 lines · Mark Brown
Quoted 8 lines

+int spdif_soc_dai_probe(struct snd_soc_dai *dai)

sound/soc/spear/spdif_out.c line 247

Quoted 7 lines
sound/soc/spear/spdif_out.c new file +7 -0
+{
+ struct snd_soc_card *card = dai->card;
+ struct snd_soc_pcm_runtime *rtd = card->rtd;
+ struct snd_soc_codec *codec = rtd->codec;
+
+ return snd_soc_add_codec_controls(codec, spdif_out_controls,
+ ARRAY_SIZE(spdif_out_controls));

We should add a framework thing for this...

Quoted 9 lines

I was going through the simaple-card.c file and I think that the above is possible if we have a pointer of "snd_kcontrol_new" in asoc_simple_card_info structure. In this case we can pass all the controls from board file (arch/arm/mach-*). Please share your opinion.

or,

Is there any other way to do this ?

Waiting for your reply,

Best Regards
Rajeev

Quoted 3 lines

Best Regards
Rajeev

#12 lore raw

Re: [PATCH V3 3/4] ASoC: SPEAr spdif_out: Add spdif out support

In reply to Rajeev kumar
Quoted 11 lines · Rajeev kumar
Quoted 8 lines · Mark Brown
Quoted 8 lines

+int spdif_soc_dai_probe(struct snd_soc_dai *dai)

Quoted 7 lines

+{
+ struct snd_soc_card *card = dai->card;
+ struct snd_soc_pcm_runtime *rtd = card->rtd;
+ struct snd_soc_codec *codec = rtd->codec;
+
+ return snd_soc_add_codec_controls(codec, spdif_out_controls,
+ ARRAY_SIZE(spdif_out_controls));

Quoted 7 lines
Quoted 1 line

We should add a framework thing for this...

I was going through the simaple-card.c file and I think that the above is possible if we have a pointer of "snd_kcontrol_new" in asoc_simple_card_info structure. In this case we can pass all the controls from board file (arch/arm/mach-*). Please share your opinion.

Why would we want to do that? These controls are part of the CPU DAI, the CPU DAI driver should add them.

#13 lore raw

PATCH v3 4/4 ASoC: SPEAr: Add Kconfig and Makefile to support SPEAr audio driver

In reply to Rajeev Kumar

This patch add Kconfig and Makefile to support SPEAr Audio driver

---
 sound/soc/spear/Kconfig  |   22 ++++++++++++++++++++++
 sound/soc/spear/Makefile |    4 ++++
 2 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/spear/Kconfig
 create mode 100644 sound/soc/spear/Makefile
sound/soc/spear/Kconfig new file +22 -0
new file mode 100644
index 0000000..6ff9460
@@ -0,0 +1,22 @@
+config SND_SPEAR_SOC
+	tristate "SoC Audio for the ST chip"
+	depends on SND_DESIGNWARE_I2S || SND_SPEAR_SPDIF_OUT || \
+		SND_SPEAR_SPDIF_IN
+	select SND_SOC_DMAENGINE_PCM
+	select SND_SOC_STA529
+	select SND_SOC_SPDIF
+	select SND_SIMPLE_CARD
+	help
+	 Say Y or M if you want to add support for any of the audio
+	 controllers (I2S/SPDIF). You will also need to select
+	 the audio interface codecs to support below.
+
+config SND_SPEAR_SPDIF_OUT
+	tristate "SPEAr SPDIF Out Device Driver"
+	help
+	 Say Y or M if you want to add support for SPDIF OUT driver.
+
+config SND_SPEAR_SPDIF_IN
+	tristate "SPEAr SPDIF IN Device Driver"
+	help
+	 Say Y or M if you want to add support for SPDIF IN driver.
sound/soc/spear/Makefile new file +4 -0
new file mode 100644
index 0000000..9f47bb4
@@ -0,0 +1,4 @@
+# SPEAR Platform Support
+obj-$(CONFIG_SND_SPEAR_SOC) += spear_pcm.o
+obj-$(CONFIG_SND_SPEAR_SPDIF_IN) += spdif_in.o
+obj-$(CONFIG_SND_SPEAR_SPDIF_OUT) += spdif_out.o
Signature · 1 line
1.7.0.4