From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F1663E63A4 for ; Wed, 29 Jul 2026 07:27:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785310084; cv=none; b=Ix29CoogjPXDJRO0g35dv+x4n2W7kkvWdigysI4cv6is+oA0iQZf7vD4rn2GvkS0ug6rZqcCPZ1WNDzpqYWomPmtjrKMbxbPFqgxQbNxP3prNoHxys0hpgXxRLhUuWYhbsHhbTGzfbs6zBrbiqaVJ4zH83ortoWfUQTy+lNYlCo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785310084; c=relaxed/simple; bh=CWd8WOlX3VtsujVs127e0zN6K5UVvxxaSbGx79AvhtU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZRQE9qdFYo9cTvWlTF9tJnBSv5oExkIyNmfamIR2uWvOQkLbDyZofRI3J4OV/NwOSi6vemzblU1fOiYOTpwa/KdujqEEi6f5hRFH/D/b+imaTeaG5d/9oEoKJE3XdkoIvwt3LFDcrnTAGF6QlJ/eCrn1kN5ayIWZN86b6lLgV30= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk; spf=pass smtp.mailfrom=pqrs.dk; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b=T5PXdQPk; arc=none smtp.client-ip=91.218.175.186 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pqrs.dk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pqrs.dk header.i=@pqrs.dk header.b="T5PXdQPk" Date: Wed, 29 Jul 2026 09:27:25 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=key1; t=1785310066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=flGazc2BReBLinrA2UdYgDf53eJgUEJeLXT/PFsHUuQ=; b=T5PXdQPkU/P6flpcpOVFhNdy9ofhKtwA7A2XbvAiZvSnQ7blkefBiWspKbKYDWyaofXh+g ymmrfTJ+P0axGjIb2xIaEj6TH7u0ooP1VmLTzyyQikNC3KAcpUGp8XefVPfjT9EG6n45jk chD/3Mnf9gxR+CRVWblfn4OMdC/cDRp0gfrhCIZTtni69KDhCj0muHWu9fgkg4MHTgnIBI UKgaL7tmN9A/9sOmYCDlbYTRlQvmywm4xbuWOryCfRVM0abf2oaMoeQ3kX+YDI9+gA5jgx D2iJljpsB3q6YTAL7SWN6C3v2wZ8PuMG0WrVthN4byKYbqaQBb8nhc7fG/P4Mw== X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Alvin =?utf-8?Q?=C5=A0ipraga?= To: Advait Dhamorikar Cc: myungjoo.ham@samsung.com, cw00.choi@samsung.com, linux-kernel@vger.kernel.org, alsi@bang-olufsen.dk, gregkh@linuxfoundation.org, marex@denx.de, heikki.krogerus@linux.intel.com Subject: Re: [PATCH] extcon: usbc-tusb320: always rewrite REG9 to deassert INT_N Message-ID: References: <20260728153744.321743-1-advaitd@mechasystems.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20260728153744.321743-1-advaitd@mechasystems.com> X-Migadu-Flow: FLOW_OUT On Tue, Jul 28, 2026 at 09:07:44PM +0530, Advait Dhamorikar wrote: > The IRQ handler currently returns IRQ_NONE without rewriting REG9 when > INTERRUPT_STATUS is clear, skipping the documented interrupt acknowledge > sequence which says that rewrites to this register are needed for the > INT_N to be correctly asserted for all interrupt events. > > On some hardware, this can leave INT_N asserted, causing repeated > level-triggered interrupts until the kernel disables the IRQ as > spurious. Can you say a bit more about your hardware? You seem to be saying that INT_N is sometimes being asserted when INTERRUPT_STATUS=0, but that is in contradiction with the datasheet, which states that: | When INT_N is pulled low, this bit [INTERRUPT_STATUS] will be 1. (check table 7-7 in [1] or table 9 in [2]) [1] https://www.ti.com/lit/ds/symlink/tusb320.pdf?ts=1785241670013 Taking the datasheet at face value, the driver's logic seems sound to me. I know Marek fought with the interrupt handling of this chip in the past and has some more experience, so perhaps he knows better what you are talking about. > Always rewrite REG9 before returning from the IRQ handler, regardless > of the observed INTERRUPT_STATUS bit, and return IRQ_HANDLED once the > acknowledge sequence has been performed. Also report REG9 write > failures to aid debugging. This will also break support for shared interrupts, should anybody want to add it later on. > > Fixes: 581c848b610d ("extcon: usbc-tusb320: Update state on probe even if no IRQ pending") > Signed-off-by: Advait Dhamorikar > --- > drivers/extcon/extcon-usbc-tusb320.c | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c > index 920b03421850..56c888004f41 100644 > --- a/drivers/extcon/extcon-usbc-tusb320.c > +++ b/drivers/extcon/extcon-usbc-tusb320.c > @@ -375,14 +375,25 @@ static irqreturn_t tusb320_state_update_handler(struct tusb320_priv *priv, > bool force_update) > { > unsigned int reg; > + int ret; > > - if (regmap_read(priv->regmap, TUSB320_REG9, ®)) { > - dev_err(priv->dev, "error during i2c read!\n"); > + ret = regmap_read(priv->regmap, TUSB320_REG9, ®); > + if (ret) { > + dev_err(priv->dev, "REG9 read failed: %d\n", ret); > return IRQ_NONE; > } > > - if (!force_update && !(reg & TUSB320_REG9_INTERRUPT_STATUS)) > - return IRQ_NONE; > + if (!force_update && !(reg & TUSB320_REG9_INTERRUPT_STATUS)) { > + dev_dbg(priv->dev, "IRQ fired but interrupt status not set\n"); Isn't this the equivalent of calling this function with force_update=true from the interrupt handler? And in that case all callsites set it to true, so you could just drop it. > + /* > + * Rewrites to this register are needed for the INT_N > + * to be correctly asserted for all interrupt events. > + */ Even though INTERRUPT_STATUS=0 and you're writing 0 to it here? > + ret = regmap_write(priv->regmap, TUSB320_REG9, reg); > + if (ret) > + dev_err(priv->dev, "REG9 write failed: %d\n", ret); > + return IRQ_HANDLED; > + } > > tusb320_extcon_irq_handler(priv, reg); > > @@ -393,7 +404,9 @@ static irqreturn_t tusb320_state_update_handler(struct tusb320_priv *priv, > if (priv->port) > tusb320_typec_irq_handler(priv, reg); > > - regmap_write(priv->regmap, TUSB320_REG9, reg); > + ret = regmap_write(priv->regmap, TUSB320_REG9, reg); > + if (ret) > + dev_err(priv->dev, "REG9 write failed: %d\n", ret); > > return IRQ_HANDLED; > } > -- > 2.43.0 > Kind regards, Alvin