[PATCH 2/3] iuu_phoenix: add support for 3.3V VCC

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

 



New module parameter: vcc33.
You can now set the IUU reader to 3.3V VCC instead of 5V VCC.

Signed-off-by: Olivier Bornet <Olivier.Bornet@xxxxxxx>
---
 drivers/usb/serial/iuu_phoenix.c |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c
index 8fbf798..bbd0fc6 100644
--- a/drivers/usb/serial/iuu_phoenix.c
+++ b/drivers/usb/serial/iuu_phoenix.c
@@ -64,6 +64,7 @@ static int cdmode = 1;
 static int iuu_cardin;
 static int iuu_cardout;
 static int xmas;
+static int vcc33;
 
 static void read_rxcmd_callback(struct urb *urb);
 
@@ -1018,6 +1019,35 @@ static void iuu_close(struct usb_serial_port *port)
 	}
 }
 
+int iuu_vcc33(struct usb_serial_port *port)
+{
+	int status;
+	u8 *buf;
+	int vcc = 3;
+
+	buf = kmalloc(5, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	dbg("%s - enter", __func__);
+
+	buf[0] = IUU_SET_VCC;
+	buf[1] = vcc & 0xFF;
+	buf[2] = (vcc >> 8) & 0xFF;
+	buf[3] = (vcc >> 16) & 0xFF;
+	buf[4] = (vcc >> 24) & 0xFF;
+
+	status = bulk_immediate(port, buf, 5);
+	kfree(buf);
+
+	if (status != IUU_OPERATION_OK)
+		dbg("%s - vcc error status = %2x", __func__, status);
+	else
+		dbg("%s - vcc OK !", __func__);
+
+	return status;
+}
+
 static int iuu_open(struct tty_struct *tty,
 			struct usb_serial_port *port, struct file *filp)
 {
@@ -1166,6 +1196,11 @@ static int iuu_open(struct tty_struct *tty,
 
 	iuu_uart_flush(port);
 
+	if (vcc33) {
+		iuu_vcc33(port);
+		iuu_uart_flush(port);
+	}
+
 	dbg("%s - initialization done", __func__);
 
 	memset(port->write_urb->transfer_buffer, IUU_UART_RX, 1);
@@ -1254,3 +1289,6 @@ MODULE_PARM_DESC(clockmode, "Card clock mode (1=3.579 MHz, 2=3.680 MHz, "
 module_param(cdmode, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(cdmode, "Card detect mode (0=none, 1=CD, 2=!CD, 3=DSR, "
 		 "4=!DSR, 5=CTS, 6=!CTS, 7=RING, 8=!RING)");
+
+module_param(vcc33, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(vcc33, "Card 3.3V VCC enabled or not");
-- 
1.6.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux