Re: [PATCH 1/2] usb: chipidea: core: fix device mode not work in non-lpm
From: Xu Yang
Date: Mon Mar 30 2026 - 05:26:49 EST
On Mon, Mar 30, 2026 at 03:14:02PM +0800, Peter Chen (CIX) wrote:
> On 26-03-27 18:54:45, Xu Yang wrote:
> > On Wed, Mar 25, 2026 at 03:08:49PM +0800, Peter Chen (CIX) wrote:
> > > On 26-03-19 17:57:15, Xu Yang wrote:
> > > > In current design, we expect 2 ci_irq() to handle ID and VBUS events in
> > > > usb role switch, like what ci_extcon_wakeup_int() does. Now we only call
> > > > ci_irq() once. However, this won't bring any issues in low power mode,
> > > > because ci_irq() just take the device out of low power mode, and then
> > > > ci_extcon_wakeup_int() will call ci_irq() twice. If the device is not in
> > > > suspend state, the device mode will not work properly because VBUS event
> > > > won'tbe handled (ID event has higher priority) at all.
> > >
> > > %s/won'tbe/won't be
> >
> > OK.
> >
> > >
> > > Is it possible change ci_irq_handler and handle both events?
> >
> > Yes, we can change ci_irq_handler() and let it set both ci->id_event and
> > ci->b_sess_valid_event flags, then queue a ci_otg_work() to handle them
> > later.
> >
> > I think this just unnecessarily call ci_irq_handler() to handle lpm/non-lpm
> > case as the final path is ci_otg_work() and it will handle lpm/non-lpm case
> > by naturally calling pm_runtime_get/put_sync(), otherwise it relies on
> > ci_extcon_wakeup_int() to achieve the same purpose.
> >
> > Both methods work for me, may I know which one do you prefer? :)
>
> My main concerns are below code, and it may confuse the reader.
>
> ci->id_event = true;
> ci->b_sess_valid_event = true;
>
> I may prefer the first option, it is easy to understand.
OK. Thanks for your suggestion. I will rework the patch later.
Best Regards,
Xu Yang