Skip to content

Commit

Permalink
iio: adc: ad9081: IIO_CHAN_INFO_SAMP_FREQ handle output channels
Browse files Browse the repository at this point in the history
Handle IIO_CHAN_INFO_SAMP_FREQ output channels and use proper macros.

Signed-off-by: Michael Hennerich <[email protected]>
  • Loading branch information
mhennerich committed Aug 16, 2023
1 parent 2d86e70 commit 19a5317
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions drivers/iio/adc/ad9081.c
Original file line number Diff line number Diff line change
Expand Up @@ -2456,7 +2456,7 @@ static int ad9081_read_raw(struct iio_dev *indio_dev,
{
struct axiadc_converter *conv = iio_device_get_drvdata(indio_dev);
struct ad9081_phy *phy = conv->phy;
u8 msb, lsb;
u8 msb, lsb, dir;
u8 cddc_num, cddc_mask, fddc_num, fddc_mask;
u64 freq;

Expand All @@ -2465,15 +2465,15 @@ static int ad9081_read_raw(struct iio_dev *indio_dev,

switch (info) {
case IIO_CHAN_INFO_SAMP_FREQ:
if (!conv->clk)
return -ENODEV;
dir = chan->output ? TX_SAMPL_CLK : RX_SAMPL_CLK;

freq = clk_get_rate_scaled(conv->clk,
&phy->clkscale[RX_SAMPL_CLK]);
if (!phy->clks[dir])
return -ENODEV;

*val = (u32)freq;
*val2 = (u32)(freq >> 32);
freq = clk_get_rate_scaled(phy->clks[dir], &phy->clkscale[dir]);

*val = lower_32_bits(freq);
*val2 = upper_32_bits(freq);
return IIO_VAL_INT_64;
case IIO_CHAN_INFO_ENABLE:
if (chan->output) {
Expand Down

0 comments on commit 19a5317

Please sign in to comment.