From patchwork Tue Jul 20 15:33:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 12388615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1732C07E9B for ; Tue, 20 Jul 2021 15:33:57 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A41B6113A for ; Tue, 20 Jul 2021 15:33:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A41B6113A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=connolly.tech Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1084F89C33; Tue, 20 Jul 2021 15:33:57 +0000 (UTC) Received: from mail-41104.protonmail.ch (mail-41104.protonmail.ch [185.70.41.104]) by gabe.freedesktop.org (Postfix) with ESMTPS id D924789C33 for ; Tue, 20 Jul 2021 15:33:54 +0000 (UTC) Received: from mail-0201.mail-europe.com (mail-0201.mail-europe.com [51.77.79.158]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by mail-41104.protonmail.ch (Postfix) with ESMTPS id 4GTjRj1DxWz50MKT for ; Tue, 20 Jul 2021 15:33:53 +0000 (UTC) Authentication-Results: mail-41104.protonmail.ch; dkim=pass (1024-bit key) header.d=connolly.tech header.i=@connolly.tech header.b="Xg4qOYPU" Date: Tue, 20 Jul 2021 15:33:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=connolly.tech; s=protonmail; t=1626795229; bh=d9Q3moj/2J34xlyehWoq/C7zP8ek1tDX6NiP55RbvIw=; h=Date:To:From:Cc:Reply-To:Subject:In-Reply-To:References:From; b=Xg4qOYPUk793e8ucsxhhTPL54VmfiqV/0bzSeQbgFfxV8qKVM5NUA24rdBHPJ4e5Y AaGfTk2+TPzflGIxx6u7Ij+n1ruwAtqH0fHGQMD7onBeH5v7m0g34KQTLuSHtczYBI 0n95i5OOHJpze7akWJI1R8Gm0UHmMU53ssJeinMs= To: Caleb Connolly From: Caleb Connolly Subject: [PATCH 3/5] drm/panel/samsung-sofef00: make gpio optional Message-ID: <20210720153125.43389-4-caleb@connolly.tech> In-Reply-To: <20210720153125.43389-1-caleb@connolly.tech> References: <20210720153125.43389-1-caleb@connolly.tech> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Caleb Connolly Cc: devicetree@vger.kernel.org, David Airlie , linux-arm-msm@vger.kernel.org, Rob Herring , Bjorn Andersson , Andy Gross , Thierry Reding , dri-devel@lists.freedesktop.org, Sam Ravnborg Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The OnePlus 6T panel fails to initialise if it has been reset, workaround this by allowing panels to not specify a reset GPIO. Signed-off-by: Caleb Connolly --- drivers/gpu/drm/panel/panel-samsung-sofef00.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.32.0 diff --git a/drivers/gpu/drm/panel/panel-samsung-sofef00.c b/drivers/gpu/drm/panel/panel-samsung-sofef00.c index 8cb1853574bb..a20a5af14653 100644 --- a/drivers/gpu/drm/panel/panel-samsung-sofef00.c +++ b/drivers/gpu/drm/panel/panel-samsung-sofef00.c @@ -44,6 +44,8 @@ struct sofef00_panel *to_sofef00_panel(struct drm_panel *panel) static void sofef00_panel_reset(struct sofef00_panel *ctx) { + if (!ctx->reset_gpio) + return; gpiod_set_value_cansleep(ctx->reset_gpio, 0); usleep_range(5000, 6000); gpiod_set_value_cansleep(ctx->reset_gpio, 1); @@ -137,7 +139,8 @@ static int sofef00_panel_prepare(struct drm_panel *panel) ret = sofef00_panel_on(ctx); if (ret < 0) { dev_err(dev, "Failed to initialize panel: %d\n", ret); - gpiod_set_value_cansleep(ctx->reset_gpio, 1); + if (ctx->reset_gpio) + gpiod_set_value_cansleep(ctx->reset_gpio, 1); return ret; } @@ -276,7 +279,7 @@ static int sofef00_panel_probe(struct mipi_dsi_device *dsi) return ret; } - ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); + ctx->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(ctx->reset_gpio)) { ret = PTR_ERR(ctx->reset_gpio); dev_warn(dev, "Failed to get reset-gpios: %d\n", ret);