[PATCH v3 10/13] staging: comedi: ni_mio_common: create device-global access to tio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c
index d7862787e064..ecb05b3f9d35 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -5620,6 +5620,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);
@@ -5708,6 +5710,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;
 	}
@@ -5766,6 +5775,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;
 	}
-- 
2.17.1

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux