Re: Anysee E30C Plus (Re: DVB-C developers interested in receiving an USB adapter for hacking?)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



morjens
Here comes the second test version. It has now remote control support. My next plan is to fix TDA10023 issue correctly. After that I will try to add Anysee DVB-T support also. All Anysee devices seems to be rather similar (demod & tuner of course differs).

TODO:
- put required TDA10023 options configurable
- add Anysee E30 DVB-T device support
- add Common Interface (CI) support
- fixes overall

Please test and report whether or not it works.

Regards,
Antti

Antti Palosaari wrote:
terve
First version of the driver is attached. It does not have remote control , nor CI support yet. I will add remote control in next few days...

I can test it only with QAM128 & symbol rate 6.875 and it seems work fine. All test reports, success and fails, are highly welcome.

Some small changes to current TDA10023 driver was needed, those are now under the #ifdef's. We should find better solution for needed changes. Proposals for resolving the situation are also highly welcome in this issue too. One solution is to put needed parameters to driver config, is there better ones? Hartmut Birr, could you investigate this?

Regards,
Antti

diff -r e95ee8dec49d linux/drivers/media/dvb/dvb-usb/Kconfig
--- a/linux/drivers/media/dvb/dvb-usb/Kconfig	Sun Sep 30 10:20:18 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/Kconfig	Mon Oct 01 05:43:04 2007 +0300
@@ -239,3 +239,10 @@ config DVB_USB_AF9005_REMOTE
 	  Say Y here to support the default remote control decoding for the
 	  Afatech AF9005 based receiver.
 
+config DVB_USB_ANYSEE
+	tristate "Anysee E30C DVB-C USB2.0 support"
+	depends on DVB_USB
+	select DVB_TDA10023 if !DVB_FE_CUSTOMISE
+	help
+	  Say Y here to support the Anysee E30C DVB-C USB2.0 receiver.
+
diff -r e95ee8dec49d linux/drivers/media/dvb/dvb-usb/Makefile
--- a/linux/drivers/media/dvb/dvb-usb/Makefile	Sun Sep 30 10:20:18 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/Makefile	Sun Sep 30 19:58:07 2007 +0300
@@ -61,4 +61,7 @@ dvb-usb-af9005-remote-objs = af9005-remo
 dvb-usb-af9005-remote-objs = af9005-remote.o
 obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
 
+dvb-usb-anysee-objs = anysee.o
+obj-$(CONFIG_DVB_USB_ANYSEE) += dvb-usb-anysee.o
+
 EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
diff -r e95ee8dec49d linux/drivers/media/dvb/dvb-usb/anysee.c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/linux/drivers/media/dvb/dvb-usb/anysee.c	Mon Oct 08 01:16:00 2007 +0300
@@ -0,0 +1,398 @@
+/* DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver
+ *
+ * Copyright (C) 2007 Antti Palosaari <crope@xxxxxx>
+ *
+ *	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, version 2.
+ *
+ * see Documentation/dvb/README.dvb-usb for more information
+ *
+ *
+ * TODO:
+ * - put required TDA10023 options configurable
+ * - add Anysee E30 DVB-T device support
+ * - add Common Interface (CI) support
+ * - fixes overall
+ */
+
+#include "anysee.h"
+#include "tda1002x.h"
+
+/* debug */
+//static int dvb_usb_anysee_debug = -1;
+static int dvb_usb_anysee_debug;
+module_param_named(debug, dvb_usb_anysee_debug, int, 0644);
+MODULE_PARM_DESC(debug, "set debugging level (1=rc (or-able))." DVB_USB_DEBUG_STATUS);
+
+static int anysee_usb_ctrl_msg(struct usb_device *udev, u8 *snd_buf, u8 snd_len, u8 *reply)
+{
+	int act_len, ret;
+	u8 buf[64];
+	static u8 seq; /* packet sequence number */
+
+	memcpy(&buf[0], snd_buf, snd_len);
+	buf[60] = seq++;
+		
+	deb_xfer(">>> ");
+	debug_dump(buf,  sizeof(buf), deb_xfer);
+	/* send request */
+	ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 0x01), buf, sizeof(buf), &act_len, ANYSEE_USB_TIMEOUT);
+	if (ret)
+		err("%s: sending failed: %d (%d/%d)", __FUNCTION__, ret, sizeof(buf), act_len);
+	else
+		ret = act_len != sizeof(buf) ? -1 : 0;
+
+	if (ret)
+		return ret;
+
+	/* receive 1st answer (skip, answer to previous call) */
+	ret = usb_bulk_msg(udev, usb_rcvbulkpipe(udev, 0x81), buf, sizeof(buf), &act_len, ANYSEE_USB_TIMEOUT);
+	if (ret) {
+		err("%s: 1st receiving failed: %d", __FUNCTION__, ret);
+		return ret;
+	}
+//	deb_xfer("<<< ");
+//	debug_dump(buf, act_len, deb_xfer);
+
+	/* receive 2nd answer */
+	ret = usb_bulk_msg(udev, usb_rcvbulkpipe(udev, 0x81), buf, sizeof(buf), &act_len, ANYSEE_USB_TIMEOUT);
+	if (ret) {
+		err("%s: 2nd receiving failed: %d", __FUNCTION__, ret);
+		return ret;
+	}
+	deb_xfer("<<< ");
+	debug_dump(buf, act_len, deb_xfer);
+
+	/* read request, copy return data to return buf */
+	if(reply != NULL)
+		*reply = buf[0];
+		if (snd_buf[0] == CMD_GET_IR_CODE)
+			memcpy(reply, &buf[0], 2);
+	return 0;
+}
+
+static int anysee_read_reg(struct dvb_usb_device *d, u16 reg, u8 *val)
+{
+	u8 buf[] = {CMD_REG_READ, (reg & 0xff00) >> 8, reg & 0x00ff, 0x01};
+	return anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), val);
+}
+
+static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
+{
+	u8 buf[] = {CMD_GET_IR_CODE};
+	struct dvb_usb_rc_key *keymap = d->props.rc_key_map;
+	u8 ircode[2];
+	int i;
+
+	anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), &ircode[0]);
+
+	*event = 0;
+	*state = REMOTE_NO_KEY_PRESSED;
+
+	for (i = 0; i < d->props.rc_key_map_size; i++) {
+		if (keymap[i].custom == ircode[0] &&
+		    keymap[i].data == ircode[1]) {
+			*event = keymap[i].event;
+			*state = REMOTE_KEY_PRESSED;
+			return 0;
+		}
+	}
+	return 0;
+}
+
+static int anysee_write_reg(struct dvb_usb_device *d, u16 reg, u8 val)
+{
+	u8 buf[] = {CMD_REG_WRITE, (reg & 0xff00) >> 8, reg & 0x00ff, 0x01, val};
+	return anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), NULL);
+}
+
+static int anysee_streaming_ctrl(struct dvb_usb_device *d, u8 onoff)
+{
+	u8 buf[] = {CMD_STREAMING_CTRL, onoff, 0x00};
+	deb_info("%s: onoff:%02x\n", __FUNCTION__, onoff);
+	return anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), NULL);
+}
+
+static int anysee_led_ctrl(struct dvb_usb_device *d, u8 state, u8 interval)
+{
+	u8 buf[] = {CMD_LED_CTRL, 0x01, state, interval};
+	deb_info("%s: state:%02x interval:%02x\n", __FUNCTION__, state, interval);
+	return anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), NULL);
+}
+
+static int anysee_ir_ctrl(struct dvb_usb_device *d, u8 onoff)
+{
+	u8 buf[] = {CMD_LED_CTRL, 0x02, onoff};
+	deb_info("%s: onoff:%02x\n", __FUNCTION__, onoff);
+	return anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), NULL);
+}
+
+/* I2C */
+static int anysee_master_xfer(struct i2c_adapter* adap, struct i2c_msg *msg, int num)
+{
+	struct dvb_usb_device *d = i2c_get_adapdata(adap);
+	int i = 0;
+	int inc;
+	int err;
+	u8 *reply;
+	
+	if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
+		return -EAGAIN;
+
+	while (i < num) {
+		if (num > i + 1 && (msg[i + 1].flags & I2C_M_RD)) {
+			u8 buf[6];
+			buf[0] = CMD_I2C_READ;
+			buf[1] = msg[i].addr + 1;
+			buf[2] = msg[i].buf[0];
+			buf[3] = 0x00;
+			buf[4] = 0x00;
+			buf[5] = 0x01;
+			/* don't return value if len is zero to avoid buffer overflow */
+			if (msg[i + 1].len)
+				reply = msg[ i +1].buf;
+			else
+				reply = NULL;
+			err = anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), reply);
+			inc = 2;
+		} else {
+			u8 buf[4+msg[i].len];
+			buf[0] = CMD_I2C_WRITE;
+			buf[1] = msg[i].addr;
+			buf[2] = msg[i].len;
+			buf[3] = 0x01;
+			memcpy(&buf[4], msg[i].buf, msg[i].len);
+			err = anysee_usb_ctrl_msg(d->udev, buf, sizeof(buf), NULL);
+			inc = 1;
+		}
+		i += inc;
+	}
+
+	mutex_unlock(&d->i2c_mutex);
+	return i; // TODO returned correctly?
+}
+
+
+static int anysee_init(struct dvb_usb_device *d)
+{
+	anysee_led_ctrl(d, 0x00, 0x01);
+	anysee_ir_ctrl(d, 1);
+	anysee_streaming_ctrl(d, 1);
+
+	return 0;
+}
+
+
+static u32 anysee_i2c_func(struct i2c_adapter *adapter)
+{
+	return I2C_FUNC_I2C;
+}
+
+static struct i2c_algorithm anysee_i2c_algo = {
+	.master_xfer   = anysee_master_xfer,
+	.functionality = anysee_i2c_func,
+};
+
+/* Callbacks for DVB USB */
+static int anysee_identify_state(struct usb_device *udev,
+				 struct dvb_usb_device_properties *props,
+				 struct dvb_usb_device_description **desc,
+				 int *cold)
+{
+	*cold = 0;
+	return 0;
+}
+
+static struct tda1002x_config anysee_tda1002x_config = {
+	.demod_address = 0x1a,
+	.invert = 0,
+};
+
+static int anysee_unknown_2_tuner_attach(struct dvb_usb_adapter *adap)
+{
+	deb_info("%s: \n", __FUNCTION__);
+	dvb_attach(dvb_pll_attach, adap->fe, 0xc0, &adap->dev->i2c_adap, DVB_PLL_UNKNOWN_2);
+	return 0;
+}
+
+static int anysee_tda1002x_frontend_attach(struct dvb_usb_adapter *adap)
+{
+	/* connect demod on IO port D */
+	anysee_write_reg(adap->dev, 0xb0, 0x25);
+
+	if ((adap->fe = dvb_attach(tda10023_attach, &anysee_tda1002x_config,
+	    &adap->dev->i2c_adap, 0x48)) != NULL) {
+		return 0;
+	}
+
+	return -EIO;
+}
+
+static struct dvb_usb_rc_key anysee_rc_keys[] = {
+	{ 0x01, 0x00, KEY_0 },
+	{ 0x01, 0x01, KEY_1 },
+	{ 0x01, 0x02, KEY_2 },
+	{ 0x01, 0x03, KEY_3 },
+	{ 0x01, 0x04, KEY_4 },
+	{ 0x01, 0x05, KEY_5 },
+	{ 0x01, 0x06, KEY_6 },
+	{ 0x01, 0x07, KEY_7 },
+	{ 0x01, 0x08, KEY_8 },
+	{ 0x01, 0x09, KEY_9 },
+	{ 0x01, 0x0a, KEY_POWER },
+	{ 0x01, 0x0b, KEY_DOCUMENTS },    /* '*' */
+	{ 0x01, 0x19, KEY_FAVORITES },
+	{ 0x01, 0x20, KEY_SLEEP },
+	{ 0x01, 0x21, KEY_MODE },         /* 4:3 / 16:9 select */
+	{ 0x01, 0x22, KEY_ZOOM },
+	{ 0x01, 0x47, KEY_TEXT },
+	{ 0x01, 0x16, KEY_TV },           /* TV / radio select */
+	{ 0x01, 0x1e, KEY_LANGUAGE },     /* Second Audio Program */
+	{ 0x01, 0x1a, KEY_SUBTITLE },
+	{ 0x01, 0x1b, KEY_CAMERA },       /* screenshot */
+	{ 0x01, 0x42, KEY_MUTE },
+	{ 0x01, 0x0e, KEY_MENU },
+	{ 0x01, 0x0f, KEY_EPG },
+	{ 0x01, 0x17, KEY_INFO },
+	{ 0x01, 0x10, KEY_EXIT },
+	{ 0x01, 0x13, KEY_VOLUMEUP },
+	{ 0x01, 0x12, KEY_VOLUMEDOWN },
+	{ 0x01, 0x11, KEY_CHANNELUP },
+	{ 0x01, 0x14, KEY_CHANNELDOWN },
+	{ 0x01, 0x15, KEY_OK },
+	{ 0x01, 0x1d, KEY_RED },
+	{ 0x01, 0x1f, KEY_GREEN },
+	{ 0x01, 0x1c, KEY_YELLOW },
+	{ 0x01, 0x44, KEY_BLUE },
+	{ 0x01, 0x0c, KEY_SHUFFLE },      /* snapshot */
+	{ 0x01, 0x48, KEY_STOP },
+	{ 0x01, 0x50, KEY_PLAY },
+	{ 0x01, 0x51, KEY_PAUSE },
+	{ 0x01, 0x49, KEY_RECORD },
+//	{ 0x01, 0x18, KEY_PREVIOUSSONG }, /* |<< */
+//	{ 0x01, 0x0d, KEY_NEXTSONG },     /* >>| */
+	{ 0x01, 0x18, KEY_PREVIOUS },     /* |<< */
+	{ 0x01, 0x0d, KEY_NEXT },         /* >>| */
+	{ 0x01, 0x24, KEY_PROG1 },        /* 'F1' */
+	{ 0x01, 0x25, KEY_PROG2 },        /* 'F2' */
+};
+
+
+
+/* DVB USB Driver stuff */
+static struct dvb_usb_device_properties anysee_properties;
+
+static int anysee_probe(struct usb_interface *intf,
+			const struct usb_device_id *id)
+{
+	struct dvb_usb_device *d;
+	struct usb_host_interface *alt;
+	struct usb_device *udev;
+	int ret;
+
+	if (intf->num_altsetting < 1)
+		return -ENODEV;
+
+	if ((ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d)) == 0) {
+		alt = usb_altnum_to_altsetting(intf, 0);
+
+		if (alt == NULL) {
+			deb_info("no alt found!\n");
+			return -ENODEV;
+		}
+		ret = usb_set_interface(d->udev, alt->desc.bInterfaceNumber, alt->desc.bAlternateSetting);
+
+		udev = interface_to_usbdev(intf);
+		if (d && (ret = anysee_init(d)) != 0)
+			return ret;
+		
+	}
+
+	return ret;
+}
+
+
+static struct usb_device_id anysee_table [] = {
+
+//	{ USB_DEVICE(USB_VID_CYPRESS, 123) },
+	{ USB_DEVICE(USB_VID_CYPRESS, USB_PID_ANYSEE_E30C_PLUS) },
+	{ }		/* Terminating entry */
+};
+MODULE_DEVICE_TABLE (usb, anysee_table);
+
+static struct dvb_usb_device_properties anysee_properties = {
+	.caps = DVB_USB_IS_AN_I2C_ADAPTER,
+	.usb_ctrl = DEVICE_SPECIFIC,
+
+	.rc_interval      = 250,  /* windows driver uses 500ms */
+	.rc_key_map       = anysee_rc_keys,
+	.rc_key_map_size  = ARRAY_SIZE(anysee_rc_keys),
+	.rc_query         = anysee_rc_query,
+	
+	.size_of_priv     = 0,
+	.identify_state   = anysee_identify_state,
+	.num_adapters = 1,
+	.adapter = {
+		{
+			.frontend_attach  = anysee_tda1002x_frontend_attach,
+			.tuner_attach     = anysee_unknown_2_tuner_attach,
+
+			.stream = {
+				.type = USB_BULK,
+				.count = 8,
+				.endpoint = 0x82,
+				.u = {
+					.bulk = {
+						.buffersize = 512,
+					}
+				}
+			},
+		}
+	},
+	.i2c_algo = &anysee_i2c_algo,
+	.num_device_descs = 1,
+	.devices = {
+		{
+			"Anysee E30C DVB-C USB2.0",
+			{ &anysee_table[0], NULL },
+			{ NULL },
+		},
+	}
+};
+
+static struct usb_driver anysee_driver = {
+#if LINUX_VERSION_CODE <=  KERNEL_VERSION(2,6,15)
+	.owner      = THIS_MODULE,
+#endif
+	.name       = "dvb_usb_anysee",
+	.probe      = anysee_probe,
+	.disconnect = dvb_usb_device_exit,
+	.id_table   = anysee_table,
+};
+
+/* module stuff */
+static int __init anysee_module_init(void)
+{
+	int ret;
+	if ((ret = usb_register(&anysee_driver))) {
+		err("usb_register failed. Error number %d", ret);
+		return ret;
+	}
+
+	return 0;
+}
+
+static void __exit anysee_module_exit(void)
+{
+	/* deregister this driver from the USB subsystem */
+	usb_deregister(&anysee_driver);
+}
+
+module_init (anysee_module_init);
+module_exit (anysee_module_exit);
+
+MODULE_AUTHOR("Antti Palosaari <crope@xxxxxx>");
+MODULE_DESCRIPTION("Driver Anysee E30 DVB-C & DVB-T USB2.0");
+MODULE_VERSION("0.1");
+MODULE_LICENSE("GPL");
diff -r e95ee8dec49d linux/drivers/media/dvb/dvb-usb/anysee.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/linux/drivers/media/dvb/dvb-usb/anysee.h	Mon Oct 08 01:04:22 2007 +0300
@@ -0,0 +1,253 @@
+/* DVB USB Linux driver for Anysee E30 DVB-C & DVB-T USB2.0 receiver
+ *
+ * Copyright (C) 2007 Antti Palosaari <crope@xxxxxx>
+ *
+ *	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, version 2.
+ *
+ * see Documentation/dvb/README.dvb-usb for more information
+ *
+ *
+ * TODO:
+ * - put required TDA10023 options configurable
+ * - add Anysee E30 DVB-T device support
+ * - add Common Interface (CI) support
+ * - fixes overall
+ */
+ 
+#ifndef _DVB_USB_ANYSEE_H_
+#define _DVB_USB_ANYSEE_H_
+
+#define DVB_USB_LOG_PREFIX "anysee"
+#include "dvb-usb.h"
+
+#define deb_info(args...) dprintk(dvb_usb_anysee_debug,0x01,args)
+#define deb_xfer(args...) dprintk(dvb_usb_anysee_debug,0x02,args)
+#define deb_rc(args...)   dprintk(dvb_usb_anysee_debug,0x04,args)
+#define deb_reg(args...)  dprintk(dvb_usb_anysee_debug,0x08,args)
+#define deb_i2c(args...)  dprintk(dvb_usb_anysee_debug,0x10,args)
+#define deb_fw(args...)   dprintk(dvb_usb_anysee_debug,0x20,args)
+
+enum cmd {
+	CMD_I2C_READ            = 0x33,
+	CMD_I2C_WRITE           = 0x31,
+	CMD_REG_READ            = 0xb0,
+	CMD_REG_WRITE           = 0xb1,
+	CMD_STREAMING_CTRL      = 0x12,
+	CMD_LED_CTRL            = 0x16,
+	CMD_GET_IR_CODE         = 0x41,
+};
+
+#define ANYSEE_USB_TIMEOUT 1000
+
+#endif
+
+/***************************************************************************
+ * USB API description (reverse engineered)
+ ***************************************************************************
+
+Transaction flow:
+=================
+BULK[00001] >>> REQUEST PACKET 64 bytes
+BULK[00081] <<< REPLY PACKET #1 64 bytes (PREVIOUS TRANSACTION REPLY)
+BULK[00081] <<< REPLY PACKET #2 64 bytes (CURRENT TRANSACTION REPLY)
+
+============================================================================
+| 00-63 | GENERAL REPLY PACKET #1 (PREVIOUS REPLY)
+============================================================================
+|    00 | reply data (if any) from previous transaction
+|       | Just same reply packet as returned during previous transaction.
+|       | Needed only if reply is missed in previous transaction.
+|       | Just skip normally.
+----------------------------------------------------------------------------
+| 01-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | GENERAL REPLY PACKET #2 (CURRENT REPLY)
+============================================================================
+|    00 | reply data (if any)
+----------------------------------------------------------------------------
+| 01-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | I2C WRITE REQUEST PACKET
+============================================================================
+|    00 | 0x31, I2C write command
+----------------------------------------------------------------------------
+|    01 | i2c address
+----------------------------------------------------------------------------
+|    02 | data length
+|       | 0x02 (for typical I2C reg / val pair)
+----------------------------------------------------------------------------
+|    03 | 0x01
+----------------------------------------------------------------------------
+| 04-   | data
+----------------------------------------------------------------------------
+|   -59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | I2C READ REQUEST PACKET
+============================================================================
+|    00 | 0x33, I2C read command
+----------------------------------------------------------------------------
+|    01 | i2c address + 1
+----------------------------------------------------------------------------
+|    02 | register
+----------------------------------------------------------------------------
+|    03 | 0x00
+----------------------------------------------------------------------------
+|    04 | 0x00
+----------------------------------------------------------------------------
+|    05 | 0x01
+----------------------------------------------------------------------------
+| 06-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER REGISTER WRITE REQUEST PACKET
+============================================================================
+|    00 | 0xb1, register write command
+----------------------------------------------------------------------------
+| 01-02 | register
+----------------------------------------------------------------------------
+|    03 | 0x01
+----------------------------------------------------------------------------
+|    04 | value
+----------------------------------------------------------------------------
+| 05-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER REGISTER READ REQUEST PACKET
+============================================================================
+|    00 | 0xb0, register read command
+----------------------------------------------------------------------------
+| 01-02 | register
+----------------------------------------------------------------------------
+|    03 | 0x01
+----------------------------------------------------------------------------
+| 04-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER LED & IR CONTROL REQUEST PACKET
+============================================================================
+|    00 | 0x16, LED control command
+----------------------------------------------------------------------------
+|    01 | 0x01
+----------------------------------------------------------------------------
+|    03 | 0x00 blink
+|       | 0x01 lights continuously
+----------------------------------------------------------------------------
+|    04 | blink interval
+|       | 0x00 fastest (looks like LED lights continuously)
+|       | 0xff slowest
+----------------------------------------------------------------------------
+| 05-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER STREAMING CONTROL REQUEST PACKET
+============================================================================
+|    00 | 0x12, streaming control command
+----------------------------------------------------------------------------
+|    01 | 0x00 streaming disabled
+|       | 0x01 streaming enabled
+----------------------------------------------------------------------------
+|    02 | 0x00
+----------------------------------------------------------------------------
+| 03-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER REMOTE CONTROL REQUEST PACKET
+============================================================================
+|    00 | 0x41, remote control command
+----------------------------------------------------------------------------
+| 01-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER REMOTE CONTROL PACKET REPLY
+============================================================================
+|    00 | 0x00 code not received
+|       | 0x01 code received
+----------------------------------------------------------------------------
+|    01 | remote control code
+----------------------------------------------------------------------------
+| 02-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER <UNKNOWN> CONTROL PACKET
+============================================================================
+|    00 | 0x19, <unknown> control command
+----------------------------------------------------------------------------
+|    xx | 
+----------------------------------------------------------------------------
+| xx-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+============================================================================
+| 00-63 | USB CONTROLLER <UNKNOWN> CONTROL PACKET
+============================================================================
+|    00 | 0x34, <unknown> control command
+----------------------------------------------------------------------------
+|    xx | 
+----------------------------------------------------------------------------
+| xx-59 | don't care
+----------------------------------------------------------------------------
+|    60 | packet sequence number
+----------------------------------------------------------------------------
+| 61-63 | don't care
+----------------------------------------------------------------------------
+
+*/
diff -r e95ee8dec49d linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
--- a/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Sun Sep 30 10:20:18 2007 -0300
+++ b/linux/drivers/media/dvb/dvb-usb/dvb-usb-ids.h	Sun Sep 30 20:06:45 2007 +0300
@@ -169,6 +169,6 @@
 #define USB_PID_OPERA1_WARM				0x3829
 #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_COLD		0x0514
 #define USB_PID_LIFEVIEW_TV_WALKER_TWIN_WARM		0x0513
-
+#define USB_PID_ANYSEE_E30C_PLUS 0x861f
 
 #endif
diff -r e95ee8dec49d linux/drivers/media/dvb/frontends/dvb-pll.c
--- a/linux/drivers/media/dvb/frontends/dvb-pll.c	Sun Sep 30 10:20:18 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/dvb-pll.c	Mon Oct 08 01:13:01 2007 +0300
@@ -213,6 +213,45 @@ static struct dvb_pll_desc dvb_pll_unkno
 	},
 };
 
+static void unknown_2_set(struct dvb_frontend *fe, u8 *buf,
+		       const struct dvb_frontend_parameters *params)
+{
+	struct dvb_pll_priv *priv = fe->tuner_priv;
+	struct i2c_msg msg = { .addr = priv->pll_i2c_address, .flags = 0, .buf = buf, .len = 4 };
+	int result;
+
+	if (fe->ops.i2c_gate_ctrl)
+		fe->ops.i2c_gate_ctrl(fe, 1);
+
+	if ((result = i2c_transfer(priv->i2c, &msg, 1)) != 1)
+		printk(KERN_ERR "%s: i2c_transfer failed:%d", __FUNCTION__, result);
+
+	buf[2] = 0x9e;
+	buf[3] = 0x90;
+
+	return;
+}
+
+/* used in Samsung DTOS403IH102A tuner */
+static struct dvb_pll_desc dvb_pll_unknown_2 = {
+	.name  = "unknown 2",
+	.min   =  44250000,
+	.max   = 858000000,
+	.iffreq= 36125000,
+	.count = 8,
+	.set   = unknown_2_set,
+	.entries = {
+		{ 135000000, 62500, 0xbe, 0x01 },
+		{ 177000000, 62500, 0xf6, 0x01 },
+		{ 370000000, 62500, 0xbe, 0x02 },
+		{ 450000000, 62500, 0xf6, 0x02 },
+		{ 466000000, 62500, 0xfe, 0x02 },
+		{ 538000000, 62500, 0xbe, 0x08 },
+		{ 826000000, 62500, 0xf6, 0x08 },
+		{ 999999999, 62500, 0xfe, 0x08 },
+	}
+};
+
 /* Infineon TUA6010XS
  * used in Thomson Cable Tuner
  */
@@ -590,6 +629,7 @@ static struct dvb_pll_desc *pll_list[] =
 	[DVB_PLL_MICROTUNE_4042]         = &dvb_pll_microtune_4042,
 	[DVB_PLL_THOMSON_DTT761X]        = &dvb_pll_thomson_dtt761x,
 	[DVB_PLL_UNKNOWN_1]              = &dvb_pll_unknown_1,
+	[DVB_PLL_UNKNOWN_2]              = &dvb_pll_unknown_2,
 	[DVB_PLL_TUA6010XS]              = &dvb_pll_tua6010xs,
 	[DVB_PLL_ENV57H1XD5]             = &dvb_pll_env57h1xd5,
 	[DVB_PLL_TUA6034]                = &dvb_pll_tua6034,
diff -r e95ee8dec49d linux/drivers/media/dvb/frontends/dvb-pll.h
--- a/linux/drivers/media/dvb/frontends/dvb-pll.h	Sun Sep 30 10:20:18 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/dvb-pll.h	Fri Oct 05 16:58:54 2007 +0300
@@ -31,6 +31,7 @@
 #define DVB_PLL_THOMSON_FE6600         20
 #define DVB_PLL_OPERA1                 21
 #define DVB_PLL_FCV1236D               22
+#define DVB_PLL_UNKNOWN_2              23
 
 /**
  * Attach a dvb-pll to the supplied frontend structure.
diff -r e95ee8dec49d linux/drivers/media/dvb/frontends/tda10023.c
--- a/linux/drivers/media/dvb/frontends/tda10023.c	Sun Sep 30 10:20:18 2007 -0300
+++ b/linux/drivers/media/dvb/frontends/tda10023.c	Sat Oct 06 02:00:18 2007 +0300
@@ -58,10 +58,19 @@ struct tda10023_state {
 
 static int verbose;
 
+#define ANYSEE
+
+#ifdef ANYSEE
+#define XTAL   16000000UL
+#define PLL_M  11UL
+#define PLL_P  3UL
+#define PLL_N  1UL
+#else
 #define XTAL   28920000UL
 #define PLL_M  8UL
 #define PLL_P  4UL
 #define PLL_N  1UL
+#endif
 #define SYSCLK (XTAL*PLL_M/(PLL_N*PLL_P))  // -> 57840000
 
 static u8 tda10023_inittab[]={
@@ -93,8 +102,13 @@ static u8 tda10023_inittab[]={
 	0x36,0xff,0x00,  // TUNMIN
 	0x06,0xff,0x7f,  // EQCONF1 POSI=7 ENADAPT=ENEQUAL=DFE=1    // 0x77
 	0x1c,0x30,0x30,  // EQCONF2 STEPALGO=SGNALGO=1
+#ifdef ANYSEE
+	0x37,0xff,0xd6,  // DELTAF_LSB
+	0x38,0xff,0xfe,  // DELTAF_MSB
+#else
 	0x37,0xff,0xf6,  // DELTAF_LSB
 	0x38,0xff,0xff,  // DELTAF_MSB
+#endif
 	0x02,0xff,0x93,  // AGCCONF1  IFS=1 KAGCIF=2 KAGCTUN=3
 	0x2d,0xff,0xf6,  // SWEEP SWPOS=1 SWDYN=7 SWSTEP=1 SWLEN=2
 	0x04,0x10,0x00,   // SWRAMP=1
@@ -259,7 +273,7 @@ static int tda10023_set_symbolrate (stru
 
 		BDR=(s32)BDRX;
 	}
-//	printk("Symbolrate %i, BDR %i BDRI %i, NDEC %i\n",sr,BDR,BDRI,NDEC);
+	dprintk("Symbolrate %i, BDR %i BDRI %i, NDEC %i\n",sr,BDR,BDRI,NDEC);
 	tda10023_writebit (state, 0x03, 0xc0, NDEC<<6);
 	tda10023_writereg (state, 0x0a, BDR&255);
 	tda10023_writereg (state, 0x0b, (BDR>>8)&255);
@@ -273,7 +287,7 @@ static int tda10023_init (struct dvb_fro
 {
 	struct tda10023_state* state = fe->demodulator_priv;
 
-	dprintk("DVB: TDA10023(%d): init chip\n", fe->adapter->num);
+	dprintk("DVB: TDA10023(%d): init chip\n", fe->dvb->num);
 
 	tda10023_writetab(state, tda10023_inittab);
 
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux