[PATCH 0/5] ad7780,ad7791,ad7793: localize all IIO channel macro defs

From: Alexandru Ardelean
Date: Wed Mar 18 2020 - 09:37:37 EST


This patchset has 2 intents:
1. We've noticed with newer Sigma-Delta ADCs that the current standard
macros (AD_SD_*_CHANNEL()) for defining IIO channels are too rigid when
adding new parts that have some slight variations. Two examples that
come to mind are AD7124 and AD7192; for the final version of the AD7192
one requirement was to set 'IIO_CHAN_INFO_SCALE' to
'info_mask_shared_by_type_available', which would require a new
AD_SD_*_CHANNEL macro-set
2. Similarly to AD7192, for the AD7793 driver, there is a AD7797 part that
doesn't need 'IIO_CHAN_INFO_SCALE' for
'info_mask_shared_by_type_available'. While other parts do need it.
But the biggest problem in the AD7793 driver, is that we're getting
checkpatch patches that try to fix/break the
'in_voltage-voltage_scale_available' sysfs attribute. So, to get that
driver away from checkpatch's radar, the read_avail hook is used for
AD7793.

This patchset comes with a bit of code duplication, but as it seems, this
duplication is easier to handle.

Alexandru Ardelean (5):
iio: adc: ad7780: define/use own IIO channel macros
iio: adc: ad7791: define/use own IIO channel macros
iio: adc: ad7793: define/use own IIO channel macros
iio: ad_sigma_delta: remove unused IIO channel macros
iio: adc: ad7793: use read_avail iio hook for scale available

drivers/iio/adc/ad7780.c | 27 ++++-
drivers/iio/adc/ad7791.c | 62 +++++++++--
drivers/iio/adc/ad7793.c | 142 ++++++++++++++++++-------
include/linux/iio/adc/ad_sigma_delta.h | 58 ----------
4 files changed, 182 insertions(+), 107 deletions(-)

--
2.20.1