Padmanabhan Komanduru | cc9a1851 | 2017-05-03 13:59:02 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #include <drm/drm_edid.h> |
| 14 | |
| 15 | #include "sde_kms.h" |
| 16 | #include "sde_edid_parser.h" |
| 17 | |
| 18 | #define DBC_START_OFFSET 4 |
| 19 | #define EDID_DTD_LEN 18 |
| 20 | |
| 21 | enum data_block_types { |
| 22 | RESERVED, |
| 23 | AUDIO_DATA_BLOCK, |
| 24 | VIDEO_DATA_BLOCK, |
| 25 | VENDOR_SPECIFIC_DATA_BLOCK, |
| 26 | SPEAKER_ALLOCATION_DATA_BLOCK, |
| 27 | VESA_DTC_DATA_BLOCK, |
| 28 | RESERVED2, |
| 29 | USE_EXTENDED_TAG |
| 30 | }; |
| 31 | |
| 32 | static u8 *sde_find_edid_extension(struct edid *edid, int ext_id) |
| 33 | { |
| 34 | u8 *edid_ext = NULL; |
| 35 | int i; |
| 36 | |
| 37 | /* No EDID or EDID extensions */ |
| 38 | if (edid == NULL || edid->extensions == 0) |
| 39 | return NULL; |
| 40 | |
| 41 | /* Find CEA extension */ |
| 42 | for (i = 0; i < edid->extensions; i++) { |
| 43 | edid_ext = (u8 *)edid + EDID_LENGTH * (i + 1); |
| 44 | if (edid_ext[0] == ext_id) |
| 45 | break; |
| 46 | } |
| 47 | |
| 48 | if (i == edid->extensions) |
| 49 | return NULL; |
| 50 | |
| 51 | return edid_ext; |
| 52 | } |
| 53 | |
| 54 | static u8 *sde_find_cea_extension(struct edid *edid) |
| 55 | { |
| 56 | return sde_find_edid_extension(edid, SDE_CEA_EXT); |
| 57 | } |
| 58 | |
| 59 | static int |
| 60 | sde_cea_db_payload_len(const u8 *db) |
| 61 | { |
| 62 | return db[0] & 0x1f; |
| 63 | } |
| 64 | |
| 65 | static int |
| 66 | sde_cea_db_tag(const u8 *db) |
| 67 | { |
| 68 | return db[0] >> 5; |
| 69 | } |
| 70 | |
| 71 | static int |
| 72 | sde_cea_revision(const u8 *cea) |
| 73 | { |
| 74 | return cea[1]; |
| 75 | } |
| 76 | |
| 77 | static int |
| 78 | sde_cea_db_offsets(const u8 *cea, int *start, int *end) |
| 79 | { |
| 80 | /* Data block offset in CEA extension block */ |
| 81 | *start = 4; |
| 82 | *end = cea[2]; |
| 83 | if (*end == 0) |
| 84 | *end = 127; |
| 85 | if (*end < 4 || *end > 127) |
| 86 | return -ERANGE; |
| 87 | return 0; |
| 88 | } |
| 89 | |
| 90 | #define sde_for_each_cea_db(cea, i, start, end) \ |
| 91 | for ((i) = (start); \ |
| 92 | (i) < (end) && (i) + sde_cea_db_payload_len(&(cea)[(i)]) < (end); \ |
| 93 | (i) += sde_cea_db_payload_len(&(cea)[(i)]) + 1) |
| 94 | |
Abhinav Kumar | cd18751 | 2017-06-30 01:02:36 -0700 | [diff] [blame^] | 95 | static bool sde_cea_db_is_hdmi_hf_vsdb(const u8 *db) |
| 96 | { |
| 97 | int hdmi_id; |
| 98 | |
| 99 | if (sde_cea_db_tag(db) != VENDOR_SPECIFIC_DATA_BLOCK) |
| 100 | return false; |
| 101 | |
| 102 | if (sde_cea_db_payload_len(db) < 7) |
| 103 | return false; |
| 104 | |
| 105 | hdmi_id = db[1] | (db[2] << 8) | (db[3] << 16); |
| 106 | |
| 107 | return hdmi_id == HDMI_IEEE_OUI_HF; |
| 108 | } |
| 109 | |
Padmanabhan Komanduru | cc9a1851 | 2017-05-03 13:59:02 -0700 | [diff] [blame] | 110 | static u8 *sde_edid_find_extended_tag_block(struct edid *edid, int blk_id) |
| 111 | { |
| 112 | u8 *db = NULL; |
| 113 | u8 *cea = NULL; |
| 114 | |
| 115 | if (!edid) { |
| 116 | SDE_ERROR("%s: invalid input\n", __func__); |
| 117 | return NULL; |
| 118 | } |
| 119 | |
| 120 | cea = sde_find_cea_extension(edid); |
| 121 | |
| 122 | if (cea && sde_cea_revision(cea) >= 3) { |
| 123 | int i, start, end; |
| 124 | |
| 125 | if (sde_cea_db_offsets(cea, &start, &end)) |
| 126 | return NULL; |
| 127 | |
| 128 | sde_for_each_cea_db(cea, i, start, end) { |
| 129 | db = &cea[i]; |
| 130 | if ((sde_cea_db_tag(db) == SDE_EXTENDED_TAG) && |
| 131 | (db[1] == blk_id)) |
| 132 | return db; |
| 133 | } |
| 134 | } |
| 135 | return NULL; |
| 136 | } |
| 137 | |
| 138 | static u8 * |
| 139 | sde_edid_find_block(struct edid *edid, int blk_id) |
| 140 | { |
| 141 | u8 *db = NULL; |
| 142 | u8 *cea = NULL; |
| 143 | |
| 144 | if (!edid) { |
| 145 | SDE_ERROR("%s: invalid input\n", __func__); |
| 146 | return NULL; |
| 147 | } |
| 148 | |
| 149 | cea = sde_find_cea_extension(edid); |
| 150 | |
| 151 | if (cea && sde_cea_revision(cea) >= 3) { |
| 152 | int i, start, end; |
| 153 | |
| 154 | if (sde_cea_db_offsets(cea, &start, &end)) |
| 155 | return NULL; |
| 156 | |
| 157 | sde_for_each_cea_db(cea, i, start, end) { |
| 158 | db = &cea[i]; |
| 159 | if (sde_cea_db_tag(db) == blk_id) |
| 160 | return db; |
| 161 | } |
| 162 | } |
| 163 | return NULL; |
| 164 | } |
| 165 | |
| 166 | |
| 167 | static const u8 *_sde_edid_find_block(const u8 *in_buf, u32 start_offset, |
| 168 | u8 type, u8 *len) |
| 169 | { |
| 170 | /* the start of data block collection, start of Video Data Block */ |
| 171 | u32 offset = start_offset; |
| 172 | u32 dbc_offset = in_buf[2]; |
| 173 | |
| 174 | SDE_EDID_DEBUG("%s +", __func__); |
| 175 | /* |
| 176 | * * edid buffer 1, byte 2 being 4 means no non-DTD/Data block |
| 177 | * collection present. |
| 178 | * * edid buffer 1, byte 2 being 0 means no non-DTD/DATA block |
| 179 | * collection present and no DTD data present. |
| 180 | */ |
| 181 | if ((dbc_offset == 0) || (dbc_offset == 4)) { |
| 182 | SDE_ERROR("EDID: no DTD or non-DTD data present\n"); |
| 183 | return NULL; |
| 184 | } |
| 185 | |
| 186 | while (offset < dbc_offset) { |
| 187 | u8 block_len = in_buf[offset] & 0x1F; |
| 188 | |
| 189 | if ((offset + block_len <= dbc_offset) && |
| 190 | (in_buf[offset] >> 5) == type) { |
| 191 | *len = block_len; |
| 192 | SDE_EDID_DEBUG("block=%d found @ 0x%x w/ len=%d\n", |
| 193 | type, offset, block_len); |
| 194 | |
| 195 | return in_buf + offset; |
| 196 | } |
| 197 | offset += 1 + block_len; |
| 198 | } |
| 199 | |
| 200 | return NULL; |
| 201 | } |
| 202 | |
| 203 | static void sde_edid_extract_vendor_id(struct sde_edid_ctrl *edid_ctrl) |
| 204 | { |
| 205 | char *vendor_id; |
| 206 | u32 id_codes; |
| 207 | |
| 208 | SDE_EDID_DEBUG("%s +", __func__); |
| 209 | if (!edid_ctrl) { |
| 210 | SDE_ERROR("%s: invalid input\n", __func__); |
| 211 | return; |
| 212 | } |
| 213 | |
| 214 | vendor_id = edid_ctrl->vendor_id; |
| 215 | id_codes = ((u32)edid_ctrl->edid->mfg_id[0] << 8) + |
| 216 | edid_ctrl->edid->mfg_id[1]; |
| 217 | |
| 218 | vendor_id[0] = 'A' - 1 + ((id_codes >> 10) & 0x1F); |
| 219 | vendor_id[1] = 'A' - 1 + ((id_codes >> 5) & 0x1F); |
| 220 | vendor_id[2] = 'A' - 1 + (id_codes & 0x1F); |
| 221 | vendor_id[3] = 0; |
| 222 | SDE_EDID_DEBUG("vendor id is %s ", vendor_id); |
| 223 | SDE_EDID_DEBUG("%s -", __func__); |
| 224 | } |
| 225 | |
| 226 | static void sde_edid_set_y420_support(struct drm_connector *connector, |
| 227 | u32 video_format) |
| 228 | { |
| 229 | u8 cea_mode = 0; |
| 230 | struct drm_display_mode *mode; |
| 231 | |
| 232 | /* Need to add Y420 support flag to the modes */ |
| 233 | list_for_each_entry(mode, &connector->probed_modes, head) { |
| 234 | cea_mode = drm_match_cea_mode(mode); |
| 235 | if ((cea_mode != 0) && (cea_mode == video_format)) { |
| 236 | SDE_EDID_DEBUG("%s found match for %d ", __func__, |
| 237 | video_format); |
| 238 | mode->flags |= DRM_MODE_FLAG_SUPPORTS_YUV; |
| 239 | } |
| 240 | } |
| 241 | } |
| 242 | |
| 243 | static void sde_edid_parse_Y420CMDB( |
| 244 | struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl, |
| 245 | const u8 *db) |
| 246 | { |
| 247 | u32 offset = 0; |
| 248 | u8 len = 0; |
| 249 | u8 svd_len = 0; |
| 250 | const u8 *svd = NULL; |
| 251 | u32 i = 0, j = 0; |
| 252 | u32 video_format = 0; |
| 253 | |
| 254 | if (!edid_ctrl) { |
| 255 | SDE_ERROR("%s: edid_ctrl is NULL\n", __func__); |
| 256 | return; |
| 257 | } |
| 258 | |
| 259 | if (!db) { |
| 260 | SDE_ERROR("%s: invalid input\n", __func__); |
| 261 | return; |
| 262 | } |
| 263 | SDE_EDID_DEBUG("%s +\n", __func__); |
| 264 | len = db[0] & 0x1f; |
| 265 | |
| 266 | if (len < 7) |
| 267 | return; |
| 268 | /* Byte 3 to L+1 contain SVDs */ |
| 269 | offset += 2; |
| 270 | |
| 271 | svd = sde_edid_find_block(edid_ctrl->edid, VIDEO_DATA_BLOCK); |
| 272 | |
| 273 | if (svd) { |
| 274 | /*moving to the next byte as vic info begins there*/ |
| 275 | ++svd; |
| 276 | svd_len = svd[0] & 0x1f; |
| 277 | } |
| 278 | |
| 279 | for (i = 0; i < svd_len; i++, j++) { |
| 280 | video_format = *svd & 0x7F; |
| 281 | if (db[offset] & (1 << j)) |
| 282 | sde_edid_set_y420_support(connector, video_format); |
| 283 | |
| 284 | if (j & 0x80) { |
| 285 | j = j/8; |
| 286 | offset++; |
| 287 | if (offset >= len) |
| 288 | break; |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | SDE_EDID_DEBUG("%s -\n", __func__); |
| 293 | |
| 294 | } |
| 295 | |
| 296 | static void sde_edid_parse_Y420VDB( |
| 297 | struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl, |
| 298 | const u8 *db) |
| 299 | { |
| 300 | u8 len = db[0] & 0x1f; |
| 301 | u32 i = 0; |
| 302 | u32 video_format = 0; |
| 303 | |
| 304 | if (!edid_ctrl) { |
| 305 | SDE_ERROR("%s: invalid input\n", __func__); |
| 306 | return; |
| 307 | } |
| 308 | |
| 309 | SDE_EDID_DEBUG("%s +\n", __func__); |
| 310 | |
| 311 | /* Offset to byte 3 */ |
| 312 | db += 2; |
| 313 | for (i = 0; i < len - 1; i++) { |
| 314 | video_format = *(db + i) & 0x7F; |
| 315 | /* |
| 316 | * mode was already added in get_modes() |
| 317 | * only need to set the Y420 support flag |
| 318 | */ |
| 319 | sde_edid_set_y420_support(connector, video_format); |
| 320 | } |
| 321 | SDE_EDID_DEBUG("%s -", __func__); |
| 322 | } |
| 323 | |
| 324 | static void sde_edid_set_mode_format( |
| 325 | struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl) |
| 326 | { |
| 327 | const u8 *db = NULL; |
| 328 | struct drm_display_mode *mode; |
| 329 | |
| 330 | SDE_EDID_DEBUG("%s +\n", __func__); |
| 331 | /* Set YUV mode support flags for YCbcr420VDB */ |
| 332 | db = sde_edid_find_extended_tag_block(edid_ctrl->edid, |
| 333 | Y420_VIDEO_DATA_BLOCK); |
| 334 | if (db) |
| 335 | sde_edid_parse_Y420VDB(connector, edid_ctrl, db); |
| 336 | else |
| 337 | SDE_EDID_DEBUG("YCbCr420 VDB is not present\n"); |
| 338 | |
| 339 | /* Set RGB supported on all modes where YUV is not set */ |
| 340 | list_for_each_entry(mode, &connector->probed_modes, head) { |
| 341 | if (!(mode->flags & DRM_MODE_FLAG_SUPPORTS_YUV)) |
| 342 | mode->flags |= DRM_MODE_FLAG_SUPPORTS_RGB; |
| 343 | } |
| 344 | |
| 345 | |
| 346 | db = sde_edid_find_extended_tag_block(edid_ctrl->edid, |
| 347 | Y420_CAPABILITY_MAP_DATA_BLOCK); |
| 348 | if (db) |
| 349 | sde_edid_parse_Y420CMDB(connector, edid_ctrl, db); |
| 350 | else |
| 351 | SDE_EDID_DEBUG("YCbCr420 CMDB is not present\n"); |
| 352 | |
| 353 | SDE_EDID_DEBUG("%s -\n", __func__); |
| 354 | } |
| 355 | |
Abhinav Kumar | cd18751 | 2017-06-30 01:02:36 -0700 | [diff] [blame^] | 356 | static void _sde_edid_update_dc_modes( |
| 357 | struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl) |
| 358 | { |
| 359 | int i, start, end; |
| 360 | u8 *edid_ext, *hdmi; |
| 361 | struct drm_display_info *disp_info; |
| 362 | u32 hdmi_dc_yuv_modes = 0; |
| 363 | |
| 364 | SDE_EDID_DEBUG("%s +\n", __func__); |
| 365 | |
| 366 | if (!connector || !edid_ctrl) { |
| 367 | SDE_ERROR("invalid input\n"); |
| 368 | return; |
| 369 | } |
| 370 | |
| 371 | disp_info = &connector->display_info; |
| 372 | |
| 373 | edid_ext = sde_find_cea_extension(edid_ctrl->edid); |
| 374 | |
| 375 | if (!edid_ext) { |
| 376 | SDE_ERROR("no cea extension\n"); |
| 377 | return; |
| 378 | } |
| 379 | |
| 380 | if (sde_cea_db_offsets(edid_ext, &start, &end)) |
| 381 | return; |
| 382 | |
| 383 | sde_for_each_cea_db(edid_ext, i, start, end) { |
| 384 | if (sde_cea_db_is_hdmi_hf_vsdb(&edid_ext[i])) { |
| 385 | |
| 386 | hdmi = &edid_ext[i]; |
| 387 | |
| 388 | if (sde_cea_db_payload_len(hdmi) < 7) |
| 389 | continue; |
| 390 | |
| 391 | if (hdmi[7] & DRM_EDID_YCBCR420_DC_30) { |
| 392 | hdmi_dc_yuv_modes |= DRM_EDID_YCBCR420_DC_30; |
| 393 | SDE_EDID_DEBUG("Y420 30-bit supported\n"); |
| 394 | } |
| 395 | |
| 396 | if (hdmi[7] & DRM_EDID_YCBCR420_DC_36) { |
| 397 | hdmi_dc_yuv_modes |= DRM_EDID_YCBCR420_DC_36; |
| 398 | SDE_EDID_DEBUG("Y420 36-bit supported\n"); |
| 399 | } |
| 400 | |
| 401 | if (hdmi[7] & DRM_EDID_YCBCR420_DC_48) { |
| 402 | hdmi_dc_yuv_modes |= DRM_EDID_YCBCR420_DC_36; |
| 403 | SDE_EDID_DEBUG("Y420 48-bit supported\n"); |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | disp_info->edid_hdmi_dc_modes |= hdmi_dc_yuv_modes; |
| 409 | |
| 410 | SDE_EDID_DEBUG("%s -\n", __func__); |
| 411 | } |
| 412 | |
Padmanabhan Komanduru | cc9a1851 | 2017-05-03 13:59:02 -0700 | [diff] [blame] | 413 | static void _sde_edid_extract_audio_data_blocks( |
| 414 | struct sde_edid_ctrl *edid_ctrl) |
| 415 | { |
| 416 | u8 len = 0; |
| 417 | u8 adb_max = 0; |
| 418 | const u8 *adb = NULL; |
| 419 | u32 offset = DBC_START_OFFSET; |
| 420 | u8 *cea = NULL; |
| 421 | |
| 422 | if (!edid_ctrl) { |
| 423 | SDE_ERROR("invalid edid_ctrl\n"); |
| 424 | return; |
| 425 | } |
| 426 | SDE_EDID_DEBUG("%s +", __func__); |
| 427 | cea = sde_find_cea_extension(edid_ctrl->edid); |
| 428 | if (!cea) { |
| 429 | SDE_DEBUG("CEA extension not found\n"); |
| 430 | return; |
| 431 | } |
| 432 | |
| 433 | edid_ctrl->adb_size = 0; |
| 434 | |
| 435 | memset(edid_ctrl->audio_data_block, 0, |
| 436 | sizeof(edid_ctrl->audio_data_block)); |
| 437 | |
| 438 | do { |
| 439 | len = 0; |
| 440 | adb = _sde_edid_find_block(cea, offset, AUDIO_DATA_BLOCK, |
| 441 | &len); |
| 442 | |
| 443 | if ((adb == NULL) || (len > MAX_AUDIO_DATA_BLOCK_SIZE || |
| 444 | adb_max >= MAX_NUMBER_ADB)) { |
| 445 | if (!edid_ctrl->adb_size) { |
| 446 | SDE_DEBUG("No/Invalid Audio Data Block\n"); |
| 447 | return; |
| 448 | } |
| 449 | |
| 450 | continue; |
| 451 | } |
| 452 | |
| 453 | memcpy(edid_ctrl->audio_data_block + edid_ctrl->adb_size, |
| 454 | adb + 1, len); |
| 455 | offset = (adb - cea) + 1 + len; |
| 456 | |
| 457 | edid_ctrl->adb_size += len; |
| 458 | adb_max++; |
| 459 | } while (adb); |
| 460 | SDE_EDID_DEBUG("%s -", __func__); |
| 461 | } |
| 462 | |
| 463 | static void _sde_edid_extract_speaker_allocation_data( |
| 464 | struct sde_edid_ctrl *edid_ctrl) |
| 465 | { |
| 466 | u8 len; |
| 467 | const u8 *sadb = NULL; |
| 468 | u8 *cea = NULL; |
| 469 | |
| 470 | if (!edid_ctrl) { |
| 471 | SDE_ERROR("invalid edid_ctrl\n"); |
| 472 | return; |
| 473 | } |
| 474 | SDE_EDID_DEBUG("%s +", __func__); |
| 475 | cea = sde_find_cea_extension(edid_ctrl->edid); |
| 476 | if (!cea) { |
| 477 | SDE_DEBUG("CEA extension not found\n"); |
| 478 | return; |
| 479 | } |
| 480 | |
| 481 | sadb = _sde_edid_find_block(cea, DBC_START_OFFSET, |
| 482 | SPEAKER_ALLOCATION_DATA_BLOCK, &len); |
| 483 | if ((sadb == NULL) || (len != MAX_SPKR_ALLOC_DATA_BLOCK_SIZE)) { |
| 484 | SDE_DEBUG("No/Invalid Speaker Allocation Data Block\n"); |
| 485 | return; |
| 486 | } |
| 487 | |
| 488 | memcpy(edid_ctrl->spkr_alloc_data_block, sadb + 1, len); |
| 489 | edid_ctrl->sadb_size = len; |
| 490 | |
| 491 | SDE_EDID_DEBUG("speaker alloc data SP byte = %08x %s%s%s%s%s%s%s\n", |
| 492 | sadb[1], |
| 493 | (sadb[1] & BIT(0)) ? "FL/FR," : "", |
| 494 | (sadb[1] & BIT(1)) ? "LFE," : "", |
| 495 | (sadb[1] & BIT(2)) ? "FC," : "", |
| 496 | (sadb[1] & BIT(3)) ? "RL/RR," : "", |
| 497 | (sadb[1] & BIT(4)) ? "RC," : "", |
| 498 | (sadb[1] & BIT(5)) ? "FLC/FRC," : "", |
| 499 | (sadb[1] & BIT(6)) ? "RLC/RRC," : ""); |
| 500 | SDE_EDID_DEBUG("%s -", __func__); |
| 501 | } |
| 502 | |
| 503 | struct sde_edid_ctrl *sde_edid_init(void) |
| 504 | { |
| 505 | struct sde_edid_ctrl *edid_ctrl = NULL; |
| 506 | |
| 507 | SDE_EDID_DEBUG("%s +\n", __func__); |
| 508 | edid_ctrl = kzalloc(sizeof(*edid_ctrl), GFP_KERNEL); |
| 509 | if (!edid_ctrl) { |
| 510 | SDE_ERROR("edid_ctrl alloc failed\n"); |
| 511 | return NULL; |
| 512 | } |
| 513 | memset((edid_ctrl), 0, sizeof(*edid_ctrl)); |
| 514 | SDE_EDID_DEBUG("%s -\n", __func__); |
| 515 | return edid_ctrl; |
| 516 | } |
| 517 | |
| 518 | void sde_free_edid(void **input) |
| 519 | { |
| 520 | struct sde_edid_ctrl *edid_ctrl = (struct sde_edid_ctrl *)(*input); |
| 521 | |
| 522 | SDE_EDID_DEBUG("%s +", __func__); |
| 523 | kfree(edid_ctrl->edid); |
| 524 | edid_ctrl->edid = NULL; |
| 525 | } |
| 526 | |
| 527 | void sde_edid_deinit(void **input) |
| 528 | { |
| 529 | struct sde_edid_ctrl *edid_ctrl = (struct sde_edid_ctrl *)(*input); |
| 530 | |
| 531 | SDE_EDID_DEBUG("%s +", __func__); |
| 532 | sde_free_edid((void *)&edid_ctrl); |
| 533 | kfree(edid_ctrl); |
| 534 | SDE_EDID_DEBUG("%s -", __func__); |
| 535 | } |
| 536 | |
| 537 | int _sde_edid_update_modes(struct drm_connector *connector, |
| 538 | void *input) |
| 539 | { |
| 540 | int rc = 0; |
| 541 | struct sde_edid_ctrl *edid_ctrl = (struct sde_edid_ctrl *)(input); |
| 542 | |
| 543 | SDE_EDID_DEBUG("%s +", __func__); |
| 544 | if (edid_ctrl->edid) { |
| 545 | drm_mode_connector_update_edid_property(connector, |
| 546 | edid_ctrl->edid); |
| 547 | |
| 548 | rc = drm_add_edid_modes(connector, edid_ctrl->edid); |
| 549 | sde_edid_set_mode_format(connector, edid_ctrl); |
Abhinav Kumar | cd18751 | 2017-06-30 01:02:36 -0700 | [diff] [blame^] | 550 | _sde_edid_update_dc_modes(connector, edid_ctrl); |
Padmanabhan Komanduru | cc9a1851 | 2017-05-03 13:59:02 -0700 | [diff] [blame] | 551 | SDE_EDID_DEBUG("%s -", __func__); |
| 552 | return rc; |
| 553 | } |
| 554 | |
| 555 | drm_mode_connector_update_edid_property(connector, NULL); |
| 556 | SDE_EDID_DEBUG("%s null edid -", __func__); |
| 557 | return rc; |
| 558 | } |
| 559 | |
| 560 | bool sde_detect_hdmi_monitor(void *input) |
| 561 | { |
| 562 | struct sde_edid_ctrl *edid_ctrl = (struct sde_edid_ctrl *)(input); |
| 563 | |
| 564 | return drm_detect_hdmi_monitor(edid_ctrl->edid); |
| 565 | } |
| 566 | |
| 567 | void sde_get_edid(struct drm_connector *connector, |
| 568 | struct i2c_adapter *adapter, void **input) |
| 569 | { |
| 570 | struct sde_edid_ctrl *edid_ctrl = (struct sde_edid_ctrl *)(*input); |
| 571 | |
| 572 | edid_ctrl->edid = drm_get_edid(connector, adapter); |
| 573 | SDE_EDID_DEBUG("%s +\n", __func__); |
| 574 | |
| 575 | if (!edid_ctrl->edid) |
| 576 | SDE_ERROR("EDID read failed\n"); |
| 577 | |
| 578 | if (edid_ctrl->edid) { |
| 579 | sde_edid_extract_vendor_id(edid_ctrl); |
| 580 | _sde_edid_extract_audio_data_blocks(edid_ctrl); |
| 581 | _sde_edid_extract_speaker_allocation_data(edid_ctrl); |
| 582 | } |
| 583 | SDE_EDID_DEBUG("%s -\n", __func__); |
| 584 | }; |