From: Jonathan Cameron <jic23@kernel.org>
To: Angelo Compagnucci <angelo.compagnucci@gmail.com>,
Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH 1/2] iio: Fix sign extension table in mcp3422 driver
Date: Mon, 04 Nov 2013 20:06:15 +0000 [thread overview]
Message-ID: <5277FE37.5090606@kernel.org> (raw)
In-Reply-To: <CA+TH9VkZROpEd5=OgxNXHs=4DMnb3LMtmtedX+vrYtVzb1jEhw@mail.gmail.com>
On 11/02/13 22:09, Angelo Compagnucci wrote:
> Hi Peter,
>
> You are totally right, index is 0 based and this is a bug!
>
> Thank your for fixing!
If you are happy with a patch that effects your code, the convention is
to reply with
Acked-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
to indicate this in the commit log.
Do you mind me adding that to this patch?
>
> 2013/11/2 Peter Meerwald <pmeerw@pmeerw.net>:
>> the index argument to sign_extend32() gives the bit position (from 0)
>> to the sign bit
>>
>> so e.g. if the measurement has 16-bit resolution, we need to pass 15;
>> a measurement of 0x8000 should be reported as -32768, not 32768
>>
>> Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
>> Cc: Angelo Compagnucci <angelo.compagnucci@gmail.com>
>> ---
>> drivers/iio/adc/mcp3422.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/iio/adc/mcp3422.c b/drivers/iio/adc/mcp3422.c
>> index 1294832..c8c1baa 100644
>> --- a/drivers/iio/adc/mcp3422.c
>> +++ b/drivers/iio/adc/mcp3422.c
>> @@ -88,10 +88,10 @@ static const int mcp3422_sample_rates[4] = {
>>
>> /* sample rates to sign extension table */
>> static const int mcp3422_sign_extend[4] = {
>> - [MCP3422_SRATE_240] = 12,
>> - [MCP3422_SRATE_60] = 14,
>> - [MCP3422_SRATE_15] = 16,
>> - [MCP3422_SRATE_3] = 18 };
>> + [MCP3422_SRATE_240] = 11,
>> + [MCP3422_SRATE_60] = 13,
>> + [MCP3422_SRATE_15] = 15,
>> + [MCP3422_SRATE_3] = 17 };
>>
>> /* Client data (each client gets its own) */
>> struct mcp3422 {
>> --
>> 1.8.4.2
>>
>
>
>
next prev parent reply other threads:[~2013-11-04 19:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-02 19:44 [PATCH 1/2] iio: Fix sign extension table in mcp3422 driver Peter Meerwald
2013-11-02 19:44 ` [PATCH 2/2] iio: Drop scan_type from viperboard adc driver Peter Meerwald
2013-11-09 11:48 ` Jonathan Cameron
2013-11-09 13:52 ` Jonathan Cameron
2013-11-02 22:09 ` [PATCH 1/2] iio: Fix sign extension table in mcp3422 driver Angelo Compagnucci
2013-11-04 20:06 ` Jonathan Cameron [this message]
2013-11-05 7:57 ` Angelo Compagnucci
2013-11-05 13:28 ` Jonathan Cameron
2013-11-05 22:46 ` Jonathan Cameron
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=5277FE37.5090606@kernel.org \
--to=jic23@kernel.org \
--cc=angelo.compagnucci@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.