]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soundwire: intel_auxdevice: add kernel parameter for mclk divider
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 4 Oct 2024 02:18:50 +0000 (10:18 +0800)
committerVinod Koul <vkoul@kernel.org>
Thu, 10 Oct 2024 12:13:55 +0000 (17:43 +0530)
Add a kernel parameter to work-around discrepancies between hardware
and platform firmware, it's not unusual to see e.g. 38.4MHz listed in
_DSD properties as the SoundWire clock source, but the hardware may be
based on a 19.2 MHz mclk source.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20241004021850.9758-1-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Documentation/admin-guide/kernel-parameters.rst
Documentation/admin-guide/kernel-parameters.txt
drivers/soundwire/intel_auxdevice.c

index fdea7c26ef80403bf561da2c31942aa8d412ba42..a64130fd19bff624e38e77a55c8b088bc9e02568 100644 (file)
@@ -159,6 +159,7 @@ is applicable::
        SCSI    Appropriate SCSI support is enabled.
                        A lot of drivers have their options described inside
                        the Documentation/scsi/ sub-directory.
+        SDW     SoundWire support is enabled.
        SECURITY Different security models are enabled.
        SELINUX SELinux support is enabled.
        SERIAL  Serial support is enabled.
index 1518343bbe2237f1d577df5656339d6224b769be..d7aee9ed5a1d1ecdc8533bbc04af873ebb61a647 100644 (file)
                        non-zero "wait" parameter.  See weight_single
                        and weight_many.
 
+       sdw_mclk_divider=[SDW]
+                       Specify the MCLK divider for Intel SoundWire buses in
+                       case the BIOS does not provide the clock rate properly.
+
        skew_tick=      [KNL,EARLY] Offset the periodic timer tick per cpu to mitigate
                        xtime_lock contention on larger systems, and/or RCU lock
                        contention on all systems with CONFIG_MAXSMP set.
index ae689d5d1ab9eb6b7cb26ba1d28c06c54327e887..599954d9275299882b58711172b6f15614219996 100644 (file)
@@ -41,6 +41,10 @@ static int md_flags;
 module_param_named(sdw_md_flags, md_flags, int, 0444);
 MODULE_PARM_DESC(sdw_md_flags, "SoundWire Intel Master device flags (0x0 all off)");
 
+static int mclk_divider;
+module_param_named(sdw_mclk_divider, mclk_divider, int, 0444);
+MODULE_PARM_DESC(sdw_mclk_divider, "SoundWire Intel mclk divider");
+
 struct wake_capable_part {
        const u16 mfg_id;
        const u16 part_id;
@@ -142,8 +146,12 @@ static int sdw_master_read_intel_prop(struct sdw_bus *bus)
                                 "intel-sdw-ip-clock",
                                 &prop->mclk_freq);
 
-       /* the values reported by BIOS are the 2x clock, not the bus clock */
-       prop->mclk_freq /= 2;
+       if (mclk_divider)
+               /* use kernel parameter for BIOS or board work-arounds */
+               prop->mclk_freq /= mclk_divider;
+       else
+               /* the values reported by BIOS are the 2x clock, not the bus clock */
+               prop->mclk_freq /= 2;
 
        fwnode_property_read_u32(link,
                                 "intel-quirk-mask",