[PATCH 3/4] staging: comedi: vmk80xx: initialize K8055 outputs to known state

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

 



vmk8055_reset_device() is called during initialization of a Velleman
K8055 (aka VM110) to send a reset command to the hardware.  I don't know
what this does, but I know that it doesn't reset the digital outputs as
I've tried it.  Since the hardware does not have any way to query the
current output values and there is only the one command to update all
the analog and digital outputs simultaneously (VMK8055_CMD_WRT_AD), send
this command during initialization to set all the analog and digital
outputs to a known state.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
 drivers/staging/comedi/drivers/vmk80xx.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index 51859b8..af143ec 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -436,10 +436,15 @@ exit:
 static int vmk80xx_reset_device(struct vmk80xx_private *devpriv)
 {
 	size_t size;
+	int retval;
 
 	size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
 	memset(devpriv->usb_tx_buf, 0, size);
-	return vmk80xx_write_packet(devpriv, VMK8055_CMD_RST);
+	retval = vmk80xx_write_packet(devpriv, VMK8055_CMD_RST);
+	if (retval)
+		return retval;
+	/* set outputs to known state as we cannot read them */
+	return vmk80xx_write_packet(devpriv, VMK8055_CMD_WRT_AD);
 }
 
 #define DIR_IN  1
-- 
1.8.1.2

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/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