public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Stefan Ringel <stefan.ringel@arcor.de>
To: linux-media@vger.kernel.org
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Subject: tm6000
Date: Sat, 27 Mar 2010 15:55:38 +0100	[thread overview]
Message-ID: <4BAE1C6A.6070601@arcor.de> (raw)
In-Reply-To: <4B9D44D3.8080201@arcor.de>

Hi Mauro,

First, I have a question, in the function "int tm6000_cards_setup(struct
tm6000_core *dev)" have you reset gpio 1 and 4, but why? In my lastest
patch I have add a few sticks and it's works with and without this
part.What for sticks use this part? For a week I have become a email
with usbsnoop log from a tm5600 based stick and I have analysed it.
Resume is that I think it use two reset gpio's.

1. GPIO1  = 0
2. GPIO4 = 0
3. wait a few ms
4. GPIO1 = 1
5. GPIO4 = 1

/*
     * Default initialization. Most of the devices seem to use GPIO1
     * and GPIO4.on the same way, so, this handles the common sequence
     * used by most devices.
     * If a device uses a different sequence or different GPIO pins for
     * reset, just add the code at the board-specific part
     */
    for (i = 0; i < 2; i++) {
        rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
                    dev->gpio.tuner_reset, 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->gpio.tuner_reset, 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(KERN_DEBUG "board=%d\n", rc);
        }
    }

For a week I have become a email with usbsnoop log from a tm5600 based
stick and I have analysed it. Resume is that I think it use two reset
gpio's.

1. GPIO1  = 0
2. GPIO4 = 0
3. wait a few ms
4. GPIO1 = 1
5. GPIO4 = 1

So I think, if it a part from function tm6000_cards_setup is, then is
that part wrong and must remove to tuner_callback function.

Second, I will rewrite the gpio's into a struct.

for example:

in tm6000.h

struct tm6000_gpio {
    int        tuner_reset;
    int        tuner_on;
    int        demod_reset;
    int        demod_on;
    int        power_led;
    int        dvb_led;
    int        ir;
};

in tm6000_card.c

[TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE] = {
        .name         = "Terratec Cinergy Hybrid XE / Cinergy Hybrid-Stick",
        .tuner_type   = TUNER_XC2028, /* has a XC3028 */
        .tuner_addr   = 0xc2 >> 1,
        .demod_addr   = 0x1e >> 1,
        .type         = TM6010,
        .caps = {
            .has_tuner    = 1,
            .has_dvb    = 1,
            .has_zl10353    = 1,
            .has_eeprom    = 1,
            .has_remote    = 1,
        },
        .gpio = {
            .tuner_reset     = TM6010_GPIO_2,
            .tuner_on    = TM6010_GPIO_3,
            .demod_reset    = TM6010_GPIO_1,
            .demod_on    = TM6010_GPIO_4,
            .power_led    = TM6010_GPIO_7,
            .dvb_led    = TM6010_GPIO_5,
            .ir        = TM6010_GPIO_0,
        },
    },

The rest I send in the patch email. So can the gpio's define in the
board struct and using per label in the functions.

Stefan Ringel

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


  parent reply	other threads:[~2010-03-27 14:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 17:57 [PATCH] tm6000: add new hybrid-stick stefan.ringel
2010-03-14  7:11 ` Stefan Ringel
2010-03-14 18:26   ` Mauro Carvalho Chehab
2010-03-14 20:19     ` Stefan Ringel
2010-03-14 23:06       ` Mauro Carvalho Chehab
2010-03-27 14:55       ` Stefan Ringel [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-05-18  7:35 tm6000 Dmitri Belimov
2010-05-05  4:50 tm6000 Dmitri Belimov
2010-05-05  5:44 ` tm6000 Bee Hock Goh
2010-05-05  7:27   ` tm6000 Dmitri Belimov
2010-05-05  7:47     ` tm6000 Bee Hock Goh
2010-05-05 13:58     ` tm6000 Mauro Carvalho Chehab
2010-04-23  0:48 [PATCH] tm6000 fix i2c Dmitri Belimov
2010-04-23 15:15 ` Stefan Ringel
2010-04-26  0:25   ` Dmitri Belimov
2010-04-26 12:58     ` Bee Hock Goh
2010-04-27  5:15       ` Dmitri Belimov
2010-04-27  6:07         ` Bee Hock Goh
2010-04-28  5:49           ` tm6000 Dmitri Belimov
2010-04-28  7:32             ` tm6000 Bee Hock Goh
2010-04-28 12:14             ` tm6000 Mauro Carvalho Chehab
2009-11-10  4:37 [PATCH] Add new TV cards of Beholder Dmitri Belimov
2009-11-23 21:28 ` Mauro Carvalho Chehab
2010-01-12  8:24   ` tm6000 Dmitri Belimov
2010-01-12 11:50     ` tm6000 Mauro Carvalho Chehab

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=4BAE1C6A.6070601@arcor.de \
    --to=stefan.ringel@arcor.de \
    --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