summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/dss/hdmi4.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-02-26 14:24:48 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2020-02-26 14:31:52 +0300
commit0fe37173ce0ec7ca23232a1a242059db73c0ff16 (patch)
tree45ca4a989dcdc14eb1a843d57f7ffd2e9afcc2d0 /drivers/gpu/drm/omapdrm/dss/hdmi4.c
parentdb0fefd1b90d7d2a23090e9178ce742fe1b0aadd (diff)
downloadlinux-0fe37173ce0ec7ca23232a1a242059db73c0ff16.tar.xz
drm/omap: hdmi: Allocate EDID in the .read_edid() operation
Bring the omapdss-specific .read_edid() operation in sync with the drm_bridge .get_edid() operation to ease code reuse. 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-29-laurent.pinchart@ideasonboard.com
Diffstat (limited to 'drivers/gpu/drm/omapdrm/dss/hdmi4.c')
-rw-r--r--drivers/gpu/drm/omapdrm/dss/hdmi4.c36
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4.c b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
index dd4a14fe7e59..e15fa3862922 100644
--- a/drivers/gpu/drm/omapdrm/dss/hdmi4.c
+++ b/drivers/gpu/drm/omapdrm/dss/hdmi4.c
@@ -405,31 +405,45 @@ static void hdmi_disconnect(struct omap_dss_device *src,
omapdss_device_disconnect(dst, dst->next);
}
-static int hdmi_read_edid(struct omap_dss_device *dssdev,
- u8 *edid, int len)
+#define MAX_EDID 512
+
+static struct edid *hdmi_read_edid(struct omap_dss_device *dssdev)
{
struct omap_hdmi *hdmi = dssdev_to_hdmi(dssdev);
bool need_enable;
+ u8 *edid;
int r;
+ edid = kzalloc(MAX_EDID, GFP_KERNEL);
+ if (!edid)
+ return NULL;
+
need_enable = hdmi->core_enabled == false;
if (need_enable) {
r = hdmi4_core_enable(&hdmi->core);
- if (r)
- return r;
+ if (r) {
+ kfree(edid);
+ return NULL;
+ }
+ }
+
+ r = read_edid(hdmi, edid, MAX_EDID);
+ if (r < 0) {
+ kfree(edid);
+ edid = NULL;
+ } else {
+ unsigned int cec_addr;
+
+ cec_addr = r >= 256 ? cec_get_edid_phys_addr(edid, r, NULL)
+ : CEC_PHYS_ADDR_INVALID;
+ hdmi4_cec_set_phys_addr(&hdmi->core, cec_addr);
}
- r = read_edid(hdmi, edid, len);
- if (r >= 256)
- hdmi4_cec_set_phys_addr(&hdmi->core,
- cec_get_edid_phys_addr(edid, r, NULL));
- else
- hdmi4_cec_set_phys_addr(&hdmi->core, CEC_PHYS_ADDR_INVALID);
if (need_enable)
hdmi4_core_disable(&hdmi->core);
- return r;
+ return (struct edid *)edid;
}
static void hdmi_lost_hotplug(struct omap_dss_device *dssdev)