diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-06-30 15:57:14 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2019-06-30 15:57:14 +0000 |
commit | 25ff6f8267378a4717a6326312d34ff1ab2fdcd7 (patch) | |
tree | 7ff9090d919b562db34c3141719c25305f750775 /sys | |
parent | f7aeb51850f1e48b231035c5b685ad925dfa7b5f (diff) |
drm: add fallback override/firmware EDID modes workaround
From Jani Nikula
04757d0e37897cdfa59050157b9083d661bd099e in linux 4.19.y/4.19.53
48eaeb7664c76139438724d520a1ea4a84a3ed92 in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/drm_edid.c | 30 | ||||
-rw-r--r-- | sys/dev/pci/drm/drm_probe_helper.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/drm/include/drm/drm_edid.h | 1 |
3 files changed, 38 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/drm_edid.c b/sys/dev/pci/drm/drm_edid.c index e969161f7b0..35892e859f6 100644 --- a/sys/dev/pci/drm/drm_edid.c +++ b/sys/dev/pci/drm/drm_edid.c @@ -1595,6 +1595,36 @@ static struct edid *drm_get_override_edid(struct drm_connector *connector) } /** + * drm_add_override_edid_modes - add modes from override/firmware EDID + * @connector: connector we're probing + * + * Add modes from the override/firmware EDID, if available. Only to be used from + * drm_helper_probe_single_connector_modes() as a fallback for when DDC probe + * failed during drm_get_edid() and caused the override/firmware EDID to be + * skipped. + * + * Return: The number of modes added or 0 if we couldn't find any. + */ +int drm_add_override_edid_modes(struct drm_connector *connector) +{ + struct edid *override; + int num_modes = 0; + + override = drm_get_override_edid(connector); + if (override) { + drm_connector_update_edid_property(connector, override); + num_modes = drm_add_edid_modes(connector, override); + kfree(override); + + DRM_DEBUG_KMS("[CONNECTOR:%d:%s] adding %d modes via fallback override/firmware EDID\n", + connector->base.id, connector->name, num_modes); + } + + return num_modes; +} +EXPORT_SYMBOL(drm_add_override_edid_modes); + +/** * drm_do_get_edid - get EDID data using a custom EDID block read function * @connector: connector we're probing * @get_edid_block: EDID block read function diff --git a/sys/dev/pci/drm/drm_probe_helper.c b/sys/dev/pci/drm/drm_probe_helper.c index 32312615c3a..5cbd1f54d71 100644 --- a/sys/dev/pci/drm/drm_probe_helper.c +++ b/sys/dev/pci/drm/drm_probe_helper.c @@ -481,6 +481,13 @@ retry: count = (*connector_funcs->get_modes)(connector); + /* + * Fallback for when DDC probe failed in drm_get_edid() and thus skipped + * override/firmware EDID. + */ + if (count == 0 && connector->status == connector_status_connected) + count = drm_add_override_edid_modes(connector); + if (count == 0 && connector->status == connector_status_connected) count = drm_add_modes_noedid(connector, 1024, 768); count += drm_helper_probe_add_cmdline_mode(connector); diff --git a/sys/dev/pci/drm/include/drm/drm_edid.h b/sys/dev/pci/drm/include/drm/drm_edid.h index 9eda6bd4cd3..269249b7f09 100644 --- a/sys/dev/pci/drm/include/drm/drm_edid.h +++ b/sys/dev/pci/drm/include/drm/drm_edid.h @@ -463,6 +463,7 @@ struct edid *drm_get_edid_switcheroo(struct drm_connector *connector, struct i2c_adapter *adapter); struct edid *drm_edid_duplicate(const struct edid *edid); int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); +int drm_add_override_edid_modes(struct drm_connector *connector); u8 drm_match_cea_mode(const struct drm_display_mode *to_match); enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code); |