aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/qcom/common.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2021-12-23 19:38:13 +0000
committerMark Brown <broonie@kernel.org>2021-12-23 19:38:13 +0000
commit2f15d3cebd45f773a2e27cce84ca851164dd5acd (patch)
treee3af59b4e59c97ffd315ee4b2c73fcd744f340ac /sound/soc/qcom/common.c
parent4e28491a7a198c668437f2be8a91a76aa52f20eb (diff)
parent319a05330f4ff3f951f9c42094958c6cdef393b3 (diff)
ASoC: qcom: Parse "pin-switches" and "widgets" from DT
Merge series from Stephan Gerhold <stephan@gerhold.net>: Some sound card setups might require extra pin switches to allow turning off certain audio components. simple-card supports this already using the "pin-switches" and "widgets" device tree property. This series makes it possible to use the same properties for the Qcom sound cards. To implement that, the function that parses the "pin-switches" property in simple-card-utils.c is first moved into the ASoC core. Then two simple function calls are added to the common Qcom sound card DT parser. Finally there is a small patch for the msm8916-wcd-analog codec to make it possible to model sound card setups used in some MSM8916 smartphones. (See PATCH 2/4 for an explanation of some real example use cases.) Using pin switches rather than patching codec drivers with switches was originally suggested by Mark Brown on a patch for the tfa989x codec: https://lore.kernel.org/alsa-devel/YXaMVHo9drCIuD3u@sirena.org.uk/
Diffstat (limited to 'sound/soc/qcom/common.c')
-rw-r--r--sound/soc/qcom/common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c
index e1bf04d00625..c407684ce1a2 100644
--- a/sound/soc/qcom/common.c
+++ b/sound/soc/qcom/common.c
@@ -26,6 +26,12 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
return ret;
}
+ if (of_property_read_bool(dev->of_node, "widgets")) {
+ ret = snd_soc_of_parse_audio_simple_widgets(card, "widgets");
+ if (ret)
+ return ret;
+ }
+
/* DAPM routes */
if (of_property_read_bool(dev->of_node, "audio-routing")) {
ret = snd_soc_of_parse_audio_routing(card, "audio-routing");
@@ -39,6 +45,10 @@ int qcom_snd_parse_of(struct snd_soc_card *card)
return ret;
}
+ ret = snd_soc_of_parse_pin_switches(card, "pin-switches");
+ if (ret)
+ return ret;
+
ret = snd_soc_of_parse_aux_devs(card, "aux-devs");
if (ret)
return ret;