lkml.org 
[lkml]   [2022]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v14 02/10] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients
    On Fri, 29 Apr 2022 23:08:57 +0100
    Caleb Connolly <caleb.connolly@linaro.org> 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@linaro.org>
    > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    > Tested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
    > ---


    > +/**
    > + * 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)
    Missed this in review, but build test of the rradc patch threw it up.
    this should defintely not be inline as it's exported.
    Same for the header definition.

    I'm doing a quick test to see if I can apply this series with relevant
    tweaks. Will get rid of this inline as well.

    Thanks,

    Jonathan

    > +{
    > + 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);
    > +
    > + return &spmi->pmic;
    > }
    > +EXPORT_SYMBOL(qcom_pmic_get);

    \
     
     \ /
      Last update: 2022-06-18 14:49    [W:4.773 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site