Skip to content

Commit

Permalink
iio: adc: cf_axi_adc_core: Fix IIO_VAL_INT_64 value composition
Browse files Browse the repository at this point in the history
Properly cast values.

Fixes: dced6c9 ("iio: adc: cf_axi_adc_core: Support for 64-bit IIO_CHAN_INFO_SAMP_FREQ")

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich committed Aug 16, 2023
1 parent 19a5317 commit dc7f003
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/iio/adc/cf_axi_adc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,8 @@ static int axiadc_read_raw(struct iio_dev *indio_dev,
case IIO_CHAN_INFO_SAMP_FREQ:
*val2 = 0;
ret = conv->read_raw(indio_dev, chan, val, val2, m);
llval = (u64)*val2 << 32 | *val;
llval = (((u64)*val2) << 32) | (u32)*val;

if (ret < 0 || !llval) {
tmp = ADI_TO_CLK_FREQ(axiadc_read(st, ADI_REG_CLK_FREQ));
llval = tmp * 100000000ULL /* FIXME */ * ADI_TO_CLK_RATIO(axiadc_read(st, ADI_REG_CLK_RATIO));
Expand Down

0 comments on commit dc7f003

Please sign in to comment.