Skip to content

Commit

Permalink
drm/bridge: tc358767: add get_edid bridge operation
Browse files Browse the repository at this point in the history
Prepare for chained bridge with the addition of
get_edid support.

v2:
  - Fixed handling of edid storage (Laurent)

Signed-off-by: Sam Ravnborg <[email protected]>
Reviewed-by: Laurent Pinchart <[email protected]>
Cc: Andrzej Hajda <[email protected]>
Cc: Neil Armstrong <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Jonas Karlman <[email protected]>
Cc: Jernej Skrabec <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
  • Loading branch information
sravnborg committed Jul 27, 2020
1 parent 136d73a commit 731f4ba
Showing 1 changed file with 18 additions and 16 deletions.
34 changes: 18 additions & 16 deletions drivers/gpu/drm/bridge/tc358767.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,6 @@ struct tc_data {
/* link settings */
struct tc_edp_link link;

/* display edid */
struct edid *edid;
/* current mode */
struct drm_display_mode mode;

Expand Down Expand Up @@ -1335,11 +1333,19 @@ static void tc_bridge_mode_set(struct drm_bridge *bridge,
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)
{
struct tc_data *tc = connector_to_tc(connector);
int num_modes;
struct edid *edid;
int count;
int ret;

ret = tc_get_display_props(tc);
Expand All @@ -1348,21 +1354,15 @@ static int tc_connector_get_modes(struct drm_connector *connector)
return 0;
}

count = drm_panel_get_modes(tc->panel, connector);
if (count > 0)
return count;

edid = drm_get_edid(connector, &tc->aux.ddc);

kfree(tc->edid);
tc->edid = edid;
if (!edid)
return 0;
num_modes = drm_panel_get_modes(tc->panel, connector);
if (num_modes > 0)
return num_modes;

drm_connector_update_edid_property(connector, edid);
count = drm_add_edid_modes(connector, edid);
edid = tc_get_edid(&tc->bridge, connector);
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 = {
Expand Down Expand Up @@ -1465,6 +1465,7 @@ static const struct drm_bridge_funcs tc_bridge_funcs = {
.post_disable = tc_bridge_post_disable,
.mode_fixup = tc_bridge_mode_fixup,
.detect = tc_bridge_detect,
.get_edid = tc_get_edid,
};

static bool tc_readable_reg(struct device *dev, unsigned int reg)
Expand Down Expand Up @@ -1689,6 +1690,7 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id)
tc->bridge.funcs = &tc_bridge_funcs;
if (tc->hpd_pin >= 0)
tc->bridge.ops |= DRM_BRIDGE_OP_DETECT;
tc->bridge.ops |= DRM_BRIDGE_OP_EDID;

tc->bridge.of_node = dev->of_node;
drm_bridge_add(&tc->bridge);
Expand Down

0 comments on commit 731f4ba

Please sign in to comment.