All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <linux-iio@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<lars@metafoo.de>
Subject: Re: [PATCH v2 1/5] iio: adc: ad7780: define/use own IIO channel macros
Date: Sat, 21 Mar 2020 16:50:53 +0000	[thread overview]
Message-ID: <20200321165053.0af56ffe@archlinux> (raw)
In-Reply-To: <20200321090802.11537-1-alexandru.ardelean@analog.com>

On Sat, 21 Mar 2020 11:07:58 +0200
Alexandru Ardelean <alexandru.ardelean@analog.com> wrote:

> This change gets rid of the AD_SD_*_CHANNEL macros in favor of defining
> it's own. The ad7780 is quite simpler than it's other Sigma-Delta brothers.
> 
> It turned out that centralizing the AD_SD_*_CHANNEL macros doesn't scale
> too well, especially with some more complicated drivers. Some of the
> variations in the more complicated drivers require new macros, and that way
> things can become harder to maintain.
> 
> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>

Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan

> ---
> 
> Changelog v1 -> v2:
> * re-send + change author @analog.com; GMail messed it up
> 
>  drivers/iio/adc/ad7780.c | 27 +++++++++++++++++++++++----
>  1 file changed, 23 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/adc/ad7780.c b/drivers/iio/adc/ad7780.c
> index 291c1a898129..f47606ebbbbe 100644
> --- a/drivers/iio/adc/ad7780.c
> +++ b/drivers/iio/adc/ad7780.c
> @@ -206,10 +206,29 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
>  	.irq_flags = IRQF_TRIGGER_LOW,
>  };
>  
> -#define AD7780_CHANNEL(bits, wordsize) \
> -	AD_SD_CHANNEL(1, 0, 0, bits, 32, (wordsize) - (bits))
> -#define AD7170_CHANNEL(bits, wordsize) \
> -	AD_SD_CHANNEL_NO_SAMP_FREQ(1, 0, 0, bits, 32, (wordsize) - (bits))
> +#define _AD7780_CHANNEL(_bits, _wordsize, _mask_all)		\
> +{								\
> +	.type = IIO_VOLTAGE,					\
> +	.indexed = 1,						\
> +	.channel = 0,						\
> +	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |		\
> +		BIT(IIO_CHAN_INFO_OFFSET),			\
> +	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),	\
> +	.info_mask_shared_by_all = _mask_all,			\
> +	.scan_index = 1,					\
> +	.scan_type = {						\
> +		.sign = 'u',					\
> +		.realbits = (_bits),				\
> +		.storagebits = 32,				\
> +		.shift = (_wordsize) - (_bits),			\
> +		.endianness = IIO_BE,				\
> +	},							\
> +}
> +
> +#define AD7780_CHANNEL(_bits, _wordsize)	\
> +	_AD7780_CHANNEL(_bits, _wordsize, BIT(IIO_CHAN_INFO_SAMP_FREQ))
> +#define AD7170_CHANNEL(_bits, _wordsize)	\
> +	_AD7780_CHANNEL(_bits, _wordsize, 0)
>  
>  static const struct ad7780_chip_info ad7780_chip_info_tbl[] = {
>  	[ID_AD7170] = {


      parent reply	other threads:[~2020-03-21 16:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21  9:07 [PATCH v2 1/5] iio: adc: ad7780: define/use own IIO channel macros Alexandru Ardelean
2020-03-21  9:07 ` [PATCH v2 2/5] iio: adc: ad7791: " Alexandru Ardelean
2020-03-21 16:51   ` Jonathan Cameron
2020-03-21  9:08 ` [PATCH v2 3/5] iio: adc: ad7793: " Alexandru Ardelean
2020-03-21 16:52   ` Jonathan Cameron
2020-03-21  9:08 ` [PATCH v2 4/5] iio: ad_sigma_delta: remove unused " Alexandru Ardelean
2020-03-21 16:53   ` Jonathan Cameron
2020-03-21  9:08 ` [PATCH v2 5/5] iio: adc: ad7793: use read_avail iio hook for scale available Alexandru Ardelean
2020-03-21 16:57   ` Jonathan Cameron
2020-03-22  9:38     ` Ardelean, Alexandru
2020-03-21 19:37   ` Andy Shevchenko
2020-03-22  9:18     ` Ardelean, Alexandru
2020-03-22 15:15       ` Jonathan Cameron
2020-03-21 16:50 ` Jonathan Cameron [this message]

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=20200321165053.0af56ffe@archlinux \
    --to=jic23@kernel.org \
    --cc=alexandru.ardelean@analog.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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 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.