Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1472594pxb; Wed, 2 Feb 2022 05:51:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxF75ez7xAj/36Akjgf/mEqpOUUzNhWVzjVvO9uZ7bWWmmGGqEsxLq0DT8c8MzKihISKsNY X-Received: by 2002:a17:90b:4109:: with SMTP id io9mr8247510pjb.244.1643809889040; Wed, 02 Feb 2022 05:51:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643809889; cv=none; d=google.com; s=arc-20160816; b=EUioQDK4lCMlH3/z4rwEIBAOcjDkMExhdzven6dwiNG98qhoVuv8xNNAVXnywTSS1f JZs5cGaUneHGaqAriDcXGVACr/+0iCyLub+MbJuz3YQFuE+aa9aV4S8EVajmwKRxDS2F VwCHeYmn3RiIhsb2GSs7mKnDaEFMAxnt09yJNIBLUJG8+qpHhvRlr+dp8n9kdl8S4yR9 gpp0pC+B+yeaAOffsr6Gagi4q1I9N2bt5zvqPr3tgLDHXHHuF1wqb436Xz2uvJEkmWHb wr1eFsFeoKWH2g+oZfBdQLIcMVbzgDUSmnILXzm7dnA98HxoO/QZGpxNE5N8GJuZ8CG9 5bbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:cc:to:subject:from:date; bh=uomaowVZNyJmTzlGqIuDuL+bnihxGN/Gc4ho1jjtZSk=; b=qOqj2yA9GkglaSXZyT9runqUdS3pRL1nEl5LBBF9fb53pdyK9diCMwoydBvXV706l0 K5ELyEyY5BnBZx5j5xDxuCzgb6oEGklfadPh/lpytzGvr0cWXDEQII0famjACdeKaKR3 3MEWZqER7F0wzZ8DdKXfEkMw0ki0mMw3oI8uqpLhWP1T0LHI3+4gG0bic8y9WF3QTB2N ZVXFhKgXxln3rC8RihMfIm0B3N9eBb2cv6whDNFrbOLpGGwWB42Da83NjgUK2X0YlkdZ ZpM50rAI77I2Fpw4cGLmqTcyVVOeRfVD8WkKVwQp8h7Sn2MiA6vngxnGhYJOEn+P522d Z3Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t19si20525229pgu.36.2022.02.02.05.51.16; Wed, 02 Feb 2022 05:51:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343529AbiBBKcY convert rfc822-to-8bit (ORCPT + 99 others); Wed, 2 Feb 2022 05:32:24 -0500 Received: from aposti.net ([89.234.176.197]:46030 "EHLO aposti.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232194AbiBBKcV (ORCPT ); Wed, 2 Feb 2022 05:32:21 -0500 Date: Wed, 02 Feb 2022 10:32:01 +0000 From: Paul Cercueil Subject: Re: [PATCH v12 7/9] drm/bridge: display-connector: add ddc-en gpio support To: "H. Nikolaus Schaller" Cc: Rob Herring , Mark Rutland , Thomas Bogendoerfer , Geert Uytterhoeven , Kees Cook , "Eric W. Biederman" , Miquel Raynal , David Airlie , Daniel Vetter , Neil Armstrong , Robert Foss , Laurent Pinchart , Jernej Skrabec , Harry Wentland , Sam Ravnborg , Maxime Ripard , Hans Verkuil , Liam Girdwood , Mark Brown , Paul Boddie , Andrzej Hajda , Kieran Bingham , devicetree@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, Jonas Karlman , dri-devel@lists.freedesktop.org Message-Id: In-Reply-To: <77a7a1daaf381e1651be38adb62f9af9dd6c8fc5.1643632014.git.hns@goldelico.com> References: <77a7a1daaf381e1651be38adb62f9af9dd6c8fc5.1643632014.git.hns@goldelico.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Nikolaus, Le lun., janv. 31 2022 at 13:26:53 +0100, H. Nikolaus Schaller 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 > --- > 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 >