ASoC: Intel: bxt_rt298: platform name fixup support
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 25 Jan 2019 20:35:08 +0000 (14:35 -0600)
committerMark Brown <broonie@kernel.org>
Mon, 28 Jan 2019 18:09:28 +0000 (18:09 +0000)
Add helper to override dailink platform name, if passed as parameter

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/bxt_rt298.c

index 27308337ab127a22071369056d471d8c69b1ce81..e91057f83d2058ba97651c95459e262ca064bac8 100644 (file)
@@ -21,6 +21,7 @@
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/soc.h>
+#include <sound/soc-acpi.h>
 #include <sound/jack.h>
 #include <sound/pcm_params.h>
 #include "../../codecs/hdac_hdmi.h"
@@ -576,6 +577,9 @@ static int broxton_audio_probe(struct platform_device *pdev)
        struct bxt_rt286_private *ctx;
        struct snd_soc_card *card =
                        (struct snd_soc_card *)pdev->id_entry->driver_data;
+       struct snd_soc_acpi_mach *mach;
+       const char *platform_name;
+       int ret;
        int i;
 
        for (i = 0; i < ARRAY_SIZE(broxton_rt298_dais); i++) {
@@ -602,6 +606,15 @@ static int broxton_audio_probe(struct platform_device *pdev)
        card->dev = &pdev->dev;
        snd_soc_card_set_drvdata(card, ctx);
 
+       /* override plaform name, if required */
+       mach = (&pdev->dev)->platform_data;
+       platform_name = mach->mach_params.platform;
+
+       ret = snd_soc_fixup_dai_links_platform_name(card,
+                                                   platform_name);
+       if (ret)
+               return ret;
+
        return devm_snd_soc_register_card(&pdev->dev, card);
 }