Commit b27404b2 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ALSA/ASoC/SoundWire: Intel: use single definition for SDW_INTEL_MAX_LINKS

The definitions are currently duplicated in intel-sdw-acpi.c and
sof_sdw.c.  Move the definition to the sdw_intel.h header, and change
the prefix to make it Intel-specific.

No functionality change in this patch.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarPéter Ujfalusi <peter.ujfalusi@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240819005548.5867-2-yung-chuan.liao@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d08ea419
...@@ -447,4 +447,9 @@ extern const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops; ...@@ -447,4 +447,9 @@ extern const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops;
#define SDW_INTEL_DEV_NUM_IDA_MIN 6 #define SDW_INTEL_DEV_NUM_IDA_MIN 6
/*
* Max number of links supported in hardware
*/
#define SDW_INTEL_MAX_LINKS 4
#endif #endif
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include <linux/string.h> #include <linux/string.h>
#define SDW_LINK_TYPE 4 /* from Intel ACPI documentation */ #define SDW_LINK_TYPE 4 /* from Intel ACPI documentation */
#define SDW_MAX_LINKS 4
static int ctrl_link_mask; static int ctrl_link_mask;
module_param_named(sdw_link_mask, ctrl_link_mask, int, 0444); module_param_named(sdw_link_mask, ctrl_link_mask, int, 0444);
...@@ -87,9 +86,9 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info) ...@@ -87,9 +86,9 @@ sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
} }
/* Check count is within bounds */ /* Check count is within bounds */
if (count > SDW_MAX_LINKS) { if (count > SDW_INTEL_MAX_LINKS) {
dev_err(&adev->dev, "Link count %d exceeds max %d\n", dev_err(&adev->dev, "Link count %d exceeds max %d\n",
count, SDW_MAX_LINKS); count, SDW_INTEL_MAX_LINKS);
return -EINVAL; return -EINVAL;
} }
......
...@@ -5,12 +5,14 @@ ...@@ -5,12 +5,14 @@
* sof_sdw - ASOC Machine driver for Intel SoundWire platforms * sof_sdw - ASOC Machine driver for Intel SoundWire platforms
*/ */
#include <linux/acpi.h>
#include <linux/bitmap.h> #include <linux/bitmap.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw.h>
#include <linux/soundwire/sdw_type.h> #include <linux/soundwire/sdw_type.h>
#include <linux/soundwire/sdw_intel.h>
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include "sof_sdw_common.h" #include "sof_sdw_common.h"
#include "../../codecs/rt711.h" #include "../../codecs/rt711.h"
...@@ -883,7 +885,7 @@ static int create_sdw_dailinks(struct snd_soc_card *card, ...@@ -883,7 +885,7 @@ static int create_sdw_dailinks(struct snd_soc_card *card,
struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private; struct intel_mc_ctx *intel_ctx = (struct intel_mc_ctx *)ctx->private;
int ret, i; int ret, i;
for (i = 0; i < SDW_MAX_LINKS; i++) for (i = 0; i < SDW_INTEL_MAX_LINKS; i++)
intel_ctx->sdw_pin_index[i] = SOC_SDW_INTEL_BIDIR_PDI_BASE; intel_ctx->sdw_pin_index[i] = SOC_SDW_INTEL_BIDIR_PDI_BASE;
/* generate DAI links by each sdw link */ /* generate DAI links by each sdw link */
......
...@@ -19,8 +19,6 @@ ...@@ -19,8 +19,6 @@
#define SOC_SDW_MAX_CPU_DAIS 16 #define SOC_SDW_MAX_CPU_DAIS 16
#define SOC_SDW_INTEL_BIDIR_PDI_BASE 2 #define SOC_SDW_INTEL_BIDIR_PDI_BASE 2
#define SDW_MAX_LINKS 4
/* 8 combinations with 4 links + unused group 0 */ /* 8 combinations with 4 links + unused group 0 */
#define SDW_MAX_GROUPS 9 #define SDW_MAX_GROUPS 9
...@@ -57,7 +55,7 @@ enum { ...@@ -57,7 +55,7 @@ enum {
struct intel_mc_ctx { struct intel_mc_ctx {
struct sof_hdmi_private hdmi; struct sof_hdmi_private hdmi;
/* To store SDW Pin index for each SoundWire link */ /* To store SDW Pin index for each SoundWire link */
unsigned int sdw_pin_index[SDW_MAX_LINKS]; unsigned int sdw_pin_index[SDW_INTEL_MAX_LINKS];
}; };
extern unsigned long sof_sdw_quirk; extern unsigned long sof_sdw_quirk;
......
...@@ -5,10 +5,12 @@ ...@@ -5,10 +5,12 @@
* sof_sdw_hdmi - Helpers to handle HDMI from generic machine driver * sof_sdw_hdmi - Helpers to handle HDMI from generic machine driver
*/ */
#include <linux/acpi.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/soundwire/sdw_intel.h>
#include <sound/soc.h> #include <sound/soc.h>
#include <sound/soc-acpi.h> #include <sound/soc-acpi.h>
#include <sound/jack.h> #include <sound/jack.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment