Message ID | 20200703192417.372164-9-sam@ravnborg.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/bridge: support chained bridges + panel updates | expand |
Hi Sam, Thank you for the patch. s/bride/bridge/ in the subject line. On Fri, Jul 03, 2020 at 09:24:04PM +0200, Sam Ravnborg wrote: > Prepare for chained bridge with the addition of > get_edid support. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > 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> > --- > drivers/gpu/drm/bridge/tc358767.c | 24 +++++++++++++++++------- > 1 file changed, 17 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > index 85973ae728db..fb9d57967b2c 100644 > --- a/drivers/gpu/drm/bridge/tc358767.c > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -1317,6 +1317,20 @@ 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); > + struct edid *edid; > + > + edid = drm_get_edid(connector, &tc->aux.ddc); > + > + kfree(tc->edid); > + tc->edid = edid; The caller (drm_bridge_connector_get_modes_edid()) calls kfree(edid), so if you want to store it internally, you'll have to make a copy. Can you skip internal storage altogether by freeing the memory in tc_connector_get_modes() ? > + > + return edid; > +} > + > static int tc_connector_get_modes(struct drm_connector *connector) > { > struct tc_data *tc = connector_to_tc(connector); > @@ -1336,12 +1350,7 @@ static int tc_connector_get_modes(struct drm_connector *connector) > return count; > } > > - edid = drm_get_edid(connector, &tc->aux.ddc); > - > - kfree(tc->edid); > - tc->edid = edid; > - if (!edid) > - return 0; > + edid = tc_get_edid(&tc->bridge, connector); > > drm_connector_update_edid_property(connector, edid); > count = drm_add_edid_modes(connector, edid); > @@ -1452,6 +1461,7 @@ static const struct drm_bridge_funcs tc_bridge_funcs = { > .disable = tc_bridge_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) > @@ -1685,7 +1695,7 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) > return ret; > > tc->bridge.funcs = &tc_bridge_funcs; > - tc->bridge.ops = DRM_BRIDGE_OP_DETECT; > + tc->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; > > tc->bridge.of_node = dev->of_node; > drm_bridge_add(&tc->bridge); > -- > 2.25.1 >
diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 85973ae728db..fb9d57967b2c 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1317,6 +1317,20 @@ 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); + struct edid *edid; + + edid = drm_get_edid(connector, &tc->aux.ddc); + + kfree(tc->edid); + tc->edid = edid; + + return edid; +} + static int tc_connector_get_modes(struct drm_connector *connector) { struct tc_data *tc = connector_to_tc(connector); @@ -1336,12 +1350,7 @@ static int tc_connector_get_modes(struct drm_connector *connector) return count; } - edid = drm_get_edid(connector, &tc->aux.ddc); - - kfree(tc->edid); - tc->edid = edid; - if (!edid) - return 0; + edid = tc_get_edid(&tc->bridge, connector); drm_connector_update_edid_property(connector, edid); count = drm_add_edid_modes(connector, edid); @@ -1452,6 +1461,7 @@ static const struct drm_bridge_funcs tc_bridge_funcs = { .disable = tc_bridge_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) @@ -1685,7 +1695,7 @@ static int tc_probe(struct i2c_client *client, const struct i2c_device_id *id) return ret; tc->bridge.funcs = &tc_bridge_funcs; - tc->bridge.ops = DRM_BRIDGE_OP_DETECT; + tc->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; tc->bridge.of_node = dev->of_node; drm_bridge_add(&tc->bridge);
Prepare for chained bridge with the addition of get_edid support. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> 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> --- drivers/gpu/drm/bridge/tc358767.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)