summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/saa7134/saa7134-dvb.c
diff options
context:
space:
mode:
authorGerd Knorr <devnull@localhost>2004-10-19 16:02:04 +0000
committerGerd Knorr <devnull@localhost>2004-10-19 16:02:04 +0000
commit1978764a333728085febe6606437b586fc2e14d4 (patch)
tree80d861b548370e3dfc319649d43c956e238587e2 /linux/drivers/media/video/saa7134/saa7134-dvb.c
parent005bc8a9298b2eab8e0bdb6d494b5b13c32811f4 (diff)
downloadmediapointer-dvb-s2-1978764a333728085febe6606437b586fc2e14d4.tar.gz
mediapointer-dvb-s2-1978764a333728085febe6606437b586fc2e14d4.tar.bz2
- saa7134 reorganiation for modular mpeg2 stuff
- splitted some generic dvb code into the new video-buf-dvb module.
Diffstat (limited to 'linux/drivers/media/video/saa7134/saa7134-dvb.c')
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-dvb.c113
1 files changed, 113 insertions, 0 deletions
diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c
new file mode 100644
index 000000000..662a45c10
--- /dev/null
+++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c
@@ -0,0 +1,113 @@
+/*
+ * $Id: saa7134-dvb.c,v 1.1 2004/10/19 16:02:05 kraxel Exp $
+ *
+ * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/init.h>
+#include <linux/list.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/kthread.h>
+#include <linux/suspend.h>
+
+#include "saa7134-reg.h"
+#include "saa7134.h"
+
+MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
+MODULE_LICENSE("GPL");
+
+/* ------------------------------------------------------------------ */
+
+static int dvb_init(struct saa7134_dev *dev)
+{
+ int err;
+
+ printk("%s: %s\n",dev->name,__FUNCTION__);
+
+ videobuf_queue_init(&dev->dvb.dvbq, &saa7134_ts_qops,
+ dev->pci, &dev->slock,
+ V4L2_BUF_TYPE_VIDEO_CAPTURE,
+ V4L2_FIELD_TOP,
+ sizeof(struct saa7134_buf));
+ init_MUTEX(&dev->dvb.dvbq.lock);
+
+ /* init struct videobuf_dvb */
+ dev->dvb.priv = dev;
+ dev->dvb.name = dev->name;
+
+ /* register adapter */
+ err = dvb_register_adapter(&dev->dvb.adapter, dev->name,
+ THIS_MODULE);
+ if (err < 0) {
+ printk(KERN_WARNING "%s: dvb_register_adapter failed (errno = %d)\n",
+ dev->name, err);
+ goto fail1;
+ }
+
+ /* TODO: init + register frontend */
+
+ /* register everything else */
+ err = videobuf_dvb_register(&dev->dvb);
+ if (0 != err)
+ goto fail2;
+ return 0;
+
+fail2:
+ dvb_unregister_adapter(dev->dvb.adapter);
+fail1:
+ return err;
+}
+
+static int dvb_fini(struct saa7134_dev *dev)
+{
+ printk("%s: %s\n",dev->name,__FUNCTION__);
+
+ videobuf_dvb_unregister(&dev->dvb);
+ /* TODO: unregister frontend */
+ dvb_unregister_adapter(dev->dvb.adapter);
+ return 0;
+}
+
+static struct saa7134_mpeg_ops dvb_ops = {
+ .type = SAA7134_MPEG_DVB,
+ .init = dvb_init,
+ .fini = dvb_fini,
+};
+
+static int __init dvb_register(void)
+{
+ return saa7134_ts_register(&dvb_ops);
+}
+
+static void __exit dvb_unregister(void)
+{
+ saa7134_ts_unregister(&dvb_ops);
+}
+
+module_init(dvb_register);
+module_exit(dvb_unregister);
+
+/* ------------------------------------------------------------------ */
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * compile-command: "make DVB=1"
+ * End:
+ */