public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sui Jingfeng <sui.jingfeng@linux.dev>
Cc: David Airlie <airlied@gmail.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Daniel Vetter <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/5] drm/bridge: Add drm_bridge_find_by_fwnode() helper
Date: Tue, 23 Jan 2024 03:17:10 +0200	[thread overview]
Message-ID: <20240123011710.GA22880@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240122163220.110788-2-sui.jingfeng@linux.dev>

Hi Sui,

Thank you for the patch.

On Tue, Jan 23, 2024 at 12:32:16AM +0800, Sui Jingfeng wrote:
> Because ACPI based systems only has the fwnode associated, the of_node
> member of struct device is NULL. To order to move things forward, we add
> drm_bridge_find_by_fwnode() to extend the support.
> 
> Signed-off-by: Sui Jingfeng <sui.jingfeng@linux.dev>

Could we switch completely to fwnode, instead of maintaining the fwnode
and OF options side-by-side ?

> ---
>  drivers/gpu/drm/drm_bridge.c | 33 +++++++++++++++++++++++++++++++++
>  include/drm/drm_bridge.h     |  4 ++++
>  2 files changed, 37 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c
> index cee3188adf3d..ffd969adc2fb 100644
> --- a/drivers/gpu/drm/drm_bridge.c
> +++ b/drivers/gpu/drm/drm_bridge.c
> @@ -1347,6 +1347,39 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np)
>  EXPORT_SYMBOL(of_drm_find_bridge);
>  #endif
>  
> +/**
> + * drm_bridge_find_by_fwnode - Find the bridge corresponding to the associated fwnode
> + *
> + * @fwnode: fwnode for which to find the matching drm_bridge
> + *
> + * This function looks up a drm_bridge based on its associated fwnode.
> + *
> + * RETURNS:
> + * A reference to the drm_bridge control structure if found, NULL on failure.
> + */
> +struct drm_bridge *drm_bridge_find_by_fwnode(struct fwnode_handle *fwnode)
> +{
> +	struct drm_bridge *ret = NULL;
> +	struct drm_bridge *bridge;
> +
> +	if (!fwnode)
> +		return NULL;
> +
> +	mutex_lock(&bridge_lock);
> +
> +	list_for_each_entry(bridge, &bridge_list, list) {
> +		if (bridge->fwnode == fwnode) {
> +			ret = bridge;
> +			break;
> +		}
> +	}
> +
> +	mutex_unlock(&bridge_lock);
> +
> +	return ret;
> +}
> +EXPORT_SYMBOL(drm_bridge_find_by_fwnode);
> +
>  MODULE_AUTHOR("Ajay Kumar <ajaykumar.rs@samsung.com>");
>  MODULE_DESCRIPTION("DRM bridge infrastructure");
>  MODULE_LICENSE("GPL and additional rights");
> diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h
> index e39da5807ba7..fe3d5f4bf37f 100644
> --- a/include/drm/drm_bridge.h
> +++ b/include/drm/drm_bridge.h
> @@ -720,6 +720,8 @@ struct drm_bridge {
>  	struct list_head chain_node;
>  	/** @of_node: device node pointer to the bridge */
>  	struct device_node *of_node;
> +	/** @fwnode: associated fwnode supplied by platform firmware */
> +	struct fwnode_handle *fwnode;
>  	/** @list: to keep track of all added bridges */
>  	struct list_head list;
>  	/**
> @@ -796,6 +798,8 @@ static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np)
>  }
>  #endif
>  
> +struct drm_bridge *drm_bridge_find_by_fwnode(struct fwnode_handle *fwnode);
> +
>  /**
>   * drm_bridge_get_next_bridge() - Get the next bridge in the chain
>   * @bridge: bridge object

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-01-23  1:17 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-22 16:32 [PATCH 0/5] drm/bridge: Allow using fwnode API to get the next bridge Sui Jingfeng
2024-01-22 16:32 ` [PATCH 1/5] drm/bridge: Add drm_bridge_find_by_fwnode() helper Sui Jingfeng
2024-01-23  1:17   ` Laurent Pinchart [this message]
2024-01-23  8:01     ` Sui Jingfeng
2024-01-23 15:15       ` Laurent Pinchart
2024-01-22 16:32 ` [PATCH 2/5] drm/bridge: simple-bridge: Extend match support for non-DT based systems Sui Jingfeng
2024-01-23  1:21   ` Laurent Pinchart
2024-01-23  8:20     ` Sui Jingfeng
2024-01-23 15:16       ` Laurent Pinchart
2024-01-23 12:31     ` Sui Jingfeng
2024-03-20 20:34   ` Andy Shevchenko
2024-01-22 16:32 ` [PATCH 3/5] drm/bridge: simple-bridge: Allow acquiring the next bridge with fwnode API Sui Jingfeng
2024-01-23  1:18   ` Laurent Pinchart
2024-01-23 12:18     ` Sui Jingfeng
2024-01-23 15:18       ` Laurent Pinchart
2024-01-24 15:00       ` Maxime Ripard
2024-01-22 16:32 ` [PATCH 4/5] drm/bridge: display-connector: Extend match support for non-DT based systems Sui Jingfeng
2024-01-22 16:32 ` [PATCH 5/5] drm-bridge: display-connector: Switch to use fwnode API Sui Jingfeng
2024-01-23  1:20   ` Laurent Pinchart
2024-01-23 12:35     ` Sui Jingfeng
2024-03-20 20:32     ` Andy Shevchenko

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=20240123011710.GA22880@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=sui.jingfeng@linux.dev \
    --cc=tzimmermann@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox