/* * linux/drivers/video/jz4750_tve.c -- Ingenic Jz4750 TVE Controller operation * interface. * Copyright (C) 2005-2008, Ingenic Semiconductor Inc. * Author: Wolfgang Wang, * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include "jz4750_tve.h" struct jz4750tve_info jz4750_tve_info_PAL = { .ctrl = (4 << TVE_CTRL_YCDLY_BIT) | TVE_CTRL_SYNCT | TVE_CTRL_PAL | TVE_CTRL_SWRST, /* PAL, SVIDEO */ .frcfg = (23 << TVE_FRCFG_L1ST_BIT) | (625 << TVE_FRCFG_NLINE_BIT), .slcfg1 = (800<ctrl = (jz4750_tve_info->ctrl | TVE_CTRL_DAPD) & ( ~( TVE_CTRL_DAPD1 | TVE_CTRL_DAPD2)); jz4750_tve_info->ctrl &= ~TVE_CTRL_SWRST; REG_TVE_CTRL = jz4750_tve_info->ctrl; } /* turn off TVE, turn off DACn... */ void jz4750tve_disable_tve(void) { jz4750_tve_info->ctrl &= ~TVE_CTRL_DAPD;/* DACn disabled??? */ jz4750_tve_info->ctrl |= TVE_CTRL_SWRST;/* DACn disabled??? */ REG_TVE_CTRL = jz4750_tve_info->ctrl; } void jz4750tve_set_tve_mode(struct jz4750tve_info *tve) { REG_TVE_CTRL = tve->ctrl; REG_TVE_FRCFG = tve->frcfg; REG_TVE_SLCFG1 = tve->slcfg1; REG_TVE_SLCFG2 = tve->slcfg2; REG_TVE_SLCFG3 = tve->slcfg3; REG_TVE_LTCFG1 = tve->ltcfg1; REG_TVE_LTCFG2 = tve->ltcfg2; REG_TVE_CFREQ = tve->cfreq; REG_TVE_CPHASE = tve->cphase; REG_TVE_CBCRCFG = tve->cbcrcfg; REG_TVE_WSSCR = tve->wsscr; REG_TVE_WSSCFG1 = tve->wsscfg1; REG_TVE_WSSCFG2 = tve->wsscfg2; REG_TVE_WSSCFG3 = tve->wsscfg3; } void jz4750tve_init( int tve_mode ) { switch ( tve_mode ) { case PANEL_MODE_TVE_PAL: jz4750_tve_info = &jz4750_tve_info_PAL; break; case PANEL_MODE_TVE_NTSC: jz4750_tve_info = &jz4750_tve_info_NTSC; break; } jz4750tve_set_tve_mode( jz4750_tve_info ); // jz4750tve_enable_tve(); } void jz4750tve_outfmt_init(unsigned int outfmt) { switch (outfmt) { #ifdef CONFIG_SOC_JZ4750D case PANEL_OUT_FMT_YCBCR: jz4750_tve_info_PAL.ctrl |= TVE_CTRL_EYCBCR; break; #endif case PANEL_OUT_FMT_CVBS: #ifdef CONFIG_SOC_JZ4750D /* Disable YCbCr */ jz4750_tve_info_PAL.ctrl &= ~TVE_CTRL_EYCBCR; #endif jz4750_tve_info_PAL.ctrl |= TVE_CTRL_ECVBS; break; case PANEL_OUT_FMT_SVIDEO: default: #ifdef CONFIG_SOC_JZ4750D /* Disable YCbCr */ jz4750_tve_info_PAL.ctrl &= ~TVE_CTRL_EYCBCR; #endif jz4750_tve_info_PAL.ctrl &= ~TVE_CTRL_ECVBS; break; } } #if 0 void jz4750tve_mode_init(struct jz4750tve_mode * tve_mode) { switch (tve_mode->out_fmt) { case PANEL_OUT_FMT_YCBCR: jz4750_tve_info_PAL.ctrl |= TVE_CTRL_EYCBCR; break; case PANEL_OUT_FMT_CVBS: #ifdef CONFIG_SOC_JZ4750D /* Disable YCbCr */ jz4750_tve_info_PAL.ctrl &= ~TVE_CTRL_EYCBCR; #endif jz4750_tve_info_PAL.ctrl |= TVE_CTRL_ECVBS; break; case PANEL_OUT_FMT_SVIDEO: default: #ifdef CONFIG_SOC_JZ4750D /* Disable YCbCr */ jz4750_tve_info_PAL.ctrl &= ~TVE_CTRL_EYCBCR; #endif jz4750_tve_info_PAL.ctrl &= ~TVE_CTRL_ECVBS; break; } switch (tve_mode->mode) { case PANEL_MODE_TVE_PAL: jz4750_tve_info = &jz4750_tve_info_PAL; break; case PANEL_MODE_TVE_NTSC: jz4750_tve_info = &jz4750_tve_info_NTSC; break; } jz4750tve_set_tve_mode( jz4750_tve_info ); // jz4750tve_enable_tve(); } #endif