Commit 0158e7b6 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] au0828: Cache the decoder info at au0828 dev structure

Instead of seeking for the decoder every time analog stream is
started, cache it. This simplifies the code a little bit.
Requested-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent bed69196
...@@ -228,6 +228,10 @@ void au0828_card_analog_fe_setup(struct au0828_dev *dev) ...@@ -228,6 +228,10 @@ void au0828_card_analog_fe_setup(struct au0828_dev *dev)
"au8522", 0x8e >> 1, NULL); "au8522", 0x8e >> 1, NULL);
if (sd == NULL) if (sd == NULL)
pr_err("analog subdev registration failed\n"); pr_err("analog subdev registration failed\n");
#ifdef CONFIG_MEDIA_CONTROLLER
if (sd)
dev->decoder = &sd->entity;
#endif
} }
/* Setup tuners */ /* Setup tuners */
......
...@@ -642,11 +642,11 @@ static int au0828_enable_analog_tuner(struct au0828_dev *dev) ...@@ -642,11 +642,11 @@ static int au0828_enable_analog_tuner(struct au0828_dev *dev)
{ {
#ifdef CONFIG_MEDIA_CONTROLLER #ifdef CONFIG_MEDIA_CONTROLLER
struct media_device *mdev = dev->media_dev; struct media_device *mdev = dev->media_dev;
struct media_entity *entity, *decoder = NULL, *source; struct media_entity *entity, *source;
struct media_link *link, *found_link = NULL; struct media_link *link, *found_link = NULL;
int i, ret, active_links = 0; int i, ret, active_links = 0;
if (!mdev) if (!mdev || !dev->decoder)
return 0; return 0;
/* /*
...@@ -656,18 +656,9 @@ static int au0828_enable_analog_tuner(struct au0828_dev *dev) ...@@ -656,18 +656,9 @@ static int au0828_enable_analog_tuner(struct au0828_dev *dev)
* do DVB streaming while the DMA engine is being used for V4L2, * do DVB streaming while the DMA engine is being used for V4L2,
* this should be enough for the actual needs. * this should be enough for the actual needs.
*/ */
media_device_for_each_entity(entity, mdev) { for (i = 0; i < dev->decoder->num_links; i++) {
if (entity->type == MEDIA_ENT_T_V4L2_SUBDEV_DECODER) { link = &dev->decoder->links[i];
decoder = entity; if (link->sink->entity == dev->decoder) {
break;
}
}
if (!decoder)
return 0;
for (i = 0; i < decoder->num_links; i++) {
link = &decoder->links[i];
if (link->sink->entity == decoder) {
found_link = link; found_link = link;
if (link->flags & MEDIA_LNK_FL_ENABLED) if (link->flags & MEDIA_LNK_FL_ENABLED)
active_links++; active_links++;
......
...@@ -281,6 +281,7 @@ struct au0828_dev { ...@@ -281,6 +281,7 @@ struct au0828_dev {
#ifdef CONFIG_MEDIA_CONTROLLER #ifdef CONFIG_MEDIA_CONTROLLER
struct media_device *media_dev; struct media_device *media_dev;
struct media_pad video_pad, vbi_pad; struct media_pad video_pad, vbi_pad;
struct media_entity *decoder;
#endif #endif
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment