Message ID | 20200703192417.372164-17-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. On Fri, Jul 03, 2020 at 09:24:12PM +0200, Sam Ravnborg wrote: > To prepare for a chained bridge setup add support for the > get_edid bridge operation. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Peter Senna Tschudin <peter.senna@gmail.com> > Cc: Martin Donnelly <martin.donnelly@ge.com> > Cc: Martyn Welch <martyn.welch@collabora.co.uk> > 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> > --- > .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 26 +++++++++++++------ > 1 file changed, 18 insertions(+), 8 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c > index 78a9afe8f063..5f06e18f0a61 100644 > --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c > +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c > @@ -131,21 +131,29 @@ static u8 *stdp2690_get_edid(struct i2c_client *client) > return NULL; > } > > -static int ge_b850v3_lvds_get_modes(struct drm_connector *connector) > +static struct edid *ge_b850v3_lvds_get_edid( > + struct drm_bridge *bridge, struct drm_connector *connector) > { > struct i2c_client *client; > - int num_modes = 0; > > client = ge_b850v3_lvds_ptr->stdp2690_i2c; > > kfree(ge_b850v3_lvds_ptr->edid); > ge_b850v3_lvds_ptr->edid = (struct edid *)stdp2690_get_edid(client); > > - if (ge_b850v3_lvds_ptr->edid) { > - drm_connector_update_edid_property(connector, > - ge_b850v3_lvds_ptr->edid); > - num_modes = drm_add_edid_modes(connector, > - ge_b850v3_lvds_ptr->edid); > + return ge_b850v3_lvds_ptr->edid; As pointed out earlier in this series, you can't store a pointer to the edid, if will get freed by the caller. Fortunately it doesn't seem to be needed here either. > +} > + > +static int ge_b850v3_lvds_get_modes(struct drm_connector *connector) > +{ > + struct edid *edid; > + int num_modes = 0; > + > + edid = ge_b850v3_lvds_get_edid(&ge_b850v3_lvds_ptr->bridge, connector); > + > + if (edid) { > + drm_connector_update_edid_property(connector, edid); > + num_modes = drm_add_edid_modes(connector, edid); > } > > return num_modes; > @@ -270,6 +278,7 @@ static int ge_b850v3_lvds_attach(struct drm_bridge *bridge, > static const struct drm_bridge_funcs ge_b850v3_lvds_funcs = { > .attach = ge_b850v3_lvds_attach, > .detect = ge_b850v3_lvds_bridge_detect, > + .get_edid = ge_b850v3_lvds_get_edid, > }; > > static int ge_b850v3_lvds_init(struct device *dev) > @@ -324,7 +333,8 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, > > /* drm bridge initialization */ > ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; > - ge_b850v3_lvds_ptr->bridge.ops = DRM_BRIDGE_OP_DETECT; > + ge_b850v3_lvds_ptr->bridge.ops = DRM_BRIDGE_OP_DETECT | > + DRM_BRIDGE_OP_EDID; > ge_b850v3_lvds_ptr->bridge.of_node = dev->of_node; > drm_bridge_add(&ge_b850v3_lvds_ptr->bridge); >
diff --git a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c index 78a9afe8f063..5f06e18f0a61 100644 --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c @@ -131,21 +131,29 @@ static u8 *stdp2690_get_edid(struct i2c_client *client) return NULL; } -static int ge_b850v3_lvds_get_modes(struct drm_connector *connector) +static struct edid *ge_b850v3_lvds_get_edid( + struct drm_bridge *bridge, struct drm_connector *connector) { struct i2c_client *client; - int num_modes = 0; client = ge_b850v3_lvds_ptr->stdp2690_i2c; kfree(ge_b850v3_lvds_ptr->edid); ge_b850v3_lvds_ptr->edid = (struct edid *)stdp2690_get_edid(client); - if (ge_b850v3_lvds_ptr->edid) { - drm_connector_update_edid_property(connector, - ge_b850v3_lvds_ptr->edid); - num_modes = drm_add_edid_modes(connector, - ge_b850v3_lvds_ptr->edid); + return ge_b850v3_lvds_ptr->edid; +} + +static int ge_b850v3_lvds_get_modes(struct drm_connector *connector) +{ + struct edid *edid; + int num_modes = 0; + + edid = ge_b850v3_lvds_get_edid(&ge_b850v3_lvds_ptr->bridge, connector); + + if (edid) { + drm_connector_update_edid_property(connector, edid); + num_modes = drm_add_edid_modes(connector, edid); } return num_modes; @@ -270,6 +278,7 @@ static int ge_b850v3_lvds_attach(struct drm_bridge *bridge, static const struct drm_bridge_funcs ge_b850v3_lvds_funcs = { .attach = ge_b850v3_lvds_attach, .detect = ge_b850v3_lvds_bridge_detect, + .get_edid = ge_b850v3_lvds_get_edid, }; static int ge_b850v3_lvds_init(struct device *dev) @@ -324,7 +333,8 @@ static int stdp4028_ge_b850v3_fw_probe(struct i2c_client *stdp4028_i2c, /* drm bridge initialization */ ge_b850v3_lvds_ptr->bridge.funcs = &ge_b850v3_lvds_funcs; - ge_b850v3_lvds_ptr->bridge.ops = DRM_BRIDGE_OP_DETECT; + ge_b850v3_lvds_ptr->bridge.ops = DRM_BRIDGE_OP_DETECT | + DRM_BRIDGE_OP_EDID; ge_b850v3_lvds_ptr->bridge.of_node = dev->of_node; drm_bridge_add(&ge_b850v3_lvds_ptr->bridge);
To prepare for a chained bridge setup add support for the get_edid bridge operation. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Peter Senna Tschudin <peter.senna@gmail.com> Cc: Martin Donnelly <martin.donnelly@ge.com> Cc: Martyn Welch <martyn.welch@collabora.co.uk> 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> --- .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-)