saa7134 + upd61151
RFC 1/1 saa7134 + upd61151
Hi
This is my test patch for saa7134 and MPEG2 encoder uPD61151.
My main problem is that saa7134 can has only one MPEG device attached. Our tv card has DVB-T and MPEG2 encoder. And function mops_ops_attach discard second MPEG device.
I try add same as MPEG device into saa7134 driver, but it's not work.
Who can help me??
[ 212.641035] Linux video capture interface: v2.00 [ 212.779837] IR NEC protocol handler initialized [ 212.801895] IR RC5(x) protocol handler initialized [ 212.835655] IR RC6 protocol handler initialized [ 212.862084] saa7130/34: v4l2 driver version 0.2.16 loaded [ 212.862123] saa7134 0000:04:01.0: PCI INT A -> GSI 19 (level, low) -> IRQ 19 [ 212.862129] saa7133[0]: found at 0000:04:01.0, rev: 209, irq: 19, latency: 32, mmio: 0xe5100000 [ 212.862135] saa7133[0]: subsystem: 5ace:7595, board: Beholder BeholdTV X7 [card=171,autodetected] [ 212.862150] saa7133[0]: board init: gpio is 200000 [ 212.862156] buffer_setup set psize = 188 [ 212.875380] IR JVC protocol handler initialized [ 212.877367] IR Sony protocol handler initialized [ 212.880196] lirc_dev: IR Remote Control driver registered, major 252 [ 212.881252] IR LIRC bridge handler initialized [ 213.001012] saa7133[0]: i2c eeprom 00: ce 5a 95 75 54 20 00 00 00 00 00 00 00 00 00 01 [ 213.001031] saa7133[0]: i2c eeprom 10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001049] saa7133[0]: i2c eeprom 20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001067] saa7133[0]: i2c eeprom 30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001084] saa7133[0]: i2c eeprom 40: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001101] saa7133[0]: i2c eeprom 50: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001119] saa7133[0]: i2c eeprom 60: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001136] saa7133[0]: i2c eeprom 70: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001154] saa7133[0]: i2c eeprom 80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001171] saa7133[0]: i2c eeprom 90: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001188] saa7133[0]: i2c eeprom a0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001208] saa7133[0]: i2c eeprom b0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001216] saa7133[0]: i2c eeprom c0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001224] saa7133[0]: i2c eeprom d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001232] saa7133[0]: i2c eeprom e0: 00 00 00 00 ff ff ff ff ff ff ff ff ff ff ff ff [ 213.001241] saa7133[0]: i2c eeprom f0: 42 54 56 30 30 30 30 ff ff ff ff ff ff ff ff ff [ 213.014427] i2c-core: driver [tuner] using legacy suspend method [ 213.014430] i2c-core: driver [tuner] using legacy resume method [ 213.017060] tuner 7-0061: Tuner -1 found with type(s) Radio TV. [ 213.017185] xc5000 7-0061: creating new instance [ 213.020020] xc5000: Successfully identified at address 0x61 [ 213.020024] xc5000: Firmware has not been loaded previously [ 213.020035] sap [ 214.827686] xc5000: I2C write failed (len=4) [ 214.827689] xc5000: xc_SetTVStandard failed [ 214.827698] sap [ 221.354013] Registered IR keymap rc-behold [ 221.354156] input: i2c IR (BeholdTV) as /devices/virtual/rc/rc0/input5 [ 221.354219] rc0: i2c IR (BeholdTV) as /devices/virtual/rc/rc0 [ 221.354223] ir-kbd-i2c: i2c IR (BeholdTV) detected at i2c-7/7-002d/ir0 [saa7133[0]] [ 221.354702] saa7134 0000:04:01.0: registered master spi32766 (dynamic) [ 221.354705] saa7134 0000:04:01.0: spi master registered: bus_num=32766 num_chipselect=1 [ 221.354707] saa7133[0]: found muPD61151 MPEG encoder [ 221.375343] spi spi32766.0: spi_bitbang_setup, 20 nsec/bit [ 221.375350] spi spi32766.0: setup mode 0, 8 bits/w, 50000000 Hz max --> 0 [ 221.375380] upd61151_probe function [ 221.375665] upd61151: MPEG2 core status 0 [ 221.375666] upd61151: need reload firmware [ 221.375668] Start load firmware... [ 221.375669] DEBUG: upd61151_download_firmware [ 221.378088] DEBUG: upd61151_load_base_firmware [ 221.378091] upd61151: waiting for base firmware upload (D61151_PS_7133_v22_031031.bin)... [ 221.440224] upd61151: firmware read 97002 bytes. [ 221.440226] upd61151: base firmware uploading... [ 221.440434] upd61151: Transfer IRQ status 0x0 [ 221.442098] fw upload start [ 239.219204] fw upload stop [ 239.219391] upd61151: Transfer IRQ status 0x1 [ 239.219760] upd61151: base firmware upload complete... [ 239.219954] DEBUG: upd61151_load_audio_firmware [ 239.219955] upd61151: waiting for audio firmware upload (audrey_MPE_V1r51.bin)... [ 239.248638] upd61151: firmware read 40064 bytes. [ 239.248640] upd61151: audio firmware uploading... [ 239.249104] upd61151: Transfer IRQ status 0x1 [ 239.250593] fw upload start [ 239.274165] upd61151: Transfer IRQ status 0x2 [ 246.764126] upd61151: Transfer IRQ status 0x1 [ 246.764312] fw upload stop [ 246.764496] upd61151: audio firmware upload complete... [ 246.764691] upd61151: IRQ status 0x19 [ 246.764876] DEBUG uPD61151: upd61151_chip_command [ 246.765065] upd61151: IRQ error status 0x0 [ 246.765441] upd61151: MPEG2 core status 0 [ 246.765627] upd61151: IRQ error status 0x0 [ 246.776267] upd61151: MPEG2 core status 1 [ 246.776461] upd61151: IRQ status 0x8 [ 246.776647] upd61151: SetState(1) SUCCESS!!! Delay [10 ms]. [ 246.776649] upd61151_setup_video_frontend [ 246.776650] 0x0 0x0 [ 246.777791] upd61151_setup_audio_frontend [ 246.778210] upd61151_config_encoder [ 246.778212] Video attrib1 = 0x80 [ 246.778587] upd61151_prepare_bitrates [ 246.780783] upd61151_set_state [ 246.780996] upd61151: IRQ error status 0x0 [ 246.781448] upd61151: MPEG2 core status 1 [ 246.781633] upd61151: IRQ error status 0x0 [ 246.783822] upd61151: MPEG2 core status 1 [ 246.784023] upd61151: IRQ error status 0x0 [ 246.786210] upd61151: MPEG2 core status 1 [ 246.786395] upd61151: IRQ error status 0x0 [ 246.788608] upd61151: MPEG2 core status 1 [ 246.788800] upd61151: IRQ error status 0x0 [ 246.790990] upd61151: MPEG2 core status 1 [ 246.791182] upd61151: IRQ error status 0x0 [ 246.793369] upd61151: MPEG2 core status 1 [ 246.793554] upd61151: IRQ error status 0x0 [ 246.795740] upd61151: MPEG2 core status 1 [ 246.795925] upd61151: IRQ error status 0x0 [ 246.798114] upd61151: MPEG2 core status 1 [ 246.798299] upd61151: IRQ error status 0x0 [ 246.800486] upd61151: MPEG2 core status 1 [ 246.800671] upd61151: IRQ error status 0x0 [ 246.802863] upd61151: MPEG2 core status 1 [ 246.803070] upd61151: IRQ error status 0x0 [ 246.805261] upd61151: MPEG2 core status 2 [ 246.805447] upd61151: IRQ status 0x28 [ 246.805632] upd61151: MPEG2 SetState(0), SUCCESS! Delay(20 ms) [ 246.805633] DEBUG uPD61151: upd61151_chip_command [ 246.805818] upd61151: IRQ error status 0x0 [ 246.806361] upd61151: MPEG2 core status 2 [ 246.806546] upd61151: IRQ error status 0x0 [ 246.817221] upd61151: MPEG2 core status 1 [ 246.817419] upd61151: IRQ status 0x8 [ 246.817604] upd61151: SetState(1) SUCCESS!!! Delay [10 ms]. [ 246.817606] Firmware downloaded SUCCESS!!! [ 246.817613] saa7134 0000:04:01.0: registered child spi32766.0 [ 246.818333] saa7133[0]: registered device video0 [v4l2] [ 246.818742] saa7133[0]: registered device vbi0 [ 246.818932] saa7133[0]: registered device radio0 [ 246.818934] befor request_submodules [ 246.818940] request_mod_async [ 246.818941] request mod empress [ 246.834515] sap [ 246.835857] sap [ 246.835995] sap [ 246.842066] xc5000: I2C write failed (len=4) [ 246.844303] saa7134_ts_register start [ 246.844306] SAA7134_MPEG_EMPRESS found [ 246.844307] mpeg_ops_attach start [ 246.844308] saa7134_ts_register stop [ 246.844399] dvb = 2 [ 246.844400] request mod dvb [ 246.908378] call saa7134_ts_register [ 246.908381] saa7134_ts_register start [ 246.908382] SAA7134_MPEG_DVB found [ 246.908384] dvb_ops_attach start [ 246.908385] saa7134_ts_register stop [ 246.926959] saa7134 ALSA driver for DMA sound loaded [ 246.926989] saa7133[0]/alsa: saa7133[0] at 0xe5100000 irq 19 registered as card -1 [ 246.943022] xc5000: I2C write failed (len=4) [ 246.943030] DEBUG uPD61151: upd61151_s_std [ 246.943032] DEBUG uPD61151: upd61151_s_std [ 246.944772] xc5000: I2C read failed [ 246.944780] xc5000: I2C read failed [ 246.944782] xc5000: waiting for firmware upload (dvb-fe-xc5000-1.6.114.fw)... [ 246.955952] sap [ 246.985343] xc5000: firmware read 12401 bytes. [ 246.985345] xc5000: firmware uploading... [ 249.048010] xc5000: firmware upload complete... [ 249.689016] DEBUG uPD61151: upd61151_s_std [ 249.689021] DEBUG uPD61151: upd61151_s_std [ 249.693931] sap [ 249.696850] sap [ 250.080015] DEBUG uPD61151: upd61151_s_std [ 250.080020] DEBUG uPD61151: upd61151_s_std [ 250.470016] DEBUG uPD61151: upd61151_s_std [ 250.470021] DEBUG uPD61151: upd61151_s_std
With my best regards, Dmitry.
commit cb57f465d8c395b66898e49f1dc4f3e7bd01a2e8
Author: dimon <[email protected]> Date: Tue May 31 08:27:47 2011 +1000
test commit
drivers/media/common/tuners/xc5000.c +46 -5
@@ -383,6 +383,7 @@ static int xc_SetTVStandard(struct xc5000_priv *priv, u16 VideoMode, u16 AudioMode) { int ret; +dprintk (1 ,"%s()\n" , __func__);dprintk (1 ,"%s(0x%04x,0x%04x)\n" , __func__, VideoMode, AudioMode); dprintk(1, "%s() Standard = %s\n", __func__,
@@ -397,6 +398,7 @@ static int xc_SetTVStandard(struct xc5000_priv *priv,static int xc_SetSignalSource (struct xc5000_priv *priv,u16 rf_mode) { +dprintk (1 ,"%s()\n" , __func__);dprintk (1 ,"%s(%d) Source = %s\n" , __func__, rf_mode, rf_mode ==XC_RF_MODE_AIR ?"ANTENNA" :"CABLE" );
@@ -433,6 +435,7 @@ static int xc_set_RF_frequency(struct xc5000_priv *priv, u32 freq_hz)static int xc_set_IF_frequency (struct xc5000_priv *priv,u32 freq_khz) {u32 freq_code = (freq_khz *1024 )/1000 ; +dprintk (1 ,"%s()\n" , __func__);dprintk (1 ,"%s(freq_khz = %d) freq_code = 0x%x\n" , __func__, freq_khz, freq_code);
@@ -442,6 +445,8 @@ static int xc_set_IF_frequency(struct xc5000_priv *priv, u32 freq_khz)static int xc_get_ADC_Envelope (struct xc5000_priv *priv,u16 *adc_envelope) { +dprintk (1 ,"%s()\n" , __func__); +return xc5000_readreg (priv,XREG_ADC_ENV , adc_envelope); }
@@ -451,6 +456,8 @@ static int xc_get_frequency_error(struct xc5000_priv *priv, u32 *freq_error_hz)u16 regData;u32 tmp; +dprintk (1 ,"%s()\n" , __func__); + result =xc5000_readreg (priv,XREG_FREQ_ERROR , ®Data);if (result !=XC_RESULT_SUCCESS )return result;
@@ -462,6 +469,8 @@ static int xc_get_frequency_error(struct xc5000_priv *priv, u32 *freq_error_hz)static int xc_get_lock_status (struct xc5000_priv *priv,u16 *lock_status) { +dprintk (1 ,"%s()\n" , __func__); +return xc5000_readreg (priv,XREG_LOCK , lock_status); }
@@ -472,6 +481,8 @@ static int xc_get_version(struct xc5000_priv *priv,u16 data;int result; +dprintk (1 ,"%s()\n" , __func__); + result =xc5000_readreg (priv,XREG_VERSION , &data);if (result !=XC_RESULT_SUCCESS )return result;
@@ -486,6 +497,8 @@ static int xc_get_version(struct xc5000_priv *priv,static int xc_get_buildversion (struct xc5000_priv *priv,u16 *buildrev) { +dprintk (1 ,"%s()\n" , __func__); +return xc5000_readreg (priv,XREG_BUILD , buildrev); }
@@ -494,6 +507,8 @@ static int xc_get_hsync_freq(struct xc5000_priv *priv, u32 *hsync_freq_hz)u16 regData;int result; +dprintk (1 ,"%s()\n" , __func__); + result =xc5000_readreg (priv,XREG_HSYNC_FREQ , ®Data);if (result !=XC_RESULT_SUCCESS )return result;
@@ -504,11 +519,15 @@ static int xc_get_hsync_freq(struct xc5000_priv *priv, u32 *hsync_freq_hz)static int xc_get_frame_lines (struct xc5000_priv *priv,u16 *frame_lines) { +dprintk (1 ,"%s()\n" , __func__); +return xc5000_readreg (priv,XREG_FRAME_LINES , frame_lines); }static int xc_get_quality (struct xc5000_priv *priv,u16 *quality) { +dprintk (1 ,"%s()\n" , __func__); +return xc5000_readreg (priv,XREG_QUALITY , quality); }
@@ -517,6 +536,8 @@ static u16 WaitForLock(struct xc5000_priv *priv)u16 lockState =0 ;int watchDogCount =40 ; +dprintk (1 ,"%s()\n" , __func__); +while ((lockState ==0 ) && (watchDogCount >0 )) {xc_get_lock_status (priv, &lockState);if (lockState !=1 ) {
@@ -552,7 +573,7 @@ static int xc5000_fwupload(struct dvb_frontend *fe)struct xc5000_priv *priv = fe->tuner_priv;const struct firmware *fw;int ret; - +dprintk (1 ,"%s()\n" , __func__);/* request the firmware, this will block and timeout */ printk (KERN_INFO "xc5000: waiting for firmware upload (%s)...\n" ,XC5000_DEFAULT_FIRMWARE );
@@ -642,6 +663,8 @@ static int xc5000_set_params(struct dvb_frontend *fe, {struct xc5000_priv *priv = fe->tuner_priv;int ret; +printk ("sp\n" ); +// dprintk(1, "%s()\n", __func__); if (xc5000_is_firmware_loaded (fe) !=XC_RESULT_SUCCESS ) {if (xc_load_fw_and_init_tuner (fe) !=XC_RESULT_SUCCESS ) {
@@ -772,6 +795,8 @@ static int xc5000_is_firmware_loaded(struct dvb_frontend *fe)int ret;u16 id; +// dprintk(1, "%s()\n", __func__); + ret =xc5000_readreg (priv,XREG_PRODUCT_ID , &id);if (ret ==XC_RESULT_SUCCESS ) {if (id ==XC_PRODUCT_ID_FW_NOT_LOADED )
@@ -790,7 +815,7 @@ static int xc5000_set_tv_freq(struct dvb_frontend *fe, {struct xc5000_priv *priv = fe->tuner_priv;int ret; - +dprintk (1 ,"%s()\n" , __func__);dprintk (1 ,"%s() frequency=%d (in units of 62.5khz)\n" , __func__, params->frequency);
@@ -878,7 +903,7 @@ static int xc5000_set_radio_freq(struct dvb_frontend *fe,struct xc5000_priv *priv = fe->tuner_priv;int ret = -EINVAL ;u8 radio_input; - +dprintk (1 ,"%s()\n" , __func__);dprintk (1 ,"%s() frequency=%d (in units of khz)\n" , __func__, params->frequency);
@@ -935,14 +960,17 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe, {struct xc5000_priv *priv = fe->tuner_priv;int ret = -EINVAL ; +printk ("sap\n" ); +mutex_lock (&xc5000_list_mutex); +// dprintk(1, "%s()\n", __func__); if (priv->i2c_props.adap ==NULL ) -return -EINVAL ; + goto errexit;if (xc5000_is_firmware_loaded (fe) !=XC_RESULT_SUCCESS ) {if (xc_load_fw_and_init_tuner (fe) !=XC_RESULT_SUCCESS ) {dprintk (1 ,"Unable to load firmware and init tuner\n" ); -return -EINVAL ; + goto errexit; } }
@@ -956,7 +984,12 @@ static int xc5000_set_analog_params(struct dvb_frontend *fe,break ; } +mutex_unlock (&xc5000_list_mutex);return ret; + +errexit: +mutex_unlock (&xc5000_list_mutex); +return -EINVAL ; }
@@ -982,6 +1015,8 @@ static int xc5000_get_status(struct dvb_frontend *fe, u32 *status)struct xc5000_priv *priv = fe->tuner_priv;u16 lock_status =0 ; +dprintk (1 ,"%s()\n" , __func__); +xc_get_lock_status (priv, &lock_status);dprintk (1 ,"%s() lock_status = 0x%08x\n" , __func__, lock_status);
@@ -996,6 +1031,10 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)struct xc5000_priv *priv = fe->tuner_priv;int ret =0 ; +dprintk (1 ,"%s()\n" , __func__); + +// mutex_lock(&xc5000_list_mutex); +if (xc5000_is_firmware_loaded (fe) !=XC_RESULT_SUCCESS ) { ret =xc5000_fwupload (fe);if (ret !=XC_RESULT_SUCCESS )
@@ -1015,6 +1054,8 @@ static int xc_load_fw_and_init_tuner(struct dvb_frontend *fe)/* Default to "CABLE" mode */ ret |=xc_write_reg (priv,XREG_SIGNALSOURCE ,XC_RF_MODE_CABLE ); +// mutex_unlock(&xc5000_list_mutex); +return ret; }
drivers/media/video/saa7134/Makefile +2 -2
@@ -1,10 +1,10 @@ saa7134-y := saa7134-cards.o saa7134-core.o saa7134-i2c.o saa7134-y += saa7134-ts.o saa7134-tvaudio.o saa7134-vbi.o -saa7134-y += saa7134-video.o +saa7134-y += saa7134-video.o saa7134-spi.o saa7134-$(CONFIG_VIDEO_SAA7134_RC) += saa7134-input.o -obj-$(CONFIG_VIDEO_SAA7134) += saa6752hs.o saa7134.o saa7134-empress.o +obj-$(CONFIG_VIDEO_SAA7134) += saa6752hs.o saa7134.o saa7134-empress.o upd61151.o obj-$(CONFIG_VIDEO_SAA7134_ALSA) += saa7134-alsa.o
drivers/media/video/saa7134/saa7134-cards.c +20 -1
@@ -5347,24 +5347,43 @@ struct saa7134_board saa7134_boards[] = { .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, - .mpeg = SAA7134_MPEG_DVB, + .mpeg = (SAA7134_MPEG_EMPRESS | SAA7134_MPEG_DVB), + .encoder_type = SAA7134_ENCODER_muPD61151, + .gpiomask = 0x00860000, .inputs = { { .name = name_tv, .vmux = 2, .amux = TV, .tv = 1, + .gpio =0x00860000 }, { .name = name_comp1, .vmux = 0, .amux = LINE1, + .gpio =0x00860000 }, { .name = name_svideo, .vmux = 9, .amux = LINE1, + .gpio = 0x00860000 } }, .radio = { .name = name_radio, .amux = TV, + .gpio =0x00860000 + }, + .video_out = CCIR656, + .vid_port_opts = (SET_T_CODE_POLARITY_NON_INVERTED | +SET_CLOCK_NOT_DELAYED | +SET_CLOCK_INVERTED | + SET_VSYNC_OFF), + .spi = { + .cs = 17, + .clock = 18, + .mosi = 23, + .miso = 21, + .num_chipselect = 1, + .spi_enable = 1, }, }, [SAA7134_BOARD_ZOLID_HYBRID_PCI] = {
drivers/media/video/saa7134/saa7134-core.c +172 -17
286 lines not on this page · raw message
drivers/media/video/saa7134/saa7134-dvb.c +44 -4
103 lines not on this page · raw message
drivers/media/video/saa7134/saa7134-empress.c +43 -29
309 lines not on this page · raw message
drivers/media/video/saa7134/saa7134-spi.c new file +159 -0
159 lines not on this page · raw message
drivers/media/video/saa7134/saa7134-ts.c +41 -4
99 lines not on this page · raw message
drivers/media/video/saa7134/saa7134.h +56 -5
140 lines not on this page · raw message
drivers/media/video/saa7134/upd61151.c new file +1546 -0
1,546 lines not on this page · raw message
include/media/upd61151.h new file +125 -0
113 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.