Skip to content

Commit afc4ddd

Browse files
xuwd1gregkh
authored andcommitted
platform/x86: serial-multi-instantiate: Auto detect IRQ resource for CSC3551
commit 676b7c5 upstream. The current code assumes that the CSC3551(multiple cs35l41) always have its interrupt pin connected to GPIO thus the IRQ can be acquired with acpi_dev_gpio_irq_get. However on some newer laptop models this is no longer the case as they have the CSC3551's interrupt pin connected to APIC. This causes smi_i2c_probe to fail on these machines. To support these machines, a new macro IRQ_RESOURCE_AUTO was introduced for cs35l41 smi_node, and smi_get_irq function was modified so it tries to get GPIO irq resource first and if failed, tries to get APIC irq resource for cs35l41. This patch affects only the cs35l41's probing and brings no negative influence on machines that indeed have the cs35l41's interrupt pin connected to GPIO. Signed-off-by: David Xu <xuwd1@hotmail.com> Link: https://lore.kernel.org/r/SY4P282MB18350CD8288687B87FFD2243E037A@SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 38b0020 commit afc4ddd

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

drivers/platform/x86/serial-multi-instantiate.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define IRQ_RESOURCE_NONE 0
2222
#define IRQ_RESOURCE_GPIO 1
2323
#define IRQ_RESOURCE_APIC 2
24+
#define IRQ_RESOURCE_AUTO 3
2425

2526
enum smi_bus_type {
2627
SMI_I2C,
@@ -52,6 +53,18 @@ static int smi_get_irq(struct platform_device *pdev, struct acpi_device *adev,
5253
int ret;
5354

5455
switch (inst->flags & IRQ_RESOURCE_TYPE) {
56+
case IRQ_RESOURCE_AUTO:
57+
ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx);
58+
if (ret > 0) {
59+
dev_dbg(&pdev->dev, "Using gpio irq\n");
60+
break;
61+
}
62+
ret = platform_get_irq(pdev, inst->irq_idx);
63+
if (ret > 0) {
64+
dev_dbg(&pdev->dev, "Using platform irq\n");
65+
break;
66+
}
67+
break;
5568
case IRQ_RESOURCE_GPIO:
5669
ret = acpi_dev_gpio_irq_get(adev, inst->irq_idx);
5770
break;
@@ -308,10 +321,10 @@ static const struct smi_node int3515_data = {
308321

309322
static const struct smi_node cs35l41_hda = {
310323
.instances = {
311-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
312-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
313-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
314-
{ "cs35l41-hda", IRQ_RESOURCE_GPIO, 0 },
324+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
325+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
326+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
327+
{ "cs35l41-hda", IRQ_RESOURCE_AUTO, 0 },
315328
{}
316329
},
317330
.bus_type = SMI_AUTO_DETECT,

0 commit comments

Comments
 (0)