[PATCH v1 2/3] regulator: pca9450: add pca9451a support

Alexander Stein alexander.stein at ew.tq-group.com
Tue Oct 17 07:02:09 PDT 2023


Hi,

Am Dienstag, 1. August 2023, 12:17:20 CEST schrieb Joy Zou:
> > -----Original Message-----
> > From: Alexander Stein
> > <alexander.stein at ew.tq-group.com<mailto:alexander.stein at ew.tq-group.com>>
> > 
 Sent: 2023年7月5日 21:13
> > To: Jacky Bai <ping.bai at nxp.com<mailto:ping.bai at nxp.com>>;
> > lgirdwood at gmail.com<mailto:lgirdwood at gmail.com>;
> > broonie at kernel.org<mailto:broonie at kernel.org>;
> > robh+dt at kernel.org<mailto:robh+dt at kernel.org>;
> > krzysztof.kozlowski+dt at linaro.org<mailto:krzysztof.kozlowski+dt at linaro.or
> > g>; conor+dt at kernel.org<mailto:conor+dt at kernel.org>;
> > shawnguo at kernel.org<mailto:shawnguo at kernel.org>;
> > s.hauer at pengutronix.de<mailto:s.hauer at pengutronix.de>;
> > linux-arm-kernel at lists.infradead.org<mailto:linux-arm-kernel at lists.infrad
> > ead.org>; Joy Zou <joy.zou at nxp.com<mailto:joy.zou at nxp.com>> Cc:
> > kernel at pengutronix.de<mailto:kernel at pengutronix.de>;
> > festevam at gmail.com<mailto:festevam at gmail.com>; dl-linux-imx
> > <linux-imx at nxp.com<mailto:linux-imx at nxp.com>>;
> > devicetree at vger.kernel.org<mailto:devicetree at vger.kernel.org>;
> > linux-arm-kernel at lists.infradead.org<mailto:linux-arm-kernel at lists.infrad
> > ead.org>;
> > linux-kernel at vger.kernel.org<mailto:linux-kernel at vger.kernel.org>
> > Subject: [EXT] Re: [PATCH v1 2/3] regulator: pca9450: add pca9451a
> > support>
> >
> >
> > Caution: This is an external email. Please take care when clicking links
> > or
 opening attachments. When in doubt, report the message using the
> > 'Report this email' button
> >
> >
> >
> >
> > Hello,
> >
> >
> >
> > Am Mittwoch, 5. Juli 2023, 08:50:24 CEST schrieb Joy Zou:
> > 
> > >
> > >
> > > > -----Original Message-----
> > > > From: Alexander Stein
> > > > <alexander.stein at ew.tq-group.com<mailto:alexander.stein at ew.tq-group.c
> > > > om>>
 Sent: 2023年5月31日 19:35
> > > > To: Jacky Bai <ping.bai at nxp.com<mailto:ping.bai at nxp.com>>;
> > > > lgirdwood at gmail.com<mailto:lgirdwood at gmail.com>;
> > > > broonie at kernel.org<mailto:broonie at kernel.org>;
> > > > robh+dt at kernel.org<mailto:robh+dt at kernel.org>;
> > > > krzysztof.kozlowski+dt at linaro.org<mailto:krzysztof.kozlowski+dt at linar
> > > > o.org>; conor+dt at kernel.org<mailto:conor+dt at kernel.org>;
> > > > shawnguo at kernel.org<mailto:shawnguo at kernel.org>;
> > > > s.hauer at pengutronix.de<mailto:s.hauer at pengutronix.de>;
> > > > linux-arm-kernel at lists.infradead.org<mailto:linux-arm-kernel at lists.in
> > > > fradead.org> Cc: kernel at pengutronix.de<mailto:kernel at pengutronix.de>;
> > > > festevam at gmail.com<mailto:festevam at gmail.com>; dl-linux-imx
> > > > <linux-imx at nxp.com<mailto:linux-imx at nxp.com>>;
> > > > devicetree at vger.kernel.org<mailto:devicetree at vger.kernel.org>;
> > > > linux-arm-kernel at lists.infradead.org<mailto:linux-arm-kernel at lists.in
> > > > fradead.org>;
> > > > linux-kernel at vger.kernel.org<mailto:linux-kernel at vger.kernel.org>;
> > > > Joy Zou
> >  
> >  <joy.zou at nxp.com<mailto:joy.zou at nxp.com>>
> >  
> > > > Subject: Re: [PATCH v1 2/3] regulator: pca9450: add pca9451a
> > > > support
> > > >
> > > >
> > > >
> > > > Hi,
> > > > 
> > > > > @@ -104,7 +104,15 @@ static const struct regulator_ops
> > > > > pca9450_ldo_regulator_ops = { * 0.60 to 2.1875V (12.5mV step)
> > > > >
> > > > >
> > > > >
> > > > >   */
> > > > >
> > > > >
> > > > >
> > > > >  static const struct linear_range pca9450_dvs_buck_volts[] = {
> > > > >
> > > > >
> > > > >
> > > > > -     REGULATOR_LINEAR_RANGE(600000,  0x00, 0x7F, 12500),
> > > > > +     REGULATOR_LINEAR_RANGE(600000, 0x00, 0x7F, 12500), };
> > > > > +
> > > > > +/*
> > > > > + * BUCK1/3
> > > > > + * 0.65 to 2.2375V (12.5mV step)
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > Reading this comment, it seems the same distinction needs to be done
> > > > for
> > > > BUCK3 as well, no?
> > >
> > >
> > >
> > > Sorry for the late reply!
> > > The BUCK1 and BUCK3 are dual phase, so don't need to be done for BUCK3.
> > >
> > >
> > >
> > > >
> > > >
> > > >
> > > > > + */
> > > > > +static const struct linear_range pca9450_trim_dvs_buck_volts[] = {
> > > > > +     REGULATOR_LINEAR_RANGE(650000, 0x00, 0x7F, 12500),
> > > > >
> > > > >
> > > > >
> > > > >  };
> 
> 
> 
> > > > > @@ -708,8 +917,9 @@ static int pca9450_i2c_probe(struct i2c_client
> > > > > *i2c)
> > > > >
> > > > >
> > > > >
> > > > >       const struct pca9450_regulator_desc     *regulator_desc;
> > > > >       struct regulator_config config = { };
> > > > >       struct pca9450 *pca9450;
> > > > >
> > > > >
> > > > >
> > > > > -     unsigned int device_id, i;
> > > > > +     unsigned int device_id, i, val;
> > > > >
> > > > >
> > > > >
> > > > >       unsigned int reset_ctrl;
> > > > >
> > > > >
> > > > >
> > > > > +     bool pmic_trim = false;
> > > > >
> > > > >
> > > > >
> > > > >       int ret;
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >       if (!i2c->irq) {
> > > > >
> > > > >
> > > > >
> > > > > @@ -721,6 +931,22 @@ static int pca9450_i2c_probe(struct
> > > > > i2c_client
> > > > > *i2c)
> > > > >
> > > > >
> > > > >
> > > > >       if (!pca9450)
> > > > >
> > > > >
> > > > >
> > > > >               return -ENOMEM;
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > +     pca9450->regmap = devm_regmap_init_i2c(i2c,
> > > > > +
> > > >
> > > >
> > > >
> > > > &pca9450_regmap_config);
> > > >
> > > >
> > > >
> > > > > +     if (IS_ERR(pca9450->regmap)) {
> > > > > +             dev_err(&i2c->dev, "regmap initialization failed\n");
> > > > > +             return PTR_ERR(pca9450->regmap);
> > > > > +     }
> > > > > +
> > > > > +     ret = regmap_read(pca9450->regmap, PCA9450_REG_PWRCTRL,
> > > >
> > > >
> > > >
> > > > &val);
> > > >
> > > >
> > > >
> > > > > +     if (ret) {
> > > > > +             dev_err(&i2c->dev, "Read device id error\n");
> > > > > +             return ret;
> > > > > +     }
> > > > > +
> > > > > +     if (val & PCA9450_REG_PWRCTRL_TOFF_DEB)
> > > > > +             pmic_trim = true;
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > PCA9450_REG_PWRCTRL is a read/write register. How is it possible to
> > > > detect a chip revision using a bit which can be changed by software
> > > > e.g.
> > > > bootloader? Despite that this bit sets debounce time for
> > > > PMIC_ON_REQ, how is this related to BUCK1 voltage range?
> > >
> > >
> > >
> > > There are old and new two kind PMIC pca9451a.
> >
> >
> >
> > There is only one part mentioned in the ordering options. How can I
> > distinguish them? Any chip ID, date codes, markings?
> 
> Yes, there is only one part. We distinguish the new and old part by this
> bit
 Toff_Deb of PCA9450_REG_PWRCTRL reset value. The reset value 0 means
> it's old part, and the reset value 1 means it's new part.

Is the "old" part by coincidence an unofficial prerelease/sample chip?

> >
> >
> > > This bit sets debounce time in
> > > PCA9450_REG_PWRCTRL was set different value by hardware in order to
> > > only distinguish the old and new PMIC. This bit isn't related to the
> > > BUCK1 voltage range. If the pmic_trim is true that means it's new
> > > pca9451a.
>
> >
> >
> > But this bit is writable. How do you know it has not been modified since
> > reset?
> Yes, we don't consider modify the debounce bit case. Modify the Toff_deb
> value
 will influence the old and new part judgement.

This judgement seems broken to me. How can I know offline whether I have old 
or new parts? I would like to know if there is a difference on some my boards.

> For example, this default value of Toff_deb is 1 in the new part, if the
> customers
 change the Toff_deb value from 1 to 0, and then make the board
> warm reset, the Toff_deb value still keep 0, if the Toff_deb value is 0,
> the PMIC driver will think this part is old part. But this part is new part
> in fact.

This should show you it's a bad idea to decide the chip revision depending on 
Toff_deb.

> Have discussed this issue with our internal team member, we will add a note
> to PCA9451
 datasheet – “Please contract NXP If you want to change
> Toff_deb.” But till now, we am not aware any customers case which need to
> adjust Toff_deb.
> 
> Make it more clear: If customers do need to manually adjust Toff_deb, It
> need PMIC driver
 update to bypass this bit check and directly apply
> corresponding voltage config table old or new. Thank you very much for your
> comments and efforts.

In this case I need to know if I use old, new or both revision of these parts.

Best regards,
Alexander
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/





More information about the linux-arm-kernel mailing list