Commit eed13933 authored by Mark Brown's avatar Mark Brown

ASoC: qcom: display port changes

Merge series from srinivas.kandagatla@linaro.org:

This patchset adds support for.
	1. parse Display Port module tokens from ASoC topology
	2. add support to DP/HDMI Jack events.
	3. fixes a typo in function name in sm8250

Verified these patches on X13s along with changes to tplg in
https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/tree/topic/x13s-dp?ref_type=heads
and ucm changes from https://github.com/Srinivas-Kandagatla/alsa-ucm-conf/tree/topic/x13s-dp

x1e80100 is verified by Krzysztof with his changes in tplg

https://git.codelinaro.org/linaro/qcomlt/audioreach-topology/-/merge_requests/7/commits
parents 86a37eb6 24790a3c
...@@ -8,9 +8,19 @@ ...@@ -8,9 +8,19 @@
#include <linux/input-event-codes.h> #include <linux/input-event-codes.h>
#include "common.h" #include "common.h"
#define NAME_SIZE 32
static const struct snd_soc_dapm_widget qcom_jack_snd_widgets[] = { static const struct snd_soc_dapm_widget qcom_jack_snd_widgets[] = {
SND_SOC_DAPM_HP("Headphone Jack", NULL), SND_SOC_DAPM_HP("Headphone Jack", NULL),
SND_SOC_DAPM_MIC("Mic Jack", NULL), SND_SOC_DAPM_MIC("Mic Jack", NULL),
SND_SOC_DAPM_SPK("DP0 Jack", NULL),
SND_SOC_DAPM_SPK("DP1 Jack", NULL),
SND_SOC_DAPM_SPK("DP2 Jack", NULL),
SND_SOC_DAPM_SPK("DP3 Jack", NULL),
SND_SOC_DAPM_SPK("DP4 Jack", NULL),
SND_SOC_DAPM_SPK("DP5 Jack", NULL),
SND_SOC_DAPM_SPK("DP6 Jack", NULL),
SND_SOC_DAPM_SPK("DP7 Jack", NULL),
}; };
int qcom_snd_parse_of(struct snd_soc_card *card) int qcom_snd_parse_of(struct snd_soc_card *card)
...@@ -240,5 +250,30 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd, ...@@ -240,5 +250,30 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
} }
EXPORT_SYMBOL_GPL(qcom_snd_wcd_jack_setup); EXPORT_SYMBOL_GPL(qcom_snd_wcd_jack_setup);
int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *dp_jack, int dp_pcm_id)
{
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
struct snd_soc_card *card = rtd->card;
char jack_name[NAME_SIZE];
int rval, i;
snprintf(jack_name, sizeof(jack_name), "DP%d Jack", dp_pcm_id);
rval = snd_soc_card_jack_new(card, jack_name, SND_JACK_AVOUT, dp_jack);
if (rval)
return rval;
for_each_rtd_codec_dais(rtd, i, codec_dai) {
rval = snd_soc_component_set_jack(codec_dai->component, dp_jack, NULL);
if (rval != 0 && rval != -ENOTSUPP) {
dev_warn(card->dev, "Failed to set jack: %d\n", rval);
return rval;
}
}
return 0;
}
EXPORT_SYMBOL_GPL(qcom_snd_dp_jack_setup);
MODULE_DESCRIPTION("ASoC Qualcomm helper functions"); MODULE_DESCRIPTION("ASoC Qualcomm helper functions");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -9,5 +9,8 @@ ...@@ -9,5 +9,8 @@
int qcom_snd_parse_of(struct snd_soc_card *card); int qcom_snd_parse_of(struct snd_soc_card *card);
int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd, int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *jack, bool *jack_setup); struct snd_soc_jack *jack, bool *jack_setup);
int qcom_snd_dp_jack_setup(struct snd_soc_pcm_runtime *rtd,
struct snd_soc_jack *dp_jack, int id);
#endif #endif
...@@ -730,6 +730,29 @@ static int audioreach_widget_i2s_module_load(struct audioreach_module *mod, ...@@ -730,6 +730,29 @@ static int audioreach_widget_i2s_module_load(struct audioreach_module *mod,
return 0; return 0;
} }
static int audioreach_widget_dp_module_load(struct audioreach_module *mod,
struct snd_soc_tplg_vendor_array *mod_array)
{
struct snd_soc_tplg_vendor_value_elem *mod_elem;
int tkn_count = 0;
mod_elem = mod_array->value;
while (tkn_count <= (le32_to_cpu(mod_array->num_elems) - 1)) {
switch (le32_to_cpu(mod_elem->token)) {
case AR_TKN_U32_MODULE_FMT_DATA:
mod->data_format = le32_to_cpu(mod_elem->value);
break;
default:
break;
}
tkn_count++;
mod_elem++;
}
return 0;
}
static int audioreach_widget_load_buffer(struct snd_soc_component *component, static int audioreach_widget_load_buffer(struct snd_soc_component *component,
int index, struct snd_soc_dapm_widget *w, int index, struct snd_soc_dapm_widget *w,
struct snd_soc_tplg_dapm_widget *tplg_w) struct snd_soc_tplg_dapm_widget *tplg_w)
...@@ -760,6 +783,9 @@ static int audioreach_widget_load_buffer(struct snd_soc_component *component, ...@@ -760,6 +783,9 @@ static int audioreach_widget_load_buffer(struct snd_soc_component *component,
case MODULE_ID_I2S_SOURCE: case MODULE_ID_I2S_SOURCE:
audioreach_widget_i2s_module_load(mod, mod_array); audioreach_widget_i2s_module_load(mod, mod_array);
break; break;
case MODULE_ID_DISPLAY_PORT_SINK:
audioreach_widget_dp_module_load(mod, mod_array);
break;
default: default:
return -EINVAL; return -EINVAL;
} }
......
...@@ -19,6 +19,7 @@ struct sc8280xp_snd_data { ...@@ -19,6 +19,7 @@ struct sc8280xp_snd_data {
struct snd_soc_card *card; struct snd_soc_card *card;
struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
struct snd_soc_jack jack; struct snd_soc_jack jack;
struct snd_soc_jack dp_jack[8];
bool jack_setup; bool jack_setup;
}; };
...@@ -27,6 +28,8 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -27,6 +28,8 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card); struct sc8280xp_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_soc_card *card = rtd->card; struct snd_soc_card *card = rtd->card;
struct snd_soc_jack *dp_jack = NULL;
int dp_pcm_id = 0;
switch (cpu_dai->id) { switch (cpu_dai->id) {
case WSA_CODEC_DMA_RX_0: case WSA_CODEC_DMA_RX_0:
...@@ -41,10 +44,22 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -41,10 +44,22 @@ static int sc8280xp_snd_init(struct snd_soc_pcm_runtime *rtd)
snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17); snd_soc_limit_volume(card, "SpkrLeft PA Volume", 17);
snd_soc_limit_volume(card, "SpkrRight PA Volume", 17); snd_soc_limit_volume(card, "SpkrRight PA Volume", 17);
break; break;
case DISPLAY_PORT_RX_0:
/* DISPLAY_PORT dai ids are not contiguous */
dp_pcm_id = 0;
dp_jack = &data->dp_jack[dp_pcm_id];
break;
case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
dp_pcm_id = cpu_dai->id - DISPLAY_PORT_RX_1 + 1;
dp_jack = &data->dp_jack[dp_pcm_id];
break;
default: default:
break; break;
} }
if (dp_jack)
return qcom_snd_dp_jack_setup(rtd, dp_jack, dp_pcm_id);
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
} }
......
...@@ -20,12 +20,32 @@ struct x1e80100_snd_data { ...@@ -20,12 +20,32 @@ struct x1e80100_snd_data {
struct snd_soc_card *card; struct snd_soc_card *card;
struct sdw_stream_runtime *sruntime[AFE_PORT_MAX]; struct sdw_stream_runtime *sruntime[AFE_PORT_MAX];
struct snd_soc_jack jack; struct snd_soc_jack jack;
struct snd_soc_jack dp_jack[8];
bool jack_setup; bool jack_setup;
}; };
static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd) static int x1e80100_snd_init(struct snd_soc_pcm_runtime *rtd)
{ {
struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card); struct x1e80100_snd_data *data = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
struct snd_soc_jack *dp_jack = NULL;
int dp_pcm_id = 0;
switch (cpu_dai->id) {
case DISPLAY_PORT_RX_0:
dp_pcm_id = 0;
dp_jack = &data->dp_jack[dp_pcm_id];
break;
case DISPLAY_PORT_RX_1 ... DISPLAY_PORT_RX_7:
dp_pcm_id = cpu_dai->id - DISPLAY_PORT_RX_1 + 1;
dp_jack = &data->dp_jack[dp_pcm_id];
break;
default:
break;
}
if (dp_jack)
return qcom_snd_dp_jack_setup(rtd, dp_jack, dp_pcm_id);
return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup); return qcom_snd_wcd_jack_setup(rtd, &data->jack, &data->jack_setup);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment