41#define MAX_EDID_EXT_NUM 4
44static const u8 edid_header[] = {
45 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
62 for (i = 0; i <
sizeof(edid_header); i++)
63 if (raw_edid[i] == edid_header[i])
67 else if (score >= 6) {
68 printf(
"Fixing EDID header\n");
69 memcpy(raw_edid, edid_header,
sizeof(edid_header));
76 printf(
"EDID checksum is invalid, remainder is %d\n", csum);
81 printf(
"EDID has major version %d, instead of 1\n",
edid->
version);
86 printf(
"EDID minor > 4, assuming backward compatibility\n");
128static int ddc_read_byte(
int offset,
unsigned char *b){
148 if(!(bb&0x10))
break;
176 if(ddc_init())
return -1;
178 for(i=0;i<len;++i)
if (ddc_read_byte(i,&buf[i]))
return -1;
184static int xenos_ddc_read_edid(
unsigned char *buf,
int len)
188 for (i = 0; i < 4; i++) {
191 if (edid_is_valid((
struct edid *)buf))
196 printf(
"EDID invalid.\n");
216 printf(
"Failed to allocate EDID\n");
231 "The number of extension(%d) is "
232 "over max (%d), actually read number (%d)\n",
239 ret = xenos_ddc_read_edid((
unsigned char *)
edid,
EDID_LENGTH * (edid_ext_num + 1));
255#define HDMI_IDENTIFIER 0x000C03
256#define VENDOR_BLOCK 0x03
266 char *edid_ext =
NULL;
267 int i, hdmi_id, edid_ext_num;
268 int start_offset, end_offset;
280 for (i = 0; i < edid_ext_num; i++) {
283 if (edid_ext[0] == 0x02)
287 if (i == edid_ext_num)
292 end_offset = edid_ext[2];
298 for (i = start_offset; i < end_offset;
300 i += ((edid_ext[i] & 0x1f) + 1)) {
303 hdmi_id = edid_ext[i + 1] | (edid_ext[i + 2] << 8) |
304 edid_ext[i + 3] << 16;
int xenon_smc_i2c_read(uint16_t addr, uint8_t *val)
int xenon_smc_i2c_write(uint16_t addr, uint8_t val)
int xenon_smc_i2c_ddc_lock(int lock)
int xenos_do_probe_ddc_edid(unsigned char *buf, int len)
BOOL xenos_detect_hdmi_monitor(struct edid *edid)
struct edid * xenos_get_edid()
uint8_t u8
8bit unsigned integer