From patchwork Tue Mar 14 11:17:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabio Estevam X-Patchwork-Id: 663743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8548FC6FD1C for ; Tue, 14 Mar 2023 11:18:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231406AbjCNLS5 (ORCPT ); Tue, 14 Mar 2023 07:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231370AbjCNLSV (ORCPT ); Tue, 14 Mar 2023 07:18:21 -0400 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA3961ADEB for ; Tue, 14 Mar 2023 04:17:48 -0700 (PDT) Received: from fabio-Precision-3551.. (unknown [IPv6:2804:14c:485:4b69:d086:7d15:2ce3:1a1b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: festevam@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 84D16861C5; Tue, 14 Mar 2023 12:17:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1678792659; bh=5UVq9kWaDSvkl4Rfih2050+zoQO8g2q290YPZ7fsYME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p8zxERBlTl6EmELJFG3+3NTNt64GsbVFwAGSB1AwaSC8vCWbffiPnTxxqB0UOBSrO EytfrsQaDut3BNujxc+ImPBrhiMgmW0/sHYf8V13HNaabMyim9Faspi271jeAuun34 eH6ilSOtiXXpF/T0bWNCBYWHanBkWi9rQ7bmK0XzKLD+xN7Htgm1qM1Imwki+vjIsL bTuAP++WCZud8uv/ts7B7hmDXgHHNYQYlzhm41IhGv1SJV1uXY/qZvEVifCCVv/iXv 7nKq8GzmqAOOAJP7VMqGK5tAVWH4/cHDQh8JIqSMMBzuSx7SxVFY22ofcMH0ahVyqL 7RyJNHaXaO0Ig== From: Fabio Estevam To: neil.armstrong@linaro.org Cc: sam@ravnborg.org, krzysztof.kozlowski+dt@linaro.org, robh+dt@kernel.org, devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, CPHEALY@gmail.com, Fabio Estevam Subject: [PATCH 2/2] drm/panel: seiko-43wvf1g: Add the 'enable-gpios' property Date: Tue, 14 Mar 2023 08:17:24 -0300 Message-Id: <20230314111724.1520178-2-festevam@denx.de> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230314111724.1520178-1-festevam@denx.de> References: <20230314111724.1520178-1-festevam@denx.de> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Sometimes a GPIO is needed to turn on/off the display. Add support for this usecase by introducing the optional 'enable-gpios' property. Tested on a imx53qsb board. Signed-off-by: Fabio Estevam Reviewed-by: Neil Armstrong --- drivers/gpu/drm/panel/panel-seiko-43wvf1g.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c index 76160e5d43bd..c250ca36a5b3 100644 --- a/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c +++ b/drivers/gpu/drm/panel/panel-seiko-43wvf1g.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -48,6 +49,7 @@ struct seiko_panel { const struct seiko_panel_desc *desc; struct regulator *dvdd; struct regulator *avdd; + struct gpio_desc *enable_gpio; }; static inline struct seiko_panel *to_seiko_panel(struct drm_panel *panel) @@ -139,6 +141,8 @@ static int seiko_panel_unprepare(struct drm_panel *panel) if (!p->prepared) return 0; + gpiod_set_value_cansleep(p->enable_gpio, 0); + regulator_disable(p->avdd); /* Add a 100ms delay as per the panel datasheet */ @@ -174,6 +178,8 @@ static int seiko_panel_prepare(struct drm_panel *panel) goto disable_dvdd; } + gpiod_set_value_cansleep(p->enable_gpio, 1); + p->prepared = true; return 0; @@ -252,6 +258,12 @@ static int seiko_panel_probe(struct device *dev, if (IS_ERR(panel->avdd)) return PTR_ERR(panel->avdd); + panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", + GPIOD_OUT_LOW); + if (IS_ERR(panel->enable_gpio)) + return dev_err_probe(dev, PTR_ERR(panel->enable_gpio), + "failed to request GPIO\n"); + drm_panel_init(&panel->base, dev, &seiko_panel_funcs, DRM_MODE_CONNECTOR_DPI);