All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Jernej Skrabec <jernej.skrabec@siol.net>,
	Peter Senna Tschudin <peter.senna@gmail.com>,
	kbuild test robot <lkp@intel.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Neil Armstrong <narmstrong@baylibre.com>,
	dri-devel@lists.freedesktop.org,
	Martyn Welch <martyn.welch@collabora.co.uk>,
	Andrzej Hajda <a.hajda@samsung.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Martin Donnelly <martin.donnelly@ge.com>
Subject: Re: [PATCH v4 12/15] drm/bridge: megachips: add get_edid bridge operation
Date: Mon, 27 Jul 2020 00:57:05 +0300	[thread overview]
Message-ID: <20200726215705.GE28704@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20200726203324.3722593-13-sam@ravnborg.org>

Hi Sam,

Thank you for the patch.

On Sun, Jul 26, 2020 at 10:33:21PM +0200, Sam Ravnborg wrote:
> To prepare for a chained bridge setup add support for the
> get_edid bridge operation.
> There is no need for a copy of the edid - so drop
> the pointer to the copy.
> 
> v2:
>   - Fix so we do not leak memory (Laurent)
> 
> 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>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  .../bridge/megachips-stdpxxxx-ge-b850v3-fw.c  | 31 ++++++++++---------
>  1 file changed, 17 insertions(+), 14 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 450dca33ea48..f7b55dc374ac 100644
> --- a/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
> +++ b/drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
> @@ -61,7 +61,6 @@ struct ge_b850v3_lvds {
>  	struct drm_bridge bridge;
>  	struct i2c_client *stdp4028_i2c;
>  	struct i2c_client *stdp2690_i2c;
> -	struct edid *edid;
>  };
>  
>  static struct ge_b850v3_lvds *ge_b850v3_lvds_ptr;
> @@ -131,22 +130,26 @@ 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);
> +	return (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);
> -	}
> +static int ge_b850v3_lvds_get_modes(struct drm_connector *connector)
> +{
> +	struct edid *edid;
> +	int num_modes;
> +
> +	edid = ge_b850v3_lvds_get_edid(&ge_b850v3_lvds_ptr->bridge, connector);
> +
> +	drm_connector_update_edid_property(connector, edid);
> +	num_modes = drm_add_edid_modes(connector, edid);
> +	kfree(edid);
>  
>  	return num_modes;
>  }
> @@ -269,6 +272,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)
> @@ -304,8 +308,6 @@ static void ge_b850v3_lvds_remove(void)
>  
>  	drm_bridge_remove(&ge_b850v3_lvds_ptr->bridge);
>  
> -	kfree(ge_b850v3_lvds_ptr->edid);
> -
>  	ge_b850v3_lvds_ptr = NULL;
>  out:
>  	mutex_unlock(&ge_b850v3_lvds_dev_mutex);
> @@ -323,7 +325,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);
>  

-- 
Regards,

Laurent Pinchart
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2020-07-26 21:57 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26 20:33 [PATCH v4 0/15] drm/bridge: support chained bridges + panel updates Sam Ravnborg
2020-07-26 20:33 ` [PATCH v4 01/15] drm/panel: panel-simple: validate panel description Sam Ravnborg
2020-07-26 21:24   ` Laurent Pinchart
2020-07-26 20:33 ` [PATCH v4 02/15] drm/panel: panel-simple: add default connector_type Sam Ravnborg
2020-07-26 21:26   ` Laurent Pinchart
2020-07-26 20:33 ` [PATCH v4 03/15] drm/bridge: tc358764: drop drm_connector_(un)register Sam Ravnborg
2020-09-02 16:48   ` Andrzej Hajda
2020-07-26 20:33 ` [PATCH v4 04/15] drm/bridge: tc358764: add drm_panel_bridge support Sam Ravnborg
2020-07-26 21:37   ` Laurent Pinchart
2020-08-27 11:39   ` [v4,04/15] " Marek Szyprowski
2020-08-30 20:42     ` Sam Ravnborg
2020-09-03  6:20       ` Andrzej Hajda
2020-09-03  9:40   ` [PATCH v4 04/15] " Andrzej Hajda
2020-09-03  9:59     ` Laurent Pinchart
2020-09-03 15:10       ` Andrzej Hajda
2020-07-26 20:33 ` [PATCH v4 05/15] drm/bridge: tc358767: add detect bridge operation Sam Ravnborg
2020-07-26 21:27   ` Laurent Pinchart
2020-07-26 20:33 ` [PATCH v4 06/15] drm/bridge: tc358767: add get_edid " Sam Ravnborg
2020-07-26 21:40   ` Laurent Pinchart
2020-07-26 20:33 ` [PATCH v4 07/15] drm/bridge: tc358767: add drm_panel_bridge support Sam Ravnborg
2020-07-26 21:48   ` Laurent Pinchart
2020-07-27  7:22     ` Sam Ravnborg
2020-07-26 20:33 ` [PATCH v4 08/15] drm/bridge: parade-ps8622: " Sam Ravnborg
2020-07-26 21:54   ` Laurent Pinchart
2020-07-27 15:23     ` Sam Ravnborg
2020-07-26 20:33 ` [PATCH v4 09/15] drm/bridge: megachips: add helper to create connector Sam Ravnborg
2020-07-26 20:33 ` [PATCH v4 10/15] drm/bridge: megachips: get drm_device from bridge Sam Ravnborg
2020-07-26 20:33 ` [PATCH v4 11/15] drm/bridge: megachips: enable detect bridge operation Sam Ravnborg
2020-07-26 20:33 ` [PATCH v4 12/15] drm/bridge: megachips: add get_edid " Sam Ravnborg
2020-07-26 21:57   ` Laurent Pinchart [this message]
2020-07-26 20:33 ` [PATCH v4 13/15] drm/bridge: megachips: make connector creation optional Sam Ravnborg
2020-07-26 21:59   ` Laurent Pinchart
2020-07-26 20:33 ` [PATCH v4 14/15] drm/bridge: nxp-ptn3460: add get_edid bridge operation Sam Ravnborg
2020-07-26 22:00   ` Laurent Pinchart
2020-07-26 20:33 ` [PATCH v4 15/15] drm/bridge: nxp-ptn3460: add drm_panel_bridge support Sam Ravnborg
2020-07-26 22:05   ` Laurent Pinchart
2020-07-27 16:56 ` [PATCH v4 0/15] drm/bridge: support chained bridges + panel updates Sam Ravnborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200726215705.GE28704@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jernej.skrabec@siol.net \
    --cc=jonas@kwiboo.se \
    --cc=lkp@intel.com \
    --cc=martin.donnelly@ge.com \
    --cc=martyn.welch@collabora.co.uk \
    --cc=narmstrong@baylibre.com \
    --cc=peter.senna@gmail.com \
    --cc=sam@ravnborg.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.