Commit 6168309a authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] cx231xx: create connectors at the media graph

We need to add connectors to the cx231xx graph.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 133bc4e4
...@@ -1685,6 +1685,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface, ...@@ -1685,6 +1685,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
request_modules(dev); request_modules(dev);
#ifdef CONFIG_MEDIA_CONTROLLER #ifdef CONFIG_MEDIA_CONTROLLER
/* Init entities at the Media Controller */
cx231xx_v4l2_create_entities(dev);
retval = v4l2_mc_create_media_graph(dev->media_dev); retval = v4l2_mc_create_media_graph(dev->media_dev);
if (!retval) if (!retval)
retval = media_device_register(dev->media_dev); retval = media_device_register(dev->media_dev);
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <media/v4l2-common.h> #include <media/v4l2-common.h>
#include <media/videobuf-vmalloc.h> #include <media/videobuf-vmalloc.h>
#include <media/tuner.h>
#include "xc5000.h" #include "xc5000.h"
#include "s5h1432.h" #include "s5h1432.h"
...@@ -551,7 +552,8 @@ static int register_dvb(struct cx231xx_dvb *dvb, ...@@ -551,7 +552,8 @@ static int register_dvb(struct cx231xx_dvb *dvb,
/* register network adapter */ /* register network adapter */
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
result = dvb_create_media_graph(&dvb->adapter, false); result = dvb_create_media_graph(&dvb->adapter,
dev->tuner_type == TUNER_ABSENT);
if (result < 0) if (result < 0)
goto fail_create_graph; goto fail_create_graph;
......
...@@ -1106,6 +1106,52 @@ static const char *iname[] = { ...@@ -1106,6 +1106,52 @@ static const char *iname[] = {
[CX231XX_VMUX_DEBUG] = "for debug only", [CX231XX_VMUX_DEBUG] = "for debug only",
}; };
void cx231xx_v4l2_create_entities(struct cx231xx *dev)
{
#if defined(CONFIG_MEDIA_CONTROLLER)
int ret, i;
/* Create entities for each input connector */
for (i = 0; i < MAX_CX231XX_INPUT; i++) {
struct media_entity *ent = &dev->input_ent[i];
if (!INPUT(i)->type)
break;
ent->name = iname[INPUT(i)->type];
ent->flags = MEDIA_ENT_FL_CONNECTOR;
dev->input_pad[i].flags = MEDIA_PAD_FL_SOURCE;
switch (INPUT(i)->type) {
case CX231XX_VMUX_COMPOSITE1:
ent->function = MEDIA_ENT_F_CONN_COMPOSITE;
break;
case CX231XX_VMUX_SVIDEO:
ent->function = MEDIA_ENT_F_CONN_SVIDEO;
break;
case CX231XX_VMUX_TELEVISION:
case CX231XX_VMUX_CABLE:
case CX231XX_VMUX_DVB:
/* The DVB core will handle it */
if (dev->tuner_type == TUNER_ABSENT)
continue;
/* fall though */
default: /* CX231XX_VMUX_DEBUG */
ent->function = MEDIA_ENT_F_CONN_RF;
break;
}
ret = media_entity_pads_init(ent, 1, &dev->input_pad[i]);
if (ret < 0)
pr_err("failed to initialize input pad[%d]!\n", i);
ret = media_device_register_entity(dev->media_dev, ent);
if (ret < 0)
pr_err("failed to register input entity %d!\n", i);
}
#endif
}
int cx231xx_enum_input(struct file *file, void *priv, int cx231xx_enum_input(struct file *file, void *priv,
struct v4l2_input *i) struct v4l2_input *i)
{ {
......
...@@ -663,6 +663,8 @@ struct cx231xx { ...@@ -663,6 +663,8 @@ struct cx231xx {
#if defined(CONFIG_MEDIA_CONTROLLER) #if defined(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 input_ent[MAX_CX231XX_INPUT];
struct media_pad input_pad[MAX_CX231XX_INPUT];
#endif #endif
unsigned char eedata[256]; unsigned char eedata[256];
...@@ -943,6 +945,7 @@ int cx231xx_register_extension(struct cx231xx_ops *dev); ...@@ -943,6 +945,7 @@ int cx231xx_register_extension(struct cx231xx_ops *dev);
void cx231xx_unregister_extension(struct cx231xx_ops *dev); void cx231xx_unregister_extension(struct cx231xx_ops *dev);
void cx231xx_init_extension(struct cx231xx *dev); void cx231xx_init_extension(struct cx231xx *dev);
void cx231xx_close_extension(struct cx231xx *dev); void cx231xx_close_extension(struct cx231xx *dev);
void cx231xx_v4l2_create_entities(struct cx231xx *dev);
int cx231xx_querycap(struct file *file, void *priv, int cx231xx_querycap(struct file *file, void *priv,
struct v4l2_capability *cap); struct v4l2_capability *cap);
int cx231xx_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t); int cx231xx_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t);
......
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