mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Badhri Jagan Sridharan <badhri@google.com>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	 kernel@collabora.com,
	Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: [PATCH 8/8] usb: typec: fusb302: drop custom gpio interrupt logic
Date: Fri, 13 Nov 2026 17:42:44 +0100	[thread overview]
Message-ID: <20261113-fusb302-probe-cleanup-v1-8-e5c65a8c58c8@collabora.com> (raw)
In-Reply-To: <20261113-fusb302-probe-cleanup-v1-0-e5c65a8c58c8@collabora.com>

When the driver was upstreamed it contained the logic to fetch a
"fcs,int_n" GPIO from device-tree, convert it into an interrupt and use
it. This was never part of the binding and there was only a single
upstream user, which got converted to follow the proper bindings in 2020
in commit 89ee3ace7292 ("arm64: dts: rockchip: Fix Pinebook Pro FUSB302
interrupt"). Drop the custom logic and only allow the properly
documented ABI.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 drivers/usb/typec/tcpm/fusb302.c | 39 +++++++++------------------------------
 1 file changed, 9 insertions(+), 30 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index 6105f09f96aa..c392134cdc0c 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -11,7 +11,6 @@
 #include <linux/devm-helpers.h>
 #include <linux/errno.h>
 #include <linux/extcon.h>
-#include <linux/gpio/consumer.h>
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
@@ -86,7 +85,7 @@ struct fusb302_chip {
 	struct work_struct irq_work;
 	bool irq_suspended;
 	bool irq_while_suspended;
-	int gpio_int_n_irq;
+	int irq;
 	struct extcon_dev *extcon;
 
 	struct workqueue_struct *wq;
@@ -1495,7 +1494,7 @@ static irqreturn_t fusb302_irq_intn(int irq, void *dev_id)
 	unsigned long flags;
 
 	/* Disable our level triggered IRQ until our irq_work has cleared it */
-	disable_irq_nosync(chip->gpio_int_n_irq);
+	disable_irq_nosync(chip->irq);
 
 	spin_lock_irqsave(&chip->irq_lock, flags);
 	if (chip->irq_suspended)
@@ -1639,24 +1638,7 @@ static void fusb302_irq_work(struct work_struct *work)
 	}
 done:
 	mutex_unlock(&chip->lock);
-	enable_irq(chip->gpio_int_n_irq);
-}
-
-static int fusb302_init_irq(struct fusb302_chip *chip)
-{
-	struct device *dev = chip->dev;
-	struct gpio_desc *int_gpio;
-	int ret = 0;
-
-	int_gpio = devm_gpiod_get(dev, "fcs,int_n", GPIOD_IN);
-	if (IS_ERR(int_gpio))
-		return dev_err_probe(dev, PTR_ERR(int_gpio), "failed to request interrupt GPIO\n");
-
-	ret = gpiod_to_irq(int_gpio);
-	if (ret < 0)
-		return dev_err_probe(dev, ret, "cannot request IRQ for GPIO\n");
-
-	return ret;
+	enable_irq(chip->irq);
 }
 
 #define PDO_FIXED_FLAGS \
@@ -1751,13 +1733,10 @@ static int fusb302_probe(struct i2c_client *client)
 	if (ret < 0)
 		return ret;
 
-	if (client->irq)
-		chip->gpio_int_n_irq = client->irq;
-	else
-		chip->gpio_int_n_irq = fusb302_init_irq(chip);
-
-	if (chip->gpio_int_n_irq < 0)
-		return chip->gpio_int_n_irq;
+	chip->irq = client->irq;
+	if (!chip->irq)
+		return dev_err_probe(chip->dev, -ENXIO,
+				     "missing interrupt\n");
 
 	chip->tcpc_dev.fwnode = fusb302_fwnode_get(dev);
 	if (IS_ERR(chip->tcpc_dev.fwnode)) {
@@ -1788,7 +1767,7 @@ static int fusb302_probe(struct i2c_client *client)
 	if (ret < 0)
 		return ret;
 
-	ret = devm_request_threaded_irq(dev, chip->gpio_int_n_irq, NULL,
+	ret = devm_request_threaded_irq(dev, chip->irq, NULL,
 					fusb302_irq_intn,
 					IRQF_ONESHOT | IRQF_TRIGGER_LOW,
 					"fsc_interrupt_int_n", chip);
@@ -1805,7 +1784,7 @@ static int fusb302_probe(struct i2c_client *client)
 	if (ret)
 		return ret;
 
-	return devm_pm_set_wake_irq(chip->dev, chip->gpio_int_n_irq);
+	return devm_pm_set_wake_irq(chip->dev, chip->irq);
 }
 
 static int fusb302_pm_suspend(struct device *dev)

-- 
2.53.0


  parent reply	other threads:[~2026-11-13 16:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 16:42 [PATCH 0/8] usb: typec: fusb302: cleanup device driver probe Sebastian Reichel
2026-11-13 16:42 ` [PATCH 1/8] usb: typec: tcpm: allocate pd_list entries non device managed Sebastian Reichel
2026-11-13 16:42 ` [PATCH 2/8] usb: typec: tcpm: add device managed port registration Sebastian Reichel
2026-11-13 16:42 ` [PATCH 3/8] usb: typec: fusb302: Switch to device managed resources Sebastian Reichel
2026-11-13 16:42 ` [PATCH 4/8] usb: typec: fusb302: switch to devm_pm_set_wake_irq Sebastian Reichel
2026-11-13 16:42 ` [PATCH 5/8] usb: typec: fusb302: rename init_gpio into fusb302_init_irq Sebastian Reichel
2026-11-13 16:42 ` [PATCH 6/8] usb: typec: fusb302: move gpio_int_n into function local scope Sebastian Reichel
2026-11-13 16:42 ` [PATCH 7/8] usb: typec: fusb302: rework gpio_int_n_irq handling Sebastian Reichel
2026-11-13 16:42 ` Sebastian Reichel [this message]
2026-11-16  8:32 ` [PATCH 0/8] usb: typec: fusb302: cleanup device driver probe Chaoyi Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261113-fusb302-probe-cleanup-v1-8-e5c65a8c58c8@collabora.com \
    --to=sebastian.reichel@collabora.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®