1
2
3
4
5
6
7
8#include <common.h>
9#include <i2c.h>
10
11#define ADV7611_I2C_ADDR 0x4c
12#define ADV7611_RDINFO 0x2051
13
14
15
16
17enum {
18 CP_I2C_ADDR = 0x22,
19 DPLL_I2C_ADDR = 0x26,
20 KSV_I2C_ADDR = 0x32,
21 HDMI_I2C_ADDR = 0x34,
22 EDID_I2C_ADDR = 0x36,
23 INFOFRAME_I2C_ADDR = 0x3e,
24 CEC_I2C_ADDR = 0x40,
25 IO_I2C_ADDR = ADV7611_I2C_ADDR,
26};
27
28
29
30
31enum {
32 IO_RD_INFO_MSB = 0xea,
33 IO_RD_INFO_LSB = 0xeb,
34 IO_CEC_ADDR = 0xf4,
35 IO_INFOFRAME_ADDR = 0xf5,
36 IO_DPLL_ADDR = 0xf8,
37 IO_KSV_ADDR = 0xf9,
38 IO_EDID_ADDR = 0xfa,
39 IO_HDMI_ADDR = 0xfb,
40 IO_CP_ADDR = 0xfd,
41};
42
43int adv7611_i2c[] = CONFIG_SYS_ADV7611_I2C;
44
45int adv7611_probe(unsigned int screen)
46{
47 int old_bus = i2c_get_bus_num();
48 unsigned int rd_info;
49 int res = 0;
50
51 i2c_set_bus_num(adv7611_i2c[screen]);
52
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);
55
56 if (rd_info != ADV7611_RDINFO) {
57 res = -1;
58 goto out;
59 }
60
61
62
63
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);
71
72
73
74
75
76
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);
86
87
88
89
90
91
92
93
94
95
96
97
98 i2c_reg_write(IO_I2C_ADDR, 0x02, 0x12);
99
100
101
102
103
104
105
106
107 i2c_reg_write(IO_I2C_ADDR, 0x03, 0x40);
108
109
110
111
112
113
114
115
116 i2c_reg_write(IO_I2C_ADDR, 0x05, 0x28);
117
118
119
120
121
122
123
124
125 i2c_reg_write(IO_I2C_ADDR, 0x0c, 0x42);
126
127
128
129
130
131
132
133
134
135
136 i2c_reg_write(IO_I2C_ADDR, 0x15, 0xb0);
137
138
139
140
141
142
143
144
145
146
147
148
149 i2c_reg_write(HDMI_I2C_ADDR, 0x83, 0xfe);
150
151
152
153
154
155
156
157
158 i2c_reg_write(CP_I2C_ADDR, 0xba, 0x00);
159
160
161
162
163
164
165
166
167
168
169
170
171 i2c_reg_write(IO_I2C_ADDR, 0x40, 0xc2);
172
173out:
174 i2c_set_bus_num(old_bus);
175
176 return res;
177}
178