From: Jonathan Cameron <jic23@kernel.org>
To: Luca Weiss <luca.weiss@fairphone.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
"Daniel Lezcano" <daniel.lezcano@linaro.org>,
"Zhang Rui" <rui.zhang@intel.com>,
"Lukasz Luba" <lukasz.luba@arm.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Laxman Dewangan" <ldewangan@nvidia.com>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konradybcio@kernel.org>,
"Hans de Goede" <hansg@kernel.org>,
"Jens Reidel" <adrian@mainlining.org>,
"Casey Connolly" <casey.connolly@linaro.org>,
~postmarketos/upstreaming@lists.sr.ht,
phone-devel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH RFC 3/6] thermal/drivers/generic-adc: Register as IIO device
Date: Sun, 12 Oct 2025 19:41:14 +0100 [thread overview]
Message-ID: <20251012194114.094a61a3@jic23-huawei> (raw)
In-Reply-To: <20251010-bat-temp-adc-v1-3-d51ec895dac6@fairphone.com>
On Fri, 10 Oct 2025 13:22:01 +0200
Luca Weiss <luca.weiss@fairphone.com> wrote:
> Register an IIO channel to allow reading the temperature using the IIO
> interface.
>
> Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
Just one question below.
> static int gadc_thermal_probe(struct platform_device *pdev)
> {
> struct device *dev = &pdev->dev;
> struct gadc_thermal_info *gti;
> + struct iio_dev *indio_dev;
> + struct gadc_iio *data;
> int ret;
>
> if (!dev->of_node) {
> @@ -153,6 +192,23 @@ static int gadc_thermal_probe(struct platform_device *pdev)
>
> devm_thermal_add_hwmon_sysfs(dev, gti->tz_dev);
>
> + indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
> + if (!indio_dev)
> + return -ENOMEM;
> +
> + data = iio_priv(indio_dev);
> + data->gti = gti;
> +
> + indio_dev->name = pdev->name;
what does this end up as?
obviously we don't really care what name the user space interface we
aren't using advertises but this should be something part number like.
> + indio_dev->modes = INDIO_DIRECT_MODE;
> + indio_dev->info = &gadc_adc_info;
> + indio_dev->channels = gadc_adc_channels;
> + indio_dev->num_channels = ARRAY_SIZE(gadc_adc_channels);
> +
> + ret = devm_iio_device_register(dev, indio_dev);
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to register IIO device\n");
> +
> return 0;
> }
>
>
next prev parent reply other threads:[~2025-10-12 18:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-10 11:21 [PATCH RFC 0/6] Battery temperature ADC plumbing on Qualcomm platforms Luca Weiss
2025-10-10 11:21 ` [PATCH RFC 1/6] iio: adc: qcom-spmi-adc5: Add battery thermal channels Luca Weiss
2025-10-10 11:22 ` [PATCH RFC 2/6] dt-bindings: thermal: generic-adc: Document #io-channel-cells Luca Weiss
2025-10-10 11:22 ` [PATCH RFC 3/6] thermal/drivers/generic-adc: Register as IIO device Luca Weiss
2025-10-12 18:41 ` Jonathan Cameron [this message]
2025-10-10 11:22 ` [PATCH RFC 4/6] thermal/drivers/generic-adc: Allow probe without TZ registration Luca Weiss
2025-10-10 11:22 ` [PATCH RFC 5/6] arm64: dts: qcom: pm7250b: Define battery temperature ADC channels Luca Weiss
2025-10-10 11:22 ` [PATCH RFC 6/6] arm64: dts: qcom: sm7225-fairphone-fp4: Add battery temperature node Luca Weiss
2025-10-10 14:40 ` [PATCH RFC 0/6] Battery temperature ADC plumbing on Qualcomm platforms Nuno Sá
2025-10-10 20:56 ` David Lechner
2025-10-11 9:52 ` Hans de Goede
2025-10-12 18:24 ` Jonathan Cameron
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=20251012194114.094a61a3@jic23-huawei \
--to=jic23@kernel.org \
--cc=adrian@mainlining.org \
--cc=andersson@kernel.org \
--cc=andy@kernel.org \
--cc=casey.connolly@linaro.org \
--cc=conor+dt@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=hansg@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=ldewangan@nvidia.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=luca.weiss@fairphone.com \
--cc=lukasz.luba@arm.com \
--cc=nuno.sa@analog.com \
--cc=phone-devel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=robh@kernel.org \
--cc=rui.zhang@intel.com \
--cc=~postmarketos/upstreaming@lists.sr.ht \
/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).