From: David Lechner <dlechner@baylibre.com>
To: Angelo Dureghello <adureghello@baylibre.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Jonathan Cameron <jic23@kernel.org>,
Mihail Chindris <mihail.chindris@analog.com>,
Nuno Sa <nuno.sa@analog.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 7/9] iio: dac: ad3552r: share model data structures
Date: Wed, 8 Jan 2025 15:19:12 -0600 [thread overview]
Message-ID: <3803a348-d713-4859-ac52-dbb123a69804@baylibre.com> (raw)
In-Reply-To: <20250108-wip-bl-ad3552r-axi-v0-iio-testing-carlos-v2-7-2dac02f04638@baylibre.com>
On 1/8/25 11:29 AM, Angelo Dureghello wrote:
> From: Angelo Dureghello <adureghello@baylibre.com>
>
> Preparing for new parts to be added also in the hs driver,
> set model data structures in ad3552r-common.c, to be accessible
> from both -hs and non hs driver.
>
> Signed-off-by: Angelo Dureghello <adureghello@baylibre.com>
> ---
> drivers/iio/dac/ad3552r-common.c | 40 ++++++++++++++++++++++++++++++++++++++++
> drivers/iio/dac/ad3552r-hs.c | 8 --------
> drivers/iio/dac/ad3552r.c | 36 ------------------------------------
> drivers/iio/dac/ad3552r.h | 5 +++++
> 4 files changed, 45 insertions(+), 44 deletions(-)
>
> diff --git a/drivers/iio/dac/ad3552r-common.c b/drivers/iio/dac/ad3552r-common.c
> index 03e0864f5084..36920ec95836 100644
> --- a/drivers/iio/dac/ad3552r-common.c
> +++ b/drivers/iio/dac/ad3552r-common.c
> @@ -37,6 +37,46 @@ static const s32 gains_scaling_table[] = {
> [AD3552R_CH_GAIN_SCALING_0_125] = 125
> };
>
> +const struct ad3552r_model_data ad3541r_model_data = {
> + .model_name = "ad3541r",
> + .chip_id = AD3541R_ID,
> + .num_hw_channels = 1,
> + .ranges_table = ad3542r_ch_ranges,
> + .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges),
> + .requires_output_range = true,
> +};
> +EXPORT_SYMBOL_NS_GPL(ad3541r_model_data, "IIO_AD3552R");
> +
> +const struct ad3552r_model_data ad3542r_model_data = {
> + .model_name = "ad3542r",
> + .chip_id = AD3542R_ID,
> + .num_hw_channels = 2,
> + .ranges_table = ad3542r_ch_ranges,
> + .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges),
> + .requires_output_range = true,
> +};
> +EXPORT_SYMBOL_NS_GPL(ad3542r_model_data, "IIO_AD3552R");
> +
> +const struct ad3552r_model_data ad3551r_model_data = {
> + .model_name = "ad3551r",
> + .chip_id = AD3551R_ID,
> + .num_hw_channels = 1,
> + .ranges_table = ad3552r_ch_ranges,
> + .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges),
> + .requires_output_range = false,
> +};
> +EXPORT_SYMBOL_NS_GPL(ad3551r_model_data, "IIO_AD3552R");
> +
> +const struct ad3552r_model_data ad3552r_model_data = {
> + .model_name = "ad3552r",
> + .chip_id = AD3552R_ID,
> + .num_hw_channels = 2,
> + .ranges_table = ad3552r_ch_ranges,
> + .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges),
> + .requires_output_range = false,
> +};
> +EXPORT_SYMBOL_NS_GPL(ad3552r_model_data, "IIO_AD3552R");
> +
> u16 ad3552r_calc_custom_gain(u8 p, u8 n, s16 goffs)
> {
> return FIELD_PREP(AD3552R_MASK_CH_RANGE_OVERRIDE, 1) |
> diff --git a/drivers/iio/dac/ad3552r-hs.c b/drivers/iio/dac/ad3552r-hs.c
> index 991b11702273..bfb6228c9b9b 100644
> --- a/drivers/iio/dac/ad3552r-hs.c
> +++ b/drivers/iio/dac/ad3552r-hs.c
> @@ -527,14 +527,6 @@ static int ad3552r_hs_probe(struct platform_device *pdev)
> return devm_iio_device_register(&pdev->dev, indio_dev);
> }
>
> -static const struct ad3552r_model_data ad3552r_model_data = {
> - .model_name = "ad3552r",
> - .chip_id = AD3552R_ID,
> - .num_hw_channels = 2,
> - .ranges_table = ad3552r_ch_ranges,
> - .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges),
> -};
> -
> static const struct of_device_id ad3552r_hs_of_id[] = {
> { .compatible = "adi,ad3552r", .data = &ad3552r_model_data },
> { }
> diff --git a/drivers/iio/dac/ad3552r.c b/drivers/iio/dac/ad3552r.c
> index e7206af53af6..9d28e06b80c0 100644
> --- a/drivers/iio/dac/ad3552r.c
> +++ b/drivers/iio/dac/ad3552r.c
> @@ -649,42 +649,6 @@ static int ad3552r_probe(struct spi_device *spi)
> return devm_iio_device_register(&spi->dev, indio_dev);
> }
>
> -static const struct ad3552r_model_data ad3541r_model_data = {
> - .model_name = "ad3541r",
> - .chip_id = AD3541R_ID,
> - .num_hw_channels = 1,
> - .ranges_table = ad3542r_ch_ranges,
> - .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges),
> - .requires_output_range = true,
> -};
> -
> -static const struct ad3552r_model_data ad3542r_model_data = {
> - .model_name = "ad3542r",
> - .chip_id = AD3542R_ID,
> - .num_hw_channels = 2,
> - .ranges_table = ad3542r_ch_ranges,
> - .num_ranges = ARRAY_SIZE(ad3542r_ch_ranges),
> - .requires_output_range = true,
> -};
> -
> -static const struct ad3552r_model_data ad3551r_model_data = {
> - .model_name = "ad3551r",
> - .chip_id = AD3551R_ID,
> - .num_hw_channels = 1,
> - .ranges_table = ad3552r_ch_ranges,
> - .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges),
> - .requires_output_range = false,
> -};
> -
> -static const struct ad3552r_model_data ad3552r_model_data = {
> - .model_name = "ad3552r",
> - .chip_id = AD3552R_ID,
> - .num_hw_channels = 2,
> - .ranges_table = ad3552r_ch_ranges,
> - .num_ranges = ARRAY_SIZE(ad3552r_ch_ranges),
> - .requires_output_range = false,
> -};
> -
> static const struct spi_device_id ad3552r_id[] = {
> {
> .name = "ad3541r",
> diff --git a/drivers/iio/dac/ad3552r.h b/drivers/iio/dac/ad3552r.h
> index 4b5581039ae9..23f038464a0c 100644
> --- a/drivers/iio/dac/ad3552r.h
> +++ b/drivers/iio/dac/ad3552r.h
> @@ -137,6 +137,11 @@
> extern const s32 ad3552r_ch_ranges[AD3552R_MAX_RANGES][2];
> extern const s32 ad3542r_ch_ranges[AD3542R_MAX_RANGES][2];
Do the ranges still need to be extern now or can we make them static in
ad3552r-common.c?
>
> +extern const struct ad3552r_model_data ad3541r_model_data;
> +extern const struct ad3552r_model_data ad3542r_model_data;
> +extern const struct ad3552r_model_data ad3551r_model_data;
> +extern const struct ad3552r_model_data ad3552r_model_data;
> +
> enum ad3552r_id {
> AD3541R_ID = 0x400b,
> AD3542R_ID = 0x4009,
>
next prev parent reply other threads:[~2025-01-08 21:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 17:29 [PATCH v2 0/9] iio: ad3552r-hs: add support for ad3541/42r Angelo Dureghello
2025-01-08 17:29 ` [PATCH v2 1/9] iio: dac: ad3552r-common: fix ad3541/2r ranges Angelo Dureghello
2025-01-08 20:43 ` David Lechner
2025-01-12 13:35 ` Jonathan Cameron
2025-01-08 17:29 ` [PATCH v2 2/9] iio: dac: ad3552r-hs: clear reset status flag Angelo Dureghello
2025-01-08 20:51 ` David Lechner
2025-01-12 13:36 ` Jonathan Cameron
2025-01-08 17:29 ` [PATCH v2 3/9] iio: dac: adi-axi-dac: modify stream enable Angelo Dureghello
2025-01-08 21:00 ` David Lechner
2025-01-08 17:29 ` [PATCH v2 4/9] iio: dac: adi-axi-dac: add bus mode setup Angelo Dureghello
2025-01-08 21:06 ` David Lechner
2025-01-08 17:29 ` [PATCH v2 5/9] iio: dac: ad3552r-hs: fix message on wrong chip id Angelo Dureghello
2025-01-12 14:20 ` Jonathan Cameron
2025-01-08 17:29 ` [PATCH v2 6/9] iio: dac: ad3552r-hs: use instruction mode for configuration Angelo Dureghello
2025-01-08 21:16 ` David Lechner
2025-01-09 17:25 ` Angelo Dureghello
2025-01-09 18:04 ` David Lechner
2025-01-08 17:29 ` [PATCH v2 7/9] iio: dac: ad3552r: share model data structures Angelo Dureghello
2025-01-08 21:19 ` David Lechner [this message]
2025-01-08 17:29 ` [PATCH v2 8/9] iio: dac: ad3552r-hs: add ad3541/2r support Angelo Dureghello
2025-01-08 21:37 ` David Lechner
2025-01-12 14:36 ` Jonathan Cameron
2025-01-14 9:18 ` Angelo Dureghello
2025-01-08 17:29 ` [PATCH v2 9/9] iio: dac: ad3552r-hs: update function name (non functional) Angelo Dureghello
2025-01-08 21:39 ` David Lechner
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=3803a348-d713-4859-ac52-dbb123a69804@baylibre.com \
--to=dlechner@baylibre.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=Michael.Hennerich@analog.com \
--cc=adureghello@baylibre.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mihail.chindris@analog.com \
--cc=nuno.sa@analog.com \
/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