mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Kees Cook <keescook@chromium.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Neil Armstrong <narmstrong@baylibre.com>,
	Robert Foss <robert.foss@linaro.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Harry Wentland <harry.wentland@amd.com>,
	Sam Ravnborg <sam@ravnborg.org>,
	Maxime Ripard <maxime@cerno.tech>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Paul Boddie <paul@boddie.org.uk>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>,
	devicetree@vger.kernel.org, linux-mips@vger.kernel.org,
	linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org,
	Jonas Karlman <jonas@kwiboo.se>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v12 7/9] drm/bridge: display-connector: add ddc-en gpio support
Date: Wed, 02 Feb 2022 10:32:01 +0000	[thread overview]
Message-ID: <DLAO6R.7AAJRIJFJSDD3@crapouillou.net> (raw)
In-Reply-To: <77a7a1daaf381e1651be38adb62f9af9dd6c8fc5.1643632014.git.hns@goldelico.com>

Hi Nikolaus,

Le lun., janv. 31 2022 at 13:26:53 +0100, H. Nikolaus Schaller 
<hns@goldelico.com> a écrit :
> "hdmi-connector.yaml" bindings defines an optional property
> "ddc-en-gpios" for a single gpio to enable DDC operation.
> 
> Usually this controls +5V power on the HDMI connector.
> This +5V may also be needed for HPD.
> 
> This was not reflected in code.
> 
> Now, the driver activates the ddc gpio after probe and
> deactivates after remove so it is "almost on".
> 
> But only if this driver is loaded (and not e.g. blacklisted
> as module).
> 
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>  drivers/gpu/drm/bridge/display-connector.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/gpu/drm/bridge/display-connector.c 
> b/drivers/gpu/drm/bridge/display-connector.c
> index d24f5b90feabf..555395e301096 100644
> --- a/drivers/gpu/drm/bridge/display-connector.c
> +++ b/drivers/gpu/drm/bridge/display-connector.c
> @@ -24,6 +24,7 @@ struct display_connector {
>  	int			hpd_irq;
> 
>  	struct regulator	*dp_pwr;
> +	struct gpio_desc	*ddc_en;
>  };
> 
>  static inline struct display_connector *
> @@ -345,6 +346,19 @@ static int display_connector_probe(struct 
> platform_device *pdev)
>  		}
>  	}
> 
> +	/* enable DDC */
> +	if (type == DRM_MODE_CONNECTOR_HDMIA) {
> +		conn->ddc_en = devm_gpiod_get_optional(&pdev->dev, "ddc-en",
> +						       GPIOD_OUT_HIGH);
> +
> +		if (IS_ERR(conn->ddc_en)) {
> +			dev_err(&pdev->dev, "Couldn't get ddc-en gpio\n");
> +			return PTR_ERR(conn->ddc_en);
> +		}
> +
> +		gpiod_set_value(conn->ddc_en, 1);

You already requested the gpio with the GPIOD_OUT_HIGH flag, so this 
can be removed.


> +	}
> +
>  	conn->bridge.funcs = &display_connector_bridge_funcs;
>  	conn->bridge.of_node = pdev->dev.of_node;
> 
> @@ -373,6 +387,9 @@ static int display_connector_remove(struct 
> platform_device *pdev)
>  {
>  	struct display_connector *conn = platform_get_drvdata(pdev);
> 
> +	if (conn->ddc_en)
> +		gpiod_set_value(conn->ddc_en, 0);

Note that gpiod_set_value() already does the null-check internally. I 
actually do prefer your solution, so this is fine with me, but 
maintainers may have a different opinion.

Cheers,
-Paul

> +
>  	if (conn->dp_pwr)
>  		regulator_disable(conn->dp_pwr);
> 
> --
> 2.33.0
> 



  reply	other threads:[~2022-02-02 10:32 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31 12:26 [PATCH v12 0/9] MIPS: JZ4780 and CI20 HDMI H. Nikolaus Schaller
2022-01-31 12:26 ` [PATCH v12 1/9] drm/ingenic: prepare ingenic drm for later addition of JZ4780 H. Nikolaus Schaller
2022-01-31 12:26 ` [PATCH v12 2/9] drm/ingenic: Add support for JZ4780 and HDMI output H. Nikolaus Schaller
2022-02-02 10:23   ` Paul Cercueil
2022-02-02 11:56     ` H. Nikolaus Schaller
2022-02-02 12:06       ` Paul Cercueil
2022-02-02 12:17         ` H. Nikolaus Schaller
2022-02-02 12:28           ` Paul Cercueil
2022-02-02 12:33             ` H. Nikolaus Schaller
2022-02-02 12:41               ` Paul Cercueil
2022-02-02 12:48                 ` H. Nikolaus Schaller
2022-02-02 17:04                 ` Paul Boddie
2022-01-31 12:26 ` [PATCH v12 3/9] dt-bindings: display: Add ingenic,jz4780-dw-hdmi DT Schema H. Nikolaus Schaller
2022-02-01 23:49   ` Rob Herring
2022-02-02  9:59   ` Paul Cercueil
2022-02-02 11:59     ` H. Nikolaus Schaller
2022-01-31 12:26 ` [PATCH v12 4/9] drm/ingenic: Add dw-hdmi driver specialization for jz4780 H. Nikolaus Schaller
2022-02-02 10:16   ` Paul Cercueil
2022-02-02 11:42     ` H. Nikolaus Schaller
2022-01-31 12:26 ` [PATCH v12 5/9] drm/synopsys+ingenic: repair hot plug detection H. Nikolaus Schaller
2022-01-31 12:26 ` [PATCH v12 6/9] dw-hdmi/ingenic-dw-hdmi: repair interworking with hdmi-connector H. Nikolaus Schaller
2022-01-31 12:26 ` [PATCH v12 7/9] drm/bridge: display-connector: add ddc-en gpio support H. Nikolaus Schaller
2022-02-02 10:32   ` Paul Cercueil [this message]
2022-02-02 11:45     ` H. Nikolaus Schaller
2022-01-31 12:26 ` [PATCH v12 8/9] MIPS: DTS: CI20: fix how ddc power is enabled H. Nikolaus Schaller
2022-02-02 10:34   ` Paul Cercueil

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=DLAO6R.7AAJRIJFJSDD3@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=andrzej.hajda@intel.com \
    --cc=broonie@kernel.org \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ebiederm@xmission.com \
    --cc=geert+renesas@glider.be \
    --cc=harry.wentland@amd.com \
    --cc=hns@goldelico.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=keescook@chromium.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maxime@cerno.tech \
    --cc=miquel.raynal@bootlin.com \
    --cc=narmstrong@baylibre.com \
    --cc=paul@boddie.org.uk \
    --cc=robert.foss@linaro.org \
    --cc=robh+dt@kernel.org \
    --cc=sam@ravnborg.org \
    --cc=tsbogend@alpha.franken.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

all inboxes | Powered by JetHome®