Re: [PATCH v4 24/24] platform/chrome: cros_ec: Use PM subsystem to manage wakeirq

Mark Hasemeyer
2024-01-03T22:25:37Z

> The DTS patch would go through the platform maintainer tree and be
> pulled into the soc tree and sent up to mainline from there. The
> platform/chrome patch would go through chrome platform tree and then to
> mainline. The bisection hole will be real.

I thought it would all get merged in the next merge window. How are
bifurcations like this normally dealt with? Does one wait for the
first series of patches to land in mainline before submitting
dependent patches? That could take two merge windows.

> >
> > > Does using the pm wakeirq logic require the use of 'wakeup-source'
> > > property in DT? A quick glance makes me believe it isn't needed, so
> > > please split that part out of this patch as well.
> >
> > No, 'wakeup-source' is not required, it provides an indication to the
> > driver that the IRQ should be used for wake, which then enables the pm
> > subsystem accordingly. If 'wakup-source' is not used, we're back to
> > square one of making assumptions. Specifically in this case, it would
> > be assumed that all SPI based EC's are wake capable.
>
> Is that the wrong assumption to make? My understanding of the DT
> property is that it is used to signal that this device should be treated
> as a wakeup source, when otherwise it isn't treated as one. In this
> case, the device has always been treated as a wakeup source so adding
> the property is redundant.

For SPI, it's not the wrong assumption. I was trying to drop the
assumption though to match ACPI/LPC behavior.

> Making the patch series dependent on the
> property being present makes the driver break without the DT change. We
> try to make drivers work with older DT files, sometimes by adding
> backwards compatibility code, so the presence of the wakeup-source
> property should not be required to make this work.

Do we have use cases where Chromebooks are running older DTBs? I get
the idea in theory, but don't grasp why it's needed here. Regardless,
I can update the SPI code to assume a wake capable IRQ. But I'd like
to keep the prerequisite device tree patches unless there's a good
reason to drop them. Specifying 'wake-source' certainly doesn't hurt
anything, and there are other improvements to the OF
subsystem/documentation.

> What is the goal of this patch series? Is it to allow disabling the
> wakeup capability of the EC wake irq from userspace? I can see a
> possible problem where we want to disable wakeup for the EC dynamically
> because either it has no child devices that are wakeup sources (e.g. no
> power button, no keyboard on ARM) or userspace has disabled all the
> wakeup sources for those child devices at runtime. In that case, we
> would want to keep the EC irq from waking up the system from suspend. Is
> that what you're doing here?

The root of this patch series stems from a bug where spurious wakes
are seen on Skyrim. Copying some wording from the DTS patches:
"Some Chromebooks use a separate wake pin, while others overload the
interrupt for wake and IO. With the current assumption, spurious wakes
can occur on systems that use a separate wake pin. It is planned to
update the driver to no longer assume that the EC interrupt pin should
be enabled for wake."

This patch series will allow us to disable the ec_sync pin as a wake
source on Skyrim as it already uses a dedicated wake gpio.