Index: ati/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v retrieving revision 1.13 diff -u -r1.13 Imakefile --- ati/Imakefile 7 Mar 2005 19:27:22 -0000 1.13 +++ ati/Imakefile 20 Mar 2005 15:55:40 -0000 @@ -34,13 +34,17 @@ MODSRCS2 = atiload.c atimisc.c MODSRCS3 = r128_misc.c MODSRCS4 = radeon_misc.c +MODSRC_THEATRE_DETECT = theatre_detect_module.c MODSRC_THEATRE = theatre_module.c +MODSRC_THEATRE200 = theatre200_module.c MODOBJS1 = atimodule.o MODOBJS2 = atiload.o atimisc.o MODOBJS3 = r128_misc.o MODOBJS4 = radeon_misc.o +MODOBJ_THEATRE_DETECT = theatre_detect_module.o MODOBJ_THEATRE = theatre_module.o +MODOBJ_THEATRE200 = theatre200_module.o #endif @@ -175,7 +179,9 @@ SRCS4 = radeon_accel.c radeon_mergedfb.c radeon_cursor.c radeon_dga.c radeon_driver.c \ radeon_video.c radeon_bios.c radeon_mm_i2c.c radeon_vip.c \ $(DRISRCS4) $(MODSRCS4) +SRCS_THEATRE_DETECT = theatre.c $(MODSRC_THEATRE_DETECT) SRCS_THEATRE = theatre.c $(MODSRC_THEATRE) +SRCS_THEATRE200 = theatre200.c $(MODSRC_THEATRE200) OBJS1 = ati.o atiadapter.o atibus.o atichip.o atiident.o atioption.o \ atiprobe.o atividmem.o $(CPIOOBJS1) $(MODOBJS1) \ @@ -191,10 +197,12 @@ OBJS4 = radeon_accel.o radeon_mergedfb.o radeon_cursor.o radeon_dga.o radeon_driver.o \ radeon_video.o radeon_bios.o radeon_mm_i2c.o radeon_vip.o \ $(DRIOBJS4) $(MODOBJS4) +OBJS_THEATRE_DETECT = theatre_detect.o $(MODOBJ_THEATRE_DETECT) OBJS_THEATRE = theatre.o $(MODOBJ_THEATRE) +OBJS_THEATRE200 = theatre200.o $(MODOBJ_THEATRE200) -SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS_THEATRE) -OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS_THEATRE) +SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) $(SRCS_THEATRE_DETECT) $(SRCS_THEATRE) $(SRCS_THEATRE200) +OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) $(OBJS_THEATRE_DETECT) $(OBJS_THEATRE) $(OBJS_THEATRE200) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -222,13 +230,17 @@ ObjectModuleTarget(atimisc,$(OBJS2)) ObjectModuleTarget(r128,$(OBJS3)) ObjectModuleTarget(radeon,$(OBJS4)) +ObjectModuleTarget(theatre_detect, $(OBJS_THEATRE_DETECT)) ObjectModuleTarget(theatre, $(OBJS_THEATRE)) +ObjectModuleTarget(theatre200, $(OBJS_THEATRE200)) -InstallVideoObjectModule(ati,$(MODULEDIR)) -InstallVideoObjectModule(atimisc,$(MODULEDIR)) -InstallVideoObjectModule(r128,$(MODULEDIR)) -InstallVideoObjectModule(radeon,$(MODULEDIR)) -InstallMultimediaObjectModule(theatre,$(MODULEDIR)) +InstallObjectModule(ati,$(MODULEDIR),drivers) +InstallObjectModule(atimisc,$(MODULEDIR),drivers) +InstallObjectModule(r128,$(MODULEDIR),drivers) +InstallObjectModule(radeon,$(MODULEDIR),drivers) +InstallObjectModule(theatre_detect,$(MODULEDIR),multimedia) +InstallObjectModule(theatre,$(MODULEDIR),multimedia) +InstallObjectModule(theatre200,$(MODULEDIR),multimedia) #if !defined(XF86DriverSDK) #if 0 @@ -394,11 +406,21 @@ InstallDriverSDKObjectModule(r128,$(DRIVERSDKMODULEDIR),drivers) InstallDriverSDKObjectModule(radeon,$(DRIVERSDKMODULEDIR),drivers) +InstallDriverSDKNonExecFile(theatre_detect.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(theatre_detect_module.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(theatre.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(theatre_reg.h,$(DRIVERSDKDIR)/drivers/ati) + InstallDriverSDKNonExecFile(theatre.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(theatre_module.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(theatre.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(theatre_reg.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(theatre200.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(theatre200_module.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(theatre200.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(theatre200_reg.h,$(DRIVERSDKDIR)/drivers/ati) + /* Remove instances of ati2 module */ #if DoLoadableServer Index: ati/generic_bus.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/generic_bus.h,v retrieving revision 1.1 diff -u -r1.1 generic_bus.h --- ati/generic_bus.h 2 Oct 2004 20:35:04 -0000 1.1 +++ ati/generic_bus.h 20 Mar 2005 15:55:40 -0000 @@ -23,6 +23,9 @@ Bool (*ioctl)(GENERIC_BUS_Ptr, long, long, char *); Bool (*read)(GENERIC_BUS_Ptr, CARD32, CARD32, CARD8 *); Bool (*write)(GENERIC_BUS_Ptr, CARD32, CARD32, CARD8 *); + Bool (*fifo_read)(GENERIC_BUS_Ptr, CARD32, CARD32, CARD8 *); + Bool (*fifo_write)(GENERIC_BUS_Ptr, CARD32, CARD32, CARD8 *); + } GENERIC_BUS_Rec; Index: ati/radeon.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v retrieving revision 1.18 diff -u -r1.18 radeon.h --- ati/radeon.h 22 Feb 2005 00:39:15 -0000 1.18 +++ ati/radeon.h 20 Mar 2005 15:55:55 -0000 @@ -568,6 +568,8 @@ int RageTheatreCompositePort; int RageTheatreSVideoPort; int tunerType; + char* RageTheatreMicrocPath; + char* RageTheatreMicrocType; Bool MM_TABLE_valid; struct { CARD8 table_revision; Index: ati/radeon_driver.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v retrieving revision 1.45 diff -u -r1.45 radeon_driver.c --- ati/radeon_driver.c 18 Mar 2005 22:36:47 -0000 1.45 +++ ati/radeon_driver.c 20 Mar 2005 15:57:25 -0000 @@ -169,6 +169,8 @@ OPTION_RAGE_THEATRE_COMPOSITE_PORT, OPTION_RAGE_THEATRE_SVIDEO_PORT, OPTION_TUNER_TYPE, + OPTION_RAGE_THEATRE_MICROC_PATH, + OPTION_RAGE_THEATRE_MICROC_TYPE, #endif #ifdef RENDER OPTION_RENDER_ACCEL, @@ -226,6 +228,8 @@ { OPTION_RAGE_THEATRE_COMPOSITE_PORT, "RageTheatreCompositePort", OPTV_INTEGER, {0}, FALSE }, { OPTION_RAGE_THEATRE_SVIDEO_PORT, "RageTheatreSVideoPort", OPTV_INTEGER, {0}, FALSE }, { OPTION_TUNER_TYPE, "TunerType", OPTV_INTEGER, {0}, FALSE }, + { OPTION_RAGE_THEATRE_MICROC_PATH, "RageTheatreMicrocPath", OPTV_STRING, {0}, FALSE }, + { OPTION_RAGE_THEATRE_MICROC_TYPE, "RageTheatreMicrocType", OPTV_STRING, {0}, FALSE }, #endif #ifdef RENDER { OPTION_RENDER_ACCEL, "RenderAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -4334,6 +4338,9 @@ xf86Int10InfoPtr pInt10 = NULL; void *int10_save = NULL; const char *s; + char* microc_path = NULL; + char* microc_type = NULL; + RADEONTRACE(("RADEONPreInit\n")); if (pScrn->numEntities != 1) return FALSE; @@ -4540,6 +4547,23 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Attempt to set tuner type to invalid value. Disabling setting\n"); info->tunerType=-1; } + + if((microc_path = xf86GetOptValString(info->Options, OPTION_RAGE_THEATRE_MICROC_PATH)) != NULL) + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rage Theatre Microcode path was specified as %s\n", microc_path); + info->RageTheatreMicrocPath = microc_path; + } else { + info->RageTheatreMicrocPath= NULL; + } + + if((microc_type = xf86GetOptValString(info->Options, OPTION_RAGE_THEATRE_MICROC_TYPE)) != NULL) + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rage Theatre Microcode type was specified as %s\n", microc_type); + info->RageTheatreMicrocType = microc_type; + } else { + info->RageTheatreMicrocType= NULL; + } + #endif info->DispPriority = 1; Index: ati/radeon_mm_i2c.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_mm_i2c.c,v retrieving revision 1.2 diff -u -r1.2 radeon_mm_i2c.c --- ati/radeon_mm_i2c.c 3 Oct 2004 23:54:40 -0000 1.2 +++ ati/radeon_mm_i2c.c 20 Mar 2005 15:57:45 -0000 @@ -13,6 +13,7 @@ #include "fi1236.h" #include "msp3430.h" #include "tda9885.h" +#include "uda1380.h" #include "i2c_def.h" @@ -322,9 +323,9 @@ {"TEMIC-FN5AL" , TUNER_TYPE_TEMIC_FN5AL}, {"FQ1216ME/P" , TUNER_TYPE_FI1216}, {"FI1236W" , TUNER_TYPE_FI1236W}, - {"Alps TSBH5" , -1}, + {"Philips FI1216ME (or compatible)" , TUNER_TYPE_FM1216ME}, {"Alps TSCxx" , -1}, - {"Alps TSCH5 FM" , -1}, + {"Philips FI1216ME (or compatible)" , TUNER_TYPE_FM1216ME}, {"UNKNOWN-19" , -1}, {"UNKNOWN-20" , -1}, {"UNKNOWN-21" , -1}, @@ -363,6 +364,7 @@ pPriv->fi1236 = NULL; pPriv->msp3430 = NULL; pPriv->tda9885 = NULL; + pPriv->uda1380 = NULL; #if 0 /* put back on when saa7114 support is present */ pPriv->saa7114 = NULL; #endif @@ -415,9 +417,12 @@ pPriv->i2c->BusName="Radeon multimedia bus"; pPriv->i2c->DriverPrivate.ptr=(pointer)pPriv; switch(info->ChipFamily){ + case CHIP_FAMILY_RV350: + case CHIP_FAMILY_R350: case CHIP_FAMILY_R300: + case CHIP_FAMILY_RV250: case CHIP_FAMILY_R200: - case CHIP_FAMILY_RV200: + case CHIP_FAMILY_RV200: pPriv->i2c->I2CWriteRead=R200_I2CWriteRead; xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Using R200 i2c bus access method\n"); break; @@ -516,6 +521,54 @@ } } } + + if(info->MM_TABLE_valid && ((RADEON_tuners[info->MM_TABLE.tuner_type & 0x1f].type==TUNER_TYPE_FM1216ME) + || (RADEON_tuners[info->MM_TABLE.tuner_type & 0x1f].type==TUNER_TYPE_FI1236W))) + { + if(!xf86LoadSubModule(pScrn,"tda9885")) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to initialize tda9885 driver\n"); + } + else + { + xf86LoaderReqSymbols(TDA9885SymbolsList, NULL); + if(pPriv->tda9885 == NULL) + { + pPriv->tda9885 = xf86_Detect_tda9885(pPriv->i2c, TDA9885_ADDR_1); + } + if(pPriv->tda9885 == NULL) + { + pPriv->tda9885 = xf86_Detect_tda9885(pPriv->i2c, TDA9885_ADDR_2); + } + if(pPriv->tda9885 != NULL) + { + RADEON_TDA9885_Init(pPriv); + pPriv->fi1236->afc_source = (void*)pPriv->tda9885; + } + } + } + + if(!xf86LoadSubModule(pScrn,"uda1380")) + { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to initialize uda1380 driver\n"); + } + else + { + xf86LoaderReqSymbols(UDA1380SymbolsList, NULL); + if(pPriv->uda1380 == NULL) + { + pPriv->uda1380 = xf86_Detect_uda1380(pPriv->i2c, UDA1380_ADDR_1); + } + if(pPriv->uda1380 == NULL) + { + pPriv->uda1380 = xf86_Detect_uda1380(pPriv->i2c, UDA1380_ADDR_2); + } + if(pPriv->uda1380 != NULL) + { + xf86_uda1380_init(pPriv->uda1380); + } + } + if(!xf86LoadSubModule(pScrn,"msp3430")) { Index: ati/radeon_video.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v retrieving revision 1.21 diff -u -r1.21 radeon_video.c --- ati/radeon_video.c 19 Feb 2005 16:00:12 -0000 1.21 +++ ati/radeon_video.c 20 Mar 2005 15:58:09 -0000 @@ -14,6 +14,7 @@ #include "Xv.h" #include "fourcc.h" +#include "theatre_detect.h" #include "theatre_reg.h" #include "fi1236.h" #include "msp3430.h" @@ -1372,17 +1373,69 @@ RADEONVIP_init(pScrn, pPriv); info->adaptor = adapt; - if(!xf86LoadSubModule(pScrn,"theatre")) + if(!xf86LoadSubModule(pScrn,"theatre_detect")) { - xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Unable to load Rage Theatre module\n"); - goto skip_theatre; - } - xf86LoaderReqSymbols(TheatreSymbolsList, NULL); - + xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Unable to load Rage Theatre detect module\n"); + goto skip_theatre; + } + xf86LoaderReqSymbols(TheatreDetectSymbolsList, NULL); + RADEONSetupTheatre(pScrn, pPriv); + + /* + * Now load the correspondind theatre chip based on what has been detected. + */ + if (pPriv->theatre) + { + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Going to load the corresponding theatre module\n"); + switch (pPriv->theatre->theatre_id) + { + case RT100_ATI_ID: + { + if(!xf86LoadSubModule(pScrn,"theatre")) + { + xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Unable to load Rage Theatre module\n"); + xfree(pPriv->theatre); + goto skip_theatre; + } + break; + } + case RT200_ATI_ID: + { + if(!xf86LoadSubModule(pScrn,"theatre200")) + { + xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Unable to load Rage Theatre module\n"); + xfree(pPriv->theatre); + goto skip_theatre; + } + pPriv->theatre->microc_path = info->RageTheatreMicrocPath; + pPriv->theatre->microc_type = info->RageTheatreMicrocType; + break; + } + default: + { + xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Unknown Theatre chip\n"); + xfree(pPriv->theatre); + goto skip_theatre; + } + } + xf86LoaderReqSymbols(TheatreSymbolsList, NULL); + } - if(pPriv->theatre!=NULL){ + if(pPriv->theatre!=NULL) + { xf86_InitTheatre(pPriv->theatre); + if(pPriv->theatre->mode == MODE_UNINITIALIZED) + { + Xfree(pPriv->theatre); + pPriv->theatre = NULL; + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Rage Theatre disabled\n"); + /* Here the modules must be unloaded */ + goto skip_theatre; + } + } + + if(pPriv->theatre!=NULL){ xf86_ResetTheatreRegsForNoTVout(pPriv->theatre); xf86_RT_SetTint(pPriv->theatre, pPriv->dec_hue); xf86_RT_SetSaturation(pPriv->theatre, pPriv->dec_saturation); @@ -1470,6 +1523,7 @@ RADEONResetVideo(pScrn); pPriv->video_stream_active = FALSE; if(pPriv->msp3430 != NULL) xf86_MSP3430SetVolume(pPriv->msp3430, MSP3430_FAST_MUTE); + if(pPriv->uda1380 != NULL) xf86_uda1380_mute(pPriv->uda1380, TRUE); if(pPriv->i2c != NULL) RADEON_board_setmisc(pPriv); } if(info->videoLinear) { @@ -1659,17 +1713,20 @@ pPriv->frequency = value; /* mute volume if it was not muted before */ if((pPriv->msp3430!=NULL)&& !pPriv->mute)xf86_MSP3430SetVolume(pPriv->msp3430, MSP3430_FAST_MUTE); + if((pPriv->uda1380!=NULL)&& !pPriv->mute)xf86_uda1380_mute(pPriv->uda1380, TRUE); if(pPriv->fi1236 != NULL) xf86_TUNER_set_frequency(pPriv->fi1236, value); /* if(pPriv->theatre != NULL) RADEON_RT_SetEncoding(pScrn, pPriv); */ if((pPriv->msp3430 != NULL) && (pPriv->msp3430->recheck)) xf86_InitMSP3430(pPriv->msp3430); if((pPriv->msp3430 != NULL)&& !pPriv->mute) xf86_MSP3430SetVolume(pPriv->msp3430, MSP3430_VOLUME(pPriv->volume)); + if((pPriv->uda1380 != NULL)&& !pPriv->mute) xf86_uda1380_setvolume(pPriv->uda1380, pPriv->volume); } else if(attribute == xvMute) { pPriv->mute = value; if(pPriv->msp3430 != NULL) xf86_MSP3430SetVolume(pPriv->msp3430, pPriv->mute ? MSP3430_FAST_MUTE : MSP3430_VOLUME(pPriv->volume)); if(pPriv->i2c != NULL) RADEON_board_setmisc(pPriv); + if(pPriv->uda1380 != NULL) xf86_uda1380_mute(pPriv->uda1380, pPriv->mute); } else if(attribute == xvSAP) { @@ -1684,6 +1741,7 @@ pPriv->mute = FALSE; if(pPriv->msp3430 != NULL) xf86_MSP3430SetVolume(pPriv->msp3430, MSP3430_VOLUME(value)); if(pPriv->i2c != NULL) RADEON_board_setmisc(pPriv); + if(pPriv->uda1380 != NULL) xf86_uda1380_setvolume(pPriv->uda1380, value); } else if(attribute == xvOverlayDeinterlacingMethod) { @@ -3476,8 +3534,8 @@ case 2: case 3: t->standard_video_if=2; - t->standard_sound_carrier=3; - t->modulation=0; /* positive AM */ + t->standard_sound_carrier=1; + t->modulation=2; /* negative FM */ break; /* NTSC */ case 4: @@ -3485,7 +3543,7 @@ case 6: t->standard_video_if=1; t->standard_sound_carrier=0; - t->modulation=2; /* negative FM */ + t->modulation=2; /* negative FM */ break; /* SECAM */ case 7: Index: ati/radeon_video.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.h,v retrieving revision 1.4 diff -u -r1.4 radeon_video.h --- ati/radeon_video.h 3 Oct 2004 03:07:17 -0000 1.4 +++ ati/radeon_video.h 20 Mar 2005 15:58:09 -0000 @@ -5,6 +5,7 @@ #include "fi1236.h" #include "msp3430.h" #include "tda9885.h" +#include "uda1380.h" #include "i2c_def.h" #include "generic_bus.h" @@ -40,6 +41,7 @@ CARD8 tuner_type; MSP3430Ptr msp3430; TDA9885Ptr tda9885; + UDA1380Ptr uda1380; /* VIP bus and devices */ GENERIC_BUS_Ptr VIP; Index: ati/radeon_vip.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_vip.c,v retrieving revision 1.1 diff -u -r1.1 radeon_vip.c --- ati/radeon_vip.c 2 Oct 2004 20:55:42 -0000 1.1 +++ ati/radeon_vip.c 20 Mar 2005 15:58:10 -0000 @@ -9,6 +9,7 @@ #include "xf86PciInfo.h" #include "generic_bus.h" +#include "theatre_reg.h" #define VIP_NAME "RADEON VIP BUS" #define VIP_TYPE "ATI VIP BUS" @@ -60,6 +61,28 @@ return (INREG(RADEON_VIPH_CONTROL) & 0x2000) ? VIP_BUSY : VIP_IDLE ; } +static CARD32 RADEONVIP_fifo_idle(GENERIC_BUS_Ptr b, CARD8 channel) +{ + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + CARD32 timeout; + + RADEONWaitForIdleMMIO(pScrn); + timeout = INREG(VIPH_TIMEOUT_STAT); + if((timeout & 0x0000000f) & channel) /* lockup ?? */ + { + xf86DrvMsg(b->scrnIndex, X_INFO, "RADEON_fifo_idle\n"); + RADEONWaitForFifo(pScrn, 2); + OUTREG(VIPH_TIMEOUT_STAT, (timeout & 0xfffffff0) | channel); + RADEONWaitForIdleMMIO(pScrn); + return (INREG(VIPH_CONTROL) & 0x2000) ? VIP_BUSY : VIP_RESET; + } + RADEONWaitForIdleMMIO(pScrn); + return (INREG(VIPH_CONTROL) & 0x2000) ? VIP_BUSY : VIP_IDLE ; +} + /* address format: ((device & 0x3)<<14) | (fifo << 12) | (addr) */ @@ -130,6 +153,80 @@ return TRUE; } +static Bool RADEONVIP_fifo_read(GENERIC_BUS_Ptr b, CARD32 address, CARD32 count, CARD8 *buffer) +{ + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + CARD32 status,tmp; + + if(count!=1) + { + xf86DrvMsg(pScrn->scrnIndex,X_ERROR,"Attempt to access VIP bus with non-stadard transaction length\n"); + return FALSE; + } + + RADEONWaitForFifo(pScrn, 2); + OUTREG(VIPH_REG_ADDR, address | 0x3000); + write_mem_barrier(); + while(VIP_BUSY == (status = RADEONVIP_fifo_idle(b, 0xff))); + if(VIP_IDLE != status) return FALSE; + +/* + disable VIPH_REGR_DIS to enable VIP cycle. + The LSB of VIPH_TIMEOUT_STAT are set to 0 + because 1 would have acknowledged various VIP + interrupts unexpectedly +*/ + + RADEONWaitForIdleMMIO(pScrn); + OUTREG(VIPH_TIMEOUT_STAT, INREG(VIPH_TIMEOUT_STAT) & (0xffffff00 & ~VIPH_TIMEOUT_STAT__VIPH_REGR_DIS) ); + write_mem_barrier(); + +/* + the value returned here is garbage. The read merely initiates + a register cycle +*/ + RADEONWaitForIdleMMIO(pScrn); + INREG(VIPH_REG_DATA); + + while(VIP_BUSY == (status = RADEONVIP_fifo_idle(b, 0xff))); + if(VIP_IDLE != status) return FALSE; + +/* + set VIPH_REGR_DIS so that the read won't take too long. +*/ + RADEONWaitForIdleMMIO(pScrn); + tmp=INREG(VIPH_TIMEOUT_STAT); + OUTREG(VIPH_TIMEOUT_STAT, (tmp & 0xffffff00) | VIPH_TIMEOUT_STAT__VIPH_REGR_DIS); + write_mem_barrier(); + + RADEONWaitForIdleMMIO(pScrn); + switch(count){ + case 1: + *buffer=(CARD8)(INREG(VIPH_REG_DATA) & 0xff); + break; + case 2: + *(CARD16 *)buffer=(CARD16) (INREG(VIPH_REG_DATA) & 0xffff); + break; + case 4: + *(CARD32 *)buffer=(CARD32) ( INREG(VIPH_REG_DATA) & 0xffffffff); + break; + } + while(VIP_BUSY == (status = RADEONVIP_fifo_idle(b, 0xff))); + if(VIP_IDLE != status) return FALSE; + + /* + so that reading VIPH_REG_DATA would not trigger unnecessary vip cycles. +*/ + OUTREG(VIPH_TIMEOUT_STAT, (INREG(VIPH_TIMEOUT_STAT) & 0xffffff00) | VIPH_TIMEOUT_STAT__VIPH_REGR_DIS); + write_mem_barrier(); + return TRUE; + + +} + + static Bool RADEONVIP_write(GENERIC_BUS_Ptr b, CARD32 address, CARD32 count, CARD8 *buffer) { ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; @@ -163,6 +260,43 @@ return TRUE; } +static Bool RADEONVIP_fifo_write(GENERIC_BUS_Ptr b, CARD32 address, CARD32 count, CARD8 *buffer) +{ + ScrnInfoPtr pScrn = xf86Screens[b->scrnIndex]; + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + + CARD32 status; + CARD32 i; + + RADEONWaitForFifo(pScrn, 2); + OUTREG(VIPH_REG_ADDR, (address & (~0x2000)) | 0x1000); + while(VIP_BUSY == (status = RADEONVIP_fifo_idle(b, 0x0f))); + + + if(VIP_IDLE != status){ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "cannot write %x to VIPH_REG_ADDR\n", (unsigned int)address); + return FALSE; + } + + RADEONWaitForFifo(pScrn, 2); + for (i = 0; i < count; i+=4) + { + OUTREG(VIPH_REG_DATA, *(CARD32*)(buffer + i)); + write_mem_barrier(); + while(VIP_BUSY == (status = RADEONVIP_fifo_idle(b, 0x0f))); + if(VIP_IDLE != status) + { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "cannot write to VIPH_REG_DATA\n"); + return FALSE; + } + + } + + return TRUE; + +} + void RADEONVIP_reset(ScrnInfoPtr pScrn, RADEONPortPrivPtr pPriv) { RADEONInfoPtr info = RADEONPTR(pScrn); @@ -171,7 +305,10 @@ RADEONWaitForIdleMMIO(pScrn); switch(info->ChipFamily){ - case CHIP_FAMILY_RV250: + case CHIP_FAMILY_RV250: + case CHIP_FAMILY_RV350: + case CHIP_FAMILY_R350: + case CHIP_FAMILY_R300: OUTREG(RADEON_VIPH_CONTROL, 0x003F0009); /* slowest, timeout in 16 phases */ OUTREG(RADEON_VIPH_TIMEOUT_STAT, (INREG(RADEON_VIPH_TIMEOUT_STAT) & 0xFFFFFF00) | RADEON_VIPH_TIMEOUT_STAT__VIPH_REGR_DIS); OUTREG(RADEON_VIPH_DV_LAT, 0x444400FF); /* set timeslice */ @@ -195,6 +332,8 @@ pPriv->VIP->ioctl=RADEONVIP_ioctl; pPriv->VIP->read=RADEONVIP_read; pPriv->VIP->write=RADEONVIP_write; - + pPriv->VIP->fifo_read=RADEONVIP_fifo_read; + pPriv->VIP->fifo_write=RADEONVIP_fifo_write; + RADEONVIP_reset(pScrn, pPriv); } Index: ati/theatre.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/theatre.c,v retrieving revision 1.3 diff -u -r1.3 theatre.c --- ati/theatre.c 3 Oct 2004 03:07:17 -0000 1.3 +++ ati/theatre.c 20 Mar 2005 15:58:37 -0000 @@ -24,6 +24,7 @@ #define VIP_TYPE "ATI VIP BUS" +#if 0 TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b) { TheatrePtr t; @@ -85,6 +86,7 @@ #endif return t; } +#endif enum { Index: ati/theatre.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/theatre.h,v retrieving revision 1.2 diff -u -r1.2 theatre.h --- ati/theatre.h 5 Oct 2004 01:16:01 -0000 1.2 +++ ati/theatre.h 20 Mar 2005 15:58:37 -0000 @@ -11,6 +11,8 @@ int theatre_num; CARD32 theatre_id; int mode; + char* microc_path; + char* microc_type; CARD16 video_decoder_type; CARD32 wStandard; @@ -33,8 +35,6 @@ } TheatreRec, * TheatrePtr; -TheatrePtr DetectTheatre(GENERIC_BUS_Ptr b); - /* DO NOT FORGET to setup constants before calling InitTheatre */ void InitTheatre(TheatrePtr t); @@ -54,11 +54,11 @@ void ShutdownTheatre(TheatrePtr t); void DumpRageTheatreRegs(TheatrePtr t); void ResetTheatreRegsForTVout(TheatrePtr t); +void ResetTheatreRegsForNoTVout(TheatrePtr t); #define TheatreSymbolsList \ "InitTheatre" \ - "DetectTheatre" \ "RT_SetTint", \ "RT_SetSaturation", \ "RT_SetBrightness", \ @@ -76,8 +76,6 @@ #ifdef XFree86LOADER -#define xf86_DetectTheatre ((TheatrePtr (*)(GENERIC_BUS_Ptr))LoaderSymbol("DetectTheatre")) - #define xf86_InitTheatre ((void (*)(TheatrePtr t))LoaderSymbol("InitTheatre")) #define xf86_RT_SetTint ((void (*)(TheatrePtr, int))LoaderSymbol("RT_SetTint")) @@ -95,10 +93,9 @@ #define xf86_DumpRageTheatreRegs ((void (*)(TheatrePtr))LoaderSymbol("DumpRageTheatreRegs")) #define xf86_ResetTheatreRegsForTVout ((void (*)(TheatrePtr))LoaderSymbol("ResetTheatreRegsForTVout")) #define xf86_ResetTheatreRegsForNoTVout ((void (*)(TheatrePtr))LoaderSymbol("ResetTheatreRegsForNoTVout")) +#define xf86_RT_GetSignalStatus ((void (*)(TheatrePtr))LoaderSymbol("xf86_RT_GetSignalStatus")) #else -#define xf86_DetectTheatre DetectTheatre - #define xf86_InitTheatre InitTheatre #define xf86_RT_SetTint RT_SetTint @@ -114,8 +111,6 @@ #define xf86_RageTheatreDebugGain RageTheatreDebugGain #define xf86_ShutdownTheatre ShutdownTheatre #define xf86_DumpRageTheatreRegs DumpRageTheatreRegs -#define xf86_ResetTheatreRegsForTVout ResetTheatreRegsForTVout -#define xf86_ResetTheatreRegsForNoTVout ResetTheatreRegsForNoTVout #endif Index: ati/theatre_reg.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/ati/theatre_reg.h,v retrieving revision 1.2 diff -u -r1.2 theatre_reg.h --- ati/theatre_reg.h 2 Oct 2004 20:55:42 -0000 1.2 +++ ati/theatre_reg.h 20 Mar 2005 15:58:39 -0000 @@ -2,6 +2,31 @@ #define __THEATRE_REGS_H__ +#define VIPH_CH0_DATA 0x0c00 +#define VIPH_CH1_DATA 0x0c04 +#define VIPH_CH2_DATA 0x0c08 +#define VIPH_CH3_DATA 0x0c0c +#define VIPH_CH0_ADDR 0x0c10 +#define VIPH_CH1_ADDR 0x0c14 +#define VIPH_CH2_ADDR 0x0c18 +#define VIPH_CH3_ADDR 0x0c1c +#define VIPH_CH0_SBCNT 0x0c20 +#define VIPH_CH1_SBCNT 0x0c24 +#define VIPH_CH2_SBCNT 0x0c28 +#define VIPH_CH3_SBCNT 0x0c2c +#define VIPH_CH0_ABCNT 0x0c30 +#define VIPH_CH1_ABCNT 0x0c34 +#define VIPH_CH2_ABCNT 0x0c38 +#define VIPH_CH3_ABCNT 0x0c3c +#define VIPH_CONTROL 0x0c40 +#define VIPH_DV_LAT 0x0c44 +#define VIPH_BM_CHUNK 0x0c48 +#define VIPH_DV_INT 0x0c4c +#define VIPH_TIMEOUT_STAT 0x0c50 + +#define VIPH_REG_DATA 0x0084 +#define VIPH_REG_ADDR 0x0080 + /* Address Space Rage Theatre Registers (VIP Access) */ #define VIP_VIP_VENDOR_DEVICE_ID 0x0000 #define VIP_VIP_SUB_VENDOR_DEVICE_ID 0x0004 @@ -13,10 +38,62 @@ #define VIP_I2C_CNTL_1 0x0024 #define VIP_I2C_DATA 0x0028 #define VIP_INT_CNTL 0x002c +/* RT200 */ +#define VIP_INT_CNTL__FB_INT0 0x02000000 +#define VIP_INT_CNTL__FB_INT0_CLR 0x02000000 #define VIP_GPIO_INOUT 0x0030 #define VIP_GPIO_CNTL 0x0034 #define VIP_CLKOUT_GPIO_CNTL 0x0038 #define VIP_RIPINTF_PORT_CNTL 0x003c + +/* RT200 */ +#define VIP_GPIO_INOUT 0x0030 +#define VIP_GPIO_CNTL 0x0034 +#define VIP_HOSTINTF_PORT_CNTL 0x003c +#define VIP_HOSTINTF_PORT_CNTL__HAD_HCTL_SDA_SN 0x00000008 +#define VIP_HOSTINTF_PORT_CNTL__HAD_HCTL_SDA_SP 0x00000080 +#define VIP_HOSTINTF_PORT_CNTL__HAD_HCTL_SDA_SR 0x00000100 +#define VIP_HOSTINTF_PORT_CNTL__SUB_SYS_ID_EN 0x00010000 +#define VIP_HOSTINTF_PORT_CNTL__FIFO_RW_MODE 0x00300000 +#define VIP_HOSTINTF_PORT_CNTL__FIFOA_ENDIAN_SWAP 0x00c00000 +#define VIP_HOSTINTF_PORT_CNTL__FIFOB_ENDIAN_SWAP 0x03000000 +#define VIP_HOSTINTF_PORT_CNTL__FIFOC_ENDIAN_SWAP 0x0c000000 +#define VIP_HOSTINTF_PORT_CNTL__FIFOD_ENDIAN_SWAP 0x30000000 +#define VIP_HOSTINTF_PORT_CNTL__FIFOE_ENDIAN_SWAP 0xc0000000 + +/* RT200 */ +#define VIP_DSP_PLL_CNTL 0x0bc + +/* RT200 */ +#define VIP_TC_SOURCE 0x300 +#define VIP_TC_DESTINATION 0x304 +#define VIP_TC_COMMAND 0x308 + +/* RT200 */ +#define VIP_TC_STATUS 0x030c +#define VIP_TC_STATUS__TC_CHAN_BUSY 0x00007fff +#define VIP_TC_STATUS__TC_WRITE_PENDING 0x00008000 +#define VIP_TC_STATUS__TC_FIFO_4_EMPTY 0x00040000 +#define VIP_TC_STATUS__TC_FIFO_6_EMPTY 0x00080000 +#define VIP_TC_STATUS__TC_FIFO_8_EMPTY 0x00100000 +#define VIP_TC_STATUS__TC_FIFO_10_EMPTY 0x00200000 +#define VIP_TC_STATUS__TC_FIFO_4_FULL 0x04000000 +#define VIP_TC_STATUS__TC_FIFO_6_FULL 0x08080000 +#define VIP_TC_STATUS__TC_FIFO_8_FULL 0x10080000 +#define VIP_TC_STATUS__TC_FIFO_10_FULL 0x20080000 +#define VIP_TC_STATUS__DSP_ILLEGAL_OP 0x80080000 + +/* RT200 */ +#define VIP_TC_DOWNLOAD 0x0310 +#define VIP_TC_DOWNLOAD__TC_DONE_MASK 0x00003fff +#define VIP_TC_DOWNLOAD__TC_RESET_MODE 0x00060000 + +/* RT200 */ +#define VIP_FB_INT 0x0314 +#define VIP_FB_INT__INT_7 0x00000080 +#define VIP_FB_SCRATCH0 0x0318 +#define VIP_FB_SCRATCH1 0x031c + #define VIP_ADC_CNTL 0x0400 #define VIP_ADC_DEBUG 0x0404 #define VIP_STANDARD_SELECT 0x0408 @@ -194,8 +271,27 @@ #define VIP_SPDIF_TX_CNT_REG 0x0820 #define VIP_IIS_TX_CNT_REG 0x0824 +/* Status defines */ +#define VIP_BUSY 0 +#define VIP_IDLE 1 +#define VIP_RESET 2 + +#define VIPH_TIMEOUT_STAT__VIPH_FIFO0_STAT 0x00000001 +#define VIPH_TIMEOUT_STAT__VIPH_FIFO0_AK 0x00000001 +#define VIPH_TIMEOUT_STAT__VIPH_FIFO1_STAT 0x00000002 +#define VIPH_TIMEOUT_STAT__VIPH_FIFO1_AK 0x00000002 +#define VIPH_TIMEOUT_STAT__VIPH_FIFO2_STAT 0x00000004 +#define VIPH_TIMEOUT_STAT__VIPH_FIFO2_AK 0x00000004 +#define VIPH_TIMEOUT_STAT__VIPH_FIFO3_STAT 0x00000008 +#define VIPH_TIMEOUT_STAT__VIPH_FIFO3_AK 0x00000008 + +#define VIPH_TIMEOUT_STAT__VIPH_REG_STAT 0x00000010 +#define VIPH_TIMEOUT_STAT__VIPH_REG_AK 0x00000010 +#define VIPH_TIMEOUT_STAT__VIPH_REGR_DIS 0x01000000 +#define TEST_DEBUG_CNTL__TEST_DEBUG_OUT_EN 0x00000001 + #define RT100_ATI_ID 0x4D541002 -#define RT200_ATI_ID 0x4f4a1002 +#define RT200_ATI_ID 0x4d4a1002 /* Register/Field values: */ #define RT_COMP0 0x0 @@ -225,6 +321,20 @@ /* these are used in MSP3430 */ #define extPAL_DK1 0x0C00 #define extPAL_AUTO 0x0D00 + /* these are used in RT200. Some are defined above */ +#define extPAL_B 0x0E00 +#define extPAL_D 0x0F00 +#define extPAL_G 0x1000 +#define extPAL_H 0x1100 +#define extPAL_I 0x1200 +#define extSECAM_B 0x1300 +#define extSECAM_D 0x1400 +#define extSECAM_G 0x1500 +#define extSECAM_H 0x1600 +#define extSECAM_K 0x1700 +#define extSECAM_K1 0x1800 +#define extSECAM_L 0x1900 +#define extSECAM_L1 0x1A00 #define RT_FREF_2700 6 #define RT_FREF_2950 5 Index: i2c/Imakefile =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/i2c/Imakefile,v retrieving revision 1.2 diff -u -r1.2 Imakefile --- i2c/Imakefile 7 Mar 2005 19:27:22 -0000 1.2 +++ i2c/Imakefile 20 Mar 2005 15:58:50 -0000 @@ -11,6 +11,7 @@ MODSRC_TDA9850 = tda9850_module.c MODSRC_TDA8425 = tda8425_module.c MODSRC_TDA9885 = tda9885_module.c +MODSRC_UDA1380 = uda1380_module.c MODOBJ_FI1236 = fi1236_module.o MODOBJ_MSP3430 = msp3430_module.o @@ -18,6 +19,7 @@ MODOBJ_TDA9850 = tda9850_module.o MODOBJ_TDA8425 = tda8425_module.o MODOBJ_TDA9885 = tda9885_module.o +MODOBJ_UDA1380 = uda1380_module.o #endif @@ -29,6 +31,7 @@ SRCS_TDA9850 = tda9850.c $(MODSRC_TDA9850) SRCS_TDA8425 = tda8425.c $(MODSRC_TDA8425) SRCS_TDA9885 = tda9885.c $(MODSRC_TDA9885) +SRCS_UDA1380 = uda1380.c $(MODSRC_UDA1380) OBJS_FI1236 = fi1236.o $(MODOBJ_FI1236) OBJS_MSP3430 = msp3430.o $(MODOBJ_MSP3430) @@ -36,12 +39,15 @@ OBJS_TDA9850 = tda9850.o $(MODOBJ_TDA9850) OBJS_TDA8425 = tda8425.o $(MODOBJ_TDA8425) OBJS_TDA9885 = tda9885.o $(MODOBJ_TDA9885) +OBJS_UDA1380 = uda1380.o $(MODOBJ_UDA1380) SRCS = $(SRCS_FI1236) $(SRCS_MSP3430) $(SRCS_BT829) \ - $(SRCS_TDA9850) $(SRCS_TDA8425) $(SRCS_TDA9885) + $(SRCS_TDA9850) $(SRCS_TDA8425) $(SRCS_TDA9885) \ + $(SRCS_UDA1380) OBJS = $(OBJS_FI1236) $(OBJS_MSP3430) $(OBJS_BT829) \ - $(OBJS_TDA9850) $(OBJS_TDA8425) $(OBJS_TDA9885) + $(OBJS_TDA9850) $(OBJS_TDA8425) $(OBJS_TDA9885) \ + $(OBJS_UDA1380) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -63,6 +69,7 @@ ObjectModuleTarget(tda9850, $(OBJS_TDA9850)) ObjectModuleTarget(tda8425, $(OBJS_TDA8425)) ObjectModuleTarget(tda9885, $(OBJS_TDA9885)) +ObjectModuleTarget(uda1380, $(OBJS_UDA1380)) InstallMultimediaObjectModule(fi1236,$(MODULEDIR)) InstallMultimediaObjectModule(msp3430,$(MODULEDIR)) @@ -70,6 +77,7 @@ InstallMultimediaObjectModule(tda9850,$(MODULEDIR)) InstallMultimediaObjectModule(tda8425,$(MODULEDIR)) InstallMultimediaObjectModule(tda9885,$(MODULEDIR)) +InstallMultimediaObjectModule(uda1380,$(MODULEDIR)) DependTarget() @@ -97,3 +105,7 @@ InstallDriverSDKNonExecFile(tda9885_module.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(tda9885.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(uda1380.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(uda1380_module.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(uda1380.h,$(DRIVERSDKDIR)/drivers/ati) + Index: i2c/fi1236.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/i2c/fi1236.c,v retrieving revision 1.3 diff -u -r1.3 fi1236.c --- i2c/fi1236.c 3 Oct 2004 15:01:31 -0000 1.3 +++ i2c/fi1236.c 20 Mar 2005 15:58:50 -0000 @@ -1,9 +1,10 @@ #include "xf86.h" #include "xf86i2c.h" #include "fi1236.h" +#include "tda9885.h" #include "i2c_def.h" -#define NUM_TUNERS 7 +#define NUM_TUNERS 8 const FI1236_parameters tuner_parms[NUM_TUNERS] = { @@ -23,7 +24,9 @@ /* 5 - FI1256 */ { 623 ,16*49.75 ,16*863.25 ,16*170 ,16*450 ,0xA0 ,0x90, 0x30, 0x8e }, /* 6 - FI1236W */ - { 733 ,884 ,12820 ,2516 ,7220 ,0x1 ,0x2, 0x4, 0x8e } + { 733 ,884 ,12820 ,2516 ,7220 ,0x1 ,0x2, 0x4, 0x8e }, + /* 7 - FM1216ME */ + { 623 ,16*48.25 ,16*863.25 ,16*158.00 ,16*442.00 ,0x1 ,0x2, 0x4, 0x8e } }; @@ -329,16 +332,35 @@ static int FI1236_get_afc_hint(FI1236Ptr f) { -CARD8 out; -CARD8 AFC; -I2C_WriteRead(&(f->d), NULL, 0, &out, 1); -AFC=out & 0x7; -if(AFC==2)return TUNER_TUNED; -if(AFC==3)return TUNER_JUST_BELOW; -if(AFC==1)return TUNER_JUST_ABOVE; -return TUNER_OFF; -} + CARD8 out; + CARD8 AFC; + if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) + { + TDA9885Ptr t = (TDA9885Ptr)f->afc_source; + if (t == NULL) + return TUNER_OFF; + tda9885_getstatus(t); + tda9885_dumpstatus(t); + AFC = t->afc_status & 0x0f; + + xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC); + if (AFC == 0) return TUNER_TUNED; + else if (AFC <= 0x07)return TUNER_JUST_BELOW; + else if (AFC < 0x0f )return TUNER_JUST_ABOVE; + else if (AFC == 0x0f)return TUNER_TUNED; + } + else + { + I2C_WriteRead(&(f->d), NULL, 0, &out, 1); + AFC=out & 0x7; + xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: FI1236_get_afc_hint: %i\n", AFC); + if(AFC==2)return TUNER_TUNED; + if(AFC==3)return TUNER_JUST_BELOW; + if(AFC==1)return TUNER_JUST_ABOVE; + return TUNER_OFF; + } +} static int MT2032_get_afc_hint(FI1236Ptr f) { @@ -457,6 +479,7 @@ void FI1236_tune(FI1236Ptr f, CARD32 frequency) { CARD16 divider; + CARD8 data; if(frequency < f->parm.min_freq) frequency = f->parm.min_freq; if(frequency > f->parm.max_freq) frequency = f->parm.max_freq; @@ -479,10 +502,20 @@ f->tuner_data.band = f->parm.band_high; } -#if 0 + xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner band to %d\n", f->tuner_data.band); + xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Setting tuner frequency to %d\n", frequency); -#endif - I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0); + + if ((f->type == TUNER_TYPE_FM1216ME) || (f->type == TUNER_TYPE_FI1236W)) + { + f->tuner_data.aux = 0x20; + I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 5, NULL, 0); + I2C_WriteRead(&(f->d), NULL, 0, &data, 1); + xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "Tuner status %x\n", data); + + } + else + I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0); } void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency) @@ -537,7 +570,11 @@ } else { f->last_afc_hint=FI1236_get_afc_hint(f); - if(f->last_afc_hint==TUNER_TUNED)return 0; + if(f->last_afc_hint==TUNER_TUNED) + { + xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: TUNER_TUNNED\n"); + return 0; + } if(f->afc_count>3)f->last_afc_hint=TUNER_OFF; if(f->last_afc_hint==TUNER_OFF) { Index: i2c/fi1236.h =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/i2c/fi1236.h,v retrieving revision 1.2 diff -u -r1.2 fi1236.h --- i2c/fi1236.h 13 Oct 2004 23:02:42 -0000 1.2 +++ i2c/fi1236.h 20 Mar 2005 15:58:50 -0000 @@ -44,6 +44,8 @@ typedef struct { I2CDevRec d; int type; + + void* afc_source; /* The AFC source may be another chip like TDA988x */ int afc_delta; CARD32 original_frequency; @@ -60,6 +62,7 @@ CARD8 div2; CARD8 control; CARD8 band; + CARD8 aux; /* this is for MK3 tuners */ } tuner_data; } FI1236Rec, *FI1236Ptr; @@ -70,6 +73,7 @@ #define TUNER_TYPE_FI1246 4 #define TUNER_TYPE_FI1256 5 #define TUNER_TYPE_FI1236W 6 +#define TUNER_TYPE_FM1216ME 7 #define FI1236_ADDR(a) ((a)->d.SlaveAddr) Index: i2c/tda9885.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/i2c/tda9885.c,v retrieving revision 1.1 diff -u -r1.1 tda9885.c --- i2c/tda9885.c 30 Sep 2004 22:58:07 -0000 1.1 +++ i2c/tda9885.c 20 Mar 2005 15:58:50 -0000 @@ -87,6 +87,8 @@ ((t->vif_agc & 0x01)<<7); /* E data */ I2C_WriteRead(&(t->d), data, 4, NULL, 0); + +xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"TDA9885 setparam: B data: %x, C data: %x, E data: %x\n", data[1], data[2], data[3]); } void tda9885_dumpstatus(TDA9885Ptr t)