ASoC: SOF: Intel: hda: add helper to extract SoundWire link count
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Fri, 2 Jun 2023 20:56:20 +0000 (15:56 -0500)
committerMark Brown <broonie@kernel.org>
Mon, 5 Jun 2023 13:01:00 +0000 (14:01 +0100)
The register changed with the HDaudio integration, the information is
present in the extended link descriptor and not in the SHIM.

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20230602205620.310879-10-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda.c
sound/soc/sof/intel/hda.h

index 835c2568dd60a80b0614fdf27e2aeffc941985dd..066f27e3402f9a0fc706a7c8b5e3342cae09fb02 100644 (file)
@@ -222,6 +222,31 @@ int hda_sdw_check_lcount_common(struct snd_sof_dev *sdev)
        return 0;
 }
 
+int hda_sdw_check_lcount_ext(struct snd_sof_dev *sdev)
+{
+       struct sof_intel_hda_dev *hdev;
+       struct sdw_intel_ctx *ctx;
+       struct hdac_bus *bus;
+       u32 slcount;
+
+       bus = sof_to_bus(sdev);
+
+       hdev = sdev->pdata->hw_pdata;
+       ctx = hdev->sdw;
+
+       slcount = hdac_bus_eml_get_count(bus, true, AZX_REG_ML_LEPTR_ID_SDW);
+
+       /* Check HW supported vs property value */
+       if (slcount < ctx->count) {
+               dev_err(sdev->dev,
+                       "%s: BIOS master count %d is larger than hardware capabilities %d\n",
+                       __func__, ctx->count, slcount);
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
 static int hda_sdw_check_lcount(struct snd_sof_dev *sdev)
 {
        const struct sof_intel_dsp_desc *chip;
index 8ca43303d97f6e814532e251652a2f3c758fce4e..3f7c6fb05e5d7535df0ba5eb6d698229338201ef 100644 (file)
@@ -781,6 +781,7 @@ int hda_dsp_trace_trigger(struct snd_sof_dev *sdev, int cmd);
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
 
 int hda_sdw_check_lcount_common(struct snd_sof_dev *sdev);
+int hda_sdw_check_lcount_ext(struct snd_sof_dev *sdev);
 int hda_sdw_startup(struct snd_sof_dev *sdev);
 void hda_common_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable);
 void hda_sdw_int_enable(struct snd_sof_dev *sdev, bool enable);
@@ -794,6 +795,11 @@ static inline int hda_sdw_check_lcount_common(struct snd_sof_dev *sdev)
        return 0;
 }
 
+static inline int hda_sdw_check_lcount_ext(struct snd_sof_dev *sdev)
+{
+       return 0;
+}
+
 static inline int hda_sdw_startup(struct snd_sof_dev *sdev)
 {
        return 0;