[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251012194114.094a61a3@jic23-huawei>
Date: Sun, 12 Oct 2025 19:41:14 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Luca Weiss <luca.weiss@...rphone.com>
Cc: David Lechner <dlechner@...libre.com>, Nuno Sá
<nuno.sa@...log.com>, Andy Shevchenko <andy@...nel.org>, "Rafael J.
Wysocki" <rafael@...nel.org>, Daniel Lezcano <daniel.lezcano@...aro.org>,
Zhang Rui <rui.zhang@...el.com>, Lukasz Luba <lukasz.luba@....com>, Rob
Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor
Dooley <conor+dt@...nel.org>, Laxman Dewangan <ldewangan@...dia.com>, Bjorn
Andersson <andersson@...nel.org>, Konrad Dybcio <konradybcio@...nel.org>,
Hans de Goede <hansg@...nel.org>, Jens Reidel <adrian@...nlining.org>,
Casey Connolly <casey.connolly@...aro.org>,
~postmarketos/upstreaming@...ts.sr.ht, phone-devel@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH RFC 3/6] thermal/drivers/generic-adc: Register as IIO
device
On Fri, 10 Oct 2025 13:22:01 +0200
Luca Weiss <luca.weiss@...rphone.com> wrote:
> Register an IIO channel to allow reading the temperature using the IIO
> interface.
>
> Signed-off-by: Luca Weiss <luca.weiss@...rphone.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;
> }
>
>
Powered by blists - more mailing lists