diff options
author | Srinivas Kandagatla <srinivas.kandagatla@linaro.org> | 2023-05-09 13:21:59 +0200 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2023-05-11 03:19:03 +0200 |
commit | 4c2be53f411c25b569c8fe3f91d0acfc4c5b8392 (patch) | |
tree | fe460d900e908282ca0d439d1fc73d495ebfea8f /sound/soc/qcom/qdsp6/q6afe-dai.c | |
parent | ASoC: add and use asoc_dummy_dlc (diff) | |
download | linux-4c2be53f411c25b569c8fe3f91d0acfc4c5b8392.tar.xz linux-4c2be53f411c25b569c8fe3f91d0acfc4c5b8392.zip |
ASoC: qcom: q6dsp-common: move channel allocation to common
move hdmi/dp channel allocation to a common function
q6dsp_get_channel_allocation() so that we can reuse this across
q6afe and q6apm drivers.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org
Link: https://lore.kernel.org/r/20230509112202.21471-2-srinivas.kandagatla@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org
Diffstat (limited to 'sound/soc/qcom/qdsp6/q6afe-dai.c')
-rw-r--r-- | sound/soc/qcom/qdsp6/q6afe-dai.c | 34 |
1 files changed, 7 insertions, 27 deletions
diff --git a/sound/soc/qcom/qdsp6/q6afe-dai.c b/sound/soc/qcom/qdsp6/q6afe-dai.c index 8bb7452b8f18..31e0bad71e95 100644 --- a/sound/soc/qcom/qdsp6/q6afe-dai.c +++ b/sound/soc/qcom/qdsp6/q6afe-dai.c @@ -12,6 +12,7 @@ #include <sound/soc.h> #include <sound/pcm_params.h> #include "q6dsp-lpass-ports.h" +#include "q6dsp-common.h" #include "q6afe.h" @@ -69,6 +70,7 @@ static int q6hdmi_hw_params(struct snd_pcm_substream *substream, struct q6afe_dai_data *dai_data = dev_get_drvdata(dai->dev); int channels = params_channels(params); struct q6afe_hdmi_cfg *hdmi = &dai_data->port_config[dai->id].hdmi; + int ret; hdmi->sample_rate = params_rate(params); switch (params_format(params)) { @@ -80,33 +82,11 @@ static int q6hdmi_hw_params(struct snd_pcm_substream *substream, break; } - /* HDMI spec CEA-861-E: Table 28 Audio InfoFrame Data Byte 4 */ - switch (channels) { - case 2: - hdmi->channel_allocation = 0; - break; - case 3: - hdmi->channel_allocation = 0x02; - break; - case 4: - hdmi->channel_allocation = 0x06; - break; - case 5: - hdmi->channel_allocation = 0x0A; - break; - case 6: - hdmi->channel_allocation = 0x0B; - break; - case 7: - hdmi->channel_allocation = 0x12; - break; - case 8: - hdmi->channel_allocation = 0x13; - break; - default: - dev_err(dai->dev, "invalid Channels = %u\n", channels); - return -EINVAL; - } + ret = q6dsp_get_channel_allocation(channels); + if (ret < 0) + return ret; + + hdmi->channel_allocation = (u16) ret; return 0; } |