Commit 731f4bad authored by Sam Ravnborg's avatar Sam Ravnborg

drm/bridge: tc358767: add get_edid bridge operation

Prepare for chained bridge with the addition of
get_edid support.

v2:
  - Fixed handling of edid storage (Laurent)
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
Cc: Jonas Karlman <jonas@kwiboo.se>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20200727170320.959777-3-sam@ravnborg.org
parent 136d73a8
...@@ -250,8 +250,6 @@ struct tc_data { ...@@ -250,8 +250,6 @@ struct tc_data {
/* link settings */ /* link settings */
struct tc_edp_link link; struct tc_edp_link link;
/* display edid */
struct edid *edid;
/* current mode */ /* current mode */
struct drm_display_mode mode; struct drm_display_mode mode;
...@@ -1335,11 +1333,19 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge, ...@@ -1335,11 +1333,19 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge,
tc->mode = *mode; tc->mode = *mode;
} }
static struct edid *tc_get_edid(struct drm_bridge *bridge,
struct drm_connector *connector)
{
struct tc_data *tc = bridge_to_tc(bridge);
return drm_get_edid(connector, &tc->aux.ddc);
}
static int tc_connector_get_modes(struct drm_connector *connector) static int tc_connector_get_modes(struct drm_connector *connector)
{ {
struct tc_data *tc = connector_to_tc(connector); struct tc_data *tc = connector_to_tc(connector);
int num_modes;
struct edid *edid; struct edid *edid;
int count;
int ret; int ret;
ret = tc_get_display_props(tc); ret = tc_get_display_props(tc);
...@@ -1348,21 +1354,15 @@ static int tc_connector_get_modes(struct drm_connector *connector) ...@@ -1348,21 +1354,15 @@ static int tc_connector_get_modes(struct drm_connector *connector)
return 0; return 0;
} }
count = drm_panel_get_modes(tc->panel, connector); num_modes = drm_panel_get_modes(tc->panel, connector);
if (count > 0) if (num_modes > 0)
return count; return num_modes;
edid = drm_get_edid(connector, &tc->aux.ddc);
kfree(tc->edid);
tc->edid = edid;
if (!edid)
return 0;
drm_connector_update_edid_property(connector, edid); edid = tc_get_edid(&tc->bridge, connector);
count = drm_add_edid_modes(connector, edid); num_modes = drm_add_edid_modes(connector, edid);
kfree(edid);
return count; return num_modes;
} }
static const struct drm_connector_helper_funcs tc_connector_helper_funcs = { static const struct drm_connector_helper_funcs tc_connector_helper_funcs = {
...@@ -1465,6 +1465,7 @@ static const struct drm_bridge_funcs tc_bridge_funcs = { ...@@ -1465,6 +1465,7 @@ static const struct drm_bridge_funcs tc_bridge_funcs = {
.post_disable = tc_bridge_post_disable, .post_disable = tc_bridge_post_disable,
.mode_fixup = tc_bridge_mode_fixup, .mode_fixup = tc_bridge_mode_fixup,
.detect = tc_bridge_detect, .detect = tc_bridge_detect,
.get_edid = tc_get_edid,
}; };
static bool tc_readable_reg(struct device *dev, unsigned int reg) static bool tc_readable_reg(struct device *dev, unsigned int reg)
...@@ -1689,6 +1690,7 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) ...@@ -1689,6 +1690,7 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
tc->bridge.funcs = &tc_bridge_funcs; tc->bridge.funcs = &tc_bridge_funcs;
if (tc->hpd_pin >= 0) if (tc->hpd_pin >= 0)
tc->bridge.ops |= DRM_BRIDGE_OP_DETECT; tc->bridge.ops |= DRM_BRIDGE_OP_DETECT;
tc->bridge.ops |= DRM_BRIDGE_OP_EDID;
tc->bridge.of_node = dev->of_node; tc->bridge.of_node = dev->of_node;
drm_bridge_add(&tc->bridge); drm_bridge_add(&tc->bridge);
......
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