All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: nuno.sa@analog.com
Cc: linux-iio@vger.kernel.org,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v3 04/10] iio: dac: ad5446: Move to single chip_info structures
Date: Fri, 31 Oct 2025 15:47:36 +0200	[thread overview]
Message-ID: <aQS9-NofUjxBoPyu@smile.fi.intel.com> (raw)
In-Reply-To: <20251031-dev-add-ad5542-v3-4-d3541036c0e6@analog.com>

On Fri, Oct 31, 2025 at 12:31:25PM +0000, Nuno Sá via B4 Relay wrote:
> 
> Do not use an array with an enum id kind of thing. Use the more
> maintainable chip_info variable per chip.
> 
> Adapt the probe functions to use the proper helpers (for SPI and I2c).
> Note that in a following patch we'll also add the chip_info variables to
> the of_device_id tables. Hence already use the helpers that internally use
> device_get_match_data().

...

> +static const struct ad5446_chip_info ad5310_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(10, 16, 2),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5320_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 0),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5444_chip_info = {
> +	.channel = AD5446_CHANNEL(12, 16, 2),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5446_chip_info = {
> +	.channel = AD5446_CHANNEL(14, 16, 0),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5450_chip_info = {
> +	.channel = AD5446_CHANNEL(8, 16, 6),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5451_chip_info = {
> +	.channel = AD5446_CHANNEL(10, 16, 4),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5541a_chip_info = {
> +	.channel = AD5446_CHANNEL(16, 16, 0),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5512a_chip_info = {
> +	.channel = AD5446_CHANNEL(12, 16, 4),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5553_chip_info = {
> +	.channel = AD5446_CHANNEL(14, 16, 0),
> +	.write = ad5446_write,
> +};

> +static const struct ad5446_chip_info ad5600_chip_info = {
> +	.channel = AD5446_CHANNEL(16, 16, 0),
> +	.write = ad5446_write,
> +};

Seems same as ad5541a_chip_info(). Do we need duplicates _now_?

> +static const struct ad5446_chip_info ad5601_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(8, 16, 6),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5611_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(10, 16, 4),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5621_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5641_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0),
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5620_2500_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
> +	.int_vref_mv = 2500,
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5620_1250_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(12, 16, 2),
> +	.int_vref_mv = 1250,
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5640_2500_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0),
> +	.int_vref_mv = 2500,
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5640_1250_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(14, 16, 0),
> +	.int_vref_mv = 1250,
> +	.write = ad5446_write,
> +};
> +
> +static const struct ad5446_chip_info ad5660_2500_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0),
> +	.int_vref_mv = 2500,
> +	.write = ad5660_write,
> +};
> +
> +static const struct ad5446_chip_info ad5660_1250_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0),
> +	.int_vref_mv = 1250,
> +	.write = ad5660_write,
> +};
> +
> +static const struct ad5446_chip_info ad5662_chip_info = {
> +	.channel = AD5446_CHANNEL_POWERDOWN(16, 16, 0),
> +	.write = ad5660_write,
>  };

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2025-10-31 13:47 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 12:31 [PATCH v3 00/10] iio: dac: ad5446: Refactor and add support for AD5542 Nuno Sá
2025-10-31 12:31 ` Nuno Sá via B4 Relay
2025-10-31 12:31 ` [PATCH v3 01/10] dt-bindings: iio: dac: Document AD5446 and similar devices Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-11-02  9:18   ` Krzysztof Kozlowski
2025-11-03 10:35     ` Nuno Sá
2025-10-31 12:31 ` [PATCH v3 02/10] iio: dac: ad5446: Use DMA safe buffer for transfers Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-10-31 13:36   ` Andy Shevchenko
2025-10-31 15:00     ` Nuno Sá
2025-10-31 15:07       ` Andy Shevchenko
2025-10-31 15:50         ` Jonathan Cameron
2025-11-03 10:43         ` Nuno Sá
2025-10-31 12:31 ` [PATCH v3 03/10] iio: dac: ad5446: Don't ignore missing regulator Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-10-31 13:40   ` Andy Shevchenko
2025-10-31 13:43     ` Andy Shevchenko
2025-10-31 12:31 ` [PATCH v3 04/10] iio: dac: ad5446: Move to single chip_info structures Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-10-31 13:47   ` Andy Shevchenko [this message]
2025-10-31 15:05     ` Nuno Sá
2025-10-31 15:08       ` Andy Shevchenko
2025-10-31 12:31 ` [PATCH v3 05/10] iio: dac: ad5456: Add missing DT compatibles Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-10-31 12:31 ` [PATCH v3 06/10] iio: dac: ad5446: Separate I2C/SPI into different drivers Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-11-01 16:46   ` Jonathan Cameron
2025-11-03  7:39     ` Andy Shevchenko
2025-11-03 10:40       ` Nuno Sá
2025-11-03 19:30         ` Andy Shevchenko
2025-11-04  7:44           ` Nuno Sá
2025-11-04 14:00             ` Jonathan Cameron
2025-10-31 12:31 ` [PATCH v3 07/10] iio: dac: ad5446: Make use of devm_mutex_init() Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-10-31 12:31 ` [PATCH v3 08/10] iio: dac: ad5446: Make use of the cleanup helpers Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-10-31 12:31 ` [PATCH v3 09/10] iio: dac: ad5446: Fix coding style issues Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay
2025-11-01 16:51   ` Jonathan Cameron
2025-11-03 10:44     ` Nuno Sá
2025-10-31 12:31 ` [PATCH v3 10/10] iio: dac: ad5446: Add AD5542 to the spi id table Nuno Sá
2025-10-31 12:31   ` Nuno Sá via B4 Relay

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=aQS9-NofUjxBoPyu@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.