aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2018-08-20 17:45:58 +0100
committerSrinivas Kandagatla <srinivas.kandagatla@linaro.org>2018-09-08 14:53:20 +0100
commit8a42b421b4654ffbad95385a63763dd1caa4a530 (patch)
tree9682ab01f1193472db28700dfb1529de80a808ce
parent4cc5497b0f9e3d0b77f630f5f10758004c701a61 (diff)
ASoC: qcom: common: move be_hw_fixup to common
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>
-rw-r--r--sound/soc/qcom/apq8096.c13
-rw-r--r--sound/soc/qcom/common.c17
2 files changed, 17 insertions, 13 deletions
diff --git a/sound/soc/qcom/apq8096.c b/sound/soc/qcom/apq8096.c
index 485aa1ea553bb..ad40bd41ac385 100644
--- a/sound/soc/qcom/apq8096.c
+++ b/sound/soc/qcom/apq8096.c
@@ -21,18 +21,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;
-}
-
static int msm_snd_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
@@ -137,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 eb1b9da05dd47..ce8e7595864d0 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";