aboutsummaryrefslogtreecommitdiff
path: root/sound/soc/intel/boards/bytcr_rt5651.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/intel/boards/bytcr_rt5651.c')
-rw-r--r--sound/soc/intel/boards/bytcr_rt5651.c72
1 files changed, 29 insertions, 43 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c
index 4606f6f582d6..5074bb53f98e 100644
--- a/sound/soc/intel/boards/bytcr_rt5651.c
+++ b/sound/soc/intel/boards/bytcr_rt5651.c
@@ -656,14 +656,6 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime)
return 0;
}
-static const struct snd_soc_pcm_stream byt_rt5651_dai_params = {
- .formats = SNDRV_PCM_FMTBIT_S24_LE,
- .rate_min = 48000,
- .rate_max = 48000,
- .channels_min = 2,
- .channels_max = 2,
-};
-
static int byt_rt5651_codec_fixup(struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_hw_params *params)
{
@@ -795,9 +787,10 @@ static struct snd_soc_dai_link byt_rt5651_dais[] = {
/* SoC card */
static char byt_rt5651_codec_name[SND_ACPI_I2C_ID_LEN];
-static char byt_rt5651_codec_aif_name[12]; /* = "rt5651-aif[1|2]" */
-static char byt_rt5651_cpu_dai_name[10]; /* = "ssp[0|2]-port" */
+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
static char byt_rt5651_long_name[50]; /* = "bytcr-rt5651-*-spk-*-mic[-swapped-hp]" */
+#endif
+static char byt_rt5651_components[50]; /* = "cfg-spk:* cfg-mic:*" */
static int byt_rt5651_suspend(struct snd_soc_card *card)
{
@@ -876,7 +869,6 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
const char *platform_name;
struct acpi_device *adev;
struct device *codec_dev;
- const char *hp_swapped;
bool is_bytcr = false;
int ret_val = 0;
int dai_index = 0;
@@ -996,10 +988,11 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
if (byt_rt5651_gpios) {
devm_acpi_dev_add_driver_gpios(codec_dev, byt_rt5651_gpios);
- priv->ext_amp_gpio = devm_fwnode_get_index_gpiod_from_child(
- &pdev->dev, "ext-amp-enable", 0,
- codec_dev->fwnode,
- GPIOD_OUT_LOW, "speaker-amp");
+ priv->ext_amp_gpio = devm_fwnode_gpiod_get(&pdev->dev,
+ codec_dev->fwnode,
+ "ext-amp-enable",
+ GPIOD_OUT_LOW,
+ "speaker-amp");
if (IS_ERR(priv->ext_amp_gpio)) {
ret_val = PTR_ERR(priv->ext_amp_gpio);
switch (ret_val) {
@@ -1015,10 +1008,11 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
return ret_val;
}
}
- priv->hp_detect = devm_fwnode_get_index_gpiod_from_child(
- &pdev->dev, "hp-detect", 0,
- codec_dev->fwnode,
- GPIOD_IN, "hp-detect");
+ priv->hp_detect = devm_fwnode_gpiod_get(&pdev->dev,
+ codec_dev->fwnode,
+ "hp-detect",
+ GPIOD_IN,
+ "hp-detect");
if (IS_ERR(priv->hp_detect)) {
ret_val = PTR_ERR(priv->hp_detect);
switch (ret_val) {
@@ -1041,26 +1035,12 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
log_quirks(&pdev->dev);
if ((byt_rt5651_quirk & BYT_RT5651_SSP2_AIF2) ||
- (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF2)) {
- /* fixup codec aif name */
- snprintf(byt_rt5651_codec_aif_name,
- sizeof(byt_rt5651_codec_aif_name),
- "%s", "rt5651-aif2");
-
- byt_rt5651_dais[dai_index].codecs->dai_name =
- byt_rt5651_codec_aif_name;
- }
+ (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF2))
+ byt_rt5651_dais[dai_index].codecs->dai_name = "rt5651-aif2";
if ((byt_rt5651_quirk & BYT_RT5651_SSP0_AIF1) ||
- (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF2)) {
- /* fixup cpu dai name name */
- snprintf(byt_rt5651_cpu_dai_name,
- sizeof(byt_rt5651_cpu_dai_name),
- "%s", "ssp0-port");
-
- byt_rt5651_dais[dai_index].cpus->dai_name =
- byt_rt5651_cpu_dai_name;
- }
+ (byt_rt5651_quirk & BYT_RT5651_SSP0_AIF2))
+ byt_rt5651_dais[dai_index].cpus->dai_name = "ssp0-port";
if (byt_rt5651_quirk & BYT_RT5651_MCLK_EN) {
priv->mclk = devm_clk_get(&pdev->dev, "pmc_plt_clk_3");
@@ -1080,17 +1060,23 @@ static int snd_byt_rt5651_mc_probe(struct platform_device *pdev)
}
}
- if (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED)
- hp_swapped = "-hp-swapped";
- else
- hp_swapped = "";
-
+ snprintf(byt_rt5651_components, sizeof(byt_rt5651_components),
+ "cfg-spk:%s cfg-mic:%s%s",
+ (byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ? "1" : "2",
+ mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)],
+ (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ?
+ " cfg-hp:lrswap" : "");
+ byt_rt5651_card.components = byt_rt5651_components;
+#if !IS_ENABLED(CONFIG_SND_SOC_INTEL_USER_FRIENDLY_LONG_NAMES)
snprintf(byt_rt5651_long_name, sizeof(byt_rt5651_long_name),
"bytcr-rt5651-%s-spk-%s-mic%s",
(byt_rt5651_quirk & BYT_RT5651_MONO_SPEAKER) ?
"mono" : "stereo",
- mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)], hp_swapped);
+ mic_name[BYT_RT5651_MAP(byt_rt5651_quirk)],
+ (byt_rt5651_quirk & BYT_RT5651_HP_LR_SWAPPED) ?
+ "-hp-swapped" : "");
byt_rt5651_card.long_name = byt_rt5651_long_name;
+#endif
/* override plaform name, if required */
platform_name = mach->mach_params.platform;