summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
diff options
context:
space:
mode:
authorDaniel Mack <devnull@localhost>2004-10-16 11:05:30 +0000
committerDaniel Mack <devnull@localhost>2004-10-16 11:05:30 +0000
commit0eb3c674c71a54f978154e242f990a7e1e55d35a (patch)
tree85ecd9aa94c43955907ce72f09b906460776fd90 /linux/drivers/media/dvb/cinergyT2/cinergyT2.c
parentff260c9222fd6b1e0a63a96fff06a6111236aff0 (diff)
downloadmediapointer-dvb-s2-0eb3c674c71a54f978154e242f990a7e1e55d35a.tar.gz
mediapointer-dvb-s2-0eb3c674c71a54f978154e242f990a7e1e55d35a.tar.bz2
- fixed some shifting bugs in tps calculation
- got rid of using the frontend infrastructure
Diffstat (limited to 'linux/drivers/media/dvb/cinergyT2/cinergyT2.c')
-rw-r--r--linux/drivers/media/dvb/cinergyT2/cinergyT2.c123
1 files changed, 79 insertions, 44 deletions
diff --git a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
index fb567c681..067e7143a 100644
--- a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
+++ b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
@@ -29,11 +29,11 @@
#include <linux/usb.h>
#include <linux/pci.h>
#include <linux/input.h>
+#include <linux/dvb/frontend.h>
#include "dmxdev.h"
#include "dvb_demux.h"
#include "dvb_net.h"
-#include "dvb_frontend.h"
#ifdef CONFIG_DVB_CINERGYT2_TUNING
@@ -87,6 +87,7 @@ struct cinergyt2 {
struct usb_device *udev;
struct semaphore sem;
struct dvb_adapter *adapter;
+ struct dvb_device *fedev;
struct dmxdev dmxdev;
struct dvb_net dvbnet;
@@ -95,6 +96,7 @@ struct cinergyt2 {
void *streambuf;
dma_addr_t streambuf_dmahandle;
struct urb *stream_urb [STREAM_URB_COUNT];
+
#ifdef ENABLE_RC
struct input_dev rc_input_dev;
struct work_struct rc_query_work;
@@ -334,7 +336,6 @@ int cinergyt2_start_feed(struct dvb_demux_feed *dvbdmxfeed)
if (cinergyt2->streaming == 0) {
- cinergyt2_control_sleep_mode(cinergyt2, 0);
if (cinergyt2_start_stream_xfer (cinergyt2) == 0)
cinergyt2_control_stream_transfer (cinergyt2, 1);
}
@@ -354,7 +355,6 @@ int cinergyt2_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
if (--cinergyt2->streaming == 0) {
cinergyt2_control_stream_transfer(cinergyt2, 0);
cinergyt2_stop_stream_xfer(cinergyt2);
- cinergyt2_control_sleep_mode(cinergyt2, 1);
}
return 0;
@@ -379,91 +379,91 @@ uint16_t compute_tps (struct dvb_frontend_parameters *param)
switch (op->code_rate_HP) {
case FEC_2_3:
- tps |= (1 << 9);
+ tps |= (1 << 7);
break;
case FEC_3_4:
- tps |= (2 << 9);
+ tps |= (2 << 7);
break;
case FEC_5_6:
- tps |= (3 << 9);
+ tps |= (3 << 7);
break;
case FEC_7_8:
- tps |= (4 << 9);
+ tps |= (4 << 7);
break;
case FEC_1_2:
case FEC_AUTO:
default:
- /* tps |= (0 << 9) */;
+ /* tps |= (0 << 7) */;
}
switch (op->code_rate_LP) {
case FEC_2_3:
- tps |= (1 << 6);
+ tps |= (1 << 4);
break;
case FEC_3_4:
- tps |= (2 << 6);
+ tps |= (2 << 4);
break;
case FEC_5_6:
- tps |= (3 << 6);
+ tps |= (3 << 4);
break;
case FEC_7_8:
- tps |= (4 << 6);
+ tps |= (4 << 4);
break;
case FEC_1_2:
case FEC_AUTO:
default:
- /* tps |= (0 << 6) */;
+ /* tps |= (0 << 4) */;
}
switch (op->constellation) {
case QAM_16:
- tps |= (1 << 14);
+ tps |= (1 << 13);
break;
case QAM_64:
- tps |= (2 << 14);
+ tps |= (2 << 13);
break;
case QPSK:
default:
- /* tps |= (0 << 14) */;
+ /* tps |= (0 << 13) */;
}
switch (op->transmission_mode) {
case TRANSMISSION_MODE_8K:
- tps |= (1 << 1);
+ tps |= (1 << 0);
break;
case TRANSMISSION_MODE_2K:
default:
- /* tps |= (0 << 1) */;
+ /* tps |= (0 << 0) */;
}
switch (op->guard_interval) {
case GUARD_INTERVAL_1_16:
- tps |= (1 << 3);
+ tps |= (1 << 2);
break;
case GUARD_INTERVAL_1_8:
- tps |= (2 << 3);
+ tps |= (2 << 2);
break;
case GUARD_INTERVAL_1_4:
- tps |= (3 << 3);
+ tps |= (3 << 2);
break;
case GUARD_INTERVAL_1_32:
default:
- /* tps |= (0 << 3) */;
+ /* tps |= (0 << 2) */;
}
switch (op->hierarchy_information) {
case HIERARCHY_1:
- tps |= (1 << 12);
+ tps |= (1 << 10);
break;
case HIERARCHY_2:
- tps |= (2 << 12);
+ tps |= (2 << 10);
break;
case HIERARCHY_4:
- tps |= (3 << 12);
+ tps |= (3 << 10);
break;
case HIERARCHY_NONE:
default:
- /* tps |= (0 << 12) */;
+ /* tps |= (0 << 10) */;
}
return tps;
@@ -495,15 +495,32 @@ struct dvbt_get_parameters_msg {
static
-int cinergyt2_fe_ioctl (struct dvb_frontend *fe, unsigned int ioctl_cmd, void *arg)
+int cinergyt2_fe_open (struct inode *inode, struct file *file)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ cinergyt2_control_sleep_mode((struct cinergyt2 *) dvbdev->priv, 0);
+ return dvb_generic_open(inode, file);
+}
+
+
+static
+int cinergyt2_fe_release (struct inode *inode, struct file *file)
{
- struct cinergyt2 *cinergyt2 = fe->data;
+ struct dvb_device *dvbdev = file->private_data;
+ cinergyt2_control_sleep_mode((struct cinergyt2 *) dvbdev->priv, 1);
+ return dvb_generic_release (inode, file);
+}
+
+
+static
+int cinergyt2_fe_ioctl (struct inode *inode, struct file *file,
+ unsigned int cmd, void *arg)
+{
+ struct dvb_device *dvbdev = file->private_data;
+ struct cinergyt2 *cinergyt2 = dvbdev->priv;
int ret = 0;
- if (!cinergyt2->streaming)
- cinergyt2_control_sleep_mode(cinergyt2, 0);
-
- switch (ioctl_cmd) {
+ switch (cmd) {
case FE_GET_INFO:
memcpy (arg, &cinergyt2_fe_info, sizeof(struct dvb_frontend_info));
break;
@@ -608,23 +625,40 @@ int cinergyt2_fe_ioctl (struct dvb_frontend *fe, unsigned int ioctl_cmd, void *a
*/
break;
- case FE_INIT:
- case FE_SLEEP:
- /* no need to do anything */
- break;
-
default:
- ret = -EOPNOTSUPP;
+ ret = -EINVAL;
break;
}
- if (!cinergyt2->streaming)
- cinergyt2_control_sleep_mode(cinergyt2, 1);
-
return ret;
}
+static
+struct file_operations cinergyt2_fe_fops = {
+ .owner = THIS_MODULE,
+ .ioctl = dvb_generic_ioctl,
+ /**
+ * do we really need this? If so, let's implement it via
+ * schedule_delayed_work() similiar to the IR code.
+ */
+ /*.poll = cinergyt2_fe_poll, */
+ .open = cinergyt2_fe_open,
+ .release = cinergyt2_fe_release
+};
+
+
+static
+struct dvb_device cinergyt2_fe_template = {
+ .users = ~0,
+ .writers = 1,
+ .readers = (~0)-1,
+ .fops = &cinergyt2_fe_fops,
+ .kernel_ioctl = cinergyt2_fe_ioctl
+};
+
+
+
#ifdef ENABLE_RC
static
void cinergyt2_query_rc (void *data)
@@ -729,8 +763,9 @@ int cinergyt2_probe (struct usb_interface *intf,
if (dvb_net_init(cinergyt2->adapter, &cinergyt2->dvbnet, &cinergyt2->demux.dmx))
printk("cinergyt2_dvb: dvb_net_init failed!\n");
- dvb_register_frontend(cinergyt2_fe_ioctl, cinergyt2->adapter, cinergyt2,
- &cinergyt2_fe_info, THIS_MODULE);
+ dvb_register_device(cinergyt2->adapter, &cinergyt2->fedev,
+ &cinergyt2_fe_template, cinergyt2,
+ DVB_DEVICE_FRONTEND);
#ifdef ENABLE_RC
init_input_dev(&cinergyt2->rc_input_dev);
@@ -785,7 +820,7 @@ void cinergyt2_disconnect (struct usb_interface *intf)
dvb_dmxdev_release(&cinergyt2->dmxdev);
dvb_dmx_release(&cinergyt2->demux);
- dvb_unregister_frontend(cinergyt2_fe_ioctl, cinergyt2->adapter);
+ dvb_unregister_device(cinergyt2->fedev);
dvb_unregister_adapter(cinergyt2->adapter);
cinergyt2_free_stream_urbs(cinergyt2);