[media] add media controller support to videobuf2-dvb
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>
Fri, 5 Feb 2016 10:35:50 +0000 (08:35 -0200)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 10 Feb 2016 09:23:41 +0000 (07:23 -0200)
Allow devices to pass an optional argument to register the DVB
driver at the media controller.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx88/cx88-dvb.c
drivers/media/pci/netup_unidvb/netup_unidvb_core.c
drivers/media/pci/saa7134/saa7134-dvb.c
drivers/media/v4l2-core/videobuf2-dvb.c
include/media/videobuf2-dvb.h

index 80319bb73d94dc25545e33c8ccefab9ed6f26497..5131c9f555fbebf4cdd3ac3003f69e9118b3def8 100644 (file)
@@ -2301,7 +2301,8 @@ static int dvb_register(struct cx23885_tsport *port)
 
        /* register everything */
        ret = vb2_dvb_register_bus(&port->frontends, THIS_MODULE, port,
-                                       &dev->pci->dev, adapter_nr, mfe_shared);
+                                  &dev->pci->dev, NULL,
+                                  adapter_nr, mfe_shared);
        if (ret)
                goto frontend_detach;
 
index afb20756d7a56ef54ed49c6b3eaf3d78878f7888..851d2a9caed3d7782e9d0ca7b8c50ede9fe28f8d 100644 (file)
@@ -1642,7 +1642,8 @@ static int dvb_register(struct cx8802_dev *dev)
 
        /* register everything */
        res = vb2_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
-               &dev->pci->dev, adapter_nr, mfe_shared);
+                                  &dev->pci->dev, NULL, adapter_nr,
+                                  mfe_shared);
        if (res)
                goto frontend_detach;
        return res;
index c94cecd2aa4068c5d7a4922800745e52b5a8dd98..2b667b3159135e204e8e7b24cdcc6531ad3108ce 100644 (file)
@@ -462,8 +462,8 @@ static int netup_unidvb_dvb_init(struct netup_unidvb_dev *ndev,
        }
 
        if (vb2_dvb_register_bus(&ndev->frontends[num],
-                       THIS_MODULE, NULL,
-                       &ndev->pci_dev->dev, adapter_nr, 1)) {
+                                THIS_MODULE, NULL,
+                                &ndev->pci_dev->dev, NULL, adapter_nr, 1)) {
                dev_dbg(&ndev->pci_dev->dev,
                        "%s(): unable to register DVB bus %d\n",
                        __func__, num);
index 101ba8729416836c07fa34cb14d6205f67552b3c..ed84f7dea94c558891406faecd6561dc07c86e4e 100644 (file)
@@ -1884,7 +1884,7 @@ static int dvb_init(struct saa7134_dev *dev)
 
        /* register everything else */
        ret = vb2_dvb_register_bus(&dev->frontends, THIS_MODULE, dev,
-                                       &dev->pci->dev, adapter_nr, 0);
+                                  &dev->pci->dev, NULL, adapter_nr, 0);
 
        /* this sequence is necessary to make the tda1004x load its firmware
         * and to enter analog mode of hybrid boards
index d09269846b7e36aa9b7d646b0dac7b10e69e5599..9f38b4218c0d26ca6f226697e0b6cff2f9038ef4 100644 (file)
@@ -77,6 +77,7 @@ static int vb2_dvb_register_adapter(struct vb2_dvb_frontends *fe,
                          struct module *module,
                          void *adapter_priv,
                          struct device *device,
+                         struct media_device *mdev,
                          char *adapter_name,
                          short *adapter_nr,
                          int mfe_shared)
@@ -94,7 +95,10 @@ static int vb2_dvb_register_adapter(struct vb2_dvb_frontends *fe,
        }
        fe->adapter.priv = adapter_priv;
        fe->adapter.mfe_shared = mfe_shared;
-
+#ifdef CONFIG_MEDIA_CONTROLLER_DVB
+       if (mdev)
+               fe->adapter.mdev = mdev;
+#endif
        return result;
 }
 
@@ -193,6 +197,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
                         struct module *module,
                         void *adapter_priv,
                         struct device *device,
+                        struct media_device *mdev,
                         short *adapter_nr,
                         int mfe_shared)
 {
@@ -207,7 +212,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
        }
 
        /* Bring up the adapter */
-       res = vb2_dvb_register_adapter(f, module, adapter_priv, device,
+       res = vb2_dvb_register_adapter(f, module, adapter_priv, device, mdev,
                fe->dvb.name, adapter_nr, mfe_shared);
        if (res < 0) {
                pr_warn("vb2_dvb_register_adapter failed (errno = %d)\n", res);
@@ -224,7 +229,11 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
                                fe->dvb.name, res);
                        goto err;
                }
+               res = dvb_create_media_graph(&f->adapter, false);
+               if (res < 0)
+                       goto err;
        }
+
        mutex_unlock(&f->lock);
        return 0;
 
index 5b64c9eac2c9324191e21f020acdca5fc9f7ce35..87b559024b4ab0a003d9d1e05bd40b53e6f8cd24 100644 (file)
@@ -8,6 +8,10 @@
 #include <dvb_frontend.h>
 
 #include <media/videobuf2-v4l2.h>
+
+/* We don't actually need to include media-device.h here */
+struct media_device;
+
 /*
  * TODO: This header file should be replaced with videobuf2-core.h
  * Currently, vb2_thread is not a stuff of videobuf2-core,
@@ -50,6 +54,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
                         struct module *module,
                         void *adapter_priv,
                         struct device *device,
+                        struct media_device *mdev,
                         short *adapter_nr,
                         int mfe_shared);