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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200226112514.12455-45-laurent.pinchart@ideasonboard.com
This commit is contained in:
Laurent Pinchart 2020-02-26 13:25:04 +02:00 committed by Tomi Valkeinen
parent 7f113085af
commit b6067da4eb
1 changed files with 35 additions and 51 deletions

View File

@ -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,
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;
return hdmi_do_read_edid(hdmi, hdmi5_bridge_read_edid, connector); 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);
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 = {