* [PATCHv2 0/9] dvb core: add basic support for the media controller
@ 2015-01-03 14:49 Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 1/9] media: Fix DVB representation at media controller API Mauro Carvalho Chehab
` (8 more replies)
0 siblings, 9 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab
This patch series adds basic support for the media controller at the
DVB core: it creates one media entity per DVB devnode, if the media
device is passed as an argument to the DVB structures.
The cx231xx driver was modified to pass such argument for DVB NET,
DVB frontend and DVB demux.
-
version 2:
- Now the PADs are created for all nodes
- Instead of using entity->flags for subtypes, create separate
MEDIA_ENT_T_DEVNODE_DVB_foo for each DVB devtype
- The API change patch was split from the DVB core changes
TODO:
- Create links
- Update media API for the DVB media controller changes
- Add the new devnodes at media-ctl at v4l-utils
Results of the media controller, using the modified version found at:
http://git.linuxtv.org/cgit.cgi/mchehab/experimental-v4l-utils.git/log/?h=dvb-media-ctl
Media controller API version 0.1.1
Media device information
------------------------
driver cx231xx
model Pixelview PlayTV USB Hybrid
serial CIR000000000001
bus info 4
hw revision 0x4001
driver version 3.19.0
Device topology
- entity 1: cx25840 19-0044 (0 pad, 0 link)
type V4L2 subdev subtype Unknown flags 0
- entity 2: tuner 21-0060 (0 pad, 0 link)
type V4L2 subdev subtype Unknown flags 0
- entity 3: cx231xx #0 video (0 pad, 0 link)
type Node subtype V4L flags 0
device node name /dev/video0
- entity 4: cx231xx #0 vbi (0 pad, 0 link)
type Node subtype V4L flags 0
device node name /dev/vbi0
- entity 5: Fujitsu mb86A20s (1 pad, 0 link)
type Node subtype DVB FE flags 0
device node name /dev/dvb/adapter0/frontend0
pad0: Source
- entity 6: demux (2 pads, 0 link)
type Node subtype DVB DEMUX flags 0
device node name /dev/dvb/adapter0/demux0
pad0: Source
pad1: Sink
- entity 7: dvr (1 pad, 0 link)
type Node subtype DVB DVR flags 0
device node name /dev/dvb/adapter0/dvr0
pad0: Sink
- entity 8: dvb net (0 pad, 0 link)
type Node subtype DVB NET flags 0
device node name /dev/dvb/adapter0/net0
Mauro Carvalho Chehab (9):
media: Fix DVB representation at media controller API
media: add new types for DVB devnodes
dvb core: add support for media controller at dvbdev
dvb core: add media controller support for DVB frontend
dvb core: add support for demux/dvr nodes at media controller
dvb core: add support for CA node at the media controller
dvb core: add support for DVB net node at the media controller
cx231xx: add media controller support
dvbdev: add pad for the DVB devnodes
drivers/media/dvb-core/dmxdev.c | 34 ++++++-----
drivers/media/dvb-core/dmxdev.h | 6 ++
drivers/media/dvb-core/dvb_ca_en50221.c | 19 +++---
drivers/media/dvb-core/dvb_ca_en50221.h | 6 ++
drivers/media/dvb-core/dvb_frontend.c | 8 ++-
drivers/media/dvb-core/dvb_frontend.h | 7 +++
drivers/media/dvb-core/dvb_net.c | 18 +++---
drivers/media/dvb-core/dvb_net.h | 6 ++
drivers/media/dvb-core/dvbdev.c | 96 ++++++++++++++++++++++++++++++-
drivers/media/dvb-core/dvbdev.h | 11 ++++
drivers/media/usb/cx231xx/cx231xx-cards.c | 60 +++++++++++++++++--
drivers/media/usb/cx231xx/cx231xx-dvb.c | 4 ++
drivers/media/usb/cx231xx/cx231xx.h | 4 ++
include/media/media-entity.h | 5 +-
include/uapi/linux/media.h | 16 +++++-
15 files changed, 257 insertions(+), 43 deletions(-)
--
2.1.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCHv2 1/9] media: Fix DVB representation at media controller API
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-11 13:50 ` Laurent Pinchart
2015-01-03 14:49 ` [PATCHv2 2/9] media: add new types for DVB devnodes Mauro Carvalho Chehab
` (7 subsequent siblings)
8 siblings, 1 reply; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, linux-api
The DVB devices are identified via a (major, minor) tuple,
and not by a random id. Fix it, before we start using it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/include/media/media-entity.h b/include/media/media-entity.h
index e00459185d20..de333cc8261b 100644
--- a/include/media/media-entity.h
+++ b/include/media/media-entity.h
@@ -97,7 +97,10 @@ struct media_entity {
u32 device;
u32 subdevice;
} alsa;
- int dvb;
+ struct {
+ u32 major;
+ u32 minor;
+ } dvb;
/* Sub-device specifications */
/* Nothing needed yet */
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index d847c760e8f0..7902e800f019 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -27,7 +27,7 @@
#include <linux/types.h>
#include <linux/version.h>
-#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
+#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 1)
struct media_device_info {
char driver[16];
@@ -88,7 +88,10 @@ struct media_entity_desc {
__u32 device;
__u32 subdevice;
} alsa;
- int dvb;
+ struct {
+ __u32 major;
+ __u32 minor;
+ } dvb;
/* Sub-device specifications */
/* Nothing needed yet */
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 2/9] media: add new types for DVB devnodes
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 1/9] media: Fix DVB representation at media controller API Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 3/9] dvb core: add support for media controller at dvbdev Mauro Carvalho Chehab
` (6 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, linux-api
Most of the DVB subdevs have already their own devnode.
Add support for them at the media controller API.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 7902e800f019..707db275f92b 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -50,7 +50,14 @@ struct media_device_info {
#define MEDIA_ENT_T_DEVNODE_V4L (MEDIA_ENT_T_DEVNODE + 1)
#define MEDIA_ENT_T_DEVNODE_FB (MEDIA_ENT_T_DEVNODE + 2)
#define MEDIA_ENT_T_DEVNODE_ALSA (MEDIA_ENT_T_DEVNODE + 3)
-#define MEDIA_ENT_T_DEVNODE_DVB (MEDIA_ENT_T_DEVNODE + 4)
+#define MEDIA_ENT_T_DEVNODE_DVB_FE (MEDIA_ENT_T_DEVNODE + 4)
+#define MEDIA_ENT_T_DEVNODE_DVB_DEMUX (MEDIA_ENT_T_DEVNODE + 5)
+#define MEDIA_ENT_T_DEVNODE_DVB_DVR (MEDIA_ENT_T_DEVNODE + 6)
+#define MEDIA_ENT_T_DEVNODE_DVB_CA (MEDIA_ENT_T_DEVNODE + 7)
+#define MEDIA_ENT_T_DEVNODE_DVB_NET (MEDIA_ENT_T_DEVNODE + 8)
+
+/* Legacy symbol. Use it to avoid userspace compilation breakages */
+#define MEDIA_ENT_T_DEVNODE_DVB MEDIA_ENT_T_DEVNODE_DVB_FE
#define MEDIA_ENT_T_V4L2_SUBDEV (2 << MEDIA_ENT_TYPE_SHIFT)
#define MEDIA_ENT_T_V4L2_SUBDEV_SENSOR (MEDIA_ENT_T_V4L2_SUBDEV + 1)
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 3/9] dvb core: add support for media controller at dvbdev
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 1/9] media: Fix DVB representation at media controller API Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 2/9] media: add new types for DVB devnodes Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 4/9] dvb core: add media controller support for DVB frontend Mauro Carvalho Chehab
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab
Provide a way to register media controller device nodes
at the DVB core.
Please notice that the dvbdev callers also require changes
for the devices to be registered via the media controller.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 983db75de350..28e9d53d0979 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -180,6 +180,58 @@ skip:
return -ENFILE;
}
+static void dvb_register_media_device(struct dvb_device *dvbdev,
+ int type, int minor)
+{
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ int ret;
+
+ if (!dvbdev->mdev)
+ return;
+
+ dvbdev->entity = kzalloc(sizeof(*dvbdev->entity), GFP_KERNEL);
+ if (!dvbdev->entity)
+ return;
+
+ dvbdev->entity->info.dvb.major = DVB_MAJOR;
+ dvbdev->entity->info.dvb.minor = minor;
+ dvbdev->entity->name = dvbdev->name;
+ switch(type) {
+ case DVB_DEVICE_FRONTEND:
+ dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_FE;
+ break;
+ case DVB_DEVICE_DEMUX:
+ dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_DEMUX;
+ break;
+ case DVB_DEVICE_DVR:
+ dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_DVR;
+ break;
+ case DVB_DEVICE_CA:
+ dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_CA;
+ break;
+ case DVB_DEVICE_NET:
+ dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_NET;
+ break;
+ default:
+ kfree(dvbdev->entity);
+ dvbdev->entity = NULL;
+ return;
+ }
+
+ ret = media_device_register_entity(dvbdev->mdev, dvbdev->entity);
+ if (ret < 0) {
+ printk(KERN_ERR
+ "%s: media_device_register_entity failed for %s\n",
+ __func__, dvbdev->entity->name);
+ kfree(dvbdev->entity);
+ dvbdev->entity = NULL;
+ return;
+ }
+
+ printk(KERN_DEBUG "%s: media device '%s' registered.\n",
+ __func__, dvbdev->entity->name);
+#endif
+}
int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
const struct dvb_device *template, void *priv, int type)
@@ -258,10 +310,11 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev,
__func__, adap->num, dnames[type], id, PTR_ERR(clsdev));
return PTR_ERR(clsdev);
}
-
dprintk(KERN_DEBUG "DVB: register adapter%d/%s%d @ minor: %i (0x%02x)\n",
adap->num, dnames[type], id, minor, minor);
+ dvb_register_media_device(dvbdev, type, minor);
+
return 0;
}
EXPORT_SYMBOL(dvb_register_device);
@@ -278,6 +331,13 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
device_destroy(dvb_class, MKDEV(DVB_MAJOR, dvbdev->minor));
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ if (dvbdev->entity) {
+ media_device_unregister_entity(dvbdev->entity);
+ kfree(dvbdev->entity);
+ }
+#endif
+
list_del (&dvbdev->list_head);
kfree (dvbdev->fops);
kfree (dvbdev);
diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h
index f96b28e7fc95..f58dfef46984 100644
--- a/drivers/media/dvb-core/dvbdev.h
+++ b/drivers/media/dvb-core/dvbdev.h
@@ -27,6 +27,7 @@
#include <linux/poll.h>
#include <linux/fs.h>
#include <linux/list.h>
+#include <media/media-device.h>
#define DVB_MAJOR 212
@@ -92,6 +93,15 @@ struct dvb_device {
/* don't really need those !? -- FIXME: use video_usercopy */
int (*kernel_ioctl)(struct file *file, unsigned int cmd, void *arg);
+ /* Needed for media controller register/unregister */
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_device *mdev;
+ const char *name;
+
+ /* Filled inside dvbdev.c */
+ struct media_entity *entity;
+#endif
+
void *priv;
};
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 4/9] dvb core: add media controller support for DVB frontend
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
` (2 preceding siblings ...)
2015-01-03 14:49 ` [PATCHv2 3/9] dvb core: add support for media controller at dvbdev Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 5/9] dvb core: add support for demux/dvr nodes at media controller Mauro Carvalho Chehab
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, Shuah Khan, Akihiro Tsukada, Ole Ernst
Now that the dvb core is capable of registering devices via the
media controller, add support for the DVB frontend devices.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c
index 2cf30576bf39..e34c47de1135 100644
--- a/drivers/media/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb-core/dvb_frontend.c
@@ -2612,12 +2612,16 @@ int dvb_register_frontend(struct dvb_adapter* dvb,
struct dvb_frontend* fe)
{
struct dvb_frontend_private *fepriv;
- static const struct dvb_device dvbdev_template = {
+ const struct dvb_device dvbdev_template = {
.users = ~0,
.writers = 1,
.readers = (~0)-1,
.fops = &dvb_frontend_fops,
- .kernel_ioctl = dvb_frontend_ioctl
+ .kernel_ioctl = dvb_frontend_ioctl,
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ .mdev = fe->mdev,
+ .name = fe->ops.info.name,
+#endif
};
dev_dbg(dvb->device, "%s:\n", __func__);
diff --git a/drivers/media/dvb-core/dvb_frontend.h b/drivers/media/dvb-core/dvb_frontend.h
index 816269e5f706..79b79a90d612 100644
--- a/drivers/media/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb-core/dvb_frontend.h
@@ -40,6 +40,8 @@
#include <linux/dvb/frontend.h>
+#include <media/media-device.h>
+
#include "dvbdev.h"
/*
@@ -415,6 +417,11 @@ struct dtv_frontend_properties {
struct dvb_frontend {
struct dvb_frontend_ops ops;
struct dvb_adapter *dvb;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_device *mdev;
+#endif
+
void *demodulator_priv;
void *tuner_priv;
void *frontend_priv;
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 5/9] dvb core: add support for demux/dvr nodes at media controller
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
` (3 preceding siblings ...)
2015-01-03 14:49 ` [PATCHv2 4/9] dvb core: add media controller support for DVB frontend Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 6/9] dvb core: add support for CA node at the " Mauro Carvalho Chehab
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, Changbing Xiong
Make the dvb core demux support aware of the media controller and
register the corresponding devices.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
index abff803ad69a..9071636534db 100644
--- a/drivers/media/dvb-core/dmxdev.c
+++ b/drivers/media/dvb-core/dmxdev.c
@@ -1136,13 +1136,6 @@ static const struct file_operations dvb_demux_fops = {
.llseek = default_llseek,
};
-static struct dvb_device dvbdev_demux = {
- .priv = NULL,
- .users = 1,
- .writers = 1,
- .fops = &dvb_demux_fops
-};
-
static int dvb_dvr_do_ioctl(struct file *file,
unsigned int cmd, void *parg)
{
@@ -1209,16 +1202,29 @@ static const struct file_operations dvb_dvr_fops = {
.llseek = default_llseek,
};
-static struct dvb_device dvbdev_dvr = {
- .priv = NULL,
- .readers = 1,
- .users = 1,
- .fops = &dvb_dvr_fops
-};
-
int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter)
{
int i;
+ struct dvb_device dvbdev_demux = {
+ .priv = NULL,
+ .users = 1,
+ .writers = 1,
+ .fops = &dvb_demux_fops,
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ .mdev = dmxdev->mdev,
+ .name = "demux",
+#endif
+ };
+ struct dvb_device dvbdev_dvr = {
+ .priv = NULL,
+ .readers = 1,
+ .users = 1,
+ .fops = &dvb_dvr_fops,
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ .mdev = dmxdev->mdev,
+ .name = "dvr",
+#endif
+ };
if (dmxdev->demux->open(dmxdev->demux) < 0)
return -EUSERS;
diff --git a/drivers/media/dvb-core/dmxdev.h b/drivers/media/dvb-core/dmxdev.h
index 48c6cf92ab99..09832a8e6956 100644
--- a/drivers/media/dvb-core/dmxdev.h
+++ b/drivers/media/dvb-core/dmxdev.h
@@ -36,6 +36,8 @@
#include <linux/dvb/dmx.h>
+#include <media/media-device.h>
+
#include "dvbdev.h"
#include "demux.h"
#include "dvb_ringbuffer.h"
@@ -110,6 +112,10 @@ struct dmxdev {
struct mutex mutex;
spinlock_t lock;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_device *mdev;
+#endif
};
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 6/9] dvb core: add support for CA node at the media controller
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
` (4 preceding siblings ...)
2015-01-03 14:49 ` [PATCHv2 5/9] dvb core: add support for demux/dvr nodes at media controller Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 7/9] dvb core: add support for DVB net " Mauro Carvalho Chehab
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab
Make the dvb core CA support aware of the media controller and
register the corresponding devices.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
index 0aac3096728e..011cb2bc04e1 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -1638,14 +1638,6 @@ static const struct file_operations dvb_ca_fops = {
.llseek = noop_llseek,
};
-static struct dvb_device dvbdev_ca = {
- .priv = NULL,
- .users = 1,
- .readers = 1,
- .writers = 1,
- .fops = &dvb_ca_fops,
-};
-
/* ******************************************************************************** */
/* Initialisation/shutdown functions */
@@ -1667,6 +1659,17 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter,
int ret;
struct dvb_ca_private *ca = NULL;
int i;
+ struct dvb_device dvbdev_ca = {
+ .priv = NULL,
+ .users = 1,
+ .readers = 1,
+ .writers = 1,
+ .fops = &dvb_ca_fops,
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ .mdev = pubca->mdev,
+ .name = "ca_en50221",
+#endif
+ };
dprintk("%s\n", __func__);
diff --git a/drivers/media/dvb-core/dvb_ca_en50221.h b/drivers/media/dvb-core/dvb_ca_en50221.h
index 7df2e141187a..c8e69f418eb5 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.h
+++ b/drivers/media/dvb-core/dvb_ca_en50221.h
@@ -24,6 +24,8 @@
#include <linux/list.h>
#include <linux/dvb/ca.h>
+#include <media/media-device.h>
+
#include "dvbdev.h"
#define DVB_CA_EN50221_POLL_CAM_PRESENT 1
@@ -74,6 +76,10 @@ struct dvb_ca_en50221 {
/* Opaque data used by the dvb_ca core. Do not modify! */
void* private;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_device *mdev;
+#endif
};
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 7/9] dvb core: add support for DVB net node at the media controller
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
` (5 preceding siblings ...)
2015-01-03 14:49 ` [PATCHv2 6/9] dvb core: add support for CA node at the " Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 8/9] cx231xx: add media controller support Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 9/9] dvbdev: add pad for the DVB devnodes Mauro Carvalho Chehab
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, Dan Carpenter, David S. Miller,
Tom Gundersen, Joe Perches
Make the dvb core network support aware of the media controller and
register the corresponding devices.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/dvb-core/dvb_net.c b/drivers/media/dvb-core/dvb_net.c
index e4041f074909..cbb50da6b35f 100644
--- a/drivers/media/dvb-core/dvb_net.c
+++ b/drivers/media/dvb-core/dvb_net.c
@@ -1498,14 +1498,6 @@ static const struct file_operations dvb_net_fops = {
.llseek = noop_llseek,
};
-static struct dvb_device dvbdev_net = {
- .priv = NULL,
- .users = 1,
- .writers = 1,
- .fops = &dvb_net_fops,
-};
-
-
void dvb_net_release (struct dvb_net *dvbnet)
{
int i;
@@ -1530,6 +1522,16 @@ int dvb_net_init (struct dvb_adapter *adap, struct dvb_net *dvbnet,
struct dmx_demux *dmx)
{
int i;
+ struct dvb_device dvbdev_net = {
+ .priv = NULL,
+ .users = 1,
+ .writers = 1,
+ .fops = &dvb_net_fops,
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ .mdev = dvbnet->mdev,
+ .name = "dvb net",
+#endif
+ };
mutex_init(&dvbnet->ioctl_mutex);
dvbnet->demux = dmx;
diff --git a/drivers/media/dvb-core/dvb_net.h b/drivers/media/dvb-core/dvb_net.h
index ede78e8c8aa8..7e32e416a67c 100644
--- a/drivers/media/dvb-core/dvb_net.h
+++ b/drivers/media/dvb-core/dvb_net.h
@@ -28,6 +28,8 @@
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
+#include <media/media-device.h>
+
#include "dvbdev.h"
#define DVB_NET_DEVICES_MAX 10
@@ -41,6 +43,10 @@ struct dvb_net {
unsigned int exit:1;
struct dmx_demux *demux;
struct mutex ioctl_mutex;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_device *mdev;
+#endif
};
void dvb_net_release(struct dvb_net *);
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 8/9] cx231xx: add media controller support
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
` (6 preceding siblings ...)
2015-01-03 14:49 ` [PATCHv2 7/9] dvb core: add support for DVB net " Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 9/9] dvbdev: add pad for the DVB devnodes Mauro Carvalho Chehab
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, Matthias Schwarzott, Antti Palosaari,
Hans Verkuil
Let's add media controller support for this driver and register it
for both V4L and DVB.
The media controller on this driver is not mandatory, as it can fully
work without it. So, if the media controller register fails, just print
an error message, but proceed with device registering.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c
index ae05d591f228..7e1c73a5172d 100644
--- a/drivers/media/usb/cx231xx/cx231xx-cards.c
+++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
@@ -912,9 +912,6 @@ static inline void cx231xx_set_model(struct cx231xx *dev)
*/
void cx231xx_pre_card_setup(struct cx231xx *dev)
{
-
- cx231xx_set_model(dev);
-
dev_info(dev->dev, "Identified as %s (card=%d)\n",
dev->board.name, dev->model);
@@ -1092,6 +1089,17 @@ void cx231xx_config_i2c(struct cx231xx *dev)
call_all(dev, video, s_stream, 1);
}
+static void cx231xx_unregister_media_device(struct cx231xx *dev)
+{
+#ifdef CONFIG_MEDIA_CONTROLLER
+ if (dev->media_dev) {
+ media_device_unregister(dev->media_dev);
+ kfree(dev->media_dev);
+ dev->media_dev = NULL;
+ }
+#endif
+}
+
/*
* cx231xx_realease_resources()
* unregisters the v4l2,i2c and usb devices
@@ -1099,6 +1107,8 @@ void cx231xx_config_i2c(struct cx231xx *dev)
*/
void cx231xx_release_resources(struct cx231xx *dev)
{
+ cx231xx_unregister_media_device(dev);
+
cx231xx_release_analog_resources(dev);
cx231xx_remove_from_devlist(dev);
@@ -1117,6 +1127,38 @@ void cx231xx_release_resources(struct cx231xx *dev)
clear_bit(dev->devno, &cx231xx_devused);
}
+static void cx231xx_media_device_register(struct cx231xx *dev,
+ struct usb_device *udev)
+{
+#ifdef CONFIG_MEDIA_CONTROLLER
+ struct media_device *mdev;
+ int ret;
+
+ mdev = kzalloc(sizeof(*mdev), GFP_KERNEL);
+ if (!mdev)
+ return;
+
+ mdev->dev = dev->dev;
+ strlcpy(mdev->model, dev->board.name, sizeof(mdev->model));
+ if (udev->serial)
+ strlcpy(mdev->serial, udev->serial, sizeof(mdev->serial));
+ strcpy(mdev->bus_info, udev->devpath);
+ mdev->hw_revision = le16_to_cpu(udev->descriptor.bcdDevice);
+ mdev->driver_version = LINUX_VERSION_CODE;
+
+ ret = media_device_register(mdev);
+ if (ret) {
+ dev_err(dev->dev,
+ "Couldn't create a media device. Error: %d\n",
+ ret);
+ kfree(mdev);
+ return;
+ }
+
+ dev->media_dev = mdev;
+#endif
+}
+
/*
* cx231xx_init_dev()
* allocates and inits the device structs, registers i2c bus and v4l device
@@ -1225,10 +1267,8 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,
}
retval = cx231xx_register_analog_devices(dev);
- if (retval) {
- cx231xx_release_analog_resources(dev);
+ if (retval)
goto err_analog;
- }
cx231xx_ir_init(dev);
@@ -1236,6 +1276,8 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,
return 0;
err_analog:
+ cx231xx_unregister_media_device(dev);
+ cx231xx_release_analog_resources(dev);
cx231xx_remove_from_devlist(dev);
err_dev_init:
cx231xx_dev_uninit(dev);
@@ -1437,6 +1479,8 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
dev->video_mode.alt = -1;
dev->dev = d;
+ cx231xx_set_model(dev);
+
dev->interface_count++;
/* reset gpio dir and value */
dev->gpio_dir = 0;
@@ -1501,7 +1545,11 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
/* save our data pointer in this interface device */
usb_set_intfdata(interface, dev);
+ /* Register the media controller */
+ cx231xx_media_device_register(dev, udev);
+
/* Create v4l2 device */
+ dev->v4l2_dev.mdev = dev->media_dev;
retval = v4l2_device_register(&interface->dev, &dev->v4l2_dev);
if (retval) {
dev_err(d, "v4l2_device_register failed\n");
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index dd600b994e69..1c0d082fc4ef 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -500,6 +500,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
dvb->dmxdev.filternum = 256;
dvb->dmxdev.demux = &dvb->demux.dmx;
dvb->dmxdev.capabilities = 0;
+ dvb->dmxdev.mdev = dev->media_dev;
result = dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
if (result < 0) {
dev_warn(dev->dev,
@@ -535,6 +536,7 @@ static int register_dvb(struct cx231xx_dvb *dvb,
}
/* register network adapter */
+ dvb->net.mdev = dev->media_dev;
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
return 0;
@@ -846,6 +848,8 @@ static int dvb_init(struct cx231xx *dev)
result = -EINVAL;
goto out_free;
}
+ if (dev->media_dev)
+ dev->dvb->frontend->mdev = dev->media_dev;
/* register everything */
result = register_dvb(dvb, THIS_MODULE, dev, dev->dev);
diff --git a/drivers/media/usb/cx231xx/cx231xx.h b/drivers/media/usb/cx231xx/cx231xx.h
index 6d6f3ee812f6..af9d6c4041dc 100644
--- a/drivers/media/usb/cx231xx/cx231xx.h
+++ b/drivers/media/usb/cx231xx/cx231xx.h
@@ -658,6 +658,10 @@ struct cx231xx {
struct video_device *vbi_dev;
struct video_device *radio_dev;
+#if defined(CONFIG_MEDIA_CONTROLLER)
+ struct media_device *media_dev;
+#endif
+
unsigned char eedata[256];
struct cx231xx_video_mode video_mode;
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCHv2 9/9] dvbdev: add pad for the DVB devnodes
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
` (7 preceding siblings ...)
2015-01-03 14:49 ` [PATCHv2 8/9] cx231xx: add media controller support Mauro Carvalho Chehab
@ 2015-01-03 14:49 ` Mauro Carvalho Chehab
8 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-03 14:49 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab
We want to represent the links between the several DVB devnodes,
so let's create PADs for them.
The DVB net devnode is a different matter, as it is not related
to the media stream, but with network. So, at least for now, let's
not add any pad for it.
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c
index 28e9d53d0979..202c15582fa3 100644
--- a/drivers/media/dvb-core/dvbdev.c
+++ b/drivers/media/dvb-core/dvbdev.c
@@ -184,7 +184,7 @@ static void dvb_register_media_device(struct dvb_device *dvbdev,
int type, int minor)
{
#if defined(CONFIG_MEDIA_CONTROLLER)
- int ret;
+ int ret = 0, npads;
if (!dvbdev->mdev)
return;
@@ -196,18 +196,46 @@ static void dvb_register_media_device(struct dvb_device *dvbdev,
dvbdev->entity->info.dvb.major = DVB_MAJOR;
dvbdev->entity->info.dvb.minor = minor;
dvbdev->entity->name = dvbdev->name;
+
+ switch(type) {
+ case DVB_DEVICE_CA:
+ case DVB_DEVICE_DEMUX:
+ npads = 2;
+ break;
+ case DVB_DEVICE_NET:
+ npads = 0;
+ break;
+ default:
+ npads = 1;
+ }
+
+ if (npads) {
+ dvbdev->pads = kcalloc(npads, sizeof(*dvbdev->pads),
+ GFP_KERNEL);
+ if (!dvbdev->pads) {
+ kfree(dvbdev->entity);
+ return;
+ }
+ }
+
switch(type) {
case DVB_DEVICE_FRONTEND:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_FE;
+ dvbdev->pads[0].flags = MEDIA_PAD_FL_SOURCE;
break;
case DVB_DEVICE_DEMUX:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_DEMUX;
+ dvbdev->pads[0].flags = MEDIA_PAD_FL_SOURCE;
+ dvbdev->pads[1].flags = MEDIA_PAD_FL_SINK;
break;
case DVB_DEVICE_DVR:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_DVR;
+ dvbdev->pads[0].flags = MEDIA_PAD_FL_SINK;
break;
case DVB_DEVICE_CA:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_CA;
+ dvbdev->pads[0].flags = MEDIA_PAD_FL_SOURCE;
+ dvbdev->pads[1].flags = MEDIA_PAD_FL_SINK;
break;
case DVB_DEVICE_NET:
dvbdev->entity->type = MEDIA_ENT_T_DEVNODE_DVB_NET;
@@ -218,11 +246,16 @@ static void dvb_register_media_device(struct dvb_device *dvbdev,
return;
}
- ret = media_device_register_entity(dvbdev->mdev, dvbdev->entity);
+ if (npads)
+ ret = media_entity_init(dvbdev->entity, npads, dvbdev->pads, 0);
+ if (!ret)
+ ret = media_device_register_entity(dvbdev->mdev,
+ dvbdev->entity);
if (ret < 0) {
printk(KERN_ERR
"%s: media_device_register_entity failed for %s\n",
__func__, dvbdev->entity->name);
+ kfree(dvbdev->pads);
kfree(dvbdev->entity);
dvbdev->entity = NULL;
return;
@@ -335,6 +368,7 @@ void dvb_unregister_device(struct dvb_device *dvbdev)
if (dvbdev->entity) {
media_device_unregister_entity(dvbdev->entity);
kfree(dvbdev->entity);
+ kfree(dvbdev->pads);
}
#endif
diff --git a/drivers/media/dvb-core/dvbdev.h b/drivers/media/dvb-core/dvbdev.h
index f58dfef46984..513ca92028dd 100644
--- a/drivers/media/dvb-core/dvbdev.h
+++ b/drivers/media/dvb-core/dvbdev.h
@@ -98,8 +98,9 @@ struct dvb_device {
struct media_device *mdev;
const char *name;
- /* Filled inside dvbdev.c */
+ /* Allocated and filled inside dvbdev.c */
struct media_entity *entity;
+ struct media_pad *pads;
#endif
void *priv;
--
2.1.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCHv2 1/9] media: Fix DVB representation at media controller API
2015-01-03 14:49 ` [PATCHv2 1/9] media: Fix DVB representation at media controller API Mauro Carvalho Chehab
@ 2015-01-11 13:50 ` Laurent Pinchart
2015-01-11 13:58 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 14+ messages in thread
From: Laurent Pinchart @ 2015-01-11 13:50 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, linux-api
Hi Mauro,
Thank you for the patch.
On Saturday 03 January 2015 12:49:03 Mauro Carvalho Chehab wrote:
> The DVB devices are identified via a (major, minor) tuple,
> and not by a random id. Fix it, before we start using it.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index e00459185d20..de333cc8261b 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -97,7 +97,10 @@ struct media_entity {
> u32 device;
> u32 subdevice;
> } alsa;
> - int dvb;
> + struct {
> + u32 major;
> + u32 minor;
> + } dvb;
>
> /* Sub-device specifications */
> /* Nothing needed yet */
> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> index d847c760e8f0..7902e800f019 100644
> --- a/include/uapi/linux/media.h
> +++ b/include/uapi/linux/media.h
> @@ -27,7 +27,7 @@
> #include <linux/types.h>
> #include <linux/version.h>
>
> -#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
> +#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 1)
>
> struct media_device_info {
> char driver[16];
> @@ -88,7 +88,10 @@ struct media_entity_desc {
> __u32 device;
> __u32 subdevice;
> } alsa;
> - int dvb;
> + struct {
> + __u32 major;
> + __u32 minor;
> + } dvb;
Won't this break compilation of existing userspace code ? As DVB is not
properly supported in MC at the moment we could consider that only mediactl
will be affected, so it shouldn't be a big issue.
>
> /* Sub-device specifications */
> /* Nothing needed yet */
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv2 1/9] media: Fix DVB representation at media controller API
2015-01-11 13:50 ` Laurent Pinchart
@ 2015-01-11 13:58 ` Mauro Carvalho Chehab
2015-01-11 14:05 ` Laurent Pinchart
0 siblings, 1 reply; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-11 13:58 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, linux-api
Em Sun, 11 Jan 2015 15:50:04 +0200
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:
> Hi Mauro,
>
> Thank you for the patch.
>
> On Saturday 03 January 2015 12:49:03 Mauro Carvalho Chehab wrote:
> > The DVB devices are identified via a (major, minor) tuple,
> > and not by a random id. Fix it, before we start using it.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >
> > diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> > index e00459185d20..de333cc8261b 100644
> > --- a/include/media/media-entity.h
> > +++ b/include/media/media-entity.h
> > @@ -97,7 +97,10 @@ struct media_entity {
> > u32 device;
> > u32 subdevice;
> > } alsa;
> > - int dvb;
> > + struct {
> > + u32 major;
> > + u32 minor;
> > + } dvb;
> >
> > /* Sub-device specifications */
> > /* Nothing needed yet */
> > diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> > index d847c760e8f0..7902e800f019 100644
> > --- a/include/uapi/linux/media.h
> > +++ b/include/uapi/linux/media.h
> > @@ -27,7 +27,7 @@
> > #include <linux/types.h>
> > #include <linux/version.h>
> >
> > -#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
> > +#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 1)
> >
> > struct media_device_info {
> > char driver[16];
> > @@ -88,7 +88,10 @@ struct media_entity_desc {
> > __u32 device;
> > __u32 subdevice;
> > } alsa;
> > - int dvb;
> > + struct {
> > + __u32 major;
> > + __u32 minor;
> > + } dvb;
>
> Won't this break compilation of existing userspace code ? As DVB is not
> properly supported in MC at the moment we could consider that only mediactl
> will be affected, so it shouldn't be a big issue.
Well, media-ctl uses a local copy of the videodev2.h header, so it won't
break.
I'm not aware of any other application using MC for DVB.
Yet, imagining that such application exists, then, IMHO, it is better
to break compilation for it, as probably such application was written for
some OOT driver that might be using its own version of the media
controller implementation.
Regards,
Mauro
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv2 1/9] media: Fix DVB representation at media controller API
2015-01-11 13:58 ` Mauro Carvalho Chehab
@ 2015-01-11 14:05 ` Laurent Pinchart
2015-01-11 14:34 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 14+ messages in thread
From: Laurent Pinchart @ 2015-01-11 14:05 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, linux-api
Hi Mauro,
On Sunday 11 January 2015 11:58:24 Mauro Carvalho Chehab wrote:
> Em Sun, 11 Jan 2015 15:50:04 +0200 Laurent Pinchart escreveu:
> > On Saturday 03 January 2015 12:49:03 Mauro Carvalho Chehab wrote:
> >> The DVB devices are identified via a (major, minor) tuple,
> >> and not by a random id. Fix it, before we start using it.
> >>
> >> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >>
> >> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> >> index e00459185d20..de333cc8261b 100644
> >> --- a/include/media/media-entity.h
> >> +++ b/include/media/media-entity.h
> >> @@ -97,7 +97,10 @@ struct media_entity {
> >> u32 device;
> >> u32 subdevice;
> >> } alsa;
> >> - int dvb;
> >> + struct {
> >> + u32 major;
> >> + u32 minor;
> >> + } dvb;
> >>
> >> /* Sub-device specifications */
> >> /* Nothing needed yet */
> >> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> >> index d847c760e8f0..7902e800f019 100644
> >> --- a/include/uapi/linux/media.h
> >> +++ b/include/uapi/linux/media.h
> >> @@ -27,7 +27,7 @@
> >> #include <linux/types.h>
> >> #include <linux/version.h>
> >>
> >> -#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
> >> +#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 1)
> >>
> >> struct media_device_info {
> >> char driver[16];
> >> @@ -88,7 +88,10 @@ struct media_entity_desc {
> >> __u32 device;
> >> __u32 subdevice;
> >> } alsa;
> >> - int dvb;
> >> + struct {
> >> + __u32 major;
> >> + __u32 minor;
> >> + } dvb;
> >
> > Won't this break compilation of existing userspace code ? As DVB is not
> > properly supported in MC at the moment we could consider that only
> > mediactl will be affected, so it shouldn't be a big issue.
>
> Well, media-ctl uses a local copy of the videodev2.h header, so it won't
> break.
It's media.h, but you're correct here.
> I'm not aware of any other application using MC for DVB.
>
> Yet, imagining that such application exists, then, IMHO, it is better
> to break compilation for it, as probably such application was written for
> some OOT driver that might be using its own version of the media
> controller implementation.
OK. I'll remember that argument the next time I want to break a kernel API
though ;-)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCHv2 1/9] media: Fix DVB representation at media controller API
2015-01-11 14:05 ` Laurent Pinchart
@ 2015-01-11 14:34 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 14+ messages in thread
From: Mauro Carvalho Chehab @ 2015-01-11 14:34 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, linux-api
Em Sun, 11 Jan 2015 16:05:32 +0200
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:
> Hi Mauro,
>
> On Sunday 11 January 2015 11:58:24 Mauro Carvalho Chehab wrote:
> > Em Sun, 11 Jan 2015 15:50:04 +0200 Laurent Pinchart escreveu:
> > > On Saturday 03 January 2015 12:49:03 Mauro Carvalho Chehab wrote:
> > >> The DVB devices are identified via a (major, minor) tuple,
> > >> and not by a random id. Fix it, before we start using it.
> > >>
> > >> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> > >>
> > >> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> > >> index e00459185d20..de333cc8261b 100644
> > >> --- a/include/media/media-entity.h
> > >> +++ b/include/media/media-entity.h
> > >> @@ -97,7 +97,10 @@ struct media_entity {
> > >> u32 device;
> > >> u32 subdevice;
> > >> } alsa;
> > >> - int dvb;
> > >> + struct {
> > >> + u32 major;
> > >> + u32 minor;
> > >> + } dvb;
> > >>
> > >> /* Sub-device specifications */
> > >> /* Nothing needed yet */
> > >> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> > >> index d847c760e8f0..7902e800f019 100644
> > >> --- a/include/uapi/linux/media.h
> > >> +++ b/include/uapi/linux/media.h
> > >> @@ -27,7 +27,7 @@
> > >> #include <linux/types.h>
> > >> #include <linux/version.h>
> > >>
> > >> -#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 0)
> > >> +#define MEDIA_API_VERSION KERNEL_VERSION(0, 1, 1)
> > >>
> > >> struct media_device_info {
> > >> char driver[16];
> > >> @@ -88,7 +88,10 @@ struct media_entity_desc {
> > >> __u32 device;
> > >> __u32 subdevice;
> > >> } alsa;
> > >> - int dvb;
> > >> + struct {
> > >> + __u32 major;
> > >> + __u32 minor;
> > >> + } dvb;
> > >
> > > Won't this break compilation of existing userspace code ? As DVB is not
> > > properly supported in MC at the moment we could consider that only
> > > mediactl will be affected, so it shouldn't be a big issue.
> >
> > Well, media-ctl uses a local copy of the videodev2.h header, so it won't
> > break.
>
> It's media.h, but you're correct here.
Ah, yes, that's what I meant ;)
Btw, I have also the patches adding support for DVB at v4l-utils:
http://git.linuxtv.org/cgit.cgi/mchehab/experimental-v4l-utils.git/log/?h=dvb-media-ctl
>
> > I'm not aware of any other application using MC for DVB.
> >
> > Yet, imagining that such application exists, then, IMHO, it is better
> > to break compilation for it, as probably such application was written for
> > some OOT driver that might be using its own version of the media
> > controller implementation.
>
> OK. I'll remember that argument the next time I want to break a kernel API
> though ;-)
:)
Actually, we're not breaking the Kernel API here, as DVB support
inside the media controller were never added.
Next time, we should be sure to not add provision for an API at
the Kernel without actually implementing it ;)
Btw, eventually we'll end facing the very same issue when we
merge support for ALSA. IMHO, it is just easier to use major,minor
for all devnodes than to use anything else.
Yet, you're right: maybe we should do, instead:
union {
struct {
u32 major;
u32 minor;
} dev;
/* DEPRECATED: old node specifications */
struct {
u32 major;
u32 minor;
} v4l;
struct {
u32 major;
u32 minor;
} fb;
struct {
u32 card;
u32 device;
u32 subdevice;
} alsa;
int dvb;
/* Sub-device specifications */
/* Nothing needed yet */
} info;
And change media-ctl to use info.dev for all devnodes. This will
provide a fix when we add support for alsa devnodes too.
Regards,
Mauro
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2015-01-11 14:34 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-03 14:49 [PATCHv2 0/9] dvb core: add basic support for the media controller Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 1/9] media: Fix DVB representation at media controller API Mauro Carvalho Chehab
2015-01-11 13:50 ` Laurent Pinchart
2015-01-11 13:58 ` Mauro Carvalho Chehab
2015-01-11 14:05 ` Laurent Pinchart
2015-01-11 14:34 ` Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 2/9] media: add new types for DVB devnodes Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 3/9] dvb core: add support for media controller at dvbdev Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 4/9] dvb core: add media controller support for DVB frontend Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 5/9] dvb core: add support for demux/dvr nodes at media controller Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 6/9] dvb core: add support for CA node at the " Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 7/9] dvb core: add support for DVB net " Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 8/9] cx231xx: add media controller support Mauro Carvalho Chehab
2015-01-03 14:49 ` [PATCHv2 9/9] dvbdev: add pad for the DVB devnodes Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox