[PATCH 2.6 IrDA] 3/11: esi-sir: dongle api change

From: Jean Tourrilhes
Date: Fri Jan 23 2004 - 21:29:24 EST


ir262_dongles-3_esi-sir.diff :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<Patch from Martin Diehl>
* convert to de-virtualized sirdev helpers
* add probably missing dongle power-up operation


diff -u -p linux/drivers/net/irda.d6/esi-sir.c linux/drivers/net/irda/esi-sir.c
--- linux/drivers/net/irda.d6/esi-sir.c Wed Dec 17 18:59:18 2003
+++ linux/drivers/net/irda/esi-sir.c Thu Jan 22 16:43:22 2004
@@ -68,11 +68,14 @@ static int esi_open(struct sir_dev *dev)
{
struct qos_info *qos = &dev->qos;

+ /* Power up and set dongle to 9600 baud */
+ sirdev_set_dtr_rts(dev, FALSE, TRUE);
+
qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200;
qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */
irda_qos_bits_to_value(qos);

- /* shouldn't we do set_dtr_rts(FALSE, TRUE) here (power up at 9600)? */
+ /* irda thread waits 50 msec for power settling */

return 0;
}
@@ -80,7 +83,7 @@ static int esi_open(struct sir_dev *dev)
static int esi_close(struct sir_dev *dev)
{
/* Power off dongle */
- dev->set_dtr_rts(dev, FALSE, FALSE);
+ sirdev_set_dtr_rts(dev, FALSE, FALSE);

return 0;
}
@@ -88,11 +91,13 @@ static int esi_close(struct sir_dev *dev
/*
* Function esi_change_speed (task)
*
- * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle
+ * Set the speed for the Extended Systems JetEye PC ESI-9680 type dongle
+ * Apparently (see old esi-driver) no delays are needed here...
*
*/
static int esi_change_speed(struct sir_dev *dev, unsigned speed)
{
+ int ret = 0;
int dtr, rts;

switch (speed) {
@@ -104,6 +109,7 @@ static int esi_change_speed(struct sir_d
dtr = rts = TRUE;
break;
default:
+ ret = -EINVAL;
speed = 9600;
/* fall through */
case 9600:
@@ -113,12 +119,10 @@ static int esi_change_speed(struct sir_d
}

/* Change speed of dongle */
- dev->set_dtr_rts(dev, dtr, rts);
+ sirdev_set_dtr_rts(dev, dtr, rts);
dev->speed = speed;

- /* do we need some delay for power stabilization? */
-
- return 0;
+ return ret;
}

/*
@@ -129,9 +133,18 @@ static int esi_change_speed(struct sir_d
*/
static int esi_reset(struct sir_dev *dev)
{
- dev->set_dtr_rts(dev, FALSE, FALSE);
+ sirdev_set_dtr_rts(dev, FALSE, FALSE);
+
+ /* Hm, the old esi-driver left the dongle unpowered relying on
+ * the following speed change to repower. This might work for
+ * the esi because we only need the modem lines. However, now the
+ * general rule is reset must bring the dongle to some working
+ * well-known state because speed change might write to registers.
+ * The old esi-driver didn't any delay here - let's hope it' fine.
+ */

- /* Hm, probably repower to 9600 and some delays? */
+ sirdev_set_dtr_rts(dev, FALSE, TRUE);
+ dev->speed = 9600;

return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/