Re: [PATCH v2 5/9] reset: google: Add CPM reset driver
From: Philipp Zabel
Date: Thu Nov 26 2026 - 05:00:40 EST
On Mi, 2026-11-25 at 11:15 -0800, Brian Norris wrote:
> On Wed, Nov 25, 2026 at 09:48:04AM +0100, Philipp Zabel wrote:
> > On Di, 2026-11-24 at 16:03 -0800, Brian Norris wrote:
> > > Google Tensor SoCs (used on Pixel phones) manage many resources
> > > (including resets) using a Central Power Manager (CPM) co-processor. We
> > > communicate with CPM using mailboxes, abstracted in the
> > > devm_cpm_get_handle(), etc., API.
> > >
> > > For posterity, I list a summary of changes made relative to the
> > > downstream Pixel driver:
> > >
> > > * Switch to auxiliary bus, as a child of a CPM device
> > >
> > > * Use devm more heavily
> > >
> > > * Avoid representing each reset as its own Device Tree node.
> > >
> > > Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
> > > ---
> > >
> > > Changes in v2:
> > > * Rename symbols from goog_cpm_rst_* to cpm_reset_*
> > > * Moved shared protocol details to CPM driver
> > > * Remove custom reset debugfs interface and .remove callback.
> > > * Remove per-SoC table; we only need naive translation of firmware IDs
> > >
> > > drivers/reset/Kconfig | 1 +
> > > drivers/reset/Makefile | 1 +
> > > drivers/reset/google/Kconfig | 11 +++
> > > drivers/reset/google/Makefile | 2 +
> > > drivers/reset/google/reset-cpm.c | 154 +++++++++++++++++++++++++++++++
> > > 5 files changed, 169 insertions(+)
> > > create mode 100644 drivers/reset/google/Kconfig
> > > create mode 100644 drivers/reset/google/Makefile
> > > create mode 100644 drivers/reset/google/reset-cpm.c
> > >
[...]
> > > diff --git a/drivers/reset/google/reset-cpm.c b/drivers/reset/google/reset-cpm.c
> > > new file mode 100644
> > > index 000000000000..ef0863f25cac
> > > --- /dev/null
> > > +++ b/drivers/reset/google/reset-cpm.c
> > > @@ -0,0 +1,154 @@
[...]
> > > + if (lpcm_id > CPM_RST_ID_MAX)
> >
> > This looks a bit weird.
> >
> > Maybe add a CPM_LPCM_ID_MAX, directly use U8_MAX here, or rename the
> > constant to not include RST_ID?
>
> How about these (with the masks made 8-bit as they should be)?
>
> FIELD_MAX(CPM_RST_LPCM_ID_MASK))
> FIELD_MAX(CPM_RST_ID_MASK))
Even better. I just got tripped up by the comparison between lpcm_id
and what looked like the limit for rst_id.
regards
Philipp