Commit d9ba1b4c authored by Jani Nikula's avatar Jani Nikula

drm/displayid: convert to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Rebase
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarAnkit Nautiyal <ankit.k.nautiyal@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a52a6882e87a4bb6b1670918f3aba13f9b52f6de.1652097712.git.jani.nikula@intel.com
parent c7b2dee4
...@@ -33,11 +33,11 @@ static int validate_displayid(const u8 *displayid, int length, int idx) ...@@ -33,11 +33,11 @@ static int validate_displayid(const u8 *displayid, int length, int idx)
return 0; return 0;
} }
static const u8 *drm_find_displayid_extension(const struct edid *edid, static const u8 *drm_find_displayid_extension(const struct drm_edid *drm_edid,
int *length, int *idx, int *length, int *idx,
int *ext_index) int *ext_index)
{ {
const u8 *displayid = drm_find_edid_extension(edid, DISPLAYID_EXT, ext_index); const u8 *displayid = drm_find_edid_extension(drm_edid, DISPLAYID_EXT, ext_index);
const struct displayid_header *base; const struct displayid_header *base;
int ret; int ret;
...@@ -58,12 +58,12 @@ static const u8 *drm_find_displayid_extension(const struct edid *edid, ...@@ -58,12 +58,12 @@ static const u8 *drm_find_displayid_extension(const struct edid *edid,
return displayid; return displayid;
} }
void displayid_iter_edid_begin(const struct edid *edid, void displayid_iter_edid_begin(const struct drm_edid *drm_edid,
struct displayid_iter *iter) struct displayid_iter *iter)
{ {
memset(iter, 0, sizeof(*iter)); memset(iter, 0, sizeof(*iter));
iter->edid = edid; iter->drm_edid = drm_edid;
} }
static const struct displayid_block * static const struct displayid_block *
...@@ -88,7 +88,7 @@ __displayid_iter_next(struct displayid_iter *iter) ...@@ -88,7 +88,7 @@ __displayid_iter_next(struct displayid_iter *iter)
{ {
const struct displayid_block *block; const struct displayid_block *block;
if (!iter->edid) if (!iter->drm_edid)
return NULL; return NULL;
if (iter->section) { if (iter->section) {
...@@ -96,7 +96,7 @@ __displayid_iter_next(struct displayid_iter *iter) ...@@ -96,7 +96,7 @@ __displayid_iter_next(struct displayid_iter *iter)
block = displayid_iter_block(iter); block = displayid_iter_block(iter);
if (WARN_ON(!block)) { if (WARN_ON(!block)) {
iter->section = NULL; iter->section = NULL;
iter->edid = NULL; iter->drm_edid = NULL;
return NULL; return NULL;
} }
...@@ -109,12 +109,12 @@ __displayid_iter_next(struct displayid_iter *iter) ...@@ -109,12 +109,12 @@ __displayid_iter_next(struct displayid_iter *iter)
} }
for (;;) { for (;;) {
iter->section = drm_find_displayid_extension(iter->edid, iter->section = drm_find_displayid_extension(iter->drm_edid,
&iter->length, &iter->length,
&iter->idx, &iter->idx,
&iter->ext_index); &iter->ext_index);
if (!iter->section) { if (!iter->section) {
iter->edid = NULL; iter->drm_edid = NULL;
return NULL; return NULL;
} }
......
...@@ -3563,10 +3563,13 @@ static int add_detailed_modes(struct drm_connector *connector, ...@@ -3563,10 +3563,13 @@ static int add_detailed_modes(struct drm_connector *connector,
/* /*
* Search EDID for CEA extension block. * Search EDID for CEA extension block.
*
* FIXME: Prefer not returning pointers to raw EDID data.
*/ */
const u8 *drm_find_edid_extension(const struct edid *edid, const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid,
int ext_id, int *ext_index) int ext_id, int *ext_index)
{ {
const struct edid *edid = drm_edid ? drm_edid->edid : NULL;
const u8 *edid_ext = NULL; const u8 *edid_ext = NULL;
int i; int i;
...@@ -3598,11 +3601,11 @@ static bool drm_edid_has_cta_extension(const struct drm_edid *drm_edid) ...@@ -3598,11 +3601,11 @@ static bool drm_edid_has_cta_extension(const struct drm_edid *drm_edid)
bool found = false; bool found = false;
/* Look for a top level CEA extension block */ /* Look for a top level CEA extension block */
if (drm_find_edid_extension(drm_edid->edid, CEA_EXT, &ext_index)) if (drm_find_edid_extension(drm_edid, CEA_EXT, &ext_index))
return true; return true;
/* CEA blocks can also be found embedded in a DisplayID block */ /* CEA blocks can also be found embedded in a DisplayID block */
displayid_iter_edid_begin(drm_edid->edid, &iter); displayid_iter_edid_begin(drm_edid, &iter);
displayid_iter_for_each(block, &iter) { displayid_iter_for_each(block, &iter) {
if (block->tag == DATA_BLOCK_CTA) { if (block->tag == DATA_BLOCK_CTA) {
found = true; found = true;
...@@ -4454,7 +4457,7 @@ static void cea_db_iter_edid_begin(const struct drm_edid *drm_edid, ...@@ -4454,7 +4457,7 @@ static void cea_db_iter_edid_begin(const struct drm_edid *drm_edid,
memset(iter, 0, sizeof(*iter)); memset(iter, 0, sizeof(*iter));
drm_edid_iter_begin(drm_edid, &iter->edid_iter); drm_edid_iter_begin(drm_edid, &iter->edid_iter);
displayid_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter->displayid_iter); displayid_iter_edid_begin(drm_edid, &iter->displayid_iter);
} }
static const struct cea_db * static const struct cea_db *
...@@ -5657,7 +5660,7 @@ static void drm_update_mso(struct drm_connector *connector, ...@@ -5657,7 +5660,7 @@ static void drm_update_mso(struct drm_connector *connector,
const struct displayid_block *block; const struct displayid_block *block;
struct displayid_iter iter; struct displayid_iter iter;
displayid_iter_edid_begin(drm_edid->edid, &iter); displayid_iter_edid_begin(drm_edid, &iter);
displayid_iter_for_each(block, &iter) { displayid_iter_for_each(block, &iter) {
if (block->tag == DATA_BLOCK_2_VENDOR_SPECIFIC) if (block->tag == DATA_BLOCK_2_VENDOR_SPECIFIC)
drm_parse_vesa_mso_data(connector, block); drm_parse_vesa_mso_data(connector, block);
...@@ -5872,7 +5875,7 @@ static int add_displayid_detailed_modes(struct drm_connector *connector, ...@@ -5872,7 +5875,7 @@ static int add_displayid_detailed_modes(struct drm_connector *connector,
struct displayid_iter iter; struct displayid_iter iter;
int num_modes = 0; int num_modes = 0;
displayid_iter_edid_begin(drm_edid->edid, &iter); displayid_iter_edid_begin(drm_edid, &iter);
displayid_iter_for_each(block, &iter) { displayid_iter_for_each(block, &iter) {
if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING || if (block->tag == DATA_BLOCK_TYPE_1_DETAILED_TIMING ||
block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING) block->tag == DATA_BLOCK_2_TYPE_7_DETAILED_TIMING)
...@@ -6372,7 +6375,7 @@ static void _drm_update_tile_info(struct drm_connector *connector, ...@@ -6372,7 +6375,7 @@ static void _drm_update_tile_info(struct drm_connector *connector,
connector->has_tile = false; connector->has_tile = false;
displayid_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter); displayid_iter_edid_begin(drm_edid, &iter);
displayid_iter_for_each(block, &iter) { displayid_iter_for_each(block, &iter) {
if (block->tag == DATA_BLOCK_TILED_DISPLAY) if (block->tag == DATA_BLOCK_TILED_DISPLAY)
drm_parse_tiled_block(connector, block); drm_parse_tiled_block(connector, block);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/bits.h> #include <linux/bits.h>
struct edid; struct drm_edid;
#define VESA_IEEE_OUI 0x3a0292 #define VESA_IEEE_OUI 0x3a0292
...@@ -141,7 +141,7 @@ struct displayid_vesa_vendor_specific_block { ...@@ -141,7 +141,7 @@ struct displayid_vesa_vendor_specific_block {
/* DisplayID iteration */ /* DisplayID iteration */
struct displayid_iter { struct displayid_iter {
const struct edid *edid; const struct drm_edid *drm_edid;
const u8 *section; const u8 *section;
int length; int length;
...@@ -149,7 +149,7 @@ struct displayid_iter { ...@@ -149,7 +149,7 @@ struct displayid_iter {
int ext_index; int ext_index;
}; };
void displayid_iter_edid_begin(const struct edid *edid, void displayid_iter_edid_begin(const struct drm_edid *drm_edid,
struct displayid_iter *iter); struct displayid_iter *iter);
const struct displayid_block * const struct displayid_block *
__displayid_iter_next(struct displayid_iter *iter); __displayid_iter_next(struct displayid_iter *iter);
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <drm/drm_mode.h> #include <drm/drm_mode.h>
struct drm_device; struct drm_device;
struct drm_edid;
struct i2c_adapter; struct i2c_adapter;
#define EDID_LENGTH 128 #define EDID_LENGTH 128
...@@ -578,8 +579,9 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, ...@@ -578,8 +579,9 @@ struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
struct drm_display_mode * struct drm_display_mode *
drm_display_mode_from_cea_vic(struct drm_device *dev, drm_display_mode_from_cea_vic(struct drm_device *dev,
u8 video_code); u8 video_code);
const u8 *drm_find_edid_extension(const struct edid *edid,
int ext_id, int *ext_index);
/* Interface based on struct drm_edid */
const u8 *drm_find_edid_extension(const struct drm_edid *drm_edid,
int ext_id, int *ext_index);
#endif /* __DRM_EDID_H__ */ #endif /* __DRM_EDID_H__ */
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