3 * Dirk Eibach, Guntermann & Drunck GmbH, eibach@gdsys.de
5 * SPDX-License-Identifier: GPL-2.0+
11 #define ADV7611_I2C_ADDR 0x4c
12 #define ADV7611_RDINFO 0x2051
15 * ADV7611 I2C Addresses in u-boot notation
23 INFOFRAME_I2C_ADDR = 0x3e,
25 IO_I2C_ADDR = ADV7611_I2C_ADDR,
29 * Global Control Registers
32 IO_RD_INFO_MSB = 0xea,
33 IO_RD_INFO_LSB = 0xeb,
35 IO_INFOFRAME_ADDR = 0xf5,
43 int adv7611_i2c[] = CONFIG_SYS_ADV7611_I2C;
45 int adv7611_probe(unsigned int screen)
47 int old_bus = i2c_get_bus_num();
51 i2c_set_bus_num(adv7611_i2c[screen]);
53 rd_info = (i2c_reg_read(IO_I2C_ADDR, IO_RD_INFO_MSB) << 8)
54 | i2c_reg_read(IO_I2C_ADDR, IO_RD_INFO_LSB);
56 if (rd_info != ADV7611_RDINFO) {
62 * set I2C addresses to default values
64 i2c_reg_write(IO_I2C_ADDR, IO_CEC_ADDR, CEC_I2C_ADDR << 1);
65 i2c_reg_write(IO_I2C_ADDR, IO_INFOFRAME_ADDR, INFOFRAME_I2C_ADDR << 1);
66 i2c_reg_write(IO_I2C_ADDR, IO_DPLL_ADDR, DPLL_I2C_ADDR << 1);
67 i2c_reg_write(IO_I2C_ADDR, IO_KSV_ADDR, KSV_I2C_ADDR << 1);
68 i2c_reg_write(IO_I2C_ADDR, IO_EDID_ADDR, EDID_I2C_ADDR << 1);
69 i2c_reg_write(IO_I2C_ADDR, IO_HDMI_ADDR, HDMI_I2C_ADDR << 1);
70 i2c_reg_write(IO_I2C_ADDR, IO_CP_ADDR, CP_I2C_ADDR << 1);
73 * do magic initialization sequence from
74 * "ADV7611 Register Settings Recommendations Revision 1.5"
75 * with most registers undocumented
77 i2c_reg_write(CP_I2C_ADDR, 0x6c, 0x00);
78 i2c_reg_write(HDMI_I2C_ADDR, 0x9b, 0x03);
79 i2c_reg_write(HDMI_I2C_ADDR, 0x6f, 0x08);
80 i2c_reg_write(HDMI_I2C_ADDR, 0x85, 0x1f);
81 i2c_reg_write(HDMI_I2C_ADDR, 0x87, 0x70);
82 i2c_reg_write(HDMI_I2C_ADDR, 0x57, 0xda);
83 i2c_reg_write(HDMI_I2C_ADDR, 0x58, 0x01);
84 i2c_reg_write(HDMI_I2C_ADDR, 0x03, 0x98);
85 i2c_reg_write(HDMI_I2C_ADDR, 0x4c, 0x44);
88 * IO_REG_02, default 0xf0
90 * INP_COLOR_SPACE (IO, Address 0x02[7:4])
91 * default: 0b1111 auto
92 * set to : 0b0001 force RGB (range 0 to 255) input
94 * RGB_OUT (IO, Address 0x02[1])
95 * default: 0 YPbPr color space output
96 * set to : 1 RGB color space output
98 i2c_reg_write(IO_I2C_ADDR, 0x02, 0x12);
101 * IO_REG_03, default 0x00
103 * OP_FORMAT_SEL (IO, Address 0x03[7:0])
104 * default: 0x00 8-bit SDR ITU-656 mode
105 * set to : 0x40 24-bit 4:4:4 SDR mode
107 i2c_reg_write(IO_I2C_ADDR, 0x03, 0x40);
110 * IO_REG_05, default 0x2c
112 * AVCODE_INSERT_EN (IO, Address 0x05[2])
113 * default: 1 insert AV codes into data stream
114 * set to : 0 do not insert AV codes into data stream
116 i2c_reg_write(IO_I2C_ADDR, 0x05, 0x28);
119 * IO_REG_0C, default 0x62
121 * POWER_DOWN (IO, Address 0x0C[5])
122 * default: 1 chip is powered down
123 * set to : 0 chip is operational
125 i2c_reg_write(IO_I2C_ADDR, 0x0c, 0x42);
128 * IO_REG_15, default 0xbe
130 * TRI_SYNCS (IO, Address 0x15[3)
131 * TRI_LLC (IO, Address 0x15[2])
132 * TRI_PIX (IO, Address 0x15[1])
133 * default: 1 video output pins are tristate
134 * set to : 0 video output pins are active
136 i2c_reg_write(IO_I2C_ADDR, 0x15, 0xb0);
139 * HDMI_REGISTER_02H, default 0xff
141 * CLOCK_TERMA_DISABLE (HDMI, Address 0x83[0])
142 * default: 1 disable termination
143 * set to : 0 enable termination
144 * Future options are:
145 * - use the chips automatic termination control
146 * - set this manually on cable detect
147 * but at the moment this seems a safe default.
149 i2c_reg_write(HDMI_I2C_ADDR, 0x83, 0xfe);
152 * HDMI_CP_CNTRL_1, default 0x01
154 * HDMI_FRUN_EN (CP, Address 0xBA[0])
155 * default: 1 Enable the free run feature in HDMI mode
156 * set to : 0 Disable the free run feature in HDMI mode
158 i2c_reg_write(CP_I2C_ADDR, 0xba, 0x00);
161 * INT1_CONFIGURATION, default 0x20
163 * INTRQ_DUR_SEL[1:0] (IO, Address 0x40[7:6])
164 * default: 00 Interrupt signal is active for 4 Xtal periods
165 * set to : 11 Active until cleared
167 * INTRQ_OP_SEL[1:0] (IO, Address 0x40[1:0])
168 * default: 00 Open drain
169 * set to : 10 Drives high when active
171 i2c_reg_write(IO_I2C_ADDR, 0x40, 0xc2);
174 i2c_set_bus_num(old_bus);