3244 lines
95 KiB
C
Executable File
3244 lines
95 KiB
C
Executable File
#include <stdio.h>
|
|
#include <linux/types.h>
|
|
#include <linux/i2c.h>
|
|
#include <linux/i2c-dev.h>
|
|
#include <sys/ioctl.h>
|
|
#include <fcntl.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
//#include "i2c.h"
|
|
#include "tp2828.h"
|
|
|
|
typedef unsigned char FH_UINT8;
|
|
typedef unsigned short FH_UINT16;
|
|
typedef unsigned long long u64;
|
|
typedef unsigned int u32;
|
|
typedef int s32;
|
|
typedef unsigned short u16;
|
|
typedef short s16;
|
|
typedef unsigned char u8;
|
|
typedef char s8;
|
|
typedef unsigned int UINT32;
|
|
typedef unsigned long long int UINT64;
|
|
typedef int SINT32;
|
|
typedef unsigned short int UINT16;
|
|
typedef unsigned char UINT8;
|
|
typedef unsigned int bool;
|
|
|
|
#define FALSE (1 == 0)
|
|
#define TRUE (1 == 1)
|
|
#define NULL ((void *)0)
|
|
|
|
#define false (1 == 0)
|
|
#define true (1 == 1)
|
|
|
|
#define ENABLE (1 == 1)
|
|
#define DISABLE (1 == 0)
|
|
|
|
#define BIT(__n) (1<<(__n))
|
|
|
|
/*
|
|
static void delay_200us()
|
|
{
|
|
int t=6620;
|
|
while(t--);
|
|
}
|
|
*/
|
|
static void viu_mdelay(int ms)
|
|
{
|
|
#if 1
|
|
sleep(1);
|
|
#else
|
|
int s=5 * ms;
|
|
while(s--)
|
|
delay_200us();
|
|
#endif
|
|
}
|
|
|
|
#define TP2802A_I2C_ADDR 0x44
|
|
struct i2c_dev {
|
|
int fd;
|
|
FH_UINT16 i2c_devid;
|
|
UINT32 reserved;
|
|
};
|
|
|
|
struct i2c_dev *chip;
|
|
struct i2c_dev s_chip;
|
|
|
|
int viu_tpi2c_hw_init(struct i2c_dev **dev)
|
|
{
|
|
chip = &s_chip;
|
|
s_chip.i2c_devid = TP2802A_I2C_ADDR;
|
|
s_chip.fd = open("/dev/i2c-0", O_RDWR | O_NONBLOCK);
|
|
return 0;
|
|
}
|
|
u16 tp28xx_byte_read(struct i2c_dev *chip, u16 addr)
|
|
{
|
|
struct i2c_rdwr_ioctl_data i2c_data;
|
|
struct i2c_msg msgs[2] = {{0}};
|
|
FH_UINT8 reg[4] = {0};
|
|
FH_UINT8 val[4] = {0};
|
|
|
|
i2c_data.nmsgs = 2;
|
|
//i2c_data.msgs = (struct i2c_msg *)malloc(i2c_data.nmsgs * sizeof(struct i2c_msg));
|
|
i2c_data.msgs = msgs;
|
|
|
|
reg[0] = addr & 0xff;
|
|
i2c_data.msgs[0].len = 1;
|
|
i2c_data.msgs[1].len = 1;
|
|
|
|
i2c_data.msgs[0].addr = chip->i2c_devid; /* */
|
|
i2c_data.msgs[0].flags = 0; /* write */
|
|
i2c_data.msgs[0].buf = reg;
|
|
|
|
i2c_data.msgs[1].addr = chip->i2c_devid; /* */
|
|
i2c_data.msgs[1].flags = I2C_M_RD; /* read */
|
|
i2c_data.msgs[1].buf = val;
|
|
|
|
ioctl(chip->fd, I2C_RDWR, &i2c_data);
|
|
|
|
printf("tp28xx_byte_read addr, *data:[0x%x][0x%x]\n", addr, val[0]);
|
|
|
|
return val[0];
|
|
}
|
|
|
|
|
|
int tp28xx_byte_write(struct i2c_dev *chip, u16 addr, u16 data)
|
|
{
|
|
struct i2c_rdwr_ioctl_data i2c_data;
|
|
struct i2c_msg msgs[1] = {{0}};
|
|
FH_UINT8 tmp[4];
|
|
int ret;
|
|
|
|
printf("tp28xx_byte_write( 0x%x,0x%x);\n", addr, data);
|
|
i2c_data.nmsgs = 1;
|
|
i2c_data.msgs = (struct i2c_msg *)&msgs;
|
|
tmp[0] = addr & 0xff;
|
|
tmp[1] = data & 0xff;
|
|
i2c_data.msgs[0].len = 2;
|
|
|
|
i2c_data.msgs[0].addr = chip->i2c_devid; /* */
|
|
i2c_data.msgs[0].flags = 0; /* write */
|
|
i2c_data.msgs[0].buf = tmp;
|
|
|
|
ret = ioctl(chip->fd, I2C_RDWR, &i2c_data);
|
|
return ret;
|
|
}
|
|
|
|
void tp2802_write_table(struct i2c_dev *dev,unsigned char addr, unsigned char *tbl_ptr, unsigned char tbl_cnt)
|
|
{
|
|
unsigned char i = 0;
|
|
|
|
for(i = 0; i < tbl_cnt; i ++)
|
|
{
|
|
tp28xx_byte_write(dev, (addr + i), *(tbl_ptr + i));
|
|
}
|
|
}
|
|
|
|
#define BT1120_HEADER 0x00 //reg0x02 bit3 0=double head
|
|
#define BT656_HEADER_8BIT 0x08 //reg0x02 bit3 1=single head,
|
|
#define OUTPUT_MODE_16BIT 0x00
|
|
#define OUTPUT_MODE_8BIT 0x80
|
|
#define OUTCLK_148M 0x1
|
|
#define OUTCLK_78M 0x0
|
|
static int rx_mode = PTZ_RX_TVI_CMD;
|
|
static int multi_sample_en=0;
|
|
static int multi_sample_ch0_fpsmode=TP2802_1080P25;
|
|
static int multi_sample_ch1_fpsmode=TP2802_720P25;
|
|
static int blue_screen_open=0;
|
|
|
|
|
|
#if 0
|
|
//bt656 ddr 1 ch 5m
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_8M15;//3840x2160
|
|
//static int fpsmode = TP2802_5M20;//2592x1944
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_1CH;
|
|
static int out_clk_frq = OUTCLK_148M;
|
|
static int vin_clk_frq = OUTCLK_148M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
///////////cvbs////////////////////
|
|
|
|
#if 0
|
|
//bt656 sdr 1 ch cvbs
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_PAL;
|
|
static int stdard = STD_TVI;
|
|
static int output = SDR_1CH;
|
|
static int out_clk_frq = OUTCLK_78M;
|
|
static int vin_clk_frq = OUTCLK_78M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
|
|
#if 0
|
|
//bt656 ddr 2 ch cvbs
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_PAL;
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_2CH;
|
|
static int out_clk_frq = OUTCLK_78M;
|
|
static int vin_clk_frq = OUTCLK_78M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
#if 0
|
|
//bt656 ddr 4 ch cvbs
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_PAL;
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_4CH;
|
|
static int out_clk_frq = OUTCLK_148M;
|
|
static int vin_clk_frq = OUTCLK_78M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
|
|
///////////720p////////////////////
|
|
#if 1
|
|
//bt656 sdr 1 ch 720p
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_720P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = SDR_1CH;
|
|
static int out_clk_frq = OUTCLK_78M;
|
|
static int vin_clk_frq = OUTCLK_78M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
#if 0
|
|
//bt656 ddr 2 ch 720p
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_720P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_2CH;
|
|
static int out_clk_frq = OUTCLK_78M;
|
|
static int vin_clk_frq = OUTCLK_78M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
#if 0
|
|
//bt656 ddr 4 ch 720p
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_720P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_4CH;
|
|
static int out_clk_frq = OUTCLK_148M;
|
|
static int vin_clk_frq = OUTCLK_78M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
////////1080p////////////////
|
|
#if 0
|
|
//bt656 ddr 1 ch 1080p
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_1080P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_1CH;
|
|
static int out_clk_frq = OUTCLK_78M;
|
|
static int vin_clk_frq = OUTCLK_148M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
#if 0
|
|
//bt656 sdr 1 ch 1080p
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_1080P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = SDR_1CH;
|
|
static int out_clk_frq = OUTCLK_148M;
|
|
static int vin_clk_frq = OUTCLK_148M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
#if 0
|
|
//bt656 ddr 2 ch 1080p
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_1080P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_2CH;
|
|
static int out_clk_frq = OUTCLK_148M;
|
|
static int vin_clk_frq = OUTCLK_148M;
|
|
static int half_mode_en=0;
|
|
#endif
|
|
|
|
#if 0
|
|
//bt656 ddr 4 ch 1080p lite
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_8BIT;
|
|
static int fpsmode = TP2802_1080P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = DDR_4CH;
|
|
static int out_clk_frq = OUTCLK_148M;
|
|
static int vin_clk_frq = OUTCLK_148M;
|
|
static int half_mode_en=1;
|
|
#endif
|
|
|
|
#if 0
|
|
//bt1120 16bit.need 78M sdr1ch mode
|
|
static int sav_head = BT656_HEADER_8BIT;
|
|
static int bt_outputmode = OUTPUT_MODE_16BIT;
|
|
static int fpsmode = TP2802_1080P25;
|
|
static int stdard = STD_TVI;
|
|
static int output = SDR_1CH;
|
|
static int out_clk_frq = OUTCLK_78M;
|
|
static int vin_clk_frq = OUTCLK_148M;
|
|
#endif
|
|
|
|
|
|
static unsigned int id;
|
|
|
|
static const unsigned char SYS_MODE[5]= {0x01,0x02,0x04,0x08,0x0f}; //{ch1,ch2,ch3,ch4,ch_all}
|
|
static const unsigned char SYS_AND[5] = {0xfe,0xfd,0xfb,0xf7,0xf0};
|
|
|
|
//static const unsigned char DDR_2CH_MUX[5] = {0x01,0x02,0x40,0x80,0xc3}; //default Vin1&2@port1 Vin3&4@port2
|
|
static const unsigned char TP2826_DDR2CH_MUX[5]= {0x01,0x02,0x04,0x08,0x0f}; //{ch1,ch2,ch3,ch4,ch_all}
|
|
|
|
static const unsigned char CLK_MODE[4]= {0x01,0x10,0x01,0x10}; //for SDR_1CH/DDR_1CH output only
|
|
static const unsigned char CLK_ADDR[4]= {0xfa,0xfa,0xfb,0xfb};
|
|
static const unsigned char CLK_AND[4] = {0xf8,0x8f,0xf8,0x8f};
|
|
static const unsigned char SDR1_SEL[4]= {0x00,0x11,0x22,0x33}; //
|
|
//static const unsigned char DDR1_SEL[4]= {0x40,0x51,0x62,0x73}; //
|
|
static const unsigned char TP2827C_DDR1_SEL[4]= {0x04,0x15,0x26,0x37}; //
|
|
static const unsigned char DAT_ADDR[4]= {0xf6,0xf7,0xf8,0xf9};
|
|
static void tp2828_case_setting(struct i2c_dev * chip, unsigned char ch)
|
|
{
|
|
printf("tp2828_case_setting\n");
|
|
int val=0;
|
|
|
|
if(out_clk_frq == OUTCLK_78M){
|
|
tp28xx_byte_write(chip, 0xFA, 0x99);
|
|
tp28xx_byte_write(chip, 0xFB, 0x99);
|
|
}
|
|
if(vin_clk_frq == OUTCLK_78M){
|
|
tp28xx_byte_write(chip, 0xF5, 0x0f);
|
|
}
|
|
if(bt_outputmode == OUTPUT_MODE_16BIT)
|
|
{
|
|
tp28xx_byte_write(chip, 0xF6, 0x00);
|
|
tp28xx_byte_write(chip, 0xF8, 0x44);
|
|
tp28xx_byte_write(chip, 0xFA, 0xcb);
|
|
tp28xx_byte_write(chip, 0xFB, 0xed);
|
|
}
|
|
if(multi_sample_en){
|
|
tp28xx_byte_write(chip, 0x46, 0x02);
|
|
tp28xx_byte_write(chip, 0x47, 0x02);
|
|
|
|
tp28xx_byte_write(chip, 0xF2, 0x02);
|
|
tp28xx_byte_write(chip, 0xF3, 0x01);
|
|
tp28xx_byte_write(chip, 0xF4, 0x60);
|
|
tp28xx_byte_write(chip, 0xF5, 0x02);
|
|
tp28xx_byte_write(chip, 0xF6, 0x10);
|
|
tp28xx_byte_write(chip, 0xF7, 0x11);
|
|
tp28xx_byte_write(chip, 0xF8, 0x32);
|
|
tp28xx_byte_write(chip, 0xF9, 0x33);
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
}
|
|
if(output == DDR_2CH && out_clk_frq == OUTCLK_78M)
|
|
{
|
|
tp28xx_byte_write(chip, 0xF6, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF7, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF8, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF9, 0x10); //
|
|
tp28xx_byte_write(chip, 0x50, 0x81); //
|
|
tp28xx_byte_write(chip, 0x51, 0x81); //
|
|
tp28xx_byte_write(chip, 0x52, 0x81); //
|
|
tp28xx_byte_write(chip, 0x53, 0x81); //
|
|
}
|
|
if(half_mode_en)
|
|
{
|
|
val = tp28xx_byte_read(chip, 0x35);
|
|
val |= 0x40;
|
|
tp28xx_byte_write(chip, 0x35, val);
|
|
}
|
|
tp28xx_byte_write(chip, 0x4e, 0x05);//clk enable
|
|
tp28xx_byte_write(chip, 0x4d, 0x0f);//pin output control
|
|
|
|
}
|
|
static void tp2802_set_reg_page(struct i2c_dev * chip, unsigned char ch)
|
|
{
|
|
switch(ch)
|
|
{
|
|
case CH_1:
|
|
tp28xx_byte_write(chip, 0x40, 0x00);
|
|
break; // VIN1 registers
|
|
case CH_2:
|
|
tp28xx_byte_write(chip, 0x40, 0x01);
|
|
break; // VIN2 registers
|
|
case CH_3:
|
|
tp28xx_byte_write(chip, 0x40, 0x02);
|
|
break; // VIN3 registers
|
|
case CH_4:
|
|
tp28xx_byte_write(chip, 0x40, 0x03);
|
|
break; // VIN4 registers
|
|
case CH_ALL:
|
|
tp28xx_byte_write(chip, 0x40, 0x04);
|
|
break; // Write All VIN1-4 registers
|
|
case AUDIO_PAGE:
|
|
tp28xx_byte_write(chip, 0x40, 0x40);
|
|
break; // Audio
|
|
case DATA_PAGE:
|
|
tp28xx_byte_write(chip, 0x40, 0x10);
|
|
break; // PTZ data
|
|
default:
|
|
tp28xx_byte_write(chip, 0x40, 0x04);
|
|
break;
|
|
}
|
|
}
|
|
static void tp2802_set_work_mode_1080p25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_1080p25_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_1080p30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_1080p30_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_720p25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_720p25_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_720p30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_720p30_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_720p50(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_720p50_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_720p60(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_720p60_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_PAL(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_PAL_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_NTSC(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_NTSC_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_3M(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_3M_raster, 9);
|
|
}
|
|
|
|
static void tp2802_set_work_mode_5M(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_5M_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_4M(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_4M_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_3M20(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_3M20_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_4M12(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_4M12_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_6M10(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_6M10_raster, 9);
|
|
}
|
|
/*
|
|
static void tp2802_set_work_mode_QHDH30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QHDH30_raster, 9);
|
|
}
|
|
*/
|
|
/*
|
|
static void tp2802_set_work_mode_QHDH25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QHDH25_raster, 9);
|
|
}
|
|
*/
|
|
static void tp2802_set_work_mode_QHD15(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QHD15_raster, 9);
|
|
}
|
|
/*
|
|
static void tp2802_set_work_mode_QXGAH30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QXGAH30_raster, 9);
|
|
}
|
|
*/
|
|
/*
|
|
static void tp2802_set_work_mode_QXGAH25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QXGAH25_raster, 9);
|
|
}
|
|
*/
|
|
static void tp2802_set_work_mode_QHD30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QHD30_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_QHD25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QHD25_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_QXGA30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QXGA30_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_QXGA25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_QXGA25_raster, 9);
|
|
}
|
|
/*
|
|
static void tp2802_set_work_mode_4M30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_4M30_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_4M25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_4M25_raster, 9);
|
|
}
|
|
*/
|
|
static void tp2802_set_work_mode_5M20(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_5M20_raster, 9);
|
|
}
|
|
/*
|
|
static void tp2802_set_work_mode_5MH20(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_5MH20_raster, 9);
|
|
}
|
|
*/
|
|
/*
|
|
static void tp2802_set_work_mode_4MH30(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_4MH30_raster, 9);
|
|
}
|
|
static void tp2802_set_work_mode_4MH25(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_4MH25_raster, 9);
|
|
}
|
|
*/
|
|
static void tp2802_set_work_mode_8M15(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_8M15_raster, 9);
|
|
}
|
|
/*
|
|
static void tp2802_set_work_mode_8MH15(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_8MH15_raster, 9);
|
|
}
|
|
*/
|
|
static void tp2802_set_work_mode_8M12(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_8M12_raster, 9);
|
|
}
|
|
/*
|
|
static void tp2802_set_work_mode_8MH12(struct i2c_dev * chip)
|
|
{
|
|
// Start address 0x15, Size = 9B
|
|
tp2802_write_table(chip, 0x15, tbl_tp2802_8MH12_raster, 9);
|
|
}
|
|
*/
|
|
/*
|
|
static void TP2826_RX_init(struct i2c_dev * chip)
|
|
{
|
|
printf("TP2826_RX_init in.\n");
|
|
|
|
tp28xx_byte_write(chip, 0xc9, 0x00);
|
|
tp28xx_byte_write(chip, 0xca, 0x00);
|
|
tp28xx_byte_write(chip, 0xcb, 0x06);
|
|
tp28xx_byte_write(chip, 0xcc, 0x07);
|
|
tp28xx_byte_write(chip, 0xcd, 0x08);
|
|
tp28xx_byte_write(chip, 0xce, 0x09); //line6,7,8,9
|
|
tp28xx_byte_write(chip, 0xcf, 0x03);
|
|
tp28xx_byte_write(chip, 0xd0, 0x48);
|
|
tp28xx_byte_write(chip, 0xd1, 0x34); //39 clock per bit 0.526us
|
|
tp28xx_byte_write(chip, 0xd2, 0x60);
|
|
tp28xx_byte_write(chip, 0xd3, 0x10);
|
|
tp28xx_byte_write(chip, 0xd4, 0x04); //
|
|
tp28xx_byte_write(chip, 0xd5, 0xf0);
|
|
tp28xx_byte_write(chip, 0xd6, 0xd8);
|
|
tp28xx_byte_write(chip, 0xd7, 0x17); //24bit
|
|
|
|
}
|
|
*/
|
|
static void TP2829_RX_init(struct i2c_dev * chip, unsigned char mod)
|
|
{
|
|
|
|
int i, index=0;
|
|
unsigned char regA7=0x00;
|
|
unsigned char regA8=0x00;
|
|
|
|
//regC9~D7
|
|
static const unsigned char PTZ_RX_dat[][15]=
|
|
{
|
|
{0x00,0x00,0x07,0x08,0x00,0x00,0x04,0x00,0x00,0x60,0x10,0x06,0xbe,0x39,0x27}, //TVI command
|
|
{0x00,0x00,0x07,0x08,0x09,0x0a,0x04,0x00,0x00,0x60,0x10,0x06,0xbe,0x39,0x27}, //TVI burst
|
|
{0x00,0x00,0x06,0x07,0x08,0x09,0x05,0xbf,0x11,0x60,0x0b,0x04,0xf0,0xd8,0x2f}, //ACP1 0.525
|
|
{0x00,0x00,0x06,0x07,0x08,0x09,0x02,0xdf,0x88,0x60,0x10,0x04,0xf0,0xd8,0x17}, //ACP2 0.6
|
|
//{0x00,0x00,0x06,0x07,0x08,0x09,0x04,0xec,0xe9,0x60,0x10,0x04,0xf0,0xd8,0x17}, //ACP3 0.35
|
|
{0x00,0x00,0x07,0x08,0x09,0x0a,0x09,0xd9,0xd3,0x60,0x08,0x04,0xf0,0xd8,0x2f}, //ACP3 0.35
|
|
{0x00,0x00,0x06,0x07,0x08,0x09,0x03,0x52,0x53,0x60,0x10,0x04,0xf0,0xd8,0x17} //ACP1 0.525
|
|
};
|
|
|
|
if(PTZ_RX_TVI_CMD == mod)
|
|
{
|
|
index = 0;
|
|
regA7 = 0x03;
|
|
regA8 = 0x00;
|
|
}
|
|
else if(PTZ_RX_TVI_BURST == mod)
|
|
{
|
|
index = 1;
|
|
regA7 = 0x03;
|
|
regA8 = 0x00;
|
|
}
|
|
else if(PTZ_RX_ACP1 == mod)
|
|
{
|
|
index = 2;
|
|
regA7 = 0x03;
|
|
regA8 = 0x00;
|
|
}
|
|
else if(PTZ_RX_ACP2 == mod)
|
|
{
|
|
index = 3;
|
|
regA7 = 0x27;
|
|
regA8 = 0x0f;
|
|
}
|
|
else if(PTZ_RX_ACP3 == mod)
|
|
{
|
|
index = 4;
|
|
regA7 = 0x03;
|
|
regA8 = 0x00;
|
|
}
|
|
else if(PTZ_RX_TEST == mod)
|
|
{
|
|
index = 5;
|
|
regA7 = 0x03;
|
|
regA8 = 0x00;
|
|
}
|
|
|
|
for(i = 0; i < 15; i++)
|
|
{
|
|
tp28xx_byte_write(chip, 0xc9+i, PTZ_RX_dat[index][i]);
|
|
tp28xx_byte_write(chip, 0xa8, regA8);
|
|
tp28xx_byte_write(chip, 0xa7, regA7);
|
|
}
|
|
tp28xx_byte_write(chip, 0xc6, 0x19);
|
|
tp28xx_byte_write(chip, 0xc8, 0x21);
|
|
}
|
|
|
|
void TP2829_PLL_Reset( struct i2c_dev * chip)
|
|
{
|
|
int i=0;
|
|
int val=0;
|
|
tp28xx_byte_write(chip, 0x40, 0x04);
|
|
tp28xx_byte_write(chip, 0x3b, 0x20);
|
|
tp28xx_byte_write(chip, 0x3d, 0xe0);
|
|
tp28xx_byte_write(chip, 0x3d, 0x60);
|
|
tp28xx_byte_write(chip, 0x3b, 0x25);
|
|
tp28xx_byte_write(chip, 0x40, 0x40);
|
|
tp28xx_byte_write(chip, 0x7a, 0x20);
|
|
tp28xx_byte_write(chip, 0x3c, 0x20);
|
|
tp28xx_byte_write(chip, 0x3c, 0x00);
|
|
tp28xx_byte_write(chip, 0x7a, 0x25);
|
|
tp28xx_byte_write(chip, 0x40, 0x00);
|
|
|
|
if(DDR_2CH == output|| DDR_4CH == output || DDR_1CH == output)
|
|
tp28xx_byte_write(chip, 0x44, 0x07);
|
|
else
|
|
tp28xx_byte_write(chip, 0x44, 0x17);
|
|
|
|
tp28xx_byte_write(chip, 0x43, 0x12);
|
|
tp28xx_byte_write(chip, 0x45, 0x09);
|
|
|
|
for(i = 0; i < 6; i++ )
|
|
{
|
|
viu_mdelay(1000);
|
|
val = tp28xx_byte_read(chip, 0x01);
|
|
printf("detect ad status:0x%x\n",val);
|
|
tp28xx_byte_read(chip, 0x02);
|
|
tp28xx_byte_read(chip, 0x03);
|
|
//if(0x08 & val) break;
|
|
}
|
|
}
|
|
/*
|
|
static void TP2829_output(struct i2c_dev * chip)
|
|
{
|
|
unsigned int tmp;
|
|
|
|
tp28xx_byte_write(chip, 0xF5, 0x00);
|
|
tp28xx_byte_write(chip, 0xF1, 0x00);
|
|
tp28xx_byte_write(chip, 0x4D, 0x0f);
|
|
tp28xx_byte_write(chip, 0x4E, 0x0f);
|
|
tp28xx_byte_write(chip, 0x4f, 0x03);
|
|
|
|
if( SDR_1CH == output )
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
tp28xx_byte_write(chip, 0xF4, 0x80); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x00);
|
|
tp28xx_byte_write(chip, 0xF7, 0x11);
|
|
tp28xx_byte_write(chip, 0xF8, 0x22);
|
|
tp28xx_byte_write(chip, 0xF9, 0x33);
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x77);
|
|
tp28xx_byte_write(chip, 0xF2, 0x77);
|
|
if(TP2802_720P25V2 == fpsmode || TP2802_720P30V2 == fpsmode || TP2802_PAL == fpsmode || TP2802_NTSC == fpsmode )
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0xFA);
|
|
tmp &= 0x88;
|
|
tmp |= 0x11;
|
|
tp28xx_byte_write(chip, 0xFA, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xFB);
|
|
tmp &= 0x88;
|
|
tmp |= 0x11;
|
|
tp28xx_byte_write(chip, 0xFB, tmp);
|
|
}
|
|
else if(FLAG_HALF_MODE == (fpsmode & FLAG_HALF_MODE) )
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0xFA);
|
|
tmp &= 0x88;
|
|
tmp |= 0x43;
|
|
tp28xx_byte_write(chip, 0xFA, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xFB);
|
|
tmp &= 0x88;
|
|
tmp |= 0x65;
|
|
tp28xx_byte_write(chip, 0xFB, tmp);
|
|
}
|
|
}
|
|
else if(SDR_2CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
tp28xx_byte_write(chip, 0xF4, 0x80); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x10);
|
|
tp28xx_byte_write(chip, 0xF7, 0x23);
|
|
tp28xx_byte_write(chip, 0xF8, 0x10);
|
|
tp28xx_byte_write(chip, 0xF9, 0x23);
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x77);
|
|
tp28xx_byte_write(chip, 0xF2, 0x77);
|
|
}
|
|
else if(DDR_2CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
//tp28xx_byte_write(chip, 0x45, 0x54); //PLL 297M
|
|
tp28xx_byte_write(chip, 0xF4, 0xa0); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF7, 0x23); //
|
|
tp28xx_byte_write(chip, 0xF8, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF9, 0x23); //
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x77);
|
|
tp28xx_byte_write(chip, 0xF2, 0x77);
|
|
|
|
}
|
|
else if(DDR_4CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
//tp28xx_byte_write(chip, 0x45, 0x54); //PLL 297M
|
|
tp28xx_byte_write(chip, 0xF4, 0xa0); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF7, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF8, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF9, 0x10); //
|
|
tp28xx_byte_write(chip, 0x50, 0xB2); //
|
|
tp28xx_byte_write(chip, 0x51, 0xB2); //
|
|
tp28xx_byte_write(chip, 0x52, 0xB2); //
|
|
tp28xx_byte_write(chip, 0x53, 0xB2); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x77);
|
|
tp28xx_byte_write(chip, 0xF2, 0x77);
|
|
}
|
|
else if( DDR_1CH == output )
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
//tp28xx_byte_write(chip, 0x45, 0x54); //PLL 297M
|
|
tp28xx_byte_write(chip, 0xF4, 0xa0); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x04);
|
|
tp28xx_byte_write(chip, 0xF7, 0x15);
|
|
tp28xx_byte_write(chip, 0xF8, 0x26);
|
|
tp28xx_byte_write(chip, 0xF9, 0x37);
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x77);
|
|
tp28xx_byte_write(chip, 0xF2, 0x77);
|
|
}
|
|
}
|
|
*/
|
|
static void TP2828_output(struct i2c_dev * chip)
|
|
{
|
|
unsigned int tmp;
|
|
tp28xx_byte_write(chip, 0xF5, 0x00);
|
|
tp28xx_byte_write(chip, 0xF1, 0x14);
|
|
tp28xx_byte_write(chip, 0x4D, 0x07);
|
|
tp28xx_byte_write(chip, 0x4E, 0x05);
|
|
tp28xx_byte_write(chip, 0x4f, 0x03);
|
|
|
|
if( SDR_1CH == output )
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
//tp28xx_byte_write(chip, 0x45, 0x09); //PLL 148.5M
|
|
tp28xx_byte_write(chip, 0xF4, 0x80); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x00);
|
|
tp28xx_byte_write(chip, 0xF7, 0x11);
|
|
tp28xx_byte_write(chip, 0xF8, 0x22);
|
|
tp28xx_byte_write(chip, 0xF9, 0x33);
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
|
|
tp28xx_byte_write(chip, 0xF3, 0x01);
|
|
tp28xx_byte_write(chip, 0xF2, 0x03);
|
|
if(TP2802_720P25V2 == fpsmode || TP2802_720P30V2 == fpsmode || TP2802_PAL == fpsmode || TP2802_NTSC == fpsmode )
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0xFA);
|
|
tmp &= 0x88;
|
|
tmp |= 0x11;
|
|
tp28xx_byte_write(chip, 0xFA, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xFB);
|
|
tmp &= 0x88;
|
|
tmp |= 0x11;
|
|
tp28xx_byte_write(chip, 0xFB, tmp);
|
|
}
|
|
else if(FLAG_HALF_MODE == (fpsmode & FLAG_HALF_MODE) )
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0xFA);
|
|
tmp &= 0x88;
|
|
tmp |= 0x43;
|
|
tp28xx_byte_write(chip, 0xFA, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xFB);
|
|
tmp &= 0x88;
|
|
tmp |= 0x65;
|
|
tp28xx_byte_write(chip, 0xFB, tmp);
|
|
}
|
|
}
|
|
else if(SDR_2CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
//tp28xx_byte_write(chip, 0x45, 0x09); //PLL 148.5M
|
|
tp28xx_byte_write(chip, 0xF4, 0x80); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x10);
|
|
tp28xx_byte_write(chip, 0xF7, 0x10);
|
|
tp28xx_byte_write(chip, 0xF8, 0x23);
|
|
tp28xx_byte_write(chip, 0xF9, 0x23);
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x00);
|
|
tp28xx_byte_write(chip, 0xF2, 0x00);
|
|
}
|
|
else if(DDR_2CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
tp28xx_byte_write(chip, 0x45, 0x09); //PLL 297M
|
|
tp28xx_byte_write(chip, 0xF4, 0xa0); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF7, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF8, 0x23); //
|
|
tp28xx_byte_write(chip, 0xF9, 0x23); //
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x00);
|
|
tp28xx_byte_write(chip, 0xF2, 0x00);
|
|
|
|
}
|
|
else if(DDR_4CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
tp28xx_byte_write(chip, 0x45, 0x09); //PLL 297M
|
|
tp28xx_byte_write(chip, 0xF4, 0xa0); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF7, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF8, 0x10); //
|
|
tp28xx_byte_write(chip, 0xF9, 0x10); //
|
|
tp28xx_byte_write(chip, 0x50, 0xB2); //
|
|
tp28xx_byte_write(chip, 0x51, 0xB2); //
|
|
tp28xx_byte_write(chip, 0x52, 0xB2); //
|
|
tp28xx_byte_write(chip, 0x53, 0xB2); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x00);
|
|
tp28xx_byte_write(chip, 0xF2, 0x00);
|
|
}
|
|
else if( DDR_1CH == output )
|
|
{
|
|
tp28xx_byte_write(chip, 0xFA, 0x88);
|
|
tp28xx_byte_write(chip, 0xFB, 0x88);
|
|
tp28xx_byte_write(chip, 0x45, 0x09); //PLL 297M
|
|
tp28xx_byte_write(chip, 0xF4, 0xa0); //output clock 148.5M
|
|
tp28xx_byte_write(chip, 0xF6, 0x04);
|
|
tp28xx_byte_write(chip, 0xF7, 0x15);
|
|
tp28xx_byte_write(chip, 0xF8, 0x26);
|
|
tp28xx_byte_write(chip, 0xF9, 0x37);
|
|
tp28xx_byte_write(chip, 0x50, 0x00); //
|
|
tp28xx_byte_write(chip, 0x51, 0x00); //
|
|
tp28xx_byte_write(chip, 0x52, 0x00); //
|
|
tp28xx_byte_write(chip, 0x53, 0x00); //
|
|
tp28xx_byte_write(chip, 0xF3, 0x00);
|
|
tp28xx_byte_write(chip, 0xF2, 0x00);
|
|
}
|
|
}
|
|
static void TP2829_reset_default(struct i2c_dev * chip, unsigned char ch)
|
|
{
|
|
unsigned int tmp;
|
|
//tp28xx_byte_write(chip, 0x26, 0x04);
|
|
tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x38, 0x00);
|
|
tp28xx_byte_write(chip, 0x39, 0x1C);
|
|
tp28xx_byte_write(chip, 0x3a, 0x32);
|
|
tp28xx_byte_write(chip, 0x3B, 0x26);
|
|
|
|
tmp = tp28xx_byte_read(chip, 0x26);
|
|
tmp &= 0xfe;
|
|
tp28xx_byte_write(chip, 0x26, tmp);
|
|
|
|
tmp = tp28xx_byte_read(chip, 0x06);
|
|
tmp &= 0xfb;
|
|
tp28xx_byte_write(chip, 0x06, tmp);
|
|
}
|
|
//////////////////////////////////////////////////////////////
|
|
static void TP2829_NTSC_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x13);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x40);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0x2d);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x70);
|
|
tp28xx_byte_write(chip, 0x2c, 0x2a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x68);
|
|
tp28xx_byte_write(chip, 0x2e, 0x57);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x62);
|
|
tp28xx_byte_write(chip, 0x31, 0xbb);
|
|
tp28xx_byte_write(chip, 0x32, 0x96);
|
|
tp28xx_byte_write(chip, 0x33, 0xc0);
|
|
//tp28xx_byte_write(chip, 0x35, 0x25);
|
|
tp28xx_byte_write(chip, 0x38, 0x00);
|
|
tp28xx_byte_write(chip, 0x39, 0x04);
|
|
tp28xx_byte_write(chip, 0x3a, 0x32);
|
|
tp28xx_byte_write(chip, 0x3B, 0x26);
|
|
|
|
tp28xx_byte_write(chip, 0x18, 0x12);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
}
|
|
static void TP2829_PAL_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x13);
|
|
tp28xx_byte_write(chip, 0x0d, 0x51);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x48);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x37);
|
|
tp28xx_byte_write(chip, 0x23, 0x3f);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0x2d);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x70);
|
|
tp28xx_byte_write(chip, 0x2c, 0x2a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x64);
|
|
tp28xx_byte_write(chip, 0x2e, 0x56);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x7a);
|
|
tp28xx_byte_write(chip, 0x31, 0x4a);
|
|
tp28xx_byte_write(chip, 0x32, 0x4d);
|
|
tp28xx_byte_write(chip, 0x33, 0xf0);
|
|
//tp28xx_byte_write(chip, 0x35, 0x25);
|
|
tp28xx_byte_write(chip, 0x38, 0x00);
|
|
tp28xx_byte_write(chip, 0x39, 0x04);
|
|
tp28xx_byte_write(chip, 0x3a, 0x32);
|
|
tp28xx_byte_write(chip, 0x3B, 0x26);
|
|
|
|
tp28xx_byte_write(chip, 0x18, 0x17);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
}
|
|
static void TP2829_V1_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x30);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0x2d);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x30);
|
|
tp28xx_byte_write(chip, 0x2e, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0xbb);
|
|
tp28xx_byte_write(chip, 0x32, 0x2e);
|
|
tp28xx_byte_write(chip, 0x33, 0x90);
|
|
//tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp28xx_byte_write(chip, 0x38, 0x00);
|
|
tp28xx_byte_write(chip, 0x39, 0x1c);
|
|
tp28xx_byte_write(chip, 0x3a, 0x32);
|
|
tp28xx_byte_write(chip, 0x3B, 0x26);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
}
|
|
static void TP2829_V2_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x13);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x30);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0x2d);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x30);
|
|
tp28xx_byte_write(chip, 0x2e, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0xbb);
|
|
tp28xx_byte_write(chip, 0x32, 0x2e);
|
|
tp28xx_byte_write(chip, 0x33, 0x90);
|
|
//tp28xx_byte_write(chip, 0x35, 0x25);
|
|
tp28xx_byte_write(chip, 0x38, 0x00);
|
|
tp28xx_byte_write(chip, 0x39, 0x18);
|
|
tp28xx_byte_write(chip, 0x3a, 0x32);
|
|
tp28xx_byte_write(chip, 0x3B, 0x26);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
}
|
|
|
|
/////HDA QHD30
|
|
static void TP2829_AQHDP30_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
#if 0
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
#else
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0x1c);
|
|
tmp |= 0x80;
|
|
tp28xx_byte_write(chip, 0x1c, tmp);
|
|
tp28xx_byte_write(chip, 0x0d, 0x70);
|
|
#endif
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tp28xx_byte_write(chip, 0x15, 0x23);
|
|
tp28xx_byte_write(chip, 0x16, 0x16);
|
|
tp28xx_byte_write(chip, 0x18, 0x32);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x80);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2d, 0xa0);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x6a);
|
|
tp28xx_byte_write(chip, 0x32, 0xbe);
|
|
tp28xx_byte_write(chip, 0x33, 0x80);
|
|
//tp28xx_byte_write(chip, 0x35, 0x15);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
}
|
|
|
|
/////HDA QHD25
|
|
static void TP2829_AQHDP25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
#if 0
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
#else
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0x1c);
|
|
tmp |= 0x80;
|
|
tp28xx_byte_write(chip, 0x1c, tmp);
|
|
tp28xx_byte_write(chip, 0x0d, 0x70);
|
|
#endif
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tp28xx_byte_write(chip, 0x15, 0x23);
|
|
tp28xx_byte_write(chip, 0x16, 0x16);
|
|
tp28xx_byte_write(chip, 0x18, 0x32);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x80);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2d, 0xa0);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x6f);
|
|
tp28xx_byte_write(chip, 0x32, 0xb5);
|
|
tp28xx_byte_write(chip, 0x33, 0x80);
|
|
//tp28xx_byte_write(chip, 0x35, 0x15);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
}
|
|
|
|
/////HDA QXGA30
|
|
static void TP2829_AQXGAP30_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x90);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0xa0);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x68);
|
|
tp28xx_byte_write(chip, 0x32, 0xbe);
|
|
tp28xx_byte_write(chip, 0x33, 0x80);
|
|
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
tp28xx_byte_write(chip, 0x3b, 0x26);
|
|
}
|
|
|
|
/////HDA QXGA25
|
|
static void TP2829_AQXGAP25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x60;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x90);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0xa0);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x6c);
|
|
tp28xx_byte_write(chip, 0x32, 0xbe);
|
|
tp28xx_byte_write(chip, 0x33, 0x80);
|
|
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
tp28xx_byte_write(chip, 0x3b, 0x26);
|
|
}
|
|
|
|
|
|
/////HDC QHD30
|
|
static void TP2829_CQHDP30_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0xfa);
|
|
tp28xx_byte_write(chip, 0x18, 0x38);
|
|
tp28xx_byte_write(chip, 0x1c, 0x0c);
|
|
tp28xx_byte_write(chip, 0x1d, 0x80);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x38);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xda);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x6c);
|
|
tp28xx_byte_write(chip, 0x2e, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x75);
|
|
tp28xx_byte_write(chip, 0x31, 0x39);
|
|
tp28xx_byte_write(chip, 0x32, 0xc0);
|
|
tp28xx_byte_write(chip, 0x33, 0x31);
|
|
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
}
|
|
|
|
/////HDC QHD25
|
|
static void TP2829_CQHDP25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0xd8);
|
|
tp28xx_byte_write(chip, 0x18, 0x30);
|
|
tp28xx_byte_write(chip, 0x1c, 0x0c);
|
|
tp28xx_byte_write(chip, 0x1d, 0x80);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x38);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xda);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x6c);
|
|
tp28xx_byte_write(chip, 0x2e, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x75);
|
|
tp28xx_byte_write(chip, 0x31, 0x39);
|
|
tp28xx_byte_write(chip, 0x32, 0xc0);
|
|
tp28xx_byte_write(chip, 0x33, 0x3b);
|
|
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
}
|
|
|
|
///////HDA QHD15
|
|
static void TP2829_AQHDP15_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x38);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x44);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x29);
|
|
tp28xx_byte_write(chip, 0x31, 0x68);
|
|
tp28xx_byte_write(chip, 0x32, 0x78);
|
|
tp28xx_byte_write(chip, 0x33, 0x10);
|
|
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
}
|
|
|
|
/////HDA QXGA18
|
|
static void TP2829_AQXGAP18_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x10);
|
|
tp28xx_byte_write(chip, 0x18, 0x68);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x48);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2d, 0x52);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x29);
|
|
tp28xx_byte_write(chip, 0x31, 0x65);
|
|
tp28xx_byte_write(chip, 0x32, 0x2b);
|
|
tp28xx_byte_write(chip, 0x33, 0xd0);
|
|
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
}
|
|
|
|
/////TVI QHD30/QHD25
|
|
static void TP2829_QHDP30_25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x15, 0x23);
|
|
tp28xx_byte_write(chip, 0x16, 0x1b);
|
|
tp28xx_byte_write(chip, 0x18, 0x38);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x58);
|
|
tp28xx_byte_write(chip, 0x2e, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x74);
|
|
tp28xx_byte_write(chip, 0x31, 0x58);
|
|
tp28xx_byte_write(chip, 0x32, 0x9f);
|
|
tp28xx_byte_write(chip, 0x33, 0x60);
|
|
|
|
//tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
tp28xx_byte_write(chip, 0x3b, 0x26);
|
|
}
|
|
|
|
/////TVI 5M20
|
|
static void TP2829_5MP20_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x54);
|
|
tp28xx_byte_write(chip, 0x2e, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x74);
|
|
tp28xx_byte_write(chip, 0x31, 0xa7);
|
|
tp28xx_byte_write(chip, 0x32, 0x18);
|
|
tp28xx_byte_write(chip, 0x33, 0x50);
|
|
|
|
//tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
tp28xx_byte_write(chip, 0x3b, 0x26);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
}
|
|
|
|
/////HDA 5M20
|
|
static void TP2829_A5MP20_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
#if 0
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
#else
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0x1c);
|
|
tmp |= 0x80;
|
|
tp28xx_byte_write(chip, 0x1c, tmp);
|
|
tp28xx_byte_write(chip, 0x0d, 0x70);
|
|
#endif
|
|
tp28xx_byte_write(chip, 0x20, 0x80);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2d, 0xA0);
|
|
tp28xx_byte_write(chip, 0x2e, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x77);
|
|
tp28xx_byte_write(chip, 0x32, 0x0e);
|
|
tp28xx_byte_write(chip, 0x33, 0xa0);
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
}
|
|
|
|
/////TVI 8M15
|
|
static void TP2829_8MP15_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x60);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x58);
|
|
tp28xx_byte_write(chip, 0x2e, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x74);
|
|
tp28xx_byte_write(chip, 0x31, 0x59);
|
|
tp28xx_byte_write(chip, 0x32, 0xbd);
|
|
tp28xx_byte_write(chip, 0x33, 0x60);
|
|
|
|
//tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
tp28xx_byte_write(chip, 0x3b, 0x26);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
}
|
|
///////HDA 5M12.5
|
|
static void TP2829_A5MP12_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x38);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x44);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x29);
|
|
tp28xx_byte_write(chip, 0x31, 0x68);
|
|
tp28xx_byte_write(chip, 0x32, 0x72);
|
|
tp28xx_byte_write(chip, 0x33, 0xb0);
|
|
|
|
tp28xx_byte_write(chip, 0x16, 0x10);
|
|
tp28xx_byte_write(chip, 0x18, 0x1a);
|
|
tp28xx_byte_write(chip, 0x1d, 0xb8);
|
|
tp28xx_byte_write(chip, 0x36, 0xbc);
|
|
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
}
|
|
///////////////////////////////////////////////////////////////////
|
|
static void TP2829_A720P30_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp |= 0x04;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x0d, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x40);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
|
|
tp28xx_byte_write(chip, 0x2c, 0x3a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x5a);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x9d);
|
|
tp28xx_byte_write(chip, 0x31, 0xca);
|
|
tp28xx_byte_write(chip, 0x32, 0x01);
|
|
tp28xx_byte_write(chip, 0x33, 0xd0);
|
|
}
|
|
static void TP2829_A720P25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp |= 0x04;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x0d, 0x71);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x40);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
|
|
tp28xx_byte_write(chip, 0x2c, 0x3a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x5a);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x9e);
|
|
tp28xx_byte_write(chip, 0x31, 0x20);
|
|
tp28xx_byte_write(chip, 0x32, 0x10);
|
|
tp28xx_byte_write(chip, 0x33, 0x90);
|
|
}
|
|
static void TP2829_A1080P30_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp |= 0x04;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x15, 0x01);
|
|
tp28xx_byte_write(chip, 0x16, 0xf0);
|
|
|
|
tp28xx_byte_write(chip, 0x0d, 0x72);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x38);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x0d);
|
|
|
|
tp28xx_byte_write(chip, 0x2c, 0x3a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x54);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0xa5);
|
|
tp28xx_byte_write(chip, 0x31, 0x95);
|
|
tp28xx_byte_write(chip, 0x32, 0xe0);
|
|
tp28xx_byte_write(chip, 0x33, 0x60);
|
|
}
|
|
static void TP2829_A1080P25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp |= 0x04;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x15, 0x01);
|
|
tp28xx_byte_write(chip, 0x16, 0xf0);
|
|
|
|
tp28xx_byte_write(chip, 0x0d, 0x73);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x3c);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x0d);
|
|
|
|
tp28xx_byte_write(chip, 0x2c, 0x3a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x54);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0xa5);
|
|
tp28xx_byte_write(chip, 0x31, 0x86);
|
|
tp28xx_byte_write(chip, 0x32, 0xfb);
|
|
tp28xx_byte_write(chip, 0x33, 0x60);
|
|
}
|
|
static void TP2829_1080P60_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
|
|
//tp28xx_byte_write(chip, 0x07, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0b, 0xc0);
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x15, 0x03);
|
|
tp28xx_byte_write(chip, 0x16, 0xf0);
|
|
tp28xx_byte_write(chip, 0x17, 0x80);
|
|
tp28xx_byte_write(chip, 0x18, 0x12);
|
|
tp28xx_byte_write(chip, 0x19, 0x38);
|
|
tp28xx_byte_write(chip, 0x1a, 0x47);
|
|
tp28xx_byte_write(chip, 0x1c, 0x08);
|
|
tp28xx_byte_write(chip, 0x1d, 0x96);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x23, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x40);
|
|
tp28xx_byte_write(chip, 0x2e, 0x70);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x74);
|
|
tp28xx_byte_write(chip, 0x31, 0x9b);
|
|
tp28xx_byte_write(chip, 0x32, 0xa5);
|
|
tp28xx_byte_write(chip, 0x33, 0xe0);
|
|
|
|
//tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
tp28xx_byte_write(chip, 0x3b, 0x26);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
}
|
|
//HDC 8M15
|
|
static void TP2829_C8MP15_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
tp28xx_byte_write(chip, 0x21, 0x86);
|
|
tp28xx_byte_write(chip, 0x22, 0x38);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xda);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x84);
|
|
tp28xx_byte_write(chip, 0x2e, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x75);
|
|
tp28xx_byte_write(chip, 0x31, 0x39);
|
|
tp28xx_byte_write(chip, 0x32, 0xc0);
|
|
tp28xx_byte_write(chip, 0x33, 0x31);
|
|
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
}
|
|
|
|
/////HDC 8M12
|
|
static void TP2829_C8MP12_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tp28xx_byte_write(chip, 0x0c, 0x03);
|
|
tp28xx_byte_write(chip, 0x0d, 0x50);
|
|
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp &= 0x9f;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
tp28xx_byte_write(chip, 0x15, 0x23);
|
|
tp28xx_byte_write(chip, 0x16, 0xf8);
|
|
tp28xx_byte_write(chip, 0x18, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x68);
|
|
tp28xx_byte_write(chip, 0x21, 0x84);
|
|
tp28xx_byte_write(chip, 0x22, 0x36);
|
|
tp28xx_byte_write(chip, 0x22, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xda);
|
|
tp28xx_byte_write(chip, 0x28, 0x00);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2c, 0x0a);
|
|
tp28xx_byte_write(chip, 0x2d, 0x84);
|
|
tp28xx_byte_write(chip, 0x2e, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x75);
|
|
tp28xx_byte_write(chip, 0x31, 0x39);
|
|
tp28xx_byte_write(chip, 0x32, 0xc0);
|
|
tp28xx_byte_write(chip, 0x33, 0x32);
|
|
|
|
tp28xx_byte_write(chip, 0x38, 0x40);
|
|
tp28xx_byte_write(chip, 0x39, 0x48);
|
|
tp28xx_byte_write(chip, 0x3a, 0x12);
|
|
tp28xx_byte_write(chip, 0x3b, 0x26);
|
|
}
|
|
/////HDA 8M15
|
|
static void TP2829_A8MP15_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x00);
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x74);
|
|
//tp28xx_byte_write(chip, 0x18, 0x32);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
//tp28xx_byte_write(chip, 0x21, 0x86);
|
|
//tp28xx_byte_write(chip, 0x22, 0x36);
|
|
|
|
//tp28xx_byte_write(chip, 0x25, 0xff);
|
|
tp28xx_byte_write(chip, 0x26, 0x05);
|
|
tp28xx_byte_write(chip, 0x27, 0xad);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2d, 0x58);
|
|
tp28xx_byte_write(chip, 0x2e, 0x48);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x68);
|
|
tp28xx_byte_write(chip, 0x32, 0x43);
|
|
tp28xx_byte_write(chip, 0x33, 0x00);
|
|
//tp28xx_byte_write(chip, 0x35, 0x15);
|
|
tp28xx_byte_write(chip, 0x39, 0x40);
|
|
}
|
|
static void tp282x_SYSCLK_V2(struct i2c_dev * chip, unsigned char ch)
|
|
{
|
|
unsigned char tmp, i;
|
|
|
|
|
|
if(SDR_2CH == output || DDR_4CH == output)
|
|
{
|
|
|
|
}
|
|
else if(DDR_2CH == output )
|
|
{
|
|
if( TP2828 == id )
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x46);
|
|
tmp |= TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x46, tmp);
|
|
tmp = tp28xx_byte_read(chip,0x47);
|
|
tmp |= TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x47, tmp);
|
|
tmp = tp28xx_byte_read(chip,0x49);
|
|
tmp |= TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x49, tmp);
|
|
/*
|
|
tmp = tp28xx_byte_read(chip,0x46);
|
|
tmp |= SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x46, tmp);
|
|
|
|
if(CH_1 == ch || CH_2 == ch)
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x47);
|
|
tmp |= SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x47, tmp);
|
|
}
|
|
else if(CH_3 == ch || CH_4 == ch)
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x49);
|
|
tmp |= SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x49, tmp);
|
|
}
|
|
else //ch_all
|
|
{
|
|
tp28xx_byte_write(chip, 0x47, 0x03);
|
|
tp28xx_byte_write(chip, 0x49, 0x0c);
|
|
}
|
|
*/
|
|
}
|
|
|
|
}
|
|
else if(SDR_1CH == output)
|
|
{
|
|
if(TP2828 == id)
|
|
{
|
|
if( ch >= CH_ALL)
|
|
{
|
|
for(i = 0; i < 2; i++) //two ports
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[i*2]);
|
|
tmp &= CLK_AND[i*2];
|
|
tmp |= CLK_MODE[i*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[i*2], tmp);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[(ch%2)*2]);
|
|
tmp &= CLK_AND[(ch%2)*2];
|
|
tmp |= CLK_MODE[(ch%2)*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[(ch%2)*2], tmp);
|
|
}
|
|
}
|
|
|
|
}
|
|
else if(DDR_1CH == output)
|
|
{
|
|
if(TP2828 == id)
|
|
{
|
|
if( ch >= CH_ALL)
|
|
{
|
|
for(i = 0; i < 2; i++) //two ports
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[i*2]);
|
|
tmp &= CLK_AND[i*2];
|
|
tmp |= CLK_MODE[i*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[i*2], tmp);
|
|
//tp28xx_byte_write(chip, 0xf6+i*2, SDR1_SEL[i]);
|
|
tp28xx_byte_write(chip, DAT_ADDR[i*2], SDR1_SEL[i]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[(ch%2)*2]);
|
|
tmp &= CLK_AND[(ch%2)*2];
|
|
tmp |= CLK_MODE[(ch%2)*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[(ch%2)*2], tmp);
|
|
//tp28xx_byte_write(chip, 0xf6+(ch%2)*2, SDR1_SEL[ch]);
|
|
tp28xx_byte_write(chip, DAT_ADDR[(ch%2)*2], SDR1_SEL[ch]);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
static void tp282x_SYSCLK_V1(struct i2c_dev * chip, unsigned char ch)
|
|
{
|
|
unsigned char tmp, i;
|
|
|
|
if(SDR_2CH == output || DDR_4CH == output)
|
|
{
|
|
if( id >= TP2822 )
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0x35); //to match 3M/5M
|
|
tmp |= 0x40;
|
|
//tp28xx_byte_write(chip, 0x35, tmp);
|
|
}
|
|
}
|
|
else if(DDR_2CH == output )
|
|
{
|
|
if( TP2828 == id)
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x46);
|
|
tmp &= ~TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x46, tmp);
|
|
tmp = tp28xx_byte_read(chip,0x47);
|
|
tmp &= ~TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x47, tmp);
|
|
tmp = tp28xx_byte_read(chip,0x49);
|
|
tmp &= ~TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x49, tmp);
|
|
/*
|
|
tmp = tp28xx_byte_read(chip,0x46);
|
|
tmp &= ~SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x46, tmp);
|
|
|
|
if(CH_1 == ch || CH_2 == ch)
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x47);
|
|
tmp &= ~SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x47, tmp);
|
|
}
|
|
else if(CH_3 == ch || CH_4 == ch)
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x49);
|
|
tmp &= ~SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x49, tmp);
|
|
}
|
|
else //ch_all
|
|
{
|
|
tp28xx_byte_write(chip, 0x47, 0x00);
|
|
tp28xx_byte_write(chip, 0x49, 0x00);
|
|
}
|
|
*/
|
|
}
|
|
|
|
}
|
|
else if(SDR_1CH == output)
|
|
{
|
|
if(TP2826 == id || TP2826C == id || TP2828 == id)
|
|
{
|
|
if( ch >= CH_ALL)
|
|
{
|
|
for(i = 0; i < 2; i++) //two ports
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[i*2]);
|
|
tmp &= CLK_AND[i*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[i*2], tmp);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[(ch%2)*2]);
|
|
tmp &= CLK_AND[(ch%2)*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[(ch%2)*2], tmp);
|
|
}
|
|
}
|
|
|
|
}
|
|
else if(DDR_1CH == output)
|
|
{
|
|
if(TP2826 == id || TP2826C == id || TP2828 == id)
|
|
{
|
|
if( ch >= CH_ALL)
|
|
{
|
|
for(i = 0; i < 2; i++) //two ports
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[i*2]);
|
|
tmp &= CLK_AND[i*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[i*2], tmp);
|
|
//tp28xx_byte_write(chip, 0xf6+i*2, SDR1_SEL[i]);
|
|
tp28xx_byte_write(chip, DAT_ADDR[i*2], SDR1_SEL[i]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[(ch%2)*2]);
|
|
tmp &= CLK_AND[(ch%2)*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[(ch%2)*2], tmp);
|
|
//tp28xx_byte_write(chip, 0xf6+(ch%2)*2, SDR1_SEL[ch]);
|
|
tp28xx_byte_write(chip, DAT_ADDR[(ch%2)*2], SDR1_SEL[ch]);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
static void tp282x_SYSCLK_V3(struct i2c_dev * chip, unsigned char ch)
|
|
{
|
|
unsigned char tmp, i;
|
|
|
|
if(DDR_1CH == output)
|
|
{
|
|
if(TP2826C == id || TP2828 == id)
|
|
{
|
|
if( ch >= CH_ALL)
|
|
{
|
|
for(i = 0; i < 2; i++) //two ports
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[i*2]);
|
|
tmp &= CLK_AND[i*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[i*2], tmp);
|
|
tp28xx_byte_write(chip, DAT_ADDR[i*2], TP2827C_DDR1_SEL[i]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[(ch%2)*2]);
|
|
tmp &= CLK_AND[(ch%2)*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[(ch%2)*2], tmp);
|
|
tp28xx_byte_write(chip, DAT_ADDR[(ch%2)*2], TP2827C_DDR1_SEL[ch]);
|
|
}
|
|
}
|
|
|
|
}
|
|
else if(DDR_2CH == output)
|
|
{
|
|
if(TP2826 == id || TP2826C == id || TP2828 == id)
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0x35);
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x35, tmp);
|
|
|
|
tmp = tp28xx_byte_read(chip,0x46);
|
|
tmp &= ~TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x46, tmp);
|
|
tmp = tp28xx_byte_read(chip,0x47);
|
|
tmp &= ~TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x47, tmp);
|
|
tmp = tp28xx_byte_read(chip,0x49);
|
|
tmp &= ~TP2826_DDR2CH_MUX[ch];
|
|
tp28xx_byte_write(chip, 0x49, tmp);
|
|
/*
|
|
tmp = tp28xx_byte_read(chip,0x46);
|
|
tmp &= ~SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x46, tmp);
|
|
|
|
if(CH_1 == ch || CH_2 == ch)
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x47);
|
|
tmp &= ~SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x47, tmp);
|
|
}
|
|
else if(CH_3 == ch || CH_4 == ch)
|
|
{
|
|
tmp = tp28xx_byte_read(chip,0x49);
|
|
tmp &= ~SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0x49, tmp);
|
|
}
|
|
else //ch_all
|
|
{
|
|
tp28xx_byte_write(chip, 0x47, 0x00);
|
|
tp28xx_byte_write(chip, 0x49, 0x00);
|
|
}
|
|
*/
|
|
}
|
|
|
|
}
|
|
else if(SDR_1CH == output)
|
|
{ if(TP2826 == id || TP2826C == id || TP2828 == id)
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0x35); //
|
|
tmp |= 0x40;
|
|
tp28xx_byte_write(chip, 0x35, tmp);
|
|
|
|
if( ch >= CH_ALL)
|
|
{
|
|
for(i = 0; i < 2; i++) //two ports
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[i*2]);
|
|
tmp &= CLK_AND[i*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[i*2], tmp);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
tmp = tp28xx_byte_read(chip,CLK_ADDR[(ch%2)*2]);
|
|
tmp &= CLK_AND[(ch%2)*2];
|
|
tp28xx_byte_write(chip, CLK_ADDR[(ch%2)*2], tmp);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
static void TP2826_C1080P25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x50);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0x5a);
|
|
tp28xx_byte_write(chip, 0x28, 0x04);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x54);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x41);
|
|
tp28xx_byte_write(chip, 0x31, 0x82);
|
|
tp28xx_byte_write(chip, 0x32, 0x27);
|
|
tp28xx_byte_write(chip, 0x33, 0xa2);
|
|
|
|
}
|
|
static void TP2826_C720P25_DataSet(struct i2c_dev * chip)
|
|
{
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x3a);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0x5a);
|
|
tp28xx_byte_write(chip, 0x28, 0x04);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
tp28xx_byte_write(chip, 0x2d, 0x36);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x67);
|
|
tp28xx_byte_write(chip, 0x32, 0x6f);
|
|
tp28xx_byte_write(chip, 0x33, 0x33);
|
|
|
|
}
|
|
static void TP2826_C720P50_DataSet(struct i2c_dev * chip)
|
|
{
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x3a);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0x5a);
|
|
tp28xx_byte_write(chip, 0x28, 0x04);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x42);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x41);
|
|
tp28xx_byte_write(chip, 0x31, 0x82);
|
|
tp28xx_byte_write(chip, 0x32, 0x27);
|
|
tp28xx_byte_write(chip, 0x33, 0xa3);
|
|
|
|
}
|
|
static void TP2826_C1080P30_DataSet(struct i2c_dev * chip)
|
|
{
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x3c);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0x5a);
|
|
tp28xx_byte_write(chip, 0x28, 0x04);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x4c);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x41);
|
|
tp28xx_byte_write(chip, 0x31, 0x82);
|
|
tp28xx_byte_write(chip, 0x32, 0x27);
|
|
tp28xx_byte_write(chip, 0x33, 0xa4);
|
|
|
|
}
|
|
static void TP2826_C720P30_DataSet(struct i2c_dev * chip)
|
|
{
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x30);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0x5a);
|
|
tp28xx_byte_write(chip, 0x28, 0x04);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x37);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x48);
|
|
tp28xx_byte_write(chip, 0x31, 0x67);
|
|
tp28xx_byte_write(chip, 0x32, 0x6f);
|
|
tp28xx_byte_write(chip, 0x33, 0x30);
|
|
|
|
}
|
|
static void TP2826_C720P60_DataSet(struct i2c_dev * chip)
|
|
{
|
|
|
|
tp28xx_byte_write(chip, 0x13, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x30);
|
|
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
tp28xx_byte_write(chip, 0x27, 0x5a);
|
|
tp28xx_byte_write(chip, 0x28, 0x04);
|
|
|
|
tp28xx_byte_write(chip, 0x2b, 0x60);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x37);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x41);
|
|
tp28xx_byte_write(chip, 0x31, 0x82);
|
|
tp28xx_byte_write(chip, 0x32, 0x27);
|
|
tp28xx_byte_write(chip, 0x33, 0xa0);
|
|
|
|
}
|
|
static void TP2826_A720P60_DataSet(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp;
|
|
|
|
tmp = tp28xx_byte_read(chip, 0x14);
|
|
tmp |= 0x60;
|
|
tp28xx_byte_write(chip, 0x14, tmp);
|
|
|
|
tp28xx_byte_write(chip, 0x20, 0x38);
|
|
tp28xx_byte_write(chip, 0x21, 0x46);
|
|
|
|
tp28xx_byte_write(chip, 0x25, 0xfe);
|
|
tp28xx_byte_write(chip, 0x26, 0x01);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x44);
|
|
tp28xx_byte_write(chip, 0x2e, 0x40);
|
|
|
|
tp28xx_byte_write(chip, 0x30, 0x29);
|
|
tp28xx_byte_write(chip, 0x31, 0x62);
|
|
tp28xx_byte_write(chip, 0x32, 0x78);
|
|
tp28xx_byte_write(chip, 0x33, 0x10);
|
|
|
|
//tp28xx_byte_write(chip, 0x3B, 0x05);
|
|
}
|
|
|
|
static int tp2802_set_video_mode(struct i2c_dev * chip, unsigned char mode, unsigned char ch, unsigned char std)
|
|
{
|
|
int err=0;
|
|
unsigned int tmp;
|
|
|
|
if(STD_HDA_DEFAULT == std) std = STD_HDA;
|
|
|
|
// Set Page Register to the appropriate Channel
|
|
tp2802_set_reg_page(chip, ch);
|
|
|
|
//if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x05);
|
|
|
|
//switch(mode)
|
|
switch(mode&(~FLAG_HALF_MODE))
|
|
{
|
|
case TP2802_HALF1080P25:
|
|
//tp28xx_byte_write(chip, 0x35, 0x45);
|
|
case TP2802_1080P25:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp2802_set_work_mode_1080p25(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
|
|
{
|
|
tp28xx_byte_write(chip, 0x55, 0xb5);
|
|
tp28xx_byte_write(chip, 0x6e, 0xb5);
|
|
tp28xx_byte_write(chip, 0x8b, 0xff);
|
|
tp28xx_byte_write(chip, 0x8c, 0xb5);
|
|
tp28xx_byte_write(chip, 0x8e, 0xf3);
|
|
tp28xx_byte_write(chip, 0x91, 0xff);
|
|
tp28xx_byte_write(chip, 0x92, 0x55);
|
|
tp28xx_byte_write(chip, 0x93, 0x07);
|
|
tp28xx_byte_write(chip, 0x94, 0xc4);
|
|
tp28xx_byte_write(chip, 0x95, 0x58);
|
|
}
|
|
if( STD_HDA == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_A1080P25_DataSet(chip);
|
|
}
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2826_C1080P25_DataSet(chip);
|
|
}
|
|
if(STD_HDC == std) //HDC 1080p25 position adjust
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x84);
|
|
if( TP2828 == id || TP2829 == id)
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x60);
|
|
tp28xx_byte_write(chip, 0x17, 0x80);
|
|
tp28xx_byte_write(chip, 0x18, 0x29);
|
|
tp28xx_byte_write(chip, 0x19, 0x38);
|
|
tp28xx_byte_write(chip, 0x1A, 0x47);
|
|
//tp28xx_byte_write(chip, 0x1C, 0x0a);
|
|
//tp28xx_byte_write(chip, 0x1D, 0x50);
|
|
tp28xx_byte_write(chip, 0x1C, 0x09);
|
|
tp28xx_byte_write(chip, 0x1D, 0x60);
|
|
}
|
|
}
|
|
}
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_HALF1080P30:
|
|
//tp28xx_byte_write(chip, 0x35, 0x45);
|
|
case TP2802_1080P30:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp2802_set_work_mode_1080p30(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
if( STD_HDA == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_A1080P30_DataSet(chip);
|
|
}
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2826_C1080P30_DataSet(chip);
|
|
}
|
|
if(STD_HDC == std) //HDC 1080p30 position adjust
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x44);
|
|
if(TP2827 == id || TP2826 == id || TP2816 == id || TP2827C == id || TP2826C == id || TP2828 == id || TP2829 == id)
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x60);
|
|
tp28xx_byte_write(chip, 0x17, 0x80);
|
|
tp28xx_byte_write(chip, 0x18, 0x29);
|
|
tp28xx_byte_write(chip, 0x19, 0x38);
|
|
tp28xx_byte_write(chip, 0x1A, 0x47);
|
|
tp28xx_byte_write(chip, 0x1C, 0x09);
|
|
tp28xx_byte_write(chip, 0x1D, 0x60);
|
|
}
|
|
}
|
|
}
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_HALF720P25:
|
|
//tp28xx_byte_write(chip, 0x35, 0x45);
|
|
case TP2802_720P25:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp2802_set_work_mode_720p25(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x02;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_HALF720P30:
|
|
//tp28xx_byte_write(chip, 0x35, 0x45);
|
|
case TP2802_720P30:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp2802_set_work_mode_720p30(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x02;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_HALF720P50:
|
|
//tp28xx_byte_write(chip, 0x35, 0x45);
|
|
case TP2802_720P50:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp2802_set_work_mode_720p50(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x02;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
if(STD_HDA == std)
|
|
{
|
|
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2826_C720P50_DataSet(chip);
|
|
}
|
|
if(STD_HDC == std) //HDC 720p50 position adjust
|
|
{
|
|
tp28xx_byte_write(chip, 0x16, 0x40);
|
|
if( TP2828 == id || TP2829 == id)
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x0a);
|
|
tp28xx_byte_write(chip, 0x17, 0x00);
|
|
tp28xx_byte_write(chip, 0x18, 0x19);
|
|
tp28xx_byte_write(chip, 0x19, 0xd0);
|
|
tp28xx_byte_write(chip, 0x1A, 0x25);
|
|
tp28xx_byte_write(chip, 0x1C, 0x06);
|
|
tp28xx_byte_write(chip, 0x1D, 0x7a);
|
|
}
|
|
}
|
|
}
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_HALF720P60:
|
|
//tp28xx_byte_write(chip, 0x35, 0x45);
|
|
case TP2802_720P60:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tp2802_set_work_mode_720p60(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x02;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
if(STD_HDA == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2826_A720P60_DataSet(chip);
|
|
}
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2826_C720P60_DataSet(chip);
|
|
}
|
|
if(STD_HDC == std) //HDC 720p60 position adjust
|
|
{
|
|
tp28xx_byte_write(chip, 0x16, 0x02);
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x08);
|
|
tp28xx_byte_write(chip, 0x17, 0x00);
|
|
tp28xx_byte_write(chip, 0x18, 0x19);
|
|
tp28xx_byte_write(chip, 0x19, 0xd0);
|
|
tp28xx_byte_write(chip, 0x1A, 0x25);
|
|
tp28xx_byte_write(chip, 0x1C, 0x06);
|
|
tp28xx_byte_write(chip, 0x1D, 0x72);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_720P30V2:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x25);
|
|
tp2802_set_work_mode_720p60(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x02;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp |= SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V2_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V2_DataSet(chip);
|
|
|
|
if(STD_HDA == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_A720P30_DataSet(chip);
|
|
}
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2826_C720P30_DataSet(chip);
|
|
}
|
|
if(STD_HDC == std) //HDC 720p30 position adjust
|
|
{
|
|
tp28xx_byte_write(chip, 0x16, 0x02);
|
|
if( TP2828 == id || TP2829 == id)
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x08);
|
|
tp28xx_byte_write(chip, 0x17, 0x00);
|
|
tp28xx_byte_write(chip, 0x18, 0x19);
|
|
tp28xx_byte_write(chip, 0x19, 0xd0);
|
|
tp28xx_byte_write(chip, 0x1A, 0x25);
|
|
tp28xx_byte_write(chip, 0x1C, 0x06);
|
|
tp28xx_byte_write(chip, 0x1D, 0x72);
|
|
}
|
|
}
|
|
}
|
|
|
|
tp282x_SYSCLK_V2(chip, ch);
|
|
break;
|
|
|
|
case TP2802_720P25V2:
|
|
if(id >= TP2822) tp28xx_byte_write(chip, 0x35, 0x25);
|
|
tp2802_set_work_mode_720p50(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x02;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp |= SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V2_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V2_DataSet(chip);
|
|
|
|
if(STD_HDA == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_A720P25_DataSet(chip);
|
|
}
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2826_C720P25_DataSet(chip);
|
|
}
|
|
if(STD_HDC == std) //HDC 720p25 position adjust
|
|
{
|
|
tp28xx_byte_write(chip, 0x16, 0x40);
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
tp28xx_byte_write(chip, 0x15, 0x13);
|
|
tp28xx_byte_write(chip, 0x16, 0x0a);
|
|
tp28xx_byte_write(chip, 0x17, 0x00);
|
|
tp28xx_byte_write(chip, 0x18, 0x19);
|
|
tp28xx_byte_write(chip, 0x19, 0xd0);
|
|
tp28xx_byte_write(chip, 0x1A, 0x25);
|
|
tp28xx_byte_write(chip, 0x1C, 0x06);
|
|
tp28xx_byte_write(chip, 0x1D, 0x7a);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
tp282x_SYSCLK_V2(chip, ch);
|
|
break;
|
|
|
|
case TP2802_PAL:
|
|
tp28xx_byte_write(chip, 0x35, 0x25);
|
|
tp2802_set_work_mode_PAL(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x07;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp |= SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_PAL_DataSet(chip);
|
|
if(TP2829 == id) TP2829_PAL_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_NTSC:
|
|
tp28xx_byte_write(chip, 0x35, 0x25);
|
|
tp2802_set_work_mode_NTSC(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tmp |=0x07;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp |= SYS_MODE[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_NTSC_DataSet(chip);
|
|
if(TP2829 == id) TP2829_NTSC_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V2(chip, ch);
|
|
break;
|
|
|
|
case TP2802_3M18:
|
|
tp28xx_byte_write(chip, 0x35, 0x16);
|
|
tp28xx_byte_write(chip, 0x36, 0x30);
|
|
tp2802_set_work_mode_3M(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_5M12:
|
|
tp28xx_byte_write(chip, 0x35, 0x17);
|
|
tp28xx_byte_write(chip, 0x36, 0xD0);
|
|
tp2802_set_work_mode_5M(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
if( STD_HDA == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_A5MP12_DataSet(chip);
|
|
}
|
|
}
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_4M15:
|
|
tp28xx_byte_write(chip, 0x35, 0x16);
|
|
tp28xx_byte_write(chip, 0x36, 0x72);
|
|
tp2802_set_work_mode_4M(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_3M20:
|
|
tp28xx_byte_write(chip, 0x35, 0x16);
|
|
tp28xx_byte_write(chip, 0x36, 0x72);
|
|
tp2802_set_work_mode_3M20(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
tp28xx_byte_write(chip, 0x2d, 0x26);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_4M12:
|
|
tp28xx_byte_write(chip, 0x35, 0x17);
|
|
tp28xx_byte_write(chip, 0x36, 0x08);
|
|
tp2802_set_work_mode_4M12(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_6M10:
|
|
tp28xx_byte_write(chip, 0x35, 0x17);
|
|
tp28xx_byte_write(chip, 0x36, 0xbc);
|
|
tp2802_set_work_mode_6M10(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
|
|
case TP2802_QHD30:
|
|
tp28xx_byte_write(chip, 0x35, 0x15);
|
|
tp28xx_byte_write(chip, 0x36, 0xdc);
|
|
//tp2802_set_work_mode_4MH30(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
|
|
if(TP2828 == id) {tp2802_set_work_mode_QHD30(chip); TP2829_QHDP30_25_DataSet(chip);}
|
|
if(TP2829 == id) {tp2802_set_work_mode_QHD30(chip); TP2829_QHDP30_25_DataSet(chip);}
|
|
|
|
if( STD_HDA == std)
|
|
{
|
|
|
|
if(TP2828 == id) TP2829_AQHDP30_DataSet(chip);
|
|
if(TP2829 == id) TP2829_AQHDP30_DataSet(chip);
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
|
|
if(TP2828 == id) TP2829_CQHDP30_DataSet(chip);
|
|
if(TP2829 == id) TP2829_CQHDP30_DataSet(chip);
|
|
}
|
|
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
break;
|
|
case TP2802_QHD25:
|
|
tp28xx_byte_write(chip, 0x35, 0x15);
|
|
tp28xx_byte_write(chip, 0x36, 0xdc);
|
|
//tp2802_set_work_mode_4MH25(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
|
|
if(TP2828 == id) {tp2802_set_work_mode_QHD25(chip); TP2829_QHDP30_25_DataSet(chip);}
|
|
if(TP2829 == id) {tp2802_set_work_mode_QHD25(chip); TP2829_QHDP30_25_DataSet(chip);}
|
|
if( STD_HDA == std)
|
|
{
|
|
|
|
if(TP2828 == id) TP2829_AQHDP25_DataSet(chip);
|
|
if(TP2829 == id) TP2829_AQHDP25_DataSet(chip);
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
|
|
if(TP2828 == id) TP2829_CQHDP25_DataSet(chip);
|
|
if(TP2829 == id) TP2829_CQHDP25_DataSet(chip);
|
|
}
|
|
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
break;
|
|
case TP2802_QHD15:
|
|
tp28xx_byte_write(chip, 0x35, 0x15);
|
|
tp28xx_byte_write(chip, 0x36, 0xdc);
|
|
tp2802_set_work_mode_QHD15(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
if( STD_HDA == std)
|
|
{
|
|
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_AQHDP15_DataSet(chip);
|
|
}
|
|
}
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
case TP2802_QXGA18:
|
|
tp28xx_byte_write(chip, 0x35, 0x16);
|
|
tp28xx_byte_write(chip, 0x36, 0x72);
|
|
tp2802_set_work_mode_3M(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
if(TP2828 == id) TP2829_V1_DataSet(chip);
|
|
if(TP2829 == id) TP2829_V1_DataSet(chip);
|
|
if( STD_HDA == std )
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_AQXGAP18_DataSet(chip);
|
|
}
|
|
}
|
|
tp282x_SYSCLK_V1(chip, ch);
|
|
break;
|
|
case TP2802_QXGA25:
|
|
tp28xx_byte_write(chip, 0x35, 0x16);
|
|
tp28xx_byte_write(chip, 0x36, 0x72);
|
|
//tp2802_set_work_mode_QXGAH25(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
|
|
if(TP2828 == id) {tp2802_set_work_mode_QXGA25(chip); TP2829_AQXGAP25_DataSet(chip);}
|
|
if(TP2829 == id) {tp2802_set_work_mode_QXGA25(chip); TP2829_AQXGAP25_DataSet(chip);}
|
|
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
break;
|
|
case TP2802_QXGA30:
|
|
tp28xx_byte_write(chip, 0x35, 0x16);
|
|
tp28xx_byte_write(chip, 0x36, 0x71);
|
|
//tp2802_set_work_mode_QXGAH30(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
|
|
if(TP2828 == id) {tp2802_set_work_mode_QXGA30(chip); TP2829_AQXGAP30_DataSet(chip);}
|
|
if(TP2829 == id) {tp2802_set_work_mode_QXGA30(chip); TP2829_AQXGAP30_DataSet(chip);}
|
|
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
break;
|
|
|
|
case TP2802_5M20:
|
|
tp28xx_byte_write(chip, 0x35, 0x17);
|
|
tp28xx_byte_write(chip, 0x36, 0xbc);
|
|
//tp2802_set_work_mode_QXGAH30(chip);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
|
|
if(TP2828 == id) {tp2802_set_work_mode_5M20(chip); TP2829_5MP20_DataSet(chip);}
|
|
if(TP2829 == id) {tp2802_set_work_mode_5M20(chip); TP2829_5MP20_DataSet(chip);}
|
|
if( STD_HDA == std)
|
|
{
|
|
|
|
if(TP2828 == id) TP2829_A5MP20_DataSet(chip);
|
|
if(TP2829 == id) TP2829_A5MP20_DataSet(chip);
|
|
}
|
|
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
//soft reset
|
|
if(STD_TVI == std)
|
|
{
|
|
tmp = tp28xx_byte_read(chip, 0x06);
|
|
tmp |=0x80;
|
|
tp28xx_byte_write(chip, 0x06, tmp);
|
|
}
|
|
|
|
break;
|
|
|
|
case TP2802_8M15:
|
|
tp28xx_byte_write(chip, 0x35, 0x18);
|
|
tp28xx_byte_write(chip, 0x36, 0xca);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
|
|
if(TP2828 == id) {tp2802_set_work_mode_8M15(chip); TP2829_8MP15_DataSet(chip);}
|
|
if(TP2829 == id) {tp2802_set_work_mode_8M15(chip); TP2829_8MP15_DataSet(chip);}
|
|
if( STD_HDA == std)
|
|
{
|
|
|
|
if(TP2828 == id) TP2829_A8MP15_DataSet(chip);
|
|
if(TP2829 == id) TP2829_A8MP15_DataSet(chip);
|
|
|
|
}
|
|
else if(STD_HDC == std || STD_HDC_DEFAULT == std)
|
|
{
|
|
|
|
if(TP2828 == id) TP2829_C8MP15_DataSet(chip);
|
|
if(TP2829 == id) TP2829_C8MP15_DataSet(chip);
|
|
}
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
break;
|
|
|
|
case TP2802_8M12:
|
|
tp28xx_byte_write(chip, 0x35, 0x18);
|
|
tp28xx_byte_write(chip, 0x36, 0xca);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
|
|
|
|
if(TP2828 == id) {tp2802_set_work_mode_8M12(chip); TP2829_8MP15_DataSet(chip);}
|
|
if(TP2829 == id) {tp2802_set_work_mode_8M12(chip); TP2829_8MP15_DataSet(chip);}
|
|
if( STD_HDA == std)
|
|
{
|
|
|
|
}
|
|
else if(STD_HDC_DEFAULT == std)
|
|
{
|
|
if(TP2828 == id) TP2829_C8MP12_DataSet(chip);
|
|
if(TP2829 == id) TP2829_C8MP12_DataSet(chip);
|
|
}
|
|
else if(STD_HDC == std)
|
|
{
|
|
if(TP2828 == id || TP2829 == id)
|
|
{
|
|
TP2829_C8MP12_DataSet(chip);
|
|
tp28xx_byte_write(chip, 0x1c, 0x13);
|
|
tp28xx_byte_write(chip, 0x1d, 0x10);
|
|
}
|
|
}
|
|
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
break;
|
|
|
|
case TP2802_1080P60:
|
|
tp28xx_byte_write(chip, 0x35, 0x05);
|
|
tmp = tp28xx_byte_read(chip, 0x02);
|
|
tmp &=0xF8;
|
|
tp28xx_byte_write(chip, 0x02, tmp);
|
|
tmp = tp28xx_byte_read(chip, 0xf5);
|
|
tmp &= SYS_AND[ch];
|
|
tp28xx_byte_write(chip, 0xf5, tmp);
|
|
if(TP2828 == id) {TP2829_1080P60_DataSet(chip);}
|
|
if(TP2829 == id) {TP2829_1080P60_DataSet(chip);}
|
|
tp282x_SYSCLK_V3(chip, ch);
|
|
break;
|
|
|
|
default:
|
|
err = -1;
|
|
break;
|
|
}
|
|
|
|
// already set the reg0x35 in SYSCLK_V1/V2/V3 according to output mode.
|
|
//if(mode&FLAG_HALF_MODE)
|
|
//{
|
|
// tmp = tp28xx_byte_read(chip, 0x35);
|
|
// tmp |=0x40;
|
|
// tp28xx_byte_write(chip, 0x35, tmp);
|
|
//}
|
|
|
|
return err;
|
|
}
|
|
static void TP28xx_ChannelID(struct i2c_dev * chip)
|
|
{
|
|
|
|
tp28xx_byte_write(chip, 0x40, 0x00);
|
|
tp28xx_byte_write(chip, 0x34, 0x10);
|
|
tp28xx_byte_write(chip, 0x40, 0x01);
|
|
tp28xx_byte_write(chip, 0x34, 0x11);
|
|
if(DDR_4CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0x40, 0x02);
|
|
tp28xx_byte_write(chip, 0x34, 0x12);
|
|
tp28xx_byte_write(chip, 0x40, 0x03);
|
|
tp28xx_byte_write(chip, 0x34, 0x13);
|
|
}
|
|
else
|
|
{
|
|
tp28xx_byte_write(chip, 0x40, 0x02);
|
|
tp28xx_byte_write(chip, 0x34, 0x10);
|
|
tp28xx_byte_write(chip, 0x40, 0x03);
|
|
tp28xx_byte_write(chip, 0x34, 0x11);
|
|
}
|
|
tp28xx_byte_write(chip, 0x40, 0x00);
|
|
}
|
|
|
|
|
|
static void tp2802_comm_init( struct i2c_dev * chip)
|
|
{
|
|
unsigned int val;
|
|
int i=0;
|
|
tp2802_set_reg_page(chip, CH_ALL);
|
|
|
|
if(TP2828 == id )
|
|
{
|
|
TP2829_reset_default(chip, CH_ALL);
|
|
|
|
TP2828_output(chip);
|
|
|
|
if(SDR_1CH == output)
|
|
{
|
|
tp28xx_byte_write(chip, 0x02, 0x40|sav_head|bt_outputmode); //BT1120/BT656 header
|
|
}
|
|
else
|
|
{
|
|
tp28xx_byte_write(chip, 0x02, 0x40|sav_head|bt_outputmode); //BT656 header
|
|
}
|
|
if(multi_sample_en){
|
|
tp2802_set_video_mode(chip, multi_sample_ch0_fpsmode, CH_1, stdard);
|
|
tp2802_set_video_mode(chip, multi_sample_ch1_fpsmode, CH_2, stdard);
|
|
}else{
|
|
tp2802_set_video_mode(chip, fpsmode, CH_ALL, stdard);
|
|
}
|
|
tp2828_case_setting(chip,CH_ALL);
|
|
TP2829_RX_init(chip, rx_mode);
|
|
for(i=0;i<4;i++)
|
|
{
|
|
viu_mdelay(500);
|
|
tp2802_set_reg_page(chip, CH_1);
|
|
val = tp28xx_byte_read(chip, 0x01);
|
|
printf("detect ad status:0x%x\n",val);
|
|
tp28xx_byte_read(chip, 0x02);
|
|
tp28xx_byte_read(chip, 0x03);
|
|
if(multi_sample_en){
|
|
tp2802_set_reg_page(chip, CH_2);
|
|
val = tp28xx_byte_read(chip, 0x01);
|
|
printf("ch1 detect ad status:0x%x\n",val);
|
|
tp28xx_byte_read(chip, 0x02);
|
|
tp28xx_byte_read(chip, 0x03);
|
|
}
|
|
}
|
|
TP28xx_ChannelID(chip);
|
|
}
|
|
}
|
|
void dump_tp_reg(struct i2c_dev * chip)
|
|
{
|
|
unsigned char tmp=0;
|
|
int i=0;
|
|
viu_mdelay(1000);
|
|
printf("dump ch0 reg============\n");
|
|
tp2802_set_reg_page(chip, CH_1);
|
|
for(i=0;i<=0xff;i++){
|
|
tmp = tp28xx_byte_read(chip,i);
|
|
if(i%16==0)
|
|
printf("0x%02x| ",i);
|
|
printf("%02x ",tmp);
|
|
if(i%16==15)
|
|
printf("\n");
|
|
}
|
|
|
|
if(multi_sample_en){
|
|
printf("dump ch1 reg============\n");
|
|
tp2802_set_reg_page(chip, CH_2);
|
|
for(i=0;i<=0xff;i++){
|
|
tmp = tp28xx_byte_read(chip,i);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
int tp2802_module_init(int mux)
|
|
{
|
|
int val = 0;
|
|
int i=0;
|
|
viu_tpi2c_hw_init(&chip);
|
|
printf("tp2828_module_init:mux:%d\n",mux);
|
|
//page reset
|
|
tp28xx_byte_write(chip, 0x40, 0x00);
|
|
//output disable
|
|
tp28xx_byte_write(chip, 0x4d, 0x00);
|
|
tp28xx_byte_write(chip, 0x4e, 0x00);
|
|
//PLL reset
|
|
val = tp28xx_byte_read(chip, 0x44);
|
|
tp28xx_byte_write(chip, 0x44, val|0x40);
|
|
viu_mdelay(1000);
|
|
tp28xx_byte_write(chip, 0x44, val);
|
|
|
|
val = tp28xx_byte_read(chip, 0xfe);
|
|
if(0x28 == val)
|
|
printf("Detected TP28xx \n");
|
|
else
|
|
printf("Invalid chip %2x\n", val);
|
|
|
|
id = tp28xx_byte_read(chip, 0xff);
|
|
id <<=8;
|
|
id+=tp28xx_byte_read(chip, 0xfd);
|
|
|
|
TP2829_PLL_Reset(chip);
|
|
|
|
printf("Detected ID&revision %04x\n", id);
|
|
id = TP2828;
|
|
tp2802_comm_init(chip);
|
|
|
|
dump_tp_reg(chip);
|
|
|
|
for(i=0;i<5;i++)
|
|
{
|
|
viu_mdelay(500);
|
|
val = tp28xx_byte_read(chip, 0x01);
|
|
printf("detect ad status:0x%x\n",val);
|
|
tp28xx_byte_read(chip, 0x02);
|
|
tp28xx_byte_read(chip, 0x03);
|
|
}
|
|
if(blue_screen_open){
|
|
val = tp28xx_byte_read(chip, 0x2a);
|
|
val = val|BIT(2)|BIT(3);
|
|
tp28xx_byte_write(chip, 0x2a, val);
|
|
}
|
|
printf("TP2828 Driver Init Successful!\n");
|
|
|
|
return 0;
|
|
}
|
|
|