Skip to content

Commit e55245d

Browse files
pcercueijic23
authored andcommitted
iio: adc: ad7192: Change "shorted" channels to differential
The AD7192 provides a specific channel configuration where both negative and positive inputs are connected to AIN2. This was represented in the ad7192 driver as a IIO channel with .channel = 2 and .extended_name set to "shorted". The problem with this approach, is that the driver provided two IIO channels with the identifier .channel = 2; one "shorted" and the other not. This goes against the IIO ABI, as a channel identifier should be unique. Address this issue by changing "shorted" channels to being differential instead, with channel 2 vs. itself, as we're actually measuring AIN2 vs. itself. Note that the fix tag is for the commit that moved the driver out of staging. The bug existed before that, but backporting would become very complex further down and unlikely to happen. Fixes: b581f74 ("staging: iio: adc: ad7192: move out of staging") Signed-off-by: Paul Cercueil <[email protected]> Co-developed-by: Alisa Roman <[email protected]> Signed-off-by: Alisa Roman <[email protected]> Reviewed-by: Nuno Sa <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
1 parent 79b8ded commit e55245d

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/iio/adc/ad7192.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -897,18 +897,14 @@ static const struct iio_info ad7195_info = {
897897
__AD719x_CHANNEL(_si, _channel1, -1, _address, NULL, IIO_VOLTAGE, \
898898
BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info)
899899

900-
#define AD719x_SHORTED_CHANNEL(_si, _channel1, _address) \
901-
__AD719x_CHANNEL(_si, _channel1, -1, _address, "shorted", IIO_VOLTAGE, \
902-
BIT(IIO_CHAN_INFO_SCALE), ad7192_calibsys_ext_info)
903-
904900
#define AD719x_TEMP_CHANNEL(_si, _address) \
905901
__AD719x_CHANNEL(_si, 0, -1, _address, NULL, IIO_TEMP, 0, NULL)
906902

907903
static const struct iio_chan_spec ad7192_channels[] = {
908904
AD719x_DIFF_CHANNEL(0, 1, 2, AD7192_CH_AIN1P_AIN2M),
909905
AD719x_DIFF_CHANNEL(1, 3, 4, AD7192_CH_AIN3P_AIN4M),
910906
AD719x_TEMP_CHANNEL(2, AD7192_CH_TEMP),
911-
AD719x_SHORTED_CHANNEL(3, 2, AD7192_CH_AIN2P_AIN2M),
907+
AD719x_DIFF_CHANNEL(3, 2, 2, AD7192_CH_AIN2P_AIN2M),
912908
AD719x_CHANNEL(4, 1, AD7192_CH_AIN1),
913909
AD719x_CHANNEL(5, 2, AD7192_CH_AIN2),
914910
AD719x_CHANNEL(6, 3, AD7192_CH_AIN3),
@@ -922,7 +918,7 @@ static const struct iio_chan_spec ad7193_channels[] = {
922918
AD719x_DIFF_CHANNEL(2, 5, 6, AD7193_CH_AIN5P_AIN6M),
923919
AD719x_DIFF_CHANNEL(3, 7, 8, AD7193_CH_AIN7P_AIN8M),
924920
AD719x_TEMP_CHANNEL(4, AD7193_CH_TEMP),
925-
AD719x_SHORTED_CHANNEL(5, 2, AD7193_CH_AIN2P_AIN2M),
921+
AD719x_DIFF_CHANNEL(5, 2, 2, AD7193_CH_AIN2P_AIN2M),
926922
AD719x_CHANNEL(6, 1, AD7193_CH_AIN1),
927923
AD719x_CHANNEL(7, 2, AD7193_CH_AIN2),
928924
AD719x_CHANNEL(8, 3, AD7193_CH_AIN3),

0 commit comments

Comments
 (0)