Rev 1986 | Rev 2997 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1986 | Rev 2160 | ||
---|---|---|---|
Line 30... | Line 30... | ||
30 | 30 | ||
31 | /** |
31 | /** |
32 | * radeon_ddc_probe |
32 | * radeon_ddc_probe |
33 | * |
33 | * |
34 | */ |
34 | */ |
35 | bool radeon_ddc_probe(struct radeon_connector *radeon_connector) |
35 | bool radeon_ddc_probe(struct radeon_connector *radeon_connector, bool requires_extended_probe) |
36 | { |
36 | { |
37 | u8 out_buf[] = { 0x0, 0x0}; |
37 | u8 out = 0x0; |
38 | u8 buf[2]; |
38 | u8 buf[8]; |
39 | int ret; |
39 | int ret; |
40 | struct i2c_msg msgs[] = { |
40 | struct i2c_msg msgs[] = { |
41 | { |
41 | { |
42 | .addr = 0x50, |
42 | .addr = 0x50, |
43 | .flags = 0, |
43 | .flags = 0, |
44 | .len = 1, |
44 | .len = 1, |
45 | .buf = out_buf, |
45 | .buf = &out, |
46 | }, |
46 | }, |
47 | { |
47 | { |
48 | .addr = 0x50, |
48 | .addr = 0x50, |
49 | .flags = I2C_M_RD, |
49 | .flags = I2C_M_RD, |
50 | .len = 1, |
50 | .len = 1, |
51 | .buf = buf, |
51 | .buf = buf, |
52 | } |
52 | } |
Line -... | Line 53... | ||
- | 53 | }; |
|
- | 54 | ||
- | 55 | /* Read 8 bytes from i2c for extended probe of EDID header */ |
|
- | 56 | if (requires_extended_probe) |
|
53 | }; |
57 | msgs[1].len = 8; |
54 | 58 | ||
55 | /* on hw with routers, select right port */ |
59 | /* on hw with routers, select right port */ |
Line 56... | Line 60... | ||
56 | if (radeon_connector->router.ddc_valid) |
60 | if (radeon_connector->router.ddc_valid) |
57 | radeon_router_select_ddc_port(radeon_connector); |
61 | radeon_router_select_ddc_port(radeon_connector); |
- | 62 | ||
58 | 63 | ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); |
|
59 | ret = i2c_transfer(&radeon_connector->ddc_bus->adapter, msgs, 2); |
- | |
- | 64 | if (ret != 2) |
|
- | 65 | /* Couldn't find an accessible DDC on this connector */ |
|
- | 66 | return false; |
|
- | 67 | if (requires_extended_probe) { |
|
- | 68 | /* Probe also for valid EDID header |
|
- | 69 | * EDID header starts with: |
|
- | 70 | * 0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00. |
|
- | 71 | * Only the first 6 bytes must be valid as |
|
- | 72 | * drm_edid_block_valid() can fix the last 2 bytes */ |
|
60 | if (ret == 2) |
73 | if (drm_edid_header_is_valid(buf) < 6) { |
61 | return true; |
74 | /* Couldn't find an accessible EDID on this |
- | 75 | * connector */ |
|
- | 76 | return false; |
|
- | 77 | } |
|
Line 62... | Line 78... | ||
62 | 78 | } |
|
Line 63... | Line 79... | ||
63 | return false; |
79 | return true; |
64 | } |
80 | } |