On Tue, Oct 15, 2024 at 01:56:20PM +0000, Guillaume Stols wrote: > @@ -640,6 +665,14 @@ static int ad7606_read_raw(struct iio_dev *indio_dev, > case IIO_CHAN_INFO_OVERSAMPLING_RATIO: > *val = st->oversampling; > return IIO_VAL_INT; > + case IIO_CHAN_INFO_SAMP_FREQ: > + /* > + * TODO: return the real frequency intead of the requested one once > + * pwm_get_state_hw comes upstream. > + */ > + pwm_get_state(st->cnvst_pwm, &cnvst_pwm_state); > + *val = DIV_ROUND_CLOSEST_ULL(NSEC_PER_SEC, cnvst_pwm_state.period); > + return IIO_VAL_INT; > } > return -EINVAL; > } Being late to the party as the patch is already applied: ad7606_set_sampling_freq() uses DIV_ROUND_UP_ULL to determine the period from freq. So I guess you should a down-rounding div here to calculate freq from period. Having said that, pwm_get_state_hw() is in mainline and will be included in v6.13-rc1. Best regards Uwe
Attachment:
signature.asc
Description: PGP signature