summaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/boards/bytcr_rt5640.c
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2020-11-12 16:38:16 -0600
committerMark Brown <broonie@kernel.org>2020-11-19 18:24:37 +0000
commit41656c3dc2acfe2aef3d7c4e1cd2b92f49b6e3a7 (patch)
tree5d6bc0b3576e614ee3ba7e43e15a505077db87cf /sound/soc/intel/boards/bytcr_rt5640.c
parent644eebdbbf1154c995d6319c133d7d5b898c5ed2 (diff)
downloadlinux-41656c3dc2acfe2aef3d7c4e1cd2b92f49b6e3a7.tar.bz2
ASoC: Intel: boards: byt/cht: set card and driver name at run time
To avoid hard-coded variations between SOF and SST drivers, set the card name and driver dynamically depending on the parent type. This is the first pass required to let distributions select which drivers to use with kernel parameters instead of build-time selection. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@linux.intel.com> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> Link: https://lore.kernel.org/r/20201112223825.39765-6-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/intel/boards/bytcr_rt5640.c')
-rw-r--r--sound/soc/intel/boards/bytcr_rt5640.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
index 9dadf6561444..574b489a3283 100644
--- a/sound/soc/intel/boards/bytcr_rt5640.c
+++ b/sound/soc/intel/boards/bytcr_rt5640.c
@@ -1136,18 +1136,14 @@ static int byt_rt5640_resume(struct snd_soc_card *card)
return 0;
}
-#if IS_ENABLED(CONFIG_SND_SOC_SOF_BAYTRAIL)
/* use space before codec name to simplify card ID, and simplify driver name */
-#define CARD_NAME "bytcht rt5640" /* card name will be 'sof-bytcht rt5640' */
-#define DRIVER_NAME "SOF"
-#else
+#define SOF_CARD_NAME "bytcht rt5640" /* card name will be 'sof-bytcht rt5640' */
+#define SOF_DRIVER_NAME "SOF"
+
#define CARD_NAME "bytcr-rt5640"
#define DRIVER_NAME NULL /* card name will be used for driver name */
-#endif
static struct snd_soc_card byt_rt5640_card = {
- .name = CARD_NAME,
- .driver_name = DRIVER_NAME,
.owner = THIS_MODULE,
.dai_link = byt_rt5640_dais,
.num_links = ARRAY_SIZE(byt_rt5640_dais),
@@ -1173,6 +1169,7 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
struct snd_soc_acpi_mach *mach;
const char *platform_name;
struct acpi_device *adev;
+ bool sof_parent;
int ret_val = 0;
int dai_index = 0;
int i;
@@ -1336,6 +1333,17 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
if (ret_val)
return ret_val;
+ sof_parent = snd_soc_acpi_sof_parent(&pdev->dev);
+
+ /* set card and driver name */
+ if (sof_parent) {
+ byt_rt5640_card.name = SOF_CARD_NAME;
+ byt_rt5640_card.driver_name = SOF_DRIVER_NAME;
+ } else {
+ byt_rt5640_card.name = CARD_NAME;
+ byt_rt5640_card.driver_name = DRIVER_NAME;
+ }
+
ret_val = devm_snd_soc_register_card(&pdev->dev, &byt_rt5640_card);
if (ret_val) {