summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2013-02-27 12:31:16 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2013-02-27 12:31:30 -0500
commite588bc2c02f28f8d56b5b62a296fa4f2806adb65 (patch)
treeebf94ee331b61671b9eb5556159a6c4153be1d79
parent16acbf31cc366a630b0a082f470e0bfa52b9e102 (diff)
downloadlongterm-queue-2.6.34-e588bc2c02f28f8d56b5b62a296fa4f2806adb65.tar.gz
add staging/comedi labpc patches
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r--queue/series2
-rw-r--r--queue/staging-comedi-ni_labpc-correct-differential-channel.patch53
-rw-r--r--queue/staging-comedi-ni_labpc-set-up-command4-register-aft.patch77
3 files changed, 132 insertions, 0 deletions
diff --git a/queue/series b/queue/series
index 48c5bac..84eae84 100644
--- a/queue/series
+++ b/queue/series
@@ -1 +1,3 @@
x86-random-make-ARCH_RANDOM-prompt-if-EMBEDDED-not-E.patch
+staging-comedi-ni_labpc-correct-differential-channel.patch
+staging-comedi-ni_labpc-set-up-command4-register-aft.patch
diff --git a/queue/staging-comedi-ni_labpc-correct-differential-channel.patch b/queue/staging-comedi-ni_labpc-correct-differential-channel.patch
new file mode 100644
index 0000000..4a17f2c
--- /dev/null
+++ b/queue/staging-comedi-ni_labpc-correct-differential-channel.patch
@@ -0,0 +1,53 @@
+From 5dc4d816ffaa44f1bb875bfd5da31579fefd75a5 Mon Sep 17 00:00:00 2001
+From: Ian Abbott <abbotti@mev.co.uk>
+Date: Fri, 1 Feb 2013 14:51:58 +0000
+Subject: [PATCH] staging: comedi: ni_labpc: correct differential channel
+ sequence for AI commands
+
+commit 4c4bc25d0fa6beaf054c0b4c3b324487f266c820 upstream.
+
+Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
+meaningful output from a Lab-PC+ in differential mode for AI cmds, but
+AI insn reads gave correct readings. He tracked it down to two
+problems, one of which is addressed by this patch.
+
+It seems the setting of the channel bits for particular scanning modes
+was incorrect for differential mode. (Only half the number of channels
+are available in differential mode; comedi refers to them as channels 0,
+1, 2 and 3, but the hardware documentation refers to them as channels 0,
+2, 4 and 6.) In differential mode, the setting of the channel enable
+bits in the command1 register should depend on whether the scan enable
+bit is set. Effectively, we need to double the comedi channel number
+when the scan enable bit is not set in differential mode. The scan
+enable bit gets set when the AI scan mode is `MODE_MULT_CHAN_UP` or
+`MODE_MULT_CHAN_DOWN`, and gets cleared when the AI scan mode is
+`MODE_SINGLE_CHAN` or `MODE_SINGLE_CHAN_INTERVAL`. The existing test
+for whether the comedi channel number needs to be doubled in
+differential mode is incorrect in `labpc_ai_cmd()`. This patch corrects
+the test.
+
+Thanks to Tuomas for suggesting the fix.
+
+Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+[PG: in 2.6.34 baseline, "mode" was "labpc_ai_scan_mode(cmd)"]
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+
+diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
+index 3f4fbfe..9521b04 100644
+--- a/drivers/staging/comedi/drivers/ni_labpc.c
++++ b/drivers/staging/comedi/drivers/ni_labpc.c
+@@ -1223,7 +1223,9 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
+ else
+ channel = CR_CHAN(cmd->chanlist[0]);
+ /* munge channel bits for differential / scan disabled mode */
+- if (labpc_ai_scan_mode(cmd) != MODE_SINGLE_CHAN && aref == AREF_DIFF)
++ if ((labpc_ai_scan_mode(cmd) == MODE_SINGLE_CHAN ||
++ labpc_ai_scan_mode(cmd) == MODE_SINGLE_CHAN_INTERVAL) &&
++ aref == AREF_DIFF)
+ channel *= 2;
+ devpriv->command1_bits |= ADC_CHAN_BITS(channel);
+ devpriv->command1_bits |= thisboard->ai_range_code[range];
+--
+1.8.1.2
+
diff --git a/queue/staging-comedi-ni_labpc-set-up-command4-register-aft.patch b/queue/staging-comedi-ni_labpc-set-up-command4-register-aft.patch
new file mode 100644
index 0000000..e7cba2c
--- /dev/null
+++ b/queue/staging-comedi-ni_labpc-set-up-command4-register-aft.patch
@@ -0,0 +1,77 @@
+From 067c94ea8da1d140e9b567d07cf24e8eab634fe8 Mon Sep 17 00:00:00 2001
+From: Ian Abbott <abbotti@mev.co.uk>
+Date: Fri, 1 Feb 2013 14:51:57 +0000
+Subject: [PATCH] staging: comedi: ni_labpc: set up command4 register *after*
+ command3
+
+commit 22056e2b46246d97ff0f7c6e21a77b8daa07f02c upstream.
+
+Tuomas <tvainikk _at_ gmail _dot_ com> reported problems getting
+meaningful output from a Lab-PC+ in differential mode for AI cmds, but
+AI insn reads gave correct readings. He tracked it down to two
+problems, one of which is addressed by this patch.
+
+It seems that writing to the command3 register after writing to the
+command4 register in `labpc_ai_cmd()` messes up the differential
+reference bit setting in the command4 register. Set up the command4
+register after the command3 register (as in `labpc_ai_rinsn()`) to avoid
+the problem.
+
+Thanks to Tuomas for suggesting the fix.
+
+Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
+
+diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c
+index 9521b04..7a310e9 100644
+--- a/drivers/staging/comedi/drivers/ni_labpc.c
++++ b/drivers/staging/comedi/drivers/ni_labpc.c
+@@ -1241,21 +1241,6 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
+ devpriv->write_byte(devpriv->command1_bits,
+ dev->iobase + COMMAND1_REG);
+ }
+- /* setup any external triggering/pacing (command4 register) */
+- devpriv->command4_bits = 0;
+- if (cmd->convert_src != TRIG_EXT)
+- devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT;
+- /* XXX should discard first scan when using interval scanning
+- * since manual says it is not synced with scan clock */
+- if (labpc_use_continuous_mode(cmd) == 0) {
+- devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT;
+- if (cmd->scan_begin_src == TRIG_EXT)
+- devpriv->command4_bits |= EXT_SCAN_EN_BIT;
+- }
+- /* single-ended/differential */
+- if (aref == AREF_DIFF)
+- devpriv->command4_bits |= ADC_DIFF_BIT;
+- devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG);
+
+ devpriv->write_byte(cmd->chanlist_len,
+ dev->iobase + INTERVAL_COUNT_REG);
+@@ -1333,6 +1318,22 @@ static int labpc_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s)
+ devpriv->command3_bits &= ~ADC_FNE_INTR_EN_BIT;
+ devpriv->write_byte(devpriv->command3_bits, dev->iobase + COMMAND3_REG);
+
++ /* setup any external triggering/pacing (command4 register) */
++ devpriv->command4_bits = 0;
++ if (cmd->convert_src != TRIG_EXT)
++ devpriv->command4_bits |= EXT_CONVERT_DISABLE_BIT;
++ /* XXX should discard first scan when using interval scanning
++ * since manual says it is not synced with scan clock */
++ if (labpc_use_continuous_mode(cmd) == 0) {
++ devpriv->command4_bits |= INTERVAL_SCAN_EN_BIT;
++ if (cmd->scan_begin_src == TRIG_EXT)
++ devpriv->command4_bits |= EXT_SCAN_EN_BIT;
++ }
++ /* single-ended/differential */
++ if (aref == AREF_DIFF)
++ devpriv->command4_bits |= ADC_DIFF_BIT;
++ devpriv->write_byte(devpriv->command4_bits, dev->iobase + COMMAND4_REG);
++
+ /* startup aquisition */
+
+ /* command2 reg */
+--
+1.8.1.2
+