Re: [PATCH v3 1/2] PM / wakeirq: support enabling wake-up irq after runtime_suspend called

From: Chunfeng Yun
Date: Sat Oct 23 2021 - 03:08:19 EST


On Sat, 2021-10-23 at 14:35 +0800, Chunfeng Yun wrote:
> On Tue, 2021-10-19 at 17:28 +0200, Rafael J. Wysocki wrote:
> > On Wed, Aug 11, 2021 at 5:05 AM Chunfeng Yun <
> > chunfeng.yun@xxxxxxxxxxxx> wrote:
> > >
> > > When the dedicated wake-irq is level trigger, and it uses the
> > > consumer's sleep status as the wakeup source, that means if the
> > > consumer is not in sleep state, the wake-irq will be triggered
> > > when enable it; For this case, need enable the wake-irq after
> > > invoking the consumer's runtime_suspend() which make the consumer
> > > enter sleep state.
> > [...]
>
> If want to make it static, should move it from wakeirq.c into
> runtime.c
>
> >
> > > {
> > > struct wake_irq *wirq = dev->power.wakeirq;
> > >
> > > if (!wirq || !(wirq->status & WAKE_IRQ_DEDICATED_MASK))
> > > return;
> >
> > And I would just add the following line here:
> >
> > if (cond_disable && (wirq->status &
> > WAKE_IRQ_DEDICATED_LATE_ENABLED))
> > return;
>
> This change doesn't cover the case (WAKE_IRQ_DEDICATED_LATE_ENABLED
> and
> WAKE_IRQ_DEDICATED_MANAGED are both set 1):
>
> -->rpm_suspend(): wirq->irq is enabled
> -->rpm_resume(): disable wirq->irq; (if change it, doesn't disable
> wirq->irq)
Seems I'm wrong, check again.

>
> >
> > >
> > > - if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED)
> > > + if (wirq->status & WAKE_IRQ_DEDICATED_MANAGED &&
> > > + (skip_late_enabled_status ||
> > > + !(wirq->status & WAKE_IRQ_DEDICATED_LATE_ENABLED)))
> > > disable_irq_nosync(wirq->irq);
> > > }
> > >
> > > +/**
> > > + * dev_pm_enable_wake_irq_complete - enable wake irq based on
> > > status
> >