Skip to content

Commit a0d7e98

Browse files
committed
Merge branch 'linux-6.6-trunk/iio/pac1934' into linux-6.6-mchp
2 parents 7d20839 + f219687 commit a0d7e98

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/iio/adc/pac1934.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -787,6 +787,15 @@ static int pac1934_read_raw(struct iio_dev *indio_dev,
787787
s64 curr_energy;
788788
int ret, channel = chan->channel - 1;
789789

790+
/*
791+
* For AVG the index should be between 5 to 8.
792+
* To calculate PAC1934_CH_VOLTAGE_AVERAGE,
793+
* respectively PAC1934_CH_CURRENT real index, we need
794+
* to remove the added offset (PAC1934_MAX_NUM_CHANNELS).
795+
*/
796+
if (channel >= PAC1934_MAX_NUM_CHANNELS)
797+
channel = channel - PAC1934_MAX_NUM_CHANNELS;
798+
790799
ret = pac1934_retrieve_data(info, PAC1934_MIN_UPDATE_WAIT_TIME_US);
791800
if (ret < 0)
792801
return ret;

0 commit comments

Comments
 (0)