• Home
  • Raw
  • Download

Lines Matching refs:self

110 static void irda_usb_init_qos(struct irda_usb_cb *self) ;
113 static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self);
115 static int irda_usb_open(struct irda_usb_cb *self);
116 static void irda_usb_close(struct irda_usb_cb *self);
148 static void irda_usb_build_header(struct irda_usb_cb *self, in irda_usb_build_header() argument
156 if (self->capability & IUC_STIR421X && in irda_usb_build_header()
157 ((self->new_speed != -1) || (self->new_xbofs != -1))) { in irda_usb_build_header()
162 if (self->new_speed == -1) in irda_usb_build_header()
163 self->new_speed = self->speed ; in irda_usb_build_header()
165 if (self->new_xbofs == -1) in irda_usb_build_header()
166 self->new_xbofs = self->xbofs ; in irda_usb_build_header()
170 if (self->new_speed != -1) { in irda_usb_build_header()
175 if ((self->capability & IUC_SPEED_BUG) && in irda_usb_build_header()
176 (!force) && (self->speed != -1)) { in irda_usb_build_header()
184 IRDA_DEBUG(2, "%s(), changing speed to %d\n", __func__, self->new_speed); in irda_usb_build_header()
185 self->speed = self->new_speed; in irda_usb_build_header()
189 switch (self->speed) { in irda_usb_build_header()
217 self->new_xbofs = 0; in irda_usb_build_header()
221 self->new_xbofs = 0; in irda_usb_build_header()
229 if (self->new_xbofs != -1) { in irda_usb_build_header()
230 IRDA_DEBUG(2, "%s(), changing xbofs to %d\n", __func__, self->new_xbofs); in irda_usb_build_header()
231 self->xbofs = self->new_xbofs; in irda_usb_build_header()
235 switch (self->xbofs) { in irda_usb_build_header()
298 static void irda_usb_change_speed_xbofs(struct irda_usb_cb *self) in irda_usb_change_speed_xbofs() argument
305 self->new_speed, self->new_xbofs); in irda_usb_change_speed_xbofs()
308 urb = self->speed_urb; in irda_usb_change_speed_xbofs()
315 frame = self->speed_buff; in irda_usb_change_speed_xbofs()
318 irda_usb_build_header(self, frame, 1); in irda_usb_change_speed_xbofs()
320 if (self->capability & IUC_STIR421X) { in irda_usb_change_speed_xbofs()
327 usb_fill_bulk_urb(urb, self->usbdev, in irda_usb_change_speed_xbofs()
328 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep), in irda_usb_change_speed_xbofs()
330 speed_bulk_callback, self); in irda_usb_change_speed_xbofs()
331 urb->transfer_buffer_length = self->header_length; in irda_usb_change_speed_xbofs()
347 struct irda_usb_cb *self = urb->context; in speed_bulk_callback() local
352 IRDA_ASSERT(self != NULL, return;); in speed_bulk_callback()
354 IRDA_ASSERT(urb == self->speed_urb, return;); in speed_bulk_callback()
373 self->new_speed = -1; in speed_bulk_callback()
374 self->new_xbofs = -1; in speed_bulk_callback()
377 netif_wake_queue(self->netdev); in speed_bulk_callback()
386 struct irda_usb_cb *self = netdev_priv(netdev); in irda_usb_hard_xmit() local
387 struct urb *urb = self->tx_urb; in irda_usb_hard_xmit()
399 spin_lock_irqsave(&self->lock, flags); in irda_usb_hard_xmit()
404 if (!self->present) { in irda_usb_hard_xmit()
411 if ((xbofs != self->xbofs) && (xbofs != -1)) { in irda_usb_hard_xmit()
412 self->new_xbofs = xbofs; in irda_usb_hard_xmit()
417 if ((speed != self->speed) && (speed != -1)) { in irda_usb_hard_xmit()
419 self->new_speed = speed; in irda_usb_hard_xmit()
430 irda_usb_change_speed_xbofs(self); in irda_usb_hard_xmit()
443 skb_copy_from_linear_data(skb, self->tx_buff + self->header_length, skb->len); in irda_usb_hard_xmit()
446 if (self->capability & IUC_STIR421X) { in irda_usb_hard_xmit()
448 __u8* frame = self->tx_buff; in irda_usb_hard_xmit()
450 irda_usb_build_header(self, frame, 0); in irda_usb_hard_xmit()
462 irda_usb_build_header(self, self->tx_buff, 0); in irda_usb_hard_xmit()
466 ((struct irda_skb_cb *)skb->cb)->context = self; in irda_usb_hard_xmit()
468 usb_fill_bulk_urb(urb, self->usbdev, in irda_usb_hard_xmit()
469 usb_sndbulkpipe(self->usbdev, self->bulk_out_ep), in irda_usb_hard_xmit()
470 self->tx_buff, skb->len + self->header_length, in irda_usb_hard_xmit()
494 if (self->capability & IUC_NO_TURN) { in irda_usb_hard_xmit()
498 do_gettimeofday(&self->now); in irda_usb_hard_xmit()
499 diff = self->now.tv_usec - self->stamp.tv_usec; in irda_usb_hard_xmit()
537 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_hard_xmit()
544 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_hard_xmit()
556 struct irda_usb_cb *self = ((struct irda_skb_cb *) skb->cb)->context; in write_bulk_callback() local
561 IRDA_ASSERT(self != NULL, return;); in write_bulk_callback()
563 IRDA_ASSERT(urb == self->tx_urb, return;); in write_bulk_callback()
587 spin_lock_irqsave(&self->lock, flags); in write_bulk_callback()
590 if ((!self->netopen) || (!self->present)) { in write_bulk_callback()
592 spin_unlock_irqrestore(&self->lock, flags); in write_bulk_callback()
597 if ((self->new_speed != -1) || (self->new_xbofs != -1)) { in write_bulk_callback()
598 if ((self->new_speed != self->speed) || in write_bulk_callback()
599 (self->new_xbofs != self->xbofs)) { in write_bulk_callback()
603 irda_usb_change_speed_xbofs(self); in write_bulk_callback()
606 self->new_speed = -1; in write_bulk_callback()
607 self->new_xbofs = -1; in write_bulk_callback()
609 netif_wake_queue(self->netdev); in write_bulk_callback()
613 netif_wake_queue(self->netdev); in write_bulk_callback()
615 spin_unlock_irqrestore(&self->lock, flags); in write_bulk_callback()
630 struct irda_usb_cb *self = netdev_priv(netdev); in irda_usb_net_timeout() local
635 IRDA_ASSERT(self != NULL, return;); in irda_usb_net_timeout()
638 spin_lock_irqsave(&self->lock, flags); in irda_usb_net_timeout()
641 if (!self->present) { in irda_usb_net_timeout()
644 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_net_timeout()
649 urb = self->speed_urb; in irda_usb_net_timeout()
665 netif_wake_queue(self->netdev); in irda_usb_net_timeout()
672 urb = self->tx_urb; in irda_usb_net_timeout()
683 if(self->new_speed == -1) in irda_usb_net_timeout()
684 self->new_speed = self->speed; in irda_usb_net_timeout()
685 if(self->new_xbofs == -1) in irda_usb_net_timeout()
686 self->new_xbofs = self->xbofs; in irda_usb_net_timeout()
687 irda_usb_change_speed_xbofs(self); in irda_usb_net_timeout()
708 netif_wake_queue(self->netdev); in irda_usb_net_timeout()
713 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_net_timeout()
760 static void irda_usb_submit(struct irda_usb_cb *self, struct sk_buff *skb, struct urb *urb) in irda_usb_submit() argument
773 cb->context = self; in irda_usb_submit()
776 usb_fill_bulk_urb(urb, self->usbdev, in irda_usb_submit()
777 usb_rcvbulkpipe(self->usbdev, self->bulk_in_ep), in irda_usb_submit()
802 struct irda_usb_cb *self; in irda_usb_receive() local
814 self = (struct irda_usb_cb *) cb->context; in irda_usb_receive()
815 IRDA_ASSERT(self != NULL, return;); in irda_usb_receive()
818 if ((!self->netopen) || (!self->present)) { in irda_usb_receive()
828 self->netdev->stats.rx_crc_errors++; in irda_usb_receive()
841 self->netdev->stats.rx_errors++; in irda_usb_receive()
855 self->rx_defer_timer.function = &irda_usb_rx_defer_expired; in irda_usb_receive()
856 self->rx_defer_timer.data = (unsigned long) urb; in irda_usb_receive()
857 mod_timer(&self->rx_defer_timer, jiffies + (10 * HZ / 1000)); in irda_usb_receive()
862 if (urb->actual_length <= self->header_length) { in irda_usb_receive()
872 do_gettimeofday(&self->stamp); in irda_usb_receive()
883 if (self->capability & IUC_STIR421X) in irda_usb_receive()
892 self->netdev->stats.rx_dropped++; in irda_usb_receive()
919 skb_pull(dataskb, self->header_length); in irda_usb_receive()
922 dataskb->dev = self->netdev; in irda_usb_receive()
929 self->netdev->stats.rx_bytes += len; in irda_usb_receive()
930 self->netdev->stats.rx_packets++; in irda_usb_receive()
944 next_urb = self->idle_rx_urb; in irda_usb_receive()
948 self->idle_rx_urb = urb; in irda_usb_receive()
952 irda_usb_submit(self, skb, next_urb); in irda_usb_receive()
964 struct irda_usb_cb *self; in irda_usb_rx_defer_expired() local
973 self = (struct irda_usb_cb *) cb->context; in irda_usb_rx_defer_expired()
974 IRDA_ASSERT(self != NULL, return;); in irda_usb_rx_defer_expired()
977 next_urb = self->idle_rx_urb; in irda_usb_rx_defer_expired()
979 self->idle_rx_urb = urb; in irda_usb_rx_defer_expired()
980 irda_usb_submit(self, skb, next_urb); in irda_usb_rx_defer_expired()
988 static int irda_usb_is_receiving(struct irda_usb_cb *self) in irda_usb_is_receiving() argument
1024 static int stir421x_fw_upload(struct irda_usb_cb *self, in stir421x_fw_upload() argument
1048 ret = usb_bulk_msg(self->usbdev, in stir421x_fw_upload()
1049 usb_sndbulkpipe(self->usbdev, in stir421x_fw_upload()
1050 self->bulk_out_ep), in stir421x_fw_upload()
1072 static int stir421x_patch_device(struct irda_usb_cb *self) in stir421x_patch_device() argument
1086 self->usbdev->descriptor.bcdDevice); in stir421x_patch_device()
1087 ret = request_firmware(&fw, stir421x_fw_name, &self->usbdev->dev); in stir421x_patch_device()
1121 if (self->usbdev->descriptor.bcdDevice == cpu_to_le16(fw_version)) { in stir421x_patch_device()
1137 ret = stir421x_fw_upload(self, &fw->data[i], in stir421x_patch_device()
1168 struct irda_usb_cb *self; in irda_usb_net_open() local
1176 self = netdev_priv(netdev); in irda_usb_net_open()
1177 IRDA_ASSERT(self != NULL, return -1;); in irda_usb_net_open()
1179 spin_lock_irqsave(&self->lock, flags); in irda_usb_net_open()
1181 if(!self->present) { in irda_usb_net_open()
1182 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_net_open()
1187 if(self->needspatch) { in irda_usb_net_open()
1188 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_net_open()
1195 self->speed = -1; in irda_usb_net_open()
1196 self->xbofs = -1; in irda_usb_net_open()
1197 self->new_speed = -1; in irda_usb_net_open()
1198 self->new_xbofs = -1; in irda_usb_net_open()
1202 self->netopen = 1; in irda_usb_net_open()
1203 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_net_open()
1210 sprintf(hwname, "usb#%d", self->usbdev->devnum); in irda_usb_net_open()
1211 self->irlap = irlap_open(netdev, &self->qos, hwname); in irda_usb_net_open()
1212 IRDA_ASSERT(self->irlap != NULL, return -1;); in irda_usb_net_open()
1221 self->idle_rx_urb = self->rx_urb[IU_MAX_ACTIVE_RX_URBS]; in irda_usb_net_open()
1222 self->idle_rx_urb->context = NULL; in irda_usb_net_open()
1236 irda_usb_submit(self, skb, self->rx_urb[i]); in irda_usb_net_open()
1252 struct irda_usb_cb *self; in irda_usb_net_close() local
1258 self = netdev_priv(netdev); in irda_usb_net_close()
1259 IRDA_ASSERT(self != NULL, return -1;); in irda_usb_net_close()
1263 self->netopen = 0; in irda_usb_net_close()
1269 del_timer(&self->rx_defer_timer); in irda_usb_net_close()
1272 for (i = 0; i < self->max_rx_urb; i++) { in irda_usb_net_close()
1273 struct urb *urb = self->rx_urb[i]; in irda_usb_net_close()
1284 usb_kill_urb(self->tx_urb); in irda_usb_net_close()
1285 usb_kill_urb(self->speed_urb); in irda_usb_net_close()
1288 if (self->irlap) in irda_usb_net_close()
1289 irlap_close(self->irlap); in irda_usb_net_close()
1290 self->irlap = NULL; in irda_usb_net_close()
1303 struct irda_usb_cb *self; in irda_usb_net_ioctl() local
1307 self = netdev_priv(dev); in irda_usb_net_ioctl()
1308 IRDA_ASSERT(self != NULL, return -1;); in irda_usb_net_ioctl()
1317 spin_lock_irqsave(&self->lock, flags); in irda_usb_net_ioctl()
1319 if(self->present) { in irda_usb_net_ioctl()
1321 self->new_speed = irq->ifr_baudrate; in irda_usb_net_ioctl()
1322 irda_usb_change_speed_xbofs(self); in irda_usb_net_ioctl()
1324 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_net_ioctl()
1330 if(self->netopen) in irda_usb_net_ioctl()
1331 irda_device_set_media_busy(self->netdev, TRUE); in irda_usb_net_ioctl()
1334 irq->ifr_receiving = irda_usb_is_receiving(self); in irda_usb_net_ioctl()
1356 static inline void irda_usb_init_qos(struct irda_usb_cb *self) in irda_usb_init_qos() argument
1362 desc = self->irda_desc; in irda_usb_init_qos()
1365 irda_init_max_qos_capabilies(&self->qos); in irda_usb_init_qos()
1370 self->qos.baud_rate.bits = le16_to_cpu(desc->wBaudRate); in irda_usb_init_qos()
1371 self->qos.min_turn_time.bits = desc->bmMinTurnaroundTime; in irda_usb_init_qos()
1372 self->qos.additional_bofs.bits = desc->bmAdditionalBOFs; in irda_usb_init_qos()
1373 self->qos.window_size.bits = desc->bmWindowSize; in irda_usb_init_qos()
1374 self->qos.data_size.bits = desc->bmDataSize; in irda_usb_init_qos()
1377 …__func__, self->qos.baud_rate.bits, self->qos.data_size.bits, self->qos.window_size.bits, self->qo… in irda_usb_init_qos()
1380 if(self->capability & IUC_SIR_ONLY) in irda_usb_init_qos()
1381 self->qos.baud_rate.bits &= 0x00ff; in irda_usb_init_qos()
1382 if(self->capability & IUC_SMALL_PKT) in irda_usb_init_qos()
1383 self->qos.data_size.bits = 0x07; in irda_usb_init_qos()
1384 if(self->capability & IUC_NO_WINDOW) in irda_usb_init_qos()
1385 self->qos.window_size.bits = 0x01; in irda_usb_init_qos()
1386 if(self->capability & IUC_MAX_WINDOW) in irda_usb_init_qos()
1387 self->qos.window_size.bits = 0x7f; in irda_usb_init_qos()
1388 if(self->capability & IUC_MAX_XBOFS) in irda_usb_init_qos()
1389 self->qos.additional_bofs.bits = 0x01; in irda_usb_init_qos()
1394 self->qos.min_turn_time.bits = qos_mtt_bits; in irda_usb_init_qos()
1400 irda_qos_bits_to_value(&self->qos); in irda_usb_init_qos()
1408 static inline int irda_usb_open(struct irda_usb_cb *self) in irda_usb_open() argument
1410 struct net_device *netdev = self->netdev; in irda_usb_open()
1414 irda_usb_init_qos(self); in irda_usb_open()
1432 static inline void irda_usb_close(struct irda_usb_cb *self) in irda_usb_close() argument
1437 unregister_netdev(self->netdev); in irda_usb_close()
1440 kfree(self->speed_buff); in irda_usb_close()
1441 self->speed_buff = NULL; in irda_usb_close()
1443 kfree(self->tx_buff); in irda_usb_close()
1444 self->tx_buff = NULL; in irda_usb_close()
1466 static inline int irda_usb_parse_endpoints(struct irda_usb_cb *self, struct usb_host_endpoint *endp… in irda_usb_parse_endpoints() argument
1471 self->bulk_in_ep = 0; in irda_usb_parse_endpoints()
1472 self->bulk_out_ep = 0; in irda_usb_parse_endpoints()
1473 self->bulk_int_ep = 0; in irda_usb_parse_endpoints()
1495 self->bulk_in_ep = ep; in irda_usb_parse_endpoints()
1498 self->bulk_out_ep = ep; in irda_usb_parse_endpoints()
1499 self->bulk_out_mtu = psize; in irda_usb_parse_endpoints()
1505 self->bulk_int_ep = ep; in irda_usb_parse_endpoints()
1513 __func__, self->bulk_in_ep, self->bulk_out_ep, self->bulk_out_mtu, self->bulk_int_ep); in irda_usb_parse_endpoints()
1515 return((self->bulk_in_ep != 0) && (self->bulk_out_ep != 0)); in irda_usb_parse_endpoints()
1613 struct irda_usb_cb *self; in irda_usb_probe() local
1628 net = alloc_irdadev(sizeof(*self)); in irda_usb_probe()
1633 self = netdev_priv(net); in irda_usb_probe()
1634 self->netdev = net; in irda_usb_probe()
1635 spin_lock_init(&self->lock); in irda_usb_probe()
1636 init_timer(&self->rx_defer_timer); in irda_usb_probe()
1638 self->capability = id->driver_info; in irda_usb_probe()
1639 self->needspatch = ((self->capability & IUC_STIR421X) != 0); in irda_usb_probe()
1642 if (self->capability & IUC_STIR421X) { in irda_usb_probe()
1643 self->max_rx_urb = IU_SIGMATEL_MAX_RX_URBS; in irda_usb_probe()
1644 self->header_length = USB_IRDA_STIR421X_HEADER; in irda_usb_probe()
1646 self->max_rx_urb = IU_MAX_RX_URBS; in irda_usb_probe()
1647 self->header_length = USB_IRDA_HEADER; in irda_usb_probe()
1650 self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *), in irda_usb_probe()
1653 for (i = 0; i < self->max_rx_urb; i++) { in irda_usb_probe()
1654 self->rx_urb[i] = usb_alloc_urb(0, GFP_KERNEL); in irda_usb_probe()
1655 if (!self->rx_urb[i]) { in irda_usb_probe()
1659 self->tx_urb = usb_alloc_urb(0, GFP_KERNEL); in irda_usb_probe()
1660 if (!self->tx_urb) { in irda_usb_probe()
1663 self->speed_urb = usb_alloc_urb(0, GFP_KERNEL); in irda_usb_probe()
1664 if (!self->speed_urb) { in irda_usb_probe()
1698 if(!irda_usb_parse_endpoints(self, interface->endpoint, in irda_usb_probe()
1705 self->usbdev = dev; in irda_usb_probe()
1713 if (self->needspatch) { in irda_usb_probe()
1714 ret = usb_control_msg (self->usbdev, usb_sndctrlpipe (self->usbdev, 0), in irda_usb_probe()
1724 self->irda_desc = irda_desc; in irda_usb_probe()
1725 self->present = 1; in irda_usb_probe()
1726 self->netopen = 0; in irda_usb_probe()
1727 self->usbintf = intf; in irda_usb_probe()
1733 self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL); in irda_usb_probe()
1734 if (!self->speed_buff) in irda_usb_probe()
1737 self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length, in irda_usb_probe()
1739 if (!self->tx_buff) in irda_usb_probe()
1742 ret = irda_usb_open(self); in irda_usb_probe()
1747 usb_set_intfdata(intf, self); in irda_usb_probe()
1749 if (self->needspatch) { in irda_usb_probe()
1751 ret = stir421x_patch_device(self); in irda_usb_probe()
1752 self->needspatch = (ret < 0); in irda_usb_probe()
1753 if (self->needspatch) { in irda_usb_probe()
1759 irda_desc = irda_usb_find_class_desc (self->usbintf); in irda_usb_probe()
1764 kfree(self->irda_desc); in irda_usb_probe()
1765 self->irda_desc = irda_desc; in irda_usb_probe()
1766 irda_usb_init_qos(self); in irda_usb_probe()
1771 unregister_netdev(self->netdev); in irda_usb_probe()
1773 kfree(self->tx_buff); in irda_usb_probe()
1775 kfree(self->speed_buff); in irda_usb_probe()
1778 usb_free_urb(self->speed_urb); in irda_usb_probe()
1780 usb_free_urb(self->tx_urb); in irda_usb_probe()
1782 for (i = 0; i < self->max_rx_urb; i++) in irda_usb_probe()
1783 usb_free_urb(self->rx_urb[i]); in irda_usb_probe()
1804 struct irda_usb_cb *self = usb_get_intfdata(intf); in irda_usb_disconnect() local
1810 if (!self) in irda_usb_disconnect()
1814 spin_lock_irqsave(&self->lock, flags); in irda_usb_disconnect()
1818 self->present = 0; in irda_usb_disconnect()
1821 del_timer(&self->rx_defer_timer); in irda_usb_disconnect()
1825 spin_unlock_irqrestore(&self->lock, flags); in irda_usb_disconnect()
1828 if((self->netopen) || (self->irlap)) { in irda_usb_disconnect()
1831 netif_stop_queue(self->netdev); in irda_usb_disconnect()
1833 for (i = 0; i < self->max_rx_urb; i++) in irda_usb_disconnect()
1834 usb_kill_urb(self->rx_urb[i]); in irda_usb_disconnect()
1837 usb_kill_urb(self->tx_urb); in irda_usb_disconnect()
1838 usb_kill_urb(self->speed_urb); in irda_usb_disconnect()
1842 irda_usb_close(self); in irda_usb_disconnect()
1844 self->usbdev = NULL; in irda_usb_disconnect()
1845 self->usbintf = NULL; in irda_usb_disconnect()
1848 for (i = 0; i < self->max_rx_urb; i++) in irda_usb_disconnect()
1849 usb_free_urb(self->rx_urb[i]); in irda_usb_disconnect()
1850 kfree(self->rx_urb); in irda_usb_disconnect()
1852 usb_free_urb(self->tx_urb); in irda_usb_disconnect()
1853 usb_free_urb(self->speed_urb); in irda_usb_disconnect()
1856 free_netdev(self->netdev); in irda_usb_disconnect()