Commit 2773b0e9 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] add media controller support to videobuf2-dvb

Allow devices to pass an optional argument to register the DVB
driver at the media controller.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent de390787
...@@ -2301,7 +2301,8 @@ static int dvb_register(struct cx23885_tsport *port) ...@@ -2301,7 +2301,8 @@ static int dvb_register(struct cx23885_tsport *port)
/* register everything */ /* register everything */
ret = vb2_dvb_register_bus(&port->frontends, THIS_MODULE, port, 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) if (ret)
goto frontend_detach; goto frontend_detach;
......
...@@ -1642,7 +1642,8 @@ static int dvb_register(struct cx8802_dev *dev) ...@@ -1642,7 +1642,8 @@ static int dvb_register(struct cx8802_dev *dev)
/* register everything */ /* register everything */
res = vb2_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, 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) if (res)
goto frontend_detach; goto frontend_detach;
return res; return res;
......
...@@ -463,7 +463,7 @@ static int netup_unidvb_dvb_init(struct netup_unidvb_dev *ndev, ...@@ -463,7 +463,7 @@ static int netup_unidvb_dvb_init(struct netup_unidvb_dev *ndev,
if (vb2_dvb_register_bus(&ndev->frontends[num], if (vb2_dvb_register_bus(&ndev->frontends[num],
THIS_MODULE, NULL, THIS_MODULE, NULL,
&ndev->pci_dev->dev, adapter_nr, 1)) { &ndev->pci_dev->dev, NULL, adapter_nr, 1)) {
dev_dbg(&ndev->pci_dev->dev, dev_dbg(&ndev->pci_dev->dev,
"%s(): unable to register DVB bus %d\n", "%s(): unable to register DVB bus %d\n",
__func__, num); __func__, num);
......
...@@ -1884,7 +1884,7 @@ static int dvb_init(struct saa7134_dev *dev) ...@@ -1884,7 +1884,7 @@ static int dvb_init(struct saa7134_dev *dev)
/* register everything else */ /* register everything else */
ret = vb2_dvb_register_bus(&dev->frontends, THIS_MODULE, dev, 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 /* this sequence is necessary to make the tda1004x load its firmware
* and to enter analog mode of hybrid boards * and to enter analog mode of hybrid boards
......
...@@ -77,6 +77,7 @@ static int vb2_dvb_register_adapter(struct vb2_dvb_frontends *fe, ...@@ -77,6 +77,7 @@ static int vb2_dvb_register_adapter(struct vb2_dvb_frontends *fe,
struct module *module, struct module *module,
void *adapter_priv, void *adapter_priv,
struct device *device, struct device *device,
struct media_device *mdev,
char *adapter_name, char *adapter_name,
short *adapter_nr, short *adapter_nr,
int mfe_shared) int mfe_shared)
...@@ -94,7 +95,10 @@ static int vb2_dvb_register_adapter(struct vb2_dvb_frontends *fe, ...@@ -94,7 +95,10 @@ static int vb2_dvb_register_adapter(struct vb2_dvb_frontends *fe,
} }
fe->adapter.priv = adapter_priv; fe->adapter.priv = adapter_priv;
fe->adapter.mfe_shared = mfe_shared; fe->adapter.mfe_shared = mfe_shared;
#ifdef CONFIG_MEDIA_CONTROLLER_DVB
if (mdev)
fe->adapter.mdev = mdev;
#endif
return result; return result;
} }
...@@ -193,6 +197,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f, ...@@ -193,6 +197,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
struct module *module, struct module *module,
void *adapter_priv, void *adapter_priv,
struct device *device, struct device *device,
struct media_device *mdev,
short *adapter_nr, short *adapter_nr,
int mfe_shared) int mfe_shared)
{ {
...@@ -207,7 +212,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f, ...@@ -207,7 +212,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
} }
/* Bring up the adapter */ /* 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); fe->dvb.name, adapter_nr, mfe_shared);
if (res < 0) { if (res < 0) {
pr_warn("vb2_dvb_register_adapter failed (errno = %d)\n", res); 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, ...@@ -224,7 +229,11 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
fe->dvb.name, res); fe->dvb.name, res);
goto err; goto err;
} }
res = dvb_create_media_graph(&f->adapter, false);
if (res < 0)
goto err;
} }
mutex_unlock(&f->lock); mutex_unlock(&f->lock);
return 0; return 0;
......
...@@ -8,6 +8,10 @@ ...@@ -8,6 +8,10 @@
#include <dvb_frontend.h> #include <dvb_frontend.h>
#include <media/videobuf2-v4l2.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 * TODO: This header file should be replaced with videobuf2-core.h
* Currently, vb2_thread is not a stuff of videobuf2-core, * Currently, vb2_thread is not a stuff of videobuf2-core,
...@@ -50,6 +54,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f, ...@@ -50,6 +54,7 @@ int vb2_dvb_register_bus(struct vb2_dvb_frontends *f,
struct module *module, struct module *module,
void *adapter_priv, void *adapter_priv,
struct device *device, struct device *device,
struct media_device *mdev,
short *adapter_nr, short *adapter_nr,
int mfe_shared); int mfe_shared);
......
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