public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Stephen Boyd <swboyd@chromium.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	Gwendal Grignou <gwendal@chromium.org>
Subject: Re: [PATCH v2] iio:proximity:sx9324: Fix hardware gain read/write
Date: Sat, 2 Apr 2022 17:51:31 +0100	[thread overview]
Message-ID: <20220402175131.75bb95de@jic23-huawei> (raw)
In-Reply-To: <CAE-0n50T9uqcB9EK-RnGXPGhd6RWdrsE9pA5FJY9yC58xd=05A@mail.gmail.com>

On Tue, 29 Mar 2022 22:25:31 +0200
Stephen Boyd <swboyd@chromium.org> wrote:

> Quoting Jonathan Cameron (2022-03-27 07:51:47)
> > On Thu, 24 Mar 2022 15:29:28 -0700
> > Stephen Boyd <swboyd@chromium.org> wrote:
> >  
> > > There are four possible gain values according to 'sx9324_gain_vals[]':
> > >
> > >       1, 2, 4, and 8
> > >
> > > The values are off by one when writing and reading the register. The
> > > bits should be set according to this equation:
> > >
> > >       ilog2(<gain>) + 1
> > >
> > > so that a gain of 8 is 0x3 in the register field and a gain of 4 is 0x2
> > > in the register field, etc  
> >
> > Example seems wrong...
> >
> > ilog2(8) + 1 = 3 + 1 = 0x4
> > ilog2(4) + 1 = 2 + 1 = 0x3
> > ilog2(2) + 1 = 1 + 1 = 0x2
> > ilog2(1) + 1 = 0 + 1 = 0x1
> >                        0x0 reserved.
> >
> > or have I misunderstood?  
> 
> Nope. I hit the wrong key but your table is correct. Can you fix it when
> applying?

Done and applied to the fixes-togreg branch of iio.git but I haven't pushed
it out yet as I want to rebase that tree on rc1 when it comes out.

After that, please take a quick look check I didn't mess up.

Thanks,

Jonathan

  reply	other threads:[~2022-04-02 16:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 22:29 [PATCH v2] iio:proximity:sx9324: Fix hardware gain read/write Stephen Boyd
2022-03-26 15:45 ` Gwendal Grignou
2022-03-27 14:51 ` Jonathan Cameron
2022-03-29 20:25   ` Stephen Boyd
2022-04-02 16:51     ` Jonathan Cameron [this message]
2022-04-04 20:35       ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220402175131.75bb95de@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=gwendal@chromium.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=swboyd@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox