]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: bytcr_rt5640: Allow quirk set via module option
authorTakashi Iwai <tiwai@suse.de>
Sun, 23 Apr 2017 07:22:56 +0000 (09:22 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 24 Apr 2017 17:48:07 +0000 (18:48 +0100)
The bytcr-rt5640 driver has a few quirk setups depending on the board,
where the quirk value is set by DMI matching.  When you have a new
device to add the support, you often experience to try the different
quirk by trial-and-error.  Or, you may have a development model that
still has no proper DMI string.  In either case, you'd need to compile
the driver at each time.

This patch introduces a module option to override the quirk value on
the fly.  User can boot like snd-soc-sst-bytcr-rt5640.quirk=0x4004 to
override the default value without recompilation.  It's a raw value,
so user needs to check the source code for the meaning of each bit.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/boards/bytcr_rt5640.c

index 5c7219fb3aa86738a49cff98bf6f16693f7a0192..0ac32788f2168848d336ecc13ec491918b23bb9d 100644 (file)
@@ -19,6 +19,7 @@
 
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/platform_device.h>
 #include <linux/acpi.h>
 #include <linux/device.h>
@@ -58,6 +59,9 @@ struct byt_rt5640_private {
 };
 
 static unsigned long byt_rt5640_quirk = BYT_RT5640_MCLK_EN;
+static unsigned int quirk_override;
+module_param_named(quirk, quirk_override, int, 0444);
+MODULE_PARM_DESC(quirk, "Board-specific quirk override");
 
 static void log_quirks(struct device *dev)
 {
@@ -806,6 +810,11 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev)
 
        /* check quirks before creating card */
        dmi_check_system(byt_rt5640_quirk_table);
+       if (quirk_override) {
+               dev_info(&pdev->dev, "Overriding quirk %0x => 0x%x\n",
+                        (unsigned int)byt_rt5640_quirk, quirk_override);
+               byt_rt5640_quirk = quirk_override;
+       }
        log_quirks(&pdev->dev);
 
        if ((byt_rt5640_quirk & BYT_RT5640_SSP2_AIF2) ||