Skip to content

Commit 0b3d96f

Browse files
machschmittnunojsa
authored andcommitted
iio: adc: ad4630: Use NANO to get to the correct sampling frequency
The ad4630 driver calculated the inverse of the PWM period in pico seconds to report the sampling frequency provided by the device. However, that lead to a sampling frequency 1000 higher than the actual one since the PWM period is actually in the nano seconds. Use NANO instead of PICO to correctly calculate the sampling frequency in Hz. Fixes: 8f4838f ("iio: adc: ad4630: Add support for ADAQ4224") Signed-off-by: Marcelo Schmitt <marcelo.schmitt@analog.com>
1 parent 8ba3937 commit 0b3d96f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/iio/adc/ad4630.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ static void ad4630_get_sampling_freq(const struct ad4630_state *st, int *freq)
261261
struct pwm_state conversion_state;
262262

263263
pwm_get_state(st->conv_trigger, &conversion_state);
264-
*freq = DIV_ROUND_CLOSEST_ULL(PICO, conversion_state.period);
264+
*freq = DIV_ROUND_CLOSEST_ULL(NANO, conversion_state.period);
265265
}
266266

267267
static int ad4630_get_chan_gain(struct iio_dev *indio_dev, int ch, int *val)

0 commit comments

Comments
 (0)