Commit b6067da4 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Tomi Valkeinen

drm/omap: hdmi5: Simplify EDID read

Now that the omap_dss_device EDID read operation has been removed,
simplify the bridge-based EDID access by merging multiple functions
together.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: default avatarTomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-45-laurent.pinchart@ideasonboard.com
parent 7f113085
...@@ -307,50 +307,6 @@ static void hdmi_core_disable(struct omap_hdmi *hdmi) ...@@ -307,50 +307,6 @@ static void hdmi_core_disable(struct omap_hdmi *hdmi)
mutex_unlock(&hdmi->lock); mutex_unlock(&hdmi->lock);
} }
static struct edid *
hdmi_do_read_edid(struct omap_hdmi *hdmi,
struct edid *(*read)(struct omap_hdmi *hdmi,
struct drm_connector *connector),
struct drm_connector *connector)
{
struct edid *edid;
bool need_enable;
int idlemode;
int r;
need_enable = hdmi->core_enabled == false;
if (need_enable) {
r = hdmi_core_enable(hdmi);
if (r)
return NULL;
}
mutex_lock(&hdmi->lock);
r = hdmi_runtime_get(hdmi);
BUG_ON(r);
idlemode = REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2);
/* No-idle mode */
REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2);
hdmi5_core_ddc_init(&hdmi->core);
edid = read(hdmi, connector);
hdmi5_core_ddc_uninit(&hdmi->core);
REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2);
hdmi_runtime_put(hdmi);
mutex_unlock(&hdmi->lock);
if (need_enable)
hdmi_core_disable(hdmi);
return (struct edid *)edid;
}
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* DRM Bridge Operations * DRM Bridge Operations
*/ */
...@@ -469,18 +425,46 @@ static void hdmi5_bridge_disable(struct drm_bridge *bridge, ...@@ -469,18 +425,46 @@ static void hdmi5_bridge_disable(struct drm_bridge *bridge,
mutex_unlock(&hdmi->lock); mutex_unlock(&hdmi->lock);
} }
static struct edid *hdmi5_bridge_read_edid(struct omap_hdmi *hdmi,
struct drm_connector *connector)
{
return drm_do_get_edid(connector, hdmi5_core_ddc_read, &hdmi->core);
}
static struct edid *hdmi5_bridge_get_edid(struct drm_bridge *bridge, static struct edid *hdmi5_bridge_get_edid(struct drm_bridge *bridge,
struct drm_connector *connector) struct drm_connector *connector)
{ {
struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge); struct omap_hdmi *hdmi = drm_bridge_to_hdmi(bridge);
struct edid *edid;
bool need_enable;
int idlemode;
int r;
need_enable = hdmi->core_enabled == false;
if (need_enable) {
r = hdmi_core_enable(hdmi);
if (r)
return NULL;
}
mutex_lock(&hdmi->lock);
r = hdmi_runtime_get(hdmi);
BUG_ON(r);
idlemode = REG_GET(hdmi->wp.base, HDMI_WP_SYSCONFIG, 3, 2);
/* No-idle mode */
REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, 1, 3, 2);
hdmi5_core_ddc_init(&hdmi->core);
edid = drm_do_get_edid(connector, hdmi5_core_ddc_read, &hdmi->core);
hdmi5_core_ddc_uninit(&hdmi->core);
return hdmi_do_read_edid(hdmi, hdmi5_bridge_read_edid, connector); REG_FLD_MOD(hdmi->wp.base, HDMI_WP_SYSCONFIG, idlemode, 3, 2);
hdmi_runtime_put(hdmi);
mutex_unlock(&hdmi->lock);
if (need_enable)
hdmi_core_disable(hdmi);
return (struct edid *)edid;
} }
static const struct drm_bridge_funcs hdmi5_bridge_funcs = { static const struct drm_bridge_funcs hdmi5_bridge_funcs = {
......
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