diff mbox series

[RFC,29/40] soundwire: intel_init: add kernel module parameter to filter out links

Message ID 20190725234032.21152-30-pierre-louis.bossart@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series soundwire: updates for 5.4 | expand

Commit Message

Pierre-Louis Bossart July 25, 2019, 11:40 p.m. UTC
The hardware and ACPI info may report the presence of links that are
not physically enabled (e.g. due to pin-muxing or hardware reworks),
which in turn can result in errors being thrown. This shouldn't be the
case for production devices but will happen a lot on development
devices - even more so when they expose a connector.

Add a module parameter to filter out such links, e.g. adding the
following config to a file in /etc/modprobe.d will select the second
and third links only.

options soundwire_intel_init sdw_link_mask=0x6

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 drivers/soundwire/intel_init.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Cezary Rojewski July 26, 2019, 10:30 a.m. UTC | #1
On 2019-07-26 01:40, Pierre-Louis Bossart wrote:
> @@ -83,6 +87,9 @@ static struct sdw_intel_ctx
>   	caps = ioread32(res->mmio_base + SDW_SHIM_BASE + SDW_SHIM_LCAP);
>   	caps &= GENMASK(2, 0);
>   
> +	dev_dbg(&adev->dev, "SoundWire links: BIOS count %d hardware caps %d\n",
> +		count, caps);
> +
>   	/* Check HW supported vs property value and use min of two */
>   	count = min_t(u8, caps, count);
>   

This message does not look like it belongs to current patch - no 
link_mask dependency whatsoever. There have been couple "informative" 
patches in your series, maybe schedule it with them instead (as a 
separate series)?
Pierre-Louis Bossart July 26, 2019, 2:43 p.m. UTC | #2
On 7/26/19 5:30 AM, Cezary Rojewski wrote:
> On 2019-07-26 01:40, Pierre-Louis Bossart wrote:
>> @@ -83,6 +87,9 @@ static struct sdw_intel_ctx
>>       caps = ioread32(res->mmio_base + SDW_SHIM_BASE + SDW_SHIM_LCAP);
>>       caps &= GENMASK(2, 0);
>> +    dev_dbg(&adev->dev, "SoundWire links: BIOS count %d hardware caps 
>> %d\n",
>> +        count, caps);
>> +
>>       /* Check HW supported vs property value and use min of two */
>>       count = min_t(u8, caps, count);
> 
> This message does not look like it belongs to current patch - no 
> link_mask dependency whatsoever. There have been couple "informative" 
> patches in your series, maybe schedule it with them instead (as a 
> separate series)?

You're right, this log should be in a different patch. it was added when 
I was debugging the DisCo properties a couple of months back and should 
be moved. thanks for noting this.
diff mbox series

Patch

diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index 70637a0383d2..6ae8bb13f907 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -22,6 +22,10 @@ 
 #define SDW_LINK_BASE		0x30000
 #define SDW_LINK_SIZE		0x10000
 
+static int link_mask;
+module_param_named(sdw_link_mask, link_mask, int, 0444);
+MODULE_PARM_DESC(sdw_link_mask, "Intel link mask (one bit per link)");
+
 struct sdw_link_data {
 	struct sdw_intel_link_res res;
 	struct platform_device *pdev;
@@ -83,6 +87,9 @@  static struct sdw_intel_ctx
 	caps = ioread32(res->mmio_base + SDW_SHIM_BASE + SDW_SHIM_LCAP);
 	caps &= GENMASK(2, 0);
 
+	dev_dbg(&adev->dev, "SoundWire links: BIOS count %d hardware caps %d\n",
+		count, caps);
+
 	/* Check HW supported vs property value and use min of two */
 	count = min_t(u8, caps, count);
 
@@ -111,6 +118,13 @@  static struct sdw_intel_ctx
 
 	/* Create SDW Master devices */
 	for (i = 0; i < count; i++) {
+		if (link_mask && !(link_mask & BIT(i))) {
+			dev_dbg(&adev->dev,
+				"Link %d masked, will not be enabled\n", i);
+			link++;
+			continue;
+		}
+
 		link->res.irq = res->irq;
 		link->res.registers = res->mmio_base + SDW_LINK_BASE
 					+ (SDW_LINK_SIZE * i);