summaryrefslogtreecommitdiff
path: root/drivers/staging/comedi
diff options
context:
space:
mode:
authorSpencer E. Olson <olsonse@umich.edu>2018-10-03 14:56:09 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-10-09 15:36:05 +0200
commit713ebc593978e67d9e6d708f34fa6c66470be536 (patch)
treeb52b8c3fba261ff0a7ca8fdd66fefb12589345d0 /drivers/staging/comedi
parent347e244884c3be1f5bce1d93730f0c32efabba99 (diff)
staging: comedi: ni_mio_common: create device-global access to tio
Adds tio sub-devices of ni_mio_common supported hardware to the implementation of test_route, connect_route, disconnect_route. This change delegates the actual functionality to the ni_tio module. Signed-off-by: Spencer E. Olson <olsonse@umich.edu> Reviewed-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/comedi')
-rw-r--r--drivers/staging/comedi/drivers/ni_mio_common.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index addea2446197..2d1e0325d04d 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -5644,6 +5644,8 @@ static int get_output_select_source(int dest, struct comedi_device *dev)
/* there are only two g_out outputs. */
return -EINVAL;
reg = ni_get_gout_routing(dest, dev);
+ } else if (channel_is_ctr(dest)) {
+ reg = ni_tio_get_routing(devpriv->counter_dev, dest);
} else {
dev_dbg(dev->class_dev, "%s: unhandled destination (%d) queried\n",
__func__, dest);
@@ -5732,6 +5734,13 @@ static int connect_route(unsigned int src, unsigned int dest,
return -EINVAL;
if (ni_set_gout_routing(src, dest, dev))
return -EINVAL;
+ } else if (channel_is_ctr(dest)) {
+ /*
+ * we are adding back the channel modifier info to set
+ * invert/edge info passed by the user
+ */
+ ni_tio_set_routing(devpriv->counter_dev, dest,
+ reg | (src & ~CR_CHAN(-1)));
} else {
return -EINVAL;
}
@@ -5790,6 +5799,8 @@ static int disconnect_route(unsigned int src, unsigned int dest,
/* there are only two g_out outputs. */
return -EINVAL;
reg = ni_disable_gout_routing(dest, dev);
+ } else if (channel_is_ctr(dest)) {
+ ni_tio_unset_routing(devpriv->counter_dev, dest);
} else {
return -EINVAL;
}