public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [linux-dvb] AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?)
@ 2011-05-19 20:48 wallak
  2011-05-20  6:20 ` Nicholas Leahy
  0 siblings, 1 reply; 3+ messages in thread
From: wallak @ 2011-05-19 20:48 UTC (permalink / raw)
  To: linux-dvb

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

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead linux-media@vger.kernel.org
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-dvb] AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?)
  2011-05-19 20:48 [linux-dvb] AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?) wallak
@ 2011-05-20  6:20 ` Nicholas Leahy
  2011-05-22 14:18   ` wallak
  0 siblings, 1 reply; 3+ messages in thread
From: Nicholas Leahy @ 2011-05-20  6:20 UTC (permalink / raw)
  To: linux-media, linux-dvb


[-- Attachment #1.1: Type: text/plain, Size: 1440 bytes --]


Hi Wallak 
How do you see the chips on the I2C bus? I have been trying to get a DiVCO card to work (it uses the same CX23885) 
I dont get the following parts
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");


and GPIO stuff



Cheers Nick
 
> Date: Thu, 19 May 2011 22:48:48 +0200
> From: wallak@free.fr
> To: linux-dvb@linuxtv.org
> Subject: [linux-dvb] AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?)
> 
> 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.
> 

> _______________________________________________
> linux-dvb users mailing list
> For V4L/DVB development, please use instead linux-media@vger.kernel.org
> linux-dvb@linuxtv.org
> http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
 		 	   		  

[-- Attachment #1.2: Type: text/html, Size: 2333 bytes --]

[-- Attachment #2: Type: text/plain, Size: 228 bytes --]

_______________________________________________
linux-dvb users mailing list
For V4L/DVB development, please use instead linux-media@vger.kernel.org
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [linux-dvb] AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?)
  2011-05-20  6:20 ` Nicholas Leahy
@ 2011-05-22 14:18   ` wallak
  0 siblings, 0 replies; 3+ messages in thread
From: wallak @ 2011-05-22 14:18 UTC (permalink / raw)
  To: linux-media, Nicholas Leahy; +Cc: linux-media, linux-dvb

Hi,

Quoting Nicholas Leahy <silvercordiagsr@hotmail.com>:

>
> Hi Wallak
> How do you see the chips on the I2C bus? I have been trying to get a DiVCO
> card to work (it uses the same CX23885)
> I dont get the following parts
> 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");
>


  Once the CX23885 driver is loaded, and the new board recognized, 3 new i2c bus
are added. The state may be dumped with the i2c-tools-3.0.3 package,  e.g.:

i2c-tools-3.0.3/tools/i2cdetect -l
...
    i2c-12      unknown         cx23885[0]
    i2c-13      unknown         cx23885[0]                                      
                       # SPD EEPROM
    i2c-14      unknown         cx23885[0]                                      
                       # SPD EEPROM

Adding the subsystem pci IDs is enough to be sure that the CX23885 driver is
loaded properly (the previous patch add theses lines).

After this stage; the following command dump an I2C bus:
i2c-tools-3.0.3/tools/i2cdetect -y $[12 + 0]

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- 1c -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: 30 31 32 33 34 35 36 37 -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

The DVB-T chip is here at the address : 0x1c

>
> and GPIO stuff
>
>
>
> Cheers Nick
>
> > Date: Thu, 19 May 2011 22:48:48 +0200
> > From: wallak@free.fr
> > To: linux-dvb@linuxtv.org
> > Subject: [linux-dvb] AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?)
> >
> > 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.
> >
>
> > _______________________________________________
> > linux-dvb users mailing list
> > For V4L/DVB development, please use instead linux-media@vger.kernel.org
> > linux-dvb@linuxtv.org
> > http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb
>


Best Regards,
Wallak,

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-05-22 14:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-19 20:48 [linux-dvb] AverMedia A306 (cx23385, xc3028, af9013) (A577 too ?) wallak
2011-05-20  6:20 ` Nicholas Leahy
2011-05-22 14:18   ` wallak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox