Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  tm6000-dvb.c - dvb-t support for TM5600/TM6000/TM6010 USB video capture devices
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (C) 2007 Michel Ludwig <michel.ludwig@gmail.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/usb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #include "tm6000.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include "tm6000-regs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include "zl10353.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <media/tuner.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include "tuner-xc2028.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include "xc5000.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) MODULE_DESCRIPTION("DVB driver extension module for tm5600/6000/6010 based TV cards");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) MODULE_AUTHOR("Mauro Carvalho Chehab");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) MODULE_SUPPORTED_DEVICE("{{Trident, tm5600},{{Trident, tm6000},{{Trident, tm6010}");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static int debug;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) module_param(debug, int, 0644);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) MODULE_PARM_DESC(debug, "enable debug message");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) static inline void print_err_status(struct tm6000_core *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 				    int packet, int status)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	char *errmsg = "Unknown";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	switch (status) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	case -ENOENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		errmsg = "unlinked synchronously";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	case -ECONNRESET:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		errmsg = "unlinked asynchronously";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 	case -ENOSR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 		errmsg = "Buffer error (overrun)";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	case -EPIPE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 		errmsg = "Stalled (device not responding)";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	case -EOVERFLOW:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 		errmsg = "Babble (bad cable?)";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	case -EPROTO:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 		errmsg = "Bit-stuff error (bad cable?)";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 	case -EILSEQ:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 		errmsg = "CRC/Timeout (could be anything)";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	case -ETIME:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		errmsg = "Device does not respond";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	if (packet < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 		dprintk(dev, 1, "URB status %d [%s].\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 			status, errmsg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		dprintk(dev, 1, "URB packet %d, status %d [%s].\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 			packet, status, errmsg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) static void tm6000_urb_received(struct urb *urb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	struct tm6000_core *dev = urb->context;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	switch (urb->status) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	case 0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	case -ETIMEDOUT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	case -ENOENT:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	case -ECONNRESET:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	case -ESHUTDOWN:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 		print_err_status(dev, 0, urb->status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	if (urb->actual_length > 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 						   urb->actual_length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	if (dev->dvb->streams > 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		ret = usb_submit_urb(urb, GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			printk(KERN_ERR "tm6000:  error %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 			kfree(urb->transfer_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 			usb_free_urb(urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			dev->dvb->bulk_urb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) static int tm6000_start_stream(struct tm6000_core *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	unsigned int pipe, size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	struct tm6000_dvb *dvb = dev->dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	printk(KERN_INFO "tm6000: got start stream request %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	if (dev->mode != TM6000_MODE_DIGITAL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		tm6000_init_digital_mode(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		dev->mode = TM6000_MODE_DIGITAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	dvb->bulk_urb = usb_alloc_urb(0, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	if (!dvb->bulk_urb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	pipe = usb_rcvbulkpipe(dev->udev, dev->bulk_in.endp->desc.bEndpointAddress
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 							  & USB_ENDPOINT_NUMBER_MASK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	size = usb_maxpacket(dev->udev, pipe, usb_pipeout(pipe));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	size = size * 15; /* 512 x 8 or 12 or 15 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	dvb->bulk_urb->transfer_buffer = kzalloc(size, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	if (!dvb->bulk_urb->transfer_buffer) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		usb_free_urb(dvb->bulk_urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		dvb->bulk_urb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	usb_fill_bulk_urb(dvb->bulk_urb, dev->udev, pipe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 						 dvb->bulk_urb->transfer_buffer,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 						 size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 						 tm6000_urb_received, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	ret = usb_clear_halt(dev->udev, pipe);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		printk(KERN_ERR "tm6000: error %i in %s during pipe reset\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 							ret, __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		kfree(dvb->bulk_urb->transfer_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		usb_free_urb(dvb->bulk_urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 		dvb->bulk_urb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 		printk(KERN_ERR "tm6000: pipe reset\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) /*	mutex_lock(&tm6000_driver.open_close_mutex); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	ret = usb_submit_urb(dvb->bulk_urb, GFP_ATOMIC);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) /*	mutex_unlock(&tm6000_driver.open_close_mutex); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 		printk(KERN_ERR "tm6000: submit of urb failed (error=%i)\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 									ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		kfree(dvb->bulk_urb->transfer_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 		usb_free_urb(dvb->bulk_urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		dvb->bulk_urb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) static void tm6000_stop_stream(struct tm6000_core *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	struct tm6000_dvb *dvb = dev->dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	if (dvb->bulk_urb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		printk(KERN_INFO "urb killing\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		usb_kill_urb(dvb->bulk_urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		printk(KERN_INFO "urb buffer free\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 		kfree(dvb->bulk_urb->transfer_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 		usb_free_urb(dvb->bulk_urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 		dvb->bulk_urb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) static int tm6000_start_feed(struct dvb_demux_feed *feed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	struct dvb_demux *demux = feed->demux;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	struct tm6000_core *dev = demux->priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	struct tm6000_dvb *dvb = dev->dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	printk(KERN_INFO "tm6000: got start feed request %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	mutex_lock(&dvb->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	if (dvb->streams == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 		dvb->streams = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) /*		mutex_init(&tm6000_dev->streming_mutex); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		tm6000_start_stream(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		++(dvb->streams);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	mutex_unlock(&dvb->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static int tm6000_stop_feed(struct dvb_demux_feed *feed)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	struct dvb_demux *demux = feed->demux;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	struct tm6000_core *dev = demux->priv;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	struct tm6000_dvb *dvb = dev->dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	printk(KERN_INFO "tm6000: got stop feed request %s\n", __func__);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	mutex_lock(&dvb->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	printk(KERN_INFO "stream %#x\n", dvb->streams);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	--(dvb->streams);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	if (dvb->streams == 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 		printk(KERN_INFO "stop stream\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 		tm6000_stop_stream(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /*		mutex_destroy(&tm6000_dev->streaming_mutex); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 	mutex_unlock(&dvb->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) /*	mutex_destroy(&tm6000_dev->streaming_mutex); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) static int tm6000_dvb_attach_frontend(struct tm6000_core *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	struct tm6000_dvb *dvb = dev->dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	if (dev->caps.has_zl10353) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		struct zl10353_config config = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 				     .demod_address = dev->demod_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 				     .no_tuner = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 				     .parallel_ts = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 				     .if2 = 45700,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 				     .disable_i2c_gate_ctrl = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 				    };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 		dvb->frontend = dvb_attach(zl10353_attach, &config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 							   &dev->i2c_adap);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 		printk(KERN_ERR "tm6000: no frontend defined for the device!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 	return (!dvb->frontend) ? -1 : 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) static int register_dvb(struct tm6000_core *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	int ret = -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 	struct tm6000_dvb *dvb = dev->dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	mutex_init(&dvb->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 	dvb->streams = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	/* attach the frontend */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	ret = tm6000_dvb_attach_frontend(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 		printk(KERN_ERR "tm6000: couldn't attach the frontend!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) 		goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	ret = dvb_register_adapter(&dvb->adapter, "Trident TVMaster 6000 DVB-T",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 					THIS_MODULE, &dev->udev->dev, adapter_nr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 		pr_err("tm6000: couldn't register the adapter!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		goto err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 	dvb->adapter.priv = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	if (dvb->frontend) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 		switch (dev->tuner_type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) 		case TUNER_XC2028: {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 			struct xc2028_config cfg = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) 				.i2c_adap = &dev->i2c_adap,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) 				.i2c_addr = dev->tuner_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 			};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 			dvb->frontend->callback = tm6000_tuner_callback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 			ret = dvb_register_frontend(&dvb->adapter, dvb->frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 			if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 				printk(KERN_ERR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 					"tm6000: couldn't register frontend\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 				goto adapter_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 			if (!dvb_attach(xc2028_attach, dvb->frontend, &cfg)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 				printk(KERN_ERR "tm6000: couldn't register frontend (xc3028)\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 				ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 				goto frontend_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 			printk(KERN_INFO "tm6000: XC2028/3028 asked to be attached to frontend!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) 		case TUNER_XC5000: {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 			struct xc5000_config cfg = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) 				.i2c_address = dev->tuner_addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) 			};
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 			dvb->frontend->callback = tm6000_xc5000_callback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 			ret = dvb_register_frontend(&dvb->adapter, dvb->frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 			if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 				printk(KERN_ERR
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 					"tm6000: couldn't register frontend\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 				goto adapter_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 			if (!dvb_attach(xc5000_attach, dvb->frontend, &dev->i2c_adap, &cfg)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 				printk(KERN_ERR "tm6000: couldn't register frontend (xc5000)\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 				ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 				goto frontend_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 			printk(KERN_INFO "tm6000: XC5000 asked to be attached to frontend!\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321) 	} else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) 		printk(KERN_ERR "tm6000: no frontend found\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) 	dvb->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) 							    | DMX_MEMORY_BASED_FILTERING;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326) 	dvb->demux.priv = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) 	dvb->demux.filternum = 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) 	dvb->demux.feednum = 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) 	dvb->demux.start_feed = tm6000_start_feed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330) 	dvb->demux.stop_feed = tm6000_stop_feed;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) 	dvb->demux.write_to_decoder = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) 	ret = dvb_dmx_init(&dvb->demux);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) 		printk(KERN_ERR "tm6000: dvb_dmx_init failed (errno = %d)\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335) 		goto frontend_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) 	dvb->dmxdev.filternum = dev->dvb->demux.filternum;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) 	dvb->dmxdev.demux = &dev->dvb->demux.dmx;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340) 	dvb->dmxdev.capabilities = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) 	ret =  dvb_dmxdev_init(&dvb->dmxdev, &dvb->adapter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) 	if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) 		printk(KERN_ERR "tm6000: dvb_dmxdev_init failed (errno = %d)\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345) 		goto dvb_dmx_err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) dvb_dmx_err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) 	dvb_dmx_release(&dvb->demux);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352) frontend_err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) 	if (dvb->frontend) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) 		dvb_unregister_frontend(dvb->frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355) 		dvb_frontend_detach(dvb->frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) adapter_err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358) 	dvb_unregister_adapter(&dvb->adapter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) err:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363) static void unregister_dvb(struct tm6000_core *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) 	struct tm6000_dvb *dvb = dev->dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367) 	if (dvb->bulk_urb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) 		struct urb *bulk_urb = dvb->bulk_urb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370) 		kfree(bulk_urb->transfer_buffer);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) 		bulk_urb->transfer_buffer = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) 		usb_unlink_urb(bulk_urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373) 		usb_free_urb(bulk_urb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) /*	mutex_lock(&tm6000_driver.open_close_mutex); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) 	if (dvb->frontend) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378) 		dvb_unregister_frontend(dvb->frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) 		dvb_frontend_detach(dvb->frontend);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) 	dvb_dmxdev_release(&dvb->dmxdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) 	dvb_dmx_release(&dvb->demux);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384) 	dvb_unregister_adapter(&dvb->adapter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) 	mutex_destroy(&dvb->mutex);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) /*	mutex_unlock(&tm6000_driver.open_close_mutex); */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) static int dvb_init(struct tm6000_core *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) 	struct tm6000_dvb *dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392) 	int rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) 	if (!dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) 	if (!dev->caps.has_dvb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) 	if (dev->udev->speed == USB_SPEED_FULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401) 		printk(KERN_INFO "This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) 	dvb = kzalloc(sizeof(struct tm6000_dvb), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) 	if (!dvb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409) 	dev->dvb = dvb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) 	rc = register_dvb(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) 	if (rc < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413) 		kfree(dvb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) 		dev->dvb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421) static int dvb_fini(struct tm6000_core *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) 	if (!dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426) 	if (!dev->caps.has_dvb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) 	if (dev->dvb) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) 		unregister_dvb(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) 		kfree(dev->dvb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) 		dev->dvb = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) static struct tm6000_ops dvb_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) 	.type	= TM6000_DVB,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) 	.name	= "TM6000 dvb Extension",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441) 	.init	= dvb_init,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) 	.fini	= dvb_fini,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) static int __init tm6000_dvb_register(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) 	return tm6000_register_extension(&dvb_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) static void __exit tm6000_dvb_unregister(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) 	tm6000_unregister_extension(&dvb_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) module_init(tm6000_dvb_register);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) module_exit(tm6000_dvb_unregister);