summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-02-26 13:25:04 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2020-02-26 13:32:05 +0200
commitb6067da4ebf9db5e4b026220b13dce3528032b88 (patch)
tree97e5b7e5bd39b3456cd2224bc0fc802c74fd3e0a
parent7f113085af93a2949ffdde95e5ea21ef8c65c76d (diff)
downloadlinux-b6067da4ebf9db5e4b026220b13dce3528032b88.tar.bz2
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
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi5.c86
1 files changed, 35 insertions, 51 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi5.c b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
index 6cb709c775d6..4d4c1fabd0a1 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi5.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi5.c
@@ -307,50 +307,6 @@ static void hdmi_core_disable(struct omap_hdmi *hdmi)
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
*/
@@ -469,18 +425,46 @@ static void hdmi5_bridge_disable(struct drm_bridge *bridge,
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,
struct drm_connector *connector)
{
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);
- return hdmi_do_read_edid(hdmi, hdmi5_bridge_read_edid, connector);
+ 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 = {