Re: [PATCH v3 2/2] usb: typec: tcpci: set ALERT_MASK register after devm_request_threaded_irq()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 17, 2024 at 10:45:53AM +0100, Francesco Dolcini wrote:
> On Tue, Dec 17, 2024 at 05:41:17PM +0800, Xu Yang wrote:
> > On Tue, Dec 17, 2024 at 10:29:05AM +0100, Francesco Dolcini wrote:
> > > On Tue, Dec 17, 2024 at 05:12:08PM +0800, Xu Yang wrote:
> > > > With edge irq support, the ALERT event may be missed currently. The reason
> > > > is that ALERT_MASK register is written before devm_request_threaded_irq().
> > > > If ALERT event happens in this time gap, it will be missed and ALERT line
> > > > will not recover to high level. However, we don't meet this issue with
> > > > level irq. To avoid the issue, this will set ALERT_MASK register after
> > > > devm_request_threaded_irq() return.
> > > > 
> > > > Fixes: 77e85107a771 ("usb: typec: tcpci: support edge irq")
> > > > Cc: stable@xxxxxxxxxxxxxxx
> > > > Signed-off-by: Xu Yang <xu.yang_2@xxxxxxx>
> > > > 
> > > > ---
> > > > Changes in v3:
> > > >  - remove set_alert_mask flag
> > > > Changes in v2:
> > > >  - new patch
> > > > ---
> > > >  drivers/usb/typec/tcpm/tcpci.c | 17 ++++++++++++-----
> > > >  1 file changed, 12 insertions(+), 5 deletions(-)
> > > > 
> > > > diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
> > > > index db42f4bf3632..48762508cc86 100644
> > > > --- a/drivers/usb/typec/tcpm/tcpci.c
> > > > +++ b/drivers/usb/typec/tcpm/tcpci.c
> > > > @@ -700,7 +700,7 @@ static int tcpci_init(struct tcpc_dev *tcpc)
> > > >  
> > > >  	tcpci->alert_mask = reg;
> > > >  
> > > > -	return tcpci_write16(tcpci, TCPC_ALERT_MASK, reg);
> > > > +	return 0;
> > > 
> > > Should we set the alert mask to 0 at the beginning of tcpci_init() ?
> > > 
> > > Just wondering if some bind/unbind or module reload use case would need
> > > it.
> > 
> > Maybe not needed.
> > 
> > tcpci = devm_kzalloc(dev, sizeof(*tcpci), GFP_KERNEL);
> > 
> > tcpci will be reset to all 0 when allocate the memory. So alert_mask is 0
> > by default.
> 
> I meant
> 
>   tcpci_write16(tcpci, TCPC_ALERT_MASK, 0);
> 
> in tcpci_init().
> 

Still seems not needed.

  err = regmap_raw_write(chip->data.regmap, TCPC_ALERT_MASK, &val, sizeof(u16));

ALERT_MASK will be set to 0 at the start of tcpci_probe()

Thanks,
Xu Yang




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux