int bsp_hdmi_video(struct video_para *video) { unsigned int id = get_vid(video->vic); glb_video.vic = video->vic; switch(glb_video.vic) { case 2: case 4: case 6: case 17: case 19: case 21: video->csc = BT601; break; default: video->csc = BT709; break; } if(hdmi_phy_set(video)!=0) return -1; bsp_hdmi_inner_init(); hdmi_write(0x0840, 0x01); hdmi_write(0x4845, 0x00); hdmi_write(0x0040, ptbl[id].para[3] | 0x10); hdmi_write(0x10001, ( (ptbl[id].para[3] < 96) ? 0x03 : 0x00 ) ); hdmi_write(0x8040, ptbl[id].para[4]); hdmi_write(0x4043, ptbl[id].para[5]); hdmi_write(0x8042, ptbl[id].para[6]); hdmi_write(0x0042, ptbl[id].para[7]); hdmi_write(0x4042, ptbl[id].para[8]); hdmi_write(0x4041, ptbl[id].para[9]); hdmi_write(0xC041, ptbl[id].para[10]); hdmi_write(0x0041, ptbl[id].para[11]); hdmi_write(0x8041, ptbl[id].para[12]); hdmi_write(0x4040, ptbl[id].para[13]); hdmi_write(0xC040, ptbl[id].para[14]); hdmi_write(0x0043, ptbl[id].para[15]); hdmi_write(0x8043, ptbl[id].para[16]); hdmi_write(0x0045, 0x0c); hdmi_write(0x8044, 0x20); hdmi_write(0x8045, 0x01); hdmi_write(0x0046, 0x0b); hdmi_write(0x0047, 0x16); hdmi_write(0x8046, 0x21); hdmi_write(0x3048, ptbl[id].para[2] ? 0x21 : 0x10); hdmi_write(0x0401, ptbl[id].para[2] ? 0x41 : 0x40); hdmi_write(0x8400, 0x07); hdmi_write(0x8401, 0x00); hdmi_write(0x0402, 0x47); hdmi_write(0x0800, 0x01); hdmi_write(0x0801, 0x07); hdmi_write(0x8800, 0x00); hdmi_write(0x8801, 0x00); hdmi_write(0x0802, 0x00); hdmi_write(0x0803, 0x00); hdmi_write(0x8802, 0x00); hdmi_write(0x8803, 0x00); if(video->is_hdmi) { hdmi_write(0xB045, 0x08); hdmi_write(0x2045, 0x00); hdmi_write(0x2044, 0x0c); hdmi_write(0x6041, 0x03); hdmi_write(0xA044, ((ptbl[id].para[0]&0x100) == 0x100) ? 0x20 : ( ((ptbl[id].para[0]&0x80) == 0x80) ? 0x40 : 0x00) ); hdmi_write(0xA045, ((ptbl[id].para[0]&0x100) == 0x100) ? (ptbl[id].para[0]&0x7f) : 0x00); hdmi_write(0x2046, 0x00); hdmi_write(0x3046, 0x01); hdmi_write(0x3047, 0x11); hdmi_write(0x4044, 0x00); hdmi_write(0x0052, 0x00); hdmi_write(0x8051, 0x11); hdmi_write(0x10010,0x45); hdmi_write(0x10011,0x45); hdmi_write(0x10012,0x52); hdmi_write(0x10013,0x54); hdmi_write(0x0040, hdmi_read(0x0040) | 0x08 ); hdmi_write(0x10010,0x52); hdmi_write(0x10011,0x54); hdmi_write(0x10012,0x41); hdmi_write(0x10013,0x57); hdmi_write(0x4045, video->is_yuv ? 0x02 : 0x00); if(ptbl[id].para[17] == 0) hdmi_write(0xC044, (video->csc << 6) | 0x18); else if(ptbl[id].para[17] == 1) hdmi_write(0xC044, (video->csc << 6) | 0x28); else hdmi_write(0xC044, (video->csc << 6) | 0x08); if((ptbl[id].para[0] == 32) || (ptbl[id].para[0] == 160)|| (ptbl[id].para[0] == 257)|| (ptbl[id].para[0] == 258)) { hdmi_write(0xC045, 0x01); } else { hdmi_write(0xC045, 0x00); } hdmi_write(0x4046, ptbl[id].para[0]&0x7f); } if(video->is_hcts) { hdmi_write(0x00C0, video->is_hdmi ? 0x91 : 0x90 ); hdmi_write(0x00C1, 0x05); hdmi_write(0x40C1, (ptbl[id].para[3] < 96) ? 0x10 : 0x1a); hdmi_write(0x80C2, 0xff); hdmi_write(0x40C0, 0xfd); hdmi_write(0xC0C0, 0x40); hdmi_write(0x00C1, 0x04); hdmi_write(0x10010,0x45); hdmi_write(0x10011,0x45); hdmi_write(0x10012,0x52); hdmi_write(0x10013,0x54); hdmi_write(0x0040, hdmi_read(0x0040) | 0x80 ); hdmi_write(0x00C0, video->is_hdmi ? 0x95 : 0x94 ); hdmi_write(0x10010,0x52); hdmi_write(0x10011,0x54); hdmi_write(0x10012,0x41); hdmi_write(0x10013,0x57); } hdmi_write(0x0082, 0x00); hdmi_write(0x0081, 0x00); hdmi_write(0x0840, 0x00); if(video->is_hcts) { } return 0; }
int bsp_hdmi_video(struct video_para *video) { unsigned id = get_vid(video->vic); glb_video.vic = video->vic; bsp_hdmi_init(); hdmi_write(0x0840, 0x01); hdmi_write(0x4845, 0x00); hdmi_write(0x0040, ptbl[id].para[3] | 0x10); hdmi_write(0x10001, ( (ptbl[id].para[3] < 96) ? 0x03 : 0x00 ) ); hdmi_write(0x8040, ptbl[id].para[4]); hdmi_write(0x4043, ptbl[id].para[5]); hdmi_write(0x8042, ptbl[id].para[6]); hdmi_write(0x0042, ptbl[id].para[7]); hdmi_write(0x4042, ptbl[id].para[8]); hdmi_write(0x4041, ptbl[id].para[9]); hdmi_write(0xC041, ptbl[id].para[10]); hdmi_write(0x0041, ptbl[id].para[11]); hdmi_write(0x8041, ptbl[id].para[12]); hdmi_write(0x4040, ptbl[id].para[13]); hdmi_write(0xC040, ptbl[id].para[14]); hdmi_write(0x0043, ptbl[id].para[15]); hdmi_write(0x8043, ptbl[id].para[16]); hdmi_write(0x0045, 0x0c); hdmi_write(0x8044, 0x20); hdmi_write(0x8045, 0x01); hdmi_write(0x0046, 0x0b); hdmi_write(0x0047, 0x16); hdmi_write(0x8046, 0x21); hdmi_write(0x3048, ptbl[id].para[2] ? 0x21 : 0x10); hdmi_write(0x0401, ptbl[id].para[2] ? 0x41 : 0x40); hdmi_write(0x8400, 0x07); hdmi_write(0x8401, 0x00); hdmi_write(0x0402, 0x47); hdmi_write(0x0800, video->is_yuv ? 0x09 : 0x01); hdmi_write(0x0801, 0x07); hdmi_write(0x8800, 0x00); hdmi_write(0x8801, 0x00); hdmi_write(0x0802, 0x00); hdmi_write(0x0803, 0x00); hdmi_write(0x8802, 0x00); hdmi_write(0x8803, 0x00); if(video->is_hdmi) { hdmi_write(0xB045, 0x08); hdmi_write(0x2045, 0x00); hdmi_write(0x2044, 0x0c); hdmi_write(0x6041, 0x03); hdmi_write(0xA044, ((ptbl[id].para[0]&0x100) == 0x100) ? 0x20 : ( ((ptbl[id].para[0]&0x80) == 0x80) ? 0x40 : 0x00) ); hdmi_write(0xA045, ((ptbl[id].para[0]&0x100) == 0x100) ? (ptbl[id].para[0]&0x7f) : 0x00); hdmi_write(0x2046, 0x00); hdmi_write(0x3046, 0x01); hdmi_write(0x3047, 0x11); hdmi_write(0x4044, 0x00); hdmi_write(0x0052, 0x00); hdmi_write(0x8051, 0x11); hdmi_write(0x10010,0x45); hdmi_write(0x10011,0x45); hdmi_write(0x10012,0x52); hdmi_write(0x10013,0x54); hdmi_write(0x0040, hdmi_read(0x0040) | 0x08 ); hdmi_write(0x10010,0x52); hdmi_write(0x10011,0x54); hdmi_write(0x10012,0x41); hdmi_write(0x10013,0x57); hdmi_write(0x4045, video->is_yuv ? 0x02 : 0x00); if(ptbl[id].para[16] == 0) hdmi_write(0xC044, (video->csc << 6) | 0x18); else if(ptbl[id].para[16] == 1) hdmi_write(0xC044, (video->csc << 6) | 0x28); else hdmi_write(0xC044, (video->csc << 6) | 0x08); hdmi_write(0xC045, 0x00); hdmi_write(0x4046, ptbl[id].para[0]&0x7f); } if(video->is_hcts) { hdmi_write(0x10010,0x45); hdmi_write(0x10011,0x45); hdmi_write(0x10012,0x52); hdmi_write(0x10013,0x54); hdmi_write(0x0040, hdmi_read(0x0040) | 0x80 ); hdmi_write(0x10010,0x52); hdmi_write(0x10011,0x54); hdmi_write(0x10012,0x41); hdmi_write(0x10013,0x57); } hdmi_write(0x0082, 0x00); hdmi_write(0x0081, 0x00); if(hdmi_phy_set(video)!=0) return -1; hdmi_write(0x0840, 0x00); if(video->is_hcts) { } return 0; }