Commit 5e546cd5 authored by Dave Airlie's avatar Dave Airlie

drm/edid: move displayid tiled block parsing into separate function.

This just makes the code easier to follow.
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent fcee5906
...@@ -4152,44 +4152,10 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, ...@@ -4152,44 +4152,10 @@ drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
} }
EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode); EXPORT_SYMBOL(drm_hdmi_vendor_infoframe_from_display_mode);
static int drm_parse_display_id(struct drm_connector *connector, static int drm_parse_tiled_block(struct drm_connector *connector,
u8 *displayid, int length, struct displayid_block *block)
bool is_edid_extension)
{ {
/* if this is an EDID extension the first byte will be 0x70 */
int idx = 0;
struct displayid_hdr *base;
struct displayid_block *block;
u8 csum = 0;
int i;
if (is_edid_extension)
idx = 1;
base = (struct displayid_hdr *)&displayid[idx];
DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
base->rev, base->bytes, base->prod_id, base->ext_count);
if (base->bytes + 5 > length - idx)
return -EINVAL;
for (i = idx; i <= base->bytes + 5; i++) {
csum += displayid[i];
}
if (csum) {
DRM_ERROR("DisplayID checksum invalid, remainder is %d\n", csum);
return -EINVAL;
}
block = (struct displayid_block *)&displayid[idx + 4];
DRM_DEBUG_KMS("block id %d, rev %d, len %d\n",
block->tag, block->rev, block->num_bytes);
switch (block->tag) {
case DATA_BLOCK_TILED_DISPLAY: {
struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block; struct displayid_tiled_block *tile = (struct displayid_tiled_block *)block;
u16 w, h; u16 w, h;
u8 tile_v_loc, tile_h_loc; u8 tile_v_loc, tile_h_loc;
u8 num_v_tile, num_h_tile; u8 num_v_tile, num_h_tile;
...@@ -4237,7 +4203,49 @@ static int drm_parse_display_id(struct drm_connector *connector, ...@@ -4237,7 +4203,49 @@ static int drm_parse_display_id(struct drm_connector *connector,
} else } else
/* if same tile group, then release the ref we just took. */ /* if same tile group, then release the ref we just took. */
drm_mode_put_tile_group(connector->dev, tg); drm_mode_put_tile_group(connector->dev, tg);
return 0;
}
static int drm_parse_display_id(struct drm_connector *connector,
u8 *displayid, int length,
bool is_edid_extension)
{
/* if this is an EDID extension the first byte will be 0x70 */
int idx = 0;
struct displayid_hdr *base;
struct displayid_block *block;
u8 csum = 0;
int i;
int ret;
if (is_edid_extension)
idx = 1;
base = (struct displayid_hdr *)&displayid[idx];
DRM_DEBUG_KMS("base revision 0x%x, length %d, %d %d\n",
base->rev, base->bytes, base->prod_id, base->ext_count);
if (base->bytes + 5 > length - idx)
return -EINVAL;
for (i = idx; i <= base->bytes + 5; i++) {
csum += displayid[i];
}
if (csum) {
DRM_ERROR("DisplayID checksum invalid, remainder is %d\n", csum);
return -EINVAL;
} }
block = (struct displayid_block *)&displayid[idx + 4];
DRM_DEBUG_KMS("block id %d, rev %d, len %d\n",
block->tag, block->rev, block->num_bytes);
switch (block->tag) {
case DATA_BLOCK_TILED_DISPLAY:
ret = drm_parse_tiled_block(connector, block);
if (ret)
return ret;
break; break;
default: default:
printk("unknown displayid tag %d\n", block->tag); printk("unknown displayid tag %d\n", block->tag);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment