public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Ringel <stefan.ringel@arcor.de>
To: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org,
	Devin Heitmueller <dheitmueller@kernellabs.com>
Subject: [PATCH 11/15] -  tm6000 add init for tm6010
Date: Wed, 03 Feb 2010 21:29:10 +0100	[thread overview]
Message-ID: <4B69DC96.1040704@arcor.de> (raw)
In-Reply-To: <4B69D8CC.2030008@arcor.de>

signed-off-by: Stefan Ringel <stefan.ringel@arcor.de>

--- a/drivers/staging/tm6000/tm6000-core.c
+++ b/drivers/staging/tm6000/tm6000-core.c
@@ -394,7 +414,15 @@ struct reg_init tm6010_init_tab[] = {
     { REQ_07_SET_GET_AVREG, 0x3f, 0x00 },
 
     { REQ_05_SET_GET_USBREG, 0x18, 0x00 },
-
+   
+    /* additional from Terratec Cinergy Hybrid XE */
+    { REQ_07_SET_GET_AVREG, 0xdc, 0xaa },
+    { REQ_07_SET_GET_AVREG, 0xdd, 0x30 },
+    { REQ_07_SET_GET_AVREG, 0xde, 0x20 },
+    { REQ_07_SET_GET_AVREG, 0xdf, 0xd0 },
+    { REQ_04_EN_DISABLE_MCU_INT, 0x02, 0x00 },
+    { REQ_07_SET_GET_AVREG, 0xd8, 0x2f },
+   
     /* set remote wakeup key:any key wakeup */
     { REQ_07_SET_GET_AVREG,  0xe5,  0xfe },
     { REQ_07_SET_GET_AVREG,  0xda,  0xff },
@@ -404,6 +432,7 @@ int tm6000_init (struct tm6000_core *dev)
 {
     int board, rc=0, i, size;
     struct reg_init *tab;
+    u8 buf[40];
 
     if (dev->dev_type == TM6010) {
         tab = tm6010_init_tab;
@@ -424,61 +453,129 @@ int tm6000_init (struct tm6000_core *dev)
         }
     }
 
-    msleep(5); /* Just to be conservative */
-
-    /* Check board version - maybe 10Moons specific */
-    board=tm6000_get_reg16 (dev, 0x40, 0, 0);
-    if (board >=0) {
-        printk (KERN_INFO "Board version = 0x%04x\n",board);
-    } else {
-        printk (KERN_ERR "Error %i while retrieving board
version\n",board);
-    }
-
+    /* hack */
     if (dev->dev_type == TM6010) {
-        /* Turn xceive 3028 on */
-        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN, TM6010_GPIO_3, 0x01);
-        msleep(11);
-    }
-
-    /* Reset GPIO1 and GPIO4. */
-    for (i=0; i< 2; i++) {
-        rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
-                    dev->tuner_reset_gpio, 0x00);
-        if (rc<0) {
-            printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc);
-            return rc;
-        }
-
-        msleep(10); /* Just to be conservative */
-        rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
-                    dev->tuner_reset_gpio, 0x01);
-        if (rc<0) {
-            printk (KERN_ERR "Error %i doing GPIO1 reset\n",rc);
-            return rc;
-        }
-
-        msleep(10);
-        rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 0);
-        if (rc<0) {
-            printk (KERN_ERR "Error %i doing GPIO4 reset\n",rc);
-            return rc;
-        }
-
-        msleep(10);
-        rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, TM6000_GPIO_4, 1);
-        if (rc<0) {
-            printk (KERN_ERR "Error %i doing GPIO4 reset\n",rc);
-            return rc;
-        }
-
-        if (!i) {
-            rc=tm6000_get_reg16(dev, 0x40,0,0);
-            if (rc>=0) {
-                printk ("board=%d\n", rc);
+       
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_4, 0);
+        msleep(15);
+               
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_1, 0);
+   
+        msleep(50);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_1, 1);
+       
+        msleep(15);
+        tm6000_read_write_usb (dev, 0xc0, 0x0e, 0x0010, 0x4400, buf, 2);
+       
+        msleep(15);
+        tm6000_read_write_usb (dev, 0xc0, 0x10, 0xf432, 0x0000, buf, 2);
+   
+        msleep(15);
+        buf[0] = 0x12;
+        buf[1] = 0x34;
+        tm6000_read_write_usb (dev, 0x40, 0x10, 0xf432, 0x0000, buf, 2);
+   
+        msleep(15);
+        tm6000_read_write_usb (dev, 0xc0, 0x10, 0xf432, 0x0000, buf, 2);
+   
+        msleep(15);
+        tm6000_read_write_usb (dev, 0xc0, 0x10, 0x0032, 0x0000, buf, 2);
+
+        msleep(15);
+        buf[0] = 0x00;
+        buf[1] = 0x01;
+        tm6000_read_write_usb (dev, 0x40, 0x10, 0xf332, 0x0000, buf, 2);
+   
+        msleep(15);
+        tm6000_read_write_usb (dev, 0xc0, 0x10, 0x00c0, 0x0000, buf, 39);
+   
+        msleep(15);
+        buf[0] = 0x00;
+        buf[1] = 0x00;
+        tm6000_read_write_usb (dev, 0x40, 0x10, 0xf332, 0x0000, buf, 2);
+   
+        msleep(15);
+        tm6000_read_write_usb (dev, 0xc0, 0x10, 0x7f1f, 0x0000, buf, 2);
+//        printk(KERN_INFO "buf %#x %#x \n", buf[0], buf [1]);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_4, 1);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                    TM6010_GPIO_0, 1);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_7, 0);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_5, 1);
+   
+        msleep(15);
+   
+        for (i=0; i< size; i++) {
+            rc= tm6000_set_reg (dev, tab[i].req, tab[i].reg, tab[i].val);
+            if (rc<0) {
+                printk (KERN_ERR "Error %i while setting req %d, "
+                         "reg %d to value %d\n", rc,
+                         tab[i].req,tab[i].reg, tab[i].val);
+                return rc;
             }
         }
+           
+        msleep(15);
+   
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_4, 0);
+        msleep(15);
+
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_1, 0);
+   
+        msleep(50);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_1, 1);
+       
+        msleep(15);
+        tm6000_read_write_usb (dev, 0xc0, 0x0e, 0x00c2, 0x0008, buf, 2);
+//        printk(KERN_INFO "buf %#x %#x \n", buf[0], buf[1]);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_2, 1);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_2, 0);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_2, 1);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_2, 1);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_2, 0);
+        msleep(15);
+        tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
+                TM6010_GPIO_2, 1);
+        msleep(15);
     }
+    /* hack end */
+   
+    msleep(5); /* Just to be conservative */
 
+    /* Check board version - maybe 10Moons specific */
+    if (dev->dev_type == TM5600) {
+         board=tm6000_get_reg16 (dev, 0x40, 0, 0);
+        if (board >=0) {
+            printk (KERN_INFO "Board version = 0x%04x\n",board);
+        } else {
+            printk (KERN_ERR "Error %i while retrieving board
version\n",board);
+        }
+    }
+   
     msleep(50);
 
     return 0;

-- 
Stefan Ringel <stefan.ringel@arcor.de>


  parent reply	other threads:[~2010-02-03 20:29 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 20:20 [PATCH] - tm6000 DVB support Stefan Ringel
2010-02-01 20:35 ` Stefan Ringel
2010-02-01 20:52   ` Devin Heitmueller
2010-02-01 21:23     ` Stefan Ringel
2010-02-01 21:44       ` Devin Heitmueller
2010-02-01 22:00         ` Stefan Ringel
2010-02-01 23:05           ` Mauro Carvalho Chehab
2010-02-02 16:14             ` Stefan Ringel
2010-02-02 16:44               ` Mauro Carvalho Chehab
2010-02-02 17:38                 ` Stefan Ringel
2010-02-02 20:05                   ` Mauro Carvalho Chehab
2010-02-01 22:52   ` Mauro Carvalho Chehab
2010-02-02 17:24     ` Stefan Ringel
2010-02-02 20:03       ` Mauro Carvalho Chehab
2010-02-02 20:19         ` Stefan Ringel
2010-02-02 20:30           ` Mauro Carvalho Chehab
2010-02-02 20:42         ` Stefan Ringel
2010-02-02 20:52           ` Mauro Carvalho Chehab
2010-02-02 21:11             ` Stefan Ringel
2010-02-03 20:10               ` [PATCH 1/15] - tm6000 build hunk Stefan Ringel
2010-02-03 20:13                 ` [PATCH 2/15] - tm6000 add Terratec Cinergy Hybrid XE Stefan Ringel
2010-02-03 20:15                   ` [PATCH 3/15] - tm6000 bugfix hunk in init_dev Stefan Ringel
2010-02-03 20:22                     ` Mauro Carvalho Chehab
2010-02-03 20:16                   ` [PATCH 4/15] - tm6000.h Stefan Ringel
2010-02-03 20:25                     ` Mauro Carvalho Chehab
2010-02-03 20:50                       ` Stefan Ringel
2010-02-03 20:58                         ` Devin Heitmueller
2010-02-03 21:31                         ` Mauro Carvalho Chehab
2010-02-03 20:18                   ` [PATCH 5/15] - tm6000 bugfix i2c transfer Stefan Ringel
2010-02-03 20:18                   ` [PATCH 2/15] - tm6000 add Terratec Cinergy Hybrid XE Mauro Carvalho Chehab
2010-02-03 20:20                   ` [PATCH 6/15] - tm6000 bugfix usb transfer in DVB mode Stefan Ringel
2010-02-03 20:22                   ` [PATCH 7/15] - tm6000 Stefan Ringel
2010-02-03 20:23                   ` [PATCH 2/15] - tm6000 bugfix Stefan Ringel
2010-02-03 20:25                   ` [PATCH 9/15] - tm6000 analog digital switch Stefan Ringel
2010-02-03 20:40                     ` Mauro Carvalho Chehab
2010-02-03 20:55                       ` Stefan Ringel
2010-02-03 21:21                         ` Mauro Carvalho Chehab
2010-02-03 20:27                   ` [PATCH 2/15] - tm6000 add digital init for tm6010 Stefan Ringel
2010-02-03 20:29                   ` Stefan Ringel [this message]
2010-02-03 20:31                   ` [PATCH 12/15] - tm6000 bugfix tuner reset time and tuner param Stefan Ringel
2010-02-03 20:52                     ` Devin Heitmueller
2010-02-03 21:15                       ` Stefan Ringel
2010-02-03 20:36                   ` [PATCH 13/15] - xc2028 bugfix for firmware 3.6 -> Zarlink use without shift in DTV8 or DTV78 Stefan Ringel
2010-02-03 20:45                     ` Devin Heitmueller
2010-02-03 20:38                   ` [PATCH 14/15] - zl10353 Stefan Ringel
2010-02-03 20:49                     ` Devin Heitmueller
2010-02-03 21:07                       ` Stefan Ringel
2010-02-04  2:43                         ` Mauro Carvalho Chehab
2010-02-04 21:12                           ` Stefan Ringel
2010-02-05  0:06                             ` Mauro Carvalho Chehab
2010-02-03 20:40                   ` [PATCH 15/15] - tm6000 hack with different demodulator parameter Stefan Ringel
2010-02-03 20:47                     ` Devin Heitmueller
2010-02-03 20:16                 ` [PATCH 1/15] - tm6000 build hunk Mauro Carvalho Chehab
2010-02-03 20:17                 ` Devin Heitmueller
2010-02-03 21:48                 ` Stefan Ringel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B69DC96.1040704@arcor.de \
    --to=stefan.ringel@arcor.de \
    --cc=dheitmueller@kernellabs.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox