Commit 6ebe4020 authored by Jani Nikula's avatar Jani Nikula

drm: bridge: dw_hdmi: switch to ->edid_read callback

Prefer using the struct drm_edid based callback and functions.

v2: Fix -Wuninitialized (kernel test robot)
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/400bfdeca4fd25b7624286e5969c4b0b1331c2b4.1706038510.git.jani.nikula@intel.com
parent 56e7ce5d
...@@ -2454,27 +2454,35 @@ static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi) ...@@ -2454,27 +2454,35 @@ static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi)
return result; return result;
} }
static struct edid *dw_hdmi_get_edid(struct dw_hdmi *hdmi, static const struct drm_edid *dw_hdmi_edid_read(struct dw_hdmi *hdmi,
struct drm_connector *connector) struct drm_connector *connector)
{ {
struct edid *edid; const struct drm_edid *drm_edid;
const struct edid *edid;
if (!hdmi->ddc) if (!hdmi->ddc)
return NULL; return NULL;
edid = drm_get_edid(connector, hdmi->ddc); drm_edid = drm_edid_read_ddc(connector, hdmi->ddc);
if (!edid) { if (!drm_edid) {
dev_dbg(hdmi->dev, "failed to get edid\n"); dev_dbg(hdmi->dev, "failed to get edid\n");
return NULL; return NULL;
} }
/*
* FIXME: This should use connector->display_info.is_hdmi and
* connector->display_info.has_audio from a path that has read the EDID
* and called drm_edid_connector_update().
*/
edid = drm_edid_raw(drm_edid);
dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
edid->width_cm, edid->height_cm); edid->width_cm, edid->height_cm);
hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
hdmi->sink_has_audio = drm_detect_monitor_audio(edid); hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
return edid; return drm_edid;
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
...@@ -2493,17 +2501,18 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector) ...@@ -2493,17 +2501,18 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
{ {
struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
connector); connector);
struct edid *edid; const struct drm_edid *drm_edid;
int ret; int ret;
edid = dw_hdmi_get_edid(hdmi, connector); drm_edid = dw_hdmi_edid_read(hdmi, connector);
if (!edid) if (!drm_edid)
return 0; return 0;
drm_connector_update_edid_property(connector, edid); drm_edid_connector_update(connector, drm_edid);
cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); cec_notifier_set_phys_addr(hdmi->cec_notifier,
ret = drm_add_edid_modes(connector, edid); connector->display_info.source_physical_address);
kfree(edid); ret = drm_edid_connector_add_modes(connector);
drm_edid_free(drm_edid);
return ret; return ret;
} }
...@@ -2980,12 +2989,12 @@ static enum drm_connector_status dw_hdmi_bridge_detect(struct drm_bridge *bridge ...@@ -2980,12 +2989,12 @@ static enum drm_connector_status dw_hdmi_bridge_detect(struct drm_bridge *bridge
return dw_hdmi_detect(hdmi); return dw_hdmi_detect(hdmi);
} }
static struct edid *dw_hdmi_bridge_get_edid(struct drm_bridge *bridge, static const struct drm_edid *dw_hdmi_bridge_edid_read(struct drm_bridge *bridge,
struct drm_connector *connector) struct drm_connector *connector)
{ {
struct dw_hdmi *hdmi = bridge->driver_private; struct dw_hdmi *hdmi = bridge->driver_private;
return dw_hdmi_get_edid(hdmi, connector); return dw_hdmi_edid_read(hdmi, connector);
} }
static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
...@@ -3002,7 +3011,7 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { ...@@ -3002,7 +3011,7 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
.mode_set = dw_hdmi_bridge_mode_set, .mode_set = dw_hdmi_bridge_mode_set,
.mode_valid = dw_hdmi_bridge_mode_valid, .mode_valid = dw_hdmi_bridge_mode_valid,
.detect = dw_hdmi_bridge_detect, .detect = dw_hdmi_bridge_detect,
.get_edid = dw_hdmi_bridge_get_edid, .edid_read = dw_hdmi_bridge_edid_read,
}; };
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
......
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