Re: [PATCH v4] usb: ohci-omap: implement overcurrent handling for GPIO-based power control

From: Greg KH

Date: Mon Oct 19 2026 - 02:47:20 EST


On Mon, Oct 19, 2026 at 02:03:12AM +0330, Muhammad Mahdi Amirpour wrote:
> The OMAP OHCI driver has had optional GPIO lines for VBUS power control
> and overcurrent detection since the gpiolib conversion, but the
> overcurrent line was never wired up — it was marked with a TODO comment.
>
> On boards like the OMAP1 OSK, the VBUS power switch (TPS2045) is
> controlled via a TPS65010 GPIO, and overcurrent is reported on a
> separate GPIO. Without this patch, an overcurrent condition is not
> detected by software and VBUS power is not cut, relying solely on the
> hardware current limiter.
>
> This patch implements the missing overcurrent handling:
> - Requests a threaded IRQ on the overcurrent GPIO (both edges)
> - Cuts VBUS power via the power GPIO when overcurrent is detected
> - Reports overcurrent status and change through the root hub port
> status callbacks so the USB hub core can react
> - Handles SetPortFeature/ClearPortFeature(POWER) to drive the VBUS
> GPIO alongside the OHCI hardware register
> - Turns off VBUS on driver removal and probe failure
>
> Signed-off-by: Muhammad Mahdi Amirpour <ampr.mhd@xxxxxxxxx>
> ---
> v4:
> - Remove spinlock entirely; use READ_ONCE/WRITE_ONCE for the
> overcurrent flags (Greg KH). This also fixes the bug where
> gpiod_set_value_cansleep() was called under spin_lock_irqsave(),
> which sleeps on the I2C-attached TPS65010 (Sashiko).

Are you sure this is correct? You never responded to my previous review
comments here, just submitted a new version which is a bit odd...

thanks,

greg k-h