All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] extcon: usbc-tusb320: Set interrupt polarity based on device-tree
@ 2023-11-21 12:48 Lukas Funke
  2023-11-22  0:54 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Lukas Funke @ 2023-11-21 12:48 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi; +Cc: Lukas Funke, Lukas Funke, linux-kernel

From: Lukas Funke <Lukas.Funke@weidmueller.com>

Remove 'IRQF_TRIGGER_FALLING' request which is not allowed on
every interrupt controller (i.e. arm64 GIC). Replace flag by a 
request that depends on the actual device-tree setting.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
---
 drivers/extcon/extcon-usbc-tusb320.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c
index 4d08c2123e59..f7d699a90f72 100644
--- a/drivers/extcon/extcon-usbc-tusb320.c
+++ b/drivers/extcon/extcon-usbc-tusb320.c
@@ -515,6 +515,8 @@ static int tusb320_probe(struct i2c_client *client)
 	const void *match_data;
 	unsigned int revision;
 	int ret;
+	int irq_pol;
+	struct irq_data *irq_d;
 
 	priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
@@ -568,9 +570,17 @@ static int tusb320_probe(struct i2c_client *client)
 		 */
 		tusb320_state_update_handler(priv, true);
 
+	irq_d = irq_get_irq_data(client->irq);
+	if (!irq_d) {
+		dev_err(&client->dev, "Invalid IRQ: %d\n", client->irq);
+		return -ENODEV;
+	}
+
+	irq_pol = irqd_get_trigger_type(irq_d);
+
 	ret = devm_request_threaded_irq(priv->dev, client->irq, NULL,
 					tusb320_irq_handler,
-					IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
+					IRQF_ONESHOT | irq_pol,
 					client->name, priv);
 	if (ret)
 		tusb320_typec_remove(priv);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-12-04 13:23 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-21 12:48 [PATCH] extcon: usbc-tusb320: Set interrupt polarity based on device-tree Lukas Funke
2023-11-22  0:54 ` kernel test robot
2023-11-22  7:19 ` kernel test robot
2023-11-22  8:07   ` [PATCH v2] " Lukas Funke
2023-12-04 12:09     ` Chanwoo Choi
2023-12-04 12:32     ` Chanwoo Choi
2023-12-04 12:49     ` Chanwoo Choi
2023-12-04 13:22       ` Lukas Funke
2023-11-23  1:54 ` [PATCH] " kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.