diff mbox series

iio: frequency: adf4371: Fix output frequency setting

Message ID 20190805133716.7808-1-nuno.sa@analog.com (mailing list archive)
State New, archived
Headers show
Series iio: frequency: adf4371: Fix output frequency setting | expand

Commit Message

Nuno Sa Aug. 5, 2019, 1:37 p.m. UTC
The fract1 word was not being properly programmed on the device leading
to wrong output frequencies.

Fixes: 7f699bd14913 (iio: frequency: adf4371: Add support for ADF4371 PLL)
Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 drivers/iio/frequency/adf4371.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Popa, Stefan Serban Aug. 5, 2019, 2:52 p.m. UTC | #1
> The fract1 word was not being properly programmed on the device leading
> to wrong output frequencies.
> 
> Fixes: 7f699bd14913 (iio: frequency: adf4371: Add support for ADF4371
> PLL)
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> ---
>  drivers/iio/frequency/adf4371.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Stefan Popa <stefan.popa@analog.com>
Jonathan Cameron Aug. 5, 2019, 4:40 p.m. UTC | #2
On Mon, 5 Aug 2019 14:52:44 +0000
"Popa, Stefan Serban" <StefanSerban.Popa@analog.com> wrote:

> > The fract1 word was not being properly programmed on the device leading
> > to wrong output frequencies.
> > 
> > Fixes: 7f699bd14913 (iio: frequency: adf4371: Add support for ADF4371
> > PLL)
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > ---
> >  drivers/iio/frequency/adf4371.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)  
> 
> Reviewed-by: Stefan Popa <stefan.popa@analog.com>
> 
Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan
diff mbox series

Patch

diff --git a/drivers/iio/frequency/adf4371.c b/drivers/iio/frequency/adf4371.c
index e48f15cc9ab5..ff82863cbf42 100644
--- a/drivers/iio/frequency/adf4371.c
+++ b/drivers/iio/frequency/adf4371.c
@@ -276,11 +276,11 @@  static int adf4371_set_freq(struct adf4371_state *st, unsigned long long freq,
 	st->buf[0] = st->integer >> 8;
 	st->buf[1] = 0x40; /* REG12 default */
 	st->buf[2] = 0x00;
-	st->buf[3] = st->fract2 & 0xFF;
-	st->buf[4] = st->fract2 >> 7;
-	st->buf[5] = st->fract2 >> 15;
+	st->buf[3] = st->fract1 & 0xFF;
+	st->buf[4] = st->fract1 >> 8;
+	st->buf[5] = st->fract1 >> 16;
 	st->buf[6] = ADF4371_FRAC2WORD_L(st->fract2 & 0x7F) |
-		     ADF4371_FRAC1WORD(st->fract1 >> 23);
+		     ADF4371_FRAC1WORD(st->fract1 >> 24);
 	st->buf[7] = ADF4371_FRAC2WORD_H(st->fract2 >> 7);
 	st->buf[8] = st->mod2 & 0xFF;
 	st->buf[9] = ADF4371_MOD2WORD(st->mod2 >> 8);