All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 00/15] ASoC: qcom: Add capture support.
@ 2016-02-01 17:27 Srinivas Kandagatla
  2016-02-01 17:27 ` [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis Srinivas Kandagatla
                   ` (15 more replies)
  0 siblings, 16 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:27 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

LPASS IP on QCOM SOC supports both Playback and capture
via I2S, but this feature is missing in existing code. 
This patchset aims at adding capture support to lpass IP.
First few patches in this series does cleanup the driver
to make easy to add capture support.

These patches are tested on DB410C with Headset Mic.

Thanks,
srini

Srinivas Kandagatla (15):
  ASoC: qcom: use snd_dma_alloc/free* apis
  ASoC: qcom: add wrdma register details to lpass_variant
  ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start
  ASoC: qcom: pass direction to dma allocation
  ASoC: qcom: ipq806x: add error in dma allocation.
  ASoC: qcom: ipq806x: add wrdma related register offsets
  ASoC: qcom: add mic related i2s control register defines
  ASoC: qcom: add wrdma dma channel start
  ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map
  ASoC: qcom: apq8016: add wrdma support
  ASoC: qcom: add wrdma register definations
  ASoC: qcom: add generic bit masks for RDMA and WRDMA
  ASoC: qcom: apq8016: set the correct max register for regmap
  ASoC: qcom: apq8016-sbc: add mic support
  ASoC: qcom: add mic support

 sound/soc/qcom/apq8016_sbc.c     |  10 +-
 sound/soc/qcom/lpass-apq8016.c   |  31 +++--
 sound/soc/qcom/lpass-cpu.c       | 146 +++++++++++++++++------
 sound/soc/qcom/lpass-ipq806x.c   |  11 +-
 sound/soc/qcom/lpass-lpaif-reg.h | 118 +++++++++++++------
 sound/soc/qcom/lpass-platform.c  | 243 +++++++++++++++++++++++----------------
 sound/soc/qcom/lpass.h           |  10 +-
 7 files changed, 392 insertions(+), 177 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 48+ messages in thread

* [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
@ 2016-02-01 17:27 ` Srinivas Kandagatla
  2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:28 ` [PATCH RFC 02/15] ASoC: qcom: add wrdma register details to lpass_variant Srinivas Kandagatla
                   ` (14 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:27 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

There is no point in having local allocation functions when the driver
can use snd_dma_alloc/free() apis. This patch replaces the local versions
of the dma allocation apis with the snd_dma_alloc/free() apis.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-platform.c | 41 +++++------------------------------------
 1 file changed, 5 insertions(+), 36 deletions(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index 4aeb8e1..a6dce1b 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -439,39 +439,6 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-static int lpass_platform_alloc_buffer(struct snd_pcm_substream *substream,
-		struct snd_soc_pcm_runtime *rt)
-{
-	struct snd_dma_buffer *buf = &substream->dma_buffer;
-	size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
-
-	buf->dev.type = SNDRV_DMA_TYPE_DEV;
-	buf->dev.dev = rt->platform->dev;
-	buf->private_data = NULL;
-	buf->area = dma_alloc_coherent(rt->platform->dev, size, &buf->addr,
-			GFP_KERNEL);
-	if (!buf->area) {
-		dev_err(rt->platform->dev, "%s: Could not allocate DMA buffer\n",
-				__func__);
-		return -ENOMEM;
-	}
-	buf->bytes = size;
-
-	return 0;
-}
-
-static void lpass_platform_free_buffer(struct snd_pcm_substream *substream,
-		struct snd_soc_pcm_runtime *rt)
-{
-	struct snd_dma_buffer *buf = &substream->dma_buffer;
-
-	if (buf->area) {
-		dma_free_coherent(rt->dev, buf->bytes, buf->area,
-				buf->addr);
-	}
-	buf->area = NULL;
-}
-
 static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 {
 	struct snd_pcm *pcm = soc_runtime->pcm;
@@ -483,6 +450,7 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 	struct lpass_variant *v = drvdata->variant;
 	int ret;
 	struct lpass_pcm_data *data;
+	size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
 
 	data = devm_kzalloc(soc_runtime->dev, sizeof(*data), GFP_KERNEL);
 	if (!data)
@@ -499,7 +467,8 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 
 	snd_soc_pcm_set_drvdata(soc_runtime, data);
 
-	ret = lpass_platform_alloc_buffer(substream, soc_runtime);
+	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
+				size, &substream->dma_buffer);
 	if (ret)
 		return ret;
 
@@ -514,7 +483,7 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 	return 0;
 
 err_buf:
-	lpass_platform_free_buffer(substream, soc_runtime);
+	snd_dma_free_pages(&substream->dma_buffer);
 	return ret;
 }
 
@@ -533,7 +502,7 @@ static void lpass_platform_pcm_free(struct snd_pcm *pcm)
 	if (v->free_dma_channel)
 		v->free_dma_channel(drvdata, data->rdma_ch);
 
-	lpass_platform_free_buffer(substream, soc_runtime);
+	snd_dma_free_pages(&substream->dma_buffer);
 }
 
 static struct snd_soc_platform_driver lpass_platform_driver = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 02/15] ASoC: qcom: add wrdma register details to lpass_variant
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
  2016-02-01 17:27 ` [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis Srinivas Kandagatla
@ 2016-02-01 17:28 ` Srinivas Kandagatla
  2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:28 ` [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start Srinivas Kandagatla
                   ` (13 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:28 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch adds wrdma related register offsets and shifts into lpass
variant structure.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 0b63e2e..ab684a8 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -71,6 +71,9 @@ struct lpass_variant {
 	u32	rdma_reg_base;
 	u32	rdma_reg_stride;
 	u32	rdma_channels;
+	u32	wrdma_reg_base;
+	u32	wrdma_reg_stride;
+	u32	wrdma_channels;
 
 	/**
 	 * on SOCs like APQ8016 the channel control bits start
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
  2016-02-01 17:27 ` [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis Srinivas Kandagatla
  2016-02-01 17:28 ` [PATCH RFC 02/15] ASoC: qcom: add wrdma register details to lpass_variant Srinivas Kandagatla
@ 2016-02-01 17:28 ` Srinivas Kandagatla
  2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:28 ` [PATCH RFC 04/15] ASoC: qcom: pass direction to dma allocation Srinivas Kandagatla
                   ` (12 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:28 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch renames rdmactl_audif_start to dmactrl_audif_start as this
is common for both rdma and wrdma. Without this patch the name would be
bit misleading to the readers.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-platform.c | 2 +-
 sound/soc/qcom/lpass.h          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index a6dce1b..bfc9de6 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -91,7 +91,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 	unsigned int channels = params_channels(params);
 	unsigned int regval;
 	int bitwidth;
-	int ret, rdma_port = pcm_data->i2s_port + v->rdmactl_audif_start;
+	int ret, rdma_port = pcm_data->i2s_port + v->dmactl_audif_start;
 
 	bitwidth = snd_pcm_format_width(format);
 	if (bitwidth < 0) {
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index ab684a8..7c3367f 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -79,7 +79,7 @@ struct lpass_variant {
 	 * on SOCs like APQ8016 the channel control bits start
 	 * at different offset to ipq806x
 	 **/
-	u32	rdmactl_audif_start;
+	u32	dmactl_audif_start;
 	/* SOC specific intialization like clocks */
 	int (*init)(struct platform_device *pdev);
 	int (*exit)(struct platform_device *pdev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 04/15] ASoC: qcom: pass direction to dma allocation
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (2 preceding siblings ...)
  2016-02-01 17:28 ` [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start Srinivas Kandagatla
@ 2016-02-01 17:28 ` Srinivas Kandagatla
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:28 ` [PATCH RFC 05/15] ASoC: qcom: ipq806x: add error in " Srinivas Kandagatla
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:28 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch updates the internal dma allocation callbacks to take the
stream direction so that it can allocate channels suitable for that
stream direction. Before the capture support this was not necessary.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-apq8016.c | 3 ++-
 sound/soc/qcom/lpass-ipq806x.c | 2 +-
 sound/soc/qcom/lpass.h         | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 94efc01..2d43842 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -133,7 +133,8 @@ static struct snd_soc_dai_driver apq8016_lpass_cpu_dai_driver[] = {
 	},
 };
 
-static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata)
+static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
+					   int direction)
 {
 	struct lpass_variant *v = drvdata->variant;
 	int chan = find_first_zero_bit(&drvdata->rdma_ch_bit_map,
diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
index 7a41679..119048c 100644
--- a/sound/soc/qcom/lpass-ipq806x.c
+++ b/sound/soc/qcom/lpass-ipq806x.c
@@ -63,7 +63,7 @@ static struct snd_soc_dai_driver ipq806x_lpass_cpu_dai_driver = {
 	.ops    = &asoc_qcom_lpass_cpu_dai_ops,
 };
 
-static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata)
+static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata, int dir)
 {
 	return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
 }
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 7c3367f..30449f3 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -83,7 +83,7 @@ struct lpass_variant {
 	/* SOC specific intialization like clocks */
 	int (*init)(struct platform_device *pdev);
 	int (*exit)(struct platform_device *pdev);
-	int (*alloc_dma_channel)(struct lpass_data *data);
+	int (*alloc_dma_channel)(struct lpass_data *data, int direction);
 	int (*free_dma_channel)(struct lpass_data *data, int ch);
 
 	/* SOC specific dais */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 05/15] ASoC: qcom: ipq806x: add error in dma allocation.
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (3 preceding siblings ...)
  2016-02-01 17:28 ` [PATCH RFC 04/15] ASoC: qcom: pass direction to dma allocation Srinivas Kandagatla
@ 2016-02-01 17:28 ` Srinivas Kandagatla
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:28 ` [PATCH RFC 06/15] ASoC: qcom: ipq806x: add wrdma related register offsets Srinivas Kandagatla
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:28 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

ipq806x is only ever tested for playback so return error in dma allocation
if the stream direction is capture.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-ipq806x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
index 119048c..8bdcdcb 100644
--- a/sound/soc/qcom/lpass-ipq806x.c
+++ b/sound/soc/qcom/lpass-ipq806x.c
@@ -65,7 +65,10 @@ static struct snd_soc_dai_driver ipq806x_lpass_cpu_dai_driver = {
 
 static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata, int dir)
 {
-	return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
+	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+		return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
+	else	/* Capture not supported */
+		return -EINVAL;
 }
 
 static int ipq806x_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 06/15] ASoC: qcom: ipq806x: add wrdma related register offsets
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (4 preceding siblings ...)
  2016-02-01 17:28 ` [PATCH RFC 05/15] ASoC: qcom: ipq806x: add error in " Srinivas Kandagatla
@ 2016-02-01 17:28 ` Srinivas Kandagatla
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: ipq806x: add wrdma related register offsets" to the asoc tree Mark Brown
  2016-02-01 17:28 ` [PATCH RFC 07/15] ASoC: qcom: add mic related i2s control register defines Srinivas Kandagatla
                   ` (9 subsequent siblings)
  15 siblings, 2 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:28 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch adds wrdma related register offsets to the lpass variant data
of ipq806x.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-ipq806x.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
index 8bdcdcb..4923740 100644
--- a/sound/soc/qcom/lpass-ipq806x.c
+++ b/sound/soc/qcom/lpass-ipq806x.c
@@ -86,6 +86,10 @@ static struct lpass_variant ipq806x_data = {
 	.rdma_reg_base		= 0x6000,
 	.rdma_reg_stride	= 0x1000,
 	.rdma_channels		= 4,
+	.wrdma_reg_base		= 0xB000,
+	.wrdma_reg_stride	= 0x1000,
+	.wrdma_channel_start	= 5,
+	.wrdma_channels		= 4,
 	.dai_driver		= &ipq806x_lpass_cpu_dai_driver,
 	.num_dai		= 1,
 	.alloc_dma_channel	= ipq806x_lpass_alloc_dma_channel,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 07/15] ASoC: qcom: add mic related i2s control register defines
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (5 preceding siblings ...)
  2016-02-01 17:28 ` [PATCH RFC 06/15] ASoC: qcom: ipq806x: add wrdma related register offsets Srinivas Kandagatla
@ 2016-02-01 17:28 ` Srinivas Kandagatla
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:29 ` [PATCH RFC 08/15] ASoC: qcom: add wrdma dma channel start Srinivas Kandagatla
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:28 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch adds mic related bitmasks and offsets in the i2c control
register.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-lpaif-reg.h | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
index 95e22f1..8a64d1a 100644
--- a/sound/soc/qcom/lpass-lpaif-reg.h
+++ b/sound/soc/qcom/lpass-lpaif-reg.h
@@ -47,6 +47,28 @@
 #define LPAIF_I2SCTL_SPKMONO_STEREO	(0 << LPAIF_I2SCTL_SPKMONO_SHIFT)
 #define LPAIF_I2SCTL_SPKMONO_MONO	(1 << LPAIF_I2SCTL_SPKMONO_SHIFT)
 
+#define LPAIF_I2SCTL_MICEN_MASK		GENMASK(8, 8)
+#define LPAIF_I2SCTL_MICEN_SHIFT	8
+#define LPAIF_I2SCTL_MICEN_DISABLE	(0 << LPAIF_I2SCTL_MICEN_SHIFT)
+#define LPAIF_I2SCTL_MICEN_ENABLE	(1 << LPAIF_I2SCTL_MICEN_SHIFT)
+
+#define LPAIF_I2SCTL_MICMODE_MASK	GENMASK(7, 4)
+#define LPAIF_I2SCTL_MICMODE_SHIFT	4
+#define LPAIF_I2SCTL_MICMODE_NONE	(0 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_SD0	(1 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_SD1	(2 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_SD2	(3 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_SD3	(4 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_QUAD01	(5 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_QUAD02	(6 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_6CH	(7 << LPAIF_I2SCTL_MICMODE_SHIFT)
+#define LPAIF_I2SCTL_MICMODE_8CH	(8 << LPAIF_I2SCTL_MICMODE_SHIFT)
+
+#define LPAIF_I2SCTL_MIMONO_MASK	GENMASK(3, 3)
+#define LPAIF_I2SCTL_MICMONO_SHIFT	3
+#define LPAIF_I2SCTL_MICMONO_STEREO	(0 << LPAIF_I2SCTL_MICMONO_SHIFT)
+#define LPAIF_I2SCTL_MICMONO_MONO	(1 << LPAIF_I2SCTL_MICMONO_SHIFT)
+
 #define LPAIF_I2SCTL_WSSRC_MASK		0x0004
 #define LPAIF_I2SCTL_WSSRC_SHIFT	2
 #define LPAIF_I2SCTL_WSSRC_INTERNAL	(0 << LPAIF_I2SCTL_WSSRC_SHIFT)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 08/15] ASoC: qcom: add wrdma dma channel start
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (6 preceding siblings ...)
  2016-02-01 17:28 ` [PATCH RFC 07/15] ASoC: qcom: add mic related i2s control register defines Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:29 ` [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map Srinivas Kandagatla
                   ` (7 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

wrdma channel numbering starts at 5 on APQ8016 and is different on other chips.

This patch adds wrdma_channel_start map to variant structure for dma channel
allocations.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 30449f3..8475b60 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -80,6 +80,7 @@ struct lpass_variant {
 	 * at different offset to ipq806x
 	 **/
 	u32	dmactl_audif_start;
+	u32	wrdma_channel_start;
 	/* SOC specific intialization like clocks */
 	int (*init)(struct platform_device *pdev);
 	int (*exit)(struct platform_device *pdev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (7 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 08/15] ASoC: qcom: add wrdma dma channel start Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map" to the asoc tree Mark Brown
  2016-02-01 17:29 ` [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support Srinivas Kandagatla
                   ` (6 subsequent siblings)
  15 siblings, 2 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

rdma_ch_bit_map can be reused for wrdma channel allocations as wrdma
channel numbering start after rdma channel numbers.
With capture support referring rdma_ch_bit_map for wrdma channel allocation
is confusing, so renaming rdma_ch_bit_map to dma_ch_bit_map makes sense.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-apq8016.c | 6 +++---
 sound/soc/qcom/lpass.h         | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 2d43842..df44f09 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -137,20 +137,20 @@ static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
 					   int direction)
 {
 	struct lpass_variant *v = drvdata->variant;
-	int chan = find_first_zero_bit(&drvdata->rdma_ch_bit_map,
+	int chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
 					v->rdma_channels);
 
 	if (chan >= v->rdma_channels)
 		return -EBUSY;
 
-	set_bit(chan, &drvdata->rdma_ch_bit_map);
+	set_bit(chan, &drvdata->dma_ch_bit_map);
 
 	return chan;
 }
 
 static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
 {
-	clear_bit(chan, &drvdata->rdma_ch_bit_map);
+	clear_bit(chan, &drvdata->dma_ch_bit_map);
 
 	return 0;
 }
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 8475b60..30714ad 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -50,7 +50,7 @@ struct lpass_data {
 	struct lpass_variant *variant;
 
 	/* bit map to keep track of static channel allocations */
-	unsigned long rdma_ch_bit_map;
+	unsigned long dma_ch_bit_map;
 
 	/* used it for handling interrupt per dma channel */
 	struct snd_pcm_substream *substream[LPASS_MAX_DMA_CHANNELS];
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (8 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:29 ` [PATCH RFC 11/15] ASoC: qcom: add wrdma register definations Srinivas Kandagatla
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch adds wrdma support in lpass-apq8016 by providing the register
offsets and adding support in dma channel allocation callback.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-apq8016.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index df44f09..3eef0c3 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -137,11 +137,23 @@ static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
 					   int direction)
 {
 	struct lpass_variant *v = drvdata->variant;
-	int chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
+	int chan = 0;
+
+	if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+		chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
 					v->rdma_channels);
 
-	if (chan >= v->rdma_channels)
-		return -EBUSY;
+		if (chan >= v->rdma_channels)
+			return -EBUSY;
+	} else {
+		chan = find_next_zero_bit(&drvdata->dma_ch_bit_map,
+					v->wrdma_channel_start +
+					v->wrdma_channels,
+					v->wrdma_channel_start);
+
+		if (chan >=  v->wrdma_channel_start + v->wrdma_channels)
+			return -EBUSY;
+	}
 
 	set_bit(chan, &drvdata->dma_ch_bit_map);
 
@@ -213,7 +225,11 @@ static struct lpass_variant apq8016_data = {
 	.rdma_reg_base		= 0x8400,
 	.rdma_reg_stride	= 0x1000,
 	.rdma_channels		= 2,
-	.rdmactl_audif_start	= 1,
+	.dmactl_audif_start	= 1,
+	.wrdma_reg_base		= 0xB000,
+	.wrdma_reg_stride	= 0x1000,
+	.wrdma_channel_start	= 5,
+	.wrdma_channels		= 2,
 	.dai_driver		= apq8016_lpass_cpu_dai_driver,
 	.num_dai		= ARRAY_SIZE(apq8016_lpass_cpu_dai_driver),
 	.init			= apq8016_lpass_init,
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 11/15] ASoC: qcom: add wrdma register definations
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (9 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: add wrdma register definitions" to the asoc tree Mark Brown
  2016-02-01 17:29 ` [PATCH RFC 12/15] ASoC: qcom: add generic bit masks for RDMA and WRDMA Srinivas Kandagatla
                   ` (4 subsequent siblings)
  15 siblings, 2 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch adds wrdma registers into the lpaif-reg.h.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-lpaif-reg.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
index 8a64d1a..2008f9f 100644
--- a/sound/soc/qcom/lpass-lpaif-reg.h
+++ b/sound/soc/qcom/lpass-lpaif-reg.h
@@ -145,4 +145,15 @@
 #define LPAIF_RDMACTL_ENABLE_OFF	(0 << LPAIF_RDMACTL_ENABLE_SHIFT)
 #define LPAIF_RDMACTL_ENABLE_ON		(1 << LPAIF_RDMACTL_ENABLE_SHIFT)
 
+#define LPAIF_WRDMA_REG_ADDR(v, addr, chan) \
+	(v->wrdma_reg_base + (addr) + \
+	 v->wrdma_reg_stride * (chan - v->wrdma_channel_start))
+
+#define LPAIF_WRDMACTL_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x00, (chan))
+#define LPAIF_WRDMABASE_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x04, (chan))
+#define	LPAIF_WRDMABUFF_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x08, (chan))
+#define LPAIF_WRDMACURR_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x0C, (chan))
+#define	LPAIF_WRDMAPER_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x10, (chan))
+#define	LPAIF_WRDMAPERCNT_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x14, (chan))
+
 #endif /* __LPASS_LPAIF_REG_H__ */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 12/15] ASoC: qcom: add generic bit masks for RDMA and WRDMA
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (10 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 11/15] ASoC: qcom: add wrdma register definations Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
  2016-02-01 17:29 ` [PATCH RFC 13/15] ASoC: qcom: apq8016: set the correct max register for regmap Srinivas Kandagatla
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch adds generic masks for accessing bits in rdma/wrdma
registers. Doing this would simplify the driver and adding capture
support would be much simpler. Also there is no point in having same
bit masks for bits in both rdma and wrdma registers.

This patch also deletes the RDMA specific bit masks and makes the code
use the generic bit masks.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-lpaif-reg.h | 85 ++++++++++++++++++++++++----------------
 sound/soc/qcom/lpass-platform.c  | 54 +++++++++++++------------
 2 files changed, 81 insertions(+), 58 deletions(-)

diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
index 2008f9f..2114b3e 100644
--- a/sound/soc/qcom/lpass-lpaif-reg.h
+++ b/sound/soc/qcom/lpass-lpaif-reg.h
@@ -112,39 +112,6 @@
 #define	LPAIF_RDMAPER_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x10, (chan))
 #define	LPAIF_RDMAPERCNT_REG(v, chan)	LPAIF_RDMA_REG_ADDR(v, 0x14, (chan))
 
-#define LPAIF_RDMACTL_BURSTEN_MASK	0x800
-#define LPAIF_RDMACTL_BURSTEN_SHIFT	11
-#define LPAIF_RDMACTL_BURSTEN_SINGLE	(0 << LPAIF_RDMACTL_BURSTEN_SHIFT)
-#define LPAIF_RDMACTL_BURSTEN_INCR4	(1 << LPAIF_RDMACTL_BURSTEN_SHIFT)
-
-#define LPAIF_RDMACTL_WPSCNT_MASK	0x700
-#define LPAIF_RDMACTL_WPSCNT_SHIFT	8
-#define LPAIF_RDMACTL_WPSCNT_ONE	(0 << LPAIF_RDMACTL_WPSCNT_SHIFT)
-#define LPAIF_RDMACTL_WPSCNT_TWO	(1 << LPAIF_RDMACTL_WPSCNT_SHIFT)
-#define LPAIF_RDMACTL_WPSCNT_THREE	(2 << LPAIF_RDMACTL_WPSCNT_SHIFT)
-#define LPAIF_RDMACTL_WPSCNT_FOUR	(3 << LPAIF_RDMACTL_WPSCNT_SHIFT)
-#define LPAIF_RDMACTL_WPSCNT_SIX	(5 << LPAIF_RDMACTL_WPSCNT_SHIFT)
-#define LPAIF_RDMACTL_WPSCNT_EIGHT	(7 << LPAIF_RDMACTL_WPSCNT_SHIFT)
-
-#define LPAIF_RDMACTL_AUDINTF_MASK	0x0F0
-#define LPAIF_RDMACTL_AUDINTF_SHIFT	4
-
-#define LPAIF_RDMACTL_FIFOWM_MASK	0x00E
-#define LPAIF_RDMACTL_FIFOWM_SHIFT	1
-#define LPAIF_RDMACTL_FIFOWM_1		(0 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-#define LPAIF_RDMACTL_FIFOWM_2		(1 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-#define LPAIF_RDMACTL_FIFOWM_3		(2 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-#define LPAIF_RDMACTL_FIFOWM_4		(3 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-#define LPAIF_RDMACTL_FIFOWM_5		(4 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-#define LPAIF_RDMACTL_FIFOWM_6		(5 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-#define LPAIF_RDMACTL_FIFOWM_7		(6 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-#define LPAIF_RDMACTL_FIFOWM_8		(7 << LPAIF_RDMACTL_FIFOWM_SHIFT)
-
-#define LPAIF_RDMACTL_ENABLE_MASK	0x1
-#define LPAIF_RDMACTL_ENABLE_SHIFT	0
-#define LPAIF_RDMACTL_ENABLE_OFF	(0 << LPAIF_RDMACTL_ENABLE_SHIFT)
-#define LPAIF_RDMACTL_ENABLE_ON		(1 << LPAIF_RDMACTL_ENABLE_SHIFT)
-
 #define LPAIF_WRDMA_REG_ADDR(v, addr, chan) \
 	(v->wrdma_reg_base + (addr) + \
 	 v->wrdma_reg_stride * (chan - v->wrdma_channel_start))
@@ -156,4 +123,56 @@
 #define	LPAIF_WRDMAPER_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x10, (chan))
 #define	LPAIF_WRDMAPERCNT_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x14, (chan))
 
+#define __LPAIF_DMA_REG(v, chan, dir, reg)  \
+	(dir ==  SNDRV_PCM_STREAM_PLAYBACK) ? \
+		LPAIF_RDMA##reg##_REG(v, chan) : \
+		LPAIF_WRDMA##reg##_REG(v, chan)
+
+#define LPAIF_DMACTL_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, CTL)
+#define LPAIF_DMABASE_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, BASE)
+#define	LPAIF_DMABUFF_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, BUFF)
+#define LPAIF_DMACURR_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, CURR)
+#define	LPAIF_DMAPER_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, PER)
+#define	LPAIF_DMAPERCNT_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, PERCNT)
+
+
+#define LPAIF_DMACTL_AUDINTF(id)	(id << LPAIF_DMACTL_AUDINTF_SHIFT)
+
+#define LPAIF_DMACTL_BURSTEN_MASK	0x800
+#define LPAIF_DMACTL_BURSTEN_SHIFT	11
+#define LPAIF_DMACTL_BURSTEN_SINGLE	(0 << LPAIF_DMACTL_BURSTEN_SHIFT)
+#define LPAIF_DMACTL_BURSTEN_INCR4	(1 << LPAIF_DMACTL_BURSTEN_SHIFT)
+
+#define LPAIF_DMACTL_WPSCNT_MASK	0x700
+#define LPAIF_DMACTL_WPSCNT_SHIFT	8
+#define LPAIF_DMACTL_WPSCNT_ONE	(0 << LPAIF_DMACTL_WPSCNT_SHIFT)
+#define LPAIF_DMACTL_WPSCNT_TWO	(1 << LPAIF_DMACTL_WPSCNT_SHIFT)
+#define LPAIF_DMACTL_WPSCNT_THREE	(2 << LPAIF_DMACTL_WPSCNT_SHIFT)
+#define LPAIF_DMACTL_WPSCNT_FOUR	(3 << LPAIF_DMACTL_WPSCNT_SHIFT)
+#define LPAIF_DMACTL_WPSCNT_SIX	(5 << LPAIF_DMACTL_WPSCNT_SHIFT)
+#define LPAIF_DMACTL_WPSCNT_EIGHT	(7 << LPAIF_DMACTL_WPSCNT_SHIFT)
+
+#define LPAIF_DMACTL_AUDINTF_MASK	0x0F0
+#define LPAIF_DMACTL_AUDINTF_SHIFT	4
+
+#define LPAIF_DMACTL_FIFOWM_MASK	0x00E
+#define LPAIF_DMACTL_FIFOWM_SHIFT	1
+#define LPAIF_DMACTL_FIFOWM_1		(0 << LPAIF_DMACTL_FIFOWM_SHIFT)
+#define LPAIF_DMACTL_FIFOWM_2		(1 << LPAIF_DMACTL_FIFOWM_SHIFT)
+#define LPAIF_DMACTL_FIFOWM_3		(2 << LPAIF_DMACTL_FIFOWM_SHIFT)
+#define LPAIF_DMACTL_FIFOWM_4		(3 << LPAIF_DMACTL_FIFOWM_SHIFT)
+#define LPAIF_DMACTL_FIFOWM_5		(4 << LPAIF_DMACTL_FIFOWM_SHIFT)
+#define LPAIF_DMACTL_FIFOWM_6		(5 << LPAIF_DMACTL_FIFOWM_SHIFT)
+#define LPAIF_DMACTL_FIFOWM_7		(6 << LPAIF_DMACTL_FIFOWM_SHIFT)
+#define LPAIF_DMACTL_FIFOWM_8		(7 << LPAIF_DMACTL_FIFOWM_SHIFT)
+
+#define LPAIF_DMACTL_ENABLE_MASK	0x1
+#define LPAIF_DMACTL_ENABLE_SHIFT	0
+#define LPAIF_DMACTL_ENABLE_OFF	(0 << LPAIF_DMACTL_ENABLE_SHIFT)
+#define LPAIF_DMACTL_ENABLE_ON		(1 << LPAIF_DMACTL_ENABLE_SHIFT)
+
+#define LPAIF_DMACTL_DYNCLK_MASK	BIT(12)
+#define LPAIF_DMACTL_DYNCLK_SHIFT	12
+#define LPAIF_DMACTL_DYNCLK_OFF	(0 << LPAIF_DMACTL_DYNCLK_SHIFT)
+#define LPAIF_DMACTL_DYNCLK_ON		(1 << LPAIF_DMACTL_DYNCLK_SHIFT)
 #endif /* __LPASS_LPAIF_REG_H__ */
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index bfc9de6..e611d78 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -90,6 +90,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 	snd_pcm_format_t format = params_format(params);
 	unsigned int channels = params_channels(params);
 	unsigned int regval;
+	int dir = substream->stream;
 	int bitwidth;
 	int ret, rdma_port = pcm_data->i2s_port + v->dmactl_audif_start;
 
@@ -100,25 +101,25 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 		return bitwidth;
 	}
 
-	regval = LPAIF_RDMACTL_BURSTEN_INCR4 |
-			LPAIF_RDMACTL_AUDINTF(rdma_port) |
-			LPAIF_RDMACTL_FIFOWM_8;
+	regval = LPAIF_DMACTL_BURSTEN_INCR4 |
+			LPAIF_DMACTL_AUDINTF(rdma_port) |
+			LPAIF_DMACTL_FIFOWM_8;
 
 	switch (bitwidth) {
 	case 16:
 		switch (channels) {
 		case 1:
 		case 2:
-			regval |= LPAIF_RDMACTL_WPSCNT_ONE;
+			regval |= LPAIF_DMACTL_WPSCNT_ONE;
 			break;
 		case 4:
-			regval |= LPAIF_RDMACTL_WPSCNT_TWO;
+			regval |= LPAIF_DMACTL_WPSCNT_TWO;
 			break;
 		case 6:
-			regval |= LPAIF_RDMACTL_WPSCNT_THREE;
+			regval |= LPAIF_DMACTL_WPSCNT_THREE;
 			break;
 		case 8:
-			regval |= LPAIF_RDMACTL_WPSCNT_FOUR;
+			regval |= LPAIF_DMACTL_WPSCNT_FOUR;
 			break;
 		default:
 			dev_err(soc_runtime->dev, "%s() invalid PCM config given: bw=%d, ch=%u\n",
@@ -130,19 +131,19 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 	case 32:
 		switch (channels) {
 		case 1:
-			regval |= LPAIF_RDMACTL_WPSCNT_ONE;
+			regval |= LPAIF_DMACTL_WPSCNT_ONE;
 			break;
 		case 2:
-			regval |= LPAIF_RDMACTL_WPSCNT_TWO;
+			regval |= LPAIF_DMACTL_WPSCNT_TWO;
 			break;
 		case 4:
-			regval |= LPAIF_RDMACTL_WPSCNT_FOUR;
+			regval |= LPAIF_DMACTL_WPSCNT_FOUR;
 			break;
 		case 6:
-			regval |= LPAIF_RDMACTL_WPSCNT_SIX;
+			regval |= LPAIF_DMACTL_WPSCNT_SIX;
 			break;
 		case 8:
-			regval |= LPAIF_RDMACTL_WPSCNT_EIGHT;
+			regval |= LPAIF_DMACTL_WPSCNT_EIGHT;
 			break;
 		default:
 			dev_err(soc_runtime->dev, "%s() invalid PCM config given: bw=%d, ch=%u\n",
@@ -157,7 +158,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 	}
 
 	ret = regmap_write(drvdata->lpaif_map,
-			LPAIF_RDMACTL_REG(v, pcm_data->rdma_ch), regval);
+			LPAIF_DMACTL_REG(v, pcm_data->rdma_ch, dir), regval);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
 				__func__, ret);
@@ -194,6 +195,7 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
 		snd_soc_platform_get_drvdata(soc_runtime->platform);
 	struct lpass_variant *v = drvdata->variant;
 	int ret, ch = pcm_data->rdma_ch;
+	int dir = substream->stream;
 
 	ret = regmap_write(drvdata->lpaif_map,
 			LPAIF_RDMABASE_REG(v, ch),
@@ -205,7 +207,7 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
 	}
 
 	ret = regmap_write(drvdata->lpaif_map,
-			LPAIF_RDMABUFF_REG(v, ch),
+			LPAIF_DMABUFF_REG(v, ch, dir),
 			(snd_pcm_lib_buffer_bytes(substream) >> 2) - 1);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error writing to rdmabuff reg: %d\n",
@@ -214,7 +216,7 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
 	}
 
 	ret = regmap_write(drvdata->lpaif_map,
-			LPAIF_RDMAPER_REG(v, ch),
+			LPAIF_DMAPER_REG(v, ch, dir),
 			(snd_pcm_lib_period_bytes(substream) >> 2) - 1);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error writing to rdmaper reg: %d\n",
@@ -223,8 +225,8 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
 	}
 
 	ret = regmap_update_bits(drvdata->lpaif_map,
-			LPAIF_RDMACTL_REG(v, ch),
-			LPAIF_RDMACTL_ENABLE_MASK, LPAIF_RDMACTL_ENABLE_ON);
+			LPAIF_DMACTL_REG(v, ch, dir),
+			LPAIF_DMACTL_ENABLE_MASK, LPAIF_DMACTL_ENABLE_ON);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
 				__func__, ret);
@@ -243,6 +245,7 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
 		snd_soc_platform_get_drvdata(soc_runtime->platform);
 	struct lpass_variant *v = drvdata->variant;
 	int ret, ch = pcm_data->rdma_ch;
+	int dir = substream->stream;
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
@@ -269,9 +272,9 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
 		}
 
 		ret = regmap_update_bits(drvdata->lpaif_map,
-				LPAIF_RDMACTL_REG(v, ch),
-				LPAIF_RDMACTL_ENABLE_MASK,
-				LPAIF_RDMACTL_ENABLE_ON);
+				LPAIF_DMACTL_REG(v, ch, dir),
+				LPAIF_DMACTL_ENABLE_MASK,
+				LPAIF_DMACTL_ENABLE_ON);
 		if (ret) {
 			dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
 					__func__, ret);
@@ -282,9 +285,9 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		ret = regmap_update_bits(drvdata->lpaif_map,
-				LPAIF_RDMACTL_REG(v, ch),
-				LPAIF_RDMACTL_ENABLE_MASK,
-				LPAIF_RDMACTL_ENABLE_OFF);
+				LPAIF_DMACTL_REG(v, ch, dir),
+				LPAIF_DMACTL_ENABLE_MASK,
+				LPAIF_DMACTL_ENABLE_OFF);
 		if (ret) {
 			dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
 					__func__, ret);
@@ -315,9 +318,10 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
 	struct lpass_variant *v = drvdata->variant;
 	unsigned int base_addr, curr_addr;
 	int ret, ch = pcm_data->rdma_ch;
+	int dir = substream->stream;
 
 	ret = regmap_read(drvdata->lpaif_map,
-			LPAIF_RDMABASE_REG(v, ch), &base_addr);
+			LPAIF_DMABASE_REG(v, ch, dir), &base_addr);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error reading from rdmabase reg: %d\n",
 				__func__, ret);
@@ -325,7 +329,7 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
 	}
 
 	ret = regmap_read(drvdata->lpaif_map,
-			LPAIF_RDMACURR_REG(v, ch), &curr_addr);
+			LPAIF_DMACURR_REG(v, ch, dir), &curr_addr);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error reading from rdmacurr reg: %d\n",
 				__func__, ret);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 13/15] ASoC: qcom: apq8016: set the correct max register for regmap
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (11 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 12/15] ASoC: qcom: add generic bit masks for RDMA and WRDMA Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: apq8016: set the correct max register for regmap" to the asoc tree Mark Brown
  2016-02-01 17:29 ` [PATCH RFC 14/15] ASoC: qcom: apq8016-sbc: add mic support Srinivas Kandagatla
                   ` (2 subsequent siblings)
  15 siblings, 2 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

Now that we are ready to access wrdma registers, set the max register
and other regmap related configs to use correct values.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-cpu.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 97bc202..82c21b2 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -294,6 +294,17 @@ static bool lpass_cpu_regmap_writeable(struct device *dev, unsigned int reg)
 			return true;
 	}
 
+	for (i = 0; i < v->wrdma_channels; ++i) {
+		if (reg == LPAIF_WRDMACTL_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABASE_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABUFF_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMAPER_REG(v, i + v->wrdma_channel_start))
+			return true;
+	}
+
 	return false;
 }
 
@@ -327,6 +338,19 @@ static bool lpass_cpu_regmap_readable(struct device *dev, unsigned int reg)
 			return true;
 	}
 
+	for (i = 0; i < v->wrdma_channels; ++i) {
+		if (reg == LPAIF_WRDMACTL_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABASE_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABUFF_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMAPER_REG(v, i + v->wrdma_channel_start))
+			return true;
+	}
+
 	return false;
 }
 
@@ -344,6 +368,10 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)
 		if (reg == LPAIF_RDMACURR_REG(v, i))
 			return true;
 
+	for (i = 0; i < v->wrdma_channels; ++i)
+		if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
+			return true;
+
 	return false;
 }
 
@@ -398,8 +426,9 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
 		return PTR_ERR((void const __force *)drvdata->lpaif);
 	}
 
-	lpass_cpu_regmap_config.max_register = LPAIF_RDMAPER_REG(variant,
-						variant->rdma_channels);
+	lpass_cpu_regmap_config.max_register = LPAIF_WRDMAPER_REG(variant,
+						variant->wrdma_channels +
+						variant->wrdma_channel_start);
 
 	drvdata->lpaif_map = devm_regmap_init_mmio(&pdev->dev, drvdata->lpaif,
 			&lpass_cpu_regmap_config);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 14/15] ASoC: qcom: apq8016-sbc: add mic support
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (12 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 13/15] ASoC: qcom: apq8016: set the correct max register for regmap Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:38   ` [alsa-devel] " Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: apq8016-sbc: add mic support" to the asoc tree Mark Brown
  2016-02-01 17:29 ` [PATCH RFC 15/15] ASoC: qcom: add mic support Srinivas Kandagatla
  2016-02-03  0:33 ` [alsa-devel] [PATCH RFC 00/15] ASoC: qcom: Add capture support Kenneth Westfield
  15 siblings, 2 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch add mic support on apq8016-sbc board aka db410c. Tested it
with headset mic.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/apq8016_sbc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c
index 1efdf00..1289543 100644
--- a/sound/soc/qcom/apq8016_sbc.c
+++ b/sound/soc/qcom/apq8016_sbc.c
@@ -30,6 +30,7 @@ struct apq8016_sbc_data {
 	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
 };
 
+#define MIC_CTRL_TER_WS_SLAVE_SEL	BIT(21)
 #define MIC_CTRL_QUA_WS_SLAVE_SEL_10	BIT(17)
 #define MIC_CTRL_TLMM_SCLK_EN		BIT(1)
 #define	SPKR_CTL_PRI_WS_SLAVE_SEL_11	(BIT(17) | BIT(16))
@@ -53,6 +54,12 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 			MIC_CTRL_TLMM_SCLK_EN,
 			pdata->mic_iomux);
 		break;
+	case MI2S_TERTIARY:
+		writel(readl(pdata->mic_iomux) | MIC_CTRL_TER_WS_SLAVE_SEL |
+			MIC_CTRL_TLMM_SCLK_EN,
+			pdata->mic_iomux);
+
+		break;
 
 	default:
 		dev_err(card->dev, "unsupported cpu dai configuration\n");
@@ -126,9 +133,6 @@ static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)
 		}
 
 		link->platform_of_node = link->cpu_of_node;
-		/* For now we only support playback */
-		link->playback_only = true;
-
 		ret = of_property_read_string(np, "link-name", &link->name);
 		if (ret) {
 			dev_err(card->dev, "error getting codec dai_link name\n");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* [PATCH RFC 15/15] ASoC: qcom: add mic support
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (13 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 14/15] ASoC: qcom: apq8016-sbc: add mic support Srinivas Kandagatla
@ 2016-02-01 17:29 ` Srinivas Kandagatla
  2016-02-03  0:38   ` [alsa-devel] " Kenneth Westfield
  2016-02-03  0:33 ` [alsa-devel] [PATCH RFC 00/15] ASoC: qcom: Add capture support Kenneth Westfield
  15 siblings, 1 reply; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-01 17:29 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel
  Cc: Banajit Goswami, Liam Girdwood, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, linux-kernel, linux-arm-msm, Srinivas Kandagatla

This patch adds mic support to the lpass driver, most of the driver is
reused as it is, only the register level access is changed depending on
te direction of the stream.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/lpass-cpu.c      | 113 +++++++++++++++++++--------
 sound/soc/qcom/lpass-platform.c | 166 +++++++++++++++++++++++++++++-----------
 2 files changed, 204 insertions(+), 75 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index 82c21b2..d8a6a53 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -120,31 +120,60 @@ static int lpass_cpu_daiops_hw_params(struct snd_pcm_substream *substream,
 		return -EINVAL;
 	}
 
-	switch (channels) {
-	case 1:
-		regval |= LPAIF_I2SCTL_SPKMODE_SD0;
-		regval |= LPAIF_I2SCTL_SPKMONO_MONO;
-		break;
-	case 2:
-		regval |= LPAIF_I2SCTL_SPKMODE_SD0;
-		regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
-		break;
-	case 4:
-		regval |= LPAIF_I2SCTL_SPKMODE_QUAD01;
-		regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
-		break;
-	case 6:
-		regval |= LPAIF_I2SCTL_SPKMODE_6CH;
-		regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
-		break;
-	case 8:
-		regval |= LPAIF_I2SCTL_SPKMODE_8CH;
-		regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
-		break;
-	default:
-		dev_err(dai->dev, "%s() invalid channels given: %u\n",
-				__func__, channels);
-		return -EINVAL;
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		switch (channels) {
+		case 1:
+			regval |= LPAIF_I2SCTL_SPKMODE_SD0;
+			regval |= LPAIF_I2SCTL_SPKMONO_MONO;
+			break;
+		case 2:
+			regval |= LPAIF_I2SCTL_SPKMODE_SD0;
+			regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
+			break;
+		case 4:
+			regval |= LPAIF_I2SCTL_SPKMODE_QUAD01;
+			regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
+			break;
+		case 6:
+			regval |= LPAIF_I2SCTL_SPKMODE_6CH;
+			regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
+			break;
+		case 8:
+			regval |= LPAIF_I2SCTL_SPKMODE_8CH;
+			regval |= LPAIF_I2SCTL_SPKMONO_STEREO;
+			break;
+		default:
+			dev_err(dai->dev, "%s() invalid channels given: %u\n",
+					__func__, channels);
+			return -EINVAL;
+		}
+	} else {
+		switch (channels) {
+		case 1:
+			regval |= LPAIF_I2SCTL_MICMODE_SD0;
+			regval |= LPAIF_I2SCTL_MICMONO_MONO;
+			break;
+		case 2:
+			regval |= LPAIF_I2SCTL_MICMODE_SD0;
+			regval |= LPAIF_I2SCTL_MICMONO_STEREO;
+			break;
+		case 4:
+			regval |= LPAIF_I2SCTL_MICMODE_QUAD01;
+			regval |= LPAIF_I2SCTL_MICMONO_STEREO;
+			break;
+		case 6:
+			regval |= LPAIF_I2SCTL_MICMODE_6CH;
+			regval |= LPAIF_I2SCTL_MICMONO_STEREO;
+			break;
+		case 8:
+			regval |= LPAIF_I2SCTL_MICMODE_8CH;
+			regval |= LPAIF_I2SCTL_MICMONO_STEREO;
+			break;
+		default:
+			dev_err(dai->dev, "%s() invalid channels given: %u\n",
+					__func__, channels);
+			return -EINVAL;
+		}
 	}
 
 	ret = regmap_write(drvdata->lpaif_map,
@@ -188,10 +217,19 @@ static int lpass_cpu_daiops_prepare(struct snd_pcm_substream *substream,
 {
 	struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
 	int ret;
+	unsigned int val, mask;
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+		val = LPAIF_I2SCTL_SPKEN_ENABLE;
+		mask = LPAIF_I2SCTL_SPKEN_MASK;
+	} else  {
+		val = LPAIF_I2SCTL_MICEN_ENABLE;
+		mask = LPAIF_I2SCTL_MICEN_MASK;
+	}
 
 	ret = regmap_update_bits(drvdata->lpaif_map,
 			LPAIF_I2SCTL_REG(drvdata->variant, dai->driver->id),
-			LPAIF_I2SCTL_SPKEN_MASK, LPAIF_I2SCTL_SPKEN_ENABLE);
+			mask, val);
 	if (ret)
 		dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n",
 				__func__, ret);
@@ -204,16 +242,24 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
 {
 	struct lpass_data *drvdata = snd_soc_dai_get_drvdata(dai);
 	int ret = -EINVAL;
+	unsigned int val, mask;
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_RESUME:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			val = LPAIF_I2SCTL_SPKEN_ENABLE;
+			mask = LPAIF_I2SCTL_SPKEN_MASK;
+		} else  {
+			val = LPAIF_I2SCTL_MICEN_ENABLE;
+			mask = LPAIF_I2SCTL_MICEN_MASK;
+		}
+
 		ret = regmap_update_bits(drvdata->lpaif_map,
 				LPAIF_I2SCTL_REG(drvdata->variant,
 						dai->driver->id),
-				LPAIF_I2SCTL_SPKEN_MASK,
-				LPAIF_I2SCTL_SPKEN_ENABLE);
+				mask, val);
 		if (ret)
 			dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n",
 					__func__, ret);
@@ -221,11 +267,18 @@ static int lpass_cpu_daiops_trigger(struct snd_pcm_substream *substream,
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_SUSPEND:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
+			val = LPAIF_I2SCTL_SPKEN_DISABLE;
+			mask = LPAIF_I2SCTL_SPKEN_MASK;
+		} else  {
+			val = LPAIF_I2SCTL_MICEN_DISABLE;
+			mask = LPAIF_I2SCTL_MICEN_MASK;
+		}
+
 		ret = regmap_update_bits(drvdata->lpaif_map,
 				LPAIF_I2SCTL_REG(drvdata->variant,
 						dai->driver->id),
-				LPAIF_I2SCTL_SPKEN_MASK,
-				LPAIF_I2SCTL_SPKEN_DISABLE);
+				mask, val);
 		if (ret)
 			dev_err(dai->dev, "%s() error writing to i2sctl reg: %d\n",
 					__func__, ret);
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c
index e611d78..574aa33 100644
--- a/sound/soc/qcom/lpass-platform.c
+++ b/sound/soc/qcom/lpass-platform.c
@@ -26,6 +26,7 @@
 
 struct lpass_pcm_data {
 	int rdma_ch;
+	int wrdma_ch;
 	int i2s_port;
 };
 
@@ -92,7 +93,13 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 	unsigned int regval;
 	int dir = substream->stream;
 	int bitwidth;
-	int ret, rdma_port = pcm_data->i2s_port + v->dmactl_audif_start;
+	int ch, ret, dma_port = pcm_data->i2s_port + v->dmactl_audif_start;
+
+	if (dir ==  SNDRV_PCM_STREAM_PLAYBACK)
+		ch = pcm_data->rdma_ch;
+	else
+		ch = pcm_data->wrdma_ch;
+
 
 	bitwidth = snd_pcm_format_width(format);
 	if (bitwidth < 0) {
@@ -102,7 +109,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 	}
 
 	regval = LPAIF_DMACTL_BURSTEN_INCR4 |
-			LPAIF_DMACTL_AUDINTF(rdma_port) |
+			LPAIF_DMACTL_AUDINTF(dma_port) |
 			LPAIF_DMACTL_FIFOWM_8;
 
 	switch (bitwidth) {
@@ -158,7 +165,7 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
 	}
 
 	ret = regmap_write(drvdata->lpaif_map,
-			LPAIF_DMACTL_REG(v, pcm_data->rdma_ch, dir), regval);
+			LPAIF_DMACTL_REG(v, ch, dir), regval);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
 				__func__, ret);
@@ -175,10 +182,15 @@ static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream)
 	struct lpass_data *drvdata =
 		snd_soc_platform_get_drvdata(soc_runtime->platform);
 	struct lpass_variant *v = drvdata->variant;
+	unsigned int reg;
 	int ret;
 
-	ret = regmap_write(drvdata->lpaif_map,
-			LPAIF_RDMACTL_REG(v, pcm_data->rdma_ch), 0);
+	if (substream->stream ==  SNDRV_PCM_STREAM_PLAYBACK)
+		reg = LPAIF_RDMACTL_REG(v, pcm_data->rdma_ch);
+	else
+		reg = LPAIF_WRDMACTL_REG(v, pcm_data->wrdma_ch);
+
+	ret = regmap_write(drvdata->lpaif_map, reg, 0);
 	if (ret)
 		dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
 				__func__, ret);
@@ -194,11 +206,15 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
 	struct lpass_data *drvdata =
 		snd_soc_platform_get_drvdata(soc_runtime->platform);
 	struct lpass_variant *v = drvdata->variant;
-	int ret, ch = pcm_data->rdma_ch;
-	int dir = substream->stream;
+	int ret, ch, dir = substream->stream;
+
+	if (dir ==  SNDRV_PCM_STREAM_PLAYBACK)
+		ch = pcm_data->rdma_ch;
+	else
+		ch = pcm_data->wrdma_ch;
 
 	ret = regmap_write(drvdata->lpaif_map,
-			LPAIF_RDMABASE_REG(v, ch),
+			LPAIF_DMABASE_REG(v, ch, dir),
 			runtime->dma_addr);
 	if (ret) {
 		dev_err(soc_runtime->dev, "%s() error writing to rdmabase reg: %d\n",
@@ -244,8 +260,12 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
 	struct lpass_data *drvdata =
 		snd_soc_platform_get_drvdata(soc_runtime->platform);
 	struct lpass_variant *v = drvdata->variant;
-	int ret, ch = pcm_data->rdma_ch;
-	int dir = substream->stream;
+	int ret, ch, dir = substream->stream;
+
+	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+		ch = pcm_data->rdma_ch;
+	else
+		ch = pcm_data->wrdma_ch;
 
 	switch (cmd) {
 	case SNDRV_PCM_TRIGGER_START:
@@ -317,8 +337,12 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
 			snd_soc_platform_get_drvdata(soc_runtime->platform);
 	struct lpass_variant *v = drvdata->variant;
 	unsigned int base_addr, curr_addr;
-	int ret, ch = pcm_data->rdma_ch;
-	int dir = substream->stream;
+	int ret, ch, dir = substream->stream;
+
+	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
+		ch = pcm_data->rdma_ch;
+	else
+		ch = pcm_data->wrdma_ch;
 
 	ret = regmap_read(drvdata->lpaif_map,
 			LPAIF_DMABASE_REG(v, ch, dir), &base_addr);
@@ -446,8 +470,7 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq, void *data)
 static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 {
 	struct snd_pcm *pcm = soc_runtime->pcm;
-	struct snd_pcm_substream *substream =
-		pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
+	struct snd_pcm_substream *psubstream, *csubstream;
 	struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
 	struct lpass_data *drvdata =
 		snd_soc_platform_get_drvdata(soc_runtime->platform);
@@ -460,53 +483,106 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
 	if (!data)
 		return -ENOMEM;
 
-	if (v->alloc_dma_channel)
-		data->rdma_ch = v->alloc_dma_channel(drvdata);
+	data->i2s_port = cpu_dai->driver->id;
+	snd_soc_pcm_set_drvdata(soc_runtime, data);
 
-	if (IS_ERR_VALUE(data->rdma_ch))
-		return data->rdma_ch;
+	psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
+	if (psubstream) {
+		if (v->alloc_dma_channel)
+			data->rdma_ch = v->alloc_dma_channel(drvdata,
+						SNDRV_PCM_STREAM_PLAYBACK);
 
-	drvdata->substream[data->rdma_ch] = substream;
-	data->i2s_port = cpu_dai->driver->id;
+		if (IS_ERR_VALUE(data->rdma_ch))
+			return data->rdma_ch;
 
-	snd_soc_pcm_set_drvdata(soc_runtime, data);
+		drvdata->substream[data->rdma_ch] = psubstream;
 
-	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
-				size, &substream->dma_buffer);
-	if (ret)
-		return ret;
+		ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
+					size, &psubstream->dma_buffer);
+		if (ret)
+			goto playback_alloc_err;
 
-	ret = regmap_write(drvdata->lpaif_map,
+		ret = regmap_write(drvdata->lpaif_map,
 			LPAIF_RDMACTL_REG(v, data->rdma_ch), 0);
-	if (ret) {
-		dev_err(soc_runtime->dev, "%s() error writing to rdmactl reg: %d\n",
+		if (ret) {
+			dev_err(soc_runtime->dev,
+				"%s() error writing to rdmactl reg: %d\n",
 				__func__, ret);
-		goto err_buf;
+			goto capture_alloc_err;
+		}
+	}
+
+	csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
+	if (csubstream) {
+		if (v->alloc_dma_channel)
+			data->wrdma_ch = v->alloc_dma_channel(drvdata,
+						SNDRV_PCM_STREAM_CAPTURE);
+
+		if (IS_ERR_VALUE(data->wrdma_ch))
+			goto capture_alloc_err;
+
+		drvdata->substream[data->wrdma_ch] = csubstream;
+
+		ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
+					size, &csubstream->dma_buffer);
+		if (ret)
+			goto capture_alloc_err;
+
+		ret = regmap_write(drvdata->lpaif_map,
+			LPAIF_WRDMACTL_REG(v, data->wrdma_ch), 0);
+		if (ret) {
+			dev_err(soc_runtime->dev,
+				"%s() error writing to wrdmactl reg: %d\n",
+				__func__, ret);
+			goto capture_reg_err;
+		}
 	}
 
 	return 0;
 
-err_buf:
-	snd_dma_free_pages(&substream->dma_buffer);
+capture_reg_err:
+	if (csubstream)
+		snd_dma_free_pages(&csubstream->dma_buffer);
+
+capture_alloc_err:
+	if (psubstream)
+		snd_dma_free_pages(&psubstream->dma_buffer);
+
+ playback_alloc_err:
+	dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
+
 	return ret;
 }
 
 static void lpass_platform_pcm_free(struct snd_pcm *pcm)
 {
-	struct snd_pcm_substream *substream =
-		pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
-	struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
-	struct lpass_data *drvdata =
-		snd_soc_platform_get_drvdata(soc_runtime->platform);
-	struct lpass_pcm_data *data = snd_soc_pcm_get_drvdata(soc_runtime);
-	struct lpass_variant *v = drvdata->variant;
-
-	drvdata->substream[data->rdma_ch] = NULL;
-
-	if (v->free_dma_channel)
-		v->free_dma_channel(drvdata, data->rdma_ch);
-
-	snd_dma_free_pages(&substream->dma_buffer);
+	struct snd_soc_pcm_runtime *rt;
+	struct lpass_data *drvdata;
+	struct lpass_pcm_data *data;
+	struct lpass_variant *v;
+	struct snd_pcm_substream *substream;
+	int ch, i;
+
+	for (i = 0; i < ARRAY_SIZE(pcm->streams); i++) {
+		substream = pcm->streams[i].substream;
+		if (substream) {
+			rt = substream->private_data;
+			data = snd_soc_pcm_get_drvdata(rt);
+			drvdata = snd_soc_platform_get_drvdata(rt->platform);
+
+			ch = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+				? data->rdma_ch
+				: data->wrdma_ch;
+			v = drvdata->variant;
+			drvdata->substream[ch] = NULL;
+			if (v->free_dma_channel)
+				v->free_dma_channel(drvdata, ch);
+
+			snd_dma_free_pages(&substream->dma_buffer);
+			substream->dma_buffer.area = NULL;
+			substream->dma_buffer.addr = 0;
+		}
+	}
 }
 
 static struct snd_soc_platform_driver lpass_platform_driver = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 00/15] ASoC: qcom: Add capture support.
  2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
                   ` (14 preceding siblings ...)
  2016-02-01 17:29 ` [PATCH RFC 15/15] ASoC: qcom: add mic support Srinivas Kandagatla
@ 2016-02-03  0:33 ` Kenneth Westfield
  2016-02-03  8:48   ` Srinivas Kandagatla
  15 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:33 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:27:02AM -0800, Srinivas Kandagatla wrote:
> LPASS IP on QCOM SOC supports both Playback and capture
> via I2S, but this feature is missing in existing code. 
> This patchset aims at adding capture support to lpass IP.
> First few patches in this series does cleanup the driver
> to make easy to add capture support.
> 
> These patches are tested on DB410C with Headset Mic.

Thanks for posting this.  I went through the changes, and it mostly
looks good minus some small, easy-to-fix nits.

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis
  2016-02-01 17:27 ` [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis Srinivas Kandagatla
@ 2016-02-03  0:35   ` Kenneth Westfield
  2016-02-03  8:48       ` [alsa-devel] " Srinivas Kandagatla
  0 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:35 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:27:59AM -0800, Srinivas Kandagatla wrote:
> diff --git a/sound/soc/qcom/lpass-platform.c
> b/sound/soc/qcom/lpass-platform.c
> index 4aeb8e1..a6dce1b 100644
> --- a/sound/soc/qcom/lpass-platform.c
> +++ b/sound/soc/qcom/lpass-platform.c
> @@ -439,39 +439,6 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq,
> void *data)
>  	return IRQ_HANDLED;
>  }
>  
> -static int lpass_platform_alloc_buffer(struct snd_pcm_substream
> *substream,
> -		struct snd_soc_pcm_runtime *rt)
> -{
> -	struct snd_dma_buffer *buf = &substream->dma_buffer;
> -	size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
> -
> -	buf->dev.type = SNDRV_DMA_TYPE_DEV;
> -	buf->dev.dev = rt->platform->dev;
> -	buf->private_data = NULL;
> -	buf->area = dma_alloc_coherent(rt->platform->dev, size,
> &buf->addr,
> -			GFP_KERNEL);
> -	if (!buf->area) {
> -		dev_err(rt->platform->dev, "%s: Could not allocate DMA
> buffer\n",
> -				__func__);
> -		return -ENOMEM;
> -	}

...

> @@ -499,7 +467,8 @@ static int lpass_platform_pcm_new(struct
> snd_soc_pcm_runtime *soc_runtime)
>  
>  	snd_soc_pcm_set_drvdata(soc_runtime, data);
>  
> -	ret = lpass_platform_alloc_buffer(substream, soc_runtime);
> +	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
> +				size, &substream->dma_buffer);
>  	if (ret)
>  		return ret;
>  

Is there a particular reason for using the soundcard device (pcm-card->dev)
rather than the platform device (rt->platform->dev) for memory
allocation?  Especially considering you posted a fix for this several
weeks ago (ASoC: qcom: use correct device pointer in dma allocation).

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 02/15] ASoC: qcom: add wrdma register details to lpass_variant
  2016-02-01 17:28 ` [PATCH RFC 02/15] ASoC: qcom: add wrdma register details to lpass_variant Srinivas Kandagatla
@ 2016-02-03  0:35   ` Kenneth Westfield
  0 siblings, 0 replies; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:35 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:28:20AM -0800, Srinivas Kandagatla wrote:
> This patch adds wrdma related register offsets and shifts into lpass
> variant structure.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/lpass.h | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start
  2016-02-01 17:28 ` [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start Srinivas Kandagatla
@ 2016-02-03  0:35   ` Kenneth Westfield
  2016-02-03  8:48       ` [alsa-devel] " Srinivas Kandagatla
  0 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:35 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:28:28AM -0800, Srinivas Kandagatla wrote:
> diff --git a/sound/soc/qcom/lpass-platform.c
> b/sound/soc/qcom/lpass-platform.c
> index a6dce1b..bfc9de6 100644
> --- a/sound/soc/qcom/lpass-platform.c
> +++ b/sound/soc/qcom/lpass-platform.c
> @@ -91,7 +91,7 @@ static int lpass_platform_pcmops_hw_params(struct
> snd_pcm_substream *substream,
>  	unsigned int channels = params_channels(params);
>  	unsigned int regval;
>  	int bitwidth;
> -	int ret, rdma_port = pcm_data->i2s_port + v->rdmactl_audif_start;
> +	int ret, rdma_port = pcm_data->i2s_port + v->dmactl_audif_start;

I was wondering why rdma_port had not been changed as well, until I saw
that in a later patch.  Would it make sense to combine all changes
related to removing read-only indications from identifiers to one patch?

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 04/15] ASoC: qcom: pass direction to dma allocation
  2016-02-01 17:28 ` [PATCH RFC 04/15] ASoC: qcom: pass direction to dma allocation Srinivas Kandagatla
@ 2016-02-03  0:36   ` Kenneth Westfield
  0 siblings, 0 replies; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:36 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:28:34AM -0800, Srinivas Kandagatla wrote:
> This patch updates the internal dma allocation callbacks to take the
> stream direction so that it can allocate channels suitable for that
> stream direction. Before the capture support this was not necessary.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/lpass-apq8016.c | 3 ++-
>  sound/soc/qcom/lpass-ipq806x.c | 2 +-
>  sound/soc/qcom/lpass.h         | 2 +-
>  3 files changed, 4 insertions(+), 3 deletions(-)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 05/15] ASoC: qcom: ipq806x: add error in dma allocation.
  2016-02-01 17:28 ` [PATCH RFC 05/15] ASoC: qcom: ipq806x: add error in " Srinivas Kandagatla
@ 2016-02-03  0:36   ` Kenneth Westfield
  2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:36 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:28:43AM -0800, Srinivas Kandagatla wrote:
> diff --git a/sound/soc/qcom/lpass-ipq806x.c
> b/sound/soc/qcom/lpass-ipq806x.c
> index 119048c..8bdcdcb 100644
> --- a/sound/soc/qcom/lpass-ipq806x.c
> +++ b/sound/soc/qcom/lpass-ipq806x.c
> @@ -65,7 +65,10 @@ static struct snd_soc_dai_driver
> ipq806x_lpass_cpu_dai_driver = {
>  
>  static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata,
> int dir)
>  {
> -	return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
> +	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
> +		return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
> +	else	/* Capture not supported */
> +		return -EINVAL;
>  }

The comment could be read as "Capture not supported by hardware", which
isn't true.  Maybe "Capture currently not implemented"?

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 06/15] ASoC: qcom: ipq806x: add wrdma related register offsets
  2016-02-01 17:28 ` [PATCH RFC 06/15] ASoC: qcom: ipq806x: add wrdma related register offsets Srinivas Kandagatla
@ 2016-02-03  0:36   ` Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: ipq806x: add wrdma related register offsets" to the asoc tree Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:36 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:28:49AM -0800, Srinivas Kandagatla wrote:
> This patch adds wrdma related register offsets to the lpass variant data
> of ipq806x.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/lpass-ipq806x.c | 4 ++++
>  1 file changed, 4 insertions(+)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 07/15] ASoC: qcom: add mic related i2s control register defines
  2016-02-01 17:28 ` [PATCH RFC 07/15] ASoC: qcom: add mic related i2s control register defines Srinivas Kandagatla
@ 2016-02-03  0:36   ` Kenneth Westfield
  2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:36 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:28:55AM -0800, Srinivas Kandagatla wrote:
> diff --git a/sound/soc/qcom/lpass-lpaif-reg.h
> b/sound/soc/qcom/lpass-lpaif-reg.h
> index 95e22f1..8a64d1a 100644
> --- a/sound/soc/qcom/lpass-lpaif-reg.h
> +++ b/sound/soc/qcom/lpass-lpaif-reg.h
> @@ -47,6 +47,28 @@

...

> +#define LPAIF_I2SCTL_MICMODE_MASK	GENMASK(7, 4)
> +#define LPAIF_I2SCTL_MICMODE_SHIFT	4
> +#define LPAIF_I2SCTL_MICMODE_NONE	(0 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_SD0	(1 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_SD1	(2 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_SD2	(3 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_SD3	(4 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_QUAD01	(5 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_QUAD02	(6 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_6CH	(7 << LPAIF_I2SCTL_MICMODE_SHIFT)
> +#define LPAIF_I2SCTL_MICMODE_8CH	(8 << LPAIF_I2SCTL_MICMODE_SHIFT)

LPAIF_I2SCTL_MICMODE_QUAD02 should be LPAIF_I2SCTL_MICMODE_QUAD23, as
the suffix numbers refer to SD[0-3].

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 08/15] ASoC: qcom: add wrdma dma channel start
  2016-02-01 17:29 ` [PATCH RFC 08/15] ASoC: qcom: add wrdma dma channel start Srinivas Kandagatla
@ 2016-02-03  0:36   ` Kenneth Westfield
  2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:36 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:01AM -0800, Srinivas Kandagatla wrote:
> diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
> index 30449f3..8475b60 100644
> --- a/sound/soc/qcom/lpass.h
> +++ b/sound/soc/qcom/lpass.h
> @@ -80,6 +80,7 @@ struct lpass_variant {
>  	 * at different offset to ipq806x
>  	 **/
>  	u32	dmactl_audif_start;
> +	u32	wrdma_channel_start;

This patch should come before patch 6 (ASoC: qcom: ipq806x: add wrdma
related register offsets) as that patch references this field.

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map
  2016-02-01 17:29 ` [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map Srinivas Kandagatla
@ 2016-02-03  0:37   ` Kenneth Westfield
  2016-02-03  8:48     ` Srinivas Kandagatla
  2016-02-20 17:14   ` Applied "ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map" to the asoc tree Mark Brown
  1 sibling, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:37 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:07AM -0800, Srinivas Kandagatla wrote:
> rdma_ch_bit_map can be reused for wrdma channel allocations as wrdma
> channel numbering start after rdma channel numbers.
> With capture support referring rdma_ch_bit_map for wrdma channel
> allocation
> is confusing, so renaming rdma_ch_bit_map to dma_ch_bit_map makes sense.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/lpass-apq8016.c | 6 +++---
>  sound/soc/qcom/lpass.h         | 2 +-
>  2 files changed, 4 insertions(+), 4 deletions(-)

As stated in my comments on patch 3 (ASoC: qcom: rename
rdmactl_audif_start to dmactrl_audif_start), I believe this change could
be combined with that patch.  Or at the very least, have this patch be
sequenced directly after patch 3.

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support
  2016-02-01 17:29 ` [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support Srinivas Kandagatla
@ 2016-02-03  0:37   ` Kenneth Westfield
  2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:37 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:20AM -0800, Srinivas Kandagatla wrote:
> diff --git a/sound/soc/qcom/lpass-apq8016.c
> b/sound/soc/qcom/lpass-apq8016.c
> index df44f09..3eef0c3 100644
> --- a/sound/soc/qcom/lpass-apq8016.c
> +++ b/sound/soc/qcom/lpass-apq8016.c

...

> @@ -213,7 +225,11 @@ static struct lpass_variant apq8016_data = {
>  	.rdma_reg_base		= 0x8400,
>  	.rdma_reg_stride	= 0x1000,
>  	.rdma_channels		= 2,
> -	.rdmactl_audif_start	= 1,
> +	.dmactl_audif_start	= 1,

Changing rdma.. to dma.. should be done in patch 3 (ASoC: qcom: rename
rdmactl_audif_start to dmactrl_audif_start).  The build should
fail otherwise if bisecting between this patch and patch 3.

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 11/15] ASoC: qcom: add wrdma register definations
  2016-02-01 17:29 ` [PATCH RFC 11/15] ASoC: qcom: add wrdma register definations Srinivas Kandagatla
@ 2016-02-03  0:37   ` Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: add wrdma register definitions" to the asoc tree Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:37 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:26AM -0800, Srinivas Kandagatla wrote:
> This patch adds wrdma registers into the lpaif-reg.h.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/lpass-lpaif-reg.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 12/15] ASoC: qcom: add generic bit masks for RDMA and WRDMA
  2016-02-01 17:29 ` [PATCH RFC 12/15] ASoC: qcom: add generic bit masks for RDMA and WRDMA Srinivas Kandagatla
@ 2016-02-03  0:37   ` Kenneth Westfield
  2016-02-03  8:49     ` Srinivas Kandagatla
  0 siblings, 1 reply; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:37 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:32AM -0800, Srinivas Kandagatla wrote:
> diff --git a/sound/soc/qcom/lpass-lpaif-reg.h
> b/sound/soc/qcom/lpass-lpaif-reg.h
> index 2008f9f..2114b3e 100644
> --- a/sound/soc/qcom/lpass-lpaif-reg.h
> +++ b/sound/soc/qcom/lpass-lpaif-reg.h

...

> +#define __LPAIF_DMA_REG(v, chan, dir, reg)  \
> +	(dir ==  SNDRV_PCM_STREAM_PLAYBACK) ? \
> +		LPAIF_RDMA##reg##_REG(v, chan) : \
> +		LPAIF_WRDMA##reg##_REG(v, chan)
> +
> +#define LPAIF_DMACTL_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, CTL)
> +#define LPAIF_DMABASE_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir,
> BASE)
> +#define	LPAIF_DMABUFF_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan,
> dir, BUFF)
> +#define LPAIF_DMACURR_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir,
> CURR)
> +#define	LPAIF_DMAPER_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan,
> dir, PER)
> +#define	LPAIF_DMAPERCNT_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan,
> dir, PERCNT)
> +
> +
> +#define LPAIF_DMACTL_AUDINTF(id)	(id << LPAIF_DMACTL_AUDINTF_SHIFT)

IMO, it would make more sense to place this definition here ...

> +
> +#define LPAIF_DMACTL_BURSTEN_MASK	0x800
> +#define LPAIF_DMACTL_BURSTEN_SHIFT	11
> +#define LPAIF_DMACTL_BURSTEN_SINGLE	(0 << LPAIF_DMACTL_BURSTEN_SHIFT)
> +#define LPAIF_DMACTL_BURSTEN_INCR4	(1 << LPAIF_DMACTL_BURSTEN_SHIFT)
> +
> +#define LPAIF_DMACTL_WPSCNT_MASK	0x700
> +#define LPAIF_DMACTL_WPSCNT_SHIFT	8
> +#define LPAIF_DMACTL_WPSCNT_ONE	(0 << LPAIF_DMACTL_WPSCNT_SHIFT)
> +#define LPAIF_DMACTL_WPSCNT_TWO	(1 << LPAIF_DMACTL_WPSCNT_SHIFT)
> +#define LPAIF_DMACTL_WPSCNT_THREE	(2 << LPAIF_DMACTL_WPSCNT_SHIFT)
> +#define LPAIF_DMACTL_WPSCNT_FOUR	(3 << LPAIF_DMACTL_WPSCNT_SHIFT)
> +#define LPAIF_DMACTL_WPSCNT_SIX	(5 << LPAIF_DMACTL_WPSCNT_SHIFT)
> +#define LPAIF_DMACTL_WPSCNT_EIGHT	(7 << LPAIF_DMACTL_WPSCNT_SHIFT)
> +
> +#define LPAIF_DMACTL_AUDINTF_MASK	0x0F0
> +#define LPAIF_DMACTL_AUDINTF_SHIFT	4
...
   #define LPAIF_DMACTL_AUDINTF(id)     (id << LPAIF_DMACTL_AUDINTF_SHIFT)


-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 13/15] ASoC: qcom: apq8016: set the correct max register for regmap
  2016-02-01 17:29 ` [PATCH RFC 13/15] ASoC: qcom: apq8016: set the correct max register for regmap Srinivas Kandagatla
@ 2016-02-03  0:37   ` Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: apq8016: set the correct max register for regmap" to the asoc tree Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:37 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:38AM -0800, Srinivas Kandagatla wrote:
> Now that we are ready to access wrdma registers, set the max register
> and other regmap related configs to use correct values.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/lpass-cpu.c | 33 +++++++++++++++++++++++++++++++--
>  1 file changed, 31 insertions(+), 2 deletions(-)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 14/15] ASoC: qcom: apq8016-sbc: add mic support
  2016-02-01 17:29 ` [PATCH RFC 14/15] ASoC: qcom: apq8016-sbc: add mic support Srinivas Kandagatla
@ 2016-02-03  0:38   ` Kenneth Westfield
  2016-02-20 17:14   ` Applied "ASoC: qcom: apq8016-sbc: add mic support" to the asoc tree Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:38 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:46AM -0800, Srinivas Kandagatla wrote:
> This patch add mic support on apq8016-sbc board aka db410c. Tested it
> with headset mic.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/apq8016_sbc.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 15/15] ASoC: qcom: add mic support
  2016-02-01 17:29 ` [PATCH RFC 15/15] ASoC: qcom: add mic support Srinivas Kandagatla
@ 2016-02-03  0:38   ` Kenneth Westfield
  0 siblings, 0 replies; 48+ messages in thread
From: Kenneth Westfield @ 2016-02-03  0:38 UTC (permalink / raw)
  To: Srinivas Kandagatla
  Cc: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

On Mon, Feb 01, 2016 at 09:29:52AM -0800, Srinivas Kandagatla wrote:
> This patch adds mic support to the lpass driver, most of the driver is
> reused as it is, only the register level access is changed depending on
> te direction of the stream.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  sound/soc/qcom/lpass-cpu.c      | 113 +++++++++++++++++++--------
>  sound/soc/qcom/lpass-platform.c | 166
> +++++++++++++++++++++++++++++-----------
>  2 files changed, 204 insertions(+), 75 deletions(-)

Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>

-- 
Kenneth Westfield
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 00/15] ASoC: qcom: Add capture support.
  2016-02-03  0:33 ` [alsa-devel] [PATCH RFC 00/15] ASoC: qcom: Add capture support Kenneth Westfield
@ 2016-02-03  8:48   ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown

Thanks Kenneth for review comments.

On 03/02/16 00:33, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:27:02AM -0800, Srinivas Kandagatla wrote:
>> LPASS IP on QCOM SOC supports both Playback and capture
>> via I2S, but this feature is missing in existing code.
>> This patchset aims at adding capture support to lpass IP.
>> First few patches in this series does cleanup the driver
>> to make easy to add capture support.
>>
>> These patches are tested on DB410C with Headset Mic.
>
> Thanks for posting this.  I went through the changes, and it mostly
> looks good minus some small, easy-to-fix nits.
I agree with all the comments, and will send a new version with fixes.

--srini
>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis
  2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:48       ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:35, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:27:59AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-platform.c
>> b/sound/soc/qcom/lpass-platform.c
>> index 4aeb8e1..a6dce1b 100644
>> --- a/sound/soc/qcom/lpass-platform.c
>> +++ b/sound/soc/qcom/lpass-platform.c
>> @@ -439,39 +439,6 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq,
>> void *data)
>>   	return IRQ_HANDLED;
>>   }
>>
>> -static int lpass_platform_alloc_buffer(struct snd_pcm_substream
>> *substream,
>> -		struct snd_soc_pcm_runtime *rt)
>> -{
>> -	struct snd_dma_buffer *buf = &substream->dma_buffer;
>> -	size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
>> -
>> -	buf->dev.type = SNDRV_DMA_TYPE_DEV;
>> -	buf->dev.dev = rt->platform->dev;
>> -	buf->private_data = NULL;
>> -	buf->area = dma_alloc_coherent(rt->platform->dev, size,
>> &buf->addr,
>> -			GFP_KERNEL);
>> -	if (!buf->area) {
>> -		dev_err(rt->platform->dev, "%s: Could not allocate DMA
>> buffer\n",
>> -				__func__);
>> -		return -ENOMEM;
>> -	}
>
> ...
>
>> @@ -499,7 +467,8 @@ static int lpass_platform_pcm_new(struct
>> snd_soc_pcm_runtime *soc_runtime)
>>
>>   	snd_soc_pcm_set_drvdata(soc_runtime, data);
>>
>> -	ret = lpass_platform_alloc_buffer(substream, soc_runtime);
>> +	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
>> +				size, &substream->dma_buffer);
>>   	if (ret)
>>   		return ret;
>>
>
> Is there a particular reason for using the soundcard device (pcm-card->dev)
> rather than the platform device (rt->platform->dev) for memory
> allocation?  Especially considering you posted a fix for this several
> weeks ago (ASoC: qcom: use correct device pointer in dma allocation).

Thanks for spotting this, I will fix it and resend it with platform->dev.

>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis
@ 2016-02-03  8:48       ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:35, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:27:59AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-platform.c
>> b/sound/soc/qcom/lpass-platform.c
>> index 4aeb8e1..a6dce1b 100644
>> --- a/sound/soc/qcom/lpass-platform.c
>> +++ b/sound/soc/qcom/lpass-platform.c
>> @@ -439,39 +439,6 @@ static irqreturn_t lpass_platform_lpaif_irq(int irq,
>> void *data)
>>   	return IRQ_HANDLED;
>>   }
>>
>> -static int lpass_platform_alloc_buffer(struct snd_pcm_substream
>> *substream,
>> -		struct snd_soc_pcm_runtime *rt)
>> -{
>> -	struct snd_dma_buffer *buf = &substream->dma_buffer;
>> -	size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
>> -
>> -	buf->dev.type = SNDRV_DMA_TYPE_DEV;
>> -	buf->dev.dev = rt->platform->dev;
>> -	buf->private_data = NULL;
>> -	buf->area = dma_alloc_coherent(rt->platform->dev, size,
>> &buf->addr,
>> -			GFP_KERNEL);
>> -	if (!buf->area) {
>> -		dev_err(rt->platform->dev, "%s: Could not allocate DMA
>> buffer\n",
>> -				__func__);
>> -		return -ENOMEM;
>> -	}
>
> ...
>
>> @@ -499,7 +467,8 @@ static int lpass_platform_pcm_new(struct
>> snd_soc_pcm_runtime *soc_runtime)
>>
>>   	snd_soc_pcm_set_drvdata(soc_runtime, data);
>>
>> -	ret = lpass_platform_alloc_buffer(substream, soc_runtime);
>> +	ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
>> +				size, &substream->dma_buffer);
>>   	if (ret)
>>   		return ret;
>>
>
> Is there a particular reason for using the soundcard device (pcm-card->dev)
> rather than the platform device (rt->platform->dev) for memory
> allocation?  Especially considering you posted a fix for this several
> weeks ago (ASoC: qcom: use correct device pointer in dma allocation).

Thanks for spotting this, I will fix it and resend it with platform->dev.

>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start
  2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:48       ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:35, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:28:28AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-platform.c
>> b/sound/soc/qcom/lpass-platform.c
>> index a6dce1b..bfc9de6 100644
>> --- a/sound/soc/qcom/lpass-platform.c
>> +++ b/sound/soc/qcom/lpass-platform.c
>> @@ -91,7 +91,7 @@ static int lpass_platform_pcmops_hw_params(struct
>> snd_pcm_substream *substream,
>>   	unsigned int channels = params_channels(params);
>>   	unsigned int regval;
>>   	int bitwidth;
>> -	int ret, rdma_port = pcm_data->i2s_port + v->rdmactl_audif_start;
>> +	int ret, rdma_port = pcm_data->i2s_port + v->dmactl_audif_start;
>
> I was wondering why rdma_port had not been changed as well, until I saw
> that in a later patch.  Would it make sense to combine all changes
> related to removing read-only indications from identifiers to one patch?

Yep, I will see if I can merge this and also I need to fix the ordering, 
I got same report from 0day testing too.

>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start
@ 2016-02-03  8:48       ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:35, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:28:28AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-platform.c
>> b/sound/soc/qcom/lpass-platform.c
>> index a6dce1b..bfc9de6 100644
>> --- a/sound/soc/qcom/lpass-platform.c
>> +++ b/sound/soc/qcom/lpass-platform.c
>> @@ -91,7 +91,7 @@ static int lpass_platform_pcmops_hw_params(struct
>> snd_pcm_substream *substream,
>>   	unsigned int channels = params_channels(params);
>>   	unsigned int regval;
>>   	int bitwidth;
>> -	int ret, rdma_port = pcm_data->i2s_port + v->rdmactl_audif_start;
>> +	int ret, rdma_port = pcm_data->i2s_port + v->dmactl_audif_start;
>
> I was wondering why rdma_port had not been changed as well, until I saw
> that in a later patch.  Would it make sense to combine all changes
> related to removing read-only indications from identifiers to one patch?

Yep, I will see if I can merge this and also I need to fix the ordering, 
I got same report from 0day testing too.

>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 05/15] ASoC: qcom: ipq806x: add error in dma allocation.
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:36, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:28:43AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-ipq806x.c
>> b/sound/soc/qcom/lpass-ipq806x.c
>> index 119048c..8bdcdcb 100644
>> --- a/sound/soc/qcom/lpass-ipq806x.c
>> +++ b/sound/soc/qcom/lpass-ipq806x.c
>> @@ -65,7 +65,10 @@ static struct snd_soc_dai_driver
>> ipq806x_lpass_cpu_dai_driver = {
>>
>>   static int ipq806x_lpass_alloc_dma_channel(struct lpass_data *drvdata,
>> int dir)
>>   {
>> -	return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
>> +	if (dir == SNDRV_PCM_STREAM_PLAYBACK)
>> +		return IPQ806X_LPAIF_RDMA_CHAN_MI2S;
>> +	else	/* Capture not supported */
>> +		return -EINVAL;
>>   }
>
> The comment could be read as "Capture not supported by hardware", which
> isn't true.  Maybe "Capture currently not implemented"?
Agreed, I will change this in next version.
>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 07/15] ASoC: qcom: add mic related i2s control register defines
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:36, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:28:55AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-lpaif-reg.h
>> b/sound/soc/qcom/lpass-lpaif-reg.h
>> index 95e22f1..8a64d1a 100644
>> --- a/sound/soc/qcom/lpass-lpaif-reg.h
>> +++ b/sound/soc/qcom/lpass-lpaif-reg.h
>> @@ -47,6 +47,28 @@
>
> ...
>
>> +#define LPAIF_I2SCTL_MICMODE_MASK	GENMASK(7, 4)
>> +#define LPAIF_I2SCTL_MICMODE_SHIFT	4
>> +#define LPAIF_I2SCTL_MICMODE_NONE	(0 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_SD0	(1 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_SD1	(2 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_SD2	(3 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_SD3	(4 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_QUAD01	(5 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_QUAD02	(6 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_6CH	(7 << LPAIF_I2SCTL_MICMODE_SHIFT)
>> +#define LPAIF_I2SCTL_MICMODE_8CH	(8 << LPAIF_I2SCTL_MICMODE_SHIFT)
>
> LPAIF_I2SCTL_MICMODE_QUAD02 should be LPAIF_I2SCTL_MICMODE_QUAD23, as
> the suffix numbers refer to SD[0-3].
Ok, will fix this in next version.
>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 08/15] ASoC: qcom: add wrdma dma channel start
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:36, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:29:01AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
>> index 30449f3..8475b60 100644
>> --- a/sound/soc/qcom/lpass.h
>> +++ b/sound/soc/qcom/lpass.h
>> @@ -80,6 +80,7 @@ struct lpass_variant {
>>   	 * at different offset to ipq806x
>>   	 **/
>>   	u32	dmactl_audif_start;
>> +	u32	wrdma_channel_start;
>
> This patch should come before patch 6 (ASoC: qcom: ipq806x: add wrdma
> related register offsets) as that patch references this field.
yes, I need to fix the correct ordering of the patches.

>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:37, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:29:07AM -0800, Srinivas Kandagatla wrote:
>> rdma_ch_bit_map can be reused for wrdma channel allocations as wrdma
>> channel numbering start after rdma channel numbers.
>> With capture support referring rdma_ch_bit_map for wrdma channel
>> allocation
>> is confusing, so renaming rdma_ch_bit_map to dma_ch_bit_map makes sense.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   sound/soc/qcom/lpass-apq8016.c | 6 +++---
>>   sound/soc/qcom/lpass.h         | 2 +-
>>   2 files changed, 4 insertions(+), 4 deletions(-)
>
> As stated in my comments on patch 3 (ASoC: qcom: rename
> rdmactl_audif_start to dmactrl_audif_start), I believe this change could
> be combined with that patch.  Or at the very least, have this patch be
> sequenced directly after patch 3.
Ok, I will give it a go in next version.
>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:48     ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:48 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:37, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:29:20AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-apq8016.c
>> b/sound/soc/qcom/lpass-apq8016.c
>> index df44f09..3eef0c3 100644
>> --- a/sound/soc/qcom/lpass-apq8016.c
>> +++ b/sound/soc/qcom/lpass-apq8016.c
>
> ...
>
>> @@ -213,7 +225,11 @@ static struct lpass_variant apq8016_data = {
>>   	.rdma_reg_base		= 0x8400,
>>   	.rdma_reg_stride	= 0x1000,
>>   	.rdma_channels		= 2,
>> -	.rdmactl_audif_start	= 1,
>> +	.dmactl_audif_start	= 1,
>
> Changing rdma.. to dma.. should be done in patch 3 (ASoC: qcom: rename
> rdmactl_audif_start to dmactrl_audif_start).  The build should
> fail otherwise if bisecting between this patch and patch 3.
Agreed, will sort this out in next version.
>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Re: [alsa-devel] [PATCH RFC 12/15] ASoC: qcom: add generic bit masks for RDMA and WRDMA
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-03  8:49     ` Srinivas Kandagatla
  0 siblings, 0 replies; 48+ messages in thread
From: Srinivas Kandagatla @ 2016-02-03  8:49 UTC (permalink / raw)
  To: Patrick Lai, alsa-devel, Banajit Goswami, Liam Girdwood,
	linux-arm-msm, linux-kernel, Takashi Iwai, Mark Brown



On 03/02/16 00:37, Kenneth Westfield wrote:
> On Mon, Feb 01, 2016 at 09:29:32AM -0800, Srinivas Kandagatla wrote:
>> diff --git a/sound/soc/qcom/lpass-lpaif-reg.h
>> b/sound/soc/qcom/lpass-lpaif-reg.h
>> index 2008f9f..2114b3e 100644
>> --- a/sound/soc/qcom/lpass-lpaif-reg.h
>> +++ b/sound/soc/qcom/lpass-lpaif-reg.h
>
> ...
>
>> +#define __LPAIF_DMA_REG(v, chan, dir, reg)  \
>> +	(dir ==  SNDRV_PCM_STREAM_PLAYBACK) ? \
>> +		LPAIF_RDMA##reg##_REG(v, chan) : \
>> +		LPAIF_WRDMA##reg##_REG(v, chan)
>> +
>> +#define LPAIF_DMACTL_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir, CTL)
>> +#define LPAIF_DMABASE_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir,
>> BASE)
>> +#define	LPAIF_DMABUFF_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan,
>> dir, BUFF)
>> +#define LPAIF_DMACURR_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan, dir,
>> CURR)
>> +#define	LPAIF_DMAPER_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan,
>> dir, PER)
>> +#define	LPAIF_DMAPERCNT_REG(v, chan, dir) __LPAIF_DMA_REG(v, chan,
>> dir, PERCNT)
>> +
>> +
>> +#define LPAIF_DMACTL_AUDINTF(id)	(id << LPAIF_DMACTL_AUDINTF_SHIFT)
>
> IMO, it would make more sense to place this definition here ...
>
Ok, Will do it.
>> +
>> +#define LPAIF_DMACTL_BURSTEN_MASK	0x800
>> +#define LPAIF_DMACTL_BURSTEN_SHIFT	11
>> +#define LPAIF_DMACTL_BURSTEN_SINGLE	(0 << LPAIF_DMACTL_BURSTEN_SHIFT)
>> +#define LPAIF_DMACTL_BURSTEN_INCR4	(1 << LPAIF_DMACTL_BURSTEN_SHIFT)
>> +
>> +#define LPAIF_DMACTL_WPSCNT_MASK	0x700
>> +#define LPAIF_DMACTL_WPSCNT_SHIFT	8
>> +#define LPAIF_DMACTL_WPSCNT_ONE	(0 << LPAIF_DMACTL_WPSCNT_SHIFT)
>> +#define LPAIF_DMACTL_WPSCNT_TWO	(1 << LPAIF_DMACTL_WPSCNT_SHIFT)
>> +#define LPAIF_DMACTL_WPSCNT_THREE	(2 << LPAIF_DMACTL_WPSCNT_SHIFT)
>> +#define LPAIF_DMACTL_WPSCNT_FOUR	(3 << LPAIF_DMACTL_WPSCNT_SHIFT)
>> +#define LPAIF_DMACTL_WPSCNT_SIX	(5 << LPAIF_DMACTL_WPSCNT_SHIFT)
>> +#define LPAIF_DMACTL_WPSCNT_EIGHT	(7 << LPAIF_DMACTL_WPSCNT_SHIFT)
>> +
>> +#define LPAIF_DMACTL_AUDINTF_MASK	0x0F0
>> +#define LPAIF_DMACTL_AUDINTF_SHIFT	4
> ...
>     #define LPAIF_DMACTL_AUDINTF(id)     (id << LPAIF_DMACTL_AUDINTF_SHIFT)
>
>

^ permalink raw reply	[flat|nested] 48+ messages in thread

* Applied "ASoC: qcom: apq8016-sbc: add mic support" to the asoc tree
  2016-02-01 17:29 ` [PATCH RFC 14/15] ASoC: qcom: apq8016-sbc: add mic support Srinivas Kandagatla
  2016-02-03  0:38   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-20 17:14   ` Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Mark Brown @ 2016-02-20 17:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, Kenneth Westfield, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: qcom: apq8016-sbc: add mic support

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From bbedefb9e8c350bc7e8e7dc4732ba1974789e3e9 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date: Thu, 11 Feb 2016 12:18:45 +0000
Subject: [PATCH] ASoC: qcom: apq8016-sbc: add mic support

This patch add mic support on apq8016-sbc board aka db410c. Tested it
with headset mic.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/qcom/apq8016_sbc.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/sound/soc/qcom/apq8016_sbc.c b/sound/soc/qcom/apq8016_sbc.c
index 1efdf00..1289543 100644
--- a/sound/soc/qcom/apq8016_sbc.c
+++ b/sound/soc/qcom/apq8016_sbc.c
@@ -30,6 +30,7 @@ struct apq8016_sbc_data {
 	struct snd_soc_dai_link dai_link[];	/* dynamically allocated */
 };
 
+#define MIC_CTRL_TER_WS_SLAVE_SEL	BIT(21)
 #define MIC_CTRL_QUA_WS_SLAVE_SEL_10	BIT(17)
 #define MIC_CTRL_TLMM_SCLK_EN		BIT(1)
 #define	SPKR_CTL_PRI_WS_SLAVE_SEL_11	(BIT(17) | BIT(16))
@@ -53,6 +54,12 @@ static int apq8016_sbc_dai_init(struct snd_soc_pcm_runtime *rtd)
 			MIC_CTRL_TLMM_SCLK_EN,
 			pdata->mic_iomux);
 		break;
+	case MI2S_TERTIARY:
+		writel(readl(pdata->mic_iomux) | MIC_CTRL_TER_WS_SLAVE_SEL |
+			MIC_CTRL_TLMM_SCLK_EN,
+			pdata->mic_iomux);
+
+		break;
 
 	default:
 		dev_err(card->dev, "unsupported cpu dai configuration\n");
@@ -126,9 +133,6 @@ static struct apq8016_sbc_data *apq8016_sbc_parse_of(struct snd_soc_card *card)
 		}
 
 		link->platform_of_node = link->cpu_of_node;
-		/* For now we only support playback */
-		link->playback_only = true;
-
 		ret = of_property_read_string(np, "link-name", &link->name);
 		if (ret) {
 			dev_err(card->dev, "error getting codec dai_link name\n");
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Applied "ASoC: qcom: apq8016: set the correct max register for regmap" to the asoc tree
  2016-02-01 17:29 ` [PATCH RFC 13/15] ASoC: qcom: apq8016: set the correct max register for regmap Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-20 17:14   ` Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Mark Brown @ 2016-02-20 17:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, Kenneth Westfield, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: qcom: apq8016: set the correct max register for regmap

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From dad8061494d2a2ce6edc2ae5ab530b0d330b2685 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date: Thu, 11 Feb 2016 12:18:27 +0000
Subject: [PATCH] ASoC: qcom: apq8016: set the correct max register for regmap

Now that we are ready to access wrdma registers, set the max register
and other regmap related configs to use correct values.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/qcom/lpass-cpu.c | 33 +++++++++++++++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c
index e5101e0..91774fc 100644
--- a/sound/soc/qcom/lpass-cpu.c
+++ b/sound/soc/qcom/lpass-cpu.c
@@ -294,6 +294,17 @@ static bool lpass_cpu_regmap_writeable(struct device *dev, unsigned int reg)
 			return true;
 	}
 
+	for (i = 0; i < v->wrdma_channels; ++i) {
+		if (reg == LPAIF_WRDMACTL_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABASE_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABUFF_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMAPER_REG(v, i + v->wrdma_channel_start))
+			return true;
+	}
+
 	return false;
 }
 
@@ -327,6 +338,19 @@ static bool lpass_cpu_regmap_readable(struct device *dev, unsigned int reg)
 			return true;
 	}
 
+	for (i = 0; i < v->wrdma_channels; ++i) {
+		if (reg == LPAIF_WRDMACTL_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABASE_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMABUFF_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
+			return true;
+		if (reg == LPAIF_WRDMAPER_REG(v, i + v->wrdma_channel_start))
+			return true;
+	}
+
 	return false;
 }
 
@@ -344,6 +368,10 @@ static bool lpass_cpu_regmap_volatile(struct device *dev, unsigned int reg)
 		if (reg == LPAIF_RDMACURR_REG(v, i))
 			return true;
 
+	for (i = 0; i < v->wrdma_channels; ++i)
+		if (reg == LPAIF_WRDMACURR_REG(v, i + v->wrdma_channel_start))
+			return true;
+
 	return false;
 }
 
@@ -398,8 +426,9 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev)
 		return PTR_ERR((void const __force *)drvdata->lpaif);
 	}
 
-	lpass_cpu_regmap_config.max_register = LPAIF_RDMAPER_REG(variant,
-						variant->rdma_channels);
+	lpass_cpu_regmap_config.max_register = LPAIF_WRDMAPER_REG(variant,
+						variant->wrdma_channels +
+						variant->wrdma_channel_start);
 
 	drvdata->lpaif_map = devm_regmap_init_mmio(&pdev->dev, drvdata->lpaif,
 			&lpass_cpu_regmap_config);
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Applied "ASoC: qcom: add wrdma register definitions" to the asoc tree
  2016-02-01 17:29 ` [PATCH RFC 11/15] ASoC: qcom: add wrdma register definations Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-20 17:14   ` Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Mark Brown @ 2016-02-20 17:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, Kenneth Westfield, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: qcom: add wrdma register definitions

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 71aaa600787faffd72a9b674c9e5c9ded7cd9a82 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date: Thu, 11 Feb 2016 12:18:14 +0000
Subject: [PATCH] ASoC: qcom: add wrdma register definitions

This patch adds wrdma registers into the lpaif-reg.h.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/qcom/lpass-lpaif-reg.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/qcom/lpass-lpaif-reg.h b/sound/soc/qcom/lpass-lpaif-reg.h
index 6599794..760d219 100644
--- a/sound/soc/qcom/lpass-lpaif-reg.h
+++ b/sound/soc/qcom/lpass-lpaif-reg.h
@@ -145,4 +145,15 @@
 #define LPAIF_RDMACTL_ENABLE_OFF	(0 << LPAIF_RDMACTL_ENABLE_SHIFT)
 #define LPAIF_RDMACTL_ENABLE_ON		(1 << LPAIF_RDMACTL_ENABLE_SHIFT)
 
+#define LPAIF_WRDMA_REG_ADDR(v, addr, chan) \
+	(v->wrdma_reg_base + (addr) + \
+	 v->wrdma_reg_stride * (chan - v->wrdma_channel_start))
+
+#define LPAIF_WRDMACTL_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x00, (chan))
+#define LPAIF_WRDMABASE_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x04, (chan))
+#define	LPAIF_WRDMABUFF_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x08, (chan))
+#define LPAIF_WRDMACURR_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x0C, (chan))
+#define	LPAIF_WRDMAPER_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x10, (chan))
+#define	LPAIF_WRDMAPERCNT_REG(v, chan)	LPAIF_WRDMA_REG_ADDR(v, 0x14, (chan))
+
 #endif /* __LPASS_LPAIF_REG_H__ */
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Applied "ASoC: qcom: ipq806x: add wrdma related register offsets" to the asoc tree
  2016-02-01 17:28 ` [PATCH RFC 06/15] ASoC: qcom: ipq806x: add wrdma related register offsets Srinivas Kandagatla
  2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-20 17:14   ` Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Mark Brown @ 2016-02-20 17:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, Kenneth Westfield, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: qcom: ipq806x: add wrdma related register offsets

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 0a14a1bf2e81a75c5b814a3904f971fb5a53c068 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date: Thu, 11 Feb 2016 12:17:57 +0000
Subject: [PATCH] ASoC: qcom: ipq806x: add wrdma related register offsets

This patch adds wrdma related register offsets to the lpass variant data
of ipq806x.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/qcom/lpass-ipq806x.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sound/soc/qcom/lpass-ipq806x.c b/sound/soc/qcom/lpass-ipq806x.c
index 29a3529..608c1a9 100644
--- a/sound/soc/qcom/lpass-ipq806x.c
+++ b/sound/soc/qcom/lpass-ipq806x.c
@@ -86,6 +86,10 @@ static struct lpass_variant ipq806x_data = {
 	.rdma_reg_base		= 0x6000,
 	.rdma_reg_stride	= 0x1000,
 	.rdma_channels		= 4,
+	.wrdma_reg_base		= 0xB000,
+	.wrdma_reg_stride	= 0x1000,
+	.wrdma_channel_start	= 5,
+	.wrdma_channels		= 4,
 	.dai_driver		= &ipq806x_lpass_cpu_dai_driver,
 	.num_dai		= 1,
 	.alloc_dma_channel	= ipq806x_lpass_alloc_dma_channel,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 48+ messages in thread

* Applied "ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map" to the asoc tree
  2016-02-01 17:29 ` [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map Srinivas Kandagatla
  2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
@ 2016-02-20 17:14   ` Mark Brown
  1 sibling, 0 replies; 48+ messages in thread
From: Mark Brown @ 2016-02-20 17:14 UTC (permalink / raw)
  To: Srinivas Kandagatla, Kenneth Westfield, Mark Brown; +Cc: alsa-devel

The patch

   ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map

has been applied to the asoc tree at

   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 4d809fb12189aef9419f7337bb1767de85699003 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Date: Thu, 11 Feb 2016 12:17:51 +0000
Subject: [PATCH] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map

rdma_ch_bit_map can be reused for wrdma channel allocations as wrdma
channel numbering start after rdma channel numbers.
With capture support referring rdma_ch_bit_map for wrdma channel allocation
is confusing, so renaming rdma_ch_bit_map to dma_ch_bit_map makes sense.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Acked-by: Kenneth Westfield <kwestfie@codeaurora.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 sound/soc/qcom/lpass-apq8016.c | 6 +++---
 sound/soc/qcom/lpass.h         | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/qcom/lpass-apq8016.c b/sound/soc/qcom/lpass-apq8016.c
index 99061f4..ca3bbd5 100644
--- a/sound/soc/qcom/lpass-apq8016.c
+++ b/sound/soc/qcom/lpass-apq8016.c
@@ -137,20 +137,20 @@ static int apq8016_lpass_alloc_dma_channel(struct lpass_data *drvdata,
 					   int direction)
 {
 	struct lpass_variant *v = drvdata->variant;
-	int chan = find_first_zero_bit(&drvdata->rdma_ch_bit_map,
+	int chan = find_first_zero_bit(&drvdata->dma_ch_bit_map,
 					v->rdma_channels);
 
 	if (chan >= v->rdma_channels)
 		return -EBUSY;
 
-	set_bit(chan, &drvdata->rdma_ch_bit_map);
+	set_bit(chan, &drvdata->dma_ch_bit_map);
 
 	return chan;
 }
 
 static int apq8016_lpass_free_dma_channel(struct lpass_data *drvdata, int chan)
 {
-	clear_bit(chan, &drvdata->rdma_ch_bit_map);
+	clear_bit(chan, &drvdata->dma_ch_bit_map);
 
 	return 0;
 }
diff --git a/sound/soc/qcom/lpass.h b/sound/soc/qcom/lpass.h
index 8475b60..30714ad 100644
--- a/sound/soc/qcom/lpass.h
+++ b/sound/soc/qcom/lpass.h
@@ -50,7 +50,7 @@ struct lpass_data {
 	struct lpass_variant *variant;
 
 	/* bit map to keep track of static channel allocations */
-	unsigned long rdma_ch_bit_map;
+	unsigned long dma_ch_bit_map;
 
 	/* used it for handling interrupt per dma channel */
 	struct snd_pcm_substream *substream[LPASS_MAX_DMA_CHANNELS];
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 48+ messages in thread

end of thread, other threads:[~2016-02-20 17:15 UTC | newest]

Thread overview: 48+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-01 17:27 [PATCH RFC 00/15] ASoC: qcom: Add capture support Srinivas Kandagatla
2016-02-01 17:27 ` [PATCH RFC 01/15] ASoC: qcom: use snd_dma_alloc/free* apis Srinivas Kandagatla
2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:48     ` Srinivas Kandagatla
2016-02-03  8:48       ` [alsa-devel] " Srinivas Kandagatla
2016-02-01 17:28 ` [PATCH RFC 02/15] ASoC: qcom: add wrdma register details to lpass_variant Srinivas Kandagatla
2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
2016-02-01 17:28 ` [PATCH RFC 03/15] ASoC: qcom: rename rdmactl_audif_start to dmactrl_audif_start Srinivas Kandagatla
2016-02-03  0:35   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:48     ` Srinivas Kandagatla
2016-02-03  8:48       ` [alsa-devel] " Srinivas Kandagatla
2016-02-01 17:28 ` [PATCH RFC 04/15] ASoC: qcom: pass direction to dma allocation Srinivas Kandagatla
2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
2016-02-01 17:28 ` [PATCH RFC 05/15] ASoC: qcom: ipq806x: add error in " Srinivas Kandagatla
2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:48     ` Srinivas Kandagatla
2016-02-01 17:28 ` [PATCH RFC 06/15] ASoC: qcom: ipq806x: add wrdma related register offsets Srinivas Kandagatla
2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
2016-02-20 17:14   ` Applied "ASoC: qcom: ipq806x: add wrdma related register offsets" to the asoc tree Mark Brown
2016-02-01 17:28 ` [PATCH RFC 07/15] ASoC: qcom: add mic related i2s control register defines Srinivas Kandagatla
2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:48     ` Srinivas Kandagatla
2016-02-01 17:29 ` [PATCH RFC 08/15] ASoC: qcom: add wrdma dma channel start Srinivas Kandagatla
2016-02-03  0:36   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:48     ` Srinivas Kandagatla
2016-02-01 17:29 ` [PATCH RFC 09/15] ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map Srinivas Kandagatla
2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:48     ` Srinivas Kandagatla
2016-02-20 17:14   ` Applied "ASoC: qcom: rename rdma_ch_bit_map to dma_ch_bit_map" to the asoc tree Mark Brown
2016-02-01 17:29 ` [PATCH RFC 10/15] ASoC: qcom: apq8016: add wrdma support Srinivas Kandagatla
2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:48     ` Srinivas Kandagatla
2016-02-01 17:29 ` [PATCH RFC 11/15] ASoC: qcom: add wrdma register definations Srinivas Kandagatla
2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
2016-02-20 17:14   ` Applied "ASoC: qcom: add wrdma register definitions" to the asoc tree Mark Brown
2016-02-01 17:29 ` [PATCH RFC 12/15] ASoC: qcom: add generic bit masks for RDMA and WRDMA Srinivas Kandagatla
2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
2016-02-03  8:49     ` Srinivas Kandagatla
2016-02-01 17:29 ` [PATCH RFC 13/15] ASoC: qcom: apq8016: set the correct max register for regmap Srinivas Kandagatla
2016-02-03  0:37   ` [alsa-devel] " Kenneth Westfield
2016-02-20 17:14   ` Applied "ASoC: qcom: apq8016: set the correct max register for regmap" to the asoc tree Mark Brown
2016-02-01 17:29 ` [PATCH RFC 14/15] ASoC: qcom: apq8016-sbc: add mic support Srinivas Kandagatla
2016-02-03  0:38   ` [alsa-devel] " Kenneth Westfield
2016-02-20 17:14   ` Applied "ASoC: qcom: apq8016-sbc: add mic support" to the asoc tree Mark Brown
2016-02-01 17:29 ` [PATCH RFC 15/15] ASoC: qcom: add mic support Srinivas Kandagatla
2016-02-03  0:38   ` [alsa-devel] " Kenneth Westfield
2016-02-03  0:33 ` [alsa-devel] [PATCH RFC 00/15] ASoC: qcom: Add capture support Kenneth Westfield
2016-02-03  8:48   ` Srinivas Kandagatla

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.