Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'media/v4.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:

- a regression fix at the videobuf2 core driver

- fix error handling at mantis probing code

- revert the IR encode patches, as the API is not mature enough.
So, better to postpone the changes to a latter Kernel

- fix Kconfig breakages on some randconfig scenarios.

* tag 'media/v4.2-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] mantis: Fix error handling in mantis_dma_init()
Revert "[media] rc: rc-ir-raw: Add scancode encoder callback"
Revert "[media] rc: rc-ir-raw: Add Manchester encoder (phase encoder) helper"
Revert "[media] rc: ir-rc5-decoder: Add encode capability"
Revert "[media] rc: ir-rc6-decoder: Add encode capability"
Revert "[media] rc: rc-core: Add support for encode_wakeup drivers"
Revert "[media] rc: rc-loopback: Add loopback of filter scancodes"
Revert "[media] rc: nuvoton-cir: Add support for writing wakeup samples via sysfs filter callback"
[media] vb2: Fix compilation breakage when !CONFIG_BUG
[media] vb2: Only requeue buffers immediately once streaming is started
[media] media/pci/cobalt: fix Kconfig and build when SND is not enabled
[media] media/dvb: fix ts2020.c Kconfig and build

+34 -609
+1 -1
drivers/media/dvb-frontends/Kconfig
··· 240 240 241 241 config DVB_TS2020 242 242 tristate "Montage Tehnology TS2020 based tuners" 243 - depends on DVB_CORE 243 + depends on DVB_CORE && I2C 244 244 select REGMAP_I2C 245 245 default m if !MEDIA_SUBDRV_AUTOSELECT 246 246 help
+1
drivers/media/pci/cobalt/Kconfig
··· 2 2 tristate "Cisco Cobalt support" 3 3 depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER 4 4 depends on PCI_MSI && MTD_COMPLEX_MAPPINGS && GPIOLIB 5 + depends on SND 5 6 select I2C_ALGOBIT 6 7 select VIDEO_ADV7604 7 8 select VIDEO_ADV7511
+1 -1
drivers/media/pci/cobalt/cobalt-irq.c
··· 139 139 also know about dropped frames. */ 140 140 cb->vb.v4l2_buf.sequence = s->sequence++; 141 141 vb2_buffer_done(&cb->vb, (skip || s->unstable_frame) ? 142 - VB2_BUF_STATE_QUEUED : VB2_BUF_STATE_DONE); 142 + VB2_BUF_STATE_REQUEUEING : VB2_BUF_STATE_DONE); 143 143 } 144 144 145 145 irqreturn_t cobalt_irq_handler(int irq, void *dev_id)
+3 -2
drivers/media/pci/mantis/mantis_dma.c
··· 130 130 131 131 int mantis_dma_init(struct mantis_pci *mantis) 132 132 { 133 - int err = 0; 133 + int err; 134 134 135 135 dprintk(MANTIS_DEBUG, 1, "Mantis DMA init"); 136 - if (mantis_alloc_buffers(mantis) < 0) { 136 + err = mantis_alloc_buffers(mantis); 137 + if (err < 0) { 137 138 dprintk(MANTIS_ERROR, 1, "Error allocating DMA buffer"); 138 139 139 140 /* Stop RISC Engine */
-116
drivers/media/rc/ir-rc5-decoder.c
··· 184 184 return -EINVAL; 185 185 } 186 186 187 - static struct ir_raw_timings_manchester ir_rc5_timings = { 188 - .leader = RC5_UNIT, 189 - .pulse_space_start = 0, 190 - .clock = RC5_UNIT, 191 - .trailer_space = RC5_UNIT * 10, 192 - }; 193 - 194 - static struct ir_raw_timings_manchester ir_rc5x_timings[2] = { 195 - { 196 - .leader = RC5_UNIT, 197 - .pulse_space_start = 0, 198 - .clock = RC5_UNIT, 199 - .trailer_space = RC5X_SPACE, 200 - }, 201 - { 202 - .clock = RC5_UNIT, 203 - .trailer_space = RC5_UNIT * 10, 204 - }, 205 - }; 206 - 207 - static struct ir_raw_timings_manchester ir_rc5_sz_timings = { 208 - .leader = RC5_UNIT, 209 - .pulse_space_start = 0, 210 - .clock = RC5_UNIT, 211 - .trailer_space = RC5_UNIT * 10, 212 - }; 213 - 214 - static int ir_rc5_validate_filter(const struct rc_scancode_filter *scancode, 215 - unsigned int important_bits) 216 - { 217 - /* all important bits of scancode should be set in mask */ 218 - if (~scancode->mask & important_bits) 219 - return -EINVAL; 220 - /* extra bits in mask should be zero in data */ 221 - if (scancode->mask & scancode->data & ~important_bits) 222 - return -EINVAL; 223 - return 0; 224 - } 225 - 226 - /** 227 - * ir_rc5_encode() - Encode a scancode as a stream of raw events 228 - * 229 - * @protocols: allowed protocols 230 - * @scancode: scancode filter describing scancode (helps distinguish between 231 - * protocol subtypes when scancode is ambiguous) 232 - * @events: array of raw ir events to write into 233 - * @max: maximum size of @events 234 - * 235 - * Returns: The number of events written. 236 - * -ENOBUFS if there isn't enough space in the array to fit the 237 - * encoding. In this case all @max events will have been written. 238 - * -EINVAL if the scancode is ambiguous or invalid. 239 - */ 240 - static int ir_rc5_encode(u64 protocols, 241 - const struct rc_scancode_filter *scancode, 242 - struct ir_raw_event *events, unsigned int max) 243 - { 244 - int ret; 245 - struct ir_raw_event *e = events; 246 - unsigned int data, xdata, command, commandx, system; 247 - 248 - /* Detect protocol and convert scancode to raw data */ 249 - if (protocols & RC_BIT_RC5 && 250 - !ir_rc5_validate_filter(scancode, 0x1f7f)) { 251 - /* decode scancode */ 252 - command = (scancode->data & 0x003f) >> 0; 253 - commandx = (scancode->data & 0x0040) >> 6; 254 - system = (scancode->data & 0x1f00) >> 8; 255 - /* encode data */ 256 - data = !commandx << 12 | system << 6 | command; 257 - 258 - /* Modulate the data */ 259 - ret = ir_raw_gen_manchester(&e, max, &ir_rc5_timings, RC5_NBITS, 260 - data); 261 - if (ret < 0) 262 - return ret; 263 - } else if (protocols & RC_BIT_RC5X && 264 - !ir_rc5_validate_filter(scancode, 0x1f7f3f)) { 265 - /* decode scancode */ 266 - xdata = (scancode->data & 0x00003f) >> 0; 267 - command = (scancode->data & 0x003f00) >> 8; 268 - commandx = (scancode->data & 0x004000) >> 14; 269 - system = (scancode->data & 0x1f0000) >> 16; 270 - /* commandx and system overlap, bits must match when encoded */ 271 - if (commandx == (system & 0x1)) 272 - return -EINVAL; 273 - /* encode data */ 274 - data = 1 << 18 | system << 12 | command << 6 | xdata; 275 - 276 - /* Modulate the data */ 277 - ret = ir_raw_gen_manchester(&e, max, &ir_rc5x_timings[0], 278 - CHECK_RC5X_NBITS, 279 - data >> (RC5X_NBITS-CHECK_RC5X_NBITS)); 280 - if (ret < 0) 281 - return ret; 282 - ret = ir_raw_gen_manchester(&e, max - (e - events), 283 - &ir_rc5x_timings[1], 284 - RC5X_NBITS - CHECK_RC5X_NBITS, 285 - data); 286 - if (ret < 0) 287 - return ret; 288 - } else if (protocols & RC_BIT_RC5_SZ && 289 - !ir_rc5_validate_filter(scancode, 0x2fff)) { 290 - /* RC5-SZ scancode is raw enough for Manchester as it is */ 291 - ret = ir_raw_gen_manchester(&e, max, &ir_rc5_sz_timings, 292 - RC5_SZ_NBITS, scancode->data & 0x2fff); 293 - if (ret < 0) 294 - return ret; 295 - } else { 296 - return -EINVAL; 297 - } 298 - 299 - return e - events; 300 - } 301 - 302 187 static struct ir_raw_handler rc5_handler = { 303 188 .protocols = RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ, 304 189 .decode = ir_rc5_decode, 305 - .encode = ir_rc5_encode, 306 190 }; 307 191 308 192 static int __init ir_rc5_decode_init(void)
-122
drivers/media/rc/ir-rc6-decoder.c
··· 291 291 return -EINVAL; 292 292 } 293 293 294 - static struct ir_raw_timings_manchester ir_rc6_timings[4] = { 295 - { 296 - .leader = RC6_PREFIX_PULSE, 297 - .pulse_space_start = 0, 298 - .clock = RC6_UNIT, 299 - .invert = 1, 300 - .trailer_space = RC6_PREFIX_SPACE, 301 - }, 302 - { 303 - .clock = RC6_UNIT, 304 - .invert = 1, 305 - }, 306 - { 307 - .clock = RC6_UNIT * 2, 308 - .invert = 1, 309 - }, 310 - { 311 - .clock = RC6_UNIT, 312 - .invert = 1, 313 - .trailer_space = RC6_SUFFIX_SPACE, 314 - }, 315 - }; 316 - 317 - static int ir_rc6_validate_filter(const struct rc_scancode_filter *scancode, 318 - unsigned int important_bits) 319 - { 320 - /* all important bits of scancode should be set in mask */ 321 - if (~scancode->mask & important_bits) 322 - return -EINVAL; 323 - /* extra bits in mask should be zero in data */ 324 - if (scancode->mask & scancode->data & ~important_bits) 325 - return -EINVAL; 326 - return 0; 327 - } 328 - 329 - /** 330 - * ir_rc6_encode() - Encode a scancode as a stream of raw events 331 - * 332 - * @protocols: allowed protocols 333 - * @scancode: scancode filter describing scancode (helps distinguish between 334 - * protocol subtypes when scancode is ambiguous) 335 - * @events: array of raw ir events to write into 336 - * @max: maximum size of @events 337 - * 338 - * Returns: The number of events written. 339 - * -ENOBUFS if there isn't enough space in the array to fit the 340 - * encoding. In this case all @max events will have been written. 341 - * -EINVAL if the scancode is ambiguous or invalid. 342 - */ 343 - static int ir_rc6_encode(u64 protocols, 344 - const struct rc_scancode_filter *scancode, 345 - struct ir_raw_event *events, unsigned int max) 346 - { 347 - int ret; 348 - struct ir_raw_event *e = events; 349 - 350 - if (protocols & RC_BIT_RC6_0 && 351 - !ir_rc6_validate_filter(scancode, 0xffff)) { 352 - 353 - /* Modulate the preamble */ 354 - ret = ir_raw_gen_manchester(&e, max, &ir_rc6_timings[0], 0, 0); 355 - if (ret < 0) 356 - return ret; 357 - 358 - /* Modulate the header (Start Bit & Mode-0) */ 359 - ret = ir_raw_gen_manchester(&e, max - (e - events), 360 - &ir_rc6_timings[1], 361 - RC6_HEADER_NBITS, (1 << 3)); 362 - if (ret < 0) 363 - return ret; 364 - 365 - /* Modulate Trailer Bit */ 366 - ret = ir_raw_gen_manchester(&e, max - (e - events), 367 - &ir_rc6_timings[2], 1, 0); 368 - if (ret < 0) 369 - return ret; 370 - 371 - /* Modulate rest of the data */ 372 - ret = ir_raw_gen_manchester(&e, max - (e - events), 373 - &ir_rc6_timings[3], RC6_0_NBITS, 374 - scancode->data); 375 - if (ret < 0) 376 - return ret; 377 - 378 - } else if (protocols & (RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | 379 - RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE) && 380 - !ir_rc6_validate_filter(scancode, 0x8fffffff)) { 381 - 382 - /* Modulate the preamble */ 383 - ret = ir_raw_gen_manchester(&e, max, &ir_rc6_timings[0], 0, 0); 384 - if (ret < 0) 385 - return ret; 386 - 387 - /* Modulate the header (Start Bit & Header-version 6 */ 388 - ret = ir_raw_gen_manchester(&e, max - (e - events), 389 - &ir_rc6_timings[1], 390 - RC6_HEADER_NBITS, (1 << 3 | 6)); 391 - if (ret < 0) 392 - return ret; 393 - 394 - /* Modulate Trailer Bit */ 395 - ret = ir_raw_gen_manchester(&e, max - (e - events), 396 - &ir_rc6_timings[2], 1, 0); 397 - if (ret < 0) 398 - return ret; 399 - 400 - /* Modulate rest of the data */ 401 - ret = ir_raw_gen_manchester(&e, max - (e - events), 402 - &ir_rc6_timings[3], 403 - fls(scancode->mask), 404 - scancode->data); 405 - if (ret < 0) 406 - return ret; 407 - 408 - } else { 409 - return -EINVAL; 410 - } 411 - 412 - return e - events; 413 - } 414 - 415 294 static struct ir_raw_handler rc6_handler = { 416 295 .protocols = RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | 417 296 RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 | 418 297 RC_BIT_RC6_MCE, 419 298 .decode = ir_rc6_decode, 420 - .encode = ir_rc6_encode, 421 299 }; 422 300 423 301 static int __init ir_rc6_decode_init(void)
-127
drivers/media/rc/nuvoton-cir.c
··· 526 526 return 0; 527 527 } 528 528 529 - static int nvt_write_wakeup_codes(struct rc_dev *dev, 530 - const u8 *wakeup_sample_buf, int count) 531 - { 532 - int i = 0; 533 - u8 reg, reg_learn_mode; 534 - unsigned long flags; 535 - struct nvt_dev *nvt = dev->priv; 536 - 537 - nvt_dbg_wake("writing wakeup samples"); 538 - 539 - reg = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON); 540 - reg_learn_mode = reg & ~CIR_WAKE_IRCON_MODE0; 541 - reg_learn_mode |= CIR_WAKE_IRCON_MODE1; 542 - 543 - /* Lock the learn area to prevent racing with wake-isr */ 544 - spin_lock_irqsave(&nvt->nvt_lock, flags); 545 - 546 - /* Enable fifo writes */ 547 - nvt_cir_wake_reg_write(nvt, reg_learn_mode, CIR_WAKE_IRCON); 548 - 549 - /* Clear cir wake rx fifo */ 550 - nvt_clear_cir_wake_fifo(nvt); 551 - 552 - if (count > WAKE_FIFO_LEN) { 553 - nvt_dbg_wake("HW FIFO too small for all wake samples"); 554 - count = WAKE_FIFO_LEN; 555 - } 556 - 557 - if (count) 558 - pr_info("Wake samples (%d) =", count); 559 - else 560 - pr_info("Wake sample fifo cleared"); 561 - 562 - /* Write wake samples to fifo */ 563 - for (i = 0; i < count; i++) { 564 - pr_cont(" %02x", wakeup_sample_buf[i]); 565 - nvt_cir_wake_reg_write(nvt, wakeup_sample_buf[i], 566 - CIR_WAKE_WR_FIFO_DATA); 567 - } 568 - pr_cont("\n"); 569 - 570 - /* Switch cir to wakeup mode and disable fifo writing */ 571 - nvt_cir_wake_reg_write(nvt, reg, CIR_WAKE_IRCON); 572 - 573 - /* Set number of bytes needed for wake */ 574 - nvt_cir_wake_reg_write(nvt, count ? count : 575 - CIR_WAKE_FIFO_CMP_BYTES, 576 - CIR_WAKE_FIFO_CMP_DEEP); 577 - 578 - spin_unlock_irqrestore(&nvt->nvt_lock, flags); 579 - 580 - return 0; 581 - } 582 - 583 - static int nvt_ir_raw_set_wakeup_filter(struct rc_dev *dev, 584 - struct rc_scancode_filter *sc_filter) 585 - { 586 - u8 *reg_buf; 587 - u8 buf_val; 588 - int i, ret, count; 589 - unsigned int val; 590 - struct ir_raw_event *raw; 591 - bool complete; 592 - 593 - /* Require both mask and data to be set before actually committing */ 594 - if (!sc_filter->mask || !sc_filter->data) 595 - return 0; 596 - 597 - raw = kmalloc_array(WAKE_FIFO_LEN, sizeof(*raw), GFP_KERNEL); 598 - if (!raw) 599 - return -ENOMEM; 600 - 601 - ret = ir_raw_encode_scancode(dev->enabled_wakeup_protocols, sc_filter, 602 - raw, WAKE_FIFO_LEN); 603 - complete = (ret != -ENOBUFS); 604 - if (!complete) 605 - ret = WAKE_FIFO_LEN; 606 - else if (ret < 0) 607 - goto out_raw; 608 - 609 - reg_buf = kmalloc_array(WAKE_FIFO_LEN, sizeof(*reg_buf), GFP_KERNEL); 610 - if (!reg_buf) { 611 - ret = -ENOMEM; 612 - goto out_raw; 613 - } 614 - 615 - /* Inspect the ir samples */ 616 - for (i = 0, count = 0; i < ret && count < WAKE_FIFO_LEN; ++i) { 617 - val = NS_TO_US((raw[i]).duration) / SAMPLE_PERIOD; 618 - 619 - /* Split too large values into several smaller ones */ 620 - while (val > 0 && count < WAKE_FIFO_LEN) { 621 - 622 - /* Skip last value for better comparison tolerance */ 623 - if (complete && i == ret - 1 && val < BUF_LEN_MASK) 624 - break; 625 - 626 - /* Clamp values to BUF_LEN_MASK at most */ 627 - buf_val = (val > BUF_LEN_MASK) ? BUF_LEN_MASK : val; 628 - 629 - reg_buf[count] = buf_val; 630 - val -= buf_val; 631 - if ((raw[i]).pulse) 632 - reg_buf[count] |= BUF_PULSE_BIT; 633 - count++; 634 - } 635 - } 636 - 637 - ret = nvt_write_wakeup_codes(dev, reg_buf, count); 638 - 639 - kfree(reg_buf); 640 - out_raw: 641 - kfree(raw); 642 - 643 - return ret; 644 - } 645 - 646 - /* Dummy implementation. nuvoton is agnostic to the protocol used */ 647 - static int nvt_ir_raw_change_wakeup_protocol(struct rc_dev *dev, 648 - u64 *rc_type) 649 - { 650 - return 0; 651 - } 652 - 653 529 /* 654 530 * nvt_tx_ir 655 531 * ··· 1043 1167 /* Set up the rc device */ 1044 1168 rdev->priv = nvt; 1045 1169 rdev->driver_type = RC_DRIVER_IR_RAW; 1046 - rdev->encode_wakeup = true; 1047 1170 rdev->allowed_protocols = RC_BIT_ALL; 1048 1171 rdev->open = nvt_open; 1049 1172 rdev->close = nvt_close; 1050 1173 rdev->tx_ir = nvt_tx_ir; 1051 1174 rdev->s_tx_carrier = nvt_set_tx_carrier; 1052 - rdev->s_wakeup_filter = nvt_ir_raw_set_wakeup_filter; 1053 - rdev->change_wakeup_protocol = nvt_ir_raw_change_wakeup_protocol; 1054 1175 rdev->input_name = "Nuvoton w836x7hg Infrared Remote Transceiver"; 1055 1176 rdev->input_phys = "nuvoton/cir0"; 1056 1177 rdev->input_id.bustype = BUS_HOST;
-1
drivers/media/rc/nuvoton-cir.h
··· 63 63 */ 64 64 #define TX_BUF_LEN 256 65 65 #define RX_BUF_LEN 32 66 - #define WAKE_FIFO_LEN 67 67 66 68 67 struct nvt_dev { 69 68 struct pnp_dev *pdev;
-36
drivers/media/rc/rc-core-priv.h
··· 25 25 26 26 u64 protocols; /* which are handled by this handler */ 27 27 int (*decode)(struct rc_dev *dev, struct ir_raw_event event); 28 - int (*encode)(u64 protocols, const struct rc_scancode_filter *scancode, 29 - struct ir_raw_event *events, unsigned int max); 30 28 31 29 /* These two should only be used by the lirc decoder */ 32 30 int (*raw_register)(struct rc_dev *dev); ··· 150 152 #define TO_US(duration) DIV_ROUND_CLOSEST((duration), 1000) 151 153 #define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space") 152 154 153 - /* functions for IR encoders */ 154 - 155 - static inline void init_ir_raw_event_duration(struct ir_raw_event *ev, 156 - unsigned int pulse, 157 - u32 duration) 158 - { 159 - init_ir_raw_event(ev); 160 - ev->duration = duration; 161 - ev->pulse = pulse; 162 - } 163 - 164 - /** 165 - * struct ir_raw_timings_manchester - Manchester coding timings 166 - * @leader: duration of leader pulse (if any) 0 if continuing 167 - * existing signal (see @pulse_space_start) 168 - * @pulse_space_start: 1 for starting with pulse (0 for starting with space) 169 - * @clock: duration of each pulse/space in ns 170 - * @invert: if set clock logic is inverted 171 - * (0 = space + pulse, 1 = pulse + space) 172 - * @trailer_space: duration of trailer space in ns 173 - */ 174 - struct ir_raw_timings_manchester { 175 - unsigned int leader; 176 - unsigned int pulse_space_start:1; 177 - unsigned int clock; 178 - unsigned int invert:1; 179 - unsigned int trailer_space; 180 - }; 181 - 182 - int ir_raw_gen_manchester(struct ir_raw_event **ev, unsigned int max, 183 - const struct ir_raw_timings_manchester *timings, 184 - unsigned int n, unsigned int data); 185 - 186 155 /* 187 156 * Routines from rc-raw.c to be used internally and by decoders 188 157 */ 189 158 u64 ir_raw_get_allowed_protocols(void); 190 - u64 ir_raw_get_encode_protocols(void); 191 159 int ir_raw_event_register(struct rc_dev *dev); 192 160 void ir_raw_event_unregister(struct rc_dev *dev); 193 161 int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler);
-139
drivers/media/rc/rc-ir-raw.c
··· 30 30 static DEFINE_MUTEX(ir_raw_handler_lock); 31 31 static LIST_HEAD(ir_raw_handler_list); 32 32 static u64 available_protocols; 33 - static u64 encode_protocols; 34 33 35 34 static int ir_raw_event_thread(void *data) 36 35 { ··· 240 241 return protocols; 241 242 } 242 243 243 - /* used internally by the sysfs interface */ 244 - u64 245 - ir_raw_get_encode_protocols(void) 246 - { 247 - u64 protocols; 248 - 249 - mutex_lock(&ir_raw_handler_lock); 250 - protocols = encode_protocols; 251 - mutex_unlock(&ir_raw_handler_lock); 252 - return protocols; 253 - } 254 - 255 244 static int change_protocol(struct rc_dev *dev, u64 *rc_type) 256 245 { 257 246 /* the caller will update dev->enabled_protocols */ 258 247 return 0; 259 248 } 260 - 261 - /** 262 - * ir_raw_gen_manchester() - Encode data with Manchester (bi-phase) modulation. 263 - * @ev: Pointer to pointer to next free event. *@ev is incremented for 264 - * each raw event filled. 265 - * @max: Maximum number of raw events to fill. 266 - * @timings: Manchester modulation timings. 267 - * @n: Number of bits of data. 268 - * @data: Data bits to encode. 269 - * 270 - * Encodes the @n least significant bits of @data using Manchester (bi-phase) 271 - * modulation with the timing characteristics described by @timings, writing up 272 - * to @max raw IR events using the *@ev pointer. 273 - * 274 - * Returns: 0 on success. 275 - * -ENOBUFS if there isn't enough space in the array to fit the 276 - * full encoded data. In this case all @max events will have been 277 - * written. 278 - */ 279 - int ir_raw_gen_manchester(struct ir_raw_event **ev, unsigned int max, 280 - const struct ir_raw_timings_manchester *timings, 281 - unsigned int n, unsigned int data) 282 - { 283 - bool need_pulse; 284 - unsigned int i; 285 - int ret = -ENOBUFS; 286 - 287 - i = 1 << (n - 1); 288 - 289 - if (timings->leader) { 290 - if (!max--) 291 - return ret; 292 - if (timings->pulse_space_start) { 293 - init_ir_raw_event_duration((*ev)++, 1, timings->leader); 294 - 295 - if (!max--) 296 - return ret; 297 - init_ir_raw_event_duration((*ev), 0, timings->leader); 298 - } else { 299 - init_ir_raw_event_duration((*ev), 1, timings->leader); 300 - } 301 - i >>= 1; 302 - } else { 303 - /* continue existing signal */ 304 - --(*ev); 305 - } 306 - /* from here on *ev will point to the last event rather than the next */ 307 - 308 - while (n && i > 0) { 309 - need_pulse = !(data & i); 310 - if (timings->invert) 311 - need_pulse = !need_pulse; 312 - if (need_pulse == !!(*ev)->pulse) { 313 - (*ev)->duration += timings->clock; 314 - } else { 315 - if (!max--) 316 - goto nobufs; 317 - init_ir_raw_event_duration(++(*ev), need_pulse, 318 - timings->clock); 319 - } 320 - 321 - if (!max--) 322 - goto nobufs; 323 - init_ir_raw_event_duration(++(*ev), !need_pulse, 324 - timings->clock); 325 - i >>= 1; 326 - } 327 - 328 - if (timings->trailer_space) { 329 - if (!(*ev)->pulse) 330 - (*ev)->duration += timings->trailer_space; 331 - else if (!max--) 332 - goto nobufs; 333 - else 334 - init_ir_raw_event_duration(++(*ev), 0, 335 - timings->trailer_space); 336 - } 337 - 338 - ret = 0; 339 - nobufs: 340 - /* point to the next event rather than last event before returning */ 341 - ++(*ev); 342 - return ret; 343 - } 344 - EXPORT_SYMBOL(ir_raw_gen_manchester); 345 - 346 - /** 347 - * ir_raw_encode_scancode() - Encode a scancode as raw events 348 - * 349 - * @protocols: permitted protocols 350 - * @scancode: scancode filter describing a single scancode 351 - * @events: array of raw events to write into 352 - * @max: max number of raw events 353 - * 354 - * Attempts to encode the scancode as raw events. 355 - * 356 - * Returns: The number of events written. 357 - * -ENOBUFS if there isn't enough space in the array to fit the 358 - * encoding. In this case all @max events will have been written. 359 - * -EINVAL if the scancode is ambiguous or invalid, or if no 360 - * compatible encoder was found. 361 - */ 362 - int ir_raw_encode_scancode(u64 protocols, 363 - const struct rc_scancode_filter *scancode, 364 - struct ir_raw_event *events, unsigned int max) 365 - { 366 - struct ir_raw_handler *handler; 367 - int ret = -EINVAL; 368 - 369 - mutex_lock(&ir_raw_handler_lock); 370 - list_for_each_entry(handler, &ir_raw_handler_list, list) { 371 - if (handler->protocols & protocols && handler->encode) { 372 - ret = handler->encode(protocols, scancode, events, max); 373 - if (ret >= 0 || ret == -ENOBUFS) 374 - break; 375 - } 376 - } 377 - mutex_unlock(&ir_raw_handler_lock); 378 - 379 - return ret; 380 - } 381 - EXPORT_SYMBOL(ir_raw_encode_scancode); 382 249 383 250 /* 384 251 * Used to (un)register raw event clients ··· 328 463 list_for_each_entry(raw, &ir_raw_client_list, list) 329 464 ir_raw_handler->raw_register(raw->dev); 330 465 available_protocols |= ir_raw_handler->protocols; 331 - if (ir_raw_handler->encode) 332 - encode_protocols |= ir_raw_handler->protocols; 333 466 mutex_unlock(&ir_raw_handler_lock); 334 467 335 468 return 0; ··· 344 481 list_for_each_entry(raw, &ir_raw_client_list, list) 345 482 ir_raw_handler->raw_unregister(raw->dev); 346 483 available_protocols &= ~ir_raw_handler->protocols; 347 - if (ir_raw_handler->encode) 348 - encode_protocols &= ~ir_raw_handler->protocols; 349 484 mutex_unlock(&ir_raw_handler_lock); 350 485 } 351 486 EXPORT_SYMBOL(ir_raw_handler_unregister);
-36
drivers/media/rc/rc-loopback.c
··· 26 26 #include <linux/device.h> 27 27 #include <linux/module.h> 28 28 #include <linux/sched.h> 29 - #include <linux/slab.h> 30 29 #include <media/rc-core.h> 31 30 32 31 #define DRIVER_NAME "rc-loopback" ··· 176 177 return 0; 177 178 } 178 179 179 - static int loop_set_wakeup_filter(struct rc_dev *dev, 180 - struct rc_scancode_filter *sc_filter) 181 - { 182 - static const unsigned int max = 512; 183 - struct ir_raw_event *raw; 184 - int ret; 185 - int i; 186 - 187 - /* fine to disable filter */ 188 - if (!sc_filter->mask) 189 - return 0; 190 - 191 - /* encode the specified filter and loop it back */ 192 - raw = kmalloc_array(max, sizeof(*raw), GFP_KERNEL); 193 - ret = ir_raw_encode_scancode(dev->enabled_wakeup_protocols, sc_filter, 194 - raw, max); 195 - /* still loop back the partial raw IR even if it's incomplete */ 196 - if (ret == -ENOBUFS) 197 - ret = max; 198 - if (ret >= 0) { 199 - /* do the loopback */ 200 - for (i = 0; i < ret; ++i) 201 - ir_raw_event_store(dev, &raw[i]); 202 - ir_raw_event_handle(dev); 203 - 204 - ret = 0; 205 - } 206 - 207 - kfree(raw); 208 - 209 - return ret; 210 - } 211 - 212 180 static int __init loop_init(void) 213 181 { 214 182 struct rc_dev *rc; ··· 195 229 rc->map_name = RC_MAP_EMPTY; 196 230 rc->priv = &loopdev; 197 231 rc->driver_type = RC_DRIVER_IR_RAW; 198 - rc->encode_wakeup = true; 199 232 rc->allowed_protocols = RC_BIT_ALL; 200 233 rc->timeout = 100 * 1000 * 1000; /* 100 ms */ 201 234 rc->min_timeout = 1; ··· 209 244 rc->s_idle = loop_set_idle; 210 245 rc->s_learning_mode = loop_set_learning_mode; 211 246 rc->s_carrier_report = loop_set_carrier_report; 212 - rc->s_wakeup_filter = loop_set_wakeup_filter; 213 247 214 248 loopdev.txmask = RXMASK_REGULAR; 215 249 loopdev.txcarrier = 36000;
+1 -6
drivers/media/rc/rc-main.c
··· 865 865 } else { 866 866 enabled = dev->enabled_wakeup_protocols; 867 867 allowed = dev->allowed_wakeup_protocols; 868 - if (dev->encode_wakeup && !allowed) 869 - allowed = ir_raw_get_encode_protocols(); 870 868 } 871 869 872 870 mutex_unlock(&dev->lock); ··· 1406 1408 path ? path : "N/A"); 1407 1409 kfree(path); 1408 1410 1409 - if (dev->driver_type == RC_DRIVER_IR_RAW || dev->encode_wakeup) { 1411 + if (dev->driver_type == RC_DRIVER_IR_RAW) { 1410 1412 /* Load raw decoders, if they aren't already */ 1411 1413 if (!raw_init) { 1412 1414 IR_dprintk(1, "Loading raw decoders\n"); 1413 1415 ir_raw_init(); 1414 1416 raw_init = true; 1415 1417 } 1416 - } 1417 - 1418 - if (dev->driver_type == RC_DRIVER_IR_RAW) { 1419 1418 /* calls ir_register_device so unlock mutex here*/ 1420 1419 mutex_unlock(&dev->lock); 1421 1420 rc = ir_raw_event_register(dev);
+25 -15
drivers/media/v4l2-core/videobuf2-core.c
··· 715 715 break; 716 716 case VB2_BUF_STATE_PREPARING: 717 717 case VB2_BUF_STATE_DEQUEUED: 718 + case VB2_BUF_STATE_REQUEUEING: 718 719 /* nothing */ 719 720 break; 720 721 } ··· 1183 1182 1184 1183 if (WARN_ON(state != VB2_BUF_STATE_DONE && 1185 1184 state != VB2_BUF_STATE_ERROR && 1186 - state != VB2_BUF_STATE_QUEUED)) 1185 + state != VB2_BUF_STATE_QUEUED && 1186 + state != VB2_BUF_STATE_REQUEUEING)) 1187 1187 state = VB2_BUF_STATE_ERROR; 1188 1188 1189 1189 #ifdef CONFIG_VIDEO_ADV_DEBUG ··· 1201 1199 for (plane = 0; plane < vb->num_planes; ++plane) 1202 1200 call_void_memop(vb, finish, vb->planes[plane].mem_priv); 1203 1201 1204 - /* Add the buffer to the done buffers list */ 1205 1202 spin_lock_irqsave(&q->done_lock, flags); 1206 - vb->state = state; 1207 - if (state != VB2_BUF_STATE_QUEUED) 1203 + if (state == VB2_BUF_STATE_QUEUED || 1204 + state == VB2_BUF_STATE_REQUEUEING) { 1205 + vb->state = VB2_BUF_STATE_QUEUED; 1206 + } else { 1207 + /* Add the buffer to the done buffers list */ 1208 1208 list_add_tail(&vb->done_entry, &q->done_list); 1209 + vb->state = state; 1210 + } 1209 1211 atomic_dec(&q->owned_by_drv_count); 1210 1212 spin_unlock_irqrestore(&q->done_lock, flags); 1211 1213 1212 - if (state == VB2_BUF_STATE_QUEUED) { 1214 + switch (state) { 1215 + case VB2_BUF_STATE_QUEUED: 1216 + return; 1217 + case VB2_BUF_STATE_REQUEUEING: 1213 1218 if (q->start_streaming_called) 1214 1219 __enqueue_in_driver(vb); 1215 1220 return; 1221 + default: 1222 + /* Inform any processes that may be waiting for buffers */ 1223 + wake_up(&q->done_wq); 1224 + break; 1216 1225 } 1217 - 1218 - /* Inform any processes that may be waiting for buffers */ 1219 - wake_up(&q->done_wq); 1220 1226 } 1221 1227 EXPORT_SYMBOL_GPL(vb2_buffer_done); 1222 1228 ··· 1254 1244 1255 1245 static void vb2_warn_zero_bytesused(struct vb2_buffer *vb) 1256 1246 { 1257 - static bool __check_once __read_mostly; 1247 + static bool check_once; 1258 1248 1259 - if (__check_once) 1249 + if (check_once) 1260 1250 return; 1261 1251 1262 - __check_once = true; 1263 - __WARN(); 1252 + check_once = true; 1253 + WARN_ON(1); 1264 1254 1265 - pr_warn_once("use of bytesused == 0 is deprecated and will be removed in the future,\n"); 1255 + pr_warn("use of bytesused == 0 is deprecated and will be removed in the future,\n"); 1266 1256 if (vb->vb2_queue->allow_zero_bytesused) 1267 - pr_warn_once("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); 1257 + pr_warn("use VIDIOC_DECODER_CMD(V4L2_DEC_CMD_STOP) instead.\n"); 1268 1258 else 1269 - pr_warn_once("use the actual size instead.\n"); 1259 + pr_warn("use the actual size instead.\n"); 1270 1260 } 1271 1261 1272 1262 /**
-7
include/media/rc-core.h
··· 74 74 * @input_dev: the input child device used to communicate events to userspace 75 75 * @driver_type: specifies if protocol decoding is done in hardware or software 76 76 * @idle: used to keep track of RX state 77 - * @encode_wakeup: wakeup filtering uses IR encode API, therefore the allowed 78 - * wakeup protocols is the set of all raw encoders 79 77 * @allowed_protocols: bitmask with the supported RC_BIT_* protocols 80 78 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols 81 79 * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols ··· 134 136 struct input_dev *input_dev; 135 137 enum rc_driver_type driver_type; 136 138 bool idle; 137 - bool encode_wakeup; 138 139 u64 allowed_protocols; 139 140 u64 enabled_protocols; 140 141 u64 allowed_wakeup_protocols; ··· 243 246 #define US_TO_NS(usec) ((usec) * 1000) 244 247 #define MS_TO_US(msec) ((msec) * 1000) 245 248 #define MS_TO_NS(msec) ((msec) * 1000 * 1000) 246 - #define NS_TO_US(nsec) DIV_ROUND_UP(nsec, 1000L) 247 249 248 250 void ir_raw_event_handle(struct rc_dev *dev); 249 251 int ir_raw_event_store(struct rc_dev *dev, struct ir_raw_event *ev); ··· 250 254 int ir_raw_event_store_with_filter(struct rc_dev *dev, 251 255 struct ir_raw_event *ev); 252 256 void ir_raw_event_set_idle(struct rc_dev *dev, bool idle); 253 - int ir_raw_encode_scancode(u64 protocols, 254 - const struct rc_scancode_filter *scancode, 255 - struct ir_raw_event *events, unsigned int max); 256 257 257 258 static inline void ir_raw_event_reset(struct rc_dev *dev) 258 259 {
+2
include/media/videobuf2-core.h
··· 139 139 * @VB2_BUF_STATE_PREPARING: buffer is being prepared in videobuf 140 140 * @VB2_BUF_STATE_PREPARED: buffer prepared in videobuf and by the driver 141 141 * @VB2_BUF_STATE_QUEUED: buffer queued in videobuf, but not in driver 142 + * @VB2_BUF_STATE_REQUEUEING: re-queue a buffer to the driver 142 143 * @VB2_BUF_STATE_ACTIVE: buffer queued in driver and possibly used 143 144 * in a hardware operation 144 145 * @VB2_BUF_STATE_DONE: buffer returned from driver to videobuf, but ··· 153 152 VB2_BUF_STATE_PREPARING, 154 153 VB2_BUF_STATE_PREPARED, 155 154 VB2_BUF_STATE_QUEUED, 155 + VB2_BUF_STATE_REQUEUEING, 156 156 VB2_BUF_STATE_ACTIVE, 157 157 VB2_BUF_STATE_DONE, 158 158 VB2_BUF_STATE_ERROR,