On Sun, 1 May 2022 18:28:29 +0100 Jonathan Cameron <jic23@xxxxxxxxxx> wrote: > On Fri, 29 Apr 2022 23:08:57 +0100 > Caleb Connolly <caleb.connolly@xxxxxxxxxx> wrote: > > > Some PMIC functions such as the RRADC need to be aware of the PMIC > > chip revision information to implement errata or otherwise adjust > > behaviour, export the PMIC information to enable this. > > > > This is specifically required to enable the RRADC to adjust > > coefficients based on which chip fab the PMIC was produced in, > > this can vary per unique device and therefore has to be read at > > runtime. > > > > Signed-off-by: Caleb Connolly <caleb.connolly@xxxxxxxxxx> > > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > > Tested-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx> > > ... > > > +/** > > + * qcom_pmic_get() - Get a pointer to the base PMIC device > > + * > > + * This function takes a struct device for a driver which is a child of a PMIC. > > + * And locates the PMIC revision information for it. > > + * > > + * @dev: the pmic function device > > + * @return: the struct qcom_spmi_pmic* pointer associated with the function device > > + */ > > +inline const struct qcom_spmi_pmic *qcom_pmic_get(struct device *dev) > > +{ > > + struct spmi_device *sdev; > > + struct qcom_spmi_dev *spmi; > > + > > + /* > > + * Make sure the device is actually a child of a PMIC > > + */ > > + if (!of_match_device(pmic_spmi_id_table, dev->parent)) > > + return ERR_PTR(-EINVAL); > > + > > + sdev = qcom_pmic_get_base_usid(dev->parent); > > > > - if (subtype == PM8110_SUBTYPE) > > - minor = rev2; > > + if (IS_ERR(sdev)) > > + return ERR_CAST(sdev); > > > > - dev_dbg(dev, "%x: %s v%d.%d\n", subtype, name, major, minor); > > + spmi = (struct qcom_spmi_dev *)dev_get_drvdata(&sdev->dev); > > Shouldn't need the cast as dev_get_drvdata() returns void * and you can > implicitly cast that to any other pointer type. > > If this is all that comes up in the series I can fixup whilst applying. > > Jonathan Hi Caleb, Now Stephen has acked the spmi changes, only remaining ack needed is Lee for mfd. Given it's been a while, perhaps best bet is if you do a v15 just wrapping up those minor tweaks and ping Lee to take a look at it when he has time. On off chance Lee just want's to pick it up and push out an immutable branch (rather than me doing the same, I'll give tags for the IIO effecting bits) Thanks, Jonathan > > > > + > > + return &spmi->pmic; > > } > > +EXPORT_SYMBOL(qcom_pmic_get); > > >