diff options
author | Dave Airlie <airlied@redhat.com> | 2021-09-24 06:48:48 +0300 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2021-09-24 06:49:08 +0300 |
commit | f602a96e025272d237a61df455b12893aa782d33 (patch) | |
tree | 39b4bfd65465ca9677fa2deda2378bc3ded79131 /include | |
parent | 0dfc70818a3c4bbab647a0683cc6ed448f5cdbea (diff) | |
parent | 9c2fce137852e6434ca0c6fe3d75e00feb168c07 (diff) | |
download | linux-f602a96e025272d237a61df455b12893aa782d33.tar.xz |
Merge tag 'drm-misc-next-2021-09-23' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-next for 5.15:
UAPI Changes:
Cross-subsystem Changes:
Core Changes:
Driver Changes:
- Conversions to dev_err_probe() helper
- rockchip: Various build improvements, Use
DRM_BRIDGE_ATTACH_NO_CONNECTOR for LVDS and RGB
- panel: New panel-edp driver
Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20210923074522.zaja7mzxeimxf6g3@gilmour
Diffstat (limited to 'include')
-rw-r--r-- | include/drm/drm_edid.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h index deccfd39e6db..ccc80cb7f86a 100644 --- a/include/drm/drm_edid.h +++ b/include/drm/drm_edid.h @@ -508,6 +508,50 @@ static inline u8 drm_eld_get_conn_type(const uint8_t *eld) return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK; } +/** + * drm_edid_encode_panel_id - Encode an ID for matching against drm_edid_get_panel_id() + * @vend: 3-character vendor string + * @product_id: The 16-bit product ID. + * + * This is a macro so that it can be calculated at compile time and used + * as an initializer. + * + * For instance: + * drm_edid_encode_panel_id("BOE", 0x2d08) => 0x09e52d08 + * + * Return: a 32-bit ID per panel. + */ +#define drm_edid_encode_panel_id(vend, product_id) \ + ((((u32)((vend)[0]) - '@') & 0x1f) << 26 | \ + (((u32)((vend)[1]) - '@') & 0x1f) << 21 | \ + (((u32)((vend)[2]) - '@') & 0x1f) << 16 | \ + ((product_id) & 0xffff)) + +/** + * drm_edid_decode_panel_id - Decode a panel ID from drm_edid_encode_panel_id() + * @panel_id: The panel ID to decode. + * @vend: A 4-byte buffer to store the 3-letter vendor string plus a '\0' + * termination + * @product_id: The product ID will be returned here. + * + * For instance, after: + * drm_edid_decode_panel_id(0x09e52d08, vend, &product_id) + * These will be true: + * vend[0] = 'B' + * vend[1] = 'O' + * vend[2] = 'E' + * vend[3] = '\0' + * product_id = 0x2d08 + */ +static inline void drm_edid_decode_panel_id(u32 panel_id, char vend[4], u16 *product_id) +{ + *product_id = (u16)(panel_id & 0xffff); + vend[0] = '@' + ((panel_id >> 26) & 0x1f); + vend[1] = '@' + ((panel_id >> 21) & 0x1f); + vend[2] = '@' + ((panel_id >> 16) & 0x1f); + vend[3] = '\0'; +} + bool drm_probe_ddc(struct i2c_adapter *adapter); struct edid *drm_do_get_edid(struct drm_connector *connector, int (*get_edid_block)(void *data, u8 *buf, unsigned int block, @@ -515,6 +559,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, void *data); struct edid *drm_get_edid(struct drm_connector *connector, struct i2c_adapter *adapter); +u32 drm_edid_get_panel_id(struct i2c_adapter *adapter); struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_edid_duplicate(const struct edid *edid); |