[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YrWpbcjHSY+se1Aj@gmail.com>
Date: Fri, 24 Jun 2022 14:09:17 +0200
From: Marcus Folkesson <marcus.folkesson@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: Kent Gustavsson <kent@...oris.se>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
linux-iio <linux-iio@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 06/10] iio: adc: mcp3911: add support for oversampling
ratio
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@...il.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
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists