Commit 01c266af authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: Intel: sof_sdw: use generic name for controls/widgets

Some controls and widgets have exactly the same items. Rename them to be
generic. This is a preparation for further cleanup. No function change.
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20240509163418.67746-15-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 1628e1c8
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <sound/jack.h> #include <sound/jack.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget cs42l42_widgets[] = { static const struct snd_soc_dapm_widget generic_jack_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
}; };
...@@ -30,7 +30,7 @@ static const struct snd_soc_dapm_route cs42l42_map[] = { ...@@ -30,7 +30,7 @@ static const struct snd_soc_dapm_route cs42l42_map[] = {
{"cs42l42 HS", NULL, "Headset Mic"}, {"cs42l42 HS", NULL, "Headset Mic"},
}; };
static const struct snd_kcontrol_new cs42l42_controls[] = { static const struct snd_kcontrol_new generic_jack_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Headset Mic"),
}; };
...@@ -70,15 +70,15 @@ int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -70,15 +70,15 @@ int cs42l42_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, cs42l42_controls, ret = snd_soc_add_card_controls(card, generic_jack_controls,
ARRAY_SIZE(cs42l42_controls)); ARRAY_SIZE(generic_jack_controls));
if (ret) { if (ret) {
dev_err(card->dev, "cs42l42 control addition failed: %d\n", ret); dev_err(card->dev, "cs42l42 control addition failed: %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l42_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_jack_widgets,
ARRAY_SIZE(cs42l42_widgets)); ARRAY_SIZE(generic_jack_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "cs42l42 widgets addition failed: %d\n", ret); dev_err(card->dev, "cs42l42 widgets addition failed: %d\n", ret);
return ret; return ret;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget cs42l43_hs_widgets[] = { static const struct snd_soc_dapm_widget generic_jack_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
}; };
...@@ -30,7 +30,7 @@ static const struct snd_soc_dapm_route cs42l43_hs_map[] = { ...@@ -30,7 +30,7 @@ static const struct snd_soc_dapm_route cs42l43_hs_map[] = {
{ "cs42l43 ADC1_IN1_N", NULL, "Headset Mic" }, { "cs42l43 ADC1_IN1_N", NULL, "Headset Mic" },
}; };
static const struct snd_soc_dapm_widget cs42l43_spk_widgets[] = { static const struct snd_soc_dapm_widget generic_spk_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_SPK("Speaker", NULL),
}; };
...@@ -41,7 +41,7 @@ static const struct snd_soc_dapm_route cs42l43_spk_map[] = { ...@@ -41,7 +41,7 @@ static const struct snd_soc_dapm_route cs42l43_spk_map[] = {
{ "Speaker", NULL, "cs42l43 AMP2_OUT_N", }, { "Speaker", NULL, "cs42l43 AMP2_OUT_N", },
}; };
static const struct snd_soc_dapm_widget cs42l43_dmic_widgets[] = { static const struct snd_soc_dapm_widget generic_dmic_widgets[] = {
SND_SOC_DAPM_MIC("DMIC", NULL), SND_SOC_DAPM_MIC("DMIC", NULL),
}; };
...@@ -74,8 +74,8 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -74,8 +74,8 @@ int cs42l43_hs_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_hs_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_jack_widgets,
ARRAY_SIZE(cs42l43_hs_widgets)); ARRAY_SIZE(generic_jack_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "cs42l43 hs widgets addition failed: %d\n", ret); dev_err(card->dev, "cs42l43 hs widgets addition failed: %d\n", ret);
return ret; return ret;
...@@ -133,8 +133,8 @@ int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -133,8 +133,8 @@ int cs42l43_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
return -ENOMEM; return -ENOMEM;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_spk_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_spk_widgets,
ARRAY_SIZE(cs42l43_spk_widgets)); ARRAY_SIZE(generic_spk_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "cs42l43 speaker widgets addition failed: %d\n", ret); dev_err(card->dev, "cs42l43 speaker widgets addition failed: %d\n", ret);
return ret; return ret;
...@@ -172,8 +172,8 @@ int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -172,8 +172,8 @@ int cs42l43_dmic_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_dapm_new_controls(&card->dapm, cs42l43_dmic_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_dmic_widgets,
ARRAY_SIZE(cs42l43_dmic_widgets)); ARRAY_SIZE(generic_dmic_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "cs42l43 dmic widgets addition failed: %d\n", ret); dev_err(card->dev, "cs42l43 dmic widgets addition failed: %d\n", ret);
return ret; return ret;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#define CODEC_NAME_SIZE 8 #define CODEC_NAME_SIZE 8
static const struct snd_soc_dapm_widget sof_widgets[] = { static const struct snd_soc_dapm_widget generic_spk_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_SPK("Speaker", NULL),
}; };
...@@ -35,8 +35,8 @@ int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -35,8 +35,8 @@ int cs_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_dapm_new_controls(&card->dapm, sof_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_spk_widgets,
ARRAY_SIZE(sof_widgets)); ARRAY_SIZE(generic_spk_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "widgets addition failed: %d\n", ret); dev_err(card->dev, "widgets addition failed: %d\n", ret);
return ret; return ret;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include <sound/jack.h> #include <sound/jack.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget rt5682_widgets[] = { static const struct snd_soc_dapm_widget generic_jack_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
}; };
...@@ -29,7 +29,7 @@ static const struct snd_soc_dapm_route rt5682_map[] = { ...@@ -29,7 +29,7 @@ static const struct snd_soc_dapm_route rt5682_map[] = {
{ "rt5682 IN1P", NULL, "Headset Mic" }, { "rt5682 IN1P", NULL, "Headset Mic" },
}; };
static const struct snd_kcontrol_new rt5682_controls[] = { static const struct snd_kcontrol_new generic_jack_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Headset Mic"),
}; };
...@@ -69,15 +69,15 @@ int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -69,15 +69,15 @@ int rt5682_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt5682_controls, ret = snd_soc_add_card_controls(card, generic_jack_controls,
ARRAY_SIZE(rt5682_controls)); ARRAY_SIZE(generic_jack_controls));
if (ret) { if (ret) {
dev_err(card->dev, "rt5682 control addition failed: %d\n", ret); dev_err(card->dev, "rt5682 control addition failed: %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, rt5682_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_jack_widgets,
ARRAY_SIZE(rt5682_widgets)); ARRAY_SIZE(generic_jack_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "rt5682 widgets addition failed: %d\n", ret); dev_err(card->dev, "rt5682 widgets addition failed: %d\n", ret);
return ret; return ret;
......
...@@ -42,7 +42,7 @@ static int rt711_add_codec_device_props(struct device *sdw_dev) ...@@ -42,7 +42,7 @@ static int rt711_add_codec_device_props(struct device *sdw_dev)
return ret; return ret;
} }
static const struct snd_soc_dapm_widget rt711_widgets[] = { static const struct snd_soc_dapm_widget generic_jack_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
}; };
...@@ -53,7 +53,7 @@ static const struct snd_soc_dapm_route rt711_map[] = { ...@@ -53,7 +53,7 @@ static const struct snd_soc_dapm_route rt711_map[] = {
{ "rt711 MIC2", NULL, "Headset Mic" }, { "rt711 MIC2", NULL, "Headset Mic" },
}; };
static const struct snd_kcontrol_new rt711_controls[] = { static const struct snd_kcontrol_new generic_jack_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Headset Mic"),
}; };
...@@ -93,15 +93,15 @@ int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -93,15 +93,15 @@ int rt711_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt711_controls, ret = snd_soc_add_card_controls(card, generic_jack_controls,
ARRAY_SIZE(rt711_controls)); ARRAY_SIZE(generic_jack_controls));
if (ret) { if (ret) {
dev_err(card->dev, "rt711 controls addition failed: %d\n", ret); dev_err(card->dev, "rt711 controls addition failed: %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, rt711_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_jack_widgets,
ARRAY_SIZE(rt711_widgets)); ARRAY_SIZE(generic_jack_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "rt711 widgets addition failed: %d\n", ret); dev_err(card->dev, "rt711 widgets addition failed: %d\n", ret);
return ret; return ret;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget rt712_spk_widgets[] = { static const struct snd_soc_dapm_widget generic_spk_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_SPK("Speaker", NULL),
}; };
...@@ -30,7 +30,7 @@ static const struct snd_soc_dapm_route rt712_spk_map[] = { ...@@ -30,7 +30,7 @@ static const struct snd_soc_dapm_route rt712_spk_map[] = {
{ "Speaker", NULL, "rt712 SPOR" }, { "Speaker", NULL, "rt712 SPOR" },
}; };
static const struct snd_kcontrol_new rt712_spk_controls[] = { static const struct snd_kcontrol_new generic_spk_controls[] = {
SOC_DAPM_PIN_SWITCH("Speaker"), SOC_DAPM_PIN_SWITCH("Speaker"),
}; };
...@@ -45,15 +45,15 @@ int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -45,15 +45,15 @@ int rt712_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt712_spk_controls, ret = snd_soc_add_card_controls(card, generic_spk_controls,
ARRAY_SIZE(rt712_spk_controls)); ARRAY_SIZE(generic_spk_controls));
if (ret) { if (ret) {
dev_err(card->dev, "rt712 spk controls addition failed: %d\n", ret); dev_err(card->dev, "rt712 spk controls addition failed: %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, rt712_spk_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_spk_widgets,
ARRAY_SIZE(rt712_spk_widgets)); ARRAY_SIZE(generic_spk_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "rt712 spk widgets addition failed: %d\n", ret); dev_err(card->dev, "rt712 spk widgets addition failed: %d\n", ret);
return ret; return ret;
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include <sound/soc-dapm.h> #include <sound/soc-dapm.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
static const struct snd_soc_dapm_widget rt722_spk_widgets[] = { static const struct snd_soc_dapm_widget generic_spk_widgets[] = {
SND_SOC_DAPM_SPK("Speaker", NULL), SND_SOC_DAPM_SPK("Speaker", NULL),
}; };
...@@ -23,7 +23,7 @@ static const struct snd_soc_dapm_route rt722_spk_map[] = { ...@@ -23,7 +23,7 @@ static const struct snd_soc_dapm_route rt722_spk_map[] = {
{ "Speaker", NULL, "rt722 SPK" }, { "Speaker", NULL, "rt722 SPK" },
}; };
static const struct snd_kcontrol_new rt722_spk_controls[] = { static const struct snd_kcontrol_new generic_spk_controls[] = {
SOC_DAPM_PIN_SWITCH("Speaker"), SOC_DAPM_PIN_SWITCH("Speaker"),
}; };
...@@ -38,15 +38,15 @@ int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -38,15 +38,15 @@ int rt722_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt722_spk_controls, ret = snd_soc_add_card_controls(card, generic_spk_controls,
ARRAY_SIZE(rt722_spk_controls)); ARRAY_SIZE(generic_spk_controls));
if (ret) { if (ret) {
dev_err(card->dev, "failed to add rt722 spk controls: %d\n", ret); dev_err(card->dev, "failed to add rt722 spk controls: %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, rt722_spk_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_spk_widgets,
ARRAY_SIZE(rt722_spk_widgets)); ARRAY_SIZE(generic_spk_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "failed to add rt722 spk widgets: %d\n", ret); dev_err(card->dev, "failed to add rt722 spk widgets: %d\n", ret);
return ret; return ret;
......
...@@ -131,12 +131,12 @@ static int rt_amp_add_device_props(struct device *sdw_dev) ...@@ -131,12 +131,12 @@ static int rt_amp_add_device_props(struct device *sdw_dev)
return ret; return ret;
} }
static const struct snd_kcontrol_new rt_amp_controls[] = { static const struct snd_soc_dapm_widget generic_spk_widgets[] = {
SOC_DAPM_PIN_SWITCH("Speaker"), SND_SOC_DAPM_SPK("Speaker", NULL),
}; };
static const struct snd_soc_dapm_widget rt_amp_widgets[] = { static const struct snd_kcontrol_new generic_spk_controls[] = {
SND_SOC_DAPM_SPK("Speaker", NULL), SOC_DAPM_PIN_SWITCH("Speaker"),
}; };
/* /*
...@@ -202,15 +202,15 @@ int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -202,15 +202,15 @@ int rt_amp_spk_rtd_init(struct snd_soc_pcm_runtime *rtd)
if (!card->components) if (!card->components)
return -ENOMEM; return -ENOMEM;
ret = snd_soc_add_card_controls(card, rt_amp_controls, ret = snd_soc_add_card_controls(card, generic_spk_controls,
ARRAY_SIZE(rt_amp_controls)); ARRAY_SIZE(generic_spk_controls));
if (ret) { if (ret) {
dev_err(card->dev, "%s controls addition failed: %d\n", codec_name, ret); dev_err(card->dev, "%s controls addition failed: %d\n", codec_name, ret);
return ret; return ret;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, rt_amp_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_spk_widgets,
ARRAY_SIZE(rt_amp_widgets)); ARRAY_SIZE(generic_spk_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "%s widgets addition failed: %d\n", codec_name, ret); dev_err(card->dev, "%s widgets addition failed: %d\n", codec_name, ret);
return ret; return ret;
......
...@@ -43,7 +43,7 @@ static int rt_sdca_jack_add_codec_device_props(struct device *sdw_dev) ...@@ -43,7 +43,7 @@ static int rt_sdca_jack_add_codec_device_props(struct device *sdw_dev)
return ret; return ret;
} }
static const struct snd_soc_dapm_widget rt_sdca_jack_widgets[] = { static const struct snd_soc_dapm_widget generic_jack_widgets[] = {
SND_SOC_DAPM_HP("Headphone", NULL), SND_SOC_DAPM_HP("Headphone", NULL),
SND_SOC_DAPM_MIC("Headset Mic", NULL), SND_SOC_DAPM_MIC("Headset Mic", NULL),
}; };
...@@ -68,7 +68,7 @@ static const struct snd_soc_dapm_route rt722_sdca_map[] = { ...@@ -68,7 +68,7 @@ static const struct snd_soc_dapm_route rt722_sdca_map[] = {
{ "rt722 MIC2", NULL, "Headset Mic" }, { "rt722 MIC2", NULL, "Headset Mic" },
}; };
static const struct snd_kcontrol_new rt_sdca_jack_controls[] = { static const struct snd_kcontrol_new generic_jack_controls[] = {
SOC_DAPM_PIN_SWITCH("Headphone"), SOC_DAPM_PIN_SWITCH("Headphone"),
SOC_DAPM_PIN_SWITCH("Headset Mic"), SOC_DAPM_PIN_SWITCH("Headset Mic"),
}; };
...@@ -129,15 +129,15 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd) ...@@ -129,15 +129,15 @@ int rt_sdca_jack_rtd_init(struct snd_soc_pcm_runtime *rtd)
} }
} }
ret = snd_soc_add_card_controls(card, rt_sdca_jack_controls, ret = snd_soc_add_card_controls(card, generic_jack_controls,
ARRAY_SIZE(rt_sdca_jack_controls)); ARRAY_SIZE(generic_jack_controls));
if (ret) { if (ret) {
dev_err(card->dev, "rt sdca jack controls addition failed: %d\n", ret); dev_err(card->dev, "rt sdca jack controls addition failed: %d\n", ret);
return ret; return ret;
} }
ret = snd_soc_dapm_new_controls(&card->dapm, rt_sdca_jack_widgets, ret = snd_soc_dapm_new_controls(&card->dapm, generic_jack_widgets,
ARRAY_SIZE(rt_sdca_jack_widgets)); ARRAY_SIZE(generic_jack_widgets));
if (ret) { if (ret) {
dev_err(card->dev, "rt sdca jack widgets addition failed: %d\n", ret); dev_err(card->dev, "rt sdca jack widgets addition failed: %d\n", ret);
return ret; return ret;
......
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