Re: [RESEND][PATCH v3 7/8] ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio

2020-07-08 Thread Rohit Kumar



On 7/8/2020 4:03 PM, Mark Brown wrote:

On Wed, Jul 08, 2020 at 10:44:46AM +0530, Rohit kumar wrote:

From: Ajit Pandey 

Add platform driver for configuring sc7180 lpass core I2S and
DMA configuration to support playback & capture to external codecs
connected over primary & secondary MI2S interfaces.

I only have patch 7 here, no other patches or cover letter.  What is
going on?


Hello Mark,

Sorry for the confusion. I posted complete patchset and resend only 7th 
patch as


it had invalid mail id in Signed-off. I should have probably updated it 
in Patch v4.


Thanks,

Rohit

--
Qualcomm INDIA, on behalf of Qualcomm Innovation Center, Inc.is a member
of the Code Aurora Forum, hosted by the Linux Foundation.



Re: [RESEND][PATCH v3 7/8] ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio

2020-07-08 Thread Mark Brown
On Wed, Jul 08, 2020 at 10:44:46AM +0530, Rohit kumar wrote:
> From: Ajit Pandey 
> 
> Add platform driver for configuring sc7180 lpass core I2S and
> DMA configuration to support playback & capture to external codecs
> connected over primary & secondary MI2S interfaces.

I only have patch 7 here, no other patches or cover letter.  What is
going on?


signature.asc
Description: PGP signature


[RESEND][PATCH v3 7/8] ASoC: qcom: lpass-sc7180: Add platform driver for lpass audio

2020-07-07 Thread Rohit kumar
From: Ajit Pandey 

Add platform driver for configuring sc7180 lpass core I2S and
DMA configuration to support playback & capture to external codecs
connected over primary & secondary MI2S interfaces.

Signed-off-by: Ajit Pandey 
Signed-off-by: Rohit kumar 
---
Resending to update Signed-off mail id.

 sound/soc/qcom/Kconfig|   5 +
 sound/soc/qcom/Makefile   |   2 +
 sound/soc/qcom/lpass-sc7180.c | 216 ++
 3 files changed, 223 insertions(+)
 create mode 100644 sound/soc/qcom/lpass-sc7180.c

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index 0ea4cde..87bec7f 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -24,6 +24,11 @@ config SND_SOC_LPASS_APQ8016
select SND_SOC_LPASS_CPU
select SND_SOC_LPASS_PLATFORM
 
+config SND_SOC_LPASS_SC7180
+   tristate
+   select SND_SOC_LPASS_CPU
+   select SND_SOC_LPASS_PLATFORM
+
 config SND_SOC_STORM
tristate "ASoC I2S support for Storm boards"
depends on SND_SOC_QCOM
diff --git a/sound/soc/qcom/Makefile b/sound/soc/qcom/Makefile
index 41b2c7a..7972c94 100644
--- a/sound/soc/qcom/Makefile
+++ b/sound/soc/qcom/Makefile
@@ -4,11 +4,13 @@ snd-soc-lpass-cpu-objs := lpass-cpu.o
 snd-soc-lpass-platform-objs := lpass-platform.o
 snd-soc-lpass-ipq806x-objs := lpass-ipq806x.o
 snd-soc-lpass-apq8016-objs := lpass-apq8016.o
+snd-soc-lpass-sc7180-objs := lpass-sc7180.o
 
 obj-$(CONFIG_SND_SOC_LPASS_CPU) += snd-soc-lpass-cpu.o
 obj-$(CONFIG_SND_SOC_LPASS_PLATFORM) += snd-soc-lpass-platform.o
 obj-$(CONFIG_SND_SOC_LPASS_IPQ806X) += snd-soc-lpass-ipq806x.o
 obj-$(CONFIG_SND_SOC_LPASS_APQ8016) += snd-soc-lpass-apq8016.o
+obj-$(CONFIG_SND_SOC_LPASS_SC7180) += snd-soc-lpass-sc7180.o
 
 # Machine
 snd-soc-storm-objs := storm.o
diff --git a/sound/soc/qcom/lpass-sc7180.c b/sound/soc/qcom/lpass-sc7180.c
new file mode 100644
index ..dd85a97
--- /dev/null
+++ b/sound/soc/qcom/lpass-sc7180.c
@@ -0,0 +1,216 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * lpass-sc7180.c -- ALSA SoC platform-machine driver for QTi LPASS
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "lpass-lpaif-reg.h"
+#include "lpass.h"
+
+static struct snd_soc_dai_driver sc7180_lpass_cpu_dai_driver[] = {
+   [MI2S_PRIMARY] = {
+   .id = MI2S_PRIMARY,
+   .name = "Primary MI2S",
+   .playback = {
+   .stream_name = "Primary Playback",
+   .formats= SNDRV_PCM_FMTBIT_S16,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .capture = {
+   .stream_name = "Primary Capture",
+   .formats = SNDRV_PCM_FMTBIT_S16,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .probe  = _qcom_lpass_cpu_dai_probe,
+   .ops= _qcom_lpass_cpu_dai_ops,
+   },
+
+   [MI2S_SECONDARY] = {
+   .id = MI2S_SECONDARY,
+   .name = "Secondary MI2S",
+   .playback = {
+   .stream_name = "Secondary Playback",
+   .formats= SNDRV_PCM_FMTBIT_S16,
+   .rates = SNDRV_PCM_RATE_48000,
+   .rate_min   = 48000,
+   .rate_max   = 48000,
+   .channels_min   = 2,
+   .channels_max   = 2,
+   },
+   .probe  = _qcom_lpass_cpu_dai_probe,
+   .ops= _qcom_lpass_cpu_dai_ops,
+   },
+};
+
+static int sc7180_lpass_alloc_dma_channel(struct lpass_data *drvdata,
+  int direction)
+{
+   struct lpass_variant *v = drvdata->variant;
+   int chan = 0;
+
+   if (direction == SNDRV_PCM_STREAM_PLAYBACK) {
+   chan = find_first_zero_bit(>dma_ch_bit_map,
+   v->rdma_channels);
+
+   if (chan >= v->rdma_channels)
+   return -EBUSY;
+   } else {
+   chan = find_next_zero_bit(>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, >dma_ch_bit_map);