diff options
Diffstat (limited to 'drivers/media/rc')
-rw-r--r-- | drivers/media/rc/mceusb.c | 65 | ||||
-rw-r--r-- | drivers/media/rc/redrat3.c | 102 | ||||
-rw-r--r-- | drivers/media/rc/streamzap.c | 9 |
3 files changed, 58 insertions, 118 deletions
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 5d8f3d40d82..d5c1df3c9db 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -747,11 +747,19 @@ static void mce_request_packet(struct mceusb_dev *ir, unsigned char *data, } /* outbound data */ - pipe = usb_sndintpipe(ir->usbdev, - ir->usb_ep_out->bEndpointAddress); - usb_fill_int_urb(async_urb, ir->usbdev, pipe, - async_buf, size, mce_async_callback, - ir, ir->usb_ep_out->bInterval); + if (usb_endpoint_xfer_int(ir->usb_ep_out)) { + pipe = usb_sndintpipe(ir->usbdev, + ir->usb_ep_out->bEndpointAddress); + usb_fill_int_urb(async_urb, ir->usbdev, pipe, async_buf, + size, mce_async_callback, ir, + ir->usb_ep_out->bInterval); + } else { + pipe = usb_sndbulkpipe(ir->usbdev, + ir->usb_ep_out->bEndpointAddress); + usb_fill_bulk_urb(async_urb, ir->usbdev, pipe, + async_buf, size, mce_async_callback, + ir); + } memcpy(async_buf, data, size); } else if (urb_type == MCEUSB_RX) { @@ -1269,32 +1277,26 @@ static int mceusb_dev_probe(struct usb_interface *intf, for (i = 0; i < idesc->desc.bNumEndpoints; ++i) { ep = &idesc->endpoint[i].desc; - if ((ep_in == NULL) - && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) - == USB_DIR_IN) - && (((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_BULK) - || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_INT))) { - - ep_in = ep; - ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; - ep_in->bInterval = 1; - dev_dbg(&intf->dev, "acceptable inbound endpoint found"); + if (ep_in == NULL) { + if (usb_endpoint_is_bulk_in(ep)) { + ep_in = ep; + dev_dbg(&intf->dev, "acceptable bulk inbound endpoint found\n"); + } else if (usb_endpoint_is_int_in(ep)) { + ep_in = ep; + ep_in->bInterval = 1; + dev_dbg(&intf->dev, "acceptable interrupt inbound endpoint found\n"); + } } - if ((ep_out == NULL) - && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) - == USB_DIR_OUT) - && (((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_BULK) - || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) - == USB_ENDPOINT_XFER_INT))) { - - ep_out = ep; - ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; - ep_out->bInterval = 1; - dev_dbg(&intf->dev, "acceptable outbound endpoint found"); + if (ep_out == NULL) { + if (usb_endpoint_is_bulk_out(ep)) { + ep_out = ep; + dev_dbg(&intf->dev, "acceptable bulk outbound endpoint found\n"); + } else if (usb_endpoint_is_int_out(ep)) { + ep_out = ep; + ep_out->bInterval = 1; + dev_dbg(&intf->dev, "acceptable interrupt outbound endpoint found\n"); + } } } if (ep_in == NULL) { @@ -1302,7 +1304,10 @@ static int mceusb_dev_probe(struct usb_interface *intf, return -ENODEV; } - pipe = usb_rcvintpipe(dev, ep_in->bEndpointAddress); + if (usb_endpoint_xfer_int(ep_in)) + pipe = usb_rcvintpipe(dev, ep_in->bEndpointAddress); + else + pipe = usb_rcvbulkpipe(dev, ep_in->bEndpointAddress); maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL); diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index 47cd373e229..79abbc8d960 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -60,28 +60,6 @@ #define DRIVER_DESC "RedRat3 USB IR Transceiver Driver" #define DRIVER_NAME "redrat3" -/* module parameters */ -#ifdef CONFIG_USB_DEBUG -static int debug = 1; -#else -static int debug; -#endif - -#define RR3_DEBUG_STANDARD 0x1 -#define RR3_DEBUG_FUNCTION_TRACE 0x2 - -#define rr3_dbg(dev, fmt, ...) \ - do { \ - if (debug & RR3_DEBUG_STANDARD) \ - dev_info(dev, fmt, ## __VA_ARGS__); \ - } while (0) - -#define rr3_ftr(dev, fmt, ...) \ - do { \ - if (debug & RR3_DEBUG_FUNCTION_TRACE) \ - dev_info(dev, fmt, ## __VA_ARGS__); \ - } while (0) - /* bulk data transfer types */ #define RR3_ERROR 0x01 #define RR3_MOD_SIGNAL_IN 0x20 @@ -237,13 +215,11 @@ static void redrat3_issue_async(struct redrat3_dev *rr3) { int res; - rr3_ftr(rr3->dev, "Entering %s\n", __func__); - res = usb_submit_urb(rr3->read_urb, GFP_ATOMIC); if (res) - rr3_dbg(rr3->dev, "%s: receive request FAILED! " - "(res %d, len %d)\n", __func__, res, - rr3->read_urb->transfer_buffer_length); + dev_dbg(rr3->dev, + "%s: receive request FAILED! (res %d, len %d)\n", + __func__, res, rr3->read_urb->transfer_buffer_length); } static void redrat3_dump_fw_error(struct redrat3_dev *rr3, int code) @@ -359,7 +335,7 @@ static void redrat3_rx_timeout(unsigned long data) { struct redrat3_dev *rr3 = (struct redrat3_dev *)data; - rr3_dbg(rr3->dev, "calling ir_raw_event_reset\n"); + dev_dbg(rr3->dev, "calling ir_raw_event_reset\n"); ir_raw_event_reset(rr3->rc); } @@ -377,8 +353,6 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) return; } - rr3_ftr(rr3->dev, "Entered %s\n", __func__); - dev = rr3->dev; /* Make sure we reset the IR kfifo after a bit of inactivity */ @@ -386,7 +360,7 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) mod_timer(&rr3->rx_timeout, jiffies + delay); mod_freq = redrat3_val_to_mod_freq(&rr3->irdata); - rr3_dbg(dev, "Got mod_freq of %u\n", mod_freq); + dev_dbg(dev, "Got mod_freq of %u\n", mod_freq); /* process each rr3 encoded byte into an int */ sig_size = be16_to_cpu(rr3->irdata.sig_size); @@ -408,7 +382,7 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) /* cap the value to IR_MAX_DURATION */ rawir.duration &= IR_MAX_DURATION; - rr3_dbg(dev, "storing %s with duration %d (i: %d)\n", + dev_dbg(dev, "storing %s with duration %d (i: %d)\n", rawir.pulse ? "pulse" : "space", rawir.duration, i); ir_raw_event_store_with_filter(rr3->rc, &rawir); } @@ -421,12 +395,12 @@ static void redrat3_process_ir_data(struct redrat3_dev *rr3) rawir.duration = US_TO_NS(2800); else rawir.duration = trailer; - rr3_dbg(dev, "storing trailing space with duration %d\n", + dev_dbg(dev, "storing trailing space with duration %d\n", rawir.duration); ir_raw_event_store_with_filter(rr3->rc, &rawir); } - rr3_dbg(dev, "calling ir_raw_event_handle\n"); + dev_dbg(dev, "calling ir_raw_event_handle\n"); ir_raw_event_handle(rr3->rc); } @@ -464,8 +438,6 @@ static int redrat3_enable_detector(struct redrat3_dev *rr3) struct device *dev = rr3->dev; u8 ret; - rr3_ftr(dev, "Entering %s\n", __func__); - ret = redrat3_send_cmd(RR3_RC_DET_ENABLE, rr3); if (ret != 0) dev_dbg(dev, "%s: unexpected ret of %d\n", @@ -486,7 +458,6 @@ static int redrat3_enable_detector(struct redrat3_dev *rr3) static inline void redrat3_delete(struct redrat3_dev *rr3, struct usb_device *udev) { - rr3_ftr(rr3->dev, "%s cleaning up\n", __func__); usb_kill_urb(rr3->read_urb); usb_kill_urb(rr3->flash_urb); usb_free_urb(rr3->read_urb); @@ -519,7 +490,7 @@ static u32 redrat3_get_timeout(struct redrat3_dev *rr3) else { timeout = redrat3_len_to_us(be32_to_cpup(tmp)); - rr3_dbg(rr3->dev, "Got timeout of %d ms\n", timeout / 1000); + dev_dbg(rr3->dev, "Got timeout of %d ms\n", timeout / 1000); } kfree(tmp); @@ -535,8 +506,6 @@ static void redrat3_reset(struct redrat3_dev *rr3) u8 *val; int len = sizeof(u8); - rr3_ftr(dev, "Entering %s\n", __func__); - rxpipe = usb_rcvctrlpipe(udev, 0); txpipe = usb_sndctrlpipe(udev, 0); @@ -550,19 +519,19 @@ static void redrat3_reset(struct redrat3_dev *rr3) rc = usb_control_msg(udev, rxpipe, RR3_RESET, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, RR3_CPUCS_REG_ADDR, 0, val, len, HZ * 25); - rr3_dbg(dev, "reset returned 0x%02x\n", rc); + dev_dbg(dev, "reset returned 0x%02x\n", rc); *val = 5; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, RR3_IR_IO_LENGTH_FUZZ, 0, val, len, HZ * 25); - rr3_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); + dev_dbg(dev, "set ir parm len fuzz %d rc 0x%02x\n", *val, rc); *val = RR3_DRIVER_MAXLENS; rc = usb_control_msg(udev, txpipe, RR3_SET_IR_PARAM, USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT, RR3_IR_IO_MAX_LENGTHS, 0, val, len, HZ * 25); - rr3_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); + dev_dbg(dev, "set ir parm max lens %d rc 0x%02x\n", *val, rc); kfree(val); } @@ -572,8 +541,6 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) int rc = 0; char *buffer; - rr3_ftr(rr3->dev, "Entering %s\n", __func__); - buffer = kzalloc(sizeof(char) * (RR3_FW_VERSION_LEN + 1), GFP_KERNEL); if (!buffer) { dev_err(rr3->dev, "Memory allocation failure\n"); @@ -591,7 +558,6 @@ static void redrat3_get_firmware_rev(struct redrat3_dev *rr3) dev_err(rr3->dev, "Problem fetching firmware ID\n"); kfree(buffer); - rr3_ftr(rr3->dev, "Exiting %s\n", __func__); } static void redrat3_read_packet_start(struct redrat3_dev *rr3, unsigned len) @@ -599,8 +565,6 @@ static void redrat3_read_packet_start(struct redrat3_dev *rr3, unsigned len) struct redrat3_header *header = rr3->bulk_in_buf; unsigned pktlen, pkttype; - rr3_ftr(rr3->dev, "Entering %s\n", __func__); - /* grab the Length and type of transfer */ pktlen = be16_to_cpu(header->length); pkttype = be16_to_cpu(header->transfer_type); @@ -622,12 +586,12 @@ static void redrat3_read_packet_start(struct redrat3_dev *rr3, unsigned len) case RR3_MOD_SIGNAL_IN: memcpy(&rr3->irdata, rr3->bulk_in_buf, len); rr3->bytes_read = len; - rr3_dbg(rr3->dev, "bytes_read %d, pktlen %d\n", + dev_dbg(rr3->dev, "bytes_read %d, pktlen %d\n", rr3->bytes_read, pktlen); break; default: - rr3_dbg(rr3->dev, "ignoring packet with type 0x%02x, len of %d, 0x%02x\n", + dev_dbg(rr3->dev, "ignoring packet with type 0x%02x, len of %d, 0x%02x\n", pkttype, len, pktlen); break; } @@ -637,8 +601,6 @@ static void redrat3_read_packet_continue(struct redrat3_dev *rr3, unsigned len) { void *irdata = &rr3->irdata; - rr3_ftr(rr3->dev, "Entering %s\n", __func__); - if (len + rr3->bytes_read > sizeof(rr3->irdata)) { dev_warn(rr3->dev, "too much data for packet\n"); rr3->bytes_read = 0; @@ -648,7 +610,7 @@ static void redrat3_read_packet_continue(struct redrat3_dev *rr3, unsigned len) memcpy(irdata + rr3->bytes_read, rr3->bulk_in_buf, len); rr3->bytes_read += len; - rr3_dbg(rr3->dev, "bytes_read %d, pktlen %d\n", rr3->bytes_read, + dev_dbg(rr3->dev, "bytes_read %d, pktlen %d\n", rr3->bytes_read, be16_to_cpu(rr3->irdata.header.length)); } @@ -659,8 +621,6 @@ static int redrat3_get_ir_data(struct redrat3_dev *rr3, unsigned len) unsigned pkttype; int ret = 0; - rr3_ftr(dev, "Entering %s\n", __func__); - if (rr3->bytes_read == 0 && len >= sizeof(struct redrat3_header)) { redrat3_read_packet_start(rr3, len); } else if (rr3->bytes_read != 0) { @@ -681,7 +641,7 @@ static int redrat3_get_ir_data(struct redrat3_dev *rr3, unsigned len) if (pkttype == RR3_MOD_SIGNAL_IN) redrat3_process_ir_data(rr3); else - rr3_dbg(dev, "discarding non-signal data packet (type 0x%02x)\n", + dev_dbg(dev, "discarding non-signal data packet (type 0x%02x)\n", pkttype); out: @@ -705,8 +665,6 @@ static void redrat3_handle_async(struct urb *urb) return; } - rr3_ftr(rr3->dev, "Entering %s\n", __func__); - switch (urb->status) { case 0: ret = redrat3_get_ir_data(rr3, urb->actual_length); @@ -743,7 +701,7 @@ static int redrat3_set_tx_carrier(struct rc_dev *rcdev, u32 carrier) struct redrat3_dev *rr3 = rcdev->priv; struct device *dev = rr3->dev; - rr3_dbg(dev, "Setting modulation frequency to %u", carrier); + dev_dbg(dev, "Setting modulation frequency to %u", carrier); if (carrier == 0) return -EINVAL; @@ -764,8 +722,6 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, u8 curlencheck = 0; unsigned i, sendbuf_len; - rr3_ftr(dev, "Entering %s\n", __func__); - if (rr3->transmitting) { dev_warn(dev, "%s: transmitter already in use\n", __func__); return -EAGAIN; @@ -801,7 +757,7 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, break; } if (lencheck == curlencheck) { - rr3_dbg(dev, "txbuf[%d]=%u, pos %d, enc %u\n", + dev_dbg(dev, "txbuf[%d]=%u, pos %d, enc %u\n", i, txbuf[i], curlencheck, cur_sample_len); if (curlencheck < RR3_DRIVER_MAXLENS) { /* now convert the value to a proper @@ -835,7 +791,7 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, pipe = usb_sndbulkpipe(rr3->udev, rr3->ep_out->bEndpointAddress); ret = usb_bulk_msg(rr3->udev, pipe, irdata, sendbuf_len, &ret_len, 10 * HZ); - rr3_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); + dev_dbg(dev, "sent %d bytes, (ret %d)\n", ret_len, ret); /* now tell the hardware to transmit what we sent it */ pipe = usb_rcvctrlpipe(rr3->udev, 0); @@ -957,8 +913,6 @@ static int redrat3_dev_probe(struct usb_interface *intf, int pipe, i; int retval = -ENOMEM; - rr3_ftr(dev, "%s called\n", __func__); - uhi = intf->cur_altsetting; /* find our bulk-in and bulk-out endpoints */ @@ -971,7 +925,7 @@ static int redrat3_dev_probe(struct usb_interface *intf, ((addr & USB_ENDPOINT_DIR_MASK) == USB_DIR_IN) && ((attrs & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) { - rr3_dbg(dev, "found bulk-in endpoint at 0x%02x\n", + dev_dbg(dev, "found bulk-in endpoint at 0x%02x\n", ep->bEndpointAddress); /* data comes in on 0x82, 0x81 is for other data... */ if (ep->bEndpointAddress == RR3_BULK_IN_EP_ADDR) @@ -982,7 +936,7 @@ static int redrat3_dev_probe(struct usb_interface *intf, ((addr & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) && ((attrs & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_BULK)) { - rr3_dbg(dev, "found bulk-out endpoint at 0x%02x\n", + dev_dbg(dev, "found bulk-out endpoint at 0x%02x\n", ep->bEndpointAddress); ep_out = ep; } @@ -1074,7 +1028,6 @@ static int redrat3_dev_probe(struct usb_interface *intf, /* we can register the device now, as it is ready */ usb_set_intfdata(intf, rr3); - rr3_ftr(dev, "Exiting %s\n", __func__); return 0; led_free_error: @@ -1093,8 +1046,6 @@ static void redrat3_dev_disconnect(struct usb_interface *intf) struct usb_device *udev = interface_to_usbdev(intf); struct redrat3_dev *rr3 = usb_get_intfdata(intf); - rr3_ftr(&intf->dev, "Entering %s\n", __func__); - if (!rr3) return; @@ -1103,14 +1054,12 @@ static void redrat3_dev_disconnect(struct usb_interface *intf) led_classdev_unregister(&rr3->led); del_timer_sync(&rr3->rx_timeout); redrat3_delete(rr3, udev); - - rr3_ftr(&intf->dev, "RedRat3 IR Transceiver now disconnected\n"); } static int redrat3_dev_suspend(struct usb_interface *intf, pm_message_t message) { struct redrat3_dev *rr3 = usb_get_intfdata(intf); - rr3_ftr(rr3->dev, "suspend\n"); + led_classdev_suspend(&rr3->led); usb_kill_urb(rr3->read_urb); usb_kill_urb(rr3->flash_urb); @@ -1120,7 +1069,7 @@ static int redrat3_dev_suspend(struct usb_interface *intf, pm_message_t message) static int redrat3_dev_resume(struct usb_interface *intf) { struct redrat3_dev *rr3 = usb_get_intfdata(intf); - rr3_ftr(rr3->dev, "resume\n"); + if (usb_submit_urb(rr3->read_urb, GFP_ATOMIC)) return -EIO; led_classdev_resume(&rr3->led); @@ -1144,8 +1093,3 @@ MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR2); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(usb, redrat3_dev_table); - -module_param(debug, int, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "Enable module debug spew. 0 = no debugging (default) " - "0x1 = standard debug messages, 0x2 = function tracing debug. " - "Flag bits are addative (i.e., 0x3 for both debug types)."); diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index f4e0bc3d382..bd5e4ff9e0b 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -42,12 +42,6 @@ #define DRIVER_NAME "streamzap" #define DRIVER_DESC "Streamzap Remote Control driver" -#ifdef CONFIG_USB_DEBUG -static bool debug = 1; -#else -static bool debug; -#endif - #define USB_STREAMZAP_VENDOR_ID 0x0e9c #define USB_STREAMZAP_PRODUCT_ID 0x0000 @@ -528,6 +522,3 @@ module_usb_driver(streamzap_driver); MODULE_AUTHOR("Jarod Wilson <jarod@wilsonet.com>"); MODULE_DESCRIPTION(DRIVER_DESC); MODULE_LICENSE("GPL"); - -module_param(debug, bool, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(debug, "Enable debugging messages"); |