soundwire: enable optional clock registers for SoundWire 1.2 devices
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 18 Nov 2022 02:58:07 +0000 (10:58 +0800)
committerVinod Koul <vkoul@kernel.org>
Mon, 9 Jan 2023 16:07:40 +0000 (21:37 +0530)
The bus supports the mandatory clock registers for SDCA devices, these
registers can also be optionally supported by SoundWire 1.2 devices
that don't follow the SDCA class specification.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20221118025807.534863-3-yung-chuan.liao@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/soundwire/bus.c
include/linux/soundwire/sdw.h

index c23275b443acec68ce22fa56606944400c5419df..55d393247a0f05d763dc1adb7ee62c62aad6ba8b 100644 (file)
@@ -1233,10 +1233,11 @@ static int sdw_slave_set_frequency(struct sdw_slave *slave)
 
        /*
         * frequency base and scale registers are required for SDCA
-        * devices. They may also be used for 1.2+/non-SDCA devices,
-        * but we will need a DisCo property to cover this case
+        * devices. They may also be used for 1.2+/non-SDCA devices.
+        * Driver can set the property, we will need a DisCo property
+        * to discover this case from platform firmware.
         */
-       if (!slave->id.class_id)
+       if (!slave->id.class_id && !slave->prop.clock_reg_supported)
                return 0;
 
        if (!mclk_freq) {
index 8fb458931772c057bd191410129d9ca8006b779e..9a49263c53cfa2fcbd56f451393235eb6f63fe97 100644 (file)
@@ -365,6 +365,9 @@ struct sdw_dpn_prop {
  * @sink_dpn_prop: Sink Data Port N properties
  * @scp_int1_mask: SCP_INT1_MASK desired settings
  * @quirks: bitmask identifying deltas from the MIPI specification
+ * @clock_reg_supported: the Peripheral implements the clock base and scale
+ * registers introduced with the SoundWire 1.2 specification. SDCA devices
+ * do not need to set this boolean property as the registers are required.
  */
 struct sdw_slave_prop {
        u32 mipi_revision;
@@ -388,6 +391,7 @@ struct sdw_slave_prop {
        struct sdw_dpn_prop *sink_dpn_prop;
        u8 scp_int1_mask;
        u32 quirks;
+       bool clock_reg_supported;
 };
 
 #define SDW_SLAVE_QUIRKS_INVALID_INITIAL_PARITY        BIT(0)