[PATCH v5] platform/x86: serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects

Baojun Xu posted 1 patch 5 days, 7 hours ago
drivers/platform/x86/serial-multi-instantiate.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
[PATCH v5] platform/x86: serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects
Posted by Baojun Xu 5 days, 7 hours ago
The tas2781-hda supports multi-projects. In some projects, GpioInt() was
dropped due to no IRQ connection. See the example code below:

Device (SPKR)
{
    Name (_ADR, One)
    Name (_HID, "TXNW2781")
    Method (_CRS, 0, NotSerialized)
    {
        Name (RBUF, ResourceTemplate ()
        {
            I2cSerialBusV2 (0x0038, ...)
            I2cSerialBusV2 (0x0039, ...)
            // GpioInt (Edge, ...) { 0x0000 }
            //"GpioInt (...) {}" was commented out due to no IRQ connection.
        })
        Return (RBUF)
    }
}

But in smi_i2c_probe(), smi_spi_probe() (serial-multi-instantiate.c), if
looking for IRQ by smi_get_irq() fails, it will return an error, will not add
new device, and cause smi_probe() to fail:

[    2.356546] Serial bus multi instantiate pseudo device driver TXNW2781:00:
error -ENXIO: IRQ index 0 not found
[    2.356561] Serial bus multi instantiate pseudo device driver TXNW2781:00:
error -ENXIO: Error requesting irq at index 0

So, we need to add an exception case for these situations. BTW, this patch
will take effect on both I2C and SPI devices.

Signed-off-by: Baojun Xu <baojun.xu@ti.com>
---
v5:
 - Change the description for this patch, remove cover letter.
v4:
 - Change the description for this patch.
v3:
 - Add IRQ_RESOURCE_OPT for IRQ missing cases.
v2:
 - Remove error ignore, change to AUTO compatible with NONE.
---
 drivers/platform/x86/serial-multi-instantiate.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c
index db030b0f176a..1a369334f9cb 100644
--- a/drivers/platform/x86/serial-multi-instantiate.c
+++ b/drivers/platform/x86/serial-multi-instantiate.c
@@ -22,6 +22,7 @@
 #define IRQ_RESOURCE_GPIO	1
 #define IRQ_RESOURCE_APIC	2
 #define IRQ_RESOURCE_AUTO   3
+#define IRQ_RESOURCE_OPT	BIT(2)
 
 enum smi_bus_type {
 	SMI_I2C,
@@ -64,6 +65,10 @@ static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev,
 			dev_dbg(&pdev->dev, "Using platform irq\n");
 			break;
 		}
+		if (inst->flags & IRQ_RESOURCE_OPT) {
+			dev_dbg(&pdev->dev, "No irq\n");
+			return 0;
+		}
 		break;
 	case IRQ_RESOURCE_GPIO:
 		ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx);
@@ -386,10 +391,10 @@ static const struct smi_node cs35l57_hda = {
 
 static const struct smi_node tas2781_hda = {
 	.instances = {
-		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
-		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
-		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
-		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
+		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
+		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
+		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
+		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
 		{}
 	},
 	.bus_type = SMI_AUTO_DETECT,
-- 
2.25.1
Re: [PATCH v5] platform/x86: serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects
Posted by Ilpo Järvinen 3 days, 11 hours ago
On Wed, 26 Nov 2025 22:14:33 +0800, Baojun Xu wrote:

> The tas2781-hda supports multi-projects. In some projects, GpioInt() was
> dropped due to no IRQ connection. See the example code below:
> 
> Device (SPKR)
> {
>     Name (_ADR, One)
>     Name (_HID, "TXNW2781")
>     Method (_CRS, 0, NotSerialized)
>     {
>         Name (RBUF, ResourceTemplate ()
>         {
>             I2cSerialBusV2 (0x0038, ...)
>             I2cSerialBusV2 (0x0039, ...)
>             // GpioInt (Edge, ...) { 0x0000 }
>             //"GpioInt (...) {}" was commented out due to no IRQ connection.
>         })
>         Return (RBUF)
>     }
> }
> 
> [...]


Thank you for your contribution, it has been applied to my local
review-ilpo-next branch. Note it will show up in the public
platform-drivers-x86/review-ilpo-next branch only once I've pushed my
local branch there, which might take a while.

The list of commits applied:
[1/1] platform/x86: serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects
      commit: 1d1b8b0734af5149946e687415bf6be05ae55bd6

--
 i.
Re: [PATCH v5] platform/x86: serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects
Posted by Andy Shevchenko 5 days, 4 hours ago
On Wed, Nov 26, 2025 at 10:14:33PM +0800, Baojun Xu wrote:
> The tas2781-hda supports multi-projects. In some projects, GpioInt() was
> dropped due to no IRQ connection. See the example code below:
> 
> Device (SPKR)
> {
>     Name (_ADR, One)
>     Name (_HID, "TXNW2781")
>     Method (_CRS, 0, NotSerialized)
>     {
>         Name (RBUF, ResourceTemplate ()
>         {
>             I2cSerialBusV2 (0x0038, ...)
>             I2cSerialBusV2 (0x0039, ...)
>             // GpioInt (Edge, ...) { 0x0000 }
>             //"GpioInt (...) {}" was commented out due to no IRQ connection.
>         })
>         Return (RBUF)
>     }
> }
> 
> But in smi_i2c_probe(), smi_spi_probe() (serial-multi-instantiate.c), if
> looking for IRQ by smi_get_irq() fails, it will return an error, will not add
> new device, and cause smi_probe() to fail:
> 
> [    2.356546] Serial bus multi instantiate pseudo device driver TXNW2781:00:
> error -ENXIO: IRQ index 0 not found
> [    2.356561] Serial bus multi instantiate pseudo device driver TXNW2781:00:
> error -ENXIO: Error requesting irq at index 0
> 
> So, we need to add an exception case for these situations. BTW, this patch
> will take effect on both I2C and SPI devices.

Thanks, excellent!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v5] platform/x86: serial-multi-instantiate: Add IRQ_RESOURCE_OPT for IRQ missing projects
Posted by Hans de Goede 5 days, 4 hours ago
Hi,

On 26-Nov-25 3:14 PM, Baojun Xu wrote:
> The tas2781-hda supports multi-projects. In some projects, GpioInt() was
> dropped due to no IRQ connection. See the example code below:
> 
> Device (SPKR)
> {
>     Name (_ADR, One)
>     Name (_HID, "TXNW2781")
>     Method (_CRS, 0, NotSerialized)
>     {
>         Name (RBUF, ResourceTemplate ()
>         {
>             I2cSerialBusV2 (0x0038, ...)
>             I2cSerialBusV2 (0x0039, ...)
>             // GpioInt (Edge, ...) { 0x0000 }
>             //"GpioInt (...) {}" was commented out due to no IRQ connection.
>         })
>         Return (RBUF)
>     }
> }
> 
> But in smi_i2c_probe(), smi_spi_probe() (serial-multi-instantiate.c), if
> looking for IRQ by smi_get_irq() fails, it will return an error, will not add
> new device, and cause smi_probe() to fail:
> 
> [    2.356546] Serial bus multi instantiate pseudo device driver TXNW2781:00:
> error -ENXIO: IRQ index 0 not found
> [    2.356561] Serial bus multi instantiate pseudo device driver TXNW2781:00:
> error -ENXIO: Error requesting irq at index 0
> 
> So, we need to add an exception case for these situations. BTW, this patch
> will take effect on both I2C and SPI devices.
> 
> Signed-off-by: Baojun Xu <baojun.xu@ti.com>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <johannes.goede@oss.qualcomm.com>

Regards,

Hans




> ---
> v5:
>  - Change the description for this patch, remove cover letter.
> v4:
>  - Change the description for this patch.
> v3:
>  - Add IRQ_RESOURCE_OPT for IRQ missing cases.
> v2:
>  - Remove error ignore, change to AUTO compatible with NONE.
> ---
>  drivers/platform/x86/serial-multi-instantiate.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/platform/x86/serial-multi-instantiate.c b/drivers/platform/x86/serial-multi-instantiate.c
> index db030b0f176a..1a369334f9cb 100644
> --- a/drivers/platform/x86/serial-multi-instantiate.c
> +++ b/drivers/platform/x86/serial-multi-instantiate.c
> @@ -22,6 +22,7 @@
>  #define IRQ_RESOURCE_GPIO	1
>  #define IRQ_RESOURCE_APIC	2
>  #define IRQ_RESOURCE_AUTO   3
> +#define IRQ_RESOURCE_OPT	BIT(2)
>  
>  enum smi_bus_type {
>  	SMI_I2C,
> @@ -64,6 +65,10 @@ static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev,
>  			dev_dbg(&pdev->dev, "Using platform irq\n");
>  			break;
>  		}
> +		if (inst->flags & IRQ_RESOURCE_OPT) {
> +			dev_dbg(&pdev->dev, "No irq\n");
> +			return 0;
> +		}
>  		break;
>  	case IRQ_RESOURCE_GPIO:
>  		ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx);
> @@ -386,10 +391,10 @@ static const struct smi_node cs35l57_hda = {
>  
>  static const struct smi_node tas2781_hda = {
>  	.instances = {
> -		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
> -		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
> -		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
> -		{ "tas2781-hda", IRQ_RESOURCE_AUTO, 0 },
> +		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
> +		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
> +		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
> +		{ "tas2781-hda", IRQ_RESOURCE_AUTO | IRQ_RESOURCE_OPT, 0 },
>  		{}
>  	},
>  	.bus_type = SMI_AUTO_DETECT,