* [PATCH 1/2] [media] au0828: use standard demod pads struct
2016-03-02 14:16 [PATCH 0/2] Don't duplicate a function to create graph on au0828 Mauro Carvalho Chehab
@ 2016-03-02 14:16 ` Mauro Carvalho Chehab
2016-03-02 15:34 ` kbuild test robot
2016-03-02 14:16 ` [PATCH 2/2] [media] au0828: use v4l2_mc_create_media_graph() Mauro Carvalho Chehab
2016-03-02 16:39 ` [PATCH v2 1/2] [media] au0828: use standard demod pads struct Mauro Carvalho Chehab
2 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-02 14:16 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Shuah Khan,
Arnd Bergmann, Krzysztof Kozlowski, Hans Verkuil, Sakari Ailus,
Laurent Pinchart, Rafael Lourenço de Lima Chehab,
Stefan Richter, Javier Martinez Canillas, Geunyoung Kim,
Seung-Woo Kim, Junghak Sung, Lad, Prabhakar
As we want au0828 to use the core function to create the MC
graphs, use enum demod_pad_index instead of
enum au8522_media_pads.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
drivers/media/dvb-frontends/au8522.h | 9 ---------
drivers/media/dvb-frontends/au8522_decoder.c | 8 ++++----
drivers/media/dvb-frontends/au8522_priv.h | 3 ++-
drivers/media/usb/au0828/au0828-core.c | 2 +-
drivers/media/usb/au0828/au0828-video.c | 8 ++++----
include/media/v4l2-mc.h | 1 +
6 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/drivers/media/dvb-frontends/au8522.h b/drivers/media/dvb-frontends/au8522.h
index d7a997fada7f..78bf3f73e58d 100644
--- a/drivers/media/dvb-frontends/au8522.h
+++ b/drivers/media/dvb-frontends/au8522.h
@@ -89,13 +89,4 @@ enum au8522_audio_input {
AU8522_AUDIO_NONE,
AU8522_AUDIO_SIF,
};
-
-enum au8522_media_pads {
- AU8522_PAD_INPUT,
- AU8522_PAD_VID_OUT,
- AU8522_PAD_VBI_OUT,
- AU8522_PAD_AUDIO_OUT,
-
- AU8522_NUM_PADS
-};
#endif /* __AU8522_H__ */
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c
index 0ab9f1eb8a29..add246382806 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -763,10 +763,10 @@ static int au8522_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(sd, client, &au8522_ops);
#if defined(CONFIG_MEDIA_CONTROLLER)
- state->pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
- state->pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
- state->pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
- state->pads[AU8522_PAD_AUDIO_OUT].flags = MEDIA_PAD_FL_SOURCE;
+ state->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+ state->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
+ state->pads[DEMOD_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
+ state->pads[DEMOD_PAD_AUDIO_OUT].flags = MEDIA_PAD_FL_SOURCE;
sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
diff --git a/drivers/media/dvb-frontends/au8522_priv.h b/drivers/media/dvb-frontends/au8522_priv.h
index 505215a21ddd..f5a9438f6ce5 100644
--- a/drivers/media/dvb-frontends/au8522_priv.h
+++ b/drivers/media/dvb-frontends/au8522_priv.h
@@ -30,6 +30,7 @@
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
+#include <media/v4l2-mc.h>
#include <linux/i2c.h>
#include "dvb_frontend.h"
#include "au8522.h"
@@ -70,7 +71,7 @@ struct au8522_state {
struct v4l2_ctrl_handler hdl;
#ifdef CONFIG_MEDIA_CONTROLLER
- struct media_pad pads[AU8522_NUM_PADS];
+ struct media_pad pads[DEMOD_NUM_PADS];
#endif
};
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index ca1e5ebf3b6b..6da4e5749f3a 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -218,7 +218,7 @@ static void au0828_media_graph_notify(struct media_entity *new,
switch (new->function) {
case MEDIA_ENT_F_AUDIO_MIXER:
ret = media_create_pad_link(dev->decoder,
- AU8522_PAD_AUDIO_OUT,
+ DEMOD_PAD_AUDIO_OUT,
new, 0,
MEDIA_LNK_FL_ENABLED);
if (ret)
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 1958de192608..b82deda02643 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -686,16 +686,16 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
if (tuner) {
dev->tuner = tuner;
ret = media_create_pad_link(tuner, TUNER_PAD_OUTPUT,
- decoder, AU8522_PAD_INPUT, 0);
+ decoder, DEMOD_PAD_IF_INPUT, 0);
if (ret)
return ret;
}
- ret = media_create_pad_link(decoder, AU8522_PAD_VID_OUT,
+ ret = media_create_pad_link(decoder, DEMOD_PAD_VID_OUT,
&dev->vdev.entity, 0,
MEDIA_LNK_FL_ENABLED);
if (ret)
return ret;
- ret = media_create_pad_link(decoder, AU8522_PAD_VBI_OUT,
+ ret = media_create_pad_link(decoder, DEMOD_PAD_VBI_OUT,
&dev->vbi_dev.entity, 0,
MEDIA_LNK_FL_ENABLED);
if (ret)
@@ -723,7 +723,7 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
case AU0828_VMUX_SVIDEO:
/* FIXME: fix the decoder PAD */
ret = media_create_pad_link(ent, 0, decoder,
- AU8522_PAD_INPUT, 0);
+ DEMOD_PAD_IF_INPUT, 0);
if (ret)
return ret;
break;
diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h
index 5cbc20923faf..2d880e035490 100644
--- a/include/media/v4l2-mc.h
+++ b/include/media/v4l2-mc.h
@@ -93,6 +93,7 @@ enum demod_pad_index {
DEMOD_PAD_IF_INPUT,
DEMOD_PAD_VID_OUT,
DEMOD_PAD_VBI_OUT,
+ DEMOD_PAD_AUDIO_OUT,
DEMOD_NUM_PADS
};
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/2] [media] au0828: use standard demod pads struct
2016-03-02 14:16 ` [PATCH 1/2] [media] au0828: use standard demod pads struct Mauro Carvalho Chehab
@ 2016-03-02 15:34 ` kbuild test robot
0 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2016-03-02 15:34 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: kbuild-all, Linux Media Mailing List, Mauro Carvalho Chehab,
Mauro Carvalho Chehab, Shuah Khan, Arnd Bergmann,
Krzysztof Kozlowski, Hans Verkuil, Sakari Ailus, Laurent Pinchart,
Rafael Lourenço de Lima Chehab, Stefan Richter,
Javier Martinez Canillas, Geunyoung Kim, Seung-Woo Kim,
Junghak Sung, Lad, Prabhakar
[-- Attachment #1: Type: text/plain, Size: 3486 bytes --]
Hi Mauro,
[auto build test WARNING on sailus-media/master]
[cannot apply to v4.5-rc6 next-20160302]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/Don-t-duplicate-a-function-to-create-graph-on-au0828/20160302-221912
base: git://linuxtv.org/media_tree.git master
reproduce: make htmldocs
All warnings (new ones prefixed by >>):
include/linux/init.h:1: warning: no structured comments found
kernel/sys.c:1: warning: no structured comments found
drivers/dma-buf/seqno-fence.c:1: warning: no structured comments found
drivers/dma-buf/reservation.c:1: warning: no structured comments found
include/linux/reservation.h:1: warning: no structured comments found
>> include/media/v4l2-mc.h:98: warning: Enum value 'DEMOD_PAD_AUDIO_OUT' not described in enum 'demod_pad_index'
include/media/v4l2-mc.h:137: warning: No description found for parameter 'vdev'
include/media/v4l2-mc.h:151: warning: No description found for parameter 'vdev'
include/linux/spi/spi.h:540: warning: No description found for parameter 'max_transfer_size'
vim +98 include/media/v4l2-mc.h
953a457e Mauro Carvalho Chehab 2016-01-29 82 };
e4001e95 Mauro Carvalho Chehab 2016-01-29 83
e4001e95 Mauro Carvalho Chehab 2016-01-29 84 /**
e4001e95 Mauro Carvalho Chehab 2016-01-29 85 * enum demod_pad_index - analog TV pad index for MEDIA_ENT_F_ATV_DECODER
e4001e95 Mauro Carvalho Chehab 2016-01-29 86 *
e4001e95 Mauro Carvalho Chehab 2016-01-29 87 * @DEMOD_PAD_IF_INPUT: IF input sink pad.
e4001e95 Mauro Carvalho Chehab 2016-01-29 88 * @DEMOD_PAD_VID_OUT: Video output source pad.
e4001e95 Mauro Carvalho Chehab 2016-01-29 89 * @DEMOD_PAD_VBI_OUT: Vertical Blank Interface (VBI) output source pad.
e4001e95 Mauro Carvalho Chehab 2016-01-29 90 * @DEMOD_NUM_PADS: Maximum number of output pads.
e4001e95 Mauro Carvalho Chehab 2016-01-29 91 */
e4001e95 Mauro Carvalho Chehab 2016-01-29 92 enum demod_pad_index {
e4001e95 Mauro Carvalho Chehab 2016-01-29 93 DEMOD_PAD_IF_INPUT,
e4001e95 Mauro Carvalho Chehab 2016-01-29 94 DEMOD_PAD_VID_OUT,
e4001e95 Mauro Carvalho Chehab 2016-01-29 95 DEMOD_PAD_VBI_OUT,
0f925abc Mauro Carvalho Chehab 2016-03-02 96 DEMOD_PAD_AUDIO_OUT,
e4001e95 Mauro Carvalho Chehab 2016-01-29 97 DEMOD_NUM_PADS
e4001e95 Mauro Carvalho Chehab 2016-01-29 @98 };
54d0dbac Mauro Carvalho Chehab 2016-02-05 99
eee7d353 Mauro Carvalho Chehab 2016-02-11 100 /* We don't need to include pci.h or usb.h here */
eee7d353 Mauro Carvalho Chehab 2016-02-11 101 struct pci_dev;
eee7d353 Mauro Carvalho Chehab 2016-02-11 102 struct usb_device;
7047f298 Mauro Carvalho Chehab 2016-02-05 103
7047f298 Mauro Carvalho Chehab 2016-02-05 104 #ifdef CONFIG_MEDIA_CONTROLLER
54d0dbac Mauro Carvalho Chehab 2016-02-05 105 /**
54d0dbac Mauro Carvalho Chehab 2016-02-05 106 * v4l2_mc_create_media_graph() - create Media Controller links at the graph.
:::::: The code at line 98 was first introduced by commit
:::::: e4001e955bec5566848624635cfb2d353ebac507 [media] v4l2-mc: add analog TV demodulator pad index macros
:::::: TO: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 6229 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] [media] au0828: use v4l2_mc_create_media_graph()
2016-03-02 14:16 [PATCH 0/2] Don't duplicate a function to create graph on au0828 Mauro Carvalho Chehab
2016-03-02 14:16 ` [PATCH 1/2] [media] au0828: use standard demod pads struct Mauro Carvalho Chehab
@ 2016-03-02 14:16 ` Mauro Carvalho Chehab
2016-03-02 16:30 ` kbuild test robot
2016-03-02 16:39 ` [PATCH v2 1/2] [media] au0828: use standard demod pads struct Mauro Carvalho Chehab
2 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-02 14:16 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Hans Verkuil,
Shuah Khan, Geunyoung Kim, Junghak Sung,
Rafael Lourenço de Lima Chehab, Lad, Prabhakar
There's no reason to implement its own function to create the
media graph. So, use the core one.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
drivers/media/usb/au0828/au0828-video.c | 99 +--------------------------------
drivers/media/v4l2-core/v4l2-mc.c | 21 ++++++-
2 files changed, 22 insertions(+), 98 deletions(-)
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index b82deda02643..d6fca109deb2 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/device.h>
#include <media/v4l2-common.h>
+#include <media/v4l2-mc.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
#include <media/tuner.h>
@@ -652,102 +653,6 @@ void au0828_usb_v4l2_media_release(struct au0828_dev *dev)
#endif
}
-static int au0828_create_media_graph(struct au0828_dev *dev)
-{
-#ifdef CONFIG_MEDIA_CONTROLLER
- struct media_device *mdev = dev->media_dev;
- struct media_entity *entity;
- struct media_entity *tuner = NULL, *decoder = NULL, *demod = NULL;
- int i, ret;
-
- if (!mdev)
- return 0;
-
- media_device_for_each_entity(entity, mdev) {
- switch (entity->function) {
- case MEDIA_ENT_F_TUNER:
- tuner = entity;
- break;
- case MEDIA_ENT_F_ATV_DECODER:
- decoder = entity;
- break;
- case MEDIA_ENT_F_DTV_DEMOD:
- demod = entity;
- break;
- }
- }
-
- /* Analog setup, using tuner as a link */
-
- /* Something bad happened! */
- if (!decoder)
- return -EINVAL;
-
- if (tuner) {
- dev->tuner = tuner;
- ret = media_create_pad_link(tuner, TUNER_PAD_OUTPUT,
- decoder, DEMOD_PAD_IF_INPUT, 0);
- if (ret)
- return ret;
- }
- ret = media_create_pad_link(decoder, DEMOD_PAD_VID_OUT,
- &dev->vdev.entity, 0,
- MEDIA_LNK_FL_ENABLED);
- if (ret)
- return ret;
- ret = media_create_pad_link(decoder, DEMOD_PAD_VBI_OUT,
- &dev->vbi_dev.entity, 0,
- MEDIA_LNK_FL_ENABLED);
- if (ret)
- return ret;
-
- for (i = 0; i < AU0828_MAX_INPUT; i++) {
- struct media_entity *ent = &dev->input_ent[i];
-
- switch (AUVI_INPUT(i).type) {
- case AU0828_VMUX_UNDEFINED:
- break;
- case AU0828_VMUX_CABLE:
- case AU0828_VMUX_TELEVISION:
- case AU0828_VMUX_DVB:
- if (!tuner)
- break;
-
- ret = media_create_pad_link(ent, 0, tuner,
- TUNER_PAD_RF_INPUT,
- MEDIA_LNK_FL_ENABLED);
- if (ret)
- return ret;
- break;
- case AU0828_VMUX_COMPOSITE:
- case AU0828_VMUX_SVIDEO:
- /* FIXME: fix the decoder PAD */
- ret = media_create_pad_link(ent, 0, decoder,
- DEMOD_PAD_IF_INPUT, 0);
- if (ret)
- return ret;
- break;
- }
- }
-
- /*
- * Disable tuner to demod link to avoid disable step
- * when tuner is requested by video or audio
- */
- if (tuner && demod) {
- struct media_link *link;
-
- list_for_each_entry(link, &demod->links, list) {
- if (link->sink->entity == demod &&
- link->source->entity == tuner) {
- media_entity_setup_link(link, 0);
- }
- }
- }
-#endif
- return 0;
-}
-
static void au0828_usb_v4l2_release(struct v4l2_device *v4l2_dev)
{
struct au0828_dev *dev =
@@ -2120,7 +2025,7 @@ int au0828_analog_register(struct au0828_dev *dev,
ret = -ENODEV;
goto err_reg_vbi_dev;
}
- retval = au0828_create_media_graph(dev);
+ retval = v4l2_mc_create_media_graph(dev->media_dev);
if (retval) {
pr_err("%s() au0282_dev_register failed to create graph\n",
__func__);
diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c
index 643686d40551..e6c8a34590b9 100644
--- a/drivers/media/v4l2-core/v4l2-mc.c
+++ b/drivers/media/v4l2-core/v4l2-mc.c
@@ -27,7 +27,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;
+ struct media_entity *tuner = NULL, *decoder = NULL, *dtv_demod = NULL;
struct media_entity *io_v4l = NULL, *io_vbi = NULL, *io_swradio = NULL;
bool is_webcam = false;
u32 flags;
@@ -50,6 +50,9 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)
case MEDIA_ENT_F_ATV_DECODER:
decoder = entity;
break;
+ case MEDIA_ENT_F_DTV_DEMOD:
+ dtv_demod = entity;
+ break;
case MEDIA_ENT_F_IO_V4L:
io_v4l = entity;
break;
@@ -183,6 +186,22 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)
flags = 0;
}
+
+ /*
+ * Disable tuner to demod link to avoid disable step
+ * when tuner is requested by video or audio
+ */
+ if (tuner && dtv_demod) {
+ struct media_link *link;
+
+ list_for_each_entry(link, &dtv_demod->links, list) {
+ if (link->sink->entity == dtv_demod &&
+ link->source->entity == tuner) {
+ media_entity_setup_link(link, 0);
+ }
+ }
+ }
+
return 0;
}
EXPORT_SYMBOL_GPL(v4l2_mc_create_media_graph);
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 2/2] [media] au0828: use v4l2_mc_create_media_graph()
2016-03-02 14:16 ` [PATCH 2/2] [media] au0828: use v4l2_mc_create_media_graph() Mauro Carvalho Chehab
@ 2016-03-02 16:30 ` kbuild test robot
0 siblings, 0 replies; 7+ messages in thread
From: kbuild test robot @ 2016-03-02 16:30 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: kbuild-all, Linux Media Mailing List, Mauro Carvalho Chehab,
Mauro Carvalho Chehab, Hans Verkuil, Shuah Khan, Geunyoung Kim,
Junghak Sung, Rafael Lourenço de Lima Chehab, Lad, Prabhakar
[-- Attachment #1: Type: text/plain, Size: 1952 bytes --]
Hi Mauro,
[auto build test ERROR on sailus-media/master]
[cannot apply to v4.5-rc6 next-20160302]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]
url: https://github.com/0day-ci/linux/commits/Mauro-Carvalho-Chehab/Don-t-duplicate-a-function-to-create-graph-on-au0828/20160302-221912
base: git://linuxtv.org/media_tree.git master
config: x86_64-rhel (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
drivers/media/usb/au0828/au0828-video.c: In function 'au0828_analog_register':
>> drivers/media/usb/au0828/au0828-video.c:2028:41: error: 'struct au0828_dev' has no member named 'media_dev'
retval = v4l2_mc_create_media_graph(dev->media_dev);
^
In file included from drivers/media/usb/au0828/au0828-video.c:38:0:
drivers/media/usb/au0828/au0828-video.c: At top level:
include/media/v4l2-mc.h:179:13: warning: 'v4l_disable_media_source' defined but not used [-Wunused-function]
static void v4l_disable_media_source(struct video_device *vdev)
^
include/media/v4l2-mc.h:184:12: warning: 'v4l_vb2q_enable_media_source' defined but not used [-Wunused-function]
static int v4l_vb2q_enable_media_source(struct vb2_queue *q)
^
vim +2028 drivers/media/usb/au0828/au0828-video.c
2022 if (retval != 0) {
2023 dprintk(1, "unable to register vbi device (error = %d).\n",
2024 retval);
2025 ret = -ENODEV;
2026 goto err_reg_vbi_dev;
2027 }
> 2028 retval = v4l2_mc_create_media_graph(dev->media_dev);
2029 if (retval) {
2030 pr_err("%s() au0282_dev_register failed to create graph\n",
2031 __func__);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 36059 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] [media] au0828: use standard demod pads struct
2016-03-02 14:16 [PATCH 0/2] Don't duplicate a function to create graph on au0828 Mauro Carvalho Chehab
2016-03-02 14:16 ` [PATCH 1/2] [media] au0828: use standard demod pads struct Mauro Carvalho Chehab
2016-03-02 14:16 ` [PATCH 2/2] [media] au0828: use v4l2_mc_create_media_graph() Mauro Carvalho Chehab
@ 2016-03-02 16:39 ` Mauro Carvalho Chehab
2016-03-02 16:39 ` [PATCH v2 2/2] [media] au0828: use v4l2_mc_create_media_graph() Mauro Carvalho Chehab
2 siblings, 1 reply; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-02 16:39 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Shuah Khan,
Arnd Bergmann, Krzysztof Kozlowski, Laurent Pinchart,
Rafael Lourenço de Lima Chehab, Hans Verkuil, Stefan Richter,
Javier Martinez Canillas, Inki Dae, Geunyoung Kim, Junghak Sung,
Lad, Prabhakar
As we want au0828 to use the core function to create the MC
graphs, use enum demod_pad_index instead of
enum au8522_media_pads.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
drivers/media/dvb-frontends/au8522.h | 9 ---------
drivers/media/dvb-frontends/au8522_decoder.c | 8 ++++----
drivers/media/dvb-frontends/au8522_priv.h | 3 ++-
drivers/media/usb/au0828/au0828-core.c | 2 +-
drivers/media/usb/au0828/au0828-video.c | 8 ++++----
include/media/v4l2-mc.h | 2 ++
6 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/drivers/media/dvb-frontends/au8522.h b/drivers/media/dvb-frontends/au8522.h
index d7a997fada7f..78bf3f73e58d 100644
--- a/drivers/media/dvb-frontends/au8522.h
+++ b/drivers/media/dvb-frontends/au8522.h
@@ -89,13 +89,4 @@ enum au8522_audio_input {
AU8522_AUDIO_NONE,
AU8522_AUDIO_SIF,
};
-
-enum au8522_media_pads {
- AU8522_PAD_INPUT,
- AU8522_PAD_VID_OUT,
- AU8522_PAD_VBI_OUT,
- AU8522_PAD_AUDIO_OUT,
-
- AU8522_NUM_PADS
-};
#endif /* __AU8522_H__ */
diff --git a/drivers/media/dvb-frontends/au8522_decoder.c b/drivers/media/dvb-frontends/au8522_decoder.c
index 0ab9f1eb8a29..add246382806 100644
--- a/drivers/media/dvb-frontends/au8522_decoder.c
+++ b/drivers/media/dvb-frontends/au8522_decoder.c
@@ -763,10 +763,10 @@ static int au8522_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(sd, client, &au8522_ops);
#if defined(CONFIG_MEDIA_CONTROLLER)
- state->pads[AU8522_PAD_INPUT].flags = MEDIA_PAD_FL_SINK;
- state->pads[AU8522_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
- state->pads[AU8522_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
- state->pads[AU8522_PAD_AUDIO_OUT].flags = MEDIA_PAD_FL_SOURCE;
+ state->pads[DEMOD_PAD_IF_INPUT].flags = MEDIA_PAD_FL_SINK;
+ state->pads[DEMOD_PAD_VID_OUT].flags = MEDIA_PAD_FL_SOURCE;
+ state->pads[DEMOD_PAD_VBI_OUT].flags = MEDIA_PAD_FL_SOURCE;
+ state->pads[DEMOD_PAD_AUDIO_OUT].flags = MEDIA_PAD_FL_SOURCE;
sd->entity.function = MEDIA_ENT_F_ATV_DECODER;
ret = media_entity_pads_init(&sd->entity, ARRAY_SIZE(state->pads),
diff --git a/drivers/media/dvb-frontends/au8522_priv.h b/drivers/media/dvb-frontends/au8522_priv.h
index 505215a21ddd..f5a9438f6ce5 100644
--- a/drivers/media/dvb-frontends/au8522_priv.h
+++ b/drivers/media/dvb-frontends/au8522_priv.h
@@ -30,6 +30,7 @@
#include <linux/videodev2.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
+#include <media/v4l2-mc.h>
#include <linux/i2c.h>
#include "dvb_frontend.h"
#include "au8522.h"
@@ -70,7 +71,7 @@ struct au8522_state {
struct v4l2_ctrl_handler hdl;
#ifdef CONFIG_MEDIA_CONTROLLER
- struct media_pad pads[AU8522_NUM_PADS];
+ struct media_pad pads[DEMOD_NUM_PADS];
#endif
};
diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c
index ca1e5ebf3b6b..6da4e5749f3a 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -218,7 +218,7 @@ static void au0828_media_graph_notify(struct media_entity *new,
switch (new->function) {
case MEDIA_ENT_F_AUDIO_MIXER:
ret = media_create_pad_link(dev->decoder,
- AU8522_PAD_AUDIO_OUT,
+ DEMOD_PAD_AUDIO_OUT,
new, 0,
MEDIA_LNK_FL_ENABLED);
if (ret)
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index 1958de192608..b82deda02643 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -686,16 +686,16 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
if (tuner) {
dev->tuner = tuner;
ret = media_create_pad_link(tuner, TUNER_PAD_OUTPUT,
- decoder, AU8522_PAD_INPUT, 0);
+ decoder, DEMOD_PAD_IF_INPUT, 0);
if (ret)
return ret;
}
- ret = media_create_pad_link(decoder, AU8522_PAD_VID_OUT,
+ ret = media_create_pad_link(decoder, DEMOD_PAD_VID_OUT,
&dev->vdev.entity, 0,
MEDIA_LNK_FL_ENABLED);
if (ret)
return ret;
- ret = media_create_pad_link(decoder, AU8522_PAD_VBI_OUT,
+ ret = media_create_pad_link(decoder, DEMOD_PAD_VBI_OUT,
&dev->vbi_dev.entity, 0,
MEDIA_LNK_FL_ENABLED);
if (ret)
@@ -723,7 +723,7 @@ static int au0828_create_media_graph(struct au0828_dev *dev)
case AU0828_VMUX_SVIDEO:
/* FIXME: fix the decoder PAD */
ret = media_create_pad_link(ent, 0, decoder,
- AU8522_PAD_INPUT, 0);
+ DEMOD_PAD_IF_INPUT, 0);
if (ret)
return ret;
break;
diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h
index 5cbc20923faf..9dff7adff64c 100644
--- a/include/media/v4l2-mc.h
+++ b/include/media/v4l2-mc.h
@@ -87,12 +87,14 @@ enum if_aud_dec_pad_index {
* @DEMOD_PAD_IF_INPUT: IF input sink pad.
* @DEMOD_PAD_VID_OUT: Video output source pad.
* @DEMOD_PAD_VBI_OUT: Vertical Blank Interface (VBI) output source pad.
+ * @DEMOD_PAD_AUDIO_OUT: Audio output source pad.
* @DEMOD_NUM_PADS: Maximum number of output pads.
*/
enum demod_pad_index {
DEMOD_PAD_IF_INPUT,
DEMOD_PAD_VID_OUT,
DEMOD_PAD_VBI_OUT,
+ DEMOD_PAD_AUDIO_OUT,
DEMOD_NUM_PADS
};
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH v2 2/2] [media] au0828: use v4l2_mc_create_media_graph()
2016-03-02 16:39 ` [PATCH v2 1/2] [media] au0828: use standard demod pads struct Mauro Carvalho Chehab
@ 2016-03-02 16:39 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2016-03-02 16:39 UTC (permalink / raw)
To: Linux Media Mailing List
Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab, Hans Verkuil,
Shuah Khan, Geunyoung Kim, Seung-Woo Kim, Junghak Sung,
Rafael Lourenço de Lima Chehab, Lad, Prabhakar
There's no reason to implement its own function to create the
media graph. So, use the core one.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
---
drivers/media/usb/au0828/au0828-video.c | 103 ++------------------------------
drivers/media/v4l2-core/v4l2-mc.c | 21 ++++++-
2 files changed, 25 insertions(+), 99 deletions(-)
diff --git a/drivers/media/usb/au0828/au0828-video.c b/drivers/media/usb/au0828/au0828-video.c
index b82deda02643..c0839d62ff13 100644
--- a/drivers/media/usb/au0828/au0828-video.c
+++ b/drivers/media/usb/au0828/au0828-video.c
@@ -35,6 +35,7 @@
#include <linux/init.h>
#include <linux/device.h>
#include <media/v4l2-common.h>
+#include <media/v4l2-mc.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-event.h>
#include <media/tuner.h>
@@ -652,102 +653,6 @@ void au0828_usb_v4l2_media_release(struct au0828_dev *dev)
#endif
}
-static int au0828_create_media_graph(struct au0828_dev *dev)
-{
-#ifdef CONFIG_MEDIA_CONTROLLER
- struct media_device *mdev = dev->media_dev;
- struct media_entity *entity;
- struct media_entity *tuner = NULL, *decoder = NULL, *demod = NULL;
- int i, ret;
-
- if (!mdev)
- return 0;
-
- media_device_for_each_entity(entity, mdev) {
- switch (entity->function) {
- case MEDIA_ENT_F_TUNER:
- tuner = entity;
- break;
- case MEDIA_ENT_F_ATV_DECODER:
- decoder = entity;
- break;
- case MEDIA_ENT_F_DTV_DEMOD:
- demod = entity;
- break;
- }
- }
-
- /* Analog setup, using tuner as a link */
-
- /* Something bad happened! */
- if (!decoder)
- return -EINVAL;
-
- if (tuner) {
- dev->tuner = tuner;
- ret = media_create_pad_link(tuner, TUNER_PAD_OUTPUT,
- decoder, DEMOD_PAD_IF_INPUT, 0);
- if (ret)
- return ret;
- }
- ret = media_create_pad_link(decoder, DEMOD_PAD_VID_OUT,
- &dev->vdev.entity, 0,
- MEDIA_LNK_FL_ENABLED);
- if (ret)
- return ret;
- ret = media_create_pad_link(decoder, DEMOD_PAD_VBI_OUT,
- &dev->vbi_dev.entity, 0,
- MEDIA_LNK_FL_ENABLED);
- if (ret)
- return ret;
-
- for (i = 0; i < AU0828_MAX_INPUT; i++) {
- struct media_entity *ent = &dev->input_ent[i];
-
- switch (AUVI_INPUT(i).type) {
- case AU0828_VMUX_UNDEFINED:
- break;
- case AU0828_VMUX_CABLE:
- case AU0828_VMUX_TELEVISION:
- case AU0828_VMUX_DVB:
- if (!tuner)
- break;
-
- ret = media_create_pad_link(ent, 0, tuner,
- TUNER_PAD_RF_INPUT,
- MEDIA_LNK_FL_ENABLED);
- if (ret)
- return ret;
- break;
- case AU0828_VMUX_COMPOSITE:
- case AU0828_VMUX_SVIDEO:
- /* FIXME: fix the decoder PAD */
- ret = media_create_pad_link(ent, 0, decoder,
- DEMOD_PAD_IF_INPUT, 0);
- if (ret)
- return ret;
- break;
- }
- }
-
- /*
- * Disable tuner to demod link to avoid disable step
- * when tuner is requested by video or audio
- */
- if (tuner && demod) {
- struct media_link *link;
-
- list_for_each_entry(link, &demod->links, list) {
- if (link->sink->entity == demod &&
- link->source->entity == tuner) {
- media_entity_setup_link(link, 0);
- }
- }
- }
-#endif
- return 0;
-}
-
static void au0828_usb_v4l2_release(struct v4l2_device *v4l2_dev)
{
struct au0828_dev *dev =
@@ -2120,14 +2025,16 @@ int au0828_analog_register(struct au0828_dev *dev,
ret = -ENODEV;
goto err_reg_vbi_dev;
}
- retval = au0828_create_media_graph(dev);
+
+#ifdef CONFIG_MEDIA_CONTROLLER
+ retval = v4l2_mc_create_media_graph(dev->media_dev);
if (retval) {
pr_err("%s() au0282_dev_register failed to create graph\n",
__func__);
ret = -ENODEV;
goto err_reg_vbi_dev;
}
-
+#endif
dprintk(1, "%s completed!\n", __func__);
diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c
index 643686d40551..e6c8a34590b9 100644
--- a/drivers/media/v4l2-core/v4l2-mc.c
+++ b/drivers/media/v4l2-core/v4l2-mc.c
@@ -27,7 +27,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;
+ struct media_entity *tuner = NULL, *decoder = NULL, *dtv_demod = NULL;
struct media_entity *io_v4l = NULL, *io_vbi = NULL, *io_swradio = NULL;
bool is_webcam = false;
u32 flags;
@@ -50,6 +50,9 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)
case MEDIA_ENT_F_ATV_DECODER:
decoder = entity;
break;
+ case MEDIA_ENT_F_DTV_DEMOD:
+ dtv_demod = entity;
+ break;
case MEDIA_ENT_F_IO_V4L:
io_v4l = entity;
break;
@@ -183,6 +186,22 @@ int v4l2_mc_create_media_graph(struct media_device *mdev)
flags = 0;
}
+
+ /*
+ * Disable tuner to demod link to avoid disable step
+ * when tuner is requested by video or audio
+ */
+ if (tuner && dtv_demod) {
+ struct media_link *link;
+
+ list_for_each_entry(link, &dtv_demod->links, list) {
+ if (link->sink->entity == dtv_demod &&
+ link->source->entity == tuner) {
+ media_entity_setup_link(link, 0);
+ }
+ }
+ }
+
return 0;
}
EXPORT_SYMBOL_GPL(v4l2_mc_create_media_graph);
--
2.5.0
^ permalink raw reply related [flat|nested] 7+ messages in thread