Skip to contentSkip to conversation

dvb-usb-v2: add support for the media controller at USB driver

RFC PATCH Superseded Rafael Lourenço de Lima Chehab 3 participants 3 messages Feb 12, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 dvb-usb-v2: add support for the media controller at USB driver

Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

---
 drivers/media/usb/dvb-usb-v2/dvb_usb.h      |  5 +++
 drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 61 +++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
drivers/media/usb/dvb-usb-v2/dvb_usb.h +5 -0
index 14e111e13e54..b273250d0e31 100644
@@ -25,6 +25,7 @@
 #include <linux/usb/input.h>
 #include <linux/firmware.h>
 #include <media/rc-core.h>
+#include <media/media-device.h>
 
 #include "dvb_frontend.h"
 #include "dvb_demux.h"
@@ -389,6 +390,10 @@ struct dvb_usb_device {
 	struct delayed_work rc_query_work;
 
 	void *priv;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	struct media_device *media_dev;
+#endif
 };
 
 extern int dvb_usbv2_probe(struct usb_interface *,
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +61 -0

103 lines not on this page · raw message

Signature · 1 line
2.1.0
#1 lore raw

Moikka!

Quoted 9 lines · Rafael Lourenço de Lima Chehab

Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

---
  drivers/media/usb/dvb-usb-v2/dvb_usb.h      |  5 +++
  drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 61 +++++++++++++++++++++++++++++
  2 files changed, 66 insertions(+)

I am not against that patch, but I don't simply understand media controller concept enough detailed level. So it is all up to Mauro.

regards
Antti

Signature · 1 line
http://palosaari.fi/
#2 lore raw
In reply to Rafael Lourenço de Lima Chehab

Em Wed, 11 Feb 2015 22:04:44 -0200
Rafael Lourenço de Lima Chehab <[email protected]> escreveu:

Quoted 38 lines

Create a struct media_device and add it to the dvb adapter.

Please notice that the tuner is not mapped yet by the dvb core.

---
 drivers/media/usb/dvb-usb-v2/dvb_usb.h      |  5 +++
 drivers/media/usb/dvb-usb-v2/dvb_usb_core.c | 61 +++++++++++++++++++++++++++++
 2 files changed, 66 insertions(+)
drivers/media/usb/dvb-usb-v2/dvb_usb.h +5 -0
index 14e111e13e54..b273250d0e31 100644
@@ -25,6 +25,7 @@
 #include <linux/usb/input.h>
 #include <linux/firmware.h>
 #include <media/rc-core.h>
+#include <media/media-device.h>
 
 #include "dvb_frontend.h"
 #include "dvb_demux.h"
@@ -389,6 +390,10 @@ struct dvb_usb_device {
 	struct delayed_work rc_query_work;
 
 	void *priv;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	struct media_device *media_dev;
+#endif
 };
 
 extern int dvb_usbv2_probe(struct usb_interface *,
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +0 -0
index 1950f37df835..ea4d7bec8fc1 100644

drivers/media/usb/dvb-usb-v2/dvb_usb_core.c static int dvb_usbv2_i2c_init(struct dvb_usb_device *d) · line 91

Quoted 6 lines
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +2 -0
@@ -86,6 +86,8 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
 		goto err;
 	}
 
+	dvb_create_media_graph(d->media_dev);
+
 	return 0;

Hmm... this is being called too early. It should be called, instead, at dvb_usbv2_adapter_frontend_init():

drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +2 -2
index f3d1211..0fd184c 100644
@@ -86,8 +86,6 @@ static int dvb_usbv2_i2c_init(struct dvb_usb_device *d)
 		goto err;
 	}
 
-	dvb_create_media_graph(d->media_dev);
-
 	return 0;
 err:
 	dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
@@ -703,6 +701,8 @@ static int dvb_usbv2_adapter_frontend_init(struct dvb_usb_adapter *adap)
 		}
 	}
 
+	dvb_create_media_graph(d->media_dev);
+
 	return 0;
 
 err_dvb_unregister_frontend:

With the above change, the patch looks OK on my eyes.

I did a quick test here with two devices:

$ media-ctl -p
Media controller API version 0.1.0

Media device information
------------------------

driver          usb
model           TerraTec Cinergy T Stick RC
serial          010101010600001
bus info        1.2
hw revision     0x200
driver version  3.19.0

Device topology
- entity 1: demux (2 pads, 2 links)
type Node subtype DVB DEMUX flags 0 device node name /dev/dvb/adapter0/demux0
pad0: Sink
<- "Afatech AF9013":1 [ENABLED]
pad1: Source
-> "dvr":0 [ENABLED]

- entity 2: dvr (1 pad, 1 link)
type Node subtype DVB DVR flags 0 device node name /dev/dvb/adapter0/dvr0
pad0: Sink
<- "demux":1 [ENABLED]

- entity 3: dvb net (0 pad, 0 link)
type Node subtype DVB NET flags 0 device node name /dev/dvb/adapter0/net0

- entity 4: Afatech AF9013 (2 pads, 1 link) type Node subtype DVB FE flags 0 device node name /dev/dvb/adapter0/frontend0
pad0: Sink
pad1: Source
-> "demux":0 [ENABLED]

$ media-ctl -p -d /dev/media1
Media controller API version 0.1.0

Media device information
------------------------

driver          usb
model           DVBSky S960CI
serial          20130508
bus info        2
hw revision     0x0
driver version  3.19.0

Device topology
- entity 1: demux (2 pads, 3 links)

            type Node subtype DVB DEMUX flags 0
            device node name /dev/dvb/adapter1/demux0
	pad0: Sink
		<- "Montage M88DS3103":1 [ENABLED]
	pad1: Source
		-> "dvr":0 [ENABLED]
		-> "ca_en50221":0 [ENABLED]

- entity 2: dvr (1 pad, 1 link)
type Node subtype DVB DVR flags 0 device node name /dev/dvb/adapter1/dvr0
pad0: Sink
<- "demux":1 [ENABLED]

- entity 3: dvb net (0 pad, 0 link)
type Node subtype DVB NET flags 0 device node name /dev/dvb/adapter1/net0

- entity 4: ca_en50221 (2 pads, 1 link) type Node subtype DVB CA flags 0 device node name /dev/dvb/adapter1/ca0
pad0: Sink
<- "demux":1 [ENABLED]
pad1: Source

- entity 5: Montage M88DS3103 (2 pads, 1 link) type Node subtype DVB FE flags 0 device node name /dev/dvb/adapter1/frontend0
pad0: Sink
pad1: Source
-> "demux":0 [ENABLED]

Both devices are OK on my eyes.

Regards,
Mauro