Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/edid: Extract drm_edid_decode_mfg_id()

Make the PNPID decoding available for other users.

Cc: dri-devel@lists.freedesktop.org
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220510104242.6099-15-ville.syrjala@linux.intel.com

+17 -4
+17 -4
include/drm/drm_edid.h
··· 498 498 } 499 499 500 500 /** 501 + * drm_edid_decode_mfg_id - Decode the manufacturer ID 502 + * @mfg_id: The manufacturer ID 503 + * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0' 504 + * termination 505 + */ 506 + static inline const char *drm_edid_decode_mfg_id(u16 mfg_id, char vend[4]) 507 + { 508 + vend[0] = '@' + ((mfg_id >> 10) & 0x1f); 509 + vend[1] = '@' + ((mfg_id >> 5) & 0x1f); 510 + vend[2] = '@' + ((mfg_id >> 0) & 0x1f); 511 + vend[3] = '\0'; 512 + 513 + return vend; 514 + } 515 + 516 + /** 501 517 * drm_edid_encode_panel_id - Encode an ID for matching against drm_edid_get_panel_id() 502 518 * @vend_chr_0: First character of the vendor string. 503 519 * @vend_chr_1: Second character of the vendor string. ··· 553 537 static inline void drm_edid_decode_panel_id(u32 panel_id, char vend[4], u16 *product_id) 554 538 { 555 539 *product_id = (u16)(panel_id & 0xffff); 556 - vend[0] = '@' + ((panel_id >> 26) & 0x1f); 557 - vend[1] = '@' + ((panel_id >> 21) & 0x1f); 558 - vend[2] = '@' + ((panel_id >> 16) & 0x1f); 559 - vend[3] = '\0'; 540 + drm_edid_decode_mfg_id(panel_id >> 16, vend); 560 541 } 561 542 562 543 bool drm_probe_ddc(struct i2c_adapter *adapter);