All of lore.kernel.org
 help / color / mirror / Atom feed
From: wallak@free.fr
To: linux-media@vger.kernel.org
Subject: AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?)
Date: Thu, 19 May 2011 23:13:32 +0200	[thread overview]
Message-ID: <1305839612.4dd587fc20a03@imp.free.fr> (raw)
In-Reply-To: <S932606Ab1ESVJJ/20110519210909Z+86@vger.kernel.org>

Hello All,

I've tried to use my A306 board on my system. All the main chips are fully
supported by linux.

At this stage the CX23385 and the tuner: xc3028 seem to respond properly. But
the DVB-T chip (af9013) is silent. Nevertheless both chips are visible on the
I2C bus.

I've no full datasheet of theses chips. with exception of the af9013 where this
information is available:
http://wenku.baidu.com/view/42240f72f242336c1eb95e08.html

At this stage the CLK signal of the DVB-T chip may be missing or something is
wrong elsewhere.

If you have the datasheets... Any help will be appreciated.


Best Regards,
Wallak.




diff -u -r -b -B -w -x '*.o' -x '*.cmd' -x '*.ko' -x '*.mod.c' -x 'modules.*'
tmp/linux-2.6.37.6/drivers/media/common/tuners/tuner-xc2028.c
linux-2.6.37.6-mdf/drivers/media/common/tuners/tuner-xc2028.c
--- linux-2.6.37.6/drivers/media/common/tuners/tuner-xc2028.c    2011-03-27
21:01:41.000000000 +0200
+++ linux-2.6.37.6-mdf/drivers/media/common/tuners/tuner-xc2028.c    2011-05-07
23:30:20.000000000 +0200
@@ -813,6 +813,10 @@
           hwmodel, (version & 0xf000) >> 12, (version & 0xf00) >> 8,
           (version & 0xf0) >> 4, version & 0xf);

+    {
+      void af9013_execdebug(struct dvb_frontend *fe);
+      af9013_execdebug(fe);
+    }

     if (priv->ctrl.read_not_reliable)
         goto read_not_reliable;
diff -u -r -b -B -w -x '*.o' -x '*.cmd' -x '*.ko' -x '*.mod.c' -x 'modules.*'
tmp/linux-2.6.37.6/drivers/media/dvb/frontends/af9013.c
linux-2.6.37.6-mdf/drivers/media/dvb/frontends/af9013.c
--- linux-2.6.37.6/drivers/media/dvb/frontends/af9013.c    2011-03-27
21:01:41.000000000 +0200
+++ linux-2.6.37.6-mdf/drivers/media/dvb/frontends/af9013.c    2011-05-15
02:58:34.000000000 +0200
@@ -69,6 +69,8 @@
     buf[2] = mbox;
     memcpy(&buf[3], val, len);

+    printk(KERN_DEBUG "af9013_write_regs(%02x, %02x %02x
%02x)\n",state->config.demod_address,buf[0],buf[1],buf[2]);
+
     if (i2c_transfer(state->i2c, &msg, 1) != 1) {
         warn("I2C write failed reg:%04x len:%d", reg, len);
         return -EREMOTEIO;
@@ -119,6 +121,10 @@
         warn("I2C read failed reg:%04x", reg);
         return -EREMOTEIO;
     }
+
+        printk(KERN_DEBUG "af9013_read_reg(%02x, %02x %02x %02x)
=%02x\n",state->config.demod_address,reg >> 8,reg & 0xff, 0, ibuf[0]);
+
+
     *val = ibuf[0];
     return 0;
 }
@@ -1448,6 +1454,22 @@
     kfree(state);
 }

+void af9013_execdebug(struct dvb_frontend *fe)
+{
+  struct af9013_state *state = fe->demodulator_priv;
+  u8 val;
+  u8 buf[4];
+  int ret, i;
+
+  ret = af9013_read_reg(state, 0x98be, &val);
+  printk(KERN_DEBUG "(0x0c) running = %02x, ret=%02x\n",val, ret);
+
+  ret = af9013_read_reg_bits(state, 0xd733, 4, 4, &buf[2]);
+  for (i = 0; i < 2; i++) { ret = af9013_read_reg(state, 0x116b + i, &buf[i]);
}
+  printk(KERN_DEBUG "%s: chip version:%d ROM version:%d.%d (ret=%d)\n",
__func__, buf[2], buf[0], buf[1], ret);
+}
+EXPORT_SYMBOL(af9013_execdebug);
+
 static struct dvb_frontend_ops af9013_ops;

 struct dvb_frontend *af9013_attach(const struct af9013_config *config,
@@ -1484,7 +1506,18 @@
     if (state->config.output_mode != AF9013_OUTPUT_MODE_USB) {
         ret = af9013_download_firmware(state);
         if (ret)
-            goto error;
+          {
+            deb_info("%s: continue...\n", __func__);
+
+            /* create dvb_frontend */
+            memcpy(&state->frontend.ops, &af9013_ops,
+               sizeof(struct dvb_frontend_ops));
+            state->frontend.demodulator_priv = state;
+
+            return &state->frontend;
+
+            //goto error;
+          }
     }

     /* firmware version */
diff -u -r -b -B -w -x '*.o' -x '*.cmd' -x '*.ko' -x '*.mod.c' -x 'modules.*'
tmp/linux-2.6.37.6/drivers/media/video/cx23885/cx23885-cards.c
linux-2.6.37.6-mdf/drivers/media/video/cx23885/cx23885-cards.c
--- linux-2.6.37.6/drivers/media/video/cx23885/cx23885-cards.c    2011-03-27
21:01:41.000000000 +0200
+++ linux-2.6.37.6-mdf/drivers/media/video/cx23885/cx23885-cards.c    2011-05-15
04:12:20.000000000 +0200
@@ -275,6 +275,10 @@
         .name        = "Compro VideoMate E800",
         .portc        = CX23885_MPEG_DVB,
     },
+    [CX23885_BOARD_AVERMEDIA_A306] = {
+        .name        = "Avermedia A306",
+        .portc        = CX23885_MPEG_DVB,
+    },
     [CX23885_BOARD_HAUPPAUGE_HVR1290] = {
         .name        = "Hauppauge WinTV-HVR1290",
         .portc        = CX23885_MPEG_DVB,
@@ -485,6 +489,10 @@
         .subdevice = 0xe800,
         .card      = CX23885_BOARD_COMPRO_VIDEOMATE_E800,
     }, {
+            .subvendor = 0x1461,
+        .subdevice = 0xc139,
+        .card      = CX23885_BOARD_AVERMEDIA_A306,
+    }, {
         .subvendor = 0x0070,
         .subdevice = 0x8551,
         .card      = CX23885_BOARD_HAUPPAUGE_HVR1290,
@@ -967,6 +975,31 @@
         /* CX24228 GPIO */
         /* Connected to IF / Mux */
         break;
+    case CX23885_BOARD_AVERMEDIA_A306:
+      // ?? PIO0: 1:on 0:nothing work
+      // ?? PIO1: demodulator address 1: 0x1c, 0:0x1d ??
+      // ?? PIO2: tuner reset ?
+      // ?? PIO3: demodulator reset ?
+      printk(KERN_INFO "gpio...\n");
+
+      cx_set(GP0_IO, 0x000f0000);
+      mdelay(100);
+      cx_clear(GP0_IO, 0x0000000f);
+      mdelay(100);
+
+
+      cx_set(GP0_IO, 0x000f0000 | (1<<3) | (1<<2) | (1<<1) | (0<<0));
+      mdelay(100);
+      //cx_clear(GP0_IO, 0x00000000 | (1<<3) | (1<<2));
+      cx_set(GP0_IO, 0x000f0000 | (1<<3) | (0<<2) | (1<<1) | (0<<0));
+      mdelay(100);
+      cx_set(GP0_IO, 0x000f0000 | (1<<3) | (0<<2) | (1<<1) | (1<<0));
+      //cx_clear(GP0_IO, 0x0000000f);
+      //cx_set(GP0_IO, 0x00000003);
+      //cx_clear(GP0_IO, 0x00000002);
+          mdelay(100);
+
+      break;
     }
 }

@@ -1012,6 +1045,7 @@
     case CX23885_BOARD_HAUPPAUGE_HVR1275:
     case CX23885_BOARD_HAUPPAUGE_HVR1255:
     case CX23885_BOARD_HAUPPAUGE_HVR1210:
+    case CX23885_BOARD_AVERMEDIA_A306:
         /* FIXME: Implement me */
         break;
     case CX23885_BOARD_HAUPPAUGE_HVR1850:
@@ -1258,6 +1292,7 @@
     /* AUX-PLL 27MHz CLK */
     switch (dev->board) {
     case CX23885_BOARD_NETUP_DUAL_DVBS2_CI:
+      //case CX23885_BOARD_AVERMEDIA_A306:
         netup_initialize(dev);
         break;
     }
diff -u -r -b -B -w -x '*.o' -x '*.cmd' -x '*.ko' -x '*.mod.c' -x 'modules.*'
tmp/linux-2.6.37.6/drivers/media/video/cx23885/cx23885-dvb.c
linux-2.6.37.6-mdf/drivers/media/video/cx23885/cx23885-dvb.c
--- linux-2.6.37.6/drivers/media/video/cx23885/cx23885-dvb.c    2011-03-27
21:01:41.000000000 +0200
+++ linux-2.6.37.6-mdf/drivers/media/video/cx23885/cx23885-dvb.c    2011-05-15
04:03:54.000000000 +0200
@@ -48,6 +48,7 @@
 #include "stv0900.h"
 #include "stv0900_reg.h"
 #include "stv6110.h"
+#include "af9013.h"
 #include "lnbh24.h"
 #include "cx24116.h"
 #include "cimax2.h"
@@ -571,6 +572,14 @@
     .osc_clk = 20
 };

+static struct af9013_config af9013_config = {
+  .demod_address = (0x1c << 1),                         /* #define
AF9015_I2C_DEMOD   0x38 */ /*0x1c or 0x1d*/
+  .output_mode   = AF9013_OUTPUT_MODE_PARALLEL,
+  .api_version = { 0, 1, 9, 0 },
+  /*.gpio[0] = AF9013_GPIO_TUNER_ON,
+    .gpio[1] = AF9013_GPIO_LO,*/
+};
+
 static int dvb_register(struct cx23885_tsport *port)
 {
     struct cx23885_dev *dev = port->dev;
@@ -966,6 +975,34 @@
             break;
         }
         break;
+    case CX23885_BOARD_AVERMEDIA_A306:
+      printk("# %d\n", port->nr - 1);
+      i2c_bus = &dev->i2c_bus[0];
+
+      fe0->dvb.frontend = dvb_attach(af9013_attach,
+                     &af9013_config,
+                     &i2c_bus->i2c_adap);
+
+      if (fe0->dvb.frontend != NULL || 1) {
+        struct dvb_frontend *fe;
+        struct xc2028_config cfg = {
+          .i2c_adap  = &dev->i2c_bus[1].i2c_adap,
+          .i2c_addr  = 0x61,
+        };
+        static struct xc2028_ctrl ctl = {
+          .fname       = XC2028_DEFAULT_FIRMWARE,
+          .max_len     = 64,
+          .demod       = XC3028_FE_ZARLINK456 /*XC3028_FE_OREN538: Loading
SCODE for type=DTV6 ATSC OREN538 SCODE HAS_IF_5580 (60110020)*/,
+        };
+
+        printk(KERN_INFO "xc2028_attach %p\n", fe0->dvb.frontend);
+        fe = dvb_attach(xc2028_attach, fe0->dvb.frontend, &cfg);
+        printk(KERN_INFO "xc2028_attach %p\n", fe);
+        if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) {
+            fe->ops.tuner_ops.set_config(fe, &ctl);
+        }
+      }
+      break;

     default:
         printk(KERN_INFO "%s: The frontend of your DVB/ATSC card "
diff -u -r -b -B -w -x '*.o' -x '*.cmd' -x '*.ko' -x '*.mod.c' -x 'modules.*'
tmp/linux-2.6.37.6/drivers/media/video/cx23885/cx23885.h
linux-2.6.37.6-mdf/drivers/media/video/cx23885/cx23885.h
--- linux-2.6.37.6/drivers/media/video/cx23885/cx23885.h    2011-03-27
21:01:41.000000000 +0200
+++ linux-2.6.37.6-mdf/drivers/media/video/cx23885/cx23885.h    2011-05-05
02:58:01.000000000 +0200
@@ -84,6 +84,7 @@
 #define CX23885_BOARD_HAUPPAUGE_HVR1290        26
 #define CX23885_BOARD_MYGICA_X8558PRO          27
 #define CX23885_BOARD_LEADTEK_WINFAST_PXTV1200 28
+#define CX23885_BOARD_AVERMEDIA_A306           29

 #define GPIO_0 0x00000001
 #define GPIO_1 0x00000002

       reply	other threads:[~2011-05-19 21:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <S932606Ab1ESVJJ/20110519210909Z+86@vger.kernel.org>
2011-05-19 21:13 ` wallak [this message]
2011-05-19 21:50   ` AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?) Antti Palosaari
2011-06-03 16:42   ` Daniel Gimpelevich
2011-06-04 15:37     ` wallak
2011-06-04 18:03       ` Daniel Gimpelevich

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=1305839612.4dd587fc20a03@imp.free.fr \
    --to=wallak@free.fr \
    --cc=linux-media@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.