@@ -361,12 +361,19 @@ static int drm_helper_probe_get_modes(struct drm_connector *connector)
int count;
if (connector_funcs->get_modes) {
+ /* No point in having both set */
+ drm_WARN_ON_ONCE(connector->dev, connector_funcs->get_edid);
+
count = connector_funcs->get_modes(connector);
} else {
const struct drm_edid *drm_edid;
- /* Note: This requires connector->ddc is set */
- drm_edid = drm_edid_read(connector);
+ if (connector_funcs->get_edid) {
+ drm_edid = connector_funcs->get_edid(connector);
+ } else {
+ /* Note: This requires connector->ddc is set */
+ drm_edid = drm_edid_read(connector);
+ }
/* Update modes etc. from the EDID */
count = drm_edid_connector_update(connector, drm_edid);
@@ -49,6 +49,7 @@
*/
enum mode_set_atomic;
+struct drm_edid;
struct drm_writeback_connector;
struct drm_writeback_job;
@@ -894,9 +895,10 @@ struct drm_connector_helper_funcs {
* libraries always call this with the &drm_mode_config.connection_mutex
* held. Because of this it's safe to inspect &drm_connector->state.
*
- * This callback is optional. By default, it reads the EDID using
- * drm_edid_read() and updates the connector display info, modes, and
- * properties using drm_edid_connector_update().
+ * This callback is optional. By default, it reads the EDID using the
+ * .get_edid() callback if set, drm_edid_read() otherwise, and updates
+ * the connector display info, modes, and properties using
+ * drm_edid_connector_update().
*
* RETURNS:
*
@@ -904,6 +906,19 @@ struct drm_connector_helper_funcs {
*/
int (*get_modes)(struct drm_connector *connector);
+ /**
+ * @get_edid:
+ *
+ * If the get_modes() callback is not set, this function gets called to
+ * retrieve the EDID. This callback is optional. By default,
+ * drm_edid_read() is used.
+ *
+ * This function must return a copy of the EDID; the returned pointer
+ * will be freed using drm_edid_free(). Usually it would be a copy of a
+ * previously cached EDID.
+ */
+ const struct drm_edid *(*get_edid)(struct drm_connector *connector);
+
/**
* @detect_ctx:
*
Add a hook for custom .get_edid() when .get_modes() is not set. Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/drm_probe_helper.c | 11 +++++++++-- include/drm/drm_modeset_helper_vtables.h | 21 ++++++++++++++++++--- 2 files changed, 27 insertions(+), 5 deletions(-)