Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (21 commits)
[media] mceusb: set a default rx timeout
[media] mceusb: fix inverted mask inversion logic
[media] mceusb: add another Fintek device ID
[media] lirc_dev: fixes in lirc_dev_fop_read()
[media] lirc_dev: stray unlock in lirc_dev_fop_poll()
[media] rc: fix sysfs entry for mceusb and streamzap
[media] streamzap: merge timeout space with trailing space
[media] mceusb: fix keybouce issue after parser simplification
[media] IR: add tv power scancode to rc6 mce keymap
[media] mceusb: buffer parsing fixups for 1st-gen device
[media] mceusb: fix up reporting of trailing space
[media] nuvoton-cir: improve buffer parsing responsiveness
[media] mceusb: add support for Conexant Hybrid TV RDU253S
[media] s5p-fimc: Fix output DMA handling in S5PV310 IP revisions
[media] s5p-fimc: Use correct fourcc code for 32-bit RGB format
[media] s5p-fimc: Convert m2m driver to unlocked_ioctl
[media] s5p-fimc: Explicitly add required header file
[media] s5p-fimc: Fix vidioc_g_crop/cropcap on camera sensor
[media] s5p-fimc: BKL lock removal - compilation fix
[media] soc-camera: fix static build of the sh_mobile_csi2.c driver
...

+257 -134
+11 -10
drivers/media/IR/keymaps/rc-rc6-mce.c
··· 26 26 27 27 { 0x800f040a, KEY_DELETE }, 28 28 { 0x800f040b, KEY_ENTER }, 29 - { 0x800f040c, KEY_POWER }, 30 - { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ 29 + { 0x800f040c, KEY_POWER }, /* PC Power */ 30 + { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ 31 31 { 0x800f040e, KEY_MUTE }, 32 32 { 0x800f040f, KEY_INFO }, 33 33 ··· 56 56 { 0x800f0422, KEY_OK }, 57 57 { 0x800f0423, KEY_EXIT }, 58 58 { 0x800f0424, KEY_DVD }, 59 - { 0x800f0425, KEY_TUNER }, /* LiveTV */ 60 - { 0x800f0426, KEY_EPG }, /* Guide */ 61 - { 0x800f0427, KEY_ZOOM }, /* Aspect */ 59 + { 0x800f0425, KEY_TUNER }, /* LiveTV */ 60 + { 0x800f0426, KEY_EPG }, /* Guide */ 61 + { 0x800f0427, KEY_ZOOM }, /* Aspect */ 62 62 63 63 { 0x800f043a, KEY_BRIGHTNESSUP }, 64 64 65 65 { 0x800f0446, KEY_TV }, 66 - { 0x800f0447, KEY_AUDIO }, /* My Music */ 67 - { 0x800f0448, KEY_PVR }, /* RecordedTV */ 66 + { 0x800f0447, KEY_AUDIO }, /* My Music */ 67 + { 0x800f0448, KEY_PVR }, /* RecordedTV */ 68 68 { 0x800f0449, KEY_CAMERA }, 69 69 { 0x800f044a, KEY_VIDEO }, 70 70 { 0x800f044c, KEY_LANGUAGE }, 71 71 { 0x800f044d, KEY_TITLE }, 72 - { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ 72 + { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ 73 73 74 74 { 0x800f0450, KEY_RADIO }, 75 75 76 - { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ 76 + { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ 77 77 { 0x800f045b, KEY_RED }, 78 78 { 0x800f045c, KEY_GREEN }, 79 79 { 0x800f045d, KEY_YELLOW }, 80 80 { 0x800f045e, KEY_BLUE }, 81 81 82 + { 0x800f0465, KEY_POWER2 }, /* TV Power */ 82 83 { 0x800f046e, KEY_PLAYPAUSE }, 83 - { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */ 84 + { 0x800f046f, KEY_MEDIA }, /* Start media application (NEW) */ 84 85 85 86 { 0x800f0480, KEY_BRIGHTNESSDOWN }, 86 87 { 0x800f0481, KEY_PLAYPAUSE },
+16 -13
drivers/media/IR/lirc_dev.c
··· 522 522 523 523 dev_dbg(ir->d.dev, LOGHEAD "poll called\n", ir->d.name, ir->d.minor); 524 524 525 - if (!ir->attached) { 526 - mutex_unlock(&ir->irctl_lock); 525 + if (!ir->attached) 527 526 return POLLERR; 528 - } 529 527 530 528 poll_wait(file, &ir->buf->wait_poll, wait); 531 529 ··· 647 649 if (!buf) 648 650 return -ENOMEM; 649 651 650 - if (mutex_lock_interruptible(&ir->irctl_lock)) 651 - return -ERESTARTSYS; 652 + if (mutex_lock_interruptible(&ir->irctl_lock)) { 653 + ret = -ERESTARTSYS; 654 + goto out_unlocked; 655 + } 652 656 if (!ir->attached) { 653 - mutex_unlock(&ir->irctl_lock); 654 - return -ENODEV; 657 + ret = -ENODEV; 658 + goto out_locked; 655 659 } 656 660 657 661 if (length % ir->chunk_size) { 658 - dev_dbg(ir->d.dev, LOGHEAD "read result = -EINVAL\n", 659 - ir->d.name, ir->d.minor); 660 - mutex_unlock(&ir->irctl_lock); 661 - return -EINVAL; 662 + ret = -EINVAL; 663 + goto out_locked; 662 664 } 663 665 664 666 /* ··· 709 711 lirc_buffer_read(ir->buf, buf); 710 712 ret = copy_to_user((void *)buffer+written, buf, 711 713 ir->buf->chunk_size); 712 - written += ir->buf->chunk_size; 714 + if (!ret) 715 + written += ir->buf->chunk_size; 716 + else 717 + ret = -EFAULT; 713 718 } 714 719 } 715 720 716 721 remove_wait_queue(&ir->buf->wait_poll, &wait); 717 722 set_current_state(TASK_RUNNING); 723 + 724 + out_locked: 718 725 mutex_unlock(&ir->irctl_lock); 719 726 720 727 out_unlocked: 721 728 kfree(buf); 722 729 dev_dbg(ir->d.dev, LOGHEAD "read result = %s (%d)\n", 723 - ir->d.name, ir->d.minor, ret ? "-EFAULT" : "OK", ret); 730 + ir->d.name, ir->d.minor, ret ? "<fail>" : "<ok>", ret); 724 731 725 732 return ret ? ret : written; 726 733 }
+109 -65
drivers/media/IR/mceusb.c
··· 35 35 #include <linux/device.h> 36 36 #include <linux/module.h> 37 37 #include <linux/slab.h> 38 - #include <linux/usb.h> 39 38 #include <linux/input.h> 39 + #include <linux/usb.h> 40 + #include <linux/usb/input.h> 40 41 #include <media/ir-core.h> 41 - #include <media/ir-common.h> 42 42 43 43 #define DRIVER_VERSION "1.91" 44 44 #define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" ··· 49 49 #define USB_BUFLEN 32 /* USB reception buffer length */ 50 50 #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ 51 51 #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ 52 + #define MS_TO_NS(msec) ((msec) * 1000) 52 53 53 54 /* MCE constants */ 54 55 #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ ··· 75 74 #define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ 76 75 77 76 /* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */ 77 + #define MCE_CMD_SIG_END 0x01 /* End of signal */ 78 78 #define MCE_CMD_PING 0x03 /* Ping device */ 79 79 #define MCE_CMD_UNKNOWN 0x04 /* Unknown */ 80 80 #define MCE_CMD_UNKNOWN2 0x05 /* Unknown */ ··· 93 91 #define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */ 94 92 #define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */ 95 93 #define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */ 94 + #define MCE_RSP_PULSE_COUNT 0x15 /* RX pulse count (only if learning) */ 96 95 #define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */ 97 96 #define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */ 98 97 #define MCE_CMD_UNKNOWN7 0x18 /* Unknown */ ··· 149 146 MCE_GEN3, 150 147 MCE_GEN2_TX_INV, 151 148 POLARIS_EVK, 149 + CX_HYBRID_TV, 152 150 }; 153 151 154 152 struct mceusb_model { 155 153 u32 mce_gen1:1; 156 154 u32 mce_gen2:1; 157 155 u32 mce_gen3:1; 158 - u32 tx_mask_inverted:1; 156 + u32 tx_mask_normal:1; 159 157 u32 is_polaris:1; 158 + u32 no_tx:1; 160 159 161 160 const char *rc_map; /* Allow specify a per-board map */ 162 161 const char *name; /* per-board name */ ··· 167 162 static const struct mceusb_model mceusb_model[] = { 168 163 [MCE_GEN1] = { 169 164 .mce_gen1 = 1, 170 - .tx_mask_inverted = 1, 165 + .tx_mask_normal = 1, 171 166 }, 172 167 [MCE_GEN2] = { 173 168 .mce_gen2 = 1, 174 169 }, 175 170 [MCE_GEN2_TX_INV] = { 176 171 .mce_gen2 = 1, 177 - .tx_mask_inverted = 1, 172 + .tx_mask_normal = 1, 178 173 }, 179 174 [MCE_GEN3] = { 180 175 .mce_gen3 = 1, 181 - .tx_mask_inverted = 1, 176 + .tx_mask_normal = 1, 182 177 }, 183 178 [POLARIS_EVK] = { 184 179 .is_polaris = 1, ··· 188 183 * to allow testing it 189 184 */ 190 185 .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, 191 - .name = "cx231xx MCE IR", 186 + .name = "Conexant Hybrid TV (cx231xx) MCE IR", 187 + }, 188 + [CX_HYBRID_TV] = { 189 + .is_polaris = 1, 190 + .no_tx = 1, /* tx isn't wired up at all */ 191 + .name = "Conexant Hybrid TV (cx231xx) MCE IR", 192 192 }, 193 193 }; 194 194 ··· 283 273 { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, 284 274 /* Formosa Industrial Computing */ 285 275 { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, 276 + /* Fintek eHome Infrared Transceiver (HP branded) */ 277 + { USB_DEVICE(VENDOR_FINTEK, 0x5168) }, 286 278 /* Fintek eHome Infrared Transceiver */ 287 279 { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, 288 280 /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ ··· 304 292 { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, 305 293 /* TiVo PC IR Receiver */ 306 294 { USB_DEVICE(VENDOR_TIVO, 0x2000) }, 307 - /* Conexant SDK */ 295 + /* Conexant Hybrid TV "Shelby" Polaris SDK */ 308 296 { USB_DEVICE(VENDOR_CONEXANT, 0x58a1), 309 297 .driver_info = POLARIS_EVK }, 298 + /* Conexant Hybrid TV RDU253S Polaris */ 299 + { USB_DEVICE(VENDOR_CONEXANT, 0x58a5), 300 + .driver_info = CX_HYBRID_TV }, 310 301 /* Terminating entry */ 311 302 { } 312 303 }; ··· 318 303 struct mceusb_dev { 319 304 /* ir-core bits */ 320 305 struct ir_dev_props *props; 321 - struct ir_raw_event rawir; 306 + 307 + /* optional features we can enable */ 308 + bool carrier_report_enabled; 309 + bool learning_enabled; 322 310 323 311 /* core device bits */ 324 312 struct device *dev; ··· 336 318 /* buffers and dma */ 337 319 unsigned char *buf_in; 338 320 unsigned int len_in; 321 + dma_addr_t dma_in; 322 + dma_addr_t dma_out; 339 323 340 324 enum { 341 325 CMD_HEADER = 0, ··· 345 325 CMD_DATA, 346 326 PARSE_IRDATA, 347 327 } parser_state; 348 - u8 cmd, rem; /* Remaining IR data bytes in packet */ 349 328 350 - dma_addr_t dma_in; 351 - dma_addr_t dma_out; 329 + u8 cmd, rem; /* Remaining IR data bytes in packet */ 352 330 353 331 struct { 354 332 u32 connected:1; 355 - u32 tx_mask_inverted:1; 333 + u32 tx_mask_normal:1; 356 334 u32 microsoft_gen1:1; 335 + u32 no_tx:1; 357 336 } flags; 358 337 359 338 /* transmit support */ ··· 427 408 case MCE_CMD_UNKNOWN: 428 409 case MCE_CMD_S_CARRIER: 429 410 case MCE_CMD_S_TIMEOUT: 430 - case MCE_CMD_G_RXSENSOR: 411 + case MCE_RSP_PULSE_COUNT: 431 412 datasize = 2; 432 413 break; 414 + case MCE_CMD_SIG_END: 433 415 case MCE_CMD_S_TXMASK: 434 416 case MCE_CMD_S_RXSENSOR: 435 417 datasize = 1; ··· 453 433 return; 454 434 455 435 /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ 456 - if (ir->flags.microsoft_gen1 && !out) 436 + if (ir->flags.microsoft_gen1 && !out && !offset) 457 437 skip = 2; 458 438 459 439 if (len <= skip) ··· 511 491 break; 512 492 case MCE_COMMAND_HEADER: 513 493 switch (subcmd) { 494 + case MCE_CMD_SIG_END: 495 + dev_info(dev, "End of signal\n"); 496 + break; 514 497 case MCE_CMD_PING: 515 498 dev_info(dev, "Ping\n"); 516 499 break; ··· 548 525 inout, data1 == 0x02 ? "short" : "long"); 549 526 break; 550 527 case MCE_CMD_G_RXSENSOR: 551 - if (len == 2) 528 + /* aka MCE_RSP_PULSE_COUNT */ 529 + if (out) 552 530 dev_info(dev, "Get receive sensor\n"); 553 - else 554 - dev_info(dev, "Received pulse count is %d\n", 531 + else if (ir->learning_enabled) 532 + dev_info(dev, "RX pulse count: %d\n", 555 533 ((data1 << 8) | data2)); 556 534 break; 557 535 case MCE_RSP_CMD_INVALID: ··· 748 724 return ret ? ret : n; 749 725 } 750 726 751 - /* Sets active IR outputs -- mce devices typically (all?) have two */ 727 + /* Sets active IR outputs -- mce devices typically have two */ 752 728 static int mceusb_set_tx_mask(void *priv, u32 mask) 753 729 { 754 730 struct mceusb_dev *ir = priv; 755 731 756 - if (ir->flags.tx_mask_inverted) 732 + if (ir->flags.tx_mask_normal) 733 + ir->tx_mask = mask; 734 + else 757 735 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ? 758 736 mask ^ MCE_DEFAULT_TX_MASK : mask) << 1; 759 - else 760 - ir->tx_mask = mask; 761 737 762 738 return 0; 763 739 } ··· 776 752 777 753 if (carrier == 0) { 778 754 ir->carrier = carrier; 779 - cmdbuf[2] = 0x01; 755 + cmdbuf[2] = MCE_CMD_SIG_END; 780 756 cmdbuf[3] = MCE_IRDATA_TRAILER; 781 757 dev_dbg(ir->dev, "%s: disabling carrier " 782 758 "modulation\n", __func__); ··· 806 782 return carrier; 807 783 } 808 784 785 + /* 786 + * We don't do anything but print debug spew for many of the command bits 787 + * we receive from the hardware, but some of them are useful information 788 + * we want to store so that we can use them. 789 + */ 790 + static void mceusb_handle_command(struct mceusb_dev *ir, int index) 791 + { 792 + u8 hi = ir->buf_in[index + 1] & 0xff; 793 + u8 lo = ir->buf_in[index + 2] & 0xff; 794 + 795 + switch (ir->buf_in[index]) { 796 + /* 2-byte return value commands */ 797 + case MCE_CMD_S_TIMEOUT: 798 + ir->props->timeout = MS_TO_NS((hi << 8 | lo) / 2); 799 + break; 800 + 801 + /* 1-byte return value commands */ 802 + case MCE_CMD_S_TXMASK: 803 + ir->tx_mask = hi; 804 + break; 805 + case MCE_CMD_S_RXSENSOR: 806 + ir->learning_enabled = (hi == 0x02); 807 + break; 808 + default: 809 + break; 810 + } 811 + } 812 + 809 813 static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) 810 814 { 811 815 DEFINE_IR_RAW_EVENT(rawir); ··· 843 791 if (ir->flags.microsoft_gen1) 844 792 i = 2; 845 793 794 + /* if there's no data, just return now */ 795 + if (buf_len <= i) 796 + return; 797 + 846 798 for (; i < buf_len; i++) { 847 799 switch (ir->parser_state) { 848 800 case SUBCMD: 849 801 ir->rem = mceusb_cmdsize(ir->cmd, ir->buf_in[i]); 850 802 mceusb_dev_printdata(ir, ir->buf_in, i - 1, 851 803 ir->rem + 2, false); 804 + mceusb_handle_command(ir, i); 852 805 ir->parser_state = CMD_DATA; 853 806 break; 854 807 case PARSE_IRDATA: 855 808 ir->rem--; 856 809 rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); 857 810 rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) 858 - * MCE_TIME_UNIT * 1000; 859 - 860 - if ((ir->buf_in[i] & MCE_PULSE_MASK) == 0x7f) { 861 - if (ir->rawir.pulse == rawir.pulse) { 862 - ir->rawir.duration += rawir.duration; 863 - } else { 864 - ir->rawir.duration = rawir.duration; 865 - ir->rawir.pulse = rawir.pulse; 866 - } 867 - if (ir->rem) 868 - break; 869 - } 870 - rawir.duration += ir->rawir.duration; 871 - ir->rawir.duration = 0; 872 - ir->rawir.pulse = rawir.pulse; 811 + * MS_TO_NS(MCE_TIME_UNIT); 873 812 874 813 dev_dbg(ir->dev, "Storing %s with duration %d\n", 875 814 rawir.pulse ? "pulse" : "space", 876 815 rawir.duration); 877 816 878 - ir_raw_event_store(ir->idev, &rawir); 817 + ir_raw_event_store_with_filter(ir->idev, &rawir); 879 818 break; 880 819 case CMD_DATA: 881 820 ir->rem--; ··· 882 839 continue; 883 840 } 884 841 ir->rem = (ir->cmd & MCE_PACKET_LENGTH_MASK); 885 - mceusb_dev_printdata(ir, ir->buf_in, i, ir->rem + 1, false); 886 - if (ir->rem) { 842 + mceusb_dev_printdata(ir, ir->buf_in, 843 + i, ir->rem + 1, false); 844 + if (ir->rem) 887 845 ir->parser_state = PARSE_IRDATA; 888 - break; 889 - } 890 - /* 891 - * a package with len=0 (e. g. 0x80) means end of 892 - * data. We could use it to do the call to 893 - * ir_raw_event_handle(). For now, we don't need to 894 - * use it. 895 - */ 896 846 break; 897 847 } 898 848 ··· 1020 984 mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); 1021 985 mce_sync_in(ir, NULL, maxp); 1022 986 1023 - /* get the transmitter bitmask */ 1024 - mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); 1025 - mce_sync_in(ir, NULL, maxp); 987 + if (!ir->flags.no_tx) { 988 + /* get the transmitter bitmask */ 989 + mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); 990 + mce_sync_in(ir, NULL, maxp); 991 + } 1026 992 1027 993 /* get receiver timeout value */ 1028 994 mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); ··· 1073 1035 props->priv = ir; 1074 1036 props->driver_type = RC_DRIVER_IR_RAW; 1075 1037 props->allowed_protos = IR_TYPE_ALL; 1076 - props->s_tx_mask = mceusb_set_tx_mask; 1077 - props->s_tx_carrier = mceusb_set_tx_carrier; 1078 - props->tx_ir = mceusb_tx_ir; 1038 + props->timeout = MS_TO_NS(1000); 1039 + if (!ir->flags.no_tx) { 1040 + props->s_tx_mask = mceusb_set_tx_mask; 1041 + props->s_tx_carrier = mceusb_set_tx_carrier; 1042 + props->tx_ir = mceusb_tx_ir; 1043 + } 1079 1044 1080 1045 ir->props = props; 1046 + 1047 + usb_to_input_id(ir->usbdev, &idev->id); 1048 + idev->dev.parent = ir->dev; 1081 1049 1082 1050 if (mceusb_model[ir->model].rc_map) 1083 1051 rc_map = mceusb_model[ir->model].rc_map; ··· 1118 1074 enum mceusb_model_type model = id->driver_info; 1119 1075 bool is_gen3; 1120 1076 bool is_microsoft_gen1; 1121 - bool tx_mask_inverted; 1077 + bool tx_mask_normal; 1122 1078 bool is_polaris; 1123 1079 1124 - dev_dbg(&intf->dev, ": %s called\n", __func__); 1080 + dev_dbg(&intf->dev, "%s called\n", __func__); 1125 1081 1126 1082 idesc = intf->cur_altsetting; 1127 1083 1128 1084 is_gen3 = mceusb_model[model].mce_gen3; 1129 1085 is_microsoft_gen1 = mceusb_model[model].mce_gen1; 1130 - tx_mask_inverted = mceusb_model[model].tx_mask_inverted; 1086 + tx_mask_normal = mceusb_model[model].tx_mask_normal; 1131 1087 is_polaris = mceusb_model[model].is_polaris; 1132 1088 1133 1089 if (is_polaris) { ··· 1151 1107 ep_in = ep; 1152 1108 ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; 1153 1109 ep_in->bInterval = 1; 1154 - dev_dbg(&intf->dev, ": acceptable inbound endpoint " 1110 + dev_dbg(&intf->dev, "acceptable inbound endpoint " 1155 1111 "found\n"); 1156 1112 } 1157 1113 ··· 1166 1122 ep_out = ep; 1167 1123 ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; 1168 1124 ep_out->bInterval = 1; 1169 - dev_dbg(&intf->dev, ": acceptable outbound endpoint " 1125 + dev_dbg(&intf->dev, "acceptable outbound endpoint " 1170 1126 "found\n"); 1171 1127 } 1172 1128 } 1173 1129 if (ep_in == NULL) { 1174 - dev_dbg(&intf->dev, ": inbound and/or endpoint not found\n"); 1130 + dev_dbg(&intf->dev, "inbound and/or endpoint not found\n"); 1175 1131 return -ENODEV; 1176 1132 } 1177 1133 ··· 1194 1150 ir->dev = &intf->dev; 1195 1151 ir->len_in = maxp; 1196 1152 ir->flags.microsoft_gen1 = is_microsoft_gen1; 1197 - ir->flags.tx_mask_inverted = tx_mask_inverted; 1153 + ir->flags.tx_mask_normal = tx_mask_normal; 1154 + ir->flags.no_tx = mceusb_model[model].no_tx; 1198 1155 ir->model = model; 1199 - 1200 - init_ir_raw_event(&ir->rawir); 1201 1156 1202 1157 /* Saving usb interface data for use by the transmitter routine */ 1203 1158 ir->usb_ep_in = ep_in; ··· 1234 1191 1235 1192 mceusb_get_parameters(ir); 1236 1193 1237 - mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); 1194 + if (!ir->flags.no_tx) 1195 + mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); 1238 1196 1239 1197 usb_set_intfdata(intf, ir); 1240 1198
+8 -2
drivers/media/IR/nuvoton-cir.c
··· 603 603 count = nvt->pkts; 604 604 nvt_dbg_verbose("Processing buffer of len %d", count); 605 605 606 + init_ir_raw_event(&rawir); 607 + 606 608 for (i = 0; i < count; i++) { 607 609 nvt->pkts--; 608 610 sample = nvt->buf[i]; ··· 645 643 * indicates end of IR signal, but new data incoming. In both 646 644 * cases, it means we're ready to call ir_raw_event_handle 647 645 */ 648 - if (sample == BUF_PULSE_BIT || ((sample != BUF_LEN_MASK) && 649 - (sample & BUF_REPEAT_MASK) == BUF_REPEAT_BYTE)) 646 + if ((sample == BUF_PULSE_BIT) && nvt->pkts) { 647 + nvt_dbg("Calling ir_raw_event_handle (signal end)\n"); 650 648 ir_raw_event_handle(nvt->rdev); 649 + } 651 650 } 651 + 652 + nvt_dbg("Calling ir_raw_event_handle (buffer empty)\n"); 653 + ir_raw_event_handle(nvt->rdev); 652 654 653 655 if (nvt->pkts) { 654 656 nvt_dbg("Odd, pkts should be 0 now... (its %u)", nvt->pkts);
+12 -9
drivers/media/IR/streamzap.c
··· 34 34 #include <linux/device.h> 35 35 #include <linux/module.h> 36 36 #include <linux/slab.h> 37 - #include <linux/usb.h> 38 37 #include <linux/input.h> 38 + #include <linux/usb.h> 39 + #include <linux/usb/input.h> 39 40 #include <media/ir-core.h> 40 41 41 42 #define DRIVER_VERSION "1.61" ··· 141 140 142 141 static void sz_push(struct streamzap_ir *sz, struct ir_raw_event rawir) 143 142 { 144 - ir_raw_event_store(sz->idev, &rawir); 143 + dev_dbg(sz->dev, "Storing %s with duration %u us\n", 144 + (rawir.pulse ? "pulse" : "space"), rawir.duration); 145 + ir_raw_event_store_with_filter(sz->idev, &rawir); 145 146 } 146 147 147 148 static void sz_push_full_pulse(struct streamzap_ir *sz, ··· 170 167 rawir.duration *= 1000; 171 168 rawir.duration &= IR_MAX_DURATION; 172 169 } 173 - dev_dbg(sz->dev, "ls %u\n", rawir.duration); 174 170 sz_push(sz, rawir); 175 171 176 172 sz->idle = false; ··· 182 180 sz->sum += rawir.duration; 183 181 rawir.duration *= 1000; 184 182 rawir.duration &= IR_MAX_DURATION; 185 - dev_dbg(sz->dev, "p %u\n", rawir.duration); 186 183 sz_push(sz, rawir); 187 184 } 188 185 ··· 201 200 rawir.duration += SZ_RESOLUTION / 2; 202 201 sz->sum += rawir.duration; 203 202 rawir.duration *= 1000; 204 - dev_dbg(sz->dev, "s %u\n", rawir.duration); 205 203 sz_push(sz, rawir); 206 204 } 207 205 ··· 221 221 struct streamzap_ir *sz; 222 222 unsigned int i; 223 223 int len; 224 - static int timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & 225 - IR_MAX_DURATION) | 0x03000000); 226 224 227 225 if (!urb) 228 226 return; ··· 244 246 245 247 dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); 246 248 for (i = 0; i < len; i++) { 247 - dev_dbg(sz->dev, "sz idx %d: %x\n", 249 + dev_dbg(sz->dev, "sz->buf_in[%d]: %x\n", 248 250 i, (unsigned char)sz->buf_in[i]); 249 251 switch (sz->decoder_state) { 250 252 case PulseSpace: ··· 271 273 DEFINE_IR_RAW_EVENT(rawir); 272 274 273 275 rawir.pulse = false; 274 - rawir.duration = timeout; 276 + rawir.duration = sz->props->timeout; 275 277 sz->idle = true; 276 278 if (sz->timeout_enabled) 277 279 sz_push(sz, rawir); ··· 332 334 props->allowed_protos = IR_TYPE_ALL; 333 335 334 336 sz->props = props; 337 + 338 + usb_to_input_id(sz->usbdev, &idev->id); 339 + idev->dev.parent = sz->dev; 335 340 336 341 ret = ir_input_register(idev, RC_MAP_STREAMZAP, props, DRIVER_NAME); 337 342 if (ret < 0) { ··· 445 444 sz->decoder_state = PulseSpace; 446 445 /* FIXME: don't yet have a way to set this */ 447 446 sz->timeout_enabled = true; 447 + sz->props->timeout = (((SZ_TIMEOUT * SZ_RESOLUTION * 1000) & 448 + IR_MAX_DURATION) | 0x03000000); 448 449 #if 0 449 450 /* not yet supported, depends on patches from maxim */ 450 451 /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */
-2
drivers/media/video/mx2_camera.c
··· 807 807 808 808 if (common_flags & SOCAM_PCLK_SAMPLE_RISING) 809 809 csicr1 |= CSICR1_REDGE; 810 - if (common_flags & SOCAM_PCLK_SAMPLE_FALLING) 811 - csicr1 |= CSICR1_INV_PCLK; 812 810 if (common_flags & SOCAM_VSYNC_ACTIVE_HIGH) 813 811 csicr1 |= CSICR1_SOF_POL; 814 812 if (common_flags & SOCAM_HSYNC_ACTIVE_HIGH)
+48 -3
drivers/media/video/s5p-fimc/fimc-capture.c
··· 522 522 INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); 523 523 fimc->vid_cap.active_buf_cnt = 0; 524 524 fimc->vid_cap.frame_count = 0; 525 + fimc->vid_cap.buf_index = fimc_hw_get_frame_index(fimc); 525 526 526 527 set_bit(ST_CAPT_PEND, &fimc->state); 527 528 ret = videobuf_streamon(&fimc->vid_cap.vbq); ··· 653 652 return ret; 654 653 } 655 654 655 + static int fimc_cap_cropcap(struct file *file, void *fh, 656 + struct v4l2_cropcap *cr) 657 + { 658 + struct fimc_frame *f; 659 + struct fimc_ctx *ctx = fh; 660 + struct fimc_dev *fimc = ctx->fimc_dev; 661 + 662 + if (cr->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 663 + return -EINVAL; 664 + 665 + if (mutex_lock_interruptible(&fimc->lock)) 666 + return -ERESTARTSYS; 667 + 668 + f = &ctx->s_frame; 669 + cr->bounds.left = 0; 670 + cr->bounds.top = 0; 671 + cr->bounds.width = f->o_width; 672 + cr->bounds.height = f->o_height; 673 + cr->defrect = cr->bounds; 674 + 675 + mutex_unlock(&fimc->lock); 676 + return 0; 677 + } 678 + 679 + static int fimc_cap_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) 680 + { 681 + struct fimc_frame *f; 682 + struct fimc_ctx *ctx = file->private_data; 683 + struct fimc_dev *fimc = ctx->fimc_dev; 684 + 685 + 686 + if (mutex_lock_interruptible(&fimc->lock)) 687 + return -ERESTARTSYS; 688 + 689 + f = &ctx->s_frame; 690 + cr->c.left = f->offs_h; 691 + cr->c.top = f->offs_v; 692 + cr->c.width = f->width; 693 + cr->c.height = f->height; 694 + 695 + mutex_unlock(&fimc->lock); 696 + return 0; 697 + } 698 + 656 699 static int fimc_cap_s_crop(struct file *file, void *fh, 657 700 struct v4l2_crop *cr) 658 701 { ··· 761 716 .vidioc_g_ctrl = fimc_vidioc_g_ctrl, 762 717 .vidioc_s_ctrl = fimc_cap_s_ctrl, 763 718 764 - .vidioc_g_crop = fimc_vidioc_g_crop, 719 + .vidioc_g_crop = fimc_cap_g_crop, 765 720 .vidioc_s_crop = fimc_cap_s_crop, 766 - .vidioc_cropcap = fimc_vidioc_cropcap, 721 + .vidioc_cropcap = fimc_cap_cropcap, 767 722 768 723 .vidioc_enum_input = fimc_cap_enum_input, 769 724 .vidioc_s_input = fimc_cap_s_input, ··· 830 785 videobuf_queue_dma_contig_init(&vid_cap->vbq, &fimc_qops, 831 786 vid_cap->v4l2_dev.dev, &fimc->irqlock, 832 787 V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, 833 - sizeof(struct fimc_vid_buffer), (void *)ctx); 788 + sizeof(struct fimc_vid_buffer), (void *)ctx, NULL); 834 789 835 790 ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); 836 791 if (ret) {
+33 -21
drivers/media/video/s5p-fimc/fimc-core.c
··· 50 50 .planes_cnt = 1, 51 51 .flags = FMT_FLAGS_M2M, 52 52 }, { 53 - .name = "XRGB-8-8-8-8, 24 bpp", 54 - .fourcc = V4L2_PIX_FMT_RGB24, 53 + .name = "XRGB-8-8-8-8, 32 bpp", 54 + .fourcc = V4L2_PIX_FMT_RGB32, 55 55 .depth = 32, 56 56 .color = S5P_FIMC_RGB888, 57 57 .buff_cnt = 1, ··· 983 983 { 984 984 struct fimc_ctx *ctx = priv; 985 985 struct v4l2_queryctrl *c; 986 + int ret = -EINVAL; 986 987 987 988 c = get_ctrl(qc->id); 988 989 if (c) { ··· 991 990 return 0; 992 991 } 993 992 994 - if (ctx->state & FIMC_CTX_CAP) 995 - return v4l2_subdev_call(ctx->fimc_dev->vid_cap.sd, 993 + if (ctx->state & FIMC_CTX_CAP) { 994 + if (mutex_lock_interruptible(&ctx->fimc_dev->lock)) 995 + return -ERESTARTSYS; 996 + ret = v4l2_subdev_call(ctx->fimc_dev->vid_cap.sd, 996 997 core, queryctrl, qc); 997 - return -EINVAL; 998 + mutex_unlock(&ctx->fimc_dev->lock); 999 + } 1000 + return ret; 998 1001 } 999 1002 1000 1003 int fimc_vidioc_g_ctrl(struct file *file, void *priv, ··· 1120 1115 return 0; 1121 1116 } 1122 1117 1123 - int fimc_vidioc_cropcap(struct file *file, void *fh, 1118 + static int fimc_m2m_cropcap(struct file *file, void *fh, 1124 1119 struct v4l2_cropcap *cr) 1125 1120 { 1126 1121 struct fimc_frame *frame; ··· 1144 1139 return 0; 1145 1140 } 1146 1141 1147 - int fimc_vidioc_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) 1142 + static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) 1148 1143 { 1149 1144 struct fimc_frame *frame; 1150 1145 struct fimc_ctx *ctx = file->private_data; ··· 1172 1167 struct fimc_frame *f; 1173 1168 u32 min_size, halign; 1174 1169 1175 - f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? 1176 - &ctx->s_frame : &ctx->d_frame; 1177 - 1178 1170 if (cr->c.top < 0 || cr->c.left < 0) { 1179 1171 v4l2_err(&fimc->m2m.v4l2_dev, 1180 1172 "doesn't support negative values for top & left\n"); 1181 1173 return -EINVAL; 1182 1174 } 1183 1175 1184 - f = ctx_get_frame(ctx, cr->type); 1185 - if (IS_ERR(f)) 1186 - return PTR_ERR(f); 1176 + if (cr->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) 1177 + f = (ctx->state & FIMC_CTX_CAP) ? &ctx->s_frame : &ctx->d_frame; 1178 + else if (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT && 1179 + ctx->state & FIMC_CTX_M2M) 1180 + f = &ctx->s_frame; 1181 + else 1182 + return -EINVAL; 1187 1183 1188 - min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) 1189 - ? fimc->variant->min_inp_pixsize 1190 - : fimc->variant->min_out_pixsize; 1184 + min_size = (f == &ctx->s_frame) ? 1185 + fimc->variant->min_inp_pixsize : fimc->variant->min_out_pixsize; 1191 1186 1192 1187 if (ctx->state & FIMC_CTX_M2M) { 1193 1188 if (fimc->id == 1 && fimc->variant->pix_hoff) ··· 1238 1233 f = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? 1239 1234 &ctx->s_frame : &ctx->d_frame; 1240 1235 1236 + if (mutex_lock_interruptible(&fimc->lock)) 1237 + return -ERESTARTSYS; 1238 + 1241 1239 spin_lock_irqsave(&ctx->slock, flags); 1242 1240 if (~ctx->state & (FIMC_SRC_FMT | FIMC_DST_FMT)) { 1243 1241 /* Check to see if scaling ratio is within supported range */ ··· 1249 1241 else 1250 1242 ret = fimc_check_scaler_ratio(&cr->c, &ctx->s_frame); 1251 1243 if (ret) { 1252 - spin_unlock_irqrestore(&ctx->slock, flags); 1253 1244 v4l2_err(&fimc->m2m.v4l2_dev, "Out of scaler range"); 1254 - return -EINVAL; 1245 + ret = -EINVAL; 1246 + goto scr_unlock; 1255 1247 } 1256 1248 } 1257 1249 ctx->state |= FIMC_PARAMS; ··· 1261 1253 f->width = cr->c.width; 1262 1254 f->height = cr->c.height; 1263 1255 1256 + scr_unlock: 1264 1257 spin_unlock_irqrestore(&ctx->slock, flags); 1258 + mutex_unlock(&fimc->lock); 1265 1259 return 0; 1266 1260 } 1267 1261 ··· 1295 1285 .vidioc_g_ctrl = fimc_vidioc_g_ctrl, 1296 1286 .vidioc_s_ctrl = fimc_m2m_s_ctrl, 1297 1287 1298 - .vidioc_g_crop = fimc_vidioc_g_crop, 1288 + .vidioc_g_crop = fimc_m2m_g_crop, 1299 1289 .vidioc_s_crop = fimc_m2m_s_crop, 1300 - .vidioc_cropcap = fimc_vidioc_cropcap 1290 + .vidioc_cropcap = fimc_m2m_cropcap 1301 1291 1302 1292 }; 1303 1293 ··· 1406 1396 .open = fimc_m2m_open, 1407 1397 .release = fimc_m2m_release, 1408 1398 .poll = fimc_m2m_poll, 1409 - .ioctl = video_ioctl2, 1399 + .unlocked_ioctl = video_ioctl2, 1410 1400 .mmap = fimc_m2m_mmap, 1411 1401 }; 1412 1402 ··· 1746 1736 .pix_hoff = 1, 1747 1737 .has_inp_rot = 1, 1748 1738 .has_out_rot = 1, 1739 + .has_cistatus2 = 1, 1749 1740 .min_inp_pixsize = 16, 1750 1741 .min_out_pixsize = 16, 1751 1742 .hor_offs_align = 1, ··· 1756 1745 1757 1746 static struct samsung_fimc_variant fimc2_variant_s5pv310 = { 1758 1747 .pix_hoff = 1, 1748 + .has_cistatus2 = 1, 1759 1749 .min_inp_pixsize = 16, 1760 1750 .min_out_pixsize = 16, 1761 1751 .hor_offs_align = 1,
+16 -8
drivers/media/video/s5p-fimc/fimc-core.h
··· 13 13 14 14 /*#define DEBUG*/ 15 15 16 + #include <linux/sched.h> 16 17 #include <linux/types.h> 18 + #include <linux/videodev2.h> 17 19 #include <media/videobuf-core.h> 18 20 #include <media/v4l2-device.h> 19 21 #include <media/v4l2-mem2mem.h> 20 22 #include <media/v4l2-mediabus.h> 21 23 #include <media/s3c_fimc.h> 22 - #include <linux/videodev2.h> 24 + 23 25 #include "regs-fimc.h" 24 26 25 27 #define err(fmt, args...) \ ··· 371 369 * @pix_hoff: indicate whether horizontal offset is in pixels or in bytes 372 370 * @has_inp_rot: set if has input rotator 373 371 * @has_out_rot: set if has output rotator 372 + * @has_cistatus2: 1 if CISTATUS2 register is present in this IP revision 374 373 * @pix_limit: pixel size constraints for the scaler 375 374 * @min_inp_pixsize: minimum input pixel size 376 375 * @min_out_pixsize: minimum output pixel size ··· 382 379 unsigned int pix_hoff:1; 383 380 unsigned int has_inp_rot:1; 384 381 unsigned int has_out_rot:1; 382 + unsigned int has_cistatus2:1; 385 383 struct fimc_pix_limit *pix_limit; 386 384 u16 min_inp_pixsize; 387 385 u16 min_out_pixsize; ··· 558 554 return frame; 559 555 } 560 556 557 + /* Return an index to the buffer actually being written. */ 561 558 static inline u32 fimc_hw_get_frame_index(struct fimc_dev *dev) 562 559 { 563 - u32 reg = readl(dev->regs + S5P_CISTATUS); 564 - return (reg & S5P_CISTATUS_FRAMECNT_MASK) >> 565 - S5P_CISTATUS_FRAMECNT_SHIFT; 560 + u32 reg; 561 + 562 + if (dev->variant->has_cistatus2) { 563 + reg = readl(dev->regs + S5P_CISTATUS2) & 0x3F; 564 + return reg > 0 ? --reg : reg; 565 + } else { 566 + reg = readl(dev->regs + S5P_CISTATUS); 567 + return (reg & S5P_CISTATUS_FRAMECNT_MASK) >> 568 + S5P_CISTATUS_FRAMECNT_SHIFT; 569 + } 566 570 } 567 571 568 572 /* -----------------------------------------------------*/ ··· 606 594 struct v4l2_format *f); 607 595 int fimc_vidioc_try_fmt(struct file *file, void *priv, 608 596 struct v4l2_format *f); 609 - int fimc_vidioc_g_crop(struct file *file, void *fh, 610 - struct v4l2_crop *cr); 611 - int fimc_vidioc_cropcap(struct file *file, void *fh, 612 - struct v4l2_cropcap *cr); 613 597 int fimc_vidioc_queryctrl(struct file *file, void *priv, 614 598 struct v4l2_queryctrl *qc); 615 599 int fimc_vidioc_g_ctrl(struct file *file, void *priv,
+3
drivers/media/video/s5p-fimc/regs-fimc.h
··· 165 165 #define S5P_CISTATUS_VVALID_A (1 << 15) 166 166 #define S5P_CISTATUS_VVALID_B (1 << 14) 167 167 168 + /* Indexes to the last and the currently processed buffer. */ 169 + #define S5P_CISTATUS2 0x68 170 + 168 171 /* Image capture control */ 169 172 #define S5P_CIIMGCPT 0xc0 170 173 #define S5P_CIIMGCPT_IMGCPTEN (1 << 31)
+1 -1
drivers/media/video/sh_mobile_ceu_camera.c
··· 1980 1980 * we complete the completion. 1981 1981 */ 1982 1982 1983 - if (!csi2->driver || !csi2->driver->owner) { 1983 + if (!csi2->driver) { 1984 1984 complete(&wait.completion); 1985 1985 /* Either too late, or probing failed */ 1986 1986 bus_unregister_notifier(&platform_bus_type, &wait.notifier);