linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Betker <thomas.betker@freenet.de>
To: linux-iio@vger.kernel.org
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	"Michal Simek" <michal.simek@xilinx.com>,
	"Sören Brinkmann" <soren.brinkmann@xilinx.com>,
	"Thomas Betker" <thomas.betker@rohde-schwarz.com>
Subject: [PATCH 4/5] iio: adc: xilinx: Fix VREFN sign
Date: Wed, 15 Apr 2015 21:11:50 +0200	[thread overview]
Message-ID: <1429125111-2926-5-git-send-email-thomas.betker@freenet.de> (raw)
In-Reply-To: <1429125111-2926-1-git-send-email-thomas.betker@freenet.de>

From: Thomas Betker <thomas.betker@rohde-schwarz.com>

The VREFN channel is bipolar, not unipolar. Small negative values do
occur (e.g., -1mV), and unsigned conversion maps them incorrectly to
large positive values (about +1V), so fix this.

Signed-off-by: Thomas Betker <thomas.betker@rohde-schwarz.com>
---
 drivers/iio/adc/xilinx-xadc-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/xilinx-xadc-core.c b/drivers/iio/adc/xilinx-xadc-core.c
index 6fa629b..ce93bd8 100644
--- a/drivers/iio/adc/xilinx-xadc-core.c
+++ b/drivers/iio/adc/xilinx-xadc-core.c
@@ -997,7 +997,7 @@ static const struct iio_event_spec xadc_voltage_events[] = {
 	.num_event_specs = (_alarm) ? ARRAY_SIZE(xadc_voltage_events) : 0, \
 	.scan_index = (_scan_index), \
 	.scan_type = { \
-		.sign = 'u', \
+		.sign = ((_addr) == XADC_REG_VREFN) ? 's' : 'u', \
 		.realbits = 12, \
 		.storagebits = 16, \
 		.shift = 4, \
-- 
1.7.9.5

  parent reply	other threads:[~2015-04-15 19:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-15 19:11 [Patch 0/5] iio: adc: xilinx: Fix some minor issues Thomas Betker
2015-04-15 19:11 ` [PATCH 1/5] iio: adc: xilinx: Fix register addresses Thomas Betker
2015-04-19 12:48   ` Jonathan Cameron
2015-04-15 19:11 ` [PATCH 2/5] iio: adc: xilinx: Fix "vccaux" channel .address Thomas Betker
2015-04-19 12:51   ` Jonathan Cameron
2015-04-15 19:11 ` [PATCH 3/5] iio: adc: xilinx: Fix VREFP scale Thomas Betker
2015-04-19 12:51   ` Jonathan Cameron
2015-06-26 21:55   ` Hartmut Knaack
2015-06-30 10:56     ` Thomas.Betker
2015-07-01 18:30       ` Hartmut Knaack
2015-07-03  7:52         ` Thomas.Betker
2015-04-15 19:11 ` Thomas Betker [this message]
2015-04-19 12:52   ` [PATCH 4/5] iio: adc: xilinx: Fix VREFN sign Jonathan Cameron
2015-04-15 19:11 ` [PATCH 5/5] iio: adc: xilinx: Set .datasheet_name instead of .extend_name Thomas Betker
2015-04-15 20:54 ` [Patch 0/5] iio: adc: xilinx: Fix some minor issues Jonathan Cameron
2015-04-16  6:20   ` Lars-Peter Clausen
2015-04-16  8:03     ` Thomas.Betker
2015-04-16  7:53   ` Thomas.Betker
2015-04-18 19:26     ` Jonathan Cameron
2015-04-20  8:34       ` Thomas.Betker
2015-04-21 19:35         ` 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=1429125111-2926-5-git-send-email-thomas.betker@freenet.de \
    --to=thomas.betker@freenet.de \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=soren.brinkmann@xilinx.com \
    --cc=thomas.betker@rohde-schwarz.com \
    /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).