Re: [alsa-devel] [PATCH v3 24/25] ASoC: qcom: apq8096: Add db820c machine driver

2018-02-22 Thread Srinivas Kandagatla

Thanks for the review,

On 22/02/18 11:00, Rohit Kumar wrote:

+config SND_SOC_MSM8996
+tristate "SoC Machine driver for MSM8996 and APQ8096 boards"
+depends on QCOM_APR
+select SND_SOC_QDSP6V2

should be select SND_SOC_QDSP6, V2 is not defined


I will fix this in next version.

--srini


Re: [alsa-devel] [PATCH v3 24/25] ASoC: qcom: apq8096: Add db820c machine driver

2018-02-22 Thread Rohit Kumar



On 2/13/2018 10:28 PM, srinivas.kandaga...@linaro.org wrote:

From: Srinivas Kandagatla 

This patch adds support to DB820c machine driver.

Signed-off-by: Srinivas Kandagatla 
---
  sound/soc/qcom/Kconfig   |   8 +++
  sound/soc/qcom/apq8096.c | 173 +++
  2 files changed, 181 insertions(+)
  create mode 100644 sound/soc/qcom/apq8096.c

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index 8c2d65e0a28e..fa4b575c086c 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -77,3 +77,11 @@ config SND_SOC_QDSP6
 This will enable sound soc platform specific
 audio drivers. This includes q6asm, q6adm,
 q6afe interfaces to DSP using apr.
+
+config SND_SOC_MSM8996
+   tristate "SoC Machine driver for MSM8996 and APQ8096 boards"
+   depends on QCOM_APR
+   select SND_SOC_QDSP6V2

should be select SND_SOC_QDSP6, V2 is not defined

+   default n
+   help
+To add support for SoC audio on MSM8996 and APQ8096 boards



[PATCH v3 24/25] ASoC: qcom: apq8096: Add db820c machine driver

2018-02-13 Thread srinivas . kandagatla
From: Srinivas Kandagatla 

This patch adds support to DB820c machine driver.

Signed-off-by: Srinivas Kandagatla 
---
 sound/soc/qcom/Kconfig   |   8 +++
 sound/soc/qcom/apq8096.c | 173 +++
 2 files changed, 181 insertions(+)
 create mode 100644 sound/soc/qcom/apq8096.c

diff --git a/sound/soc/qcom/Kconfig b/sound/soc/qcom/Kconfig
index 8c2d65e0a28e..fa4b575c086c 100644
--- a/sound/soc/qcom/Kconfig
+++ b/sound/soc/qcom/Kconfig
@@ -77,3 +77,11 @@ config SND_SOC_QDSP6
 This will enable sound soc platform specific
 audio drivers. This includes q6asm, q6adm,
 q6afe interfaces to DSP using apr.
+
+config SND_SOC_MSM8996
+   tristate "SoC Machine driver for MSM8996 and APQ8096 boards"
+   depends on QCOM_APR
+   select SND_SOC_QDSP6V2
+   default n
+   help
+To add support for SoC audio on MSM8996 and APQ8096 boards
diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c
new file mode 100644
index ..b12d2398557a
--- /dev/null
+++ b/sound/soc/qcom/apq8096.c
@@ -0,0 +1,173 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2018, Linaro Limited
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static int msm8996_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
+ struct snd_pcm_hw_params *params)
+{
+   struct snd_interval *rate = hw_param_interval(params,
+   SNDRV_PCM_HW_PARAM_RATE);
+   struct snd_interval *channels = hw_param_interval(params,
+   SNDRV_PCM_HW_PARAM_CHANNELS);
+
+   rate->min = rate->max = 48000;
+   channels->min = channels->max = 2;
+
+   return 0;
+}
+
+static int apq8096_sbc_parse_of(struct snd_soc_card *card)
+{
+   struct device *dev = card->dev;
+   struct snd_soc_dai_link *link;
+   struct device_node *np, *codec, *platform, *cpu, *node  = dev->of_node;
+   int ret, num_links;
+   bool is_fe;
+
+
+   ret = snd_soc_of_parse_card_name(card, "qcom,model");
+   if (ret)
+   dev_err(dev, "Error parsing card name: %d\n", ret);
+
+   if (of_property_read_bool(dev->of_node, "qcom,audio-routing"))
+   ret = snd_soc_of_parse_audio_routing(card,
+   "qcom,audio-routing");
+
+   /* Populate links */
+   num_links = of_get_child_count(node);
+
+   dev_info(dev, "Found %d child audio dai links..\n", num_links);
+   /* Allocate the private data and the DAI link array */
+   card->dai_link = devm_kzalloc(dev, sizeof(*link) * num_links,
+   GFP_KERNEL);
+   if (!card->dai_link)
+   return -ENOMEM;
+
+   card->num_links = num_links;
+
+   link = card->dai_link;
+
+   for_each_child_of_node(node, np) {
+   is_fe = false;
+   if (of_property_read_bool(np, "is-fe"))
+   is_fe = true;
+
+   if (is_fe) {
+   /* BE is dummy */
+   link->codec_of_node = NULL;
+   link->codec_dai_name= "snd-soc-dummy-dai";
+   link->codec_name= "snd-soc-dummy";
+
+   /* FE settings */
+   link->dynamic   = 1;
+   link->dpcm_playback = 1;
+
+   } else {
+   link->no_pcm = 1;
+   link->dpcm_playback = 1;
+   link->ignore_suspend = 1;
+   link->ignore_pmdown_time = 1;
+   link->be_hw_params_fixup = msm8996_be_hw_params_fixup;
+   }
+
+   cpu = of_get_child_by_name(np, "cpu");
+   platform = of_get_child_by_name(np, "platform");
+   codec = of_get_child_by_name(np, "codec");
+
+   if (!cpu) {
+   dev_err(dev, "Can't find cpu DT node\n");
+   return -EINVAL;
+   }
+
+   link->cpu_of_node = of_parse_phandle(cpu, "sound-dai", 0);
+   if (!link->cpu_of_node) {
+   dev_err(card->dev, "error getting cpu phandle\n");
+   return -EINVAL;
+   }
+
+   link->platform_of_node = of_parse_phandle(platform,
+ "sound-dai", 0);
+   if (!link->platform_of_node) {
+   dev_err(card->dev, "error getting platform phandle\n");
+   return -EINVAL;
+   }
+
+   ret = snd_soc_of_get_dai_name(cpu, &link->cpu_dai_name);
+   if (ret) {
+   dev_err(card->dev, "error getting cpu dai name\n");
+   return ret;
+   }
+
+   if (codec) {
+   ret = snd_soc_of_get_dai_link_codec