aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-03-11 14:02:14 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-03-31 13:50:38 -0400
commit2e208c64e3aa7abe7b79963bb29f5d14a4b96e58 (patch)
tree314387e26c8082356f23d1d8152918a596ed6b2f
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
[media] au0828: disable tuner links and cache tuner/decoder
For au0828_enable_source() to work, the tuner links should be disabled and the tuner/decoder should be cached at au0828 struct. While here, put dev->decoder cache together with dev->tuner, as it makes easier to drop both latter if/when we move the enable routines to the V4L2 core. Fixes: 9822f4173f84 ('[media] au0828: use v4l2_mc_create_media_graph()') Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Tested-by: Shuah Khan <shuahkh@osg.samsung.com>
-rw-r--r--drivers/media/usb/au0828/au0828-cards.c4
-rw-r--r--drivers/media/usb/au0828/au0828-core.c42
2 files changed, 27 insertions, 19 deletions
diff --git a/drivers/media/usb/au0828/au0828-cards.c b/drivers/media/usb/au0828/au0828-cards.c
index ca861aea68a5..6b469e8c4c6e 100644
--- a/drivers/media/usb/au0828/au0828-cards.c
+++ b/drivers/media/usb/au0828/au0828-cards.c
@@ -228,10 +228,6 @@ void au0828_card_analog_fe_setup(struct au0828_dev *dev)
228 "au8522", 0x8e >> 1, NULL); 228 "au8522", 0x8e >> 1, NULL);
229 if (sd == NULL) 229 if (sd == NULL)
230 pr_err("analog subdev registration failed\n"); 230 pr_err("analog subdev registration failed\n");
231#ifdef CONFIG_MEDIA_CONTROLLER
232 if (sd)
233 dev->decoder = &sd->entity;
234#endif
235 } 231 }
236 232
237 /* Setup tuners */ 233 /* Setup tuners */
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index 5dc82e8c8670..ecfa18939663 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -456,7 +456,8 @@ static int au0828_media_device_register(struct au0828_dev *dev,
456{ 456{
457#ifdef CONFIG_MEDIA_CONTROLLER 457#ifdef CONFIG_MEDIA_CONTROLLER
458 int ret; 458 int ret;
459 struct media_entity *entity, *demod = NULL, *tuner = NULL; 459 struct media_entity *entity, *demod = NULL;
460 struct media_link *link;
460 461
461 if (!dev->media_dev) 462 if (!dev->media_dev)
462 return 0; 463 return 0;
@@ -482,26 +483,37 @@ static int au0828_media_device_register(struct au0828_dev *dev,
482 } 483 }
483 484
484 /* 485 /*
485 * Find tuner and demod to disable the link between 486 * Find tuner, decoder and demod.
486 * the two to avoid disable step when tuner is requested 487 *
487 * by video or audio. Note that this step can't be done 488 * The tuner and decoder should be cached, as they'll be used by
488 * until dvb graph is created during dvb register. 489 * au0828_enable_source.
490 *
491 * It also needs to disable the link between tuner and
492 * decoder/demod, to avoid disable step when tuner is requested
493 * by video or audio. Note that this step can't be done until dvb
494 * graph is created during dvb register.
489 */ 495 */
490 media_device_for_each_entity(entity, dev->media_dev) { 496 media_device_for_each_entity(entity, dev->media_dev) {
491 if (entity->function == MEDIA_ENT_F_DTV_DEMOD) 497 switch (entity->function) {
498 case MEDIA_ENT_F_TUNER:
499 dev->tuner = entity;
500 break;
501 case MEDIA_ENT_F_ATV_DECODER:
502 dev->decoder = entity;
503 break;
504 case MEDIA_ENT_F_DTV_DEMOD:
492 demod = entity; 505 demod = entity;
493 else if (entity->function == MEDIA_ENT_F_TUNER) 506 break;
494 tuner = entity; 507 }
495 } 508 }
496 /* Disable link between tuner and demod */
497 if (tuner && demod) {
498 struct media_link *link;
499 509
500 list_for_each_entry(link, &demod->links, list) { 510 /* Disable link between tuner->demod and/or tuner->decoder */
501 if (link->sink->entity == demod && 511 if (dev->tuner) {
502 link->source->entity == tuner) { 512 list_for_each_entry(link, &dev->tuner->links, list) {
513 if (demod && link->sink->entity == demod)
514 media_entity_setup_link(link, 0);
515 if (dev->decoder && link->sink->entity == dev->decoder)
503 media_entity_setup_link(link, 0); 516 media_entity_setup_link(link, 0);
504 }
505 } 517 }
506 } 518 }
507 519