From: Neil Armstrong <narmstrong@baylibre.com>
To: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>,
dri-devel@lists.freedesktop.org
Cc: linux-renesas-soc@vger.kernel.org,
Andrzej Hajda <a.hajda@samsung.com>,
Jernej Skrabec <jernej.skrabec@siol.net>,
Jonas Karlman <jonas@kwiboo.se>, Sam Ravnborg <sam@ravnborg.org>,
Kieran Bingham <kieran.bingham@ideasonboard.com>
Subject: Re: [PATCH 22/27] drm: bridge: dw-hdmi: Make connector creation optional
Date: Tue, 26 May 2020 14:35:19 +0200 [thread overview]
Message-ID: <3146e372-f900-fd2b-1b2d-2f68cf8697c6@baylibre.com> (raw)
In-Reply-To: <20200526011505.31884-23-laurent.pinchart+renesas@ideasonboard.com>
On 26/05/2020 03:15, Laurent Pinchart wrote:
> Implement the drm_bridge_funcs .detect() and .get_edid() operations, and
> call drm_bridge_hpd_notify() notify to report HPD. This provides the
> necessary API to support disabling connector creation, do so by
> accepting DRM_BRIDGE_ATTACH_NO_CONNECTOR in dw_hdmi_bridge_attach().
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 104 +++++++++++++++-------
> 1 file changed, 74 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index b69c14b9de62..6148a022569a 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -2323,15 +2323,8 @@ static void dw_hdmi_update_phy_mask(struct dw_hdmi *hdmi)
> hdmi->rxsense);
> }
>
> -/* -----------------------------------------------------------------------------
> - * DRM Connector Operations
> - */
> -
> -static enum drm_connector_status
> -dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
> +static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi)
> {
> - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
> - connector);
> enum drm_connector_status result;
>
> mutex_lock(&hdmi->mutex);
> @@ -2354,31 +2347,57 @@ dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
> return result;
> }
>
> -static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
> +static struct edid *dw_hdmi_get_edid(struct dw_hdmi *hdmi,
> + struct drm_connector *connector)
> {
> - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
> - connector);
> struct edid *edid;
> - int ret = 0;
>
> if (!hdmi->ddc)
> - return 0;
> + return NULL;
>
> edid = drm_get_edid(connector, hdmi->ddc);
> - if (edid) {
> - dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
> - edid->width_cm, edid->height_cm);
> -
> - hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
> - hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
> - drm_connector_update_edid_property(connector, edid);
> - cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid);
> - ret = drm_add_edid_modes(connector, edid);
> - kfree(edid);
> - } else {
> + if (!edid) {
> dev_dbg(hdmi->dev, "failed to get edid\n");
> + return NULL;
> }
>
> + dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
> + edid->width_cm, edid->height_cm);
> +
> + hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
> + hdmi->sink_has_audio = drm_detect_monitor_audio(edid);
> +
> + return edid;
> +}
> +
> +/* -----------------------------------------------------------------------------
> + * DRM Connector Operations
> + */
> +
> +static enum drm_connector_status
> +dw_hdmi_connector_detect(struct drm_connector *connector, bool force)
> +{
> + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
> + connector);
> + return dw_hdmi_detect(hdmi);
> +}
> +
> +static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
> +{
> + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi,
> + connector);
> + struct edid *edid;
> + int ret;
> +
> + edid = dw_hdmi_get_edid(hdmi, connector);
> + if (!edid)
> + return 0;
> +
> + drm_connector_update_edid_property(connector, edid);
> + cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid);
> + ret = drm_add_edid_modes(connector, edid);
> + kfree(edid);
> +
> return ret;
> }
>
> @@ -2777,10 +2796,8 @@ static int dw_hdmi_bridge_attach(struct drm_bridge *bridge,
> {
> struct dw_hdmi *hdmi = bridge->driver_private;
>
> - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) {
> - DRM_ERROR("Fix bridge driver to make connector optional!");
> - return -EINVAL;
> - }
> + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
> + return 0;
>
> return dw_hdmi_connector_create(hdmi);
> }
> @@ -2860,6 +2877,21 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge,
> mutex_unlock(&hdmi->mutex);
> }
>
> +static enum drm_connector_status dw_hdmi_bridge_detect(struct drm_bridge *bridge)
> +{
> + struct dw_hdmi *hdmi = bridge->driver_private;
> +
> + return dw_hdmi_detect(hdmi);
> +}
> +
> +static struct edid *dw_hdmi_bridge_get_edid(struct drm_bridge *bridge,
> + struct drm_connector *connector)
> +{
> + struct dw_hdmi *hdmi = bridge->driver_private;
> +
> + return dw_hdmi_get_edid(hdmi, connector);
> +}
> +
> static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
> .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
> @@ -2873,6 +2905,8 @@ static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = {
> .atomic_disable = dw_hdmi_bridge_atomic_disable,
> .mode_set = dw_hdmi_bridge_mode_set,
> .mode_valid = dw_hdmi_bridge_mode_valid,
> + .detect = dw_hdmi_bridge_detect,
> + .get_edid = dw_hdmi_bridge_get_edid,
> };
>
> /* -----------------------------------------------------------------------------
> @@ -2988,10 +3022,18 @@ static irqreturn_t dw_hdmi_irq(int irq, void *dev_id)
> }
>
> if (intr_stat & HDMI_IH_PHY_STAT0_HPD) {
> + enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD
> + ? connector_status_connected
> + : connector_status_disconnected;
> +
> dev_dbg(hdmi->dev, "EVENT=%s\n",
> - phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout");
> - if (hdmi->bridge.dev)
> + status == connector_status_connected ?
> + "plugin" : "plugout");
> +
> + if (hdmi->bridge.dev) {
> drm_helper_hpd_irq_event(hdmi->bridge.dev);
> + drm_bridge_hpd_notify(&hdmi->bridge, status);
I suspect I will also need to add drm_bridge_hpd_notify() in meson_dw_hdmi.c in dw_hdmi_top_thread_irq() for HPD event, right ?
> + }
> }
>
> hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0);
> @@ -3337,6 +3379,8 @@ __dw_hdmi_probe(struct platform_device *pdev,
>
> hdmi->bridge.driver_private = hdmi;
> hdmi->bridge.funcs = &dw_hdmi_bridge_funcs;
> + hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
> + | DRM_BRIDGE_OP_HPD;
same here for meson_dw_hdmi ?
could I also assume we could disable the dw_hdmi bridge & hpd ops when using with meson_dw_hdmi and
implement these in meson_dw_hdmi ?
> #ifdef CONFIG_OF
> hdmi->bridge.of_node = pdev->dev.of_node;
> #endif
>
Anyway
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
next prev parent reply other threads:[~2020-05-26 12:35 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-26 1:14 [PATCH 00/27] Converter R-Car DU to the DRM bridge connector helper Laurent Pinchart
2020-05-26 1:14 ` [PATCH 01/27] drm: bridge: adv7511: Split EDID read to a separate function Laurent Pinchart
2020-05-26 1:14 ` [PATCH 02/27] drm: bridge: adv7511: Split connector creation " Laurent Pinchart
2020-05-26 1:14 ` [PATCH 03/27] drm: bridge: adv7511: Implement bridge connector operations Laurent Pinchart
2020-06-21 8:25 ` Sam Ravnborg
2020-05-26 1:14 ` [PATCH 04/27] drm: bridge: adv7511: Make connector creation optional Laurent Pinchart
2020-05-26 1:14 ` [PATCH 05/27] drm: bridge: Return NULL on error from drm_bridge_get_edid() Laurent Pinchart
2020-06-21 8:26 ` Sam Ravnborg
2020-05-26 1:14 ` [PATCH 06/27] drm: bridge: simple-bridge: Delegate operations to next bridge Laurent Pinchart
2020-05-26 1:14 ` [PATCH 07/27] drm: bridge: simple-bridge: Make connector creation optional Laurent Pinchart
2020-05-26 1:14 ` [PATCH 08/27] drm: rcar-du: lvds: Convert to DRM panel bridge helper Laurent Pinchart
2020-05-26 1:14 ` [PATCH 09/27] drm: edid: Constify connector argument to infoframe functions Laurent Pinchart
2020-06-21 8:27 ` Sam Ravnborg
2020-05-26 1:14 ` [PATCH 10/27] drm: bridge: Pass drm_display_info to drm_bridge_funcs .mode_valid() Laurent Pinchart
2020-05-26 12:51 ` Neil Armstrong
2020-05-26 12:59 ` Boris Brezillon
2020-05-26 14:05 ` Guido Günther
2020-05-26 1:14 ` [PATCH 11/27] drm: bridge: dw-hdmi: Pass private data pointer to .mode_valid() Laurent Pinchart
2020-05-26 9:44 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 12/27] drm: bridge: dw-hdmi: Pass private data pointer to .configure_phy() Laurent Pinchart
2020-05-26 9:45 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 13/27] drm: bridge: dw-hdmi: Remove unused field from dw_hdmi_plat_data Laurent Pinchart
2020-05-26 9:45 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 14/27] drm: meson: dw-hdmi: Use dw_hdmi context to replace hack Laurent Pinchart
2020-05-26 12:32 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 15/27] drm: bridge: dw-hdmi: Pass drm_display_info to .mode_valid() Laurent Pinchart
2020-05-26 9:46 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 16/27] drm: bridge: dw-hdmi: Constify mode argument to dw_hdmi_phy_ops .init() Laurent Pinchart
2020-05-26 9:46 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 17/27] drm: bridge: dw-hdmi: Constify mode argument to internal functions Laurent Pinchart
2020-05-26 9:46 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 18/27] drm: bridge: dw-hdmi: Pass drm_display_info to dw_hdmi_support_scdc() Laurent Pinchart
2020-05-26 9:48 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 19/27] drm: bridge: dw-hdmi: Split connector creation to a separate function Laurent Pinchart
2020-05-26 9:49 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 20/27] drm: bridge: dw-hdmi: Store current connector in struct dw_hdmi Laurent Pinchart
2020-05-26 12:29 ` Neil Armstrong
2020-05-26 1:14 ` [PATCH 21/27] drm: bridge: dw-hdmi: Pass drm_connector to internal functions as needed Laurent Pinchart
2020-05-26 12:29 ` Neil Armstrong
2020-05-26 1:15 ` [PATCH 22/27] drm: bridge: dw-hdmi: Make connector creation optional Laurent Pinchart
2020-05-26 12:35 ` Neil Armstrong [this message]
2020-06-07 1:19 ` Laurent Pinchart
2020-05-26 1:15 ` [PATCH 23/27] drm: bridge: dw-hdmi: Attach to next bridge if available Laurent Pinchart
2020-05-26 12:50 ` Neil Armstrong
2020-05-26 14:23 ` Jonas Karlman
2020-06-07 1:24 ` Laurent Pinchart
2020-06-07 1:22 ` Laurent Pinchart
2020-05-26 1:15 ` [PATCH 24/27] drm: rcar-du: dw-hdmi: Set output port number Laurent Pinchart
2020-05-26 1:15 ` [PATCH 25/27] drm: rcar-du: Fix error handling in rcar_du_encoder_init() Laurent Pinchart
2020-05-26 1:15 ` [PATCH 26/27] drm: rcar-du: Use drm_bridge_connector_init() helper Laurent Pinchart
2020-05-26 1:15 ` [PATCH 27/27] drm: Add default modes for connectors in unknown state Laurent Pinchart
2020-06-21 8:40 ` Sam Ravnborg
2020-06-24 1:12 ` Laurent Pinchart
2020-06-24 7:23 ` Daniel Vetter
2020-06-24 15:24 ` Alex Deucher
2020-06-24 19:31 ` Daniel Vetter
2020-06-24 19:40 ` Alex Deucher
2020-06-25 7:56 ` Daniel Vetter
2020-06-25 7:57 ` Daniel Vetter
2020-06-25 10:31 ` Pekka Paalanen
2020-06-25 10:44 ` Daniel Vetter
2020-06-26 8:59 ` Pekka Paalanen
2020-06-26 9:25 ` Daniel Stone
2020-06-26 13:35 ` Daniel Vetter
2020-06-24 22:47 ` Laurent Pinchart
2020-06-23 18:55 ` [PATCH 00/27] Converter R-Car DU to the DRM bridge connector helper Sam Ravnborg
2020-06-25 8:48 ` Liu Ying
2020-06-27 19:55 ` Sam Ravnborg
2020-06-28 8:28 ` Laurent Pinchart
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=3146e372-f900-fd2b-1b2d-2f68cf8697c6@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=a.hajda@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@siol.net \
--cc=jonas@kwiboo.se \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=sam@ravnborg.org \
/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;
as well as URLs for NNTP newsgroup(s).