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: 481657 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=unavailable 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 4CB13C07E95 for ; Tue, 20 Jul 2021 15:46:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 25D58610FB for ; Tue, 20 Jul 2021 15:46:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239729AbhGTPFK (ORCPT ); Tue, 20 Jul 2021 11:05:10 -0400 Received: from mail1.protonmail.ch ([185.70.40.18]:26743 "EHLO mail1.protonmail.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241745AbhGTOxZ (ORCPT ); Tue, 20 Jul 2021 10:53:25 -0400 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 Cc: Andy Gross , Bjorn Andersson , Rob Herring , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org Reply-To: 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 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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);