linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Caleb Connolly <caleb.connolly@linaro.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	Andy Gross <agross@kernel.org>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Lee Jones <lee.jones@linaro.org>, Stephen Boyd <sboyd@kernel.org>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	Jami Kettunen <jami.kettunen@somainline.org>,
	Sumit Semwal <sumit.semwal@linaro.org>,
	Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Subject: Re: [PATCH v14 02/10] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients
Date: Sun, 1 May 2022 18:28:29 +0100	[thread overview]
Message-ID: <20220501182829.1edc181f@jic23-huawei> (raw)
In-Reply-To: <20220429220904.137297-3-caleb.connolly@linaro.org>

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)
> +{
> +	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


> +
> +	return &spmi->pmic;
>  }
> +EXPORT_SYMBOL(qcom_pmic_get);
>  


  reply	other threads:[~2022-05-01 17:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29 22:08 [PATCH v14 00/10] iio: adc: introduce Qualcomm SPMI Round Robin ADC Caleb Connolly
2022-04-29 22:08 ` [PATCH v14 01/10] spmi: add a helper to look up an SPMI device from a device node Caleb Connolly
2022-05-01 17:23   ` Jonathan Cameron
2022-06-04 16:29     ` Jonathan Cameron
2022-06-14  8:40   ` Stephen Boyd
2022-04-29 22:08 ` [PATCH v14 02/10] mfd: qcom-spmi-pmic: expose the PMIC revid information to clients Caleb Connolly
2022-05-01 17:28   ` Jonathan Cameron [this message]
2022-06-14 10:42     ` Jonathan Cameron
2022-06-15 21:41   ` Lee Jones
2022-06-18 12:58   ` Jonathan Cameron
2022-04-29 22:08 ` [PATCH v14 03/10] mfd: qcom-spmi-pmic: read fab id on supported PMICs Caleb Connolly
2022-06-15 21:40   ` Lee Jones
2022-04-29 22:08 ` [PATCH v14 04/10] dt-bindings: iio: adc: document qcom-spmi-rradc Caleb Connolly
2022-04-30 14:44   ` Krzysztof Kozlowski
2022-04-30 15:00     ` Caleb Connolly
2022-05-01  8:28   ` Krzysztof Kozlowski
2022-06-14 10:45   ` Jonathan Cameron
2022-04-29 22:09 ` [PATCH v14 05/10] iio: adc: qcom-spmi-rradc: introduce round robin adc Caleb Connolly
2022-05-01 17:38   ` Jonathan Cameron
2022-05-09 11:53     ` Caleb Connolly
2022-06-14 10:44       ` Jonathan Cameron
2022-04-29 22:09 ` [PATCH v14 06/10] arm64: dts: qcom: pmi8998: add rradc node Caleb Connolly
2022-04-29 22:09 ` [PATCH v14 07/10] arm64: dts: qcom: sdm845-oneplus: enable rradc Caleb Connolly
2022-04-29 22:09 ` [PATCH v14 08/10] arm64: dts: qcom: sdm845-db845c: " Caleb Connolly
2022-04-29 22:09 ` [PATCH v14 09/10] arm64: dts: qcom: sdm845-xiaomi-beryllium: " Caleb Connolly
2022-04-29 22:09 ` [PATCH v14 10/10] arm64: dts: qcom: msm8998-oneplus-common: enable RRADC Caleb Connolly
2022-06-18 13:09 ` [PATCH v14 00/10] iio: adc: introduce Qualcomm SPMI Round Robin ADC Jonathan Cameron
2022-06-18 13:17   ` Jonathan Cameron
2022-06-18 16:13     ` Caleb Connolly

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220501182829.1edc181f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=caleb.connolly@linaro.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=jami.kettunen@somainline.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=sumit.semwal@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).