Commit 5e87b2e5 authored by Jani Nikula's avatar Jani Nikula

drm/edid: convert cea_db_iter_edid_begin() to drm_edid

We'll need to propagate drm_edid everywhere.

v2: Handle NULL drm_edid
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/7d9f060815086e1e4ea037dbfb9fd8ad54d1f25e.1652097712.git.jani.nikula@intel.com
parent 0c057877
...@@ -4448,12 +4448,13 @@ static bool cea_db_is_vendor(const struct cea_db *db, int vendor_oui) ...@@ -4448,12 +4448,13 @@ static bool cea_db_is_vendor(const struct cea_db *db, int vendor_oui)
oui(data[2], data[1], data[0]) == vendor_oui; oui(data[2], data[1], data[0]) == vendor_oui;
} }
static void cea_db_iter_edid_begin(const struct edid *edid, struct cea_db_iter *iter) static void cea_db_iter_edid_begin(const struct drm_edid *drm_edid,
struct cea_db_iter *iter)
{ {
memset(iter, 0, sizeof(*iter)); memset(iter, 0, sizeof(*iter));
drm_edid_iter_begin(edid, &iter->edid_iter); drm_edid_iter_begin(drm_edid ? drm_edid->edid : NULL, &iter->edid_iter);
displayid_iter_edid_begin(edid, &iter->displayid_iter); displayid_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter->displayid_iter);
} }
static const struct cea_db * static const struct cea_db *
...@@ -4675,7 +4676,7 @@ static int add_cea_modes(struct drm_connector *connector, ...@@ -4675,7 +4676,7 @@ static int add_cea_modes(struct drm_connector *connector,
struct cea_db_iter iter; struct cea_db_iter iter;
int modes = 0; int modes = 0;
cea_db_iter_edid_begin(drm_edid->edid, &iter); cea_db_iter_edid_begin(drm_edid, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
const u8 *hdmi = NULL, *video = NULL; const u8 *hdmi = NULL, *video = NULL;
u8 hdmi_len = 0, video_len = 0; u8 hdmi_len = 0, video_len = 0;
...@@ -4926,7 +4927,7 @@ static void drm_edid_to_eld(struct drm_connector *connector, ...@@ -4926,7 +4927,7 @@ static void drm_edid_to_eld(struct drm_connector *connector,
eld[DRM_ELD_PRODUCT_CODE0] = drm_edid->edid->prod_code[0]; eld[DRM_ELD_PRODUCT_CODE0] = drm_edid->edid->prod_code[0];
eld[DRM_ELD_PRODUCT_CODE1] = drm_edid->edid->prod_code[1]; eld[DRM_ELD_PRODUCT_CODE1] = drm_edid->edid->prod_code[1];
cea_db_iter_edid_begin(drm_edid->edid, &iter); cea_db_iter_edid_begin(drm_edid, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
const u8 *data = cea_db_data(db); const u8 *data = cea_db_data(db);
int len = cea_db_payload_len(db); int len = cea_db_payload_len(db);
...@@ -4979,7 +4980,7 @@ static int _drm_edid_to_sad(const struct drm_edid *drm_edid, ...@@ -4979,7 +4980,7 @@ static int _drm_edid_to_sad(const struct drm_edid *drm_edid,
struct cea_db_iter iter; struct cea_db_iter iter;
int count = 0; int count = 0;
cea_db_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter); cea_db_iter_edid_begin(drm_edid, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
if (cea_db_tag(db) == CTA_DB_AUDIO) { if (cea_db_tag(db) == CTA_DB_AUDIO) {
int j; int j;
...@@ -5032,7 +5033,7 @@ static int _drm_edid_to_speaker_allocation(const struct drm_edid *drm_edid, ...@@ -5032,7 +5033,7 @@ static int _drm_edid_to_speaker_allocation(const struct drm_edid *drm_edid,
struct cea_db_iter iter; struct cea_db_iter iter;
int count = 0; int count = 0;
cea_db_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter); cea_db_iter_edid_begin(drm_edid, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
if (cea_db_tag(db) == CTA_DB_SPEAKER && if (cea_db_tag(db) == CTA_DB_SPEAKER &&
cea_db_payload_len(db) == 3) { cea_db_payload_len(db) == 3) {
...@@ -5123,7 +5124,7 @@ static bool _drm_detect_hdmi_monitor(const struct drm_edid *drm_edid) ...@@ -5123,7 +5124,7 @@ static bool _drm_detect_hdmi_monitor(const struct drm_edid *drm_edid)
* Because HDMI identifier is in Vendor Specific Block, * Because HDMI identifier is in Vendor Specific Block,
* search it from all data blocks of CEA extension. * search it from all data blocks of CEA extension.
*/ */
cea_db_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter); cea_db_iter_edid_begin(drm_edid, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
if (cea_db_is_hdmi_vsdb(db)) { if (cea_db_is_hdmi_vsdb(db)) {
hdmi = true; hdmi = true;
...@@ -5177,7 +5178,7 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid) ...@@ -5177,7 +5178,7 @@ static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
goto end; goto end;
} }
cea_db_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter); cea_db_iter_edid_begin(drm_edid, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
if (cea_db_tag(db) == CTA_DB_AUDIO) { if (cea_db_tag(db) == CTA_DB_AUDIO) {
const u8 *data = cea_db_data(db); const u8 *data = cea_db_data(db);
...@@ -5536,7 +5537,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector, ...@@ -5536,7 +5537,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
} }
drm_edid_iter_end(&edid_iter); drm_edid_iter_end(&edid_iter);
cea_db_iter_edid_begin(drm_edid->edid, &iter); cea_db_iter_edid_begin(drm_edid, &iter);
cea_db_iter_for_each(db, &iter) { cea_db_iter_for_each(db, &iter) {
/* FIXME: convert parsers to use struct cea_db */ /* FIXME: convert parsers to use struct cea_db */
const u8 *data = (const u8 *)db; const u8 *data = (const u8 *)db;
......
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