19 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
21 #include <linux/module.h>
22 #include <linux/kernel.h>
29 #include <linux/slab.h>
30 #include <linux/prefetch.h>
59 .bInterfaceClass = 0xff,
60 .bInterfaceSubClass = 0x00,
61 .bInterfaceProtocol = 0x00,
73 static bool fb_defio = 1;
75 static int pixel_limit;
78 static void dlfb_urb_completion(
struct urb *
urb);
97 static char *dlfb_vidreg_lock(
char *
buf)
99 return dlfb_set_register(buf, 0xFF, 0x00);
102 static char *dlfb_vidreg_unlock(
char *
buf)
104 return dlfb_set_register(buf, 0xFF, 0xFF);
117 static char *dlfb_blanking(
char *
buf,
int fb_blank)
138 buf = dlfb_set_register(buf, 0x1F, reg);
143 static char *dlfb_set_color_depth(
char *buf,
u8 selection)
145 return dlfb_set_register(buf, 0x00, selection);
148 static char *dlfb_set_base16bpp(
char *wrptr,
u32 base)
151 wrptr = dlfb_set_register(wrptr, 0x20, base >> 16);
152 wrptr = dlfb_set_register(wrptr, 0x21, base >> 8);
153 return dlfb_set_register(wrptr, 0x22, base);
160 static char *dlfb_set_base8bpp(
char *wrptr,
u32 base)
162 wrptr = dlfb_set_register(wrptr, 0x26, base >> 16);
163 wrptr = dlfb_set_register(wrptr, 0x27, base >> 8);
164 return dlfb_set_register(wrptr, 0x28, base);
167 static char *dlfb_set_register_16(
char *wrptr,
u8 reg,
u16 value)
169 wrptr = dlfb_set_register(wrptr, reg, value >> 8);
170 return dlfb_set_register(wrptr, reg+1, value);
177 static char *dlfb_set_register_16be(
char *wrptr,
u8 reg,
u16 value)
179 wrptr = dlfb_set_register(wrptr, reg, value);
180 return dlfb_set_register(wrptr, reg+1, value >> 8);
192 static u16 dlfb_lfsr16(
u16 actual_count)
196 while (actual_count--) {
198 (((lv >> 15) ^ (lv >> 4) ^ (lv >> 2) ^ (lv >> 1)) & 1))
209 static char *dlfb_set_register_lfsr16(
char *wrptr,
u8 reg,
u16 value)
211 return dlfb_set_register_16(wrptr, reg, dlfb_lfsr16(value));
226 wrptr = dlfb_set_register_lfsr16(wrptr, 0x01, xds);
228 xde = xds + var->
xres;
229 wrptr = dlfb_set_register_lfsr16(wrptr, 0x03, xde);
233 wrptr = dlfb_set_register_lfsr16(wrptr, 0x05, yds);
235 yde = yds + var->
yres;
236 wrptr = dlfb_set_register_lfsr16(wrptr, 0x07, yde);
239 wrptr = dlfb_set_register_lfsr16(wrptr, 0x09,
243 wrptr = dlfb_set_register_lfsr16(wrptr, 0x0B, 1);
246 wrptr = dlfb_set_register_lfsr16(wrptr, 0x0D, var->
hsync_len + 1);
249 wrptr = dlfb_set_register_16(wrptr, 0x0F, var->
xres);
254 wrptr = dlfb_set_register_lfsr16(wrptr, 0x11, yec);
257 wrptr = dlfb_set_register_lfsr16(wrptr, 0x13, 0);
260 wrptr = dlfb_set_register_lfsr16(wrptr, 0x15, var->
vsync_len);
263 wrptr = dlfb_set_register_16(wrptr, 0x17, var->
yres);
266 wrptr = dlfb_set_register_16be(wrptr, 0x1B,
289 urb = dlfb_get_urb(dev);
293 buf = (
char *) urb->transfer_buffer;
300 wrptr = dlfb_vidreg_lock(buf);
301 wrptr = dlfb_set_color_depth(wrptr, 0x00);
303 wrptr = dlfb_set_base16bpp(wrptr, 0);
305 wrptr = dlfb_set_base8bpp(wrptr, dev->
info->fix.smem_len);
307 wrptr = dlfb_set_vid_cmds(wrptr, var);
309 wrptr = dlfb_vidreg_unlock(wrptr);
311 writesize = wrptr -
buf;
313 retval = dlfb_submit_urb(dev, urb, writesize);
327 if (offset + size > info->
fix.smem_len)
330 pos = (
unsigned long)info->
fix.smem_start + offset;
332 pr_notice(
"mmap() framebuffer addr:%lu size:%lu\n",
358 static int dlfb_trim_hline(
const u8 *bback,
const u8 **bfront,
int *width_bytes)
361 const unsigned long *back = (
const unsigned long *) bback;
362 const unsigned long *front = (
const unsigned long *) *bfront;
363 const int width = *width_bytes /
sizeof(
unsigned long);
364 int identical =
width;
371 for (j = 0; j <
width; j++) {
372 if (back[j] != front[j]) {
378 for (k = width - 1; k >
j; k--) {
379 if (back[k] != front[k]) {
385 identical = start + (width -
end);
386 *bfront = (
u8 *) &front[start];
387 *width_bytes = (end -
start) *
sizeof(
unsigned long);
389 return identical *
sizeof(
unsigned long);
419 static void dlfb_compress_hline(
424 const uint8_t *
const cmd_buffer_end)
426 const uint16_t *pixel = *pixel_start_ptr;
431 while ((pixel_end > pixel) &&
433 uint8_t *raw_pixels_count_byte = 0;
434 uint8_t *cmd_pixels_count_byte = 0;
435 const uint16_t *raw_pixel_start = 0;
436 const uint16_t *cmd_pixel_start, *cmd_pixel_end = 0;
442 *cmd++ = (
uint8_t) ((dev_addr >> 16) & 0xFF);
443 *cmd++ = (
uint8_t) ((dev_addr >> 8) & 0xFF);
444 *cmd++ = (
uint8_t) ((dev_addr) & 0xFF);
446 cmd_pixels_count_byte = cmd++;
447 cmd_pixel_start = pixel;
449 raw_pixels_count_byte = cmd++;
450 raw_pixel_start = pixel;
453 min((
int)(pixel_end - pixel),
454 (
int)(cmd_buffer_end - cmd) / bpp));
456 prefetch_range((
void *) pixel, (cmd_pixel_end - pixel) * bpp);
458 while (pixel < cmd_pixel_end) {
459 const uint16_t *
const repeating_pixel = pixel;
465 if (
unlikely((pixel < cmd_pixel_end) &&
466 (*pixel == *repeating_pixel))) {
468 *raw_pixels_count_byte = ((repeating_pixel -
469 raw_pixel_start) + 1) & 0xFF;
471 while ((pixel < cmd_pixel_end)
472 && (*pixel == *repeating_pixel)) {
477 *cmd++ = ((pixel - repeating_pixel) - 1) & 0xFF;
480 raw_pixel_start = pixel;
481 raw_pixels_count_byte = cmd++;
485 if (pixel > raw_pixel_start) {
487 *raw_pixels_count_byte = (pixel-raw_pixel_start) & 0xFF;
490 *cmd_pixels_count_byte = (pixel - cmd_pixel_start) & 0xFF;
491 dev_addr += (pixel - cmd_pixel_start) * bpp;
496 if (cmd_buffer_end > cmd)
497 memset(cmd, 0xAF, cmd_buffer_end - cmd);
498 cmd = (
uint8_t *) cmd_buffer_end;
501 *command_buffer_ptr =
cmd;
502 *pixel_start_ptr = pixel;
503 *device_address_ptr = dev_addr;
514 static int dlfb_render_hline(
struct dlfb_data *dev,
struct urb **urb_ptr,
515 const char *front,
char **urb_buf_ptr,
517 int *ident_ptr,
int *sent_ptr)
519 const u8 *line_start, *line_end, *next_pixel;
521 struct urb *urb = *urb_ptr;
522 u8 *cmd = *urb_buf_ptr;
523 u8 *cmd_end = (
u8 *) urb->transfer_buffer + urb->transfer_buffer_length;
526 next_pixel = line_start;
527 line_end = next_pixel + byte_width;
534 *ident_ptr += dlfb_trim_hline(back_start, &next_pixel,
537 offset = next_pixel - line_start;
538 line_end = next_pixel + byte_width;
543 memcpy((
char *)back_start, (
char *) line_start,
547 while (next_pixel < line_end) {
549 dlfb_compress_hline((
const uint16_t **) &next_pixel,
550 (
const uint16_t *) line_end, &dev_addr,
551 (
u8 **) &cmd, (
u8 *) cmd_end);
553 if (cmd >= cmd_end) {
554 int len = cmd - (
u8 *) urb->transfer_buffer;
555 if (dlfb_submit_urb(dev, urb, len))
558 urb = dlfb_get_urb(dev);
562 cmd = urb->transfer_buffer;
563 cmd_end = &cmd[urb->transfer_buffer_length];
579 int bytes_identical = 0;
586 width =
DL_ALIGN_UP(width + (x-aligned_x),
sizeof(
unsigned long));
590 (x + width > dev->
info->var.xres) ||
591 (y + height > dev->
info->var.yres))
597 urb = dlfb_get_urb(dev);
600 cmd = urb->transfer_buffer;
602 for (i = y; i < y +
height ; i++) {
603 const int line_offset = dev->
info->fix.line_length *
i;
604 const int byte_offset = line_offset + (x *
BPP);
606 if (dlfb_render_hline(dev, &urb,
607 (
char *) dev->
info->fix.smem_start,
608 &cmd, byte_offset, width *
BPP,
609 &bytes_identical, &bytes_sent))
613 if (cmd > (
char *) urb->transfer_buffer) {
615 int len = cmd - (
char *) urb->transfer_buffer;
616 ret = dlfb_submit_urb(dev, urb, len);
619 dlfb_urb_completion(urb);
626 atomic_add(((
unsigned int) ((end_cycles - start_cycles)
639 static ssize_t dlfb_ops_write(
struct fb_info *info,
const char __user *buf,
640 size_t count, loff_t *ppos)
649 int start =
max((
int)(offset / info->
fix.line_length), 0);
650 int lines =
min((
u32)((result / info->
fix.line_length) + 1),
661 static void dlfb_ops_copyarea(
struct fb_info *info,
673 static void dlfb_ops_imageblit(
struct fb_info *info,
684 static void dlfb_ops_fillrect(
struct fb_info *info,
701 static void dlfb_dpy_deferred_io(
struct fb_info *info,
705 struct fb_deferred_io *fbdefio = info->fbdefio;
711 int bytes_identical = 0;
712 int bytes_rendered = 0;
722 urb = dlfb_get_urb(dev);
726 cmd = urb->transfer_buffer;
731 if (dlfb_render_hline(dev, &urb, (
char *) info->
fix.smem_start,
733 PAGE_SIZE, &bytes_identical, &bytes_sent))
738 if (cmd > (
char *) urb->transfer_buffer) {
740 int len = cmd - (
char *) urb->transfer_buffer;
741 dlfb_submit_urb(dev, urb, len);
744 dlfb_urb_completion(urb);
751 atomic_add(((
unsigned int) ((end_cycles - start_cycles)
756 static int dlfb_get_edid(
struct dlfb_data *dev,
char *
edid,
int len)
766 for (i = 0; i < len; i++) {
768 usb_rcvctrlpipe(dev->
udev, 0), (0x02),
769 (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2,
772 pr_err(
"Read EDID byte %d failed err %x\n", i, ret);
784 static int dlfb_ops_ioctl(
struct fb_info *info,
unsigned int cmd,
822 if (area.x > info->
var.xres)
823 area.x = info->
var.xres;
828 if (area.y > info->
var.yres)
829 area.y = info->
var.yres;
840 dlfb_ops_setcolreg(
unsigned regno,
unsigned red,
unsigned green,
845 if (regno >= info->
cmap.len)
849 if (info->
var.red.offset == 10) {
852 ((red & 0xf800) >> 1) |
853 ((green & 0xf800) >> 6) | ((blue & 0xf800) >> 11);
858 ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
870 static int dlfb_ops_open(
struct fb_info *info,
int user)
888 kref_get(&dev->
kref);
890 if (fb_defio && (info->fbdefio ==
NULL)) {
893 struct fb_deferred_io *fbdefio;
895 fbdefio = kzalloc(
sizeof(
struct fb_deferred_io),
GFP_KERNEL);
899 fbdefio->deferred_io = dlfb_dpy_deferred_io;
902 info->fbdefio = fbdefio;
906 pr_notice(
"open /dev/fb%d user=%d fb_info=%p count=%d\n",
917 static void dlfb_free(
struct kref *
kref)
926 pr_warn(
"freeing dlfb_data %p\n", dev);
936 up(&unode->
dev->urbs.limit_sem);
939 static void dlfb_free_framebuffer(
struct dlfb_data *dev)
948 if (info->
cmap.len != 0)
962 pr_warn(
"fb_info for /dev/fb%d has been freed\n", node);
966 kref_put(&dev->
kref, dlfb_free);
973 dlfb_free_framebuffer(dev);
978 static int dlfb_ops_release(
struct fb_info *info,
int user)
988 if ((dev->
fb_count == 0) && (info->fbdefio)) {
990 kfree(info->fbdefio);
991 info->fbdefio =
NULL;
992 info->
fbops->fb_mmap = dlfb_ops_mmap;
995 pr_warn(
"released /dev/fb%d user=%d count=%d\n",
998 kref_put(&dev->
kref, dlfb_free);
1013 pr_warn(
"%dx%d beyond chip capabilities\n",
1042 if ((var->
xres * var->
yres * 2) > info->
fix.smem_len)
1046 dlfb_var_color_format(var);
1050 if (!dlfb_is_valid_mode(&mode, info))
1056 static int dlfb_ops_set_par(
struct fb_info *info)
1060 u16 *pix_framebuffer;
1065 result = dlfb_set_video_mode(dev, &info->
var);
1067 if ((result == 0) && (dev->
fb_count == 0)) {
1072 for (i = 0; i < info->
fix.smem_len / 2; i++)
1073 pix_framebuffer[i] = 0x37e6;
1083 static char *dlfb_dummy_render(
char *buf)
1106 pr_info(
"/dev/fb%d FB_BLANK mode %d --> %d\n",
1113 dlfb_set_video_mode(dev, &info->
var);
1116 urb = dlfb_get_urb(dev);
1120 bufptr = (
char *) urb->transfer_buffer;
1121 bufptr = dlfb_vidreg_lock(bufptr);
1122 bufptr = dlfb_blanking(bufptr, blank_mode);
1123 bufptr = dlfb_vidreg_unlock(bufptr);
1126 bufptr = dlfb_dummy_render(bufptr);
1128 dlfb_submit_urb(dev, urb, bufptr -
1129 (
char *) urb->transfer_buffer);
1136 static struct fb_ops dlfb_ops = {
1139 .fb_write = dlfb_ops_write,
1140 .fb_setcolreg = dlfb_ops_setcolreg,
1141 .fb_fillrect = dlfb_ops_fillrect,
1142 .fb_copyarea = dlfb_ops_copyarea,
1143 .fb_imageblit = dlfb_ops_imageblit,
1144 .fb_mmap = dlfb_ops_mmap,
1145 .fb_ioctl = dlfb_ops_ioctl,
1146 .fb_open = dlfb_ops_open,
1147 .fb_release = dlfb_ops_release,
1148 .fb_blank = dlfb_ops_blank,
1149 .fb_check_var = dlfb_ops_check_var,
1150 .fb_set_par = dlfb_ops_set_par,
1158 static int dlfb_realloc_framebuffer(
struct dlfb_data *dev,
struct fb_info *info)
1161 int old_len = info->
fix.smem_len;
1164 unsigned char *new_fb;
1165 unsigned char *new_back = 0;
1167 pr_warn(
"Reallocating framebuffer. Addresses will change!\n");
1169 new_len = info->
fix.line_length * info->
var.yres;
1177 pr_err(
"Virtual framebuffer alloc failed\n");
1182 memcpy(new_fb, old_fb, old_len);
1188 info->
fix.smem_start = (
unsigned long) new_fb;
1189 info->
flags = udlfb_info_flags;
1200 pr_info(
"No shadow/backing buffer allocated\n");
1228 static int dlfb_setup_modes(
struct dlfb_data *dev,
1230 char *default_edid,
size_t default_edid_size)
1262 if (info->
monspecs.modedb_len > 0) {
1270 if (info->
monspecs.modedb_len == 0) {
1272 pr_err(
"Unable to get valid EDID from device/display\n");
1277 pr_err(
"Using previously queried EDID\n");
1282 if (info->
monspecs.modedb_len == 0) {
1285 if (info->
monspecs.modedb_len > 0) {
1286 memcpy(edid, default_edid, default_edid_size);
1289 pr_err(
"Using default/backup EDID\n");
1295 if (info->
monspecs.modedb_len > 0) {
1297 for (i = 0; i < info->
monspecs.modedb_len; i++) {
1298 if (dlfb_is_valid_mode(&info->
monspecs.modedb[i], info))
1314 if (default_vmode ==
NULL) {
1326 &vesa_modes[i], info))
1335 fb_vmode.
xres = 800;
1336 fb_vmode.
yres = 600;
1346 dlfb_var_color_format(&info->
var);
1351 memcpy(&info->
fix, &dlfb_fix,
sizeof(dlfb_fix));
1352 info->
fix.line_length = info->
var.xres *
1353 (info->
var.bits_per_pixel / 8);
1355 result = dlfb_realloc_framebuffer(dev, info);
1361 if (edid && (dev->
edid != edid))
1378 static ssize_t metrics_bytes_identical_show(
struct device *fbdev,
1386 static ssize_t metrics_bytes_sent_show(
struct device *fbdev,
1394 static ssize_t metrics_cpu_kcycles_used_show(
struct device *fbdev,
1405 char *buf, loff_t off,
size_t count) {
1419 pr_info(
"sysfs edid copy %p to %p, %d bytes\n",
1420 dev->
edid, buf, (
int) count);
1430 char *
src, loff_t src_off,
size_t src_size) {
1440 ret = dlfb_setup_modes(dev, fb_info, src, src_size);
1447 pr_info(
"sysfs written EDID is new default\n");
1448 dlfb_ops_set_par(fb_info);
1454 const char *buf,
size_t count)
1468 .attr.name =
"edid",
1486 static int dlfb_select_std_channel(
struct dlfb_data *dev)
1489 u8 set_def_chn[] = { 0x57, 0xCD, 0xDC, 0xA7,
1490 0x1C, 0x88, 0x5E, 0x15,
1491 0x60, 0xFE, 0xC6, 0x97,
1492 0x16, 0x3D, 0x47, 0xF2 };
1497 set_def_chn,
sizeof(set_def_chn), USB_CTRL_SET_TIMEOUT);
1501 static int dlfb_parse_vendor_descriptor(
struct dlfb_data *dev,
1520 if (total_len < 0) {
1521 if (0 == usb_get_extra_descriptor(interface->cur_altsetting,
1523 total_len = (
int) desc[0];
1526 if (total_len > 5) {
1527 pr_info(
"vendor descriptor length:%x data:%02x %02x %02x %02x" \
1528 "%02x %02x %02x %02x %02x %02x %02x\n",
1530 desc[1], desc[2], desc[3], desc[4], desc[5], desc[6],
1531 desc[7], desc[8], desc[9], desc[10]);
1533 if ((desc[0] != total_len) ||
1534 (desc[1] != 0x5f) ||
1535 (desc[2] != 0x01) ||
1536 (desc[3] != 0x00) ||
1537 (desc[4] != total_len - 2))
1543 while (desc < desc_end) {
1548 desc +=
sizeof(
u16);
1556 pr_warn(
"DL chip limited to %d pixel modes\n",
1567 pr_info(
"vendor descriptor not available (%d)\n", total_len);
1574 pr_err(
"Unrecognized vendor firmware descriptor\n");
1586 struct usb_device *usbdev;
1592 usbdev = interface_to_usbdev(interface);
1596 dev_err(&interface->dev,
"dlfb_usb_probe: failed alloc of dev struct\n");
1600 kref_init(&dev->
kref);
1603 dev->
gdev = &usbdev->dev;
1604 usb_set_intfdata(interface, dev);
1606 pr_info(
"%s %s - serial #%s\n",
1607 usbdev->manufacturer, usbdev->product, usbdev->serial);
1608 pr_info(
"vid_%04x&pid_%04x&rev_%04x driver's dlfb_data struct at %p\n",
1609 usbdev->descriptor.idVendor, usbdev->descriptor.idProduct,
1610 usbdev->descriptor.bcdDevice, dev);
1612 pr_info(
"fb_defio enable=%d\n", fb_defio);
1617 if (!dlfb_parse_vendor_descriptor(dev, interface)) {
1618 pr_err(
"firmware not recognized. Assume incompatible device\n");
1623 pr_warn(
"DL chip limit of %d overriden"
1624 " by module param to %d\n",
1632 pr_err(
"dlfb_alloc_urb_list failed\n");
1636 kref_get(&dev->
kref);
1642 dlfb_init_framebuffer_work);
1650 kref_put(&dev->
kref, dlfb_free);
1651 kref_put(&dev->
kref, dlfb_free);
1663 struct fb_info *
info;
1671 pr_err(
"framebuffer_alloc failed\n");
1678 info->
fbops = &dlfb_ops;
1682 pr_err(
"fb_alloc_cmap failed %x\n", retval);
1687 dlfb_free_framebuffer_work);
1691 retval = dlfb_setup_modes(dev, info,
NULL, 0);
1693 pr_err(
"unable to find common mode for display and adapter\n");
1700 dlfb_select_std_channel(dev);
1702 dlfb_ops_check_var(&info->
var, info);
1703 dlfb_ops_set_par(info);
1707 pr_err(
"register_framebuffer failed %d\n", retval);
1711 for (i = 0; i <
ARRAY_SIZE(fb_device_attrs); i++) {
1714 pr_warn(
"device_create_file failed %d\n", retval);
1720 pr_warn(
"device_create_bin_file failed %d\n", retval);
1723 pr_info(
"DisplayLink USB device /dev/fb%d attached. %dx%d resolution."
1724 " Using %dK framebuffer memory\n", info->
node,
1725 info->
var.xres, info->
var.yres,
1727 info->
fix.smem_len * 2 : info->
fix.smem_len) >> 10);
1731 dlfb_free_framebuffer(dev);
1734 static void dlfb_usb_disconnect(
struct usb_interface *interface)
1737 struct fb_info *
info;
1740 dev = usb_get_intfdata(interface);
1743 pr_info(
"USB disconnect starting\n");
1752 dlfb_free_urb_list(dev);
1756 for (i = 0; i <
ARRAY_SIZE(fb_device_attrs); i++)
1762 usb_set_intfdata(interface,
NULL);
1771 kref_put(&dev->
kref, dlfb_free);
1778 static struct usb_driver dlfb_driver = {
1780 .probe = dlfb_usb_probe,
1781 .disconnect = dlfb_usb_disconnect,
1782 .id_table = id_table,
1787 static void dlfb_urb_completion(
struct urb *urb)
1789 struct urb_node *unode = urb->context;
1791 unsigned long flags;
1795 if (!(urb->status == -
ENOENT ||
1798 pr_err(
"%s - nonzero write bulk status received: %d\n",
1799 __func__, urb->status);
1804 urb->transfer_buffer_length = dev->
urbs.size;
1808 dev->
urbs.available++;
1809 spin_unlock_irqrestore(&dev->
urbs.lock, flags);
1818 up(&dev->
urbs.limit_sem);
1821 static void dlfb_free_urb_list(
struct dlfb_data *dev)
1823 int count = dev->
urbs.count;
1828 unsigned long flags;
1842 node = dev->
urbs.list.next;
1843 list_del_init(node);
1845 spin_unlock_irqrestore(&dev->
urbs.lock, flags);
1852 urb->transfer_buffer, urb->transfer_dma);
1857 dev->
urbs.count = 0;
1860 static int dlfb_alloc_urb_list(
struct dlfb_data *dev,
int count,
size_t size)
1870 INIT_LIST_HEAD(&dev->
urbs.list);
1879 dlfb_release_urb_work);
1889 &urb->transfer_dma);
1897 usb_fill_bulk_urb(urb, dev->
udev, usb_sndbulkpipe(dev->
udev, 1),
1898 buf, size, dlfb_urb_completion, unode);
1899 urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
1906 sema_init(&dev->
urbs.limit_sem, i);
1907 dev->
urbs.count =
i;
1908 dev->
urbs.available =
i;
1910 pr_notice(
"allocated %d %d byte urbs\n", i, (
int) size);
1915 static struct urb *dlfb_get_urb(
struct dlfb_data *dev)
1920 struct urb *urb =
NULL;
1921 unsigned long flags;
1927 pr_warn(
"wait for urb interrupted: %x available: %d\n",
1928 ret, dev->
urbs.available);
1935 entry = dev->
urbs.list.next;
1936 list_del_init(entry);
1937 dev->
urbs.available--;
1939 spin_unlock_irqrestore(&dev->
urbs.lock, flags);
1948 static int dlfb_submit_urb(
struct dlfb_data *dev,
struct urb *urb,
size_t len)
1954 urb->transfer_buffer_length = len;
1957 dlfb_urb_completion(urb);
1959 pr_err(
"usb_submit_urb error %x\n", ret);