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
Esse commit está contido em:
Laurent Pinchart
2020-02-26 13:24:48 +02:00
commit de Tomi Valkeinen
commit 0fe37173ce
4 arquivos alterados com 47 adições e 27 exclusões

Ver arquivo

@@ -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)