171d7fec4Smrg/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nsc/gfx/tv_fs450.h,v 1.1 2002/12/10 15:12:27 alanh Exp $ */ 271d7fec4Smrg/* 371d7fec4Smrg * $Workfile: tv_fs450.h $ 471d7fec4Smrg * 571d7fec4Smrg * This file defines the common FS450 API. 671d7fec4Smrg * 771d7fec4Smrg * NSC_LIC_ALTERNATIVE_PREAMBLE 871d7fec4Smrg * 971d7fec4Smrg * Revision 1.0 1071d7fec4Smrg * 1171d7fec4Smrg * National Semiconductor Alternative GPL-BSD License 1271d7fec4Smrg * 1371d7fec4Smrg * National Semiconductor Corporation licenses this software 1471d7fec4Smrg * ("Software"): 1571d7fec4Smrg * 1671d7fec4Smrg * Durango 1771d7fec4Smrg * 1871d7fec4Smrg * under one of the two following licenses, depending on how the 1971d7fec4Smrg * Software is received by the Licensee. 2071d7fec4Smrg * 2171d7fec4Smrg * If this Software is received as part of the Linux Framebuffer or 2271d7fec4Smrg * other GPL licensed software, then the GPL license designated 2371d7fec4Smrg * NSC_LIC_GPL applies to this Software; in all other circumstances 2471d7fec4Smrg * then the BSD-style license designated NSC_LIC_BSD shall apply. 2571d7fec4Smrg * 2671d7fec4Smrg * END_NSC_LIC_ALTERNATIVE_PREAMBLE */ 2771d7fec4Smrg 2871d7fec4Smrg/* NSC_LIC_BSD 2971d7fec4Smrg * 3071d7fec4Smrg * National Semiconductor Corporation Open Source License for Durango 3171d7fec4Smrg * 3271d7fec4Smrg * (BSD License with Export Notice) 3371d7fec4Smrg * 3471d7fec4Smrg * Copyright (c) 1999-2001 3571d7fec4Smrg * National Semiconductor Corporation. 3671d7fec4Smrg * All rights reserved. 3771d7fec4Smrg * 3871d7fec4Smrg * Redistribution and use in source and binary forms, with or without 3971d7fec4Smrg * modification, are permitted provided that the following conditions 4071d7fec4Smrg * are met: 4171d7fec4Smrg * 4271d7fec4Smrg * * Redistributions of source code must retain the above copyright 4371d7fec4Smrg * notice, this list of conditions and the following disclaimer. 4471d7fec4Smrg * 4571d7fec4Smrg * * Redistributions in binary form must reproduce the above 4671d7fec4Smrg * copyright notice, this list of conditions and the following 4771d7fec4Smrg * disclaimer in the documentation and/or other materials provided 4871d7fec4Smrg * with the distribution. 4971d7fec4Smrg * 5071d7fec4Smrg * * Neither the name of the National Semiconductor Corporation nor 5171d7fec4Smrg * the names of its contributors may be used to endorse or promote 5271d7fec4Smrg * products derived from this software without specific prior 5371d7fec4Smrg * written permission. 5471d7fec4Smrg * 5571d7fec4Smrg * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 5671d7fec4Smrg * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 5771d7fec4Smrg * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 5871d7fec4Smrg * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 5971d7fec4Smrg * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 6071d7fec4Smrg * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 6171d7fec4Smrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 6271d7fec4Smrg * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 6371d7fec4Smrg * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 6471d7fec4Smrg * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 6571d7fec4Smrg * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 6671d7fec4Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 6771d7fec4Smrg * OF SUCH DAMAGE. 6871d7fec4Smrg * 6971d7fec4Smrg * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 7071d7fec4Smrg * YOUR JURISDICTION. It is licensee's responsibility to comply with 7171d7fec4Smrg * any export regulations applicable in licensee's jurisdiction. Under 7271d7fec4Smrg * CURRENT (2001) U.S. export regulations this software 7371d7fec4Smrg * is eligible for export from the U.S. and can be downloaded by or 7471d7fec4Smrg * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 7571d7fec4Smrg * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 7671d7fec4Smrg * Syria, Sudan, Afghanistan and any other country to which the U.S. 7771d7fec4Smrg * has embargoed goods and services. 7871d7fec4Smrg * 7971d7fec4Smrg * END_NSC_LIC_BSD */ 8071d7fec4Smrg 8171d7fec4Smrg/* NSC_LIC_GPL 8271d7fec4Smrg * 8371d7fec4Smrg * National Semiconductor Corporation Gnu General Public License for Durango 8471d7fec4Smrg * 8571d7fec4Smrg * (GPL License with Export Notice) 8671d7fec4Smrg * 8771d7fec4Smrg * Copyright (c) 1999-2001 8871d7fec4Smrg * National Semiconductor Corporation. 8971d7fec4Smrg * All rights reserved. 9071d7fec4Smrg * 9171d7fec4Smrg * Redistribution and use in source and binary forms, with or without 9271d7fec4Smrg * modification, are permitted under the terms of the GNU General 9371d7fec4Smrg * Public License as published by the Free Software Foundation; either 9471d7fec4Smrg * version 2 of the License, or (at your option) any later version 9571d7fec4Smrg * 9671d7fec4Smrg * In addition to the terms of the GNU General Public License, neither 9771d7fec4Smrg * the name of the National Semiconductor Corporation nor the names of 9871d7fec4Smrg * its contributors may be used to endorse or promote products derived 9971d7fec4Smrg * from this software without specific prior written permission. 10071d7fec4Smrg * 10171d7fec4Smrg * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 10271d7fec4Smrg * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 10371d7fec4Smrg * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 10471d7fec4Smrg * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 10571d7fec4Smrg * NATIONAL SEMICONDUCTOR CORPORATION OR CONTRIBUTORS BE LIABLE FOR ANY 10671d7fec4Smrg * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 10771d7fec4Smrg * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 10871d7fec4Smrg * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 10971d7fec4Smrg * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 11071d7fec4Smrg * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE, 11171d7fec4Smrg * INTELLECTUAL PROPERTY INFRINGEMENT, OR OTHERWISE) ARISING IN ANY WAY 11271d7fec4Smrg * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 11371d7fec4Smrg * OF SUCH DAMAGE. See the GNU General Public License for more details. 11471d7fec4Smrg * 11571d7fec4Smrg * EXPORT LAWS: THIS LICENSE ADDS NO RESTRICTIONS TO THE EXPORT LAWS OF 11671d7fec4Smrg * YOUR JURISDICTION. It is licensee's responsibility to comply with 11771d7fec4Smrg * any export regulations applicable in licensee's jurisdiction. Under 11871d7fec4Smrg * CURRENT (2001) U.S. export regulations this software 11971d7fec4Smrg * is eligible for export from the U.S. and can be downloaded by or 12071d7fec4Smrg * otherwise exported or reexported worldwide EXCEPT to U.S. embargoed 12171d7fec4Smrg * destinations which include Cuba, Iraq, Libya, North Korea, Iran, 12271d7fec4Smrg * Syria, Sudan, Afghanistan and any other country to which the U.S. 12371d7fec4Smrg * has embargoed goods and services. 12471d7fec4Smrg * 12571d7fec4Smrg * You should have received a copy of the GNU General Public License 12671d7fec4Smrg * along with this file; if not, write to the Free Software Foundation, 12771d7fec4Smrg * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 12871d7fec4Smrg * 12971d7fec4Smrg * END_NSC_LIC_GPL */ 13071d7fec4Smrg 13171d7fec4Smrg#ifndef __FS450_H__ 13271d7fec4Smrg#define __FS450_H__ 13371d7fec4Smrg 13471d7fec4Smrg#ifdef __cplusplus 13571d7fec4Smrgextern "C" 13671d7fec4Smrg{ 13771d7fec4Smrg#endif 13871d7fec4Smrg 13971d7fec4Smrg/* ==========================================================================*/ 14071d7fec4Smrg/* Init and cleanup functions*/ 14171d7fec4Smrg 14271d7fec4Smrg int FS450_init(void); 14371d7fec4Smrg void FS450_cleanup(void); 14471d7fec4Smrg /* call FS450_init at startup to probe for and initialize FS450. */ 14571d7fec4Smrg /* returns 0 if successful. */ 14671d7fec4Smrg 14771d7fec4Smrg/* ==========================================================================*/ 14871d7fec4Smrg/* TV output on or off*/ 14971d7fec4Smrg 15071d7fec4Smrg int FS450_get_tv_enable(unsigned int *p_on); 15171d7fec4Smrg int FS450_set_tv_enable(unsigned int on); 15271d7fec4Smrg /* on is 1 for TV on, 0 for off */ 15371d7fec4Smrg 15471d7fec4Smrg/* ==========================================================================*/ 15571d7fec4Smrg/* TV standard*/ 15671d7fec4Smrg 15771d7fec4Smrg int FS450_get_tv_standard(unsigned long *p_standard); 15871d7fec4Smrg int FS450_get_available_tv_standards(unsigned long *p_standards); 15971d7fec4Smrg int FS450_set_tv_standard(unsigned long standard); 16071d7fec4Smrg /* standard is one of the FS450_TV_STANDARD constants */ 16171d7fec4Smrg /* standards is a bitmask of zero or more FS450_TV_STANDARD constants */ 16271d7fec4Smrg 16371d7fec4Smrg/* FS450 TV Standard flags*/ 16471d7fec4Smrg#define FS450_TV_STANDARD_NTSC_M 0x0001 16571d7fec4Smrg#define FS450_TV_STANDARD_NTSC_M_J 0x0002 16671d7fec4Smrg#define FS450_TV_STANDARD_PAL_B 0x0004 16771d7fec4Smrg#define FS450_TV_STANDARD_PAL_D 0x0008 16871d7fec4Smrg#define FS450_TV_STANDARD_PAL_H 0x0010 16971d7fec4Smrg#define FS450_TV_STANDARD_PAL_I 0x0020 17071d7fec4Smrg#define FS450_TV_STANDARD_PAL_M 0x0040 17171d7fec4Smrg#define FS450_TV_STANDARD_PAL_N 0x0080 17271d7fec4Smrg#define FS450_TV_STANDARD_PAL_G 0x0100 17371d7fec4Smrg 17471d7fec4Smrg/* ==========================================================================*/ 17571d7fec4Smrg/* VGA mode assumed by FS450*/ 17671d7fec4Smrg 17771d7fec4Smrg int FS450_get_vga_mode(unsigned long *p_vga_mode); 17871d7fec4Smrg int FS450_get_available_vga_modes(unsigned long *p_vga_modes); 17971d7fec4Smrg int FS450_set_vga_mode(unsigned long vga_mode); 18071d7fec4Smrg /* vga_mode is one of the FS450_VGA_MODE constants */ 18171d7fec4Smrg /* vga_modes is a bitmask of zero or more FS450_VGA_MODE constants */ 18271d7fec4Smrg 18371d7fec4Smrg/* FS450 VGA Mode flags*/ 18471d7fec4Smrg#define FS450_VGA_MODE_UNKNOWN 0 18571d7fec4Smrg#define FS450_VGA_MODE_640X480 0x0001 18671d7fec4Smrg#define FS450_VGA_MODE_720X487 0x0002 18771d7fec4Smrg#define FS450_VGA_MODE_720X576 0x0004 18871d7fec4Smrg#define FS450_VGA_MODE_800X600 0x0008 18971d7fec4Smrg#define FS450_VGA_MODE_1024X768 0x0010 19071d7fec4Smrg 19171d7fec4Smrg/* ==========================================================================*/ 19271d7fec4Smrg/* TVout mode*/ 19371d7fec4Smrg 19471d7fec4Smrg int FS450_get_tvout_mode(unsigned long *p_tvout_mode); 19571d7fec4Smrg int FS450_set_tvout_mode(unsigned long tvout_mode); 19671d7fec4Smrg /* tvout_mode is a bitmask of FS450_TVOUT_MODE constants */ 19771d7fec4Smrg 19871d7fec4Smrg/* FS450 TVout mode flags*/ 19971d7fec4Smrg#define FS450_TVOUT_MODE_CVBS 0x0001 20071d7fec4Smrg#define FS450_TVOUT_MODE_YC 0x0002 20171d7fec4Smrg#define FS450_TVOUT_MODE_RGB 0x0004 20271d7fec4Smrg#define FS450_TVOUT_MODE_CVBS_YC (FS450_TVOUT_MODE_CVBS | FS450_TVOUT_MODE_YC) 20371d7fec4Smrg 20471d7fec4Smrg/* ==========================================================================*/ 20571d7fec4Smrg/* Flicker control*/ 20671d7fec4Smrg 20771d7fec4Smrg int FS450_get_sharpness(int *p_sharpness); 20871d7fec4Smrg int FS450_set_sharpness(int sharpness); 20971d7fec4Smrg /* sharpness is a percentage in tenths of a percent, 0 to 1000 */ 21071d7fec4Smrg 21171d7fec4Smrg int FS450_get_flicker_filter(int *p_flicker); 21271d7fec4Smrg int FS450_set_flicker_filter(int flicker); 21371d7fec4Smrg /* flicker_filter is a percentage in tenths of a percent, 0 to 1000 */ 21471d7fec4Smrg 21571d7fec4Smrg/* ==========================================================================*/ 21671d7fec4Smrg/* Size and Position*/ 21771d7fec4Smrg 21871d7fec4Smrg int FS450_get_overscan(int *p_x, int *p_y); 21971d7fec4Smrg int FS450_set_overscan(int x, int y); 22071d7fec4Smrg int FS450_get_position(int *p_x, int *p_y); 22171d7fec4Smrg int FS450_set_position(int x, int y); 22271d7fec4Smrg /* x and y are horizontal and vertical adjustments, -1000 to +1000 */ 22371d7fec4Smrg 22471d7fec4Smrg/* ==========================================================================*/ 22571d7fec4Smrg/* Visual adjustments*/ 22671d7fec4Smrg 22771d7fec4Smrg int FS450_get_color(int *p_color); 22871d7fec4Smrg int FS450_set_color(int color); 22971d7fec4Smrg /* color is a percentage, 0 to 100 */ 23071d7fec4Smrg 23171d7fec4Smrg int FS450_get_brightness(int *p_brightness); 23271d7fec4Smrg int FS450_set_brightness(int brightness); 23371d7fec4Smrg /* brightness is a percentage, 0 to 100 */ 23471d7fec4Smrg 23571d7fec4Smrg int FS450_get_contrast(int *p_contrast); 23671d7fec4Smrg int FS450_set_contrast(int constrast); 23771d7fec4Smrg /* contrast is a percentage, 0 to 100 */ 23871d7fec4Smrg 23971d7fec4Smrg/* ==========================================================================*/ 24071d7fec4Smrg/* Luma and Chroma filter*/ 24171d7fec4Smrg 24271d7fec4Smrg int FS450_get_yc_filter(unsigned int *p_yc_filter); 24371d7fec4Smrg int FS450_set_yc_filter(unsigned int yc_filter); 24471d7fec4Smrg /* yc_filter is a bitmask of FS450_LUMA_FILTER and/or FS450_CHROMA_FILTER */ 24571d7fec4Smrg 24671d7fec4Smrg/* FS450 Luma and Chroma Filters*/ 24771d7fec4Smrg#define FS450_LUMA_FILTER 0x0001 24871d7fec4Smrg#define FS450_CHROMA_FILTER 0x0002 24971d7fec4Smrg 25071d7fec4Smrg/* ==========================================================================*/ 25171d7fec4Smrg/* Macrovision*/ 25271d7fec4Smrg 25371d7fec4Smrg int FS450_get_aps_trigger_bits(unsigned int *p_trigger_bits); 25471d7fec4Smrg int FS450_set_aps_trigger_bits(unsigned int trigger_bits); 25571d7fec4Smrg /* trigger_bits is one of the FS450_APS_TRIGGER constants */ 25671d7fec4Smrg 25771d7fec4Smrg/* APS Trigger Bits*/ 25871d7fec4Smrg#define FS450_APS_TRIGGER_OFF 0 25971d7fec4Smrg#define FS450_APS_TRIGGER_AGC_ONLY 1 26071d7fec4Smrg#define FS450_APS_TRIGGER_AGC_2_LINE 2 26171d7fec4Smrg#define FS450_APS_TRIGGER_AGC_4_LINE 3 26271d7fec4Smrg 26371d7fec4Smrg/* ==========================================================================*/ 26471d7fec4Smrg/* direct access to Houston and platform registers (debug builds only)*/ 26571d7fec4Smrg/* The two functions FS450_ReadRegister and FS450_WriteRegister allow access*/ 26671d7fec4Smrg/* to device registers. These functions are intended for debugging purposes*/ 26771d7fec4Smrg/* only and should not be included in a shipping product.*/ 26871d7fec4Smrg 26971d7fec4Smrg#ifdef FS450_DIRECTREG 27071d7fec4Smrg 27171d7fec4Smrg#define SOURCE_HOUSTON 0 27271d7fec4Smrg#define SOURCE_GCC 1 27371d7fec4Smrg 27471d7fec4Smrg typedef struct _S_REG_INFO 27571d7fec4Smrg { 27671d7fec4Smrg int source; 27771d7fec4Smrg unsigned int size; 27871d7fec4Smrg unsigned long offset; 27971d7fec4Smrg unsigned long value; 28071d7fec4Smrg } 28171d7fec4Smrg S_REG_INFO; 28271d7fec4Smrg 28371d7fec4Smrg int FS450_ReadRegister(S_REG_INFO * p_reg); 28471d7fec4Smrg int FS450_WriteRegister(S_REG_INFO * p_reg); 28571d7fec4Smrg 28671d7fec4Smrg#endif 28771d7fec4Smrg 28871d7fec4Smrg/* ==========================================================================*/ 28971d7fec4Smrg/* Error Codes*/ 29071d7fec4Smrg 29171d7fec4Smrg#define ERR_INVALID_PARAMETER 0x1000 29271d7fec4Smrg#define ERR_NOT_SUPPORTED 0x1001 29371d7fec4Smrg#define ERR_CANNOT_CHANGE_WHILE_TV_ON 0x1002 29471d7fec4Smrg 29571d7fec4Smrg#define ERR_DRIVER_NOT_FOUND 0x1100 29671d7fec4Smrg#define ERR_DRIVER_ERROR 0x1101 29771d7fec4Smrg#define ERR_DEVICE_NOT_FOUND 0x1120 29871d7fec4Smrg 29971d7fec4Smrg#define ERR_I2C_MISSING_DEVICE 0x1200 30071d7fec4Smrg#define ERR_I2C_WRITE_FAILED 0x1201 30171d7fec4Smrg#define ERR_I2C_READ_FAILED 0x1202 30271d7fec4Smrg 30371d7fec4Smrg#ifdef __cplusplus 30471d7fec4Smrg} 30571d7fec4Smrg#endif 30671d7fec4Smrg 30771d7fec4Smrg#endif 308