Skip to content

Commit e47c02e

Browse files
gary_genBrossKuo
authored andcommitted
Hdmi: Add check edid function to avoid drm panic
Change-Id: Id53fea6076d5e7425e0a18cf824b2f0bce61c757
1 parent a5c4a65 commit e47c02e

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

drivers/gpu/drm/bridge/synopsys/dw-hdmi.c

100644100755
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2750,6 +2750,24 @@ static void dw_hdmi_connector_force(struct drm_connector *connector)
27502750
mutex_unlock(&hdmi->mutex);
27512751
}
27522752

2753+
static bool dw_hdmi_connector_check_edid(struct drm_connector *connector)
2754+
{
2755+
struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
2756+
connector);
2757+
struct edid *edid;
2758+
2759+
if (!hdmi->ddc)
2760+
return false;
2761+
2762+
edid = drm_get_edid(connector, hdmi->ddc);
2763+
if (edid) {
2764+
kfree(edid);
2765+
return true;
2766+
} else {
2767+
return false;
2768+
}
2769+
}
2770+
27532771
static const struct drm_connector_funcs dw_hdmi_connector_funcs = {
27542772
.dpms = drm_helper_connector_dpms,
27552773
.fill_modes = drm_helper_probe_single_connector_modes,
@@ -2778,6 +2796,7 @@ static const struct drm_connector_helper_funcs dw_hdmi_connector_helper_funcs =
27782796
.best_encoder = dw_hdmi_connector_best_encoder,
27792797
.atomic_begin = dw_hdmi_connector_atomic_begin,
27802798
.atomic_flush = dw_hdmi_connector_atomic_flush,
2799+
.check_edid = dw_hdmi_connector_check_edid,
27812800
};
27822801

27832802
static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {

drivers/gpu/drm/drm_probe_helper.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,10 +265,12 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
265265
connector->name);
266266

267267
if (!strcmp(connector->name, "HDMI-A-1")) {
268-
edid_manufacturer = (struct edid *) connector->edid_blob_ptr->data;
269-
drm_iex_monitor = drm_dect_iex_edid(edid_manufacturer);
270-
drm_acer_kg221q_monitor = drm_dect_acer_kg221q_edid(edid_manufacturer);
271-
drm_asus_vz229h_monitor = drm_dect_asus_vz229h_edid(edid_manufacturer);
268+
if( (*connector_funcs->check_edid)(connector) ) {
269+
edid_manufacturer = (struct edid *) connector->edid_blob_ptr->data;
270+
drm_iex_monitor = drm_dect_iex_edid(edid_manufacturer);
271+
drm_acer_kg221q_monitor = drm_dect_acer_kg221q_edid(edid_manufacturer);
272+
drm_asus_vz229h_monitor = drm_dect_asus_vz229h_edid(edid_manufacturer);
273+
}
272274
}
273275
list_for_each_entry(mode, &connector->modes, head) {
274276
drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);

include/drm/drm_crtc_helper.h

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ struct drm_connector_helper_funcs {
189189
struct drm_connector_state *conn_state);
190190
void (*atomic_flush)(struct drm_connector *connector,
191191
struct drm_connector_state *conn_state);
192+
bool (*check_edid)(struct drm_connector *connector);
192193
};
193194

194195
extern void drm_helper_disable_unused_functions(struct drm_device *dev);

0 commit comments

Comments
 (0)