Unverified Commit 175fcd15 authored by Mark Brown's avatar Mark Brown
Browse files

ALSA/ASoC/SoundWire: Intel: update maximum number

Merge series from Bard Liao <yung-chuan.liao@linux.intel.com>:

Intel new platforms can have up to 5 SoundWire links.
This series does not apply to SoundWire tree due to recent changes in
machine driver. Can we go via ASoC tree with Vinod's Acked-by tag?
parents 46e21141 1f366283
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -222,6 +222,13 @@ static inline bool sdw_intel_sync_check_cmdsync_unlocked(struct sdw_intel *sdw)
	return false;
}

static inline int sdw_intel_get_link_count(struct sdw_intel *sdw)
{
	if (SDW_INTEL_CHECK_OPS(sdw, get_link_count))
		return SDW_INTEL_OPS(sdw, get_link_count)(sdw);
	return 4; /* default on older generations */
}

/* common bus management */
int intel_start_bus(struct sdw_intel *sdw);
int intel_start_bus_after_reset(struct sdw_intel *sdw);
+20 −0
Original line number Diff line number Diff line
@@ -706,10 +706,30 @@ static void intel_program_sdi(struct sdw_intel *sdw, int dev_num)
			__func__, sdw->instance, dev_num);
}

static int intel_get_link_count(struct sdw_intel *sdw)
{
	int ret;

	ret = hdac_bus_eml_get_count(sdw->link_res->hbus, true, AZX_REG_ML_LEPTR_ID_SDW);
	if (!ret) {
		dev_err(sdw->cdns.dev, "%s: could not retrieve link count\n", __func__);
		return -ENODEV;
	}

	if (ret > SDW_INTEL_MAX_LINKS) {
		dev_err(sdw->cdns.dev, "%s: link count %d exceed max %d\n", __func__, ret, SDW_INTEL_MAX_LINKS);
		return -EINVAL;
	}

	return ret;
}

const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops = {
	.debugfs_init = intel_ace2x_debugfs_init,
	.debugfs_exit = intel_ace2x_debugfs_exit,

	.get_link_count = intel_get_link_count,

	.register_dai = intel_register_dai,

	.check_clock_stop = intel_check_clock_stop,
+14 −0
Original line number Diff line number Diff line
@@ -317,6 +317,20 @@ static int intel_link_probe(struct auxiliary_device *auxdev,
	bus->link_id = auxdev->id;
	bus->clk_stop_timeout = 1;

	/*
	 * paranoia check: make sure ACPI-reported number of links is aligned with
	 * hardware capabilities.
	 */
	ret = sdw_intel_get_link_count(sdw);
	if (ret < 0) {
		dev_err(dev, "%s: sdw_intel_get_link_count failed: %d\n", __func__, ret);
		return ret;
	}
	if (ret <= sdw->instance) {
		dev_err(dev, "%s: invalid link id %d, link count %d\n", __func__, auxdev->id, ret);
		return -EINVAL;
	}

	sdw_cdns_probe(cdns);

	/* Set ops */
+8 −0
Original line number Diff line number Diff line
@@ -388,6 +388,7 @@ struct sdw_intel;
/* struct intel_sdw_hw_ops - SoundWire ops for Intel platforms.
 * @debugfs_init: initialize all debugfs capabilities
 * @debugfs_exit: close and cleanup debugfs capabilities
 * @get_link_count: fetch link count from hardware registers
 * @register_dai: read all PDI information and register DAIs
 * @check_clock_stop: throw error message if clock is not stopped.
 * @start_bus: normal start
@@ -412,6 +413,8 @@ struct sdw_intel_hw_ops {
	void (*debugfs_init)(struct sdw_intel *sdw);
	void (*debugfs_exit)(struct sdw_intel *sdw);

	int (*get_link_count)(struct sdw_intel *sdw);

	int (*register_dai)(struct sdw_intel *sdw);

	void (*check_clock_stop)(struct sdw_intel *sdw);
@@ -447,4 +450,9 @@ extern const struct sdw_intel_hw_ops sdw_intel_lnl_hw_ops;

#define SDW_INTEL_DEV_NUM_IDA_MIN           6

/*
 * Max number of links supported in hardware
 */
#define SDW_INTEL_MAX_LINKS                5

#endif
+2 −3
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
#include <linux/string.h>

#define SDW_LINK_TYPE		4 /* from Intel ACPI documentation */
#define SDW_MAX_LINKS		4

static int ctrl_link_mask;
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)
	}

	/* 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",
			count, SDW_MAX_LINKS);
			count, SDW_INTEL_MAX_LINKS);
		return -EINVAL;
	}

Loading