Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1204469pxv; Thu, 1 Jul 2021 20:46:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxjTycjXkA7jcLc1xpxiomAPt8Q1gRlimFzsT/3gMpcVrA+WfLbgy5pJ5XqLjEgFfPPxLj X-Received: by 2002:a17:906:4fd4:: with SMTP id i20mr3219827ejw.449.1625197590868; Thu, 01 Jul 2021 20:46:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625197590; cv=none; d=google.com; s=arc-20160816; b=UKmw87QJZlAB8+SltG/hJJ1P2xm7bwte/h5FUhke7tL3puf7ae9qiaSgDwTwtyxOIo q4HWSgRlgJQgjcR7en9g/1QRUUbiN8IHwccFnTC7F33EWGYnmRORk7/P/aBqjSyyPgdT Z3dn+HtqE63Dw3BcW6+sty4hIa4LSVY3zW2Hm7S1w0wYQpCAfpptIIAwVjuaR1V4kZFR ioC5PZAKPecbHCXyRUrMqr7MYf4jO8/sUM3rBWdZUQRLjzM/x+Z9QXZQ9GY2uBu4rv3q pCZAspXgaoifOY4DFfAj5KadGNgtDVk+fmE2hrnTeUUB06tybjBYkcmd04cPFQtfEw+3 mRAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=rsX1kYwwYIWdjiex/OVIgkyVEqgo5Y73zf64cxo2wVU=; b=kEsx4IcY629Y/nreeC+U86Sk1OeWdvkUW6IqHwoBQMx1pqhuqQbA2rPGTusLE5t0VG yZX7EMtogsCgRN5Cd2O2IylKCbKy5pSoyCLcvqpjb+bKfA2Y+NWk9tkaYJv5wJFVwzl9 GhyqmqMnwHQVOlaB6bkCn0OiuckjET+WwybTM/0R3GsGYqce7Mv2ogbhZchgDFiDXMLM MMVUm+7OT9mjsw3mzYuA0zoJ0LKqH5F7tCLWDYmQKErYNgnRjvgXxlr1rcERg83kzBiP aZWtpohqWxwekZy6BwNP4XUr3qIW2JbPL1zZawcmfO3ttFlA/UeaxN0q8yc+b9BJBE90 mTXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UcS2bHAP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d20si1800607ede.20.2021.07.01.20.46.06; Thu, 01 Jul 2021 20:46:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UcS2bHAP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234848AbhGBDcL (ORCPT + 99 others); Thu, 1 Jul 2021 23:32:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:45914 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234791AbhGBDcK (ORCPT ); Thu, 1 Jul 2021 23:32:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0DAF9613D6; Fri, 2 Jul 2021 03:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625196579; bh=6nJgAHxobBNh+qHTCsGxe4N62dWVAzhzZ6xFRFsU7C4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UcS2bHAPu2oXaGHqNrmz7bR3MKPTI7WRx9pTG1LyfMigE2mouH+GpNXjLxWvL8j9J S5RAyBnvGlEauVCanobOO4pol4RPI3FDfhfPF3SP13AlEWpxox2HyBxLyE+ayZB7xf GV8GYW5EaZv/m5psNE7owGXz1+We5BobpE9BlnWlUwaOifYIR29AAYVu3acy0IU/i4 +hBqBSxcIzJZVXNabKAfg5jbSDg99fV0Bnv4KH+YSVbNF+B5f1RKvwsWS/hYdDWfG2 1wmM+HGjx2dKhilaw4D5F8OrwAIXPPb/oD2hQR++/0vcQmdbXQSPXCUElL/qfg9xz5 0ov4hymTBycqg== Date: Thu, 1 Jul 2021 20:29:34 -0700 From: Nathan Chancellor To: Maxime Ripard Cc: dri-devel@lists.freedesktop.org, Daniel Vetter , David Airlie , Maarten Lankhorst , Thomas Zimmermann , Eric Anholt , linux-kernel@vger.kernel.org, Linus Wallei , Dave Stevenson , Phil Elwell , Tim Gover , Dom Cobley , Daniel Vetter , Hans Verkuil , Maxime Ripard Subject: Re: [PATCH 2/2] drm/vc4: hdmi: Convert to gpiod Message-ID: References: <20210524131852.263883-1-maxime@cerno.tech> <20210524131852.263883-2-maxime@cerno.tech> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210524131852.263883-2-maxime@cerno.tech> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 24, 2021 at 03:18:52PM +0200, Maxime Ripard wrote: > The new gpiod interface takes care of parsing the GPIO flags and to > return the logical value when accessing an active-low GPIO, so switching > to it simplifies a lot the driver. > > Signed-off-by: Maxime Ripard > --- > drivers/gpu/drm/vc4/vc4_hdmi.c | 24 +++++++----------------- > drivers/gpu/drm/vc4/vc4_hdmi.h | 3 +-- > 2 files changed, 8 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c > index ccc6c8079dc6..34622c59f6a7 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.c > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c > @@ -159,10 +159,9 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) > struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); > bool connected = false; > > - if (vc4_hdmi->hpd_gpio) { > - if (gpio_get_value_cansleep(vc4_hdmi->hpd_gpio) ^ > - vc4_hdmi->hpd_active_low) > - connected = true; > + if (vc4_hdmi->hpd_gpio && > + gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) { > + connected = true; > } else if (drm_probe_ddc(vc4_hdmi->ddc)) { > connected = true; > } else if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) { > @@ -1993,7 +1992,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) > struct vc4_hdmi *vc4_hdmi; > struct drm_encoder *encoder; > struct device_node *ddc_node; > - u32 value; > int ret; > > vc4_hdmi = devm_kzalloc(dev, sizeof(*vc4_hdmi), GFP_KERNEL); > @@ -2031,18 +2029,10 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) > /* Only use the GPIO HPD pin if present in the DT, otherwise > * we'll use the HDMI core's register. > */ > - if (of_find_property(dev->of_node, "hpd-gpios", &value)) { > - enum of_gpio_flags hpd_gpio_flags; > - > - vc4_hdmi->hpd_gpio = of_get_named_gpio_flags(dev->of_node, > - "hpd-gpios", 0, > - &hpd_gpio_flags); > - if (vc4_hdmi->hpd_gpio < 0) { > - ret = vc4_hdmi->hpd_gpio; > - goto err_put_ddc; > - } > - > - vc4_hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; > + vc4_hdmi->hpd_gpio = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN); > + if (IS_ERR(vc4_hdmi->hpd_gpio)) { > + ret = PTR_ERR(vc4_hdmi->hpd_gpio); > + goto err_put_ddc; > } > > vc4_hdmi->disable_wifi_frequencies = > diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.h b/drivers/gpu/drm/vc4/vc4_hdmi.h > index 060bcaefbeb5..2688a55461d6 100644 > --- a/drivers/gpu/drm/vc4/vc4_hdmi.h > +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h > @@ -146,8 +146,7 @@ struct vc4_hdmi { > /* VC5 Only */ > void __iomem *rm_regs; > > - int hpd_gpio; > - bool hpd_active_low; > + struct gpio_desc *hpd_gpio; > > /* > * On some systems (like the RPi4), some modes are in the same > -- > 2.31.1 Hi Maxime, This patch as commit 6800234ceee0 ("drm/vc4: hdmi: Convert to gpiod") causes my Raspberry Pi 3 to lock up shortly after boot in combination with commit 411efa18e4b0 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_pm"). The serial console and ssh are completely unresponsive and I do not see any messages in dmesg with "debug ignore_loglevel". The device is running with a 32-bit kernel (multi_v7_defconfig) with 32-bit userspace. If there is any further information that I can provide, please let me know. Cheers, Nathan