Exemplo n.º 1
0
static void tve_set_mode (int mode)
{
//	printf("%s mode %d\n", __FUNCTION__, mode);
	
	tve_writel(TV_RESET, v_RESET(1));
	udelay(100);
	tve_writel(TV_RESET, v_RESET(0));

	if (tve_s.soctype == SOC_RK3036)
		tve_writel(TV_CTRL, v_CVBS_MODE(mode) | v_CLK_UPSTREAM_EN(2) |
			   v_TIMING_EN(2) | v_LUMA_FILTER_GAIN(0) |
			   v_LUMA_FILTER_UPSAMPLE(1) | v_CSC_PATH(0));
	else
		tve_writel(TV_CTRL, v_CVBS_MODE(mode) | v_CLK_UPSTREAM_EN(2) |
			   v_TIMING_EN(2) | v_LUMA_FILTER_GAIN(0) |
			   v_LUMA_FILTER_UPSAMPLE(1) | v_CSC_PATH(3));
	tve_writel(TV_LUMA_FILTER0, 0x02ff0000);
	tve_writel(TV_LUMA_FILTER1, 0xF40202fd);
	tve_writel(TV_LUMA_FILTER2, 0xF332d919);
	
	if(mode == TVOUT_CVBS_NTSC) {
		tve_writel(TV_ROUTING, v_DAC_SENSE_EN(0) | v_Y_IRE_7_5(1) | 
			v_Y_AGC_PULSE_ON(1) | v_Y_VIDEO_ON(1) | 
			v_Y_SYNC_ON(1) | v_PIC_MODE(mode));
		tve_writel(TV_BW_CTRL, v_CHROMA_BW(BP_FILTER_NTSC) | v_COLOR_DIFF_BW(COLOR_DIFF_FILTER_BW_1_3));
		tve_writel(TV_SATURATION, 0x0052543C);
		if(tve_s.test_mode)
		tve_writel(TV_BRIGHTNESS_CONTRAST, 0x00008300);
		else
		tve_writel(TV_BRIGHTNESS_CONTRAST, 0x00007900);
		
		tve_writel(TV_FREQ_SC,	0x21F07BD7);
		tve_writel(TV_SYNC_TIMING, 0x00C07a81);
		tve_writel(TV_ADJ_TIMING, 0x96B40000);
		tve_writel(TV_ACT_ST,	0x001500D6);
		tve_writel(TV_ACT_TIMING, 0x169800FC);

	} else if (mode == TVOUT_CVBS_PAL) {
		tve_writel(TV_ROUTING, v_DAC_SENSE_EN(0) | v_Y_IRE_7_5(0) |
			v_Y_AGC_PULSE_ON(0) | v_Y_VIDEO_ON(1) |
			v_YPP_MODE(1) | v_Y_SYNC_ON(1) | v_PIC_MODE(mode));
		tve_writel(TV_BW_CTRL, v_CHROMA_BW(BP_FILTER_PAL) |
			v_COLOR_DIFF_BW(COLOR_DIFF_FILTER_BW_1_3));
		if (tve_s.soctype == SOC_RK312X) {
			if(tve_s.saturation != 0)
			tve_writel(TV_SATURATION, tve_s.saturation);
			else
			tve_writel(TV_SATURATION, /*0x00325c40*/ 0x002b4d3c);
			if(tve_s.test_mode)
			tve_writel(TV_BRIGHTNESS_CONTRAST, 0x00008a0a);
			else
			tve_writel(TV_BRIGHTNESS_CONTRAST, 0x0000800a);
		} else {
			tve_writel(TV_SATURATION, /*0x00325c40*/ 0x00386346);
			tve_writel(TV_BRIGHTNESS_CONTRAST, 0x00008b00);
		}

		tve_writel(TV_FREQ_SC,	0x2A098ACB);
		tve_writel(TV_SYNC_TIMING, 0x00C28381);
		tve_writel(TV_ADJ_TIMING, (0xc << 28) | 0x06c00800 | 0x80);
		tve_writel(TV_ACT_ST,	0x001500F6);
		tve_writel(TV_ACT_TIMING, 0x0694011D | (1 << 12) | (2 << 28));
		if (tve_s.soctype == SOC_RK312X) {
			tve_writel(TV_ADJ_TIMING, (0xa << 28) | 0x06c00800 | 0x80);
			udelay(100);
			tve_writel(TV_ADJ_TIMING, (0xa << 28) | 0x06c00800 | 0x80);
			tve_writel(TV_ACT_TIMING, 0x0694011D | (1 << 12) | (2 << 28));
		} else {
			tve_writel(TV_ADJ_TIMING, (0xa << 28) | 0x06c00800 | 0x80);
		}
	}
}
static void tve_set_mode(int mode)
{
	TVEDBG("%s mode %d\n", __func__, mode);
	if (cvbsformat >= 0)
		return;
	tve_writel(TV_RESET, v_RESET(1));
	usleep_range(100, 100);
	tve_writel(TV_RESET, v_RESET(0));
	if (rk3036_tve->inputformat == INPUT_FORMAT_RGB)
		tve_writel(TV_CTRL, v_CVBS_MODE(mode) | v_CLK_UPSTREAM_EN(2) |
			   v_TIMING_EN(2) | v_LUMA_FILTER_GAIN(0) |
			   v_LUMA_FILTER_UPSAMPLE(1) | v_CSC_PATH(0));
	else
		tve_writel(TV_CTRL, v_CVBS_MODE(mode) | v_CLK_UPSTREAM_EN(2) |
			   v_TIMING_EN(2) | v_LUMA_FILTER_GAIN(0) |
			   v_LUMA_FILTER_UPSAMPLE(1) | v_CSC_PATH(3));

	tve_writel(TV_LUMA_FILTER0, 0x02ff0000);
	tve_writel(TV_LUMA_FILTER1, 0xF40202fd);
	tve_writel(TV_LUMA_FILTER2, 0xF332d919);

	if (mode == TVOUT_CVBS_NTSC) {
		tve_writel(TV_ROUTING, v_DAC_SENSE_EN(0) | v_Y_IRE_7_5(1) |
			v_Y_AGC_PULSE_ON(0) | v_Y_VIDEO_ON(1) |
			v_YPP_MODE(1) | v_Y_SYNC_ON(1) | v_PIC_MODE(mode));
		tve_writel(TV_BW_CTRL, v_CHROMA_BW(BP_FILTER_NTSC) |
			v_COLOR_DIFF_BW(COLOR_DIFF_FILTER_BW_1_3));
		tve_writel(TV_SATURATION, 0x0042543C);
		tve_writel(TV_BRIGHTNESS_CONTRAST, 0x00008300);

		tve_writel(TV_FREQ_SC,	0x21F07BD7);
		tve_writel(TV_SYNC_TIMING, 0x00C07a81);
		tve_writel(TV_ADJ_TIMING, 0x96B40000 | 0x70);
		tve_writel(TV_ACT_ST,	0x001500D6);
		tve_writel(TV_ACT_TIMING, 0x069800FC | (1 << 12) | (1 << 28));

	} else if (mode == TVOUT_CVBS_PAL) {
		tve_writel(TV_ROUTING, v_DAC_SENSE_EN(0) | v_Y_IRE_7_5(0) |
			v_Y_AGC_PULSE_ON(0) | v_Y_VIDEO_ON(1) |
			v_YPP_MODE(1) | v_Y_SYNC_ON(1) | v_PIC_MODE(mode));
		tve_writel(TV_BW_CTRL, v_CHROMA_BW(BP_FILTER_PAL) |
			v_COLOR_DIFF_BW(COLOR_DIFF_FILTER_BW_1_3));
		if (rk3036_tve->soctype == SOC_RK312X) {
			tve_writel(TV_SATURATION, /*0x00325c40*/ 0x002b4d3c);
			tve_writel(TV_BRIGHTNESS_CONTRAST, 0x00008a0a);
		} else {
			tve_writel(TV_SATURATION, /*0x00325c40*/ 0x00386346);
			tve_writel(TV_BRIGHTNESS_CONTRAST, 0x00008b00);
		}

		tve_writel(TV_FREQ_SC,	0x2A098ACB);
		tve_writel(TV_SYNC_TIMING, 0x00C28381);
		tve_writel(TV_ADJ_TIMING, (0xc << 28) | 0x06c00800 | 0x80);
		tve_writel(TV_ACT_ST,	0x001500F6);
		tve_writel(TV_ACT_TIMING, 0x0694011D | (1 << 12) | (2 << 28));
		if (rk3036_tve->soctype == SOC_RK312X) {
			tve_writel(TV_ADJ_TIMING, (0xa << 28) |
					0x06c00800 | 0x80);
			usleep_range(100, 100);
			tve_writel(TV_ADJ_TIMING, (0xa << 28) |
					0x06c00800 | 0x80);
			tve_writel(TV_ACT_TIMING, 0x0694011D |
					(1 << 12) | (2 << 28));
		} else {
			tve_writel(TV_ADJ_TIMING, (0xa << 28) |
					0x06c00800 | 0x80);
		}
	}
}