diff mbox

AverMedia Satelllite Hybrid+FM A706

Message ID 201212182245.50722.linux@rainbow-software.org (mailing list archive)
State New, archived
Headers show

Commit Message

Ondrej Zary Dec. 18, 2012, 9:45 p.m. UTC
Hello,
I'm trying to add support for AverMedia Satelllite Hybrid+FM A706 card to
saa7134 driver but it does not seem to work :( I did something like this
(also tried .tuner_addr = ADDR_UNSET). It's probably mostly wrong as it's
copied from other cards.


The result is:
[    3.843111] saa7130/34: v4l2 driver version 0, 2, 17 loaded
[    3.843677] saa7133[0]: found at 0000:02:01.0, rev: 209, irq: 9, latency: 32, mmio: 0xf4000000
[    3.843747] saa7133[0]: subsystem: 1461:2055, board: AverMedia AverTV Satellite Hybrid+FM A706 [card=191,autodetected]
[    3.843830] saa7133[0]: board init: gpio is 1835ff
[    4.085202] saa7133[0]: i2c eeprom 00: 61 14 55 20 00 00 00 00 00 00 00 00 00 00 00 00
[    4.085210] saa7133[0]: i2c eeprom 10: ff ff ff ff ff 20 ff ff ff ff ff ff ff ff ff ff
[    4.085217] saa7133[0]: i2c eeprom 20: 02 40 01 02 02 01 01 04 06 ff 00 57 ff ff ff ff
[    4.085225] saa7133[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085232] saa7133[0]: i2c eeprom 40: 60 a0 00 c6 96 ff 05 30 8b 05 ff 40 ff ff ff ff
[    4.085240] saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085247] saa7133[0]: i2c eeprom 60: ff 89 00 c0 ff 1c 08 19 97 89 ff ff 80 15 0a ff
[    4.085255] saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085262] saa7133[0]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085270] saa7133[0]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085277] saa7133[0]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085285] saa7133[0]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085292] saa7133[0]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085300] saa7133[0]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.085307] saa7133[0]: i2c eeprom e0: 00 01 81 b0 65 07 ff ff ff ff ff ff ff ff ff ff
[    4.085315] saa7133[0]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[    4.108510] tuner 2-0063: Tuner -1 found with type(s) Radio TV.
[    4.247906] tda8290: no gate control were provided!
[    4.247995] tuner 2-0063: Tuner has no way to set tv freq
[    4.248057] tuner 2-0063: Tuner has no way to set tv freq
[    4.248454] saa7133[0]: registered device video0 [v4l2]
[    4.248547] saa7133[0]: registered device vbi0
[    4.248626] saa7133[0]: registered device radio0
[    4.305662] tuner 2-0063: Tuner has no way to set tv freq
[    4.306555] tuner 2-0063: tuner has no way to set radio frequency
[    4.307711] tuner 2-0063: Tuner has no way to set tv freq
[    4.443378] dvb_init() allocating 1 frontend
[    4.462345] mt312_read: ret == -5
[    4.462352] saa7133[0]/dvb: frontend initialization failed
[    4.638148] saa7134 ALSA driver for DMA sound loaded
[    4.638658] saa7133[0]/alsa: saa7133[0] at 0xf4000000 irq 9 registered as card -1
[   12.585084] tuner 2-0063: tuner has no way to set radio frequency
[   12.593909] tuner 2-0063: Tuner has no way to set tv freq
[   12.599760] tuner 2-0063: Tuner has no way to set tv freq


The card should be capable of DVB-S, analog TV and FM radio. No DVB-T.

Main chip:   SAA7131E
EEPROM:      S24CS02A
DVB-S demod: CE6313 (=ZL10303 = MT312)
DVB-S tuner: CE5039 (=ZL10039)
TV/FM tuner: TDA18271HD

I physically verified that all these chips are connected to a single I2C bus
(CE5039 and TDA18271HD through 100-ohm resistors).
There is also some MCU present (EM78P153) but it's not connected to I2C so it
probably does not matter.

i2cdetect output:
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- 41 -- -- -- -- -- -- -- -- -- 4b -- -- -- --
50: 50 -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: 60 -- -- UU -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

0x41: wtf is this?
0x4b: TDA8295 (integrated in SAA7131E)
0x50: S24CS02A
0x60: CE5039
0x63: TDA18271HD
But where is CE6313? It should be at 0x0e according to datasheet and pins
35..38 (35 = GND, 36, 37, 38 = VCC).

The tda8290 driver seems to require some i2c gate control but I thinka that
this card has none as all devices are directly on the I2C bus.

Any ideas?

Comments

Ondrej Zary Dec. 20, 2012, 9:37 p.m. UTC | #1
Update:
GPIO 9 is CE6313 SLEEP signal
GPIO 23 is CE5039 SLEEP signal
GPIO 25 is CE6313 RESET# signal - this one needs to be set high for CE6313 to 
appear on I2C bus

But there is a problem with CE5039 (zl10039) - the I2C bus breaks during its 
initialization (SDA stuck low):

Here it works (communication with CE6313):
[  921.556682] start xfer
[  921.556684] send address
[  921.556687] saa7133[0]: i2c data => 0x1c
[  921.556690] saa7133[0]: i2c stat <= BUSY
[  921.556725] saa7133[0]: i2c stat <= BUSY
[  921.556759] saa7133[0]: i2c stat <= BUSY
[  921.556794] saa7133[0]: i2c stat <= BUSY
[  921.556828] saa7133[0]: i2c stat <= DONE_WRITE
[  921.556831] saa7133[0]: i2c stat <= DONE_WRITE
[  921.556833] write bytes
[  921.556836] saa7133[0]: i2c data => 0x14
[  921.556838] saa7133[0]: i2c stat <= BUSY
[  921.556873] saa7133[0]: i2c stat <= BUSY
[  921.556907] saa7133[0]: i2c stat <= BUSY
[  921.556942] saa7133[0]: i2c stat <= DONE_WRITE
[  921.556945] saa7133[0]: i2c stat <= DONE_WRITE
[  921.556948] saa7133[0]: i2c data => 0x40
[  921.556950] saa7133[0]: i2c stat <= BUSY
[  921.556985] saa7133[0]: i2c stat <= BUSY
[  921.557019] saa7133[0]: i2c stat <= BUSY
[  921.557054] saa7133[0]: i2c stat <= DONE_WRITE
[  921.557057] saa7133[0]: i2c stat <= DONE_WRITE
[  921.557058] xfer done
[  921.557060] saa7133[0]: i2c attr => STOP
[  921.557064] saa7133[0]: i2c stat <= BUSY
[  921.557098] saa7133[0]: i2c stat <= DONE_STOP
[  921.557101] saa7133[0]: i2c stat <= DONE_STOP

Here starts CE5039 communication:
[  921.564672] zl10039_read
[  921.564677] saa7133[0]: i2c stat <= DONE_STOP
[  921.564679] start xfer
[  921.564681] send address
[  921.564684] saa7133[0]: i2c data => 0xc0
[  921.564686] saa7133[0]: i2c stat <= BUSY
[  921.564721] saa7133[0]: i2c stat <= BUSY
[  921.564755] saa7133[0]: i2c stat <= BUSY
[  921.564790] saa7133[0]: i2c stat <= BUSY

And here it breaks:
[  921.564824] saa7133[0]: i2c stat <= ARB_LOST
[  921.564827] saa7133[0]: i2c stat <= ARB_LOST
[  921.564829] zl10039_read: i2c read error
[  921.564833] saa7133[0]: i2c stat <= ARB_LOST
[  921.564834] saa7133[0]: i2c reset
[  921.564837] saa7133[0]: i2c stat <= ARB_LOST
[  921.564839] saa7133[0]: i2c stat => ARB_LOST
[  921.564843] saa7133[0]: i2c stat <= ARB_LOST
[  921.564877] saa7133[0]: i2c stat <= IDLE
[  921.564879] saa7133[0]: i2c attr => NOP

And everything is broken now (until reloading saa7134 module):
[  921.564882] start xfer
[  921.564883] send address
[  921.564886] saa7133[0]: i2c data => 0x1c
[  921.564889] saa7133[0]: i2c stat <= BUSY
[  921.564923] saa7133[0]: i2c stat <= BUSY
[  921.564958] saa7133[0]: i2c stat <= BUSY
[  921.564992] saa7133[0]: i2c stat <= BUSY
[  921.565026] saa7133[0]: i2c stat <= BUSY
[  921.565061] saa7133[0]: i2c stat <= BUSY
[  921.565095] saa7133[0]: i2c stat <= BUSY
[  921.565130] saa7133[0]: i2c stat <= BUSY
[  921.565164] saa7133[0]: i2c stat <= BUSY
[  921.565199] saa7133[0]: i2c stat <= BUSY
[  921.565233] saa7133[0]: i2c stat <= BUSY
[  921.565268] saa7133[0]: i2c stat <= BUSY
[  921.565302] saa7133[0]: i2c stat <= BUSY
[  921.565336] saa7133[0]: i2c stat <= BUSY
[  921.565371] saa7133[0]: i2c stat <= BUSY
[  921.565405] saa7133[0]: i2c stat <= BUSY
[  921.565440] mt312_read: ret == -5
[  921.565450] saa7133[0]/dvb: dvb_init: No zl10039 found!
Ondrej Zary Dec. 21, 2012, 10 p.m. UTC | #2
Update 2:
all I2C breakage is caused by i2c gates in CE6313 and TDA8290 so I just
commented-out the calls in tuner drivers for now.
Tuner detection in tda8290 breaks because it finds CE5039 at 0x60. Disabling
CE5039 using GPIO in board_init1() and enabling it in dvb_init() allows all
chips to initialize properly:

[  130.658813] saa7130/34: v4l2 driver version 0, 2, 17 loaded
[  130.662715] saa7133[0]: found at 0000:02:01.0, rev: 209, irq: 9, latency: 32, mmio: 0xf4000000
[  130.665879] saa7133[0]: subsystem: 1461:2055, board: AverMedia AverTV Satellite Hybrid+FM A706 [card=191,autodetected]
[  130.669347] saa7133[0]: board init: gpio is 3500
[  130.822347] saa7133[0]: i2c eeprom 00: 61 14 55 20 00 00 00 00 00 00 00 00 00 00 00 00
[  130.825689] saa7133[0]: i2c eeprom 10: ff ff ff ff ff 20 ff ff ff ff ff ff ff ff ff ff
[  130.829008] saa7133[0]: i2c eeprom 20: 02 40 01 02 02 01 01 04 06 ff 00 57 ff ff ff ff
[  130.832317] saa7133[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.835627] saa7133[0]: i2c eeprom 40: 60 a0 00 c6 96 ff 05 30 8b 05 ff 40 ff ff ff ff
[  130.838932] saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.842222] saa7133[0]: i2c eeprom 60: ff 89 00 c0 ff 1c 08 19 97 89 ff ff 80 15 0a ff
[  130.845525] saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.848833] saa7133[0]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.852109] saa7133[0]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.855351] saa7133[0]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.858565] saa7133[0]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.861736] saa7133[0]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.864894] saa7133[0]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.868021] saa7133[0]: i2c eeprom e0: 00 01 81 b0 65 07 ff ff ff ff ff ff ff ff ff ff
[  130.871133] saa7133[0]: i2c eeprom f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
[  130.930349] tuner 2-004b: Tuner -1 found with type(s) Radio TV.
[  130.974345] tda829x 2-004b: setting tuner address to 63
[  131.019535] tda18271 2-0063: creating new instance
[  131.030345] TDA18271HD/C2 detected @ 2-0063
[  131.454335] tda18271: performing RF tracking filter calibration
[  135.778283] tda18271: RF tracking filter calibration complete
[  135.786296] tda829x 2-004b: type set to tda8290+18271
[  138.635047] saa7133[0]: registered device video0 [v4l2]
[  138.639407] saa7133[0]: registered device vbi0
[  138.643130] saa7133[0]: registered device radio0
[  138.676190] dvb_init() allocating 1 frontend
[  139.730238] DVB: registering new adapter (saa7133[0])
[  139.733196] saa7134 0000:02:01.0: DVB: registering adapter 0 frontend 0 (Zarlink ZL10313 DVB-S)...
[  140.321583] saa7134 ALSA driver for DMA sound loaded
[  140.325361] saa7133[0]/alsa: saa7133[0] at 0xf4000000 irq 9 registered as card -1

The card comes to life slowly: FM radio works for a couple of seconds!
With arecord | aplay, noise is played. When a radio station is tuned
(v4l2ctl -d /dev/radio0 -f something), I can hear it clearly for a 2-3 seconds,
then it fades to noise.

These errors appear in log:
[  521.281639] tda18271c2_rf_tracking_filters_correction: [2-0063|M] error -22 on line 277
[  521.289675] tda18271_calc_ir_measure: [2-0063|M] error -34 on line 686
[  521.289682] tda18271_calc_bp_filter: [2-0063|M] error -34 on line 618
[  521.289686] tda18271_calc_rf_band: [2-0063|M] error -34 on line 652
[  521.289690] tda18271_calc_gain_taper: [2-0063|M] error -34 on line 669
diff mbox

Patch

--- a/drivers/media/pci/saa7134/saa7134-cards.c
+++ b/drivers/media/pci/saa7134/saa7134-cards.c
@@ -5773,6 +5773,36 @@  struct saa7134_board saa7134_boards[] = {
 			.gpio	= 0x0000000,
 		},
 	},
+	[SAA7134_BOARD_AVERMEDIA_A706] = {
+		.name           = "AverMedia AverTV Satellite Hybrid+FM A706",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr     = 0x63,
+		.radio_addr     = ADDR_UNSET,
+		.tuner_config   = 2,
+		.gpiomask       = 1 << 21,
+		.mpeg           = SAA7134_MPEG_DVB,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		}, {
+			.name = name_comp,
+			.vmux = 0,
+			.amux = LINE2,
+		}, {
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE2,
+		} },
+		.radio = {
+			.name = name_radio,
+			.amux = TV,
+			.gpio = 0x0200000,
+		},
+	},
 
 };
 
@@ -7020,6 +7050,12 @@  struct pci_device_id saa7134_pci_tbl[] = {
 		.subdevice    = 0x0911,
 		.driver_data  = SAA7134_BOARD_SENSORAY811_911,
 	}, {
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1461, /* Avermedia Technologies Inc */
+		.subdevice    = 0x2055, /* AverTV Satellite Hybrid+FM A706 */
+		.driver_data  = SAA7134_BOARD_AVERMEDIA_A706,
+	}, {
 		/* --- boards without eeprom + subsystem ID --- */
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -7266,6 +7302,7 @@  static int saa7134_tda8290_callback(struct saa7134_dev *dev,
 	case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG:
 	case SAA7134_BOARD_KWORLD_PC150U:
 	case SAA7134_BOARD_MAGICPRO_PROHDTV_PRO2:
+	case SAA7134_BOARD_AVERMEDIA_A706:
 		/* tda8290 + tda18271 */
 		ret = saa7134_tda8290_18271_callback(dev, command, arg);
 		break;
diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c b/drivers/media/pci/saa7134/saa7134-dvb.c
index b209de4..c6f886d 100644
--- a/drivers/media/pci/saa7134/saa7134-dvb.c
+++ b/drivers/media/pci/saa7134/saa7134-dvb.c
@@ -1070,6 +1070,11 @@  static struct mt312_config zl10313_compro_s350_config = {
 	.demod_address = 0x0e,
 };
 
+static struct mt312_config zl10313_avermedia_a706_config = {
+	.demod_address = 0x0e,
+};
+
+
 static struct lgdt3305_config hcw_lgdt3305_config = {
 	.i2c_addr           = 0x0e,
 	.mpeg_mode          = LGDT3305_MPEG_SERIAL,
@@ -1817,6 +1822,19 @@  static int dvb_init(struct saa7134_dev *dev)
 				   &prohdtv_pro2_tda18271_config);
 		}
 		break;
+	case SAA7134_BOARD_AVERMEDIA_A706:
+		fe0->dvb.frontend = dvb_attach(mt312_attach,
+				&zl10313_avermedia_a706_config, &dev->i2c_adap);
+		if (fe0->dvb.frontend) {
+			dvb_attach(tda829x_attach, fe0->dvb.frontend,
+				   &dev->i2c_adap, 0x4b,
+				   &tda829x_no_probe);
+			if (dvb_attach(zl10039_attach, fe0->dvb.frontend,
+					0x60, &dev->i2c_adap) == NULL)
+				wprintk("%s: No zl10039 found!\n",
+					__func__);
+		}
+		break;
 	default:
 		wprintk("Huh? unknown DVB card?\n");
 		break;
diff --git a/drivers/media/pci/saa7134/saa7134.h b/drivers/media/pci/saa7134/saa7134.h
index c24b651..6cef84d 100644
--- a/drivers/media/pci/saa7134/saa7134.h
+++ b/drivers/media/pci/saa7134/saa7134.h
@@ -332,6 +332,7 @@  struct saa7134_card_ir {
 #define SAA7134_BOARD_SENSORAY811_911       188
 #define SAA7134_BOARD_KWORLD_PC150U         189
 #define SAA7134_BOARD_ASUSTeK_PS3_100      190
+#define SAA7134_BOARD_AVERMEDIA_A706		191
 
 #define SAA7134_MAXBOARDS 32
 #define SAA7134_INPUT_MAX 8