diff options
Diffstat (limited to 'drivers/media')
46 files changed, 461 insertions, 175 deletions
diff --git a/drivers/media/common/tuners/tda18271-common.c b/drivers/media/common/tuners/tda18271-common.c index 5466d47db899..aae40e52af5b 100644 --- a/drivers/media/common/tuners/tda18271-common.c +++ b/drivers/media/common/tuners/tda18271-common.c | |||
@@ -533,16 +533,7 @@ int tda18271_calc_main_pll(struct dvb_frontend *fe, u32 freq) | |||
533 | if (tda_fail(ret)) | 533 | if (tda_fail(ret)) |
534 | goto fail; | 534 | goto fail; |
535 | 535 | ||
536 | regs[R_MPD] = (0x77 & pd); | 536 | regs[R_MPD] = (0x7f & pd); |
537 | |||
538 | switch (priv->mode) { | ||
539 | case TDA18271_ANALOG: | ||
540 | regs[R_MPD] &= ~0x08; | ||
541 | break; | ||
542 | case TDA18271_DIGITAL: | ||
543 | regs[R_MPD] |= 0x08; | ||
544 | break; | ||
545 | } | ||
546 | 537 | ||
547 | div = ((d * (freq / 1000)) << 7) / 125; | 538 | div = ((d * (freq / 1000)) << 7) / 125; |
548 | 539 | ||
diff --git a/drivers/media/common/tuners/tda18271-fe.c b/drivers/media/common/tuners/tda18271-fe.c index 9ad4454a148d..d884f5eee73c 100644 --- a/drivers/media/common/tuners/tda18271-fe.c +++ b/drivers/media/common/tuners/tda18271-fe.c | |||
@@ -579,8 +579,8 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
579 | #define RF3 2 | 579 | #define RF3 2 |
580 | u32 rf_default[3]; | 580 | u32 rf_default[3]; |
581 | u32 rf_freq[3]; | 581 | u32 rf_freq[3]; |
582 | u8 prog_cal[3]; | 582 | s32 prog_cal[3]; |
583 | u8 prog_tab[3]; | 583 | s32 prog_tab[3]; |
584 | 584 | ||
585 | i = tda18271_lookup_rf_band(fe, &freq, NULL); | 585 | i = tda18271_lookup_rf_band(fe, &freq, NULL); |
586 | 586 | ||
@@ -602,32 +602,33 @@ static int tda18271_rf_tracking_filters_init(struct dvb_frontend *fe, u32 freq) | |||
602 | return bcal; | 602 | return bcal; |
603 | 603 | ||
604 | tda18271_calc_rf_cal(fe, &rf_freq[rf]); | 604 | tda18271_calc_rf_cal(fe, &rf_freq[rf]); |
605 | prog_tab[rf] = regs[R_EB14]; | 605 | prog_tab[rf] = (s32)regs[R_EB14]; |
606 | 606 | ||
607 | if (1 == bcal) | 607 | if (1 == bcal) |
608 | prog_cal[rf] = tda18271_calibrate_rf(fe, rf_freq[rf]); | 608 | prog_cal[rf] = |
609 | (s32)tda18271_calibrate_rf(fe, rf_freq[rf]); | ||
609 | else | 610 | else |
610 | prog_cal[rf] = prog_tab[rf]; | 611 | prog_cal[rf] = prog_tab[rf]; |
611 | 612 | ||
612 | switch (rf) { | 613 | switch (rf) { |
613 | case RF1: | 614 | case RF1: |
614 | map[i].rf_a1 = 0; | 615 | map[i].rf_a1 = 0; |
615 | map[i].rf_b1 = (s32)(prog_cal[RF1] - prog_tab[RF1]); | 616 | map[i].rf_b1 = (prog_cal[RF1] - prog_tab[RF1]); |
616 | map[i].rf1 = rf_freq[RF1] / 1000; | 617 | map[i].rf1 = rf_freq[RF1] / 1000; |
617 | break; | 618 | break; |
618 | case RF2: | 619 | case RF2: |
619 | dividend = (s32)(prog_cal[RF2] - prog_tab[RF2]) - | 620 | dividend = (prog_cal[RF2] - prog_tab[RF2] - |
620 | (s32)(prog_cal[RF1] + prog_tab[RF1]); | 621 | prog_cal[RF1] + prog_tab[RF1]); |
621 | divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000; | 622 | divisor = (s32)(rf_freq[RF2] - rf_freq[RF1]) / 1000; |
622 | map[i].rf_a1 = (dividend / divisor); | 623 | map[i].rf_a1 = (dividend / divisor); |
623 | map[i].rf2 = rf_freq[RF2] / 1000; | 624 | map[i].rf2 = rf_freq[RF2] / 1000; |
624 | break; | 625 | break; |
625 | case RF3: | 626 | case RF3: |
626 | dividend = (s32)(prog_cal[RF3] - prog_tab[RF3]) - | 627 | dividend = (prog_cal[RF3] - prog_tab[RF3] - |
627 | (s32)(prog_cal[RF2] + prog_tab[RF2]); | 628 | prog_cal[RF2] + prog_tab[RF2]); |
628 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; | 629 | divisor = (s32)(rf_freq[RF3] - rf_freq[RF2]) / 1000; |
629 | map[i].rf_a2 = (dividend / divisor); | 630 | map[i].rf_a2 = (dividend / divisor); |
630 | map[i].rf_b2 = (s32)(prog_cal[RF2] - prog_tab[RF2]); | 631 | map[i].rf_b2 = (prog_cal[RF2] - prog_tab[RF2]); |
631 | map[i].rf3 = rf_freq[RF3] / 1000; | 632 | map[i].rf3 = rf_freq[RF3] / 1000; |
632 | break; | 633 | break; |
633 | default: | 634 | default: |
diff --git a/drivers/media/common/tuners/tda18271-maps.c b/drivers/media/common/tuners/tda18271-maps.c index e7f84c705da8..3d5b6ab7e332 100644 --- a/drivers/media/common/tuners/tda18271-maps.c +++ b/drivers/media/common/tuners/tda18271-maps.c | |||
@@ -229,8 +229,7 @@ static struct tda18271_map tda18271c2_km[] = { | |||
229 | static struct tda18271_map tda18271_rf_band[] = { | 229 | static struct tda18271_map tda18271_rf_band[] = { |
230 | { .rfmax = 47900, .val = 0x00 }, | 230 | { .rfmax = 47900, .val = 0x00 }, |
231 | { .rfmax = 61100, .val = 0x01 }, | 231 | { .rfmax = 61100, .val = 0x01 }, |
232 | /* { .rfmax = 152600, .val = 0x02 }, */ | 232 | { .rfmax = 152600, .val = 0x02 }, |
233 | { .rfmax = 121200, .val = 0x02 }, | ||
234 | { .rfmax = 164700, .val = 0x03 }, | 233 | { .rfmax = 164700, .val = 0x03 }, |
235 | { .rfmax = 203500, .val = 0x04 }, | 234 | { .rfmax = 203500, .val = 0x04 }, |
236 | { .rfmax = 457800, .val = 0x05 }, | 235 | { .rfmax = 457800, .val = 0x05 }, |
@@ -448,7 +447,7 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
448 | { .rfmax = 150000, .val = 0xb0 }, | 447 | { .rfmax = 150000, .val = 0xb0 }, |
449 | { .rfmax = 151000, .val = 0xb1 }, | 448 | { .rfmax = 151000, .val = 0xb1 }, |
450 | { .rfmax = 152000, .val = 0xb7 }, | 449 | { .rfmax = 152000, .val = 0xb7 }, |
451 | { .rfmax = 153000, .val = 0xbd }, | 450 | { .rfmax = 152600, .val = 0xbd }, |
452 | { .rfmax = 154000, .val = 0x20 }, | 451 | { .rfmax = 154000, .val = 0x20 }, |
453 | { .rfmax = 155000, .val = 0x22 }, | 452 | { .rfmax = 155000, .val = 0x22 }, |
454 | { .rfmax = 156000, .val = 0x24 }, | 453 | { .rfmax = 156000, .val = 0x24 }, |
@@ -459,7 +458,7 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
459 | { .rfmax = 161000, .val = 0x2d }, | 458 | { .rfmax = 161000, .val = 0x2d }, |
460 | { .rfmax = 163000, .val = 0x2e }, | 459 | { .rfmax = 163000, .val = 0x2e }, |
461 | { .rfmax = 164000, .val = 0x2f }, | 460 | { .rfmax = 164000, .val = 0x2f }, |
462 | { .rfmax = 165000, .val = 0x30 }, | 461 | { .rfmax = 164700, .val = 0x30 }, |
463 | { .rfmax = 166000, .val = 0x11 }, | 462 | { .rfmax = 166000, .val = 0x11 }, |
464 | { .rfmax = 167000, .val = 0x12 }, | 463 | { .rfmax = 167000, .val = 0x12 }, |
465 | { .rfmax = 168000, .val = 0x13 }, | 464 | { .rfmax = 168000, .val = 0x13 }, |
@@ -510,7 +509,8 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
510 | { .rfmax = 236000, .val = 0x1b }, | 509 | { .rfmax = 236000, .val = 0x1b }, |
511 | { .rfmax = 237000, .val = 0x1c }, | 510 | { .rfmax = 237000, .val = 0x1c }, |
512 | { .rfmax = 240000, .val = 0x1d }, | 511 | { .rfmax = 240000, .val = 0x1d }, |
513 | { .rfmax = 242000, .val = 0x1f }, | 512 | { .rfmax = 242000, .val = 0x1e }, |
513 | { .rfmax = 244000, .val = 0x1f }, | ||
514 | { .rfmax = 247000, .val = 0x20 }, | 514 | { .rfmax = 247000, .val = 0x20 }, |
515 | { .rfmax = 249000, .val = 0x21 }, | 515 | { .rfmax = 249000, .val = 0x21 }, |
516 | { .rfmax = 252000, .val = 0x22 }, | 516 | { .rfmax = 252000, .val = 0x22 }, |
@@ -624,7 +624,7 @@ static struct tda18271_map tda18271c2_rf_cal[] = { | |||
624 | { .rfmax = 453000, .val = 0x93 }, | 624 | { .rfmax = 453000, .val = 0x93 }, |
625 | { .rfmax = 454000, .val = 0x94 }, | 625 | { .rfmax = 454000, .val = 0x94 }, |
626 | { .rfmax = 456000, .val = 0x96 }, | 626 | { .rfmax = 456000, .val = 0x96 }, |
627 | { .rfmax = 457000, .val = 0x98 }, | 627 | { .rfmax = 457800, .val = 0x98 }, |
628 | { .rfmax = 461000, .val = 0x11 }, | 628 | { .rfmax = 461000, .val = 0x11 }, |
629 | { .rfmax = 468000, .val = 0x12 }, | 629 | { .rfmax = 468000, .val = 0x12 }, |
630 | { .rfmax = 472000, .val = 0x13 }, | 630 | { .rfmax = 472000, .val = 0x13 }, |
diff --git a/drivers/media/dvb/b2c2/flexcop-pci.c b/drivers/media/dvb/b2c2/flexcop-pci.c index 955254090a0e..03f96d6ca894 100644 --- a/drivers/media/dvb/b2c2/flexcop-pci.c +++ b/drivers/media/dvb/b2c2/flexcop-pci.c | |||
@@ -38,7 +38,7 @@ MODULE_PARM_DESC(debug, | |||
38 | DEBSTATUS); | 38 | DEBSTATUS); |
39 | 39 | ||
40 | #define DRIVER_VERSION "0.1" | 40 | #define DRIVER_VERSION "0.1" |
41 | #define DRIVER_NAME "Technisat/B2C2 FlexCop II/IIb/III Digital TV PCI Driver" | 41 | #define DRIVER_NAME "flexcop-pci" |
42 | #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de>" | 42 | #define DRIVER_AUTHOR "Patrick Boettcher <patrick.boettcher@desy.de>" |
43 | 43 | ||
44 | struct flexcop_pci { | 44 | struct flexcop_pci { |
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig index fe4f894183ff..c545039287ad 100644 --- a/drivers/media/dvb/dvb-usb/Kconfig +++ b/drivers/media/dvb/dvb-usb/Kconfig | |||
@@ -356,13 +356,15 @@ config DVB_USB_LME2510 | |||
356 | select DVB_TDA826X if !DVB_FE_CUSTOMISE | 356 | select DVB_TDA826X if !DVB_FE_CUSTOMISE |
357 | select DVB_STV0288 if !DVB_FE_CUSTOMISE | 357 | select DVB_STV0288 if !DVB_FE_CUSTOMISE |
358 | select DVB_IX2505V if !DVB_FE_CUSTOMISE | 358 | select DVB_IX2505V if !DVB_FE_CUSTOMISE |
359 | select DVB_STV0299 if !DVB_FE_CUSTOMISE | ||
360 | select DVB_PLL if !DVB_FE_CUSTOMISE | ||
359 | help | 361 | help |
360 | Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 . | 362 | Say Y here to support the LME DM04/QQBOX DVB-S USB2.0 . |
361 | 363 | ||
362 | config DVB_USB_TECHNISAT_USB2 | 364 | config DVB_USB_TECHNISAT_USB2 |
363 | tristate "Technisat DVB-S/S2 USB2.0 support" | 365 | tristate "Technisat DVB-S/S2 USB2.0 support" |
364 | depends on DVB_USB | 366 | depends on DVB_USB |
365 | select DVB_STB0899 if !DVB_FE_CUSTOMISE | 367 | select DVB_STV090x if !DVB_FE_CUSTOMISE |
366 | select DVB_STB6100 if !DVB_FE_CUSTOMISE | 368 | select DVB_STV6110x if !DVB_FE_CUSTOMISE |
367 | help | 369 | help |
368 | Say Y here to support the Technisat USB2 DVB-S/S2 device | 370 | Say Y here to support the Technisat USB2 DVB-S/S2 device |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 97af266d7f1d..65214af5cd74 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
@@ -2162,7 +2162,7 @@ struct dibx000_agc_config dib7090_agc_config[2] = { | |||
2162 | .agc1_pt3 = 98, | 2162 | .agc1_pt3 = 98, |
2163 | .agc1_slope1 = 0, | 2163 | .agc1_slope1 = 0, |
2164 | .agc1_slope2 = 167, | 2164 | .agc1_slope2 = 167, |
2165 | .agc1_pt1 = 98, | 2165 | .agc2_pt1 = 98, |
2166 | .agc2_pt2 = 255, | 2166 | .agc2_pt2 = 255, |
2167 | .agc2_slope1 = 104, | 2167 | .agc2_slope1 = 104, |
2168 | .agc2_slope2 = 0, | 2168 | .agc2_slope2 = 0, |
@@ -2440,11 +2440,11 @@ static int tfe7090pvr_frontend0_attach(struct dvb_usb_adapter *adap) | |||
2440 | dib0700_set_i2c_speed(adap->dev, 340); | 2440 | dib0700_set_i2c_speed(adap->dev, 340); |
2441 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); | 2441 | adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x90, &tfe7090pvr_dib7000p_config[0]); |
2442 | 2442 | ||
2443 | dib7090_slave_reset(adap->fe); | ||
2444 | |||
2445 | if (adap->fe == NULL) | 2443 | if (adap->fe == NULL) |
2446 | return -ENODEV; | 2444 | return -ENODEV; |
2447 | 2445 | ||
2446 | dib7090_slave_reset(adap->fe); | ||
2447 | |||
2448 | return 0; | 2448 | return 0; |
2449 | } | 2449 | } |
2450 | 2450 | ||
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index ccc2d1af49d4..6927c726ce35 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c | |||
@@ -1520,6 +1520,7 @@ static int init_channel(struct ngene_channel *chan) | |||
1520 | if (dev->ci.en && (io & NGENE_IO_TSOUT)) { | 1520 | if (dev->ci.en && (io & NGENE_IO_TSOUT)) { |
1521 | dvb_ca_en50221_init(adapter, dev->ci.en, 0, 1); | 1521 | dvb_ca_en50221_init(adapter, dev->ci.en, 0, 1); |
1522 | set_transfer(chan, 1); | 1522 | set_transfer(chan, 1); |
1523 | chan->dev->channel[2].DataFormatFlags = DF_SWAP32; | ||
1523 | set_transfer(&chan->dev->channel[2], 1); | 1524 | set_transfer(&chan->dev->channel[2], 1); |
1524 | dvb_register_device(adapter, &chan->ci_dev, | 1525 | dvb_register_device(adapter, &chan->ci_dev, |
1525 | &ngene_dvbdev_ci, (void *) chan, | 1526 | &ngene_dvbdev_ci, (void *) chan, |
diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c index 23640ed44d85..056138f63c7d 100644 --- a/drivers/media/media-entity.c +++ b/drivers/media/media-entity.c | |||
@@ -378,7 +378,6 @@ EXPORT_SYMBOL_GPL(media_entity_create_link); | |||
378 | 378 | ||
379 | static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | 379 | static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) |
380 | { | 380 | { |
381 | const u32 mask = MEDIA_LNK_FL_ENABLED; | ||
382 | int ret; | 381 | int ret; |
383 | 382 | ||
384 | /* Notify both entities. */ | 383 | /* Notify both entities. */ |
@@ -395,7 +394,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | |||
395 | return ret; | 394 | return ret; |
396 | } | 395 | } |
397 | 396 | ||
398 | link->flags = (link->flags & ~mask) | (flags & mask); | 397 | link->flags = flags; |
399 | link->reverse->flags = link->flags; | 398 | link->reverse->flags = link->flags; |
400 | 399 | ||
401 | return 0; | 400 | return 0; |
@@ -417,6 +416,7 @@ static int __media_entity_setup_link_notify(struct media_link *link, u32 flags) | |||
417 | */ | 416 | */ |
418 | int __media_entity_setup_link(struct media_link *link, u32 flags) | 417 | int __media_entity_setup_link(struct media_link *link, u32 flags) |
419 | { | 418 | { |
419 | const u32 mask = MEDIA_LNK_FL_ENABLED; | ||
420 | struct media_device *mdev; | 420 | struct media_device *mdev; |
421 | struct media_entity *source, *sink; | 421 | struct media_entity *source, *sink; |
422 | int ret = -EBUSY; | 422 | int ret = -EBUSY; |
@@ -424,6 +424,10 @@ int __media_entity_setup_link(struct media_link *link, u32 flags) | |||
424 | if (link == NULL) | 424 | if (link == NULL) |
425 | return -EINVAL; | 425 | return -EINVAL; |
426 | 426 | ||
427 | /* The non-modifiable link flags must not be modified. */ | ||
428 | if ((link->flags & ~mask) != (flags & ~mask)) | ||
429 | return -EINVAL; | ||
430 | |||
427 | if (link->flags & MEDIA_LNK_FL_IMMUTABLE) | 431 | if (link->flags & MEDIA_LNK_FL_IMMUTABLE) |
428 | return link->flags == flags ? 0 : -EINVAL; | 432 | return link->flags == flags ? 0 : -EINVAL; |
429 | 433 | ||
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index dc3f04c52d5e..87bad7678d92 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -170,7 +170,7 @@ static int fmr2_setfreq(struct fmr2 *dev) | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* !!! not tested, in my card this does't work !!! */ | 173 | /* !!! not tested, in my card this doesn't work !!! */ |
174 | static int fmr2_setvolume(struct fmr2 *dev) | 174 | static int fmr2_setvolume(struct fmr2 *dev) |
175 | { | 175 | { |
176 | int vol[16] = { 0x021, 0x084, 0x090, 0x104, | 176 | int vol[16] = { 0x021, 0x084, 0x090, 0x104, |
diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c index 585680ffbfb6..b1193dfc5087 100644 --- a/drivers/media/radio/saa7706h.c +++ b/drivers/media/radio/saa7706h.c | |||
@@ -376,7 +376,7 @@ static int __devinit saa7706h_probe(struct i2c_client *client, | |||
376 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | 376 | v4l_info(client, "chip found @ 0x%02x (%s)\n", |
377 | client->addr << 1, client->adapter->name); | 377 | client->addr << 1, client->adapter->name); |
378 | 378 | ||
379 | state = kmalloc(sizeof(struct saa7706h_state), GFP_KERNEL); | 379 | state = kzalloc(sizeof(struct saa7706h_state), GFP_KERNEL); |
380 | if (state == NULL) | 380 | if (state == NULL) |
381 | return -ENOMEM; | 381 | return -ENOMEM; |
382 | sd = &state->sd; | 382 | sd = &state->sd; |
diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c index 7c0d77751f6e..0991e1973678 100644 --- a/drivers/media/radio/tef6862.c +++ b/drivers/media/radio/tef6862.c | |||
@@ -176,7 +176,7 @@ static int __devinit tef6862_probe(struct i2c_client *client, | |||
176 | v4l_info(client, "chip found @ 0x%02x (%s)\n", | 176 | v4l_info(client, "chip found @ 0x%02x (%s)\n", |
177 | client->addr << 1, client->adapter->name); | 177 | client->addr << 1, client->adapter->name); |
178 | 178 | ||
179 | state = kmalloc(sizeof(struct tef6862_state), GFP_KERNEL); | 179 | state = kzalloc(sizeof(struct tef6862_state), GFP_KERNEL); |
180 | if (state == NULL) | 180 | if (state == NULL) |
181 | return -ENOMEM; | 181 | return -ENOMEM; |
182 | state->freq = TEF6862_LO_FREQ; | 182 | state->freq = TEF6862_LO_FREQ; |
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index ebd68edf5b24..8fc0f081b470 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c | |||
@@ -46,7 +46,7 @@ | |||
46 | #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" | 46 | #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" |
47 | #define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" | 47 | #define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" |
48 | #define MOD_NAME "imon" | 48 | #define MOD_NAME "imon" |
49 | #define MOD_VERSION "0.9.2" | 49 | #define MOD_VERSION "0.9.3" |
50 | 50 | ||
51 | #define DISPLAY_MINOR_BASE 144 | 51 | #define DISPLAY_MINOR_BASE 144 |
52 | #define DEVICE_NAME "lcd%d" | 52 | #define DEVICE_NAME "lcd%d" |
@@ -460,8 +460,9 @@ static int display_close(struct inode *inode, struct file *file) | |||
460 | } | 460 | } |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * Sends a packet to the device -- this function must be called | 463 | * Sends a packet to the device -- this function must be called with |
464 | * with ictx->lock held. | 464 | * ictx->lock held, or its unlock/lock sequence while waiting for tx |
465 | * to complete can/will lead to a deadlock. | ||
465 | */ | 466 | */ |
466 | static int send_packet(struct imon_context *ictx) | 467 | static int send_packet(struct imon_context *ictx) |
467 | { | 468 | { |
@@ -991,12 +992,21 @@ static void imon_touch_display_timeout(unsigned long data) | |||
991 | * the iMON remotes, and those used by the Windows MCE remotes (which is | 992 | * the iMON remotes, and those used by the Windows MCE remotes (which is |
992 | * really just RC-6), but only one or the other at a time, as the signals | 993 | * really just RC-6), but only one or the other at a time, as the signals |
993 | * are decoded onboard the receiver. | 994 | * are decoded onboard the receiver. |
995 | * | ||
996 | * This function gets called two different ways, one way is from | ||
997 | * rc_register_device, for initial protocol selection/setup, and the other is | ||
998 | * via a userspace-initiated protocol change request, either by direct sysfs | ||
999 | * prodding or by something like ir-keytable. In the rc_register_device case, | ||
1000 | * the imon context lock is already held, but when initiated from userspace, | ||
1001 | * it is not, so we must acquire it prior to calling send_packet, which | ||
1002 | * requires that the lock is held. | ||
994 | */ | 1003 | */ |
995 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | 1004 | static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) |
996 | { | 1005 | { |
997 | int retval; | 1006 | int retval; |
998 | struct imon_context *ictx = rc->priv; | 1007 | struct imon_context *ictx = rc->priv; |
999 | struct device *dev = ictx->dev; | 1008 | struct device *dev = ictx->dev; |
1009 | bool unlock = false; | ||
1000 | unsigned char ir_proto_packet[] = { | 1010 | unsigned char ir_proto_packet[] = { |
1001 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; | 1011 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; |
1002 | 1012 | ||
@@ -1029,6 +1039,11 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1029 | 1039 | ||
1030 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); | 1040 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); |
1031 | 1041 | ||
1042 | if (!mutex_is_locked(&ictx->lock)) { | ||
1043 | unlock = true; | ||
1044 | mutex_lock(&ictx->lock); | ||
1045 | } | ||
1046 | |||
1032 | retval = send_packet(ictx); | 1047 | retval = send_packet(ictx); |
1033 | if (retval) | 1048 | if (retval) |
1034 | goto out; | 1049 | goto out; |
@@ -1037,6 +1052,9 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) | |||
1037 | ictx->pad_mouse = false; | 1052 | ictx->pad_mouse = false; |
1038 | 1053 | ||
1039 | out: | 1054 | out: |
1055 | if (unlock) | ||
1056 | mutex_unlock(&ictx->lock); | ||
1057 | |||
1040 | return retval; | 1058 | return retval; |
1041 | } | 1059 | } |
1042 | 1060 | ||
@@ -2134,6 +2152,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf) | |||
2134 | goto rdev_setup_failed; | 2152 | goto rdev_setup_failed; |
2135 | } | 2153 | } |
2136 | 2154 | ||
2155 | mutex_unlock(&ictx->lock); | ||
2137 | return ictx; | 2156 | return ictx; |
2138 | 2157 | ||
2139 | rdev_setup_failed: | 2158 | rdev_setup_failed: |
@@ -2205,6 +2224,7 @@ static struct imon_context *imon_init_intf1(struct usb_interface *intf, | |||
2205 | goto urb_submit_failed; | 2224 | goto urb_submit_failed; |
2206 | } | 2225 | } |
2207 | 2226 | ||
2227 | mutex_unlock(&ictx->lock); | ||
2208 | return ictx; | 2228 | return ictx; |
2209 | 2229 | ||
2210 | urb_submit_failed: | 2230 | urb_submit_failed: |
@@ -2299,6 +2319,8 @@ static int __devinit imon_probe(struct usb_interface *interface, | |||
2299 | usb_set_intfdata(interface, ictx); | 2319 | usb_set_intfdata(interface, ictx); |
2300 | 2320 | ||
2301 | if (ifnum == 0) { | 2321 | if (ifnum == 0) { |
2322 | mutex_lock(&ictx->lock); | ||
2323 | |||
2302 | if (product == 0xffdc && ictx->rf_device) { | 2324 | if (product == 0xffdc && ictx->rf_device) { |
2303 | sysfs_err = sysfs_create_group(&interface->dev.kobj, | 2325 | sysfs_err = sysfs_create_group(&interface->dev.kobj, |
2304 | &imon_rf_attr_group); | 2326 | &imon_rf_attr_group); |
@@ -2309,13 +2331,14 @@ static int __devinit imon_probe(struct usb_interface *interface, | |||
2309 | 2331 | ||
2310 | if (ictx->display_supported) | 2332 | if (ictx->display_supported) |
2311 | imon_init_display(ictx, interface); | 2333 | imon_init_display(ictx, interface); |
2334 | |||
2335 | mutex_unlock(&ictx->lock); | ||
2312 | } | 2336 | } |
2313 | 2337 | ||
2314 | dev_info(dev, "iMON device (%04x:%04x, intf%d) on " | 2338 | dev_info(dev, "iMON device (%04x:%04x, intf%d) on " |
2315 | "usb<%d:%d> initialized\n", vendor, product, ifnum, | 2339 | "usb<%d:%d> initialized\n", vendor, product, ifnum, |
2316 | usbdev->bus->busnum, usbdev->devnum); | 2340 | usbdev->bus->busnum, usbdev->devnum); |
2317 | 2341 | ||
2318 | mutex_unlock(&ictx->lock); | ||
2319 | mutex_unlock(&driver_lock); | 2342 | mutex_unlock(&driver_lock); |
2320 | 2343 | ||
2321 | return 0; | 2344 | return 0; |
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index accaf6c9789a..43908a70bd8b 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/io.h> | 36 | #include <linux/io.h> |
37 | #include <linux/interrupt.h> | 37 | #include <linux/interrupt.h> |
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/delay.h> | ||
39 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
40 | #include <linux/input.h> | 41 | #include <linux/input.h> |
41 | #include <linux/bitops.h> | 42 | #include <linux/bitops.h> |
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 044fb7a382d6..0c273ec465c9 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c | |||
@@ -220,6 +220,8 @@ static struct usb_device_id mceusb_dev_table[] = { | |||
220 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, | 220 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, |
221 | /* Philips/Spinel plus IR transceiver for ASUS */ | 221 | /* Philips/Spinel plus IR transceiver for ASUS */ |
222 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, | 222 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, |
223 | /* Philips IR transceiver (Dell branded) */ | ||
224 | { USB_DEVICE(VENDOR_PHILIPS, 0x2093) }, | ||
223 | /* Realtek MCE IR Receiver and card reader */ | 225 | /* Realtek MCE IR Receiver and card reader */ |
224 | { USB_DEVICE(VENDOR_REALTEK, 0x0161), | 226 | { USB_DEVICE(VENDOR_REALTEK, 0x0161), |
225 | .driver_info = MULTIFUNCTION }, | 227 | .driver_info = MULTIFUNCTION }, |
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index f53f9c68d38d..a2706648e365 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c | |||
@@ -707,7 +707,8 @@ static void ir_close(struct input_dev *idev) | |||
707 | { | 707 | { |
708 | struct rc_dev *rdev = input_get_drvdata(idev); | 708 | struct rc_dev *rdev = input_get_drvdata(idev); |
709 | 709 | ||
710 | rdev->close(rdev); | 710 | if (rdev) |
711 | rdev->close(rdev); | ||
711 | } | 712 | } |
712 | 713 | ||
713 | /* class for /sys/class/rc */ | 714 | /* class for /sys/class/rc */ |
@@ -733,6 +734,7 @@ static struct { | |||
733 | { RC_TYPE_SONY, "sony" }, | 734 | { RC_TYPE_SONY, "sony" }, |
734 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, | 735 | { RC_TYPE_RC5_SZ, "rc-5-sz" }, |
735 | { RC_TYPE_LIRC, "lirc" }, | 736 | { RC_TYPE_LIRC, "lirc" }, |
737 | { RC_TYPE_OTHER, "other" }, | ||
736 | }; | 738 | }; |
737 | 739 | ||
738 | #define PROTO_NONE "none" | 740 | #define PROTO_NONE "none" |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 4498b944dec8..00f51dd121f3 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -875,7 +875,7 @@ config MX3_VIDEO | |||
875 | config VIDEO_MX3 | 875 | config VIDEO_MX3 |
876 | tristate "i.MX3x Camera Sensor Interface driver" | 876 | tristate "i.MX3x Camera Sensor Interface driver" |
877 | depends on VIDEO_DEV && MX3_IPU && SOC_CAMERA | 877 | depends on VIDEO_DEV && MX3_IPU && SOC_CAMERA |
878 | select VIDEOBUF_DMA_CONTIG | 878 | select VIDEOBUF2_DMA_CONTIG |
879 | select MX3_VIDEO | 879 | select MX3_VIDEO |
880 | ---help--- | 880 | ---help--- |
881 | This is a v4l2 driver for the i.MX3x Camera Sensor Interface | 881 | This is a v4l2 driver for the i.MX3x Camera Sensor Interface |
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index c6e2ca3b1149..6fbc356113c1 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -350,9 +350,17 @@ void cx18_streams_cleanup(struct cx18 *cx, int unregister) | |||
350 | 350 | ||
351 | /* No struct video_device, but can have buffers allocated */ | 351 | /* No struct video_device, but can have buffers allocated */ |
352 | if (type == CX18_ENC_STREAM_TYPE_IDX) { | 352 | if (type == CX18_ENC_STREAM_TYPE_IDX) { |
353 | /* If the module params didn't inhibit IDX ... */ | ||
353 | if (cx->stream_buffers[type] != 0) { | 354 | if (cx->stream_buffers[type] != 0) { |
354 | cx->stream_buffers[type] = 0; | 355 | cx->stream_buffers[type] = 0; |
355 | cx18_stream_free(&cx->streams[type]); | 356 | /* |
357 | * Before calling cx18_stream_free(), | ||
358 | * check if the IDX stream was actually set up. | ||
359 | * Needed, since the cx18_probe() error path | ||
360 | * exits through here as well as normal clean up | ||
361 | */ | ||
362 | if (cx->streams[type].buffers != 0) | ||
363 | cx18_stream_free(&cx->streams[type]); | ||
356 | } | 364 | } |
357 | continue; | 365 | continue; |
358 | } | 366 | } |
diff --git a/drivers/media/video/cx23885/Kconfig b/drivers/media/video/cx23885/Kconfig index 3b6e7f28568e..caab1bfb79e2 100644 --- a/drivers/media/video/cx23885/Kconfig +++ b/drivers/media/video/cx23885/Kconfig | |||
@@ -22,6 +22,7 @@ config VIDEO_CX23885 | |||
22 | select DVB_CX24116 if !DVB_FE_CUSTOMISE | 22 | select DVB_CX24116 if !DVB_FE_CUSTOMISE |
23 | select DVB_STV0900 if !DVB_FE_CUSTOMISE | 23 | select DVB_STV0900 if !DVB_FE_CUSTOMISE |
24 | select DVB_DS3000 if !DVB_FE_CUSTOMISE | 24 | select DVB_DS3000 if !DVB_FE_CUSTOMISE |
25 | select DVB_STV0367 if !DVB_FE_CUSTOMISE | ||
25 | select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMISE | 26 | select MEDIA_TUNER_MT2131 if !MEDIA_TUNER_CUSTOMISE |
26 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE | 27 | select MEDIA_TUNER_XC2028 if !MEDIA_TUNER_CUSTOMISE |
27 | select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMISE | 28 | select MEDIA_TUNER_TDA8290 if !MEDIA_TUNER_CUSTOMISE |
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index c820e2f53527..3f442003623d 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c | |||
@@ -524,7 +524,7 @@ void cx88_ir_irq(struct cx88_core *core) | |||
524 | for (todo = 32; todo > 0; todo -= bits) { | 524 | for (todo = 32; todo > 0; todo -= bits) { |
525 | ev.pulse = samples & 0x80000000 ? false : true; | 525 | ev.pulse = samples & 0x80000000 ? false : true; |
526 | bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); | 526 | bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples)); |
527 | ev.duration = (bits * NSEC_PER_SEC) / (1000 * ir_samplerate); | 527 | ev.duration = (bits * (NSEC_PER_SEC / 1000)) / ir_samplerate; |
528 | ir_raw_event_store_with_filter(ir->dev, &ev); | 528 | ir_raw_event_store_with_filter(ir->dev, &ev); |
529 | samples <<= bits; | 529 | samples <<= bits; |
530 | } | 530 | } |
diff --git a/drivers/media/video/imx074.c b/drivers/media/video/imx074.c index 1a1169115716..0382ea752e6f 100644 --- a/drivers/media/video/imx074.c +++ b/drivers/media/video/imx074.c | |||
@@ -298,7 +298,7 @@ static unsigned long imx074_query_bus_param(struct soc_camera_device *icd) | |||
298 | static int imx074_set_bus_param(struct soc_camera_device *icd, | 298 | static int imx074_set_bus_param(struct soc_camera_device *icd, |
299 | unsigned long flags) | 299 | unsigned long flags) |
300 | { | 300 | { |
301 | return -1; | 301 | return -EINVAL; |
302 | } | 302 | } |
303 | 303 | ||
304 | static struct soc_camera_ops imx074_ops = { | 304 | static struct soc_camera_ops imx074_ops = { |
diff --git a/drivers/media/video/m52790.c b/drivers/media/video/m52790.c index 5e1c9a81984c..303ffa7df4ac 100644 --- a/drivers/media/video/m52790.c +++ b/drivers/media/video/m52790.c | |||
@@ -174,7 +174,7 @@ static int m52790_probe(struct i2c_client *client, | |||
174 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 174 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
175 | client->addr << 1, client->adapter->name); | 175 | client->addr << 1, client->adapter->name); |
176 | 176 | ||
177 | state = kmalloc(sizeof(struct m52790_state), GFP_KERNEL); | 177 | state = kzalloc(sizeof(struct m52790_state), GFP_KERNEL); |
178 | if (state == NULL) | 178 | if (state == NULL) |
179 | return -ENOMEM; | 179 | return -ENOMEM; |
180 | 180 | ||
diff --git a/drivers/media/video/omap3isp/isp.c b/drivers/media/video/omap3isp/isp.c index 503bd7922bd6..472a69359e60 100644 --- a/drivers/media/video/omap3isp/isp.c +++ b/drivers/media/video/omap3isp/isp.c | |||
@@ -215,20 +215,21 @@ static u32 isp_set_xclk(struct isp_device *isp, u32 xclk, u8 xclksel) | |||
215 | } | 215 | } |
216 | 216 | ||
217 | switch (xclksel) { | 217 | switch (xclksel) { |
218 | case 0: | 218 | case ISP_XCLK_A: |
219 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, | 219 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, |
220 | ISPTCTRL_CTRL_DIVA_MASK, | 220 | ISPTCTRL_CTRL_DIVA_MASK, |
221 | divisor << ISPTCTRL_CTRL_DIVA_SHIFT); | 221 | divisor << ISPTCTRL_CTRL_DIVA_SHIFT); |
222 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclka set to %d Hz\n", | 222 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclka set to %d Hz\n", |
223 | currentxclk); | 223 | currentxclk); |
224 | break; | 224 | break; |
225 | case 1: | 225 | case ISP_XCLK_B: |
226 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, | 226 | isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, |
227 | ISPTCTRL_CTRL_DIVB_MASK, | 227 | ISPTCTRL_CTRL_DIVB_MASK, |
228 | divisor << ISPTCTRL_CTRL_DIVB_SHIFT); | 228 | divisor << ISPTCTRL_CTRL_DIVB_SHIFT); |
229 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclkb set to %d Hz\n", | 229 | dev_dbg(isp->dev, "isp_set_xclk(): cam_xclkb set to %d Hz\n", |
230 | currentxclk); | 230 | currentxclk); |
231 | break; | 231 | break; |
232 | case ISP_XCLK_NONE: | ||
232 | default: | 233 | default: |
233 | omap3isp_put(isp); | 234 | omap3isp_put(isp); |
234 | dev_dbg(isp->dev, "ISP_ERR: isp_set_xclk(): Invalid requested " | 235 | dev_dbg(isp->dev, "ISP_ERR: isp_set_xclk(): Invalid requested " |
@@ -237,13 +238,13 @@ static u32 isp_set_xclk(struct isp_device *isp, u32 xclk, u8 xclksel) | |||
237 | } | 238 | } |
238 | 239 | ||
239 | /* Do we go from stable whatever to clock? */ | 240 | /* Do we go from stable whatever to clock? */ |
240 | if (divisor >= 2 && isp->xclk_divisor[xclksel] < 2) | 241 | if (divisor >= 2 && isp->xclk_divisor[xclksel - 1] < 2) |
241 | omap3isp_get(isp); | 242 | omap3isp_get(isp); |
242 | /* Stopping the clock. */ | 243 | /* Stopping the clock. */ |
243 | else if (divisor < 2 && isp->xclk_divisor[xclksel] >= 2) | 244 | else if (divisor < 2 && isp->xclk_divisor[xclksel - 1] >= 2) |
244 | omap3isp_put(isp); | 245 | omap3isp_put(isp); |
245 | 246 | ||
246 | isp->xclk_divisor[xclksel] = divisor; | 247 | isp->xclk_divisor[xclksel - 1] = divisor; |
247 | 248 | ||
248 | omap3isp_put(isp); | 249 | omap3isp_put(isp); |
249 | 250 | ||
@@ -285,7 +286,8 @@ static void isp_power_settings(struct isp_device *isp, int idle) | |||
285 | */ | 286 | */ |
286 | void omap3isp_configure_bridge(struct isp_device *isp, | 287 | void omap3isp_configure_bridge(struct isp_device *isp, |
287 | enum ccdc_input_entity input, | 288 | enum ccdc_input_entity input, |
288 | const struct isp_parallel_platform_data *pdata) | 289 | const struct isp_parallel_platform_data *pdata, |
290 | unsigned int shift) | ||
289 | { | 291 | { |
290 | u32 ispctrl_val; | 292 | u32 ispctrl_val; |
291 | 293 | ||
@@ -298,9 +300,9 @@ void omap3isp_configure_bridge(struct isp_device *isp, | |||
298 | switch (input) { | 300 | switch (input) { |
299 | case CCDC_INPUT_PARALLEL: | 301 | case CCDC_INPUT_PARALLEL: |
300 | ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL; | 302 | ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL; |
301 | ispctrl_val |= pdata->data_lane_shift << ISPCTRL_SHIFT_SHIFT; | ||
302 | ispctrl_val |= pdata->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT; | 303 | ispctrl_val |= pdata->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT; |
303 | ispctrl_val |= pdata->bridge << ISPCTRL_PAR_BRIDGE_SHIFT; | 304 | ispctrl_val |= pdata->bridge << ISPCTRL_PAR_BRIDGE_SHIFT; |
305 | shift += pdata->data_lane_shift * 2; | ||
304 | break; | 306 | break; |
305 | 307 | ||
306 | case CCDC_INPUT_CSI2A: | 308 | case CCDC_INPUT_CSI2A: |
@@ -319,6 +321,8 @@ void omap3isp_configure_bridge(struct isp_device *isp, | |||
319 | return; | 321 | return; |
320 | } | 322 | } |
321 | 323 | ||
324 | ispctrl_val |= ((shift/2) << ISPCTRL_SHIFT_SHIFT) & ISPCTRL_SHIFT_MASK; | ||
325 | |||
322 | ispctrl_val &= ~ISPCTRL_SYNC_DETECT_MASK; | 326 | ispctrl_val &= ~ISPCTRL_SYNC_DETECT_MASK; |
323 | ispctrl_val |= ISPCTRL_SYNC_DETECT_VSRISE; | 327 | ispctrl_val |= ISPCTRL_SYNC_DETECT_VSRISE; |
324 | 328 | ||
@@ -658,6 +662,8 @@ int omap3isp_pipeline_pm_use(struct media_entity *entity, int use) | |||
658 | 662 | ||
659 | /* Apply power change to connected non-nodes. */ | 663 | /* Apply power change to connected non-nodes. */ |
660 | ret = isp_pipeline_pm_power(entity, change); | 664 | ret = isp_pipeline_pm_power(entity, change); |
665 | if (ret < 0) | ||
666 | entity->use_count -= change; | ||
661 | 667 | ||
662 | mutex_unlock(&entity->parent->graph_mutex); | 668 | mutex_unlock(&entity->parent->graph_mutex); |
663 | 669 | ||
@@ -872,6 +878,9 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe) | |||
872 | } | 878 | } |
873 | } | 879 | } |
874 | 880 | ||
881 | if (failure < 0) | ||
882 | isp->needs_reset = true; | ||
883 | |||
875 | return failure; | 884 | return failure; |
876 | } | 885 | } |
877 | 886 | ||
@@ -884,7 +893,8 @@ static int isp_pipeline_disable(struct isp_pipeline *pipe) | |||
884 | * single-shot or continuous mode. | 893 | * single-shot or continuous mode. |
885 | * | 894 | * |
886 | * Return 0 if successful, or the return value of the failed video::s_stream | 895 | * Return 0 if successful, or the return value of the failed video::s_stream |
887 | * operation otherwise. | 896 | * operation otherwise. The pipeline state is not updated when the operation |
897 | * fails, except when stopping the pipeline. | ||
888 | */ | 898 | */ |
889 | int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, | 899 | int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, |
890 | enum isp_pipeline_stream_state state) | 900 | enum isp_pipeline_stream_state state) |
@@ -895,7 +905,9 @@ int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, | |||
895 | ret = isp_pipeline_disable(pipe); | 905 | ret = isp_pipeline_disable(pipe); |
896 | else | 906 | else |
897 | ret = isp_pipeline_enable(pipe, state); | 907 | ret = isp_pipeline_enable(pipe, state); |
898 | pipe->stream_state = state; | 908 | |
909 | if (ret == 0 || state == ISP_PIPELINE_STREAM_STOPPED) | ||
910 | pipe->stream_state = state; | ||
899 | 911 | ||
900 | return ret; | 912 | return ret; |
901 | } | 913 | } |
@@ -1481,6 +1493,10 @@ void omap3isp_put(struct isp_device *isp) | |||
1481 | if (--isp->ref_count == 0) { | 1493 | if (--isp->ref_count == 0) { |
1482 | isp_disable_interrupts(isp); | 1494 | isp_disable_interrupts(isp); |
1483 | isp_save_ctx(isp); | 1495 | isp_save_ctx(isp); |
1496 | if (isp->needs_reset) { | ||
1497 | isp_reset(isp); | ||
1498 | isp->needs_reset = false; | ||
1499 | } | ||
1484 | isp_disable_clocks(isp); | 1500 | isp_disable_clocks(isp); |
1485 | } | 1501 | } |
1486 | mutex_unlock(&isp->isp_mutex); | 1502 | mutex_unlock(&isp->isp_mutex); |
diff --git a/drivers/media/video/omap3isp/isp.h b/drivers/media/video/omap3isp/isp.h index cf5214e95a92..2620c405f5e4 100644 --- a/drivers/media/video/omap3isp/isp.h +++ b/drivers/media/video/omap3isp/isp.h | |||
@@ -132,7 +132,6 @@ struct isp_reg { | |||
132 | 132 | ||
133 | /** | 133 | /** |
134 | * struct isp_parallel_platform_data - Parallel interface platform data | 134 | * struct isp_parallel_platform_data - Parallel interface platform data |
135 | * @width: Parallel bus width in bits (8, 10, 11 or 12) | ||
136 | * @data_lane_shift: Data lane shifter | 135 | * @data_lane_shift: Data lane shifter |
137 | * 0 - CAMEXT[13:0] -> CAM[13:0] | 136 | * 0 - CAMEXT[13:0] -> CAM[13:0] |
138 | * 1 - CAMEXT[13:2] -> CAM[11:0] | 137 | * 1 - CAMEXT[13:2] -> CAM[11:0] |
@@ -146,7 +145,6 @@ struct isp_reg { | |||
146 | * ISPCTRL_PAR_BRIDGE_BENDIAN - Big endian | 145 | * ISPCTRL_PAR_BRIDGE_BENDIAN - Big endian |
147 | */ | 146 | */ |
148 | struct isp_parallel_platform_data { | 147 | struct isp_parallel_platform_data { |
149 | unsigned int width; | ||
150 | unsigned int data_lane_shift:2; | 148 | unsigned int data_lane_shift:2; |
151 | unsigned int clk_pol:1; | 149 | unsigned int clk_pol:1; |
152 | unsigned int bridge:4; | 150 | unsigned int bridge:4; |
@@ -262,6 +260,7 @@ struct isp_device { | |||
262 | /* ISP Obj */ | 260 | /* ISP Obj */ |
263 | spinlock_t stat_lock; /* common lock for statistic drivers */ | 261 | spinlock_t stat_lock; /* common lock for statistic drivers */ |
264 | struct mutex isp_mutex; /* For handling ref_count field */ | 262 | struct mutex isp_mutex; /* For handling ref_count field */ |
263 | bool needs_reset; | ||
265 | int has_context; | 264 | int has_context; |
266 | int ref_count; | 265 | int ref_count; |
267 | unsigned int autoidle; | 266 | unsigned int autoidle; |
@@ -311,11 +310,12 @@ int omap3isp_pipeline_set_stream(struct isp_pipeline *pipe, | |||
311 | enum isp_pipeline_stream_state state); | 310 | enum isp_pipeline_stream_state state); |
312 | void omap3isp_configure_bridge(struct isp_device *isp, | 311 | void omap3isp_configure_bridge(struct isp_device *isp, |
313 | enum ccdc_input_entity input, | 312 | enum ccdc_input_entity input, |
314 | const struct isp_parallel_platform_data *pdata); | 313 | const struct isp_parallel_platform_data *pdata, |
314 | unsigned int shift); | ||
315 | 315 | ||
316 | #define ISP_XCLK_NONE -1 | 316 | #define ISP_XCLK_NONE 0 |
317 | #define ISP_XCLK_A 0 | 317 | #define ISP_XCLK_A 1 |
318 | #define ISP_XCLK_B 1 | 318 | #define ISP_XCLK_B 2 |
319 | 319 | ||
320 | struct isp_device *omap3isp_get(struct isp_device *isp); | 320 | struct isp_device *omap3isp_get(struct isp_device *isp); |
321 | void omap3isp_put(struct isp_device *isp); | 321 | void omap3isp_put(struct isp_device *isp); |
diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c index 5ff9d14ce710..39d501bda636 100644 --- a/drivers/media/video/omap3isp/ispccdc.c +++ b/drivers/media/video/omap3isp/ispccdc.c | |||
@@ -43,6 +43,12 @@ __ccdc_get_format(struct isp_ccdc_device *ccdc, struct v4l2_subdev_fh *fh, | |||
43 | 43 | ||
44 | static const unsigned int ccdc_fmts[] = { | 44 | static const unsigned int ccdc_fmts[] = { |
45 | V4L2_MBUS_FMT_Y8_1X8, | 45 | V4L2_MBUS_FMT_Y8_1X8, |
46 | V4L2_MBUS_FMT_Y10_1X10, | ||
47 | V4L2_MBUS_FMT_Y12_1X12, | ||
48 | V4L2_MBUS_FMT_SGRBG8_1X8, | ||
49 | V4L2_MBUS_FMT_SRGGB8_1X8, | ||
50 | V4L2_MBUS_FMT_SBGGR8_1X8, | ||
51 | V4L2_MBUS_FMT_SGBRG8_1X8, | ||
46 | V4L2_MBUS_FMT_SGRBG10_1X10, | 52 | V4L2_MBUS_FMT_SGRBG10_1X10, |
47 | V4L2_MBUS_FMT_SRGGB10_1X10, | 53 | V4L2_MBUS_FMT_SRGGB10_1X10, |
48 | V4L2_MBUS_FMT_SBGGR10_1X10, | 54 | V4L2_MBUS_FMT_SBGGR10_1X10, |
@@ -1110,21 +1116,38 @@ static void ccdc_configure(struct isp_ccdc_device *ccdc) | |||
1110 | struct isp_parallel_platform_data *pdata = NULL; | 1116 | struct isp_parallel_platform_data *pdata = NULL; |
1111 | struct v4l2_subdev *sensor; | 1117 | struct v4l2_subdev *sensor; |
1112 | struct v4l2_mbus_framefmt *format; | 1118 | struct v4l2_mbus_framefmt *format; |
1119 | const struct isp_format_info *fmt_info; | ||
1120 | struct v4l2_subdev_format fmt_src; | ||
1121 | unsigned int depth_out; | ||
1122 | unsigned int depth_in = 0; | ||
1113 | struct media_pad *pad; | 1123 | struct media_pad *pad; |
1114 | unsigned long flags; | 1124 | unsigned long flags; |
1125 | unsigned int shift; | ||
1115 | u32 syn_mode; | 1126 | u32 syn_mode; |
1116 | u32 ccdc_pattern; | 1127 | u32 ccdc_pattern; |
1117 | 1128 | ||
1118 | if (ccdc->input == CCDC_INPUT_PARALLEL) { | 1129 | pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]); |
1119 | pad = media_entity_remote_source(&ccdc->pads[CCDC_PAD_SINK]); | 1130 | sensor = media_entity_to_v4l2_subdev(pad->entity); |
1120 | sensor = media_entity_to_v4l2_subdev(pad->entity); | 1131 | if (ccdc->input == CCDC_INPUT_PARALLEL) |
1121 | pdata = &((struct isp_v4l2_subdevs_group *)sensor->host_priv) | 1132 | pdata = &((struct isp_v4l2_subdevs_group *)sensor->host_priv) |
1122 | ->bus.parallel; | 1133 | ->bus.parallel; |
1134 | |||
1135 | /* Compute shift value for lane shifter to configure the bridge. */ | ||
1136 | fmt_src.pad = pad->index; | ||
1137 | fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE; | ||
1138 | if (!v4l2_subdev_call(sensor, pad, get_fmt, NULL, &fmt_src)) { | ||
1139 | fmt_info = omap3isp_video_format_info(fmt_src.format.code); | ||
1140 | depth_in = fmt_info->bpp; | ||
1123 | } | 1141 | } |
1124 | 1142 | ||
1125 | omap3isp_configure_bridge(isp, ccdc->input, pdata); | 1143 | fmt_info = omap3isp_video_format_info |
1144 | (isp->isp_ccdc.formats[CCDC_PAD_SINK].code); | ||
1145 | depth_out = fmt_info->bpp; | ||
1146 | |||
1147 | shift = depth_in - depth_out; | ||
1148 | omap3isp_configure_bridge(isp, ccdc->input, pdata, shift); | ||
1126 | 1149 | ||
1127 | ccdc->syncif.datsz = pdata ? pdata->width : 10; | 1150 | ccdc->syncif.datsz = depth_out; |
1128 | ccdc_config_sync_if(ccdc, &ccdc->syncif); | 1151 | ccdc_config_sync_if(ccdc, &ccdc->syncif); |
1129 | 1152 | ||
1130 | /* CCDC_PAD_SINK */ | 1153 | /* CCDC_PAD_SINK */ |
@@ -1338,7 +1361,7 @@ static int ccdc_sbl_wait_idle(struct isp_ccdc_device *ccdc, | |||
1338 | * @ccdc: Pointer to ISP CCDC device. | 1361 | * @ccdc: Pointer to ISP CCDC device. |
1339 | * @event: Pointing which event trigger handler | 1362 | * @event: Pointing which event trigger handler |
1340 | * | 1363 | * |
1341 | * Return 1 when the event and stopping request combination is satisfyied, | 1364 | * Return 1 when the event and stopping request combination is satisfied, |
1342 | * zero otherwise. | 1365 | * zero otherwise. |
1343 | */ | 1366 | */ |
1344 | static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event) | 1367 | static int __ccdc_handle_stopping(struct isp_ccdc_device *ccdc, u32 event) |
@@ -1618,7 +1641,7 @@ static int ccdc_video_queue(struct isp_video *video, struct isp_buffer *buffer) | |||
1618 | 1641 | ||
1619 | ccdc_set_outaddr(ccdc, buffer->isp_addr); | 1642 | ccdc_set_outaddr(ccdc, buffer->isp_addr); |
1620 | 1643 | ||
1621 | /* We now have a buffer queued on the output, restart the pipeline in | 1644 | /* We now have a buffer queued on the output, restart the pipeline |
1622 | * on the next CCDC interrupt if running in continuous mode (or when | 1645 | * on the next CCDC interrupt if running in continuous mode (or when |
1623 | * starting the stream). | 1646 | * starting the stream). |
1624 | */ | 1647 | */ |
diff --git a/drivers/media/video/omap3isp/isppreview.c b/drivers/media/video/omap3isp/isppreview.c index 2b16988a501d..aba537af87e4 100644 --- a/drivers/media/video/omap3isp/isppreview.c +++ b/drivers/media/video/omap3isp/isppreview.c | |||
@@ -755,7 +755,7 @@ static struct preview_update update_attrs[] = { | |||
755 | * @configs - pointer to update config structure. | 755 | * @configs - pointer to update config structure. |
756 | * @config - return pointer to appropriate structure field. | 756 | * @config - return pointer to appropriate structure field. |
757 | * @bit - for which feature to return pointers. | 757 | * @bit - for which feature to return pointers. |
758 | * Return size of coresponding prev_params member | 758 | * Return size of corresponding prev_params member |
759 | */ | 759 | */ |
760 | static u32 | 760 | static u32 |
761 | __preview_get_ptrs(struct prev_params *params, void **param, | 761 | __preview_get_ptrs(struct prev_params *params, void **param, |
diff --git a/drivers/media/video/omap3isp/ispqueue.c b/drivers/media/video/omap3isp/ispqueue.c index 8fddc5806b0d..9c317148205f 100644 --- a/drivers/media/video/omap3isp/ispqueue.c +++ b/drivers/media/video/omap3isp/ispqueue.c | |||
@@ -339,7 +339,7 @@ static int isp_video_buffer_prepare_user(struct isp_video_buffer *buf) | |||
339 | up_read(¤t->mm->mmap_sem); | 339 | up_read(¤t->mm->mmap_sem); |
340 | 340 | ||
341 | if (ret != buf->npages) { | 341 | if (ret != buf->npages) { |
342 | buf->npages = ret; | 342 | buf->npages = ret < 0 ? 0 : ret; |
343 | isp_video_buffer_cleanup(buf); | 343 | isp_video_buffer_cleanup(buf); |
344 | return -EFAULT; | 344 | return -EFAULT; |
345 | } | 345 | } |
@@ -408,8 +408,8 @@ done: | |||
408 | * isp_video_buffer_prepare_vm_flags - Get VMA flags for a userspace address | 408 | * isp_video_buffer_prepare_vm_flags - Get VMA flags for a userspace address |
409 | * | 409 | * |
410 | * This function locates the VMAs for the buffer's userspace address and checks | 410 | * This function locates the VMAs for the buffer's userspace address and checks |
411 | * that their flags match. The onlflag that we need to care for at the moment is | 411 | * that their flags match. The only flag that we need to care for at the moment |
412 | * VM_PFNMAP. | 412 | * is VM_PFNMAP. |
413 | * | 413 | * |
414 | * The buffer vm_flags field is set to the first VMA flags. | 414 | * The buffer vm_flags field is set to the first VMA flags. |
415 | * | 415 | * |
diff --git a/drivers/media/video/omap3isp/ispresizer.c b/drivers/media/video/omap3isp/ispresizer.c index 653f88ba56db..0bb0f8cd36f5 100644 --- a/drivers/media/video/omap3isp/ispresizer.c +++ b/drivers/media/video/omap3isp/ispresizer.c | |||
@@ -714,19 +714,50 @@ static void resizer_print_status(struct isp_res_device *res) | |||
714 | * iw and ih are the input width and height after cropping. Those equations need | 714 | * iw and ih are the input width and height after cropping. Those equations need |
715 | * to be satisfied exactly for the resizer to work correctly. | 715 | * to be satisfied exactly for the resizer to work correctly. |
716 | * | 716 | * |
717 | * Reverting the equations, we can compute the resizing ratios with | 717 | * The equations can't be easily reverted, as the >> 8 operation is not linear. |
718 | * In addition, not all input sizes can be achieved for a given output size. To | ||
719 | * get the highest input size lower than or equal to the requested input size, | ||
720 | * we need to compute the highest resizing ratio that satisfies the following | ||
721 | * inequality (taking the 4-tap mode width equation as an example) | ||
722 | * | ||
723 | * iw >= (32 * sph + (ow - 1) * hrsz + 16) >> 8 - 7 | ||
724 | * | ||
725 | * (where iw is the requested input width) which can be rewritten as | ||
726 | * | ||
727 | * iw - 7 >= (32 * sph + (ow - 1) * hrsz + 16) >> 8 | ||
728 | * (iw - 7) << 8 >= 32 * sph + (ow - 1) * hrsz + 16 - b | ||
729 | * ((iw - 7) << 8) + b >= 32 * sph + (ow - 1) * hrsz + 16 | ||
730 | * | ||
731 | * where b is the value of the 8 least significant bits of the right hand side | ||
732 | * expression of the last inequality. The highest resizing ratio value will be | ||
733 | * achieved when b is equal to its maximum value of 255. That resizing ratio | ||
734 | * value will still satisfy the original inequality, as b will disappear when | ||
735 | * the expression will be shifted right by 8. | ||
736 | * | ||
737 | * The reverted the equations thus become | ||
718 | * | 738 | * |
719 | * - 8-phase, 4-tap mode | 739 | * - 8-phase, 4-tap mode |
720 | * hrsz = ((iw - 7) * 256 - 16 - 32 * sph) / (ow - 1) | 740 | * hrsz = ((iw - 7) * 256 + 255 - 16 - 32 * sph) / (ow - 1) |
721 | * vrsz = ((ih - 4) * 256 - 16 - 32 * spv) / (oh - 1) | 741 | * vrsz = ((ih - 4) * 256 + 255 - 16 - 32 * spv) / (oh - 1) |
722 | * - 4-phase, 7-tap mode | 742 | * - 4-phase, 7-tap mode |
723 | * hrsz = ((iw - 7) * 256 - 32 - 64 * sph) / (ow - 1) | 743 | * hrsz = ((iw - 7) * 256 + 255 - 32 - 64 * sph) / (ow - 1) |
724 | * vrsz = ((ih - 7) * 256 - 32 - 64 * spv) / (oh - 1) | 744 | * vrsz = ((ih - 7) * 256 + 255 - 32 - 64 * spv) / (oh - 1) |
725 | * | 745 | * |
726 | * The ratios are integer values, and must be rounded down to ensure that the | 746 | * The ratios are integer values, and are rounded down to ensure that the |
727 | * cropped input size is not bigger than the uncropped input size. As the ratio | 747 | * cropped input size is not bigger than the uncropped input size. |
728 | * in 7-tap mode is always smaller than the ratio in 4-tap mode, we can use the | 748 | * |
729 | * 7-tap mode equations to compute a ratio approximation. | 749 | * As the number of phases/taps, used to select the correct equations to compute |
750 | * the ratio, depends on the ratio, we start with the 4-tap mode equations to | ||
751 | * compute an approximation of the ratio, and switch to the 7-tap mode equations | ||
752 | * if the approximation is higher than the ratio threshold. | ||
753 | * | ||
754 | * As the 7-tap mode equations will return a ratio smaller than or equal to the | ||
755 | * 4-tap mode equations, the resulting ratio could become lower than or equal to | ||
756 | * the ratio threshold. This 'equations loop' isn't an issue as long as the | ||
757 | * correct equations are used to compute the final input size. Starting with the | ||
758 | * 4-tap mode equations ensure that, in case of values resulting in a 'ratio | ||
759 | * loop', the smallest of the ratio values will be used, never exceeding the | ||
760 | * requested input size. | ||
730 | * | 761 | * |
731 | * We first clamp the output size according to the hardware capabilitie to avoid | 762 | * We first clamp the output size according to the hardware capabilitie to avoid |
732 | * auto-cropping the input more than required to satisfy the TRM equations. The | 763 | * auto-cropping the input more than required to satisfy the TRM equations. The |
@@ -775,6 +806,8 @@ static void resizer_calc_ratios(struct isp_res_device *res, | |||
775 | unsigned int max_width; | 806 | unsigned int max_width; |
776 | unsigned int max_height; | 807 | unsigned int max_height; |
777 | unsigned int width_alignment; | 808 | unsigned int width_alignment; |
809 | unsigned int width; | ||
810 | unsigned int height; | ||
778 | 811 | ||
779 | /* | 812 | /* |
780 | * Clamp the output height based on the hardware capabilities and | 813 | * Clamp the output height based on the hardware capabilities and |
@@ -786,19 +819,22 @@ static void resizer_calc_ratios(struct isp_res_device *res, | |||
786 | max_height = min_t(unsigned int, max_height, MAX_OUT_HEIGHT); | 819 | max_height = min_t(unsigned int, max_height, MAX_OUT_HEIGHT); |
787 | output->height = clamp(output->height, min_height, max_height); | 820 | output->height = clamp(output->height, min_height, max_height); |
788 | 821 | ||
789 | ratio->vert = ((input->height - 7) * 256 - 32 - 64 * spv) | 822 | ratio->vert = ((input->height - 4) * 256 + 255 - 16 - 32 * spv) |
790 | / (output->height - 1); | 823 | / (output->height - 1); |
824 | if (ratio->vert > MID_RESIZE_VALUE) | ||
825 | ratio->vert = ((input->height - 7) * 256 + 255 - 32 - 64 * spv) | ||
826 | / (output->height - 1); | ||
791 | ratio->vert = clamp_t(unsigned int, ratio->vert, | 827 | ratio->vert = clamp_t(unsigned int, ratio->vert, |
792 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); | 828 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); |
793 | 829 | ||
794 | if (ratio->vert <= MID_RESIZE_VALUE) { | 830 | if (ratio->vert <= MID_RESIZE_VALUE) { |
795 | upscaled_height = (output->height - 1) * ratio->vert | 831 | upscaled_height = (output->height - 1) * ratio->vert |
796 | + 32 * spv + 16; | 832 | + 32 * spv + 16; |
797 | input->height = (upscaled_height >> 8) + 4; | 833 | height = (upscaled_height >> 8) + 4; |
798 | } else { | 834 | } else { |
799 | upscaled_height = (output->height - 1) * ratio->vert | 835 | upscaled_height = (output->height - 1) * ratio->vert |
800 | + 64 * spv + 32; | 836 | + 64 * spv + 32; |
801 | input->height = (upscaled_height >> 8) + 7; | 837 | height = (upscaled_height >> 8) + 7; |
802 | } | 838 | } |
803 | 839 | ||
804 | /* | 840 | /* |
@@ -854,20 +890,29 @@ static void resizer_calc_ratios(struct isp_res_device *res, | |||
854 | max_width & ~(width_alignment - 1)); | 890 | max_width & ~(width_alignment - 1)); |
855 | output->width = ALIGN(output->width, width_alignment); | 891 | output->width = ALIGN(output->width, width_alignment); |
856 | 892 | ||
857 | ratio->horz = ((input->width - 7) * 256 - 32 - 64 * sph) | 893 | ratio->horz = ((input->width - 7) * 256 + 255 - 16 - 32 * sph) |
858 | / (output->width - 1); | 894 | / (output->width - 1); |
895 | if (ratio->horz > MID_RESIZE_VALUE) | ||
896 | ratio->horz = ((input->width - 7) * 256 + 255 - 32 - 64 * sph) | ||
897 | / (output->width - 1); | ||
859 | ratio->horz = clamp_t(unsigned int, ratio->horz, | 898 | ratio->horz = clamp_t(unsigned int, ratio->horz, |
860 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); | 899 | MIN_RESIZE_VALUE, MAX_RESIZE_VALUE); |
861 | 900 | ||
862 | if (ratio->horz <= MID_RESIZE_VALUE) { | 901 | if (ratio->horz <= MID_RESIZE_VALUE) { |
863 | upscaled_width = (output->width - 1) * ratio->horz | 902 | upscaled_width = (output->width - 1) * ratio->horz |
864 | + 32 * sph + 16; | 903 | + 32 * sph + 16; |
865 | input->width = (upscaled_width >> 8) + 7; | 904 | width = (upscaled_width >> 8) + 7; |
866 | } else { | 905 | } else { |
867 | upscaled_width = (output->width - 1) * ratio->horz | 906 | upscaled_width = (output->width - 1) * ratio->horz |
868 | + 64 * sph + 32; | 907 | + 64 * sph + 32; |
869 | input->width = (upscaled_width >> 8) + 7; | 908 | width = (upscaled_width >> 8) + 7; |
870 | } | 909 | } |
910 | |||
911 | /* Center the new crop rectangle. */ | ||
912 | input->left += (input->width - width) / 2; | ||
913 | input->top += (input->height - height) / 2; | ||
914 | input->width = width; | ||
915 | input->height = height; | ||
871 | } | 916 | } |
872 | 917 | ||
873 | /* | 918 | /* |
diff --git a/drivers/media/video/omap3isp/ispstat.h b/drivers/media/video/omap3isp/ispstat.h index 820950c9ef46..d86da94fa50d 100644 --- a/drivers/media/video/omap3isp/ispstat.h +++ b/drivers/media/video/omap3isp/ispstat.h | |||
@@ -131,9 +131,9 @@ struct ispstat { | |||
131 | struct ispstat_generic_config { | 131 | struct ispstat_generic_config { |
132 | /* | 132 | /* |
133 | * Fields must be in the same order as in: | 133 | * Fields must be in the same order as in: |
134 | * - isph3a_aewb_config | 134 | * - omap3isp_h3a_aewb_config |
135 | * - isph3a_af_config | 135 | * - omap3isp_h3a_af_config |
136 | * - isphist_config | 136 | * - omap3isp_hist_config |
137 | */ | 137 | */ |
138 | u32 buf_size; | 138 | u32 buf_size; |
139 | u16 config_counter; | 139 | u16 config_counter; |
diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c index 208a7ec739d7..9cd8f1aa567b 100644 --- a/drivers/media/video/omap3isp/ispvideo.c +++ b/drivers/media/video/omap3isp/ispvideo.c | |||
@@ -47,29 +47,59 @@ | |||
47 | 47 | ||
48 | static struct isp_format_info formats[] = { | 48 | static struct isp_format_info formats[] = { |
49 | { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, | 49 | { V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, |
50 | V4L2_MBUS_FMT_Y8_1X8, V4L2_PIX_FMT_GREY, 8, }, | 50 | V4L2_MBUS_FMT_Y8_1X8, V4L2_MBUS_FMT_Y8_1X8, |
51 | V4L2_PIX_FMT_GREY, 8, }, | ||
52 | { V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y10_1X10, | ||
53 | V4L2_MBUS_FMT_Y10_1X10, V4L2_MBUS_FMT_Y8_1X8, | ||
54 | V4L2_PIX_FMT_Y10, 10, }, | ||
55 | { V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y10_1X10, | ||
56 | V4L2_MBUS_FMT_Y12_1X12, V4L2_MBUS_FMT_Y8_1X8, | ||
57 | V4L2_PIX_FMT_Y12, 12, }, | ||
58 | { V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8, | ||
59 | V4L2_MBUS_FMT_SBGGR8_1X8, V4L2_MBUS_FMT_SBGGR8_1X8, | ||
60 | V4L2_PIX_FMT_SBGGR8, 8, }, | ||
61 | { V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8, | ||
62 | V4L2_MBUS_FMT_SGBRG8_1X8, V4L2_MBUS_FMT_SGBRG8_1X8, | ||
63 | V4L2_PIX_FMT_SGBRG8, 8, }, | ||
64 | { V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8, | ||
65 | V4L2_MBUS_FMT_SGRBG8_1X8, V4L2_MBUS_FMT_SGRBG8_1X8, | ||
66 | V4L2_PIX_FMT_SGRBG8, 8, }, | ||
67 | { V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8, | ||
68 | V4L2_MBUS_FMT_SRGGB8_1X8, V4L2_MBUS_FMT_SRGGB8_1X8, | ||
69 | V4L2_PIX_FMT_SRGGB8, 8, }, | ||
51 | { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, | 70 | { V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, V4L2_MBUS_FMT_SGRBG10_DPCM8_1X8, |
52 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_PIX_FMT_SGRBG10DPCM8, 8, }, | 71 | V4L2_MBUS_FMT_SGRBG10_1X10, 0, |
72 | V4L2_PIX_FMT_SGRBG10DPCM8, 8, }, | ||
53 | { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, | 73 | { V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR10_1X10, |
54 | V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_PIX_FMT_SBGGR10, 10, }, | 74 | V4L2_MBUS_FMT_SBGGR10_1X10, V4L2_MBUS_FMT_SBGGR8_1X8, |
75 | V4L2_PIX_FMT_SBGGR10, 10, }, | ||
55 | { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10, | 76 | { V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG10_1X10, |
56 | V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_PIX_FMT_SGBRG10, 10, }, | 77 | V4L2_MBUS_FMT_SGBRG10_1X10, V4L2_MBUS_FMT_SGBRG8_1X8, |
78 | V4L2_PIX_FMT_SGBRG10, 10, }, | ||
57 | { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10, | 79 | { V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG10_1X10, |
58 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_PIX_FMT_SGRBG10, 10, }, | 80 | V4L2_MBUS_FMT_SGRBG10_1X10, V4L2_MBUS_FMT_SGRBG8_1X8, |
81 | V4L2_PIX_FMT_SGRBG10, 10, }, | ||
59 | { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10, | 82 | { V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB10_1X10, |
60 | V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_PIX_FMT_SRGGB10, 10, }, | 83 | V4L2_MBUS_FMT_SRGGB10_1X10, V4L2_MBUS_FMT_SRGGB8_1X8, |
84 | V4L2_PIX_FMT_SRGGB10, 10, }, | ||
61 | { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10, | 85 | { V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR10_1X10, |
62 | V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_PIX_FMT_SBGGR12, 12, }, | 86 | V4L2_MBUS_FMT_SBGGR12_1X12, V4L2_MBUS_FMT_SBGGR8_1X8, |
87 | V4L2_PIX_FMT_SBGGR12, 12, }, | ||
63 | { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10, | 88 | { V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG10_1X10, |
64 | V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_PIX_FMT_SGBRG12, 12, }, | 89 | V4L2_MBUS_FMT_SGBRG12_1X12, V4L2_MBUS_FMT_SGBRG8_1X8, |
90 | V4L2_PIX_FMT_SGBRG12, 12, }, | ||
65 | { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10, | 91 | { V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG10_1X10, |
66 | V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_PIX_FMT_SGRBG12, 12, }, | 92 | V4L2_MBUS_FMT_SGRBG12_1X12, V4L2_MBUS_FMT_SGRBG8_1X8, |
93 | V4L2_PIX_FMT_SGRBG12, 12, }, | ||
67 | { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10, | 94 | { V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB10_1X10, |
68 | V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_PIX_FMT_SRGGB12, 12, }, | 95 | V4L2_MBUS_FMT_SRGGB12_1X12, V4L2_MBUS_FMT_SRGGB8_1X8, |
96 | V4L2_PIX_FMT_SRGGB12, 12, }, | ||
69 | { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16, | 97 | { V4L2_MBUS_FMT_UYVY8_1X16, V4L2_MBUS_FMT_UYVY8_1X16, |
70 | V4L2_MBUS_FMT_UYVY8_1X16, V4L2_PIX_FMT_UYVY, 16, }, | 98 | V4L2_MBUS_FMT_UYVY8_1X16, 0, |
99 | V4L2_PIX_FMT_UYVY, 16, }, | ||
71 | { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16, | 100 | { V4L2_MBUS_FMT_YUYV8_1X16, V4L2_MBUS_FMT_YUYV8_1X16, |
72 | V4L2_MBUS_FMT_YUYV8_1X16, V4L2_PIX_FMT_YUYV, 16, }, | 101 | V4L2_MBUS_FMT_YUYV8_1X16, 0, |
102 | V4L2_PIX_FMT_YUYV, 16, }, | ||
73 | }; | 103 | }; |
74 | 104 | ||
75 | const struct isp_format_info * | 105 | const struct isp_format_info * |
@@ -86,6 +116,37 @@ omap3isp_video_format_info(enum v4l2_mbus_pixelcode code) | |||
86 | } | 116 | } |
87 | 117 | ||
88 | /* | 118 | /* |
119 | * Decide whether desired output pixel code can be obtained with | ||
120 | * the lane shifter by shifting the input pixel code. | ||
121 | * @in: input pixelcode to shifter | ||
122 | * @out: output pixelcode from shifter | ||
123 | * @additional_shift: # of bits the sensor's LSB is offset from CAMEXT[0] | ||
124 | * | ||
125 | * return true if the combination is possible | ||
126 | * return false otherwise | ||
127 | */ | ||
128 | static bool isp_video_is_shiftable(enum v4l2_mbus_pixelcode in, | ||
129 | enum v4l2_mbus_pixelcode out, | ||
130 | unsigned int additional_shift) | ||
131 | { | ||
132 | const struct isp_format_info *in_info, *out_info; | ||
133 | |||
134 | if (in == out) | ||
135 | return true; | ||
136 | |||
137 | in_info = omap3isp_video_format_info(in); | ||
138 | out_info = omap3isp_video_format_info(out); | ||
139 | |||
140 | if ((in_info->flavor == 0) || (out_info->flavor == 0)) | ||
141 | return false; | ||
142 | |||
143 | if (in_info->flavor != out_info->flavor) | ||
144 | return false; | ||
145 | |||
146 | return in_info->bpp - out_info->bpp + additional_shift <= 6; | ||
147 | } | ||
148 | |||
149 | /* | ||
89 | * isp_video_mbus_to_pix - Convert v4l2_mbus_framefmt to v4l2_pix_format | 150 | * isp_video_mbus_to_pix - Convert v4l2_mbus_framefmt to v4l2_pix_format |
90 | * @video: ISP video instance | 151 | * @video: ISP video instance |
91 | * @mbus: v4l2_mbus_framefmt format (input) | 152 | * @mbus: v4l2_mbus_framefmt format (input) |
@@ -235,6 +296,7 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
235 | return -EPIPE; | 296 | return -EPIPE; |
236 | 297 | ||
237 | while (1) { | 298 | while (1) { |
299 | unsigned int shifter_link; | ||
238 | /* Retrieve the sink format */ | 300 | /* Retrieve the sink format */ |
239 | pad = &subdev->entity.pads[0]; | 301 | pad = &subdev->entity.pads[0]; |
240 | if (!(pad->flags & MEDIA_PAD_FL_SINK)) | 302 | if (!(pad->flags & MEDIA_PAD_FL_SINK)) |
@@ -263,6 +325,10 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
263 | return -ENOSPC; | 325 | return -ENOSPC; |
264 | } | 326 | } |
265 | 327 | ||
328 | /* If sink pad is on CCDC, the link has the lane shifter | ||
329 | * in the middle of it. */ | ||
330 | shifter_link = subdev == &isp->isp_ccdc.subdev; | ||
331 | |||
266 | /* Retrieve the source format */ | 332 | /* Retrieve the source format */ |
267 | pad = media_entity_remote_source(pad); | 333 | pad = media_entity_remote_source(pad); |
268 | if (pad == NULL || | 334 | if (pad == NULL || |
@@ -278,10 +344,24 @@ static int isp_video_validate_pipeline(struct isp_pipeline *pipe) | |||
278 | return -EPIPE; | 344 | return -EPIPE; |
279 | 345 | ||
280 | /* Check if the two ends match */ | 346 | /* Check if the two ends match */ |
281 | if (fmt_source.format.code != fmt_sink.format.code || | 347 | if (fmt_source.format.width != fmt_sink.format.width || |
282 | fmt_source.format.width != fmt_sink.format.width || | ||
283 | fmt_source.format.height != fmt_sink.format.height) | 348 | fmt_source.format.height != fmt_sink.format.height) |
284 | return -EPIPE; | 349 | return -EPIPE; |
350 | |||
351 | if (shifter_link) { | ||
352 | unsigned int parallel_shift = 0; | ||
353 | if (isp->isp_ccdc.input == CCDC_INPUT_PARALLEL) { | ||
354 | struct isp_parallel_platform_data *pdata = | ||
355 | &((struct isp_v4l2_subdevs_group *) | ||
356 | subdev->host_priv)->bus.parallel; | ||
357 | parallel_shift = pdata->data_lane_shift * 2; | ||
358 | } | ||
359 | if (!isp_video_is_shiftable(fmt_source.format.code, | ||
360 | fmt_sink.format.code, | ||
361 | parallel_shift)) | ||
362 | return -EPIPE; | ||
363 | } else if (fmt_source.format.code != fmt_sink.format.code) | ||
364 | return -EPIPE; | ||
285 | } | 365 | } |
286 | 366 | ||
287 | return 0; | 367 | return 0; |
diff --git a/drivers/media/video/omap3isp/ispvideo.h b/drivers/media/video/omap3isp/ispvideo.h index 524a1acd0906..911bea64e78a 100644 --- a/drivers/media/video/omap3isp/ispvideo.h +++ b/drivers/media/video/omap3isp/ispvideo.h | |||
@@ -49,6 +49,8 @@ struct v4l2_pix_format; | |||
49 | * bits. Identical to @code if the format is 10 bits wide or less. | 49 | * bits. Identical to @code if the format is 10 bits wide or less. |
50 | * @uncompressed: V4L2 media bus format code for the corresponding uncompressed | 50 | * @uncompressed: V4L2 media bus format code for the corresponding uncompressed |
51 | * format. Identical to @code if the format is not DPCM compressed. | 51 | * format. Identical to @code if the format is not DPCM compressed. |
52 | * @flavor: V4L2 media bus format code for the same pixel layout but | ||
53 | * shifted to be 8 bits per pixel. =0 if format is not shiftable. | ||
52 | * @pixelformat: V4L2 pixel format FCC identifier | 54 | * @pixelformat: V4L2 pixel format FCC identifier |
53 | * @bpp: Bits per pixel | 55 | * @bpp: Bits per pixel |
54 | */ | 56 | */ |
@@ -56,6 +58,7 @@ struct isp_format_info { | |||
56 | enum v4l2_mbus_pixelcode code; | 58 | enum v4l2_mbus_pixelcode code; |
57 | enum v4l2_mbus_pixelcode truncated; | 59 | enum v4l2_mbus_pixelcode truncated; |
58 | enum v4l2_mbus_pixelcode uncompressed; | 60 | enum v4l2_mbus_pixelcode uncompressed; |
61 | enum v4l2_mbus_pixelcode flavor; | ||
59 | u32 pixelformat; | 62 | u32 pixelformat; |
60 | unsigned int bpp; | 63 | unsigned int bpp; |
61 | }; | 64 | }; |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index 95f8b4e11e46..d142b40ea64e 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -527,7 +527,7 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv, | |||
527 | if (ret) | 527 | if (ret) |
528 | return ret; | 528 | return ret; |
529 | 529 | ||
530 | if (vb2_is_streaming(&fimc->vid_cap.vbq) || fimc_capture_active(fimc)) | 530 | if (vb2_is_busy(&fimc->vid_cap.vbq) || fimc_capture_active(fimc)) |
531 | return -EBUSY; | 531 | return -EBUSY; |
532 | 532 | ||
533 | frame = &ctx->d_frame; | 533 | frame = &ctx->d_frame; |
@@ -539,8 +539,10 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void *priv, | |||
539 | return -EINVAL; | 539 | return -EINVAL; |
540 | } | 540 | } |
541 | 541 | ||
542 | for (i = 0; i < frame->fmt->colplanes; i++) | 542 | for (i = 0; i < frame->fmt->colplanes; i++) { |
543 | frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; | 543 | frame->payload[i] = |
544 | (pix->width * pix->height * frame->fmt->depth[i]) >> 3; | ||
545 | } | ||
544 | 546 | ||
545 | /* Output DMA frame pixel size and offsets. */ | 547 | /* Output DMA frame pixel size and offsets. */ |
546 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 | 548 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 6c919b38a3d8..dc91a8511af6 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
@@ -361,10 +361,20 @@ static void fimc_capture_irq_handler(struct fimc_dev *fimc) | |||
361 | { | 361 | { |
362 | struct fimc_vid_cap *cap = &fimc->vid_cap; | 362 | struct fimc_vid_cap *cap = &fimc->vid_cap; |
363 | struct fimc_vid_buffer *v_buf; | 363 | struct fimc_vid_buffer *v_buf; |
364 | struct timeval *tv; | ||
365 | struct timespec ts; | ||
364 | 366 | ||
365 | if (!list_empty(&cap->active_buf_q) && | 367 | if (!list_empty(&cap->active_buf_q) && |
366 | test_bit(ST_CAPT_RUN, &fimc->state)) { | 368 | test_bit(ST_CAPT_RUN, &fimc->state)) { |
369 | ktime_get_real_ts(&ts); | ||
370 | |||
367 | v_buf = active_queue_pop(cap); | 371 | v_buf = active_queue_pop(cap); |
372 | |||
373 | tv = &v_buf->vb.v4l2_buf.timestamp; | ||
374 | tv->tv_sec = ts.tv_sec; | ||
375 | tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC; | ||
376 | v_buf->vb.v4l2_buf.sequence = cap->frame_count++; | ||
377 | |||
368 | vb2_buffer_done(&v_buf->vb, VB2_BUF_STATE_DONE); | 378 | vb2_buffer_done(&v_buf->vb, VB2_BUF_STATE_DONE); |
369 | } | 379 | } |
370 | 380 | ||
@@ -758,7 +768,7 @@ static void fimc_unlock(struct vb2_queue *vq) | |||
758 | mutex_unlock(&ctx->fimc_dev->lock); | 768 | mutex_unlock(&ctx->fimc_dev->lock); |
759 | } | 769 | } |
760 | 770 | ||
761 | struct vb2_ops fimc_qops = { | 771 | static struct vb2_ops fimc_qops = { |
762 | .queue_setup = fimc_queue_setup, | 772 | .queue_setup = fimc_queue_setup, |
763 | .buf_prepare = fimc_buf_prepare, | 773 | .buf_prepare = fimc_buf_prepare, |
764 | .buf_queue = fimc_buf_queue, | 774 | .buf_queue = fimc_buf_queue, |
@@ -927,23 +937,23 @@ int fimc_vidioc_try_fmt_mplane(struct file *file, void *priv, | |||
927 | pix->num_planes = fmt->memplanes; | 937 | pix->num_planes = fmt->memplanes; |
928 | pix->colorspace = V4L2_COLORSPACE_JPEG; | 938 | pix->colorspace = V4L2_COLORSPACE_JPEG; |
929 | 939 | ||
930 | for (i = 0; i < pix->num_planes; ++i) { | ||
931 | int bpl = pix->plane_fmt[i].bytesperline; | ||
932 | 940 | ||
933 | dbg("[%d] bpl: %d, depth: %d, w: %d, h: %d", | 941 | for (i = 0; i < pix->num_planes; ++i) { |
934 | i, bpl, fmt->depth[i], pix->width, pix->height); | 942 | u32 bpl = pix->plane_fmt[i].bytesperline; |
943 | u32 *sizeimage = &pix->plane_fmt[i].sizeimage; | ||
935 | 944 | ||
936 | if (!bpl || (bpl * 8 / fmt->depth[i]) > pix->width) | 945 | if (fmt->colplanes > 1 && (bpl == 0 || bpl < pix->width)) |
937 | bpl = (pix->width * fmt->depth[0]) >> 3; | 946 | bpl = pix->width; /* Planar */ |
938 | 947 | ||
939 | if (!pix->plane_fmt[i].sizeimage) | 948 | if (fmt->colplanes == 1 && /* Packed */ |
940 | pix->plane_fmt[i].sizeimage = pix->height * bpl; | 949 | (bpl == 0 || ((bpl * 8) / fmt->depth[i]) < pix->width)) |
950 | bpl = (pix->width * fmt->depth[0]) / 8; | ||
941 | 951 | ||
942 | pix->plane_fmt[i].bytesperline = bpl; | 952 | if (i == 0) /* Same bytesperline for each plane. */ |
953 | mod_x = bpl; | ||
943 | 954 | ||
944 | dbg("[%d]: bpl: %d, sizeimage: %d", | 955 | pix->plane_fmt[i].bytesperline = mod_x; |
945 | i, pix->plane_fmt[i].bytesperline, | 956 | *sizeimage = (pix->width * pix->height * fmt->depth[i]) / 8; |
946 | pix->plane_fmt[i].sizeimage); | ||
947 | } | 957 | } |
948 | 958 | ||
949 | return 0; | 959 | return 0; |
@@ -965,7 +975,7 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *priv, | |||
965 | 975 | ||
966 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); | 976 | vq = v4l2_m2m_get_vq(ctx->m2m_ctx, f->type); |
967 | 977 | ||
968 | if (vb2_is_streaming(vq)) { | 978 | if (vb2_is_busy(vq)) { |
969 | v4l2_err(&fimc->m2m.v4l2_dev, "queue (%d) busy\n", f->type); | 979 | v4l2_err(&fimc->m2m.v4l2_dev, "queue (%d) busy\n", f->type); |
970 | return -EBUSY; | 980 | return -EBUSY; |
971 | } | 981 | } |
@@ -985,8 +995,10 @@ static int fimc_m2m_s_fmt_mplane(struct file *file, void *priv, | |||
985 | if (!frame->fmt) | 995 | if (!frame->fmt) |
986 | return -EINVAL; | 996 | return -EINVAL; |
987 | 997 | ||
988 | for (i = 0; i < frame->fmt->colplanes; i++) | 998 | for (i = 0; i < frame->fmt->colplanes; i++) { |
989 | frame->payload[i] = pix->plane_fmt[i].bytesperline * pix->height; | 999 | frame->payload[i] = |
1000 | (pix->width * pix->height * frame->fmt->depth[i]) / 8; | ||
1001 | } | ||
990 | 1002 | ||
991 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 / | 1003 | frame->f_width = pix->plane_fmt[0].bytesperline * 8 / |
992 | frame->fmt->depth[0]; | 1004 | frame->fmt->depth[0]; |
@@ -1750,7 +1762,7 @@ static int __devexit fimc_remove(struct platform_device *pdev) | |||
1750 | } | 1762 | } |
1751 | 1763 | ||
1752 | /* Image pixel limits, similar across several FIMC HW revisions. */ | 1764 | /* Image pixel limits, similar across several FIMC HW revisions. */ |
1753 | static struct fimc_pix_limit s5p_pix_limit[3] = { | 1765 | static struct fimc_pix_limit s5p_pix_limit[4] = { |
1754 | [0] = { | 1766 | [0] = { |
1755 | .scaler_en_w = 3264, | 1767 | .scaler_en_w = 3264, |
1756 | .scaler_dis_w = 8192, | 1768 | .scaler_dis_w = 8192, |
@@ -1775,6 +1787,14 @@ static struct fimc_pix_limit s5p_pix_limit[3] = { | |||
1775 | .out_rot_en_w = 1280, | 1787 | .out_rot_en_w = 1280, |
1776 | .out_rot_dis_w = 1920, | 1788 | .out_rot_dis_w = 1920, |
1777 | }, | 1789 | }, |
1790 | [3] = { | ||
1791 | .scaler_en_w = 1920, | ||
1792 | .scaler_dis_w = 8192, | ||
1793 | .in_rot_en_h = 1366, | ||
1794 | .in_rot_dis_w = 8192, | ||
1795 | .out_rot_en_w = 1366, | ||
1796 | .out_rot_dis_w = 1920, | ||
1797 | }, | ||
1778 | }; | 1798 | }; |
1779 | 1799 | ||
1780 | static struct samsung_fimc_variant fimc0_variant_s5p = { | 1800 | static struct samsung_fimc_variant fimc0_variant_s5p = { |
@@ -1827,7 +1847,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv210 = { | |||
1827 | .pix_limit = &s5p_pix_limit[2], | 1847 | .pix_limit = &s5p_pix_limit[2], |
1828 | }; | 1848 | }; |
1829 | 1849 | ||
1830 | static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | 1850 | static struct samsung_fimc_variant fimc0_variant_exynos4 = { |
1831 | .pix_hoff = 1, | 1851 | .pix_hoff = 1, |
1832 | .has_inp_rot = 1, | 1852 | .has_inp_rot = 1, |
1833 | .has_out_rot = 1, | 1853 | .has_out_rot = 1, |
@@ -1840,7 +1860,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv310 = { | |||
1840 | .pix_limit = &s5p_pix_limit[1], | 1860 | .pix_limit = &s5p_pix_limit[1], |
1841 | }; | 1861 | }; |
1842 | 1862 | ||
1843 | static struct samsung_fimc_variant fimc2_variant_s5pv310 = { | 1863 | static struct samsung_fimc_variant fimc2_variant_exynos4 = { |
1844 | .pix_hoff = 1, | 1864 | .pix_hoff = 1, |
1845 | .has_cistatus2 = 1, | 1865 | .has_cistatus2 = 1, |
1846 | .has_mainscaler_ext = 1, | 1866 | .has_mainscaler_ext = 1, |
@@ -1848,7 +1868,7 @@ static struct samsung_fimc_variant fimc2_variant_s5pv310 = { | |||
1848 | .min_out_pixsize = 16, | 1868 | .min_out_pixsize = 16, |
1849 | .hor_offs_align = 1, | 1869 | .hor_offs_align = 1, |
1850 | .out_buf_count = 32, | 1870 | .out_buf_count = 32, |
1851 | .pix_limit = &s5p_pix_limit[2], | 1871 | .pix_limit = &s5p_pix_limit[3], |
1852 | }; | 1872 | }; |
1853 | 1873 | ||
1854 | /* S5PC100 */ | 1874 | /* S5PC100 */ |
@@ -1874,12 +1894,12 @@ static struct samsung_fimc_driverdata fimc_drvdata_s5pv210 = { | |||
1874 | }; | 1894 | }; |
1875 | 1895 | ||
1876 | /* S5PV310, S5PC210 */ | 1896 | /* S5PV310, S5PC210 */ |
1877 | static struct samsung_fimc_driverdata fimc_drvdata_s5pv310 = { | 1897 | static struct samsung_fimc_driverdata fimc_drvdata_exynos4 = { |
1878 | .variant = { | 1898 | .variant = { |
1879 | [0] = &fimc0_variant_s5pv310, | 1899 | [0] = &fimc0_variant_exynos4, |
1880 | [1] = &fimc0_variant_s5pv310, | 1900 | [1] = &fimc0_variant_exynos4, |
1881 | [2] = &fimc0_variant_s5pv310, | 1901 | [2] = &fimc0_variant_exynos4, |
1882 | [3] = &fimc2_variant_s5pv310, | 1902 | [3] = &fimc2_variant_exynos4, |
1883 | }, | 1903 | }, |
1884 | .num_entities = 4, | 1904 | .num_entities = 4, |
1885 | .lclk_frequency = 166000000UL, | 1905 | .lclk_frequency = 166000000UL, |
@@ -1893,8 +1913,8 @@ static struct platform_device_id fimc_driver_ids[] = { | |||
1893 | .name = "s5pv210-fimc", | 1913 | .name = "s5pv210-fimc", |
1894 | .driver_data = (unsigned long)&fimc_drvdata_s5pv210, | 1914 | .driver_data = (unsigned long)&fimc_drvdata_s5pv210, |
1895 | }, { | 1915 | }, { |
1896 | .name = "s5pv310-fimc", | 1916 | .name = "exynos4-fimc", |
1897 | .driver_data = (unsigned long)&fimc_drvdata_s5pv310, | 1917 | .driver_data = (unsigned long)&fimc_drvdata_exynos4, |
1898 | }, | 1918 | }, |
1899 | {}, | 1919 | {}, |
1900 | }; | 1920 | }; |
diff --git a/drivers/media/video/sh_mobile_ceu_camera.c b/drivers/media/video/sh_mobile_ceu_camera.c index 3fe54bf41142..134e86bf6d97 100644 --- a/drivers/media/video/sh_mobile_ceu_camera.c +++ b/drivers/media/video/sh_mobile_ceu_camera.c | |||
@@ -922,7 +922,7 @@ static int sh_mobile_ceu_get_formats(struct soc_camera_device *icd, unsigned int | |||
922 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ | 922 | /* Try 2560x1920, 1280x960, 640x480, 320x240 */ |
923 | mf.width = 2560 >> shift; | 923 | mf.width = 2560 >> shift; |
924 | mf.height = 1920 >> shift; | 924 | mf.height = 1920 >> shift; |
925 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 925 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
926 | s_mbus_fmt, &mf); | 926 | s_mbus_fmt, &mf); |
927 | if (ret < 0) | 927 | if (ret < 0) |
928 | return ret; | 928 | return ret; |
@@ -1224,7 +1224,7 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
1224 | struct v4l2_cropcap cap; | 1224 | struct v4l2_cropcap cap; |
1225 | int ret; | 1225 | int ret; |
1226 | 1226 | ||
1227 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 1227 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
1228 | s_mbus_fmt, mf); | 1228 | s_mbus_fmt, mf); |
1229 | if (ret < 0) | 1229 | if (ret < 0) |
1230 | return ret; | 1230 | return ret; |
@@ -1254,7 +1254,7 @@ static int client_s_fmt(struct soc_camera_device *icd, | |||
1254 | tmp_h = min(2 * tmp_h, max_height); | 1254 | tmp_h = min(2 * tmp_h, max_height); |
1255 | mf->width = tmp_w; | 1255 | mf->width = tmp_w; |
1256 | mf->height = tmp_h; | 1256 | mf->height = tmp_h; |
1257 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 1257 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
1258 | s_mbus_fmt, mf); | 1258 | s_mbus_fmt, mf); |
1259 | dev_geo(dev, "Camera scaled to %ux%u\n", | 1259 | dev_geo(dev, "Camera scaled to %ux%u\n", |
1260 | mf->width, mf->height); | 1260 | mf->width, mf->height); |
@@ -1658,7 +1658,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1658 | mf.code = xlate->code; | 1658 | mf.code = xlate->code; |
1659 | mf.colorspace = pix->colorspace; | 1659 | mf.colorspace = pix->colorspace; |
1660 | 1660 | ||
1661 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, try_mbus_fmt, &mf); | 1661 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, try_mbus_fmt, &mf); |
1662 | if (ret < 0) | 1662 | if (ret < 0) |
1663 | return ret; | 1663 | return ret; |
1664 | 1664 | ||
@@ -1682,7 +1682,7 @@ static int sh_mobile_ceu_try_fmt(struct soc_camera_device *icd, | |||
1682 | */ | 1682 | */ |
1683 | mf.width = 2560; | 1683 | mf.width = 2560; |
1684 | mf.height = 1920; | 1684 | mf.height = 1920; |
1685 | ret = v4l2_device_call_until_err(sd->v4l2_dev, 0, video, | 1685 | ret = v4l2_device_call_until_err(sd->v4l2_dev, (long)icd, video, |
1686 | try_mbus_fmt, &mf); | 1686 | try_mbus_fmt, &mf); |
1687 | if (ret < 0) { | 1687 | if (ret < 0) { |
1688 | /* Shouldn't actually happen... */ | 1688 | /* Shouldn't actually happen... */ |
diff --git a/drivers/media/video/sh_mobile_csi2.c b/drivers/media/video/sh_mobile_csi2.c index dd1b81b1442b..98b87481fa94 100644 --- a/drivers/media/video/sh_mobile_csi2.c +++ b/drivers/media/video/sh_mobile_csi2.c | |||
@@ -38,6 +38,8 @@ struct sh_csi2 { | |||
38 | void __iomem *base; | 38 | void __iomem *base; |
39 | struct platform_device *pdev; | 39 | struct platform_device *pdev; |
40 | struct sh_csi2_client_config *client; | 40 | struct sh_csi2_client_config *client; |
41 | unsigned long (*query_bus_param)(struct soc_camera_device *); | ||
42 | int (*set_bus_param)(struct soc_camera_device *, unsigned long); | ||
41 | }; | 43 | }; |
42 | 44 | ||
43 | static int sh_csi2_try_fmt(struct v4l2_subdev *sd, | 45 | static int sh_csi2_try_fmt(struct v4l2_subdev *sd, |
@@ -208,6 +210,7 @@ static int sh_csi2_notify(struct notifier_block *nb, | |||
208 | case BUS_NOTIFY_BOUND_DRIVER: | 210 | case BUS_NOTIFY_BOUND_DRIVER: |
209 | snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s%s", | 211 | snprintf(priv->subdev.name, V4L2_SUBDEV_NAME_SIZE, "%s%s", |
210 | dev_name(v4l2_dev->dev), ".mipi-csi"); | 212 | dev_name(v4l2_dev->dev), ".mipi-csi"); |
213 | priv->subdev.grp_id = (long)icd; | ||
211 | ret = v4l2_device_register_subdev(v4l2_dev, &priv->subdev); | 214 | ret = v4l2_device_register_subdev(v4l2_dev, &priv->subdev); |
212 | dev_dbg(dev, "%s(%p): ret(register_subdev) = %d\n", __func__, priv, ret); | 215 | dev_dbg(dev, "%s(%p): ret(register_subdev) = %d\n", __func__, priv, ret); |
213 | if (ret < 0) | 216 | if (ret < 0) |
@@ -215,6 +218,8 @@ static int sh_csi2_notify(struct notifier_block *nb, | |||
215 | 218 | ||
216 | priv->client = pdata->clients + i; | 219 | priv->client = pdata->clients + i; |
217 | 220 | ||
221 | priv->set_bus_param = icd->ops->set_bus_param; | ||
222 | priv->query_bus_param = icd->ops->query_bus_param; | ||
218 | icd->ops->set_bus_param = sh_csi2_set_bus_param; | 223 | icd->ops->set_bus_param = sh_csi2_set_bus_param; |
219 | icd->ops->query_bus_param = sh_csi2_query_bus_param; | 224 | icd->ops->query_bus_param = sh_csi2_query_bus_param; |
220 | 225 | ||
@@ -226,8 +231,10 @@ static int sh_csi2_notify(struct notifier_block *nb, | |||
226 | priv->client = NULL; | 231 | priv->client = NULL; |
227 | 232 | ||
228 | /* Driver is about to be unbound */ | 233 | /* Driver is about to be unbound */ |
229 | icd->ops->set_bus_param = NULL; | 234 | icd->ops->set_bus_param = priv->set_bus_param; |
230 | icd->ops->query_bus_param = NULL; | 235 | icd->ops->query_bus_param = priv->query_bus_param; |
236 | priv->set_bus_param = NULL; | ||
237 | priv->query_bus_param = NULL; | ||
231 | 238 | ||
232 | v4l2_device_unregister_subdev(&priv->subdev); | 239 | v4l2_device_unregister_subdev(&priv->subdev); |
233 | 240 | ||
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 46284489e4eb..ddb4c091dedc 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -136,11 +136,50 @@ unsigned long soc_camera_apply_sensor_flags(struct soc_camera_link *icl, | |||
136 | } | 136 | } |
137 | EXPORT_SYMBOL(soc_camera_apply_sensor_flags); | 137 | EXPORT_SYMBOL(soc_camera_apply_sensor_flags); |
138 | 138 | ||
139 | #define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ | ||
140 | ((x) >> 24) & 0xff | ||
141 | |||
142 | static int soc_camera_try_fmt(struct soc_camera_device *icd, | ||
143 | struct v4l2_format *f) | ||
144 | { | ||
145 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
146 | struct v4l2_pix_format *pix = &f->fmt.pix; | ||
147 | int ret; | ||
148 | |||
149 | dev_dbg(&icd->dev, "TRY_FMT(%c%c%c%c, %ux%u)\n", | ||
150 | pixfmtstr(pix->pixelformat), pix->width, pix->height); | ||
151 | |||
152 | pix->bytesperline = 0; | ||
153 | pix->sizeimage = 0; | ||
154 | |||
155 | ret = ici->ops->try_fmt(icd, f); | ||
156 | if (ret < 0) | ||
157 | return ret; | ||
158 | |||
159 | if (!pix->sizeimage) { | ||
160 | if (!pix->bytesperline) { | ||
161 | const struct soc_camera_format_xlate *xlate; | ||
162 | |||
163 | xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); | ||
164 | if (!xlate) | ||
165 | return -EINVAL; | ||
166 | |||
167 | ret = soc_mbus_bytes_per_line(pix->width, | ||
168 | xlate->host_fmt); | ||
169 | if (ret > 0) | ||
170 | pix->bytesperline = ret; | ||
171 | } | ||
172 | if (pix->bytesperline) | ||
173 | pix->sizeimage = pix->bytesperline * pix->height; | ||
174 | } | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
139 | static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, | 179 | static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, |
140 | struct v4l2_format *f) | 180 | struct v4l2_format *f) |
141 | { | 181 | { |
142 | struct soc_camera_device *icd = file->private_data; | 182 | struct soc_camera_device *icd = file->private_data; |
143 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
144 | 183 | ||
145 | WARN_ON(priv != file->private_data); | 184 | WARN_ON(priv != file->private_data); |
146 | 185 | ||
@@ -149,7 +188,7 @@ static int soc_camera_try_fmt_vid_cap(struct file *file, void *priv, | |||
149 | return -EINVAL; | 188 | return -EINVAL; |
150 | 189 | ||
151 | /* limit format to hardware capabilities */ | 190 | /* limit format to hardware capabilities */ |
152 | return ici->ops->try_fmt(icd, f); | 191 | return soc_camera_try_fmt(icd, f); |
153 | } | 192 | } |
154 | 193 | ||
155 | static int soc_camera_enum_input(struct file *file, void *priv, | 194 | static int soc_camera_enum_input(struct file *file, void *priv, |
@@ -362,9 +401,6 @@ static void soc_camera_free_user_formats(struct soc_camera_device *icd) | |||
362 | icd->user_formats = NULL; | 401 | icd->user_formats = NULL; |
363 | } | 402 | } |
364 | 403 | ||
365 | #define pixfmtstr(x) (x) & 0xff, ((x) >> 8) & 0xff, ((x) >> 16) & 0xff, \ | ||
366 | ((x) >> 24) & 0xff | ||
367 | |||
368 | /* Called with .vb_lock held, or from the first open(2), see comment there */ | 404 | /* Called with .vb_lock held, or from the first open(2), see comment there */ |
369 | static int soc_camera_set_fmt(struct soc_camera_device *icd, | 405 | static int soc_camera_set_fmt(struct soc_camera_device *icd, |
370 | struct v4l2_format *f) | 406 | struct v4l2_format *f) |
@@ -377,7 +413,7 @@ static int soc_camera_set_fmt(struct soc_camera_device *icd, | |||
377 | pixfmtstr(pix->pixelformat), pix->width, pix->height); | 413 | pixfmtstr(pix->pixelformat), pix->width, pix->height); |
378 | 414 | ||
379 | /* We always call try_fmt() before set_fmt() or set_crop() */ | 415 | /* We always call try_fmt() before set_fmt() or set_crop() */ |
380 | ret = ici->ops->try_fmt(icd, f); | 416 | ret = soc_camera_try_fmt(icd, f); |
381 | if (ret < 0) | 417 | if (ret < 0) |
382 | return ret; | 418 | return ret; |
383 | 419 | ||
@@ -996,10 +1032,11 @@ static void soc_camera_free_i2c(struct soc_camera_device *icd) | |||
996 | { | 1032 | { |
997 | struct i2c_client *client = | 1033 | struct i2c_client *client = |
998 | to_i2c_client(to_soc_camera_control(icd)); | 1034 | to_i2c_client(to_soc_camera_control(icd)); |
1035 | struct i2c_adapter *adap = client->adapter; | ||
999 | dev_set_drvdata(&icd->dev, NULL); | 1036 | dev_set_drvdata(&icd->dev, NULL); |
1000 | v4l2_device_unregister_subdev(i2c_get_clientdata(client)); | 1037 | v4l2_device_unregister_subdev(i2c_get_clientdata(client)); |
1001 | i2c_unregister_device(client); | 1038 | i2c_unregister_device(client); |
1002 | i2c_put_adapter(client->adapter); | 1039 | i2c_put_adapter(adap); |
1003 | } | 1040 | } |
1004 | #else | 1041 | #else |
1005 | #define soc_camera_init_i2c(icd, icl) (-ENODEV) | 1042 | #define soc_camera_init_i2c(icd, icl) (-ENODEV) |
@@ -1071,6 +1108,9 @@ static int soc_camera_probe(struct device *dev) | |||
1071 | } | 1108 | } |
1072 | } | 1109 | } |
1073 | 1110 | ||
1111 | sd = soc_camera_to_subdev(icd); | ||
1112 | sd->grp_id = (long)icd; | ||
1113 | |||
1074 | /* At this point client .probe() should have run already */ | 1114 | /* At this point client .probe() should have run already */ |
1075 | ret = soc_camera_init_user_formats(icd); | 1115 | ret = soc_camera_init_user_formats(icd); |
1076 | if (ret < 0) | 1116 | if (ret < 0) |
@@ -1092,7 +1132,6 @@ static int soc_camera_probe(struct device *dev) | |||
1092 | goto evidstart; | 1132 | goto evidstart; |
1093 | 1133 | ||
1094 | /* Try to improve our guess of a reasonable window format */ | 1134 | /* Try to improve our guess of a reasonable window format */ |
1095 | sd = soc_camera_to_subdev(icd); | ||
1096 | if (!v4l2_subdev_call(sd, video, g_mbus_fmt, &mf)) { | 1135 | if (!v4l2_subdev_call(sd, video, g_mbus_fmt, &mf)) { |
1097 | icd->user_width = mf.width; | 1136 | icd->user_width = mf.width; |
1098 | icd->user_height = mf.height; | 1137 | icd->user_height = mf.height; |
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 5d4cf3b3d435..22fa8202d5ca 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c | |||
@@ -171,7 +171,7 @@ static int tda9840_probe(struct i2c_client *client, | |||
171 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 171 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
172 | client->addr << 1, client->adapter->name); | 172 | client->addr << 1, client->adapter->name); |
173 | 173 | ||
174 | sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); | 174 | sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); |
175 | if (sd == NULL) | 175 | if (sd == NULL) |
176 | return -ENOMEM; | 176 | return -ENOMEM; |
177 | v4l2_i2c_subdev_init(sd, client, &tda9840_ops); | 177 | v4l2_i2c_subdev_init(sd, client, &tda9840_ops); |
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 19621ed523ec..827425c5b866 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c | |||
@@ -152,7 +152,7 @@ static int tea6415c_probe(struct i2c_client *client, | |||
152 | 152 | ||
153 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 153 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
154 | client->addr << 1, client->adapter->name); | 154 | client->addr << 1, client->adapter->name); |
155 | sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); | 155 | sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); |
156 | if (sd == NULL) | 156 | if (sd == NULL) |
157 | return -ENOMEM; | 157 | return -ENOMEM; |
158 | v4l2_i2c_subdev_init(sd, client, &tea6415c_ops); | 158 | v4l2_i2c_subdev_init(sd, client, &tea6415c_ops); |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index 5ea840401f21..f350b6c24500 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -125,7 +125,7 @@ static int tea6420_probe(struct i2c_client *client, | |||
125 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 125 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
126 | client->addr << 1, client->adapter->name); | 126 | client->addr << 1, client->adapter->name); |
127 | 127 | ||
128 | sd = kmalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); | 128 | sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); |
129 | if (sd == NULL) | 129 | if (sd == NULL) |
130 | return -ENOMEM; | 130 | return -ENOMEM; |
131 | v4l2_i2c_subdev_init(sd, client, &tea6420_ops); | 131 | v4l2_i2c_subdev_init(sd, client, &tea6420_ops); |
diff --git a/drivers/media/video/upd64031a.c b/drivers/media/video/upd64031a.c index f8138c75be8b..1aab96a88203 100644 --- a/drivers/media/video/upd64031a.c +++ b/drivers/media/video/upd64031a.c | |||
@@ -230,7 +230,7 @@ static int upd64031a_probe(struct i2c_client *client, | |||
230 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 230 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
231 | client->addr << 1, client->adapter->name); | 231 | client->addr << 1, client->adapter->name); |
232 | 232 | ||
233 | state = kmalloc(sizeof(struct upd64031a_state), GFP_KERNEL); | 233 | state = kzalloc(sizeof(struct upd64031a_state), GFP_KERNEL); |
234 | if (state == NULL) | 234 | if (state == NULL) |
235 | return -ENOMEM; | 235 | return -ENOMEM; |
236 | sd = &state->sd; | 236 | sd = &state->sd; |
diff --git a/drivers/media/video/upd64083.c b/drivers/media/video/upd64083.c index 28e0e6b6ca84..9bbe61700fd5 100644 --- a/drivers/media/video/upd64083.c +++ b/drivers/media/video/upd64083.c | |||
@@ -202,7 +202,7 @@ static int upd64083_probe(struct i2c_client *client, | |||
202 | v4l_info(client, "chip found @ 0x%x (%s)\n", | 202 | v4l_info(client, "chip found @ 0x%x (%s)\n", |
203 | client->addr << 1, client->adapter->name); | 203 | client->addr << 1, client->adapter->name); |
204 | 204 | ||
205 | state = kmalloc(sizeof(struct upd64083_state), GFP_KERNEL); | 205 | state = kzalloc(sizeof(struct upd64083_state), GFP_KERNEL); |
206 | if (state == NULL) | 206 | if (state == NULL) |
207 | return -ENOMEM; | 207 | return -ENOMEM; |
208 | sd = &state->sd; | 208 | sd = &state->sd; |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 498e6742579e..6dc7196296b3 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -389,7 +389,8 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
389 | video_get(vdev); | 389 | video_get(vdev); |
390 | mutex_unlock(&videodev_lock); | 390 | mutex_unlock(&videodev_lock); |
391 | #if defined(CONFIG_MEDIA_CONTROLLER) | 391 | #if defined(CONFIG_MEDIA_CONTROLLER) |
392 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) { | 392 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
393 | vdev->vfl_type != VFL_TYPE_SUBDEV) { | ||
393 | entity = media_entity_get(&vdev->entity); | 394 | entity = media_entity_get(&vdev->entity); |
394 | if (!entity) { | 395 | if (!entity) { |
395 | ret = -EBUSY; | 396 | ret = -EBUSY; |
@@ -415,7 +416,8 @@ err: | |||
415 | /* decrease the refcount in case of an error */ | 416 | /* decrease the refcount in case of an error */ |
416 | if (ret) { | 417 | if (ret) { |
417 | #if defined(CONFIG_MEDIA_CONTROLLER) | 418 | #if defined(CONFIG_MEDIA_CONTROLLER) |
418 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) | 419 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
420 | vdev->vfl_type != VFL_TYPE_SUBDEV) | ||
419 | media_entity_put(entity); | 421 | media_entity_put(entity); |
420 | #endif | 422 | #endif |
421 | video_put(vdev); | 423 | video_put(vdev); |
@@ -437,7 +439,8 @@ static int v4l2_release(struct inode *inode, struct file *filp) | |||
437 | mutex_unlock(vdev->lock); | 439 | mutex_unlock(vdev->lock); |
438 | } | 440 | } |
439 | #if defined(CONFIG_MEDIA_CONTROLLER) | 441 | #if defined(CONFIG_MEDIA_CONTROLLER) |
440 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) | 442 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
443 | vdev->vfl_type != VFL_TYPE_SUBDEV) | ||
441 | media_entity_put(&vdev->entity); | 444 | media_entity_put(&vdev->entity); |
442 | #endif | 445 | #endif |
443 | /* decrease the refcount unconditionally since the release() | 446 | /* decrease the refcount unconditionally since the release() |
@@ -686,7 +689,8 @@ int __video_register_device(struct video_device *vdev, int type, int nr, | |||
686 | 689 | ||
687 | #if defined(CONFIG_MEDIA_CONTROLLER) | 690 | #if defined(CONFIG_MEDIA_CONTROLLER) |
688 | /* Part 5: Register the entity. */ | 691 | /* Part 5: Register the entity. */ |
689 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) { | 692 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
693 | vdev->vfl_type != VFL_TYPE_SUBDEV) { | ||
690 | vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L; | 694 | vdev->entity.type = MEDIA_ENT_T_DEVNODE_V4L; |
691 | vdev->entity.name = vdev->name; | 695 | vdev->entity.name = vdev->name; |
692 | vdev->entity.v4l.major = VIDEO_MAJOR; | 696 | vdev->entity.v4l.major = VIDEO_MAJOR; |
@@ -733,7 +737,8 @@ void video_unregister_device(struct video_device *vdev) | |||
733 | return; | 737 | return; |
734 | 738 | ||
735 | #if defined(CONFIG_MEDIA_CONTROLLER) | 739 | #if defined(CONFIG_MEDIA_CONTROLLER) |
736 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev) | 740 | if (vdev->v4l2_dev && vdev->v4l2_dev->mdev && |
741 | vdev->vfl_type != VFL_TYPE_SUBDEV) | ||
737 | media_device_unregister_entity(&vdev->entity); | 742 | media_device_unregister_entity(&vdev->entity); |
738 | #endif | 743 | #endif |
739 | 744 | ||
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index 5aeaf876ba9b..4aae501f02d0 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c | |||
@@ -155,8 +155,10 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, | |||
155 | sd->v4l2_dev = v4l2_dev; | 155 | sd->v4l2_dev = v4l2_dev; |
156 | if (sd->internal_ops && sd->internal_ops->registered) { | 156 | if (sd->internal_ops && sd->internal_ops->registered) { |
157 | err = sd->internal_ops->registered(sd); | 157 | err = sd->internal_ops->registered(sd); |
158 | if (err) | 158 | if (err) { |
159 | module_put(sd->owner); | ||
159 | return err; | 160 | return err; |
161 | } | ||
160 | } | 162 | } |
161 | 163 | ||
162 | /* This just returns 0 if either of the two args is NULL */ | 164 | /* This just returns 0 if either of the two args is NULL */ |
@@ -164,6 +166,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev, | |||
164 | if (err) { | 166 | if (err) { |
165 | if (sd->internal_ops && sd->internal_ops->unregistered) | 167 | if (sd->internal_ops && sd->internal_ops->unregistered) |
166 | sd->internal_ops->unregistered(sd); | 168 | sd->internal_ops->unregistered(sd); |
169 | module_put(sd->owner); | ||
167 | return err; | 170 | return err; |
168 | } | 171 | } |
169 | 172 | ||
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index 0b8064490676..812729ebf09e 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c | |||
@@ -155,25 +155,25 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
155 | 155 | ||
156 | switch (cmd) { | 156 | switch (cmd) { |
157 | case VIDIOC_QUERYCTRL: | 157 | case VIDIOC_QUERYCTRL: |
158 | return v4l2_subdev_queryctrl(sd, arg); | 158 | return v4l2_queryctrl(sd->ctrl_handler, arg); |
159 | 159 | ||
160 | case VIDIOC_QUERYMENU: | 160 | case VIDIOC_QUERYMENU: |
161 | return v4l2_subdev_querymenu(sd, arg); | 161 | return v4l2_querymenu(sd->ctrl_handler, arg); |
162 | 162 | ||
163 | case VIDIOC_G_CTRL: | 163 | case VIDIOC_G_CTRL: |
164 | return v4l2_subdev_g_ctrl(sd, arg); | 164 | return v4l2_g_ctrl(sd->ctrl_handler, arg); |
165 | 165 | ||
166 | case VIDIOC_S_CTRL: | 166 | case VIDIOC_S_CTRL: |
167 | return v4l2_subdev_s_ctrl(sd, arg); | 167 | return v4l2_s_ctrl(sd->ctrl_handler, arg); |
168 | 168 | ||
169 | case VIDIOC_G_EXT_CTRLS: | 169 | case VIDIOC_G_EXT_CTRLS: |
170 | return v4l2_subdev_g_ext_ctrls(sd, arg); | 170 | return v4l2_g_ext_ctrls(sd->ctrl_handler, arg); |
171 | 171 | ||
172 | case VIDIOC_S_EXT_CTRLS: | 172 | case VIDIOC_S_EXT_CTRLS: |
173 | return v4l2_subdev_s_ext_ctrls(sd, arg); | 173 | return v4l2_s_ext_ctrls(sd->ctrl_handler, arg); |
174 | 174 | ||
175 | case VIDIOC_TRY_EXT_CTRLS: | 175 | case VIDIOC_TRY_EXT_CTRLS: |
176 | return v4l2_subdev_try_ext_ctrls(sd, arg); | 176 | return v4l2_try_ext_ctrls(sd->ctrl_handler, arg); |
177 | 177 | ||
178 | case VIDIOC_DQEVENT: | 178 | case VIDIOC_DQEVENT: |
179 | if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) | 179 | if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) |
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c index c4742fc15529..c9691115f2d2 100644 --- a/drivers/media/video/videobuf-dma-contig.c +++ b/drivers/media/video/videobuf-dma-contig.c | |||
@@ -300,7 +300,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
300 | 300 | ||
301 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 301 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
302 | retval = remap_pfn_range(vma, vma->vm_start, | 302 | retval = remap_pfn_range(vma, vma->vm_start, |
303 | PFN_DOWN(virt_to_phys(mem->vaddr)), | 303 | mem->dma_handle >> PAGE_SHIFT, |
304 | size, vma->vm_page_prot); | 304 | size, vma->vm_page_prot); |
305 | if (retval) { | 305 | if (retval) { |
306 | dev_err(q->dev, "mmap: remap failed with error %d. ", retval); | 306 | dev_err(q->dev, "mmap: remap failed with error %d. ", retval); |
diff --git a/drivers/media/video/videobuf2-core.c b/drivers/media/video/videobuf2-core.c index 6698c77e0f64..6ba1461d51ef 100644 --- a/drivers/media/video/videobuf2-core.c +++ b/drivers/media/video/videobuf2-core.c | |||
@@ -37,6 +37,9 @@ module_param(debug, int, 0644); | |||
37 | #define call_qop(q, op, args...) \ | 37 | #define call_qop(q, op, args...) \ |
38 | (((q)->ops->op) ? ((q)->ops->op(args)) : 0) | 38 | (((q)->ops->op) ? ((q)->ops->op(args)) : 0) |
39 | 39 | ||
40 | #define V4L2_BUFFER_STATE_FLAGS (V4L2_BUF_FLAG_MAPPED | V4L2_BUF_FLAG_QUEUED | \ | ||
41 | V4L2_BUF_FLAG_DONE | V4L2_BUF_FLAG_ERROR) | ||
42 | |||
40 | /** | 43 | /** |
41 | * __vb2_buf_mem_alloc() - allocate video memory for the given buffer | 44 | * __vb2_buf_mem_alloc() - allocate video memory for the given buffer |
42 | */ | 45 | */ |
@@ -51,7 +54,7 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb, | |||
51 | for (plane = 0; plane < vb->num_planes; ++plane) { | 54 | for (plane = 0; plane < vb->num_planes; ++plane) { |
52 | mem_priv = call_memop(q, plane, alloc, q->alloc_ctx[plane], | 55 | mem_priv = call_memop(q, plane, alloc, q->alloc_ctx[plane], |
53 | plane_sizes[plane]); | 56 | plane_sizes[plane]); |
54 | if (!mem_priv) | 57 | if (IS_ERR_OR_NULL(mem_priv)) |
55 | goto free; | 58 | goto free; |
56 | 59 | ||
57 | /* Associate allocator private data with this plane */ | 60 | /* Associate allocator private data with this plane */ |
@@ -284,7 +287,7 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) | |||
284 | struct vb2_queue *q = vb->vb2_queue; | 287 | struct vb2_queue *q = vb->vb2_queue; |
285 | int ret = 0; | 288 | int ret = 0; |
286 | 289 | ||
287 | /* Copy back data such as timestamp, input, etc. */ | 290 | /* Copy back data such as timestamp, flags, input, etc. */ |
288 | memcpy(b, &vb->v4l2_buf, offsetof(struct v4l2_buffer, m)); | 291 | memcpy(b, &vb->v4l2_buf, offsetof(struct v4l2_buffer, m)); |
289 | b->input = vb->v4l2_buf.input; | 292 | b->input = vb->v4l2_buf.input; |
290 | b->reserved = vb->v4l2_buf.reserved; | 293 | b->reserved = vb->v4l2_buf.reserved; |
@@ -313,7 +316,10 @@ static int __fill_v4l2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b) | |||
313 | b->m.userptr = vb->v4l2_planes[0].m.userptr; | 316 | b->m.userptr = vb->v4l2_planes[0].m.userptr; |
314 | } | 317 | } |
315 | 318 | ||
316 | b->flags = 0; | 319 | /* |
320 | * Clear any buffer state related flags. | ||
321 | */ | ||
322 | b->flags &= ~V4L2_BUFFER_STATE_FLAGS; | ||
317 | 323 | ||
318 | switch (vb->state) { | 324 | switch (vb->state) { |
319 | case VB2_BUF_STATE_QUEUED: | 325 | case VB2_BUF_STATE_QUEUED: |
@@ -519,6 +525,7 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
519 | num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME); | 525 | num_buffers = min_t(unsigned int, req->count, VIDEO_MAX_FRAME); |
520 | memset(plane_sizes, 0, sizeof(plane_sizes)); | 526 | memset(plane_sizes, 0, sizeof(plane_sizes)); |
521 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); | 527 | memset(q->alloc_ctx, 0, sizeof(q->alloc_ctx)); |
528 | q->memory = req->memory; | ||
522 | 529 | ||
523 | /* | 530 | /* |
524 | * Ask the driver how many buffers and planes per buffer it requires. | 531 | * Ask the driver how many buffers and planes per buffer it requires. |
@@ -560,8 +567,6 @@ int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req) | |||
560 | ret = num_buffers; | 567 | ret = num_buffers; |
561 | } | 568 | } |
562 | 569 | ||
563 | q->memory = req->memory; | ||
564 | |||
565 | /* | 570 | /* |
566 | * Return the number of successfully allocated buffers | 571 | * Return the number of successfully allocated buffers |
567 | * to the userspace. | 572 | * to the userspace. |
@@ -715,6 +720,8 @@ static int __fill_vb2_buffer(struct vb2_buffer *vb, struct v4l2_buffer *b, | |||
715 | 720 | ||
716 | vb->v4l2_buf.field = b->field; | 721 | vb->v4l2_buf.field = b->field; |
717 | vb->v4l2_buf.timestamp = b->timestamp; | 722 | vb->v4l2_buf.timestamp = b->timestamp; |
723 | vb->v4l2_buf.input = b->input; | ||
724 | vb->v4l2_buf.flags = b->flags & ~V4L2_BUFFER_STATE_FLAGS; | ||
718 | 725 | ||
719 | return 0; | 726 | return 0; |
720 | } | 727 | } |
diff --git a/drivers/media/video/videobuf2-dma-contig.c b/drivers/media/video/videobuf2-dma-contig.c index 58205d596138..a790a5f8c06f 100644 --- a/drivers/media/video/videobuf2-dma-contig.c +++ b/drivers/media/video/videobuf2-dma-contig.c | |||
@@ -46,7 +46,7 @@ static void *vb2_dma_contig_alloc(void *alloc_ctx, unsigned long size) | |||
46 | GFP_KERNEL); | 46 | GFP_KERNEL); |
47 | if (!buf->vaddr) { | 47 | if (!buf->vaddr) { |
48 | dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", | 48 | dev_err(conf->dev, "dma_alloc_coherent of size %ld failed\n", |
49 | buf->size); | 49 | size); |
50 | kfree(buf); | 50 | kfree(buf); |
51 | return ERR_PTR(-ENOMEM); | 51 | return ERR_PTR(-ENOMEM); |
52 | } | 52 | } |