mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
ASoC: tegra-alt: parse machine widgets from DT
Machine DAPM widgets are currently defined in the driver and are used to connect to DAPM input/output widgets of external codecs. This routing map is exposed from DT. Since the machine driver is common to multiple platforms, all widgets defined in the driver are not always required. Instead of statically defining the widgets in the driver, these can be exposed from DT. Any platform DT can then add required number of widgets and can define a corresponding routing map. This patch removes the static array for DAPM widgets and instead helper function, snd_soc_of_parse_audio_simple_widgets(), is used to populate given DAPM widgets for the sound card. Bug 200503387 Change-Id: I8ff9f0d52e3c1cc10b6ab1682d05a7b7ef7e2684 Signed-off-by: Sameer Pujar <spujar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2257383 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Mohan Kumar D <mkumard@nvidia.com> Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
@@ -81,23 +81,6 @@ static const int tegra_machine_srate_values[] = {
|
||||
192000,
|
||||
};
|
||||
|
||||
static const struct snd_soc_dapm_widget tegra_machine_dapm_widgets[] = {
|
||||
SND_SOC_DAPM_SPK("x Int Spk", NULL),
|
||||
SND_SOC_DAPM_HP("x Headphone Jack", NULL),
|
||||
SND_SOC_DAPM_MIC("x Int Mic", NULL),
|
||||
SND_SOC_DAPM_MIC("x Mic Jack", NULL),
|
||||
|
||||
SND_SOC_DAPM_SPK("d1 Headphone", NULL),
|
||||
SND_SOC_DAPM_SPK("d2 Headphone", NULL),
|
||||
SND_SOC_DAPM_SPK("d3 Headphone", NULL),
|
||||
|
||||
SND_SOC_DAPM_HP("x Headphone", NULL),
|
||||
SND_SOC_DAPM_HP("y Headphone", NULL),
|
||||
SND_SOC_DAPM_MIC("Int Mic", NULL),
|
||||
SND_SOC_DAPM_MIC("x Mic", NULL),
|
||||
SND_SOC_DAPM_MIC("y Mic", NULL),
|
||||
};
|
||||
|
||||
static int tegra_machine_codec_get_rate(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
@@ -497,8 +480,6 @@ static struct snd_soc_card snd_soc_tegra_card = {
|
||||
.owner = THIS_MODULE,
|
||||
.controls = tegra_machine_controls,
|
||||
.num_controls = ARRAY_SIZE(tegra_machine_controls),
|
||||
.dapm_widgets = tegra_machine_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(tegra_machine_dapm_widgets),
|
||||
.suspend_pre = tegra_machine_suspend_pre,
|
||||
.fully_routed = true,
|
||||
};
|
||||
|
||||
@@ -424,6 +424,14 @@ int parse_card_info(struct snd_soc_card *card, struct snd_soc_ops *pcm_ops,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* parse machine DAPM widgets */
|
||||
if (of_property_read_bool(node, PREFIX "widgets")) {
|
||||
ret = snd_soc_of_parse_audio_simple_widgets(card,
|
||||
PREFIX "widgets");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Below property of routing map is required only when there
|
||||
* are DAPM input/output widgets available for external codec,
|
||||
|
||||
Reference in New Issue
Block a user