static int litelink_change_speed(struct sir_dev *dev, unsigned speed) { int i; IRDA_DEBUG(2, "%s()\n", __func__); for (i = 0; baud_rates[i] != speed; i++) { if (baud_rates[i] == 9600) break; sirdev_set_dtr_rts(dev, FALSE, TRUE); udelay(MIN_DELAY); sirdev_set_dtr_rts(dev, TRUE, TRUE); udelay(MIN_DELAY); } dev->speed = baud_rates[i]; return (dev->speed == speed) ? 0 : -EINVAL; }
/* * Function litelink_reset (task) * * Reset the Litelink type dongle. * */ static int litelink_reset(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); /* probably the power-up can be dropped here, but with only * 15 usec delay it's not worth the risk unless somebody with * the hardware confirms it doesn't break anything... */ /* Power on dongle */ sirdev_set_dtr_rts(dev, TRUE, TRUE); /* Sleep a minimum of 15 us */ udelay(MIN_DELAY); /* Clear RTS to reset dongle */ sirdev_set_dtr_rts(dev, TRUE, FALSE); /* Sleep a minimum of 15 us */ udelay(MIN_DELAY); /* Go back to normal mode */ sirdev_set_dtr_rts(dev, TRUE, TRUE); /* Sleep a minimum of 15 us */ udelay(MIN_DELAY); dev->speed = 115200; return 0; }
static int litelink_reset(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); sirdev_set_dtr_rts(dev, TRUE, TRUE); udelay(MIN_DELAY); sirdev_set_dtr_rts(dev, TRUE, FALSE); udelay(MIN_DELAY); sirdev_set_dtr_rts(dev, TRUE, TRUE); udelay(MIN_DELAY); dev->speed = 115200; return 0; }
static int esi_reset(struct sir_dev *dev) { sirdev_set_dtr_rts(dev, FALSE, FALSE); sirdev_set_dtr_rts(dev, FALSE, TRUE); dev->speed = 9600; return 0; }
static int actisys_reset(struct sir_dev *dev) { /* Reset the dongle : set DTR low for 10 us */ sirdev_set_dtr_rts(dev, FALSE, TRUE); udelay(MIN_DELAY); /* Go back to normal mode */ sirdev_set_dtr_rts(dev, TRUE, TRUE); dev->speed = 9600; /* That's the default */ return 0; }
static int ma600_change_speed(struct sir_dev *dev, unsigned speed) { u8 byte; IRDA_DEBUG(2, "%s(), speed=%d (was %d)\n", __FUNCTION__, speed, dev->speed); /* dongle already reset, dongle and port at default speed (9600) */ /* Set RTS low for 1 ms */ sirdev_set_dtr_rts(dev, TRUE, FALSE); mdelay(1); /* Write control byte */ byte = get_control_byte(speed); sirdev_raw_write(dev, &byte, sizeof(byte)); /* Wait at least 10ms: fake wait_until_sent - 10 bits at 9600 baud*/ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(15)); /* old ma600 uses 15ms */ #if 1 /* read-back of the control byte. ma600 is the first dongle driver * which uses this so there might be some unidentified issues. * Disable this in case of problems with readback. */ sirdev_raw_read(dev, &byte, sizeof(byte)); if (byte != get_control_byte(speed)) { WARNING("%s(): bad control byte read-back %02x != %02x\n", __FUNCTION__, (unsigned) byte, (unsigned) get_control_byte(speed)); return -1; } else IRDA_DEBUG(2, "%s() control byte write read OK\n", __FUNCTION__); #endif /* Set DTR, Set RTS */ sirdev_set_dtr_rts(dev, TRUE, TRUE); /* Wait at least 10ms */ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(10)); /* dongle is now switched to the new speed */ dev->speed = speed; return 0; }
int ma600_reset(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); /* Reset the dongle : set DTR low for 10 ms */ sirdev_set_dtr_rts(dev, FALSE, TRUE); msleep(10); /* Go back to normal mode */ sirdev_set_dtr_rts(dev, TRUE, TRUE); msleep(10); dev->speed = 9600; /* That's the dongle-default */ return 0; }
static int esi_close(struct sir_dev *dev) { sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
static int toim3232_close(struct sir_dev *dev) { /* Power off dongle */ sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
static int toim3232_open(struct sir_dev *dev) { struct qos_info *qos = &dev->qos; IRDA_DEBUG(2, "%s()\n", __func__); /* Pull the lines high to start with. * * For the IR320ST-2, we need to charge the main supply capacitor to * switch the device on. We keep DTR high throughout to do this. * When RTS, TD and RD are high, they will also trickle-charge the * cap. RTS is high for data transmission, and low for baud rate select. * -- DGB */ sirdev_set_dtr_rts(dev, TRUE, TRUE); /* The TOI3232 supports many speeds between 1200bps and 115000bps. * We really only care about those supported by the IRDA spec, but * 38400 seems to be implemented in many places */ qos->baud_rate.bits &= IR_2400|IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; /* From the tekram driver. Not sure what a reasonable value is -- DGB */ qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */ irda_qos_bits_to_value(qos); /* irda thread waits 50 msec for power settling */ return 0; }
static int actisys_close(struct sir_dev *dev) { /* Power off the dongle */ sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
static int esi_change_speed(struct sir_dev *dev, unsigned speed) { int ret = 0; int dtr, rts; switch (speed) { case 19200: dtr = TRUE; rts = FALSE; break; case 115200: dtr = rts = TRUE; break; default: ret = -EINVAL; speed = 9600; case 9600: dtr = FALSE; rts = TRUE; break; } sirdev_set_dtr_rts(dev, dtr, rts); dev->speed = speed; return ret; }
static int girbil_reset(struct sir_dev *dev) { unsigned state = dev->fsm.substate; unsigned delay = 0; u8 control = GIRBIL_TXEN | GIRBIL_RXEN; int ret = 0; IRDA_DEBUG(2, "%s()\n", __FUNCTION__); switch (state) { case SIRDEV_STATE_DONGLE_RESET: /* Reset dongle */ sirdev_set_dtr_rts(dev, TRUE, FALSE); /* Sleep at least 5 ms */ delay = 20; state = GIRBIL_STATE_WAIT1_RESET; break; case GIRBIL_STATE_WAIT1_RESET: /* Set DTR and clear RTS to enter command mode */ sirdev_set_dtr_rts(dev, FALSE, TRUE); delay = 20; state = GIRBIL_STATE_WAIT2_RESET; break; case GIRBIL_STATE_WAIT2_RESET: /* Write control byte */ sirdev_raw_write(dev, &control, 1); delay = 20; state = GIRBIL_STATE_WAIT3_RESET; break; case GIRBIL_STATE_WAIT3_RESET: /* Go back to normal mode */ sirdev_set_dtr_rts(dev, TRUE, TRUE); dev->speed = 9600; break; default: IRDA_ERROR("%s(), undefined state %d\n", __FUNCTION__, state); ret = -1; break; } dev->fsm.substate = state; return (delay > 0) ? delay : ret; }
/* * Function esi_reset (task) * * Reset dongle; * */ static int esi_reset(struct sir_dev *dev) { 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. */ sirdev_set_dtr_rts(dev, FALSE, TRUE); dev->speed = 9600; return 0; }
static int girbil_reset(struct sir_dev *dev) { unsigned state = dev->fsm.substate; unsigned delay = 0; u8 control = GIRBIL_TXEN | GIRBIL_RXEN; int ret = 0; IRDA_DEBUG(2, "%s()\n", __func__); switch (state) { case SIRDEV_STATE_DONGLE_RESET: sirdev_set_dtr_rts(dev, TRUE, FALSE); delay = 20; state = GIRBIL_STATE_WAIT1_RESET; break; case GIRBIL_STATE_WAIT1_RESET: sirdev_set_dtr_rts(dev, FALSE, TRUE); delay = 20; state = GIRBIL_STATE_WAIT2_RESET; break; case GIRBIL_STATE_WAIT2_RESET: sirdev_raw_write(dev, &control, 1); delay = 20; state = GIRBIL_STATE_WAIT3_RESET; break; case GIRBIL_STATE_WAIT3_RESET: sirdev_set_dtr_rts(dev, TRUE, TRUE); dev->speed = 9600; break; default: IRDA_ERROR("%s(), undefined state %d\n", __func__, state); ret = -1; break; } dev->fsm.substate = state; return (delay > 0) ? delay : ret; }
static int tekram_reset(struct sir_dev *dev) { /* Clear DTR, Set RTS */ sirdev_set_dtr_rts(dev, FALSE, TRUE); /* Should sleep 1 ms */ msleep(1); /* Set DTR, Set RTS */ sirdev_set_dtr_rts(dev, TRUE, TRUE); /* Wait at least 50 us */ udelay(75); dev->speed = 9600; return 0; }
static int tekram_close(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); /* */ sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
static int toim3232_close(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); /* Power off dongle */ sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
static int old_belkin_close(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
static int girbil_close(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__); /* Power off dongle */ sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
int ma600_reset(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__); /* Reset the dongle : set DTR low for 10 ms */ sirdev_set_dtr_rts(dev, FALSE, TRUE); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(10)); /* Go back to normal mode */ sirdev_set_dtr_rts(dev, TRUE, TRUE); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(10)); dev->speed = 9600; /* That's the dongle-default */ return 0; }
static int tekram_reset(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); sirdev_set_dtr_rts(dev, FALSE, TRUE); msleep(1); sirdev_set_dtr_rts(dev, TRUE, TRUE); udelay(75); dev->speed = 9600; return 0; }
static int mcp2120_close(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __func__); /* Power off dongle */ /* reset and inhibit mcp2120 */ sirdev_set_dtr_rts(dev, TRUE, TRUE); // sirdev_set_dtr_rts(dev, FALSE, FALSE); return 0; }
static int tekram_reset(struct sir_dev *dev) { IRDA_DEBUG(2, "%s()\n", __FUNCTION__); /* Clear DTR, Set RTS */ sirdev_set_dtr_rts(dev, FALSE, TRUE); /* Should sleep 1 ms */ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(MSECS_TO_JIFFIES(1)); /* Set DTR, Set RTS */ sirdev_set_dtr_rts(dev, TRUE, TRUE); /* Wait at least 50 us */ udelay(75); dev->speed = 9600; return 0; }
static int toim3232_reset(struct sir_dev *dev) { /* Switch off both DTR and RTS to switch off dongle */ sirdev_set_dtr_rts(dev, FALSE, FALSE); /* Should sleep a while. This might be evil doing it this way.*/ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(50)); /* Set DTR, Set RTS (data mode) */ sirdev_set_dtr_rts(dev, TRUE, TRUE); /* Wait at least 10 ms for power to stabilize again */ set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(msecs_to_jiffies(10)); /* Speed should now be 9600 */ dev->speed = 9600; return 0; }
/* * Function actisys_change_speed (task) * * Change speed of the ACTiSYS IR-220L and IR-220L+ type IrDA dongles. * To cycle through the available baud rates, pulse RTS low for a few us. * * First, we reset the dongle to always start from a known state. * Then, we cycle through the speeds by pulsing RTS low and then up. * The dongle allow us to pulse quite fast, se we can set speed in one go, * which is must faster ( < 100 us) and less complex than what is found * in some other dongle drivers... * Note that even if the new speed is the same as the current speed, * we reassert the speed. This make sure that things are all right, * and it's fast anyway... * By the way, this function will work for both type of dongles, * because the additional speed is at the end of the sequence... */ static int actisys_change_speed(struct sir_dev *dev, unsigned speed) { int ret = 0; int i = 0; IRDA_DEBUG(4, "%s(), speed=%d (was %d)\n", __FUNCTION__, speed, dev->speed); /* dongle was already resetted from irda_request state machine, * we are in known state (dongle default) */ /* * Now, we can set the speed requested. Send RTS pulses until we * reach the target speed */ for (i = 0; i < MAX_SPEEDS; i++) { if (speed == baud_rates[i]) { dev->speed = speed; break; } /* Set RTS low for 10 us */ sirdev_set_dtr_rts(dev, TRUE, FALSE); udelay(MIN_DELAY); /* Set RTS high for 10 us */ sirdev_set_dtr_rts(dev, TRUE, TRUE); udelay(MIN_DELAY); } /* Check if life is sweet... */ if (i >= MAX_SPEEDS) { actisys_reset(dev); ret = -EINVAL; /* This should not happen */ } /* Basta lavoro, on se casse d'ici... */ return ret; }
static int mcp2120_reset(struct sir_dev *dev) { unsigned state = dev->fsm.substate; unsigned delay = 0; int ret = 0; IRDA_DEBUG(2, "%s()\n", __func__); switch (state) { case SIRDEV_STATE_DONGLE_RESET: ; /* Reset dongle by setting RTS*/ sirdev_set_dtr_rts(dev, TRUE, TRUE); state = MCP2120_STATE_WAIT1_RESET; delay = 50; break; case MCP2120_STATE_WAIT1_RESET: ; /* clear RTS and wait for at least 30 ms. */ sirdev_set_dtr_rts(dev, FALSE, FALSE); state = MCP2120_STATE_WAIT2_RESET; delay = 50; break; case MCP2120_STATE_WAIT2_RESET: ; /* Go back to normal mode */ sirdev_set_dtr_rts(dev, FALSE, FALSE); break; default: IRDA_ERROR("%s(), undefined state %d\n", __func__, state); ret = -EINVAL; break; } dev->fsm.substate = state; return (delay > 0) ? delay : ret; }
static int tekram_open(struct sir_dev *dev) { struct qos_info *qos = &dev->qos; sirdev_set_dtr_rts(dev, TRUE, TRUE); qos->baud_rate.bits &= IR_9600|IR_19200|IR_38400|IR_57600|IR_115200; qos->min_turn_time.bits = 0x01; /* Needs at least 10 ms */ irda_qos_bits_to_value(qos); /* irda thread waits 50 msec for power settling */ return 0; }
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); /* irda thread waits 50 msec for power settling */ return 0; }
static int esi_open(struct sir_dev *dev) { struct qos_info *qos = &dev->qos; sirdev_set_dtr_rts(dev, FALSE, TRUE); qos->baud_rate.bits &= IR_9600|IR_19200|IR_115200; qos->min_turn_time.bits = 0x01; irda_qos_bits_to_value(qos); return 0; }