* [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder
@ 2016-03-11 15:55 Mauro Carvalho Chehab
2016-03-11 15:55 ` [PATCH 2/2] [media] v4l2-mc: cleanup a warning Mauro Carvalho Chehab
2016-03-11 16:27 ` [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder Shuah Khan
0 siblings, 2 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-11 15:55 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Shuah Khan,
Hans Verkuil, Rafael Lourenço de Lima Chehab,
Javier Martinez Canillas
For au0828_enable_source() to work, the tuner links should be
disabled and the tuner/decoder should be cached at au0828 struct.
Fixes: 9822f4173f84 ('[media] au0828: use v4l2_mc_create_media_graph()')
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
drivers/media/usb/au0828/au0828-core.c | 42 ++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 15 deletions(-)
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,
{
#ifdef CONFIG_MEDIA_CONTROLLER
int ret;
- struct media_entity *entity, *demod = NULL, *tuner = NULL;
+ struct media_entity *entity, *demod = NULL;
+ struct media_link *link;
if (!dev->media_dev)
return 0;
@@ -482,26 +483,37 @@ static int au0828_media_device_register(struct au0828_dev *dev,
}
/*
- * Find tuner and demod to disable the link between
- * the two to avoid disable step when tuner is requested
- * by video or audio. Note that this step can't be done
- * until dvb graph is created during dvb register.
+ * Find tuner, decoder and demod.
+ *
+ * The tuner and decoder should be cached, as they'll be used by
+ * au0828_enable_source.
+ *
+ * It also needs to disable the link between tuner and
+ * decoder/demod, to avoid disable step when tuner is requested
+ * by video or audio. Note that this step can't be done until dvb
+ * graph is created during dvb register.
*/
media_device_for_each_entity(entity, dev->media_dev) {
- if (entity->function == MEDIA_ENT_F_DTV_DEMOD)
+ switch (entity->function) {
+ case MEDIA_ENT_F_TUNER:
+ dev->tuner = entity;
+ break;
+ case MEDIA_ENT_F_ATV_DECODER:
+ dev->decoder = entity;
+ break;
+ case MEDIA_ENT_F_DTV_DEMOD:
demod = entity;
- else if (entity->function == MEDIA_ENT_F_TUNER)
- tuner = entity;
+ break;
+ }
}
- /* Disable link between tuner and demod */
- if (tuner && demod) {
- struct media_link *link;
- list_for_each_entry(link, &demod->links, list) {
- if (link->sink->entity == demod &&
- link->source->entity == tuner) {
+ /* Disable link between tuner->demod and/or tuner->decoder */
+ if (dev->tuner) {
+ list_for_each_entry(link, &dev->tuner->links, list) {
+ if (demod && link->sink->entity == demod)
+ media_entity_setup_link(link, 0);
+ if (dev->decoder && link->sink->entity == dev->decoder)
media_entity_setup_link(link, 0);
- }
}
}
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] [media] v4l2-mc: cleanup a warning
2016-03-11 15:55 [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder Mauro Carvalho Chehab
@ 2016-03-11 15:55 ` Mauro Carvalho Chehab
2016-03-11 16:27 ` [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder Shuah Khan
1 sibling, 0 replies; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-11 15:55 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Shuah Khan, Sakari Ailus
A previous patch removing dtv_demod needed to be rebased,
but the hunk removing the data was not merged by mistake.
Fixes: 840f5b0572ea ('media: au0828 disable tuner to demod link in au0828_media_device_register()']
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
drivers/media/v4l2-core/v4l2-mc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c
index 2a7b79bc90fd..2228cd3a846e 100644
--- a/drivers/media/v4l2-core/v4l2-mc.c
+++ b/drivers/media/v4l2-core/v4l2-mc.c
@@ -34,7 +34,7 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)
{
struct media_entity *entity;
struct media_entity *if_vid = NULL, *if_aud = NULL;
- struct media_entity *tuner = NULL, *decoder = NULL, *dtv_demod = NULL;
+ struct media_entity *tuner = NULL, *decoder = NULL;
struct media_entity *io_v4l = NULL, *io_vbi = NULL, *io_swradio = NULL;
bool is_webcam = false;
u32 flags;
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder
2016-03-11 15:55 [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder Mauro Carvalho Chehab
2016-03-11 15:55 ` [PATCH 2/2] [media] v4l2-mc: cleanup a warning Mauro Carvalho Chehab
@ 2016-03-11 16:27 ` Shuah Khan
2016-03-11 16:34 ` Mauro Carvalho Chehab
1 sibling, 1 reply; 8+ messages in thread
From: Shuah Khan @ 2016-03-11 16:27 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Hans Verkuil,
Rafael Lourenço de Lima Chehab, Javier Martinez Canillas,
Shuah Khan
On 03/11/2016 08:55 AM, Mauro Carvalho Chehab wrote:
> For au0828_enable_source() to work, the tuner links should be
> disabled and the tuner/decoder should be cached at au0828 struct.
hmm. are you sure about needing to cache decoder in au0828 struct.
It gets cached in au0828_card_analog_fe_setup() which is called
from au0828_card_setup() - this step happens before
au0828_media_device_register()
#ifdef CONFIG_MEDIA_CONTROLLER
if (sd)
dev->decoder = &sd->entity;
#endif
thanks,
-- Shuah
>
> Fixes: 9822f4173f84 ('[media] au0828: use v4l2_mc_create_media_graph()')
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> ---
> drivers/media/usb/au0828/au0828-core.c | 42 ++++++++++++++++++++++------------
> 1 file changed, 27 insertions(+), 15 deletions(-)
>
> 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,
> {
> #ifdef CONFIG_MEDIA_CONTROLLER
> int ret;
> - struct media_entity *entity, *demod = NULL, *tuner = NULL;
> + struct media_entity *entity, *demod = NULL;
> + struct media_link *link;
>
> if (!dev->media_dev)
> return 0;
> @@ -482,26 +483,37 @@ static int au0828_media_device_register(struct au0828_dev *dev,
> }
>
> /*
> - * Find tuner and demod to disable the link between
> - * the two to avoid disable step when tuner is requested
> - * by video or audio. Note that this step can't be done
> - * until dvb graph is created during dvb register.
> + * Find tuner, decoder and demod.
> + *
> + * The tuner and decoder should be cached, as they'll be used by
> + * au0828_enable_source.
> + *
> + * It also needs to disable the link between tuner and
> + * decoder/demod, to avoid disable step when tuner is requested
> + * by video or audio. Note that this step can't be done until dvb
> + * graph is created during dvb register.
> */
> media_device_for_each_entity(entity, dev->media_dev) {
> - if (entity->function == MEDIA_ENT_F_DTV_DEMOD)
> + switch (entity->function) {
> + case MEDIA_ENT_F_TUNER:
> + dev->tuner = entity;
> + break;
> + case MEDIA_ENT_F_ATV_DECODER:
> + dev->decoder = entity;
> + break;
> + case MEDIA_ENT_F_DTV_DEMOD:
> demod = entity;
> - else if (entity->function == MEDIA_ENT_F_TUNER)
> - tuner = entity;
> + break;
> + }
> }
> - /* Disable link between tuner and demod */
> - if (tuner && demod) {
> - struct media_link *link;
>
> - list_for_each_entry(link, &demod->links, list) {
> - if (link->sink->entity == demod &&
> - link->source->entity == tuner) {
> + /* Disable link between tuner->demod and/or tuner->decoder */
> + if (dev->tuner) {
> + list_for_each_entry(link, &dev->tuner->links, list) {
> + if (demod && link->sink->entity == demod)
> + media_entity_setup_link(link, 0);
> + if (dev->decoder && link->sink->entity == dev->decoder)
> media_entity_setup_link(link, 0);
> - }
> }
> }
>
>
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder
2016-03-11 16:27 ` [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder Shuah Khan
@ 2016-03-11 16:34 ` Mauro Carvalho Chehab
2016-03-11 16:52 ` Shuah Khan
0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-11 16:34 UTC (permalink / raw)
To: Shuah Khan
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Hans Verkuil,
Rafael Lourenço de Lima Chehab, Javier Martinez Canillas
Em Fri, 11 Mar 2016 09:27:40 -0700
Shuah Khan <shuahkh@osg.samsung.com> escreveu:
> On 03/11/2016 08:55 AM, Mauro Carvalho Chehab wrote:
> > For au0828_enable_source() to work, the tuner links should be
> > disabled and the tuner/decoder should be cached at au0828 struct.
>
> hmm. are you sure about needing to cache decoder in au0828 struct.
> It gets cached in au0828_card_analog_fe_setup() which is called
> from au0828_card_setup() - this step happens before
> au0828_media_device_register()
>
> #ifdef CONFIG_MEDIA_CONTROLLER
> if (sd)
> dev->decoder = &sd->entity;
> #endif
I haven't check it. Yet, I guess the best would be to put those
caches all at au0828_media_device_register(). This way, it would be
easier to remember removing them, once we move au0828_enable_source
to the core.
(my plan is to take a look on it after the merge window, doing some
tests on more complex drivers, like em28xx and saa7134).
Regards,
Mauro
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder
2016-03-11 16:34 ` Mauro Carvalho Chehab
@ 2016-03-11 16:52 ` Shuah Khan
2016-03-11 16:55 ` Shuah Khan
2016-03-11 19:02 ` [PATCH 1/2 v2] " Mauro Carvalho Chehab
0 siblings, 2 replies; 8+ messages in thread
From: Shuah Khan @ 2016-03-11 16:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Hans Verkuil,
Rafael Lourenço de Lima Chehab, Javier Martinez Canillas,
Shuah Khan
On 03/11/2016 09:34 AM, Mauro Carvalho Chehab wrote:
> Em Fri, 11 Mar 2016 09:27:40 -0700
> Shuah Khan <shuahkh@osg.samsung.com> escreveu:
>
>> On 03/11/2016 08:55 AM, Mauro Carvalho Chehab wrote:
>>> For au0828_enable_source() to work, the tuner links should be
>>> disabled and the tuner/decoder should be cached at au0828 struct.
>>
>> hmm. are you sure about needing to cache decoder in au0828 struct.
>> It gets cached in au0828_card_analog_fe_setup() which is called
>> from au0828_card_setup() - this step happens before
>> au0828_media_device_register()
>>
>> #ifdef CONFIG_MEDIA_CONTROLLER
>> if (sd)
>> dev->decoder = &sd->entity;
>> #endif
>
> I haven't check it. Yet, I guess the best would be to put those
> caches all at au0828_media_device_register(). This way, it would be
> easier to remember removing them, once we move au0828_enable_source
> to the core.
Yes. Consolidating caches in one place is a good idea. One thing we
have to keep in mind when we do that is the !MEDIA_CONTROLLER cases.
The above cached value could be used even when MEDIA_CONTROLLER isn't
enabled.
>
> (my plan is to take a look on it after the merge window, doing some
> tests on more complex drivers, like em28xx and saa7134).
Sounds good.
thanks,
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder
2016-03-11 16:52 ` Shuah Khan
@ 2016-03-11 16:55 ` Shuah Khan
2016-03-11 19:02 ` [PATCH 1/2 v2] " Mauro Carvalho Chehab
1 sibling, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2016-03-11 16:55 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, Hans Verkuil,
Rafael Lourenço de Lima Chehab, Javier Martinez Canillas,
Shuah Khan
On 03/11/2016 09:52 AM, Shuah Khan wrote:
> On 03/11/2016 09:34 AM, Mauro Carvalho Chehab wrote:
>> Em Fri, 11 Mar 2016 09:27:40 -0700
>> Shuah Khan <shuahkh@osg.samsung.com> escreveu:
>>
>>> On 03/11/2016 08:55 AM, Mauro Carvalho Chehab wrote:
>>>> For au0828_enable_source() to work, the tuner links should be
>>>> disabled and the tuner/decoder should be cached at au0828 struct.
>>>
>>> hmm. are you sure about needing to cache decoder in au0828 struct.
>>> It gets cached in au0828_card_analog_fe_setup() which is called
>>> from au0828_card_setup() - this step happens before
>>> au0828_media_device_register()
>>>
>>> #ifdef CONFIG_MEDIA_CONTROLLER
>>> if (sd)
>>> dev->decoder = &sd->entity;
>>> #endif
>>
>> I haven't check it. Yet, I guess the best would be to put those
>> caches all at au0828_media_device_register(). This way, it would be
>> easier to remember removing them, once we move au0828_enable_source
>> to the core.
>
> Yes. Consolidating caches in one place is a good idea. One thing we
> have to keep in mind when we do that is the !MEDIA_CONTROLLER cases.
> The above cached value could be used even when MEDIA_CONTROLLER isn't
> enabled.
Never mind - the second comment isn't valid! We are setting this
in ifdef CONFIG_MEDIA_CONTROLLER :)
thanks,
-- Shuah
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2 v2] [media] au0828: disable tuner links and cache tuner/decoder
2016-03-11 16:52 ` Shuah Khan
2016-03-11 16:55 ` Shuah Khan
@ 2016-03-11 19:02 ` Mauro Carvalho Chehab
2016-03-12 23:52 ` Shuah Khan
1 sibling, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-11 19:02 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Hans Verkuil,
Rafael Lourenço de Lima Chehab, Shuah Khan,
Javier Martinez Canillas
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>
---
drivers/media/usb/au0828/au0828-cards.c | 4 ----
drivers/media/usb/au0828/au0828-core.c | 42 +++++++++++++++++++++------------
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)
"au8522", 0x8e >> 1, NULL);
if (sd == NULL)
pr_err("analog subdev registration failed\n");
-#ifdef CONFIG_MEDIA_CONTROLLER
- if (sd)
- dev->decoder = &sd->entity;
-#endif
}
/* 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,
{
#ifdef CONFIG_MEDIA_CONTROLLER
int ret;
- struct media_entity *entity, *demod = NULL, *tuner = NULL;
+ struct media_entity *entity, *demod = NULL;
+ struct media_link *link;
if (!dev->media_dev)
return 0;
@@ -482,26 +483,37 @@ static int au0828_media_device_register(struct au0828_dev *dev,
}
/*
- * Find tuner and demod to disable the link between
- * the two to avoid disable step when tuner is requested
- * by video or audio. Note that this step can't be done
- * until dvb graph is created during dvb register.
+ * Find tuner, decoder and demod.
+ *
+ * The tuner and decoder should be cached, as they'll be used by
+ * au0828_enable_source.
+ *
+ * It also needs to disable the link between tuner and
+ * decoder/demod, to avoid disable step when tuner is requested
+ * by video or audio. Note that this step can't be done until dvb
+ * graph is created during dvb register.
*/
media_device_for_each_entity(entity, dev->media_dev) {
- if (entity->function == MEDIA_ENT_F_DTV_DEMOD)
+ switch (entity->function) {
+ case MEDIA_ENT_F_TUNER:
+ dev->tuner = entity;
+ break;
+ case MEDIA_ENT_F_ATV_DECODER:
+ dev->decoder = entity;
+ break;
+ case MEDIA_ENT_F_DTV_DEMOD:
demod = entity;
- else if (entity->function == MEDIA_ENT_F_TUNER)
- tuner = entity;
+ break;
+ }
}
- /* Disable link between tuner and demod */
- if (tuner && demod) {
- struct media_link *link;
- list_for_each_entry(link, &demod->links, list) {
- if (link->sink->entity == demod &&
- link->source->entity == tuner) {
+ /* Disable link between tuner->demod and/or tuner->decoder */
+ if (dev->tuner) {
+ list_for_each_entry(link, &dev->tuner->links, list) {
+ if (demod && link->sink->entity == demod)
+ media_entity_setup_link(link, 0);
+ if (dev->decoder && link->sink->entity == dev->decoder)
media_entity_setup_link(link, 0);
- }
}
}
--
2.5.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2 v2] [media] au0828: disable tuner links and cache tuner/decoder
2016-03-11 19:02 ` [PATCH 1/2 v2] " Mauro Carvalho Chehab
@ 2016-03-12 23:52 ` Shuah Khan
0 siblings, 0 replies; 8+ messages in thread
From: Shuah Khan @ 2016-03-12 23:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Hans Verkuil,
Rafael Lourenço de Lima Chehab, Javier Martinez Canillas,
Shuah Khan
On 03/11/2016 12:02 PM, Mauro Carvalho Chehab wrote:
> 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>
Thanks for chasing this down. Looking good. I tested it applying
it to the latest media_tree git with this top commit:
commit 840f5b0572ea9ddaca2bf5540a171013e92c97bd
Author: Shuah Khan <shuahkh@osg.samsung.com>
Date: Wed Mar 9 19:15:38 2016 -0700
media: au0828 disable tuner to demod link in au0828_media_device_register()
I ran though my basic and mutual exclusion test cases and graphs
look correct at every stage.
Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com>
Tested-by: Shuah Khan <shuahkh@osg.samsung.com>
thanks,
-- Shuah
> ---
> drivers/media/usb/au0828/au0828-cards.c | 4 ----
> drivers/media/usb/au0828/au0828-core.c | 42 +++++++++++++++++++++------------
> 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)
> "au8522", 0x8e >> 1, NULL);
> if (sd == NULL)
> pr_err("analog subdev registration failed\n");
> -#ifdef CONFIG_MEDIA_CONTROLLER
> - if (sd)
> - dev->decoder = &sd->entity;
> -#endif
> }
>
> /* 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,
> {
> #ifdef CONFIG_MEDIA_CONTROLLER
> int ret;
> - struct media_entity *entity, *demod = NULL, *tuner = NULL;
> + struct media_entity *entity, *demod = NULL;
> + struct media_link *link;
>
> if (!dev->media_dev)
> return 0;
> @@ -482,26 +483,37 @@ static int au0828_media_device_register(struct au0828_dev *dev,
> }
>
> /*
> - * Find tuner and demod to disable the link between
> - * the two to avoid disable step when tuner is requested
> - * by video or audio. Note that this step can't be done
> - * until dvb graph is created during dvb register.
> + * Find tuner, decoder and demod.
> + *
> + * The tuner and decoder should be cached, as they'll be used by
> + * au0828_enable_source.
> + *
> + * It also needs to disable the link between tuner and
> + * decoder/demod, to avoid disable step when tuner is requested
> + * by video or audio. Note that this step can't be done until dvb
> + * graph is created during dvb register.
> */
> media_device_for_each_entity(entity, dev->media_dev) {
> - if (entity->function == MEDIA_ENT_F_DTV_DEMOD)
> + switch (entity->function) {
> + case MEDIA_ENT_F_TUNER:
> + dev->tuner = entity;
> + break;
> + case MEDIA_ENT_F_ATV_DECODER:
> + dev->decoder = entity;
> + break;
> + case MEDIA_ENT_F_DTV_DEMOD:
> demod = entity;
> - else if (entity->function == MEDIA_ENT_F_TUNER)
> - tuner = entity;
> + break;
> + }
> }
> - /* Disable link between tuner and demod */
> - if (tuner && demod) {
> - struct media_link *link;
>
> - list_for_each_entry(link, &demod->links, list) {
> - if (link->sink->entity == demod &&
> - link->source->entity == tuner) {
> + /* Disable link between tuner->demod and/or tuner->decoder */
> + if (dev->tuner) {
> + list_for_each_entry(link, &dev->tuner->links, list) {
> + if (demod && link->sink->entity == demod)
> + media_entity_setup_link(link, 0);
> + if (dev->decoder && link->sink->entity == dev->decoder)
> media_entity_setup_link(link, 0);
> - }
> }
> }
>
>
--
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shuahkh@osg.samsung.com | (970) 217-8978
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-03-12 23:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-11 15:55 [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder Mauro Carvalho Chehab
2016-03-11 15:55 ` [PATCH 2/2] [media] v4l2-mc: cleanup a warning Mauro Carvalho Chehab
2016-03-11 16:27 ` [PATCH 1/2] [media] au0828: disable tuner links and cache tuner/decoder Shuah Khan
2016-03-11 16:34 ` Mauro Carvalho Chehab
2016-03-11 16:52 ` Shuah Khan
2016-03-11 16:55 ` Shuah Khan
2016-03-11 19:02 ` [PATCH 1/2 v2] " Mauro Carvalho Chehab
2016-03-12 23:52 ` Shuah Khan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.