linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcus Folkesson <marcus.folkesson@gmail.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Kent Gustavsson <kent@minoris.se>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 06/10] iio: adc: mcp3911: add support for oversampling ratio
Date: Fri, 24 Jun 2022 14:09:17 +0200	[thread overview]
Message-ID: <YrWpbcjHSY+se1Aj@gmail.com> (raw)
In-Reply-To: <CAHp75Ve+gDa46MRhTR-5dOutGhXqakZbSX14TurwnsuT4OeuYQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2192 bytes --]

On Thu, Jun 23, 2022 at 09:20:01PM +0200, Andy Shevchenko wrote:
> On Thu, Jun 23, 2022 at 9:08 PM Marcus Folkesson
> <marcus.folkesson@gmail.com> wrote:
> >
> > The chip support oversampling ratio so expose it to userspace.
> 
> supports
> 
> ratio, so
> 
> ...

Thanks
> 
> > +static const int mcp3911_osr_table[] = {32, 64, 128, 256, 512, 1024, 2048, 4096};
> 
> Spaces inside {}.

Not sure what you mean?
> 
> ...
> 
> >  }
> >
> > +
> 
> Unwanted blank line.
> 
> ...

Removed
> 
> > +               switch (val) {
> > +               case 4096:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x07);
> > +                       break;
> > +               case 2048:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x06);
> > +                       break;
> > +               case 1024:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x05);
> > +                       break;
> > +               case 512:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x04);
> > +                       break;
> > +               case 256:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x03);
> > +                       break;
> > +               case 128:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x02);
> > +                       break;
> > +               case 64:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x01);
> > +                       break;
> > +               case 32:
> > +                       val = FIELD_PREP(MCP3911_CONFIG_OSR, 0x00);
> > +                       break;
> > +               default:
> > +                       ret = -EINVAL;
> > +                       goto out;
> > +               }
> 
> I understood why the table above, but this is a waste of resources.
> Use that table

Yep, I will use the table instead
> 
> ...
> 
> > +               ret = mcp3911_update(adc, MCP3911_REG_CONFIG,
> > +                               MCP3911_CONFIG_OSR,
> > +                               val, 2);
> 
> sizeof() ?

sizeof() what?


Thanks,
Marcus Folkesson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-06-24 12:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-23 17:08 [PATCH 01/10] iio: adc: mcp3911: correct "microchip,device-addr" property Marcus Folkesson
2022-06-23 17:08 ` [PATCH 02/10] iio: adc: mcp3911: use resource-managed version of iio_device_register Marcus Folkesson
2022-06-23 19:01   ` Andy Shevchenko
2022-06-24  6:29     ` Marcus Folkesson
2022-06-25 11:24       ` Jonathan Cameron
2022-06-28 12:01         ` Andy Shevchenko
2022-06-23 17:08 ` [PATCH 03/10] iio: adc: mcp3911: add support for buffers Marcus Folkesson
2022-06-23 17:08 ` [PATCH 04/10] iio: adc: mcp3911: add support for interrupts Marcus Folkesson
2022-06-23 19:04   ` Andy Shevchenko
2022-06-24 12:01     ` Marcus Folkesson
2022-06-23 17:08 ` [PATCH 05/10] dt-bindings: iio: adc: mcp3911: add microchip,data-ready-hiz entry Marcus Folkesson
2022-06-24  9:54   ` Krzysztof Kozlowski
2022-06-24 12:10     ` Marcus Folkesson
2022-06-24 17:26   ` Rob Herring
2022-06-23 17:08 ` [PATCH 06/10] iio: adc: mcp3911: add support for oversampling ratio Marcus Folkesson
2022-06-23 19:20   ` Andy Shevchenko
2022-06-24 12:09     ` Marcus Folkesson [this message]
2022-06-28 11:56       ` Andy Shevchenko
2022-06-23 17:08 ` [PATCH 07/10] iio: adc: mcp3911: use correct formula for AD conversion Marcus Folkesson
2022-06-23 17:08 ` [PATCH 08/10] iio: adc: mcp3911: add support for phase Marcus Folkesson
2022-06-23 19:07   ` Andy Shevchenko
2022-06-24 12:02     ` Marcus Folkesson
2022-06-25 11:33       ` Jonathan Cameron
2022-06-23 17:08 ` [PATCH 09/10] iio: adc: mcp3911: make use of the sign bit Marcus Folkesson
2022-06-23 17:08 ` [PATCH 10/10] iio: adc: mcp3911: add support to set PGA Marcus Folkesson
2022-06-23 17:26   ` Marcus Folkesson
2022-06-23 19:15   ` Andy Shevchenko
2022-06-24 12:05     ` Marcus Folkesson
2022-06-23 18:59 ` [PATCH 01/10] iio: adc: mcp3911: correct "microchip,device-addr" property Andy Shevchenko

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=YrWpbcjHSY+se1Aj@gmail.com \
    --to=marcus.folkesson@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=kent@minoris.se \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).