All of lore.kernel.org
 help / color / mirror / Atom feed
From: srinivas.kandagatla@linaro.org
To: lee.jones@linaro.org, robh+dt@kernel.org, broonie@kernel.org
Cc: mark.rutland@arm.com, lgirdwood@gmail.com,
	bgoswami@codeaurora.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, vkoul@kernel.org,
	alsa-devel@alsa-project.org,
	Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Subject: [PATCH v4 14/14] ASoC: qcom: common: move be_hw_fixup to common
Date: Sun, 16 Sep 2018 17:57:27 -0700	[thread overview]
Message-ID: <20180917005727.32728-15-srinivas.kandagatla@linaro.org> (raw)
In-Reply-To: <20180917005727.32728-1-srinivas.kandagatla@linaro.org>

From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

be_hw_fixup for qdsp is common across mutiple qcom machine drivers,
so move it to common file and remove the redundant code.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
---
 sound/soc/qcom/apq8096.c | 15 ---------------
 sound/soc/qcom/common.c  | 17 +++++++++++++++++
 sound/soc/qcom/sdm845.c  | 22 ++--------------------
 3 files changed, 19 insertions(+), 35 deletions(-)

diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c
index daad43f..9cb26aee 100644
--- a/sound/soc/qcom/apq8096.c
+++ b/sound/soc/qcom/apq8096.c
@@ -20,20 +20,6 @@ struct apq8096_card_data {
 	bool jack_setup;
 };
 
-static int apq8096_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 msm_snd_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_pcm_hw_params *params)
 {
@@ -139,7 +125,6 @@ static void apq8096_add_be_ops(struct snd_soc_card *card)
 
 	for (i = 0; i < num_links; i++) {
 		if (link->no_pcm == 1) {
-			link->be_hw_params_fixup = apq8096_be_hw_params_fixup;
 			link->init = apq8096_init;
 			link->ops = &apq8096_ops;
 		}
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index eb1b9da..ce8e759 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -3,8 +3,24 @@
 // Copyright (c) 2018, The Linux Foundation. All rights reserved.
 
 #include <linux/module.h>
+#include <sound/pcm_params.h>
 #include "common.h"
 
+static int qcom_snd_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;
+	params_set_format(params, SNDRV_PCM_FORMAT_S16_LE);
+
+	return 0;
+}
+
 int qcom_snd_parse_of(struct snd_soc_card *card)
 {
 	struct device_node *np;
@@ -79,6 +95,7 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
 			}
 			link->no_pcm = 1;
 			link->ignore_pmdown_time = 1;
+			link->be_hw_params_fixup = qcom_snd_be_hw_params_fixup;
 		} else {
 			link->platform_of_node = link->cpu_of_node;
 			link->codec_dai_name = "snd-soc-dummy-dai";
diff --git a/sound/soc/qcom/sdm845.c b/sound/soc/qcom/sdm845.c
index 2a781d8..87e150c 100644
--- a/sound/soc/qcom/sdm845.c
+++ b/sound/soc/qcom/sdm845.c
@@ -11,7 +11,6 @@
 #include "common.h"
 #include "qdsp6/q6afe.h"
 
-#define DEFAULT_SAMPLE_RATE_48K		48000
 #define DEFAULT_MCLK_RATE		24576000
 #define DEFAULT_BCLK_RATE		12288000
 
@@ -177,32 +176,15 @@ static struct snd_soc_ops sdm845_be_ops = {
 	.shutdown = sdm845_snd_shutdown,
 };
 
-static int sdm845_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);
-	struct snd_mask *fmt = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
-
-	rate->min = rate->max = DEFAULT_SAMPLE_RATE_48K;
-	channels->min = channels->max = 2;
-	snd_mask_set_format(fmt, SNDRV_PCM_FORMAT_S16_LE);
-
-	return 0;
-}
-
 static void sdm845_add_be_ops(struct snd_soc_card *card)
 {
 	struct snd_soc_dai_link *link = card->dai_link;
 	int i, num_links = card->num_links;
 
 	for (i = 0; i < num_links; i++) {
-		if (link->no_pcm == 1) {
+		if (link->no_pcm == 1)
 			link->ops = &sdm845_be_ops;
-			link->be_hw_params_fixup = sdm845_be_hw_params_fixup;
-		}
+
 		link++;
 	}
 }
-- 
2.9.3


  parent reply	other threads:[~2018-09-17  0:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17  0:57 [PATCH v4 00/14] ASoC: Add support to WCD9335 Audio Codec srinivas.kandagatla
2018-09-17  0:57 ` srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 01/14] ASoC: dt-bindings: update wcd9335 bindings srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 02/14] mfd: wcd9335: add support to wcd9335 core srinivas.kandagatla
2018-10-24  7:07   ` Lee Jones
2018-10-24  7:07     ` Lee Jones
2018-10-24 10:50     ` Srinivas Kandagatla
2018-09-17  0:57 ` [PATCH v4 03/14] mfd: wcd9335: add wcd irq support srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 04/14] ASoC: wcd9335: add support to wcd9335 codec srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 05/14] ASoC: wcd9335: add CLASS-H Controller support srinivas.kandagatla
2018-09-17  0:57   ` srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 06/14] ASoC: wcd9335: add basic controls srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 07/14] ASoC: wcd9335: add playback dapm widgets srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 08/14] ASoC: wcd9335: add capture " srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 09/14] ASoC: wcd9335: add audio routings srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 10/14] ASoC: dt-bindings: Add WCD9335 MBHC specific properties srinivas.kandagatla
2018-09-26  9:27   ` Banajit Goswami
2018-09-17  0:57 ` [PATCH v4 11/14] ASoC: wcd9335: add mbhc support srinivas.kandagatla
2018-09-26  9:31   ` Banajit Goswami
2018-09-26 10:56     ` Srinivas Kandagatla
2018-09-26 10:56       ` Srinivas Kandagatla
2018-09-17  0:57 ` [PATCH v4 12/14] ASoC: apq8096: add slim support srinivas.kandagatla
2018-09-17  0:57 ` [PATCH v4 13/14] ASoC: apq8096: add headset JACK support srinivas.kandagatla
2018-09-17  0:57 ` srinivas.kandagatla [this message]
2018-09-19  5:49   ` [alsa-devel] [PATCH v4 14/14] ASoC: qcom: common: move be_hw_fixup to common Rohit Kumar
2018-09-26 10:56     ` Srinivas Kandagatla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180917005727.32728-15-srinivas.kandagatla@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=bgoswami@codeaurora.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.