完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
最近调试的PI转EDP项目,下面必须为驱动参考,以下为驱动参考,以下为驱动参考,需要为驱动参考,以下为驱动参考,需要为I2DTS和驱动程序的驱动程序和驱动程序一样,然后
MI2C.c * * *中间设备驱动程序用于I2C (HSHCAL001) * * Copyright (C) 2012 ALPS ELECTRIC CO., LTD. 版权所有。 * * 本软件根据 自由软件基金会发布 的 GNU General Public * License version 2 的条款获得许可,并且 * 可以根据这些条款进行复制、分发和修改。 * * 分发此程序是希望它有用, * 但没有任何保证; 甚至没有对特定用途的适销性或适用性的默示保证。见 * GNU 通用公共许可证了解更多详情。 * */ #include “lt8911.h” 静态 DEFINE_MUTEX(hshcal_lock); 静态结构 platform_device *pdev; 静态结构 input_dev *hshcal_idev; 静态结构延迟工作 hshcal_work; 外部无效 LT8911_EX_init(void); //extern int LT8911EX_ChipID( void ); 枚举 { H_act = 0, V_act, H_tol, V_tol, H_bp, H_sync, V_sync, V_bp }; u8 swing_req = 0x00; #define _MIPI_Lane_ 4 //#define _1080P_eDP_Panel_ 1 //#define _1366x768_eDP_Panel_ #define _1600x900_eDP_Panel_ 1 static int MIPI_Timing[] = // H_act V_act H_total V_total H_BP H_sync V_sync V_BP // {1920, 1080, 2200, 1125, 148, 44, 5, 36};// 1080P Vesa Timing //{ 1920, 1080、2080、1111、80、32、5、16}; {1600、900、1940、926、260、32、5、18}; // 0780 0438 0820 0457 50 20 05 10 #define _1_Lane_ 1 //#define _6_Bit_ColorDepth #define _8_Bit_ColorDepth_ //#define _Test_Pattern_ 1 //#define _SSC_En_ // 扩频时钟 #ifdef _SSC_Enf #define _SSC_ 0x0 的#define _SSC_ 0x07的 #ENDIF 的#define Swing_Level_Close 0×00 #定义Swing_Level_0_H 0×00 #定义Swing_Level_0_L 0XA0 的#define Swing_Level_1_H 0×00 #定义Swing_Level_1_L 0XF0 的#define Swing_Level_2_H 0×01 #定义Swing_Level_2_L 0x40的 #定义Swing_Level_3_H 0×02 #定义Swing_Level_3_L 0xb4 静态U8 DPCD0000H; 静态u8 DPCD0001H; 静态u8 DPCD0002H; 静态u8 DPCD0003H; 静态u8 DPCD0004H; 静态u8 DPCD0005H; 静态u8 DPCD0006H; 静态u8 DPCD0007H; 静态u8 DPCD0008H; 静态u8 DPCD0009H; 静态u8 DPCD000aH; 静态 u8 DPCD000bH; 静态u8 DPCD0200H; 静态u8 DPCD0201H; u8 DPCD0202H; 静态u8 DPCD0203H; 静态u8 DPCD0204H; u8 DPCD0205H; u8 DPCD0206H; u8 计数 = 0x00; u8 Cur_Temp = 0x00; u8 Pre_Temp = 0x00; u8 D_value = 0x00; 静态int flgEnaH = 0; 静态int flgEnaT = 0; 静态int延迟= 200; 静态int flgSuspend = 0; 静态int flgSkip = 1; 开始; 诠释启用; 静态结构 i2c_client *client_hshcal = NULL; 静态 int reset_init(void) { 结构 device_node *np = client_hshcal-》dev.of_node; 枚举_gpio_flags rst_flags,enable_flags; rst = of_get_named_gpio_flags(np, “rst_gpio_number”, 0, &rst_flags); if (gpio_request(rst, “it8911b-reset”) != 0) { return -EIO; } gpio_direction_output(rst, 0); gpio_set_value(rst, 0); enable = of_get_named_gpio_flags(np, “enable_8911_gpio”, 0, &enable_flags); if (gpio_request(rst, “it8911b-enable”) != 0) { return -EIO; } gpio_direction_output(启用,0); gpio_set_value(启用,0); 返回0; } void edp_reset(int val) { gpio_set_value(rst, val); } u8 HDMI_WriteI2C_Byte(u8 reg,u8 数据) { struct i2c_msg xfer_msg[1]; u8 buf[2]; buf[0] = 注册; buf[1]= 数据; xfer_msg[0].addr = client_hshcal-》addr; xfer_msg[0].len = 2; xfer_msg[0].flags = client_hshcal-》flags & I2C_M_TEN; xfer_msg[0].buf = buf; 返回 i2c_transfer(client_hshcal-》adapter, xfer_msg, 1) == 1 ?0:-故障; } int HDMI_ReadI2C_Byte(u8 reg) { /* int err; 整数尝试= 0; u8数据=0; 结构 i2c_msg msgs[] = { { .addr = client_hshcal-》addr, .flags = 0, .len = 1, .buf = reg, }, { .addr = client_hshcal-》addr, .flags = I2C_M_RD, .len = 1, .buf = &data, } , }; 做 { err = i2c_transfer(client_hshcal-》adapter, msgs, 2); } while ((err != 2) && (++tries 《 I2C_RETRIES)); if (err != 2) { dev_err(&client_hshcal-》adapter-》dev, “读取传输错误n”); 返回-1; } else { 返回数据; }*/ 返回 i2c_smbus_read_byte_data(client_hshcal,reg); } void static DpcdWrite(u32地址,u8数据) { u8地址H = 0x0f &(地址》》 16); u8 地址M = 0xff & ( 地址 》》 8 ); u8 地址L = 0xff & 地址; HDMI_WriteI2C_Byte(0xff, 0x80); HDMI_WriteI2C_Byte(0x62, 0xbd); HDMI_WriteI2C_Byte(0x62, 0xbf); // ECO(AUX 复位) HDMI_WriteI2C_Byte(0x36, 0x00); HDMI_WriteI2C_Byte(0x30, 0x0f);//0x10); // 0x0f , 0x10 HDMI_WriteI2C_Byte(0x33, AddressL); HDMI_WriteI2C_Byte(0x34,地址M); HDMI_WriteI2C_Byte(0x35,地址H); HDMI_WriteI2C_Byte(0x37,数据); HDMI_WriteI2C_Byte(0x36, 0x20); } u8 DpcdRead(u32 地址) { u8 read_cnt = 0x03; u8 DpcdValue = 0x00; u8 地址H = 0x0f & ( 地址 》》 16 ); u8 地址M = 0xff & ( 地址 》》 8 ); u8 地址L = 0xff & 地址; HDMI_WriteI2C_Byte(0xff, 0x80); HDMI_WriteI2C_Byte(0x62, 0xbd); HDMI_WriteI2C_Byte(0x62, 0xbf); // ECO(AUX 复位) HDMI_WriteI2C_Byte(0x36, 0x00); HDMI_WriteI2C_Byte(0x30, 0x8f);//0x90); //0x8f, 0x90 HDMI_WriteI2C_Byte(0x33, AddressL); HDMI_WriteI2C_Byte(0x34,地址M); HDMI_WriteI2C_Byte(0x35,地址H); HDMI_WriteI2C_Byte(0x36, 0x20); 延迟(2);//需要的 if( HDMI_ReadI2C_Byte( 0x39 ) == 0x01 ) { DpcdValue = HDMI_ReadI2C_Byte( 0x38 ); }else { while( ( HDMI_ReadI2C_Byte( 0x39 ) != 0x01 ) && ( read_cnt 》 0 ) ) { HDMI_WriteI2C_Byte( 0x36, 0x00 ); HDMI_WriteI2C_Byte(0x36, 0x20); read_cnt--; 延迟(2); } if( HDMI_ReadI2C_Byte( 0x39 ) == 0x01 ) { DpcdValue = HDMI_ReadI2C_Byte( 0x38 ); } } 返回 DpcdValue; } void adj_swing( void ) { u8 ret = 0; swing_req = DPCD0206H & 0x0f; //通道 0 HDMI_WriteI2C_Byte(0xff, 0x81); switch( swing_req ) { case 0x00: //0dB_400mV HDMI_WriteI2C_Byte( 0x18, 0x00 ); HDMI_WriteI2C_Byte(0x19, 0xa0); HDMI_WriteI2C_Byte(0x11, 0x00); ret = 0x01;//0x00; 休息; case 0x01: //0dB_600mV HDMI_WriteI2C_Byte(0x18, 0x00); HDMI_WriteI2C_Byte(0x19, 0xd0); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x00); ret = 0x01; 休息; case 0x02: //0dB_800mV HDMI_WriteI2C_Byte(0x18, 0x01); HDMI_WriteI2C_Byte(0x19, 0x20); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x00); ret = 0x02; 休息; case 0x03: //0dB_1200mV(max 1000mV) HDMI_WriteI2C_Byte(0x18, 0x01); HDMI_WriteI2C_Byte(0x19, 0xa0); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x00); ret = 0x07; 休息; case 0x04: //3.5dB_400mV HDMI_WriteI2C_Byte(0x18, 0x00); HDMI_WriteI2C_Byte(0x19, 0x98); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x08);//0x28); ret = 0x08; 休息; case 0x05: //3.5dB_600mV HDMI_WriteI2C_Byte(0x18, 0x00); HDMI_WriteI2C_Byte(0x19, 0xf0); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x18);//0x38); ret = 0x09; 休息; case 0x06: //3.5dB_800mV HDMI_WriteI2C_Byte(0x18, 0x01); HDMI_WriteI2C_Byte(0x19, 0xa0); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x50);//0x70); ret = 0x0a; 休息; 案例0x07: 中断; case 0x08: //6dB_400mV HDMI_WriteI2C_Byte(0x18, 0x00); HDMI_WriteI2C_Byte(0x19, 0xa0); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x24);//0x44); ret = 0x10; 休息; case 0x09: //6dB_800mV HDMI_WriteI2C_Byte(0x18, 0x01); HDMI_WriteI2C_Byte(0x19, 0x00); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x38);//0x58); ret = 0x11; 休息; 案例 0x0a: 中断; 案例 0x0b: ret = 0x17; 休息; case 0x0c: //9.5dB_400mV HDMI_WriteI2C_Byte(0x18, 0x00); HDMI_WriteI2C_Byte(0x19, 0xc0); //HDMI_WriteI2C_Byte(0x10,0x00); HDMI_WriteI2C_Byte(0x11, 0x58);//0x78); ret = 0x79;//0x78; 休息; 案例0x0d: 中断; 案例0x0e: ret = 0x3a; 休息; 案例0x0f: 中断; 默认值:中断; } DpcdWrite(0x0103, ret); #ifdef _2_Lane_ret = 0x00; swing_req = DPCD0206H & 0xf0; //通道 1 HDMI_WriteI2C_Byte(0xff, 0x81); switch( swing_req ) { case 0x00: //0dB_400mV HDMI_WriteI2C_Byte( 0x1a, 0x00 ); HDMI_WriteI2C_Byte(0x1b,0xa0); HDMI_WriteI2C_Byte(0x13, 0x00); ret = 0x01;//0x00; 休息; case 0x10: //0dB_600mV HDMI_WriteI2C_Byte(0x1a, 0x00); HDMI_WriteI2C_Byte(0x1b,0xd0); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x00); ret = 0x01; 休息; case 0x20: //0dB_800mV HDMI_WriteI2C_Byte(0x1a, 0x01); HDMI_WriteI2C_Byte(0x1b,0x20); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x00); ret = 0x02; 休息; case 0x30: //0dB_1200mV(max 1000mV) HDMI_WriteI2C_Byte(0x1a, 0x01); HDMI_WriteI2C_Byte(0x1b,0xa0); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x00); ret = 0x07; 休息; case 0x40: //3.5dB_400mV HDMI_WriteI2C_Byte(0x1a, 0x00); HDMI_WriteI2C_Byte(0x1b,0x98); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x08);//0x28); ret = 0x08; 休息; case 0x50: //3.5dB_600mV HDMI_WriteI2C_Byte(0x1a, 0x00); HDMI_WriteI2C_Byte(0x1b,0xf0); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x18);//0x38); ret = 0x09; 休息; case 0x60: //3.5dB_800mV HDMI_WriteI2C_Byte(0x1a, 0x01); HDMI_WriteI2C_Byte(0x1b,0xa0); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x50);//0x70); ret = 0x0a; 休息; 案例 0x70: 休息; case 0x80: //6dB_400mV HDMI_WriteI2C_Byte(0x1a, 0x00); HDMI_WriteI2C_Byte(0x1b,0xa0); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x24);//0x44); ret = 0x12; 休息; case 0x90: //6dB_800mV HDMI_WriteI2C_Byte(0x1a, 0x01); HDMI_WriteI2C_Byte(0x1b,0x00); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x38);//0x58); ret = 0x13; 休息; 案例0xa0: 中断; 案例 0xb0: ret = 0x17; 休息; case 0xc0: //9.5dB_400mV HDMI_WriteI2C_Byte(0x1a, 0x00); HDMI_WriteI2C_Byte(0x1b, 0xc0); //HDMI_WriteI2C_Byte(0x12,0x00); HDMI_WriteI2C_Byte(0x13, 0x58);//0x78); ret = 0x79;//0x78; 休息; 案例0xd0: 中断; 案例0xe0: ret = 0x3a; 休息; 案例0xf0: 中断; 默认值:中断; } DpcdWrite(0x0104, ret); #endif } 无效 LT8911_AUX_Training(无效) { u8 swing_adj_cnt = 0x00; DPCD0202H = 0x00; DPCD0000H = DpcdRead(0x0000); DPCD0200H = DpcdRead(0x0200); DPCD0201H = DpcdRead(0x0201); DPCD0202H = DpcdRead(0x0202); DPCD0203H = DpcdRead(0x0203); DPCD0204H = DpcdRead(0x0204); DPCD0205H = DpcdRead(0x0205); DPCD0000H = DpcdRead(0x0000); DPCD0001H = DpcdRead(0x0001); DPCD0002H = DpcdRead(0x0002); DPCD0003H = DpcdRead(0x0003); DPCD0004H = DpcdRead(0x0004); DPCD0005H = DpcdRead(0x0005); DPCD0006H = DpcdRead(0x0006); DPCD0007H = DpcdRead(0x0007); DPCD0008H = DpcdRead(0x0008); DPCD0009H = DpcdRead(0x0009); DPCD000aH = DpcdRead(0x000a); DPCD000bH = DpcdRead(0x000b); HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x62, 0x3f); //重置dp视频 #ifdef_2_Lane_HDMI_WriteI2C_Byte (0x03,0x42); //41-1lane,42-2lane,44-4lane #endif #ifdef _1_Lane_HDMI_WriteI2C_Byte(0x03, 0x41); //41-1lane,42-2lane,44-4lane #endif |
|
|
|
HDMI_WriteI2C_Byte(0x65, 0xf1);
延迟(5); HDMI_WriteI2C_Byte(0x65, 0xf3); HDMI_WriteI2C_Byte(0x04, 0x14); HDMI_WriteI2C_Byte(0xff, 0x84); //注册银行 // HDMI_WriteI2C_Byte(0x14,0x01); HDMI_WriteI2C_Byte(0x14, 0x81); HDMI_WriteI2C_Byte(0x14, 0x82); DpcdWrite(0x0600, 0x01); 如果(DpcdRead(0x0600)!= 0x01) { DpcdWrite(0x0600,0x01); } DpcdWrite(0x0100, 0x0a); #ifdef _2_Lane_DpcdWrite (0x0101, 0x82); // 2 车道 #endif #ifdef _1_Lane_ DpcdWrite( 0x0101, 0x81 ); // 1 通道 #endif DpcdWrite( 0x010a, 0x00 ); #ifdef _SSC_En_ DpcdWrite(0x0107,0x10);// Main-Link 信号向下扩展 #endif // DpcdWrite(0x0107,0x00); // DpcdWrite(0x0108,0x01); 如果(DpcdRead(0x0100)!= 0x0a) { DpcdWrite(0x0100,0x0a); } #ifdef _2_Lane_ if( DpcdRead( 0x0101 ) != 0x82 ) // 2 Lane { DpcdWrite( 0x0101, 0x82 ); } #endif #ifdef _1_Lane_ if( DpcdRead( 0x0101 ) != 0x81 ) // 1 Lane { DpcdWrite( 0x0101, 0x81 ); } #endif if( DpcdRead( 0x010a ) != 0x00 ) { DpcdWrite( 0x010a, 0x00 ); } // DpcdWrite(0x0102,0x00); DpcdWrite(0x0102, 0x01); // 发送 TPS1 DpcdWrite( 0x0103, 0x01 );//0x00 ); #ifdef _2_Lane_ DpcdWrite(0x0104, 0x01);//0x00); #endif if( DpcdRead( 0x0102 ) != 0x01 ) { DpcdWrite( 0x0102, 0x01 ); } mdelay(16); DPCD0204H = DpcdRead(0x0204); DPCD0202H = DpcdRead(0x0202); swing_adj_cnt = 0x05; #ifdef _2_Lane_DPCD0202H = DPCD0202H & 0x11; // 2 车道 0x11 ; 1 车道 0x01 while( ( (DPCD0202H & 0x11) != 0x11) && ( swing_adj_cnt 》 0 ) ) // 1080P 0x11; 1366 0x01 #endif #ifdef _1_Lane_DPCD0202H = DPCD0202H & 0x01; // 2 车道 0x11 ; 1 车道 0x01 而(((DPCD0202H & 0x01)!= 0x01)&&(swing_adj_cnt》 0))//1080P 0x11;1366 0x01 #endif { DPCD0206H = DpcdRead(0x0206); adj_swing(); swing_adj_cnt--; 延迟(1); DPCD0202H = DpcdRead(0x0202); #ifdef _2_Lane_DPCD0202H = DPCD0202H & 0x11; // 2 车道 0x11 ; 1 通道 0x01 #endif #ifdef _1_Lane_ DPCD0202H = DPCD0202H & 0x01; // 2 车道 0x11 ; 1 通道 0x01 #endif } // HDMI_WriteI2C_Byte(0xff,0x82); //用于调试 // HDMI_WriteI2C_Byte(0x1b,DPCD0202H); #ifdef _2_Lane_ if(DPCD0202H == 0x11) // 2 通道 0x11 ; 1 通道 0x01 #endif #ifdef _1_Lane_ if( DPCD0202H == 0x01 ) // 2 通道 0x11 ; 1 通道 0x01 #endif { HDMI_WriteI2C_Byte( 0xff, 0x80 ); //寄存器组 HDMI_WriteI2C_Byte(0x04, 0x18); HDMI_WriteI2C_Byte(0xff, 0x84); //寄存器库 // HDMI_WriteI2C_Byte(0x14,0x04); HDMI_WriteI2C_Byte(0x14, 0x84); HDMI_WriteI2C_Byte(0x14, 0x88); //0x88 DpcdWrite(0x0102, 0x02); // 发送 TPS2 if( DpcdRead( 0x0102 ) != 0x02 ) { DpcdWrite( 0x0102, 0x02 ); } 延迟(16); DPCD0204H = DpcdRead(0x0204); DPCD0202H = DpcdRead(0x0202); swing_adj_cnt = 0x05; #ifdef _2_Lane_ while( ( ( DPCD0202H & 0x77 ) != 0x77 ) && ( swing_adj_cnt 》 0 ) ) // 2 车道 0x77 ; 1 Lane 0x07 #endif #ifdef _1_Lane_ while( ( ( DPCD0202H & 0x07 ) != 0x07 ) && ( swing_adj_cnt 》 0 ) ) // 2 Lane 0x77 ; 1 通道 0x07 #endif { DPCD0206H = DpcdRead( 0x0206 ); HDMI_WriteI2C_Byte(0xff, 0x84); //寄存器组 HDMI_WriteI2C_Byte(0x14, 0x08); HDMI_WriteI2C_Byte(0x14, 0x88); adj_swing(); swing_adj_cnt--; 延迟(1); DPCD0202H = DpcdRead(0x0202); DPCD0204H = DpcdRead(0x0204); } } // HDMI_WriteI2C_Byte(0xff,0x82);//寄存器库 // HDMI_WriteI2C_Byte(0x1c,DPCD0202H); DpcdWrite(0x0102, 0x00); HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x04, 0x10); HDMI_WriteI2C_Byte(0xff, 0x84); //寄存器组 HDMI_WriteI2C_Byte(0x14, 0x80); HDMI_WriteI2C_Byte(0x14, 0xc0); HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x62, 0xbf); HDMI_WriteI2C_Byte(0xff, 0x88); //寄存器组 if( HDMI_ReadI2C_Byte( 0x24 ) != 0xc0 ) { HDMI_WriteI2C_Byte( 0xff, 0x80 ); //寄存器组 HDMI_WriteI2C_Byte(0x62, 0x3f); HDMI_WriteI2C_Byte(0x62, 0xbf); } //HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器库 //HDMI_WriteI2C_Byte( 0x62, 0xbf ); HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x65, 0xf1); 延迟(5); HDMI_WriteI2C_Byte(0x65, 0xf3); DpcdWrite(0x0102, 0x00); // 发送数据 if( DpcdRead( 0x0102 ) != 0x00 ) { DpcdWrite(0x0102, 0x00); } if( DpcdRead( 0x0600 ) != 0x01 ) { DpcdWrite( 0x0600, 0x01 ); // } if( DpcdRead( 0x010a ) != 0x00 ) { DpcdWrite( 0x010a, 0x00 ); // } DPCD0202H = DpcdRead(0x0202); } 无效 reset_lt8911( 无效 ) { edp_reset(1); 延迟(100); edp_reset(0); 延迟(100); edp_reset(1); 延迟(100); } 无效 LT8911B_Initial( 无效 ) { HDMI_WriteI2C_Byte( 0xff, 0x81 ); //寄存器组 HDMI_WriteI2C_Byte(0x00, 0x04); HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x62, 0x3f); HDMI_WriteI2C_Byte(0x7a,_SSC_);//0x07); HDMI_WriteI2C_Byte(0x71, 0x36); HDMI_WriteI2C_Byte(0x72, 0x00); HDMI_WriteI2C_Byte(0x73, 0x00); HDMI_WriteI2C_Byte(0x63, 0x7f); HDMI_WriteI2C_Byte(0x63, 0xff); ///txpll_analog/// HDMI_WriteI2C_Byte(0xff, 0x81); //寄存器组 HDMI_WriteI2C_Byte(0x0e, 0x37); HDMI_WriteI2C_Byte(0x01, 0x18); HDMI_WriteI2C_Byte(0x02, 0x42); HDMI_WriteI2C_Byte(0x04, 0x00); HDMI_WriteI2C_Byte(0x04, 0x01); HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte( 0x61, 0x7f ); HDMI_WriteI2C_Byte(0x61, 0xff); HDMI_WriteI2C_Byte(0xff, 0x81); //寄存器组 HDMI_WriteI2C_Byte(0x05, 0x13); //txpll_digital HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x74, 0x41); HDMI_WriteI2C_Byte(0x75, 0x03); HDMI_WriteI2C_Byte(0x76, 0x0a); HDMI_WriteI2C_Byte(0x78, 0x0a); //--------------------------------------------// HDMI_WriteI2C_Byte(0xff , 0x81 ); //寄存器组 HDMI_WriteI2C_Byte(0x0e, 0x37); #ifdef _1_Lane_ // 1 通道 eDP 输出 HDMI_WriteI2C_Byte(0x22, 0x11); // 关闭 LANE1 / LANE2 / LANE3 SWING 的电流开关 HDMI_WriteI2C_Byte( 0x23, 0x3e ); // 关闭 LANE1 / LANE2 / LANE3 预加重的电流开关 HDMI_WriteI2C_Byte( 0x25, 0x08 ); HDMI_WriteI2C_Byte(0x18, Swing_Level_0_H); HDMI_WriteI2C_Byte(0x19, Swing_Level_0_L); #else // 2 通道 eDP 输出 HDMI_WriteI2C_Byte(0x22, 0x33); // 关闭 LANE2 / LANE3 SWING 的电流开关 HDMI_WriteI2C_Byte( 0x23, 0x3c ); // 关闭 LANE2 / LANE3 预加重的电流开关 HDMI_WriteI2C_Byte( 0x25, 0x08 ); HDMI_WriteI2C_Byte(0x18, Swing_Level_0_H); HDMI_WriteI2C_Byte(0x19, Swing_Level_0_L); HDMI_WriteI2C_Byte(0x1a, Swing_Level_0_H); HDMI_WriteI2C_Byte(0x1b,Swing_Level_0_L); printk(“[玉剑]------------2lane--edp--outn”); #endif //---------------------------------- // #ifdef _1080P_eDP_Panel_HDMI_WriteI2C_Byte (0xff, 0x90); //寄存器组 HDMI_WriteI2C_Byte(0x4a, 0x33); // 148.5MHz HDMI_WriteI2C_Byte(0x4b, 0x33); HDMI_WriteI2C_Byte(0x4c,0xd3); HDMI_WriteI2C_Byte(0x4d,0x10); printk(“[玉剑]--------1080--edp----n”); #endif #ifdef _1366x768_eDP_Panel_ HDMI_WriteI2C_Byte(0xff, 0x90); //寄存器库 // HDMI_WriteI2C_Byte(0x4a,0x66); // 72MHz // HDMI_WriteI2C_Byte(0x4b,0x66); // HDMI_WriteI2C_Byte(0x4c,0x66); HDMI_WriteI2C_Byte(0x4a, 0xab); // 76.42MHz HDMI_WriteI2C_Byte(0x4b, 0xaf); HDMI_WriteI2C_Byte(0x4c,0x6c); HDMI_WriteI2C_Byte(0x4d,0x10); #endif #ifdef _1600x900_eDP_Panel_HDMI_WriteI2C_Byte (0xff,0x90); HDMI_WriteI2C_Byte(0x4a, 0x65); // 77.82MHz HDMI_WriteI2C_Byte(0x4b, 0xad); HDMI_WriteI2C_Byte(0x4c, 0x6e); //HDMI_WriteI2C_Byte(0x4a, 0xa9); // 77.82MHz //HDMI_WriteI2C_Byte(0x4b, 0xf1); //HDMI_WriteI2C_Byte(0x4c, 0x72); HDMI_WriteI2C_Byte(0x4d,0x10);//0x10: #endif HDMI_WriteI2C_Byte(0xff, 0x81); //寄存器组 HDMI_WriteI2C_Byte(0x09, 0x01); HDMI_WriteI2C_Byte(0x0b,0x0b); HDMI_WriteI2C_Byte(0x08, 0x13); HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x63, 0x7f); HDMI_WriteI2C_Byte(0x63, 0xff); //-----------------主链接---------------------// HDMI_WriteI2C_Byte( 0xff, 0x88 ) ; //寄存器组 HDMI_WriteI2C_Byte( 0x00, 0x6a ); HDMI_WriteI2C_Byte(0x04, 0xff); HDMI_WriteI2C_Byte(0x05,(u8)(MIPI_Timing[H_tol] / 256));//RG_HTOTAL[15:0] HDMI_WriteI2C_Byte( 0x06, (u8)( MIPI_Timing[H_tol] % 256 ) ); //RG_HTOTAL[7:0] HDMI_WriteI2C_Byte( 0x07, (u8)( ( MIPI_Timing[H_bp] + MIPI_Timing[H_sync] ) / 256 ) ); //RG_HSTART [15:8] HDMI_WriteI2C_Byte( 0x08, (u8)( ( MIPI_Timing[H_bp] + MIPI_Timing[H_sync] ) % 256 ) ); //RG_HSTART[7:0]=110 #ifdef _Test_Pattern_ HDMI_WriteI2C_Byte(0x09,(u8)(MIPI_Timing[H_sync] / 256));//[7]RG_HSPOL;[6:0]RG_HSYNC_WIDTH[14:8] 0x80--》0x00 HDMI_WriteI2C_Byte( 0x0a, (u8)( MIPI_Timing[H_sync] % 256 ) ); //RG_HSYNC_WIDTH[7:0]=60 #else HDMI_WriteI2C_Byte(0x09, 0x00); //[7]RG_HSPOL;[6:0]RG_HSYNC_WIDTH[14:8] 0x80--》0x00 HDMI_WriteI2C_Byte(0x0a, 0x00); //RG_HSYNC_WIDTH[7:0]=60 #endif HDMI_WriteI2C_Byte( 0x0b, (u8)( MIPI_Timing[H_act] / 256 ) ); //RG_HWIDTH[15:8] HDMI_WriteI2C_Byte(0x0c,(u8)(MIPI_Timing[H_act]%256));//RG_HWIDTH[7:0] HDMI_WriteI2C_Byte( 0x0d, (u8)( MIPI_Timing[V_tol] / 256 ) ); //RG_VTOTAL [15:8] HDMI_WriteI2C_Byte( 0x0e, (u8)( MIPI_Timing[V_tol] % 256 ) ); //RG_VTOTAL[7:0] HDMI_WriteI2C_Byte(0x0f, 0x00); //RG_TOP_VTOTAL[15:8] //fiexd HDMI_WriteI2C_Byte(0x10, 0x00); //RG_TOP_VTOTAL[7:0] //固定 HDMI_WriteI2C_Byte( 0x11, (u8)( ( MIPI_Timing[V_bp] + MIPI_Timing[V_sync] ) / 256 ) ); //RG_VSTART[15:8] HDMI_WriteI2C_Byte(0x12, (u8)((MIPI_Timing[V_bp] + MIPI_Timing[V_sync])%256));//RG_VSTART[7:0] #ifdef _Test_Pattern_HDMI_WriteI2C_Byte (0x13, (u8)( MIPI_Timing[V_sync] / 256 ) ); //RG_VSPOL;RG_VSYNC_WIDTH[14:8] 0x80--》0x00 HDMI_WriteI2C_Byte( 0x14, (u8)( MIPI_Timing[V_sync] % 256 ) ); //RG_VSYNC_WIDTH[7:0] #else HDMI_WriteI2C_Byte(0x13, 0x00); //RG_VSPOL;RG_VSYNC_WIDTH[14:8] 0x80--》0x00 HDMI_WriteI2C_Byte(0x14, 0x00); //RG_VSYNC_WIDTH[7:0] #endif HDMI_WriteI2C_Byte(0x15,(u8)(MIPI_Timing[V_act] / 256));//RG_VHEIGTH[15:8] HDMI_WriteI2C_Byte( 0x16, (u8)( MIPI_Timing[V_act] % 256 ) ); //RG_VHEIGTH[7:0] |
|
|
|
#ifdef
_6_Bit_ColorDepth_HDMI_WriteI2C_Byte(0x17, 0x00); // LVDS 颜色深度:6 位:0x00 ; 8位:0x08 HDMI_WriteI2C_Byte(0x18,0x00);// LVDS 颜色深度:6 位:0x00 ; 8 位:0x20 #endif #ifdef _8_Bit_ColorDepth_HDMI_WriteI2C_Byte(0x17, 0x08); // LVDS 颜色深度:6 位:0x00 ; 8位:0x08 HDMI_WriteI2C_Byte(0x18, 0x20); // LVDS 颜色深度:6 位:0x00 ; 8位:0x20 #endif HDMI_WriteI2C_Byte(0x19,0x00); HDMI_WriteI2C_Byte(0x1a, 0x80); HDMI_WriteI2C_Byte(0x1e, 0x30); HDMI_WriteI2C_Byte(0x21, 0x00); #ifdef _Test_Pattern_HDMI_WriteI2C_Byte (0x2c, 0xdf); #else HDMI_WriteI2C_Byte(0x2c,0xd0); #endif HDMI_WriteI2C_Byte(0x2d, 0x00); HDMI_WriteI2C_Byte(0x4b,0xfe); HDMI_WriteI2C_Byte(0x2e, (u8)((MIPI_Timing[V_bp] + MIPI_Timing[V_sync])%256));//RG_GCM_DE_TOP[6:0] HDMI_WriteI2C_Byte(0x2f,(u8)((MIPI_Timing[H_bp] + MIPI_Timing[H_sync])/256));//RG_GCM_DE_DLY[11:8] HDMI_WriteI2C_Byte( 0x30, (u8)( ( MIPI_Timing[H_bp] + MIPI_Timing[H_sync] ) % 256 ) ); //RG_GCM_DE_DLY[7:0] HDMI_WriteI2C_Byte( 0x31, (u8)( MIPI_Timing[H_act] / 256 ) ); //RG_GCM_DE_CNT[11:8] HDMI_WriteI2C_Byte( 0x32, (u8)( MIPI_Timing[H_act] % 256 ) ); //RG_GCM_DE_CNT[7:0] HDMI_WriteI2C_Byte( 0x33, (u8)( MIPI_Timing[V_act] / 256 ) ); //RG_GCM_DE_LIN[10:8] HDMI_WriteI2C_Byte(0x34,(u8)(MIPI_Timing[V_act]%256));//RG_GCM_DE_LIN[7:0] HDMI_WriteI2C_Byte( 0x35, (u8)( MIPI_Timing[H_tol] / 256 ) ); //RG_GCM_HTOTAL[11:8] HDMI_WriteI2C_Byte( 0x36, (u8)( MIPI_Timing[H_tol] % 256 ) ); //RG_GCM_HTOTAL[7:0] #ifdef _Test_Pattern_ HDMI_WriteI2C_Byte( 0x37, 0x18 + (u8)( MIPI_Timing[V_tol] / 256 ) ); //1c:pre-pattern,0c:mipi pattern;RG_GCM_VTOTAL[10:8] #else HDMI_WriteI2C_Byte( 0x37, 0x18 + (u8)( MIPI_Timing[V_tol] / 256 ) ); //1c:pre-pattern,0c:mipi 模式;RG_GCM_VTOTAL[10:8] #endif HDMI_WriteI2C_Byte(0x38, (u8)(MIPI_Timing[V_tol] % 256)); //RG_GCM_VTOTAL[7:0] HDMI_WriteI2C_Byte(0x39, 0x00); //reeve HDMI_WriteI2C_Byte( 0x3a, ( (u8)( MIPI_Timing[V_sync] % 256 ) ) * 4 + (u8)( MIPI_Timing[H_sync] / 256 ) ); //RG_GCM_VWIDTH[5:0];RG_GCM_HWIDTH[9:8] HDMI_WriteI2C_Byte( 0x3b, (u8)( MIPI_Timing[H_sync] % 256 ) ); //RG_GCM_HWIDTH[7:0] Nvid// HDMI_WriteI2C_Byte(0xff, 0x8c); //寄存器组 HDMI_WriteI2C_Byte(0x00, 0x00); HDMI_WriteI2C_Byte(0x01, 0x80); HDMI_WriteI2C_Byte(0x02, 0x00); // - - - - - - - - -训练 - - - - - - - - - - - - - - -/ / LT8911_AUX_Training(); printk(“[玉剑]---------lt8911_aux---n”); #ifdef _2_Lane_ if( DPCD0202H != 0x77 ) #endif #ifdef _1_Lane_ if( DPCD0202H != 0x07 ) #endif LT8911_AUX_Training( ); // HDMI_WriteI2C_Byte(0xff,0x88);//寄存器库 // HDMI_WriteI2C_Byte(0x1e,0x30); // HDMI_WriteI2C_Byte(0x4b,0xfe); //------------------------------------------------/ / HDMI_WriteI2C_Byte(0xff, 0x81); //注册银行 HDMI_WriteI2C_Byte(0x32, 0x40); // 0x40 HDMI_WriteI2C_Byte(0x27, 0x80); HDMI_WriteI2C_Byte(0x28, 0xa4); HDMI_WriteI2C_Byte(0x29, 0x66); // 0xd2 HDMI_WriteI2C_Byte(0x2a, 0x04); HDMI_WriteI2C_Byte(0x2b, 0x7e);//0x7f); // 0x7e HDMI_WriteI2C_Byte(0x2c, 0x02); HDMI_WriteI2C_Byte(0x2d, 0x02);//0x7c); // 0x02 HDMI_WriteI2C_Byte(0x2e, 0xaa);//0x00); // 0xaa HDMI_WriteI2C_Byte(0x2f, 0x02); HDMI_WriteI2C_Byte(0x30, 0xaa); HDMI_WriteI2C_Byte(0x31, 0x4b); HDMI_WriteI2C_Byte(0x32, 0x43); // 0x43 HDMI_WriteI2C_Byte(0x33, 0x20); // 0x20 HDMI_WriteI2C_Byte(0x34, 0x01); // MIPI Port B 断电 HDMI_WriteI2C_Byte( 0x35, 0x80 ); HDMI_WriteI2C_Byte(0x36, 0xa4); HDMI_WriteI2C_Byte(0x37, 0xd2); HDMI_WriteI2C_Byte(0x38, 0x00); HDMI_WriteI2C_Byte(0x39, 0x36); HDMI_WriteI2C_Byte(0x3a, 0x00); //--------------------------------------------------------// HDMI_WriteI2C_Byte( 0xff, 0x90 ); //寄存器组 HDMI_WriteI2C_Byte(0x01, 0x01); HDMI_WriteI2C_Byte(0x02, 0x08); // 0x04 HDMI_WriteI2C_Byte(0x03, 0x04); HDMI_WriteI2C_Byte(0x04, 0xc8); HDMI_WriteI2C_Byte(0x05, 0x00); HDMI_WriteI2C_Byte(0x06, 0x0b); HDMI_WriteI2C_Byte(0x0b,_MIPI_Lane_%4);// 00:4 Lane;01:1 Lane;02:2 Lane;03:3 Lane HDMI_WriteI2C_Byte(0x0c, 0x00); // 3210 HDMI_WriteI2C_Byte(0x10, 0x03); HDMI_WriteI2C_Byte(0x11, 0x03); HDMI_WriteI2C_Byte(0x12,(u8)(MIPI_Timing[H_sync]%256)); HDMI_WriteI2C_Byte(0x13,(u8)(MIPI_Timing[V_sync]%256)); HDMI_WriteI2C_Byte(0x14,(u8)(MIPI_Timing[H_act]%256)); HDMI_WriteI2C_Byte(0x15,(u8)(MIPI_Timing[H_act] / 256)); HDMI_WriteI2C_Byte(0x16,(u8)(MIPI_Timing[H_act]%256)); HDMI_WriteI2C_Byte(0x17,(u8)(MIPI_Timing[H_act] / 256)); HDMI_WriteI2C_Byte(0x18, 0x00); HDMI_WriteI2C_Byte(0x19, 0x01); HDMI_WriteI2C_Byte(0x1a,0x17); HDMI_WriteI2C_Byte(0x2b, 0x0b); HDMI_WriteI2C_Byte(0x2c, 0x0c); HDMI_WriteI2C_Byte(0x31,(u8)(MIPI_Timing[H_tol]%256)); HDMI_WriteI2C_Byte(0x32,(u8)(MIPI_Timing[H_tol] / 256)); HDMI_WriteI2C_Byte(0x33,(u8)(MIPI_Timing[V_tol]%256)); HDMI_WriteI2C_Byte(0x34,(u8)(MIPI_Timing[V_tol] / 256)); HDMI_WriteI2C_Byte(0x35,(u8)(MIPI_Timing[V_bp]%256)); HDMI_WriteI2C_Byte(0x36,(u8)(MIPI_Timing[V_bp] / 256)); HDMI_WriteI2C_Byte(0x37,(u8)((MIPI_Timing[V_tol]-MIPI_Timing[V_act]-MIPI_Timing[V_bp]-MIPI_Timing[V_sync])%256)); HDMI_WriteI2C_Byte(0x38,(u8)((MIPI_Timing[V_tol]-MIPI_Timing[V_act]-MIPI_Timing[V_bp]-MIPI_Timing[V_sync])/256)); HDMI_WriteI2C_Byte(0x39, (u8)( MIPI_Timing[H_bp] % 256 ) ); HDMI_WriteI2C_Byte(0x3a,(u8)(MIPI_Timing[H_bp] / 256)); HDMI_WriteI2C_Byte(0x3b,(u8)((MIPI_Timing[H_tol]-MIPI_Timing[H_act]-MIPI_Timing[H_bp]-MIPI_Timing[H_sync])%256)); HDMI_WriteI2C_Byte( 0x3c, (u8)( ( MIPI_Timing[H_tol] - MIPI_Timing[H_act] - MIPI_Timing[H_bp] - MIPI_Timing[H_sync] ) / 256 ) ); printk(“[玉剑]---------1111111--n”); HDMI_WriteI2C_Byte(0x1b,0x5e); HDMI_WriteI2C_Byte(0x1c, 0x01); HDMI_WriteI2C_Byte(0x1d, 0x2c); HDMI_WriteI2C_Byte(0x1e, 0x01); HDMI_WriteI2C_Byte(0x1f, 0xfa); HDMI_WriteI2C_Byte(0x20, 0x00); HDMI_WriteI2C_Byte(0x21, 0xc8); HDMI_WriteI2C_Byte(0x22, 0x00); HDMI_WriteI2C_Byte(0x23, 0x5e); HDMI_WriteI2C_Byte(0x24, 0x01); HDMI_WriteI2C_Byte(0x25, 0x2c); HDMI_WriteI2C_Byte(0x26, 0x01); HDMI_WriteI2C_Byte(0x27, 0xfa); HDMI_WriteI2C_Byte(0x28, 0x00); HDMI_WriteI2C_Byte(0x29, 0xc8); HDMI_WriteI2C_Byte(0x2a, 0x00); HDMI_WriteI2C_Byte(0x3d, 0x64); // HDMI_WriteI2C_Byte(0x3f, 0x00); // printk(“[yujian]---------22222--n”); HDMI_WriteI2C_Byte(0x40, 0x04); HDMI_WriteI2C_Byte(0x41, 0x00); HDMI_WriteI2C_Byte(0x42, 0x59); HDMI_WriteI2C_Byte(0x43, 0x00); HDMI_WriteI2C_Byte(0x44, 0xf2); HDMI_WriteI2C_Byte(0x45, 0x06); HDMI_WriteI2C_Byte(0x46, 0x00); HDMI_WriteI2C_Byte(0x47, 0x72); HDMI_WriteI2C_Byte(0x48, 0x45); HDMI_WriteI2C_Byte(0x49, 0x00); printk(“[玉剑]---------33333--n”); HDMI_WriteI2C_Byte(0x60, 0x08); HDMI_WriteI2C_Byte(0x61, 0x00); HDMI_WriteI2C_Byte(0x62, 0xb2); HDMI_WriteI2C_Byte(0x63, 0x00); HDMI_WriteI2C_Byte(0x64, 0xe4); HDMI_WriteI2C_Byte(0x65, 0x0d); HDMI_WriteI2C_Byte(0x66, 0x00); HDMI_WriteI2C_Byte(0x67, 0xe4); HDMI_WriteI2C_Byte(0x68, 0x8a); HDMI_WriteI2C_Byte(0x69, 0x00); HDMI_WriteI2C_Byte(0x6a,0x0b);// HDMI_WriteI2C_Byte(0x1a, 0x4f); // HDMI_WriteI2C_Byte(0x6b, 0x04); // printk(“[玉剑]---------4444--n”); #ifdef _Test_Pattern_ //前面已经设置过了,这里不需要设置。 // HDMI_WriteI2C_Byte(0x4d,0x10); #else HDMI_WriteI2C_Byte(0xff, 0x90); //寄存器组 HDMI_WriteI2C_Byte(0x4d, 0x00); #endif printk(“[玉剑]---------555555--n”); //----------------------------------------------------// HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x62, 0x3f); //HDMI_WriteI2C_Byte(0x63, 0x3f); //HDMI_WriteI2C_Byte(0x63, 0xbf); //HDMI_WriteI2C_Byte(0x60, 0xde); //HDMI_WriteI2C_Byte(0x60, 0xff); //------------------------------------------------------// printk(“[御剑]---------6666666--n”); /********************** 52 ff 90 00 52 75 01 ff //bit[23:16] 52 76 01 ff //bit[15:8 ] 52 77 01 ff //bit[7:0] ***********************/ //* #ifndef _Test_Pattern_ // 连续读5次0x9076付款,如果数值相差小于3,说明DDS已经调稳。 而(计数 《 3 ) { 计数++; HDMI_WriteI2C_Byte(0xff, 0x90); 延迟(100); Pre_Temp = HDMI_ReadI2C_Byte(0x76); 延迟(100); Cur_Temp = HDMI_ReadI2C_Byte(0x76); printk(“[玉剑]---------77777--n”); D_value = (Cur_Temp 》= Pre_Temp) ? (Cur_Temp - Pre_Temp):(Pre_Temp - Cur_Temp); // 连续读两次0x976次,数值相差大于等于8次,一次0x8063/0x80060次。 while(Dvalue 》 0x008) { Count = 0x8060一次。 HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组 HDMI_WriteI2C_Byte(0x63, 0x7f);//0x3f); HDMI_WriteI2C_Byte(0x63, 0xff);//0xbf); HDMI_WriteI2C_Byte(0x60, 0xde); HDMI_WriteI2C_Byte(0x60, 0xff); HDMI_WriteI2C_Byte(0xff, 0x81); //寄存器组 HDMI_WriteI2C_Byte(0x32, 0x40); 延迟1ms(10); HDMI_WriteI2C_Byte(0x32, 0x43); 延迟(300); printk(“[玉剑]---------8888--n”); HDMI_WriteI2C_Byte(0xff, 0x90); //寄存器组 Pre_Temp = HDMI_ReadI2C_Byte(0x76); 延迟(100); Cur_Temp = HDMI_ReadI2C_Byte(0x76); D_value = (Cur_Temp 》= Pre_Temp) ? (Cur_Temp - Pre_Temp):(Pre_Temp - Cur_Temp); } } #endif |
|
|
|
HDMI_WriteI2C_Byte(0xff, 0x80); //寄存器组
HDMI_WriteI2C_Byte(0x63, 0x7f);//0x3f); HDMI_WriteI2C_Byte(0x63, 0xff);//0xbf); HDMI_WriteI2C_Byte(0x60, 0xde); HDMI_WriteI2C_Byte(0x60, 0xff); HDMI_WriteI2C_Byte(0xff, 0x81); HDMI_WriteI2C_Byte(0x32, 0x40); 延迟1ms(10); HDMI_WriteI2C_Byte(0x32, 0x43); printk(“[玉剑]---------99999-n”); #ifndef _Test_Pattern_mdelay (100); HDMI_WriteI2C_Byte(0xff, 0x88); HDMI_WriteI2C_Byte(0x37, 0x08 + (u8)(MIPI_Timing[V_tol] / 256)); #endif mdelay(200); printk(“[玉剑]---------10--n”); HDMI_WriteI2C_Byte(0xff, 0x80); HDMI_WriteI2C_Byte(0x62, 0xbf); //------------------------------------------------------// // 用于测试 // HDMI_WriteI2C_Byte(0xff,0x90);//寄存器库 // HDMI_WriteI2C_Byte(0x07,0xc0); // HDMI_WriteI2C_Byte(0xff,0x80);//寄存器库 // HDMI_WriteI2C_Byte(0x94,0x00); // HDMI_WriteI2C_Byte(0x95,0x00); // HDMI_WriteI2C_Byte(0xff,0x81);//寄存器库 // HDMI_WriteI2C_Byte(0x3f,0x02); // HDMI_WriteI2C_Byte(0x3e,0xff); // HDMI_WriteI2C_Byte(0x3d,0x03); // HDMI_WriteI2C_Byte(0x2b,0x7f); //----------------------------------------------------// HDMI_WriteI2C_Byte(0xff, 0x00); //寄存器库 #if 0 HDMI_WriteI2C_Byte(0xff, 0x81); HDMI_WriteI2C_Byte(0x18, 0x02); HDMI_WriteI2C_Byte(0x19, 0xb4); HDMI_WriteI2C_Byte(0x1a, 0x02); HDMI_WriteI2C_Byte(0x1b,0xb4); #endif } int LT8911EX_ChipID( void ) // 读取芯片 ID { int exb_id = 0; HDMI_WriteI2C_Byte(0xff, 0x81); //寄存器组 HDMI_WriteI2C_Byte(0x08, 0x7f); exb_id = HDMI_ReadI2C_Byte(0x00); printk(“rnLT8911EXB 芯片 ID: = %dn”, exb_id); // 0x17 printk(“,aaa= %d ,bbb = %dn”, HDMI_ReadI2C_Byte( 0x01 ) ,HDMI_ReadI2C_Byte( 0x02 )); // 0x05 if(exb_id == 0x17) return 1; 否则 返回 0; } void LT8911B_Exb_Initial(void) { int is_exb = -1; gpio_direction_output(启用,1); 重置_lt8911(); //1.读id是否为LT8911_EX,如果是EX则初始化EX,如果是8911b则执行该 初始化is_exb = LT8911EX_ChipID( ); //读取Chip ID //刷刷之前,先Reset LT8911/B,用GPIO先拉低LT8911B的左右复位脚100ms,再高,保持100ms if(is_exb=1) { printk(“LT891_EX_init n” ); LT8911_EX_init(); } 其他 { printk(“LT8911B_Initial n”); LT8911B_Initial(); } } 静态 int hshcal_probe(struct i2c_client *client, const struct i2c_device_id *id) { printk(“[lt8911b][HSHCAL] hshcal_proben”); if (!i2c_check_functionality(client-》adapter, I2C_FUNC_I2C)) { dev_err(&client-》adapter-》dev, “[lt8911b]client 不支持 i2cn”); 返回-ENOMEM; } client_hshcal = kzalloc(sizeof(struct i2c_client), GFP_KERNEL); if (!client_hshcal) { dev_err(&client->adapter->dev, "[lt8911b]未能为模块数据分配内存n"); 返回-ENOMEM; printk("[玉剑]-------------n"); dev_info(&client->adapter->dev, "检测到 lt8911b edpn"); 重置初始化(); /*reset_lt8911(); int ret=0; ret=HDMI_WriteI2C_Byte(0xFF,0x80); if(ret) printk("[玉剑]---------1----n"); u8 temp_id0=0; u8 temp_id1=0; temp_id0=HDMI_ReadI2C_Byte(0x00); temp_id1=HDMI_ReadI2C_Byte(0x01); printk("[-------lt8911------]id[%x][%x]n",temp_id0,temp_id1); */ LT8911B_Exb_Initial(); 返回0; printk("[lt8911b][HSHCAL] hshcal_removen"); #endif kfree(client_hshcal); 返回0; } static const struct of_device_id it8911b_ts_ids[] = { {.compatible = "IT,it8911b"}, { } }; 静态常量结构 i2c_device_id hshcal_id[] = { { HSHCAL_DRIVER_NAME, 0 }, { } }; 静态结构 i2c_driver hshcal_driver = { .probe = hshcal_probe, .remove = hshcal_remove, .id_table = hshcal_id, .driver = { .name = HSHCAL_DRIVER_NAME, .of_match_table = of_match_ptr(it8911b_ts_ids), }, }; /*------------------------------------------------ -----------------------------------------------------------* // * 设备驱动程序 */ /*-------------------------------------------- -------------------------------------------------- --*/ static int __init hshcal_init(void) { int rc=0; u16 芯片信息; #ifndef RESISTER_HSHCAL_I2C 结构 i2c_board_info i2c_info; 结构 i2c_adapter *适配器; #endif #ifdef ALPS_HMD_DEBUG printk("[lt8911b][HSHCAL] hshcal_initn"); #endif rc = i2c_add_driver(&hshcal_driver); 如果(rc!= 0){ printk("[lt8911b]无法添加i2c驱动n"); rc = -ENOTSUPP; 转到out_region; } #ifndef RESISTER_HSHCAL_I2C /* 它正在适配器中添加 i2c_bord_info。如果您已经 在适配器中添加了 i2c_board_info,则需要删除此代码。*/ memset(&i2c_info, 0, sizeof(struct i2c_board_info)); i2c_info.addr = I2C_HSHCAL_ADDR; strlcpy(i2c_info.type,HSHCAL_DRIVER_NAME,I2C_NAME_SIZE); 适配器 = i2c_get_adapter(I2C_BUS_NUMBER); if (!adapter) { printk("[lt8911b]can't get i2c adapter %dn", I2C_BUS_NUMBER); rc = -ENOTSUPP; 转到out_driver; } /* 它正在适配器中添加 i2c_bord_info。如果您已经 在适配器中添加了 i2c_board_info,则需要删除此代码。*/ client_hshcal = i2c_new_device(适配器, &i2c_info); if (!client_hshcal) { printk("[lt8911b]can't add i2c device at 0x%xn",(unsigned int)i2c_info.addr); rc = -ENOTSUPP; 转到out_driver; } client_hshcal->adapter->timeout = 0; client_hshcal->适配器->重试= 0; /* 它正在适配器中添加 i2c_bord_info。如果您已经 在适配器中添加了 i2c_board_info,则需要删除此代码。*/ i2c_put_adapter(适配器); #万一 pdev = platform_device_register_simple(HSHCAL_DEVICE_NAME, -1, NULL, 0); if (IS_ERR(pdev)) { rc = PTR_ERR(pdev); 转到out_driver; } printk(KERN_INFO "[lt8911b]hshcal_init: platform_device_register_simplen"); 返回0; out_device: platform_device_unregister(pdev); printk(KERN_INFO "[lt8911b]hshcal_init: platform_device_unregistern"); out_driver: i2c_del_driver(&hshcal_driver); printk(KERN_INFO "[lt8911b]hshcal_init: i2c_del_drivern"); out_region: 返回 rc; } 静态无效 __exit hshcal_exit(void) { #ifdef ALPS_HMD_DEBUG printk("[lt8911b][HSHCAL] hshcal_exitn"); #endif i2c_del_driver(&hshcal_driver); printk(KERN_INFO "[lt8911b]hshcal_exit: i2c_del_drivern"); } 模块初始化(hshcal_init); 模块退出(hshcal_exit); MODULE_DESCRIPTION("阿尔卑斯湿度输入装置"); MODULE_AUTHOR("ALPS ELECTRIC CO., LTD."); MODULE_LICENSE("GPL v2"); |
|
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
基于米尔瑞芯微RK3576核心板/开发板的人脸疲劳检测应用方案
678 浏览 0 评论
920 浏览 1 评论
814 浏览 1 评论
2030 浏览 1 评论
3275 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-24 20:21 , Processed in 0.835816 second(s), Total 78, Slave 62 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号