Commit cee3926f authored by Stefan Ringel's avatar Stefan Ringel Committed by Mauro Carvalho Chehab

V4L/DVB: tm6000: move dvb into a separate kern module

move dvb into a separate kern module

[mchehab@redhat.com: Fix several compilation breakages]
Signed-off-by: default avatarStefan Ringel <stefan.ringel@arcor.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d77057f2
...@@ -26,8 +26,8 @@ config VIDEO_TM6000_ALSA ...@@ -26,8 +26,8 @@ config VIDEO_TM6000_ALSA
module will be called tm6000-alsa. module will be called tm6000-alsa.
config VIDEO_TM6000_DVB config VIDEO_TM6000_DVB
bool "DVB Support for tm6000 based TV cards" tristate "DVB Support for tm6000 based TV cards"
depends on VIDEO_TM6000 && DVB_CORE && EXPERIMENTAL depends on VIDEO_TM6000 && DVB_CORE && USB && EXPERIMENTAL
select DVB_ZL10353 select DVB_ZL10353
---help--- ---help---
This adds support for DVB cards based on the tm5600/tm6000 chip. This adds support for DVB cards based on the tm5600/tm6000 chip.
...@@ -4,12 +4,9 @@ tm6000-objs := tm6000-cards.o \ ...@@ -4,12 +4,9 @@ tm6000-objs := tm6000-cards.o \
tm6000-video.o \ tm6000-video.o \
tm6000-stds.o tm6000-stds.o
ifeq ($(CONFIG_VIDEO_TM6000_DVB),y)
tm6000-objs += tm6000-dvb.o
endif
obj-$(CONFIG_VIDEO_TM6000) += tm6000.o obj-$(CONFIG_VIDEO_TM6000) += tm6000.o
obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o obj-$(CONFIG_VIDEO_TM6000_ALSA) += tm6000-alsa.o
obj-$(CONFIG_VIDEO_TM6000_DVB) += tm6000-dvb.o
EXTRA_CFLAGS = -Idrivers/media/video EXTRA_CFLAGS = -Idrivers/media/video
EXTRA_CFLAGS += -Idrivers/media/common/tuners EXTRA_CFLAGS += -Idrivers/media/common/tuners
......
...@@ -347,7 +347,7 @@ int tm6000_xc5000_callback(void *ptr, int component, int command, int arg) ...@@ -347,7 +347,7 @@ int tm6000_xc5000_callback(void *ptr, int component, int command, int arg)
} }
return (rc); return (rc);
} }
EXPORT_SYMBOL_GPL(tm6000_xc5000_callback);
/* Tuner callback to provide the proper gpio changes needed for xc2028 */ /* Tuner callback to provide the proper gpio changes needed for xc2028 */
...@@ -424,6 +424,7 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg) ...@@ -424,6 +424,7 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
} }
return rc; return rc;
} }
EXPORT_SYMBOL_GPL(tm6000_tuner_callback);
int tm6000_cards_setup(struct tm6000_core *dev) int tm6000_cards_setup(struct tm6000_core *dev)
{ {
...@@ -681,31 +682,11 @@ static int tm6000_init_dev(struct tm6000_core *dev) ...@@ -681,31 +682,11 @@ static int tm6000_init_dev(struct tm6000_core *dev)
goto err; goto err;
tm6000_add_into_devlist(dev); tm6000_add_into_devlist(dev);
tm6000_init_extension(dev); tm6000_init_extension(dev);
if (dev->caps.has_dvb) {
dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL);
if (!dev->dvb) {
rc = -ENOMEM;
goto err2;
}
#ifdef CONFIG_VIDEO_TM6000_DVB
rc = tm6000_dvb_register(dev);
if (rc < 0) {
kfree(dev->dvb);
dev->dvb = NULL;
goto err2;
}
#endif
}
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return 0; return 0;
err2:
v4l2_device_unregister(&dev->v4l2_dev);
err: err:
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return rc; return rc;
...@@ -906,13 +887,6 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) ...@@ -906,13 +887,6 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
mutex_lock(&dev->lock); mutex_lock(&dev->lock);
#ifdef CONFIG_VIDEO_TM6000_DVB
if (dev->dvb) {
tm6000_dvb_unregister(dev);
kfree(dev->dvb);
}
#endif
if (dev->gpio.power_led) { if (dev->gpio.power_led) {
switch (dev->model) { switch (dev->model) {
case TM6010_BOARD_HAUPPAUGE_900H: case TM6010_BOARD_HAUPPAUGE_900H:
...@@ -942,8 +916,8 @@ static void tm6000_usb_disconnect(struct usb_interface *interface) ...@@ -942,8 +916,8 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
usb_put_dev(dev->udev); usb_put_dev(dev->udev);
tm6000_remove_from_devlist(dev);
tm6000_close_extension(dev); tm6000_close_extension(dev);
tm6000_remove_from_devlist(dev);
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
kfree(dev); kfree(dev);
......
...@@ -407,6 +407,7 @@ int tm6000_init_digital_mode (struct tm6000_core *dev) ...@@ -407,6 +407,7 @@ int tm6000_init_digital_mode (struct tm6000_core *dev)
return 0; return 0;
} }
EXPORT_SYMBOL(tm6000_init_digital_mode);
struct reg_init { struct reg_init {
u8 req; u8 req;
......
...@@ -31,6 +31,19 @@ ...@@ -31,6 +31,19 @@
#include "tuner-xc2028.h" #include "tuner-xc2028.h"
#include "xc5000.h" #include "xc5000.h"
MODULE_DESCRIPTION("DVB driver extension module for tm5600/6000/6010 based TV cards");
MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{Trident, tm5600},"
"{{Trident, tm6000},"
"{{Trident, tm6010}");
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "enable debug message");
static void inline print_err_status (struct tm6000_core *dev, static void inline print_err_status (struct tm6000_core *dev,
int packet, int status) int packet, int status)
{ {
...@@ -238,7 +251,7 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev) ...@@ -238,7 +251,7 @@ int tm6000_dvb_attach_frontend(struct tm6000_core *dev)
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
int tm6000_dvb_register(struct tm6000_core *dev) int register_dvb(struct tm6000_core *dev)
{ {
int ret = -1; int ret = -1;
struct tm6000_dvb *dvb = dev->dvb; struct tm6000_dvb *dvb = dev->dvb;
...@@ -351,7 +364,7 @@ int tm6000_dvb_register(struct tm6000_core *dev) ...@@ -351,7 +364,7 @@ int tm6000_dvb_register(struct tm6000_core *dev)
return ret; return ret;
} }
void tm6000_dvb_unregister(struct tm6000_core *dev) void unregister_dvb(struct tm6000_core *dev)
{ {
struct tm6000_dvb *dvb = dev->dvb; struct tm6000_dvb *dvb = dev->dvb;
...@@ -377,3 +390,69 @@ void tm6000_dvb_unregister(struct tm6000_core *dev) ...@@ -377,3 +390,69 @@ void tm6000_dvb_unregister(struct tm6000_core *dev)
/* mutex_unlock(&tm6000_driver.open_close_mutex); */ /* mutex_unlock(&tm6000_driver.open_close_mutex); */
} }
static int dvb_init(struct tm6000_core *dev)
{
struct tm6000_dvb *dvb;
int rc;
if (!dev)
return 0;
if (!dev->caps.has_dvb)
return 0;
dvb = kzalloc(sizeof(struct tm6000_dvb), GFP_KERNEL);
if (!dvb) {
printk(KERN_INFO "Cannot allocate memory\n");
return -ENOMEM;
}
dev->dvb = dvb;
rc = register_dvb(dev);
if (rc < 0) {
kfree(dvb);
dev->dvb = NULL;
return 0;
}
return 0;
}
static int dvb_fini(struct tm6000_core *dev)
{
if (!dev)
return 0;
if (!dev->caps.has_dvb)
return 0;
if (dev->dvb) {
unregister_dvb(dev);
kfree(dev->dvb);
dev->dvb = NULL;
}
return 0;
}
static struct tm6000_ops dvb_ops = {
.id = TM6000_DVB,
.name = "TM6000 dvb Extension",
.init = dvb_init,
.fini = dvb_fini,
};
static int __init tm6000_dvb_register(void)
{
return tm6000_register_extension(&dvb_ops);
}
static void __exit tm6000_dvb_unregister(void)
{
tm6000_unregister_extension(&dvb_ops);
}
module_init(tm6000_dvb_register);
module_exit(tm6000_dvb_unregister);
...@@ -223,6 +223,7 @@ struct tm6000_core { ...@@ -223,6 +223,7 @@ struct tm6000_core {
}; };
#define TM6000_AUDIO 0x10 #define TM6000_AUDIO 0x10
#define TM6000_DVB 0x20
struct tm6000_ops { struct tm6000_ops {
struct list_head next; struct list_head next;
...@@ -269,9 +270,6 @@ int tm6000_init_analog_mode (struct tm6000_core *dev); ...@@ -269,9 +270,6 @@ int tm6000_init_analog_mode (struct tm6000_core *dev);
int tm6000_init_digital_mode (struct tm6000_core *dev); int tm6000_init_digital_mode (struct tm6000_core *dev);
int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate); int tm6000_set_audio_bitrate (struct tm6000_core *dev, int bitrate);
int tm6000_dvb_register(struct tm6000_core *dev);
void tm6000_dvb_unregister(struct tm6000_core *dev);
int tm6000_v4l2_register(struct tm6000_core *dev); int tm6000_v4l2_register(struct tm6000_core *dev);
int tm6000_v4l2_unregister(struct tm6000_core *dev); int tm6000_v4l2_unregister(struct tm6000_core *dev);
int tm6000_v4l2_exit(void); int tm6000_v4l2_exit(void);
......
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