Message ID | 20240617-rk808-show-variant-v1-1-62143a89bafb@cherry.de |
---|---|
State | Accepted |
Commit | c580cb4b8bd305382f16a5bc5074faa34bc53770 |
Delegated to: | Kever Yang |
Headers | show |
Series | [next] power: rk8xx: fix display name for RK808 | expand |
On 2024-06-17 18:48, Quentin Schulz wrote: > From: Quentin Schulz <quentin.schulz@cherry.de> > > Commit 2ce40542e0eb ("power: rk8xx: properly print all supported PMICs > name") fixed all PMICs name that were broken but broke the only one > that > was not broken already: RK808. This one is a special case because the > ID > registers are marked as reserved and always return 0, so the variant > cannot be derived the same way it is done for other PMICs from > Rockchip. > > Fixes: 2ce40542e0eb ("power: rk8xx: properly print all supported PMICs > name") > Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> Looking good to me, but I'd still suggest [1] that reading the MSB/LSB ID registers (i.e. 0x17 and 0x18) is skipped on the RK808 altogether, because the RK808 datasheet lists those two registers as reserved and provides no methods for determining the chip name. Reviewed-by: Dragan Simic <dsimic@manjaro.org> [1] https://lore.kernel.org/u-boot/7ef07d9b9b8a1b9064eb506c96ca8213@manjaro.org/ > --- > Tested on RK3399 Puma. > --- > drivers/power/pmic/rk8xx.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c > index 617bb511e4e..4d5a5ceafad 100644 > --- a/drivers/power/pmic/rk8xx.c > +++ b/drivers/power/pmic/rk8xx.c > @@ -281,6 +281,8 @@ static int rk8xx_probe(struct udevice *dev) > show_variant = bitfield_extract_by_mask(priv->variant, RK8XX_ID_MSK); > switch (priv->variant) { > case RK808_ID: > + /* RK808 ID is 0x0000, so fix show_variant for that PMIC */ > + show_variant = 0x808; > break; > case RK805_ID: > case RK816_ID: > > --- > base-commit: e242cd95130b64cf91692da41363ac59b25fc08d > change-id: 20240617-rk808-show-variant-2121df41caf7 > > Best regards,
Hi Dragan, On 6/17/24 7:57 PM, Dragan Simic wrote: > On 2024-06-17 18:48, Quentin Schulz wrote: >> From: Quentin Schulz <quentin.schulz@cherry.de> >> >> Commit 2ce40542e0eb ("power: rk8xx: properly print all supported PMICs >> name") fixed all PMICs name that were broken but broke the only one that >> was not broken already: RK808. This one is a special case because the ID >> registers are marked as reserved and always return 0, so the variant >> cannot be derived the same way it is done for other PMICs from Rockchip. >> >> Fixes: 2ce40542e0eb ("power: rk8xx: properly print all supported PMICs >> name") >> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> > > Looking good to me, but I'd still suggest [1] that reading the MSB/LSB ID > registers (i.e. 0x17 and 0x18) is skipped on the RK808 altogether, because > the RK808 datasheet lists those two registers as reserved and provides no > methods for determining the chip name. > Rockchip themselves do this, c.f.: https://github.com/rockchip-linux/u-boot/blob/next-dev/drivers/power/pmic/rk8xx.c#L587 I won't send a patch for this, but feel free to send one if you feel like this is really important. > Reviewed-by: Dragan Simic <dsimic@manjaro.org> > Thanks! Quentin
Hello Quentin, On 2024-06-18 11:46, Quentin Schulz wrote: > On 6/17/24 7:57 PM, Dragan Simic wrote: >> On 2024-06-17 18:48, Quentin Schulz wrote: >>> From: Quentin Schulz <quentin.schulz@cherry.de> >>> >>> Commit 2ce40542e0eb ("power: rk8xx: properly print all supported >>> PMICs >>> name") fixed all PMICs name that were broken but broke the only one >>> that >>> was not broken already: RK808. This one is a special case because the >>> ID >>> registers are marked as reserved and always return 0, so the variant >>> cannot be derived the same way it is done for other PMICs from >>> Rockchip. >>> >>> Fixes: 2ce40542e0eb ("power: rk8xx: properly print all supported >>> PMICs name") >>> Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de> >> >> Looking good to me, but I'd still suggest [1] that reading the MSB/LSB >> ID >> registers (i.e. 0x17 and 0x18) is skipped on the RK808 altogether, >> because >> the RK808 datasheet lists those two registers as reserved and provides >> no >> methods for determining the chip name. > > Rockchip themselves do this, c.f.: > > https://github.com/rockchip-linux/u-boot/blob/next-dev/drivers/power/pmic/rk8xx.c#L587 I see, thanks for the reference. > I won't send a patch for this, but feel free to send one if you feel > like this is really important. I'll make a note to implement and send a patch later, after the dust settles on this. I think that the additional correctness warrants such a patch.
diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c index 617bb511e4e..4d5a5ceafad 100644 --- a/drivers/power/pmic/rk8xx.c +++ b/drivers/power/pmic/rk8xx.c @@ -281,6 +281,8 @@ static int rk8xx_probe(struct udevice *dev) show_variant = bitfield_extract_by_mask(priv->variant, RK8XX_ID_MSK); switch (priv->variant) { case RK808_ID: + /* RK808 ID is 0x0000, so fix show_variant for that PMIC */ + show_variant = 0x808; break; case RK805_ID: case RK816_ID: