aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2013-02-14 11:42:15 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-15 13:17:55 -0500
commitf06a23c93b900c37ef14858868c00dc8f061fa22 (patch)
treef7be74dd9a9b5609fcdf45de19308d92d41ff379
parente8f311a5b6b9163f6aeba2524eaab92dc3b0fb6f (diff)
staging: comedi: vmk80xx: initialize K8055 outputs to known state
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@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/comedi/drivers/vmk80xx.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/comedi/drivers/vmk80xx.c b/drivers/staging/comedi/drivers/vmk80xx.c
index 057d840b90de..7984e036c041 100644
--- a/drivers/staging/comedi/drivers/vmk80xx.c
+++ b/drivers/staging/comedi/drivers/vmk80xx.c
@@ -436,10 +436,15 @@ exit:
436static int vmk80xx_reset_device(struct vmk80xx_private *devpriv) 436static int vmk80xx_reset_device(struct vmk80xx_private *devpriv)
437{ 437{
438 size_t size; 438 size_t size;
439 int retval;
439 440
440 size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize); 441 size = le16_to_cpu(devpriv->ep_tx->wMaxPacketSize);
441 memset(devpriv->usb_tx_buf, 0, size); 442 memset(devpriv->usb_tx_buf, 0, size);
442 return vmk80xx_write_packet(devpriv, VMK8055_CMD_RST); 443 retval = vmk80xx_write_packet(devpriv, VMK8055_CMD_RST);
444 if (retval)
445 return retval;
446 /* set outputs to known state as we cannot read them */
447 return vmk80xx_write_packet(devpriv, VMK8055_CMD_WRT_AD);
443} 448}
444 449
445#define DIR_IN 1 450#define DIR_IN 1