Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3296769pxk; Mon, 21 Sep 2020 09:58:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQxiUiwsNYWNf5E+j1SLfPSpc4dbMUvATLQXsGJaHATaAjKg5FNDjb3OEOyO1sn05ZKru2 X-Received: by 2002:a17:906:54e:: with SMTP id k14mr371182eja.59.1600707529328; Mon, 21 Sep 2020 09:58:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600707529; cv=none; d=google.com; s=arc-20160816; b=Ie3I7vqjfXn7b6cCuYaLnXCRPei0+3WxS8vc9CAdr13n8+Rr+w3yHQTopQltpOlR+7 oUraJM4wBJquSGUyAs2IID3lUjsOO5c60ckVKv2DUC/nrJyZf6AWApiB1s8UozMmHwA9 wryJpE3SbCBTwMRXGzRCjn8QOQZ7AYnMZXangTsAzkCQ6FserSph0uX7FbWSIQZJ55xT IbfuD8qBHNqX25Y5Uy9XHSiA8y1PUhp4skL48zAoaff+TOz5rsnnq5TL6t0P9FbLu3mu KLztPh37cBp35Ot2OAU03H+b1ke+C2dPxr2KzAzHS/7Wp7/tUJVT/dycfd+Pap4dC0W2 Mpmg== 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:date:subject:to:from; bh=LvWsDOtL8sUIeD/T2zUnhvXoqy0u1RQXi9GPnx1vlTE=; b=zIYrYVmD6r+TjvClhy7MLTYKxui+YpJANLMqdrtA+fL0lj8s4vcD+KM8R46XMZ+krX /PPJb2T6OIFtxy7YPqRro9GPF+jlOMvVeTHyF6ugsIHr3MRG4/7nQLVlX1W+ERT5E0n3 8xbSfGkw9XOoXKlzAddrkzewsGyv7PoJq58BVPq7LNuQG789nd8m+Pe5dmvWlymUHWTm LYqy+kiaE9Y02gZUDAq7phdgT7gJCGZN1QcPJ+OZEhI1fwIiop+vojxJ+LlYUO/AKxiJ Y5rxIjT/lSB3NsTBS8WWSv7ASbySrz+Ywc/5Bh/MO3rHVobpx5OaY+lSPzdAhuC6+tE6 wRvA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d21si9257472edp.276.2020.09.21.09.58.25; Mon, 21 Sep 2020 09:58:49 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730086AbgIUQ4H (ORCPT + 99 others); Mon, 21 Sep 2020 12:56:07 -0400 Received: from honk.sigxcpu.org ([24.134.29.49]:39514 "EHLO honk.sigxcpu.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727939AbgIUQ4A (ORCPT ); Mon, 21 Sep 2020 12:56:00 -0400 Received: from localhost (localhost [127.0.0.1]) by honk.sigxcpu.org (Postfix) with ESMTP id 0DE81FB05; Mon, 21 Sep 2020 18:55:58 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at honk.sigxcpu.org Received: from honk.sigxcpu.org ([127.0.0.1]) by localhost (honk.sigxcpu.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kXa4Z1C41mUZ; Mon, 21 Sep 2020 18:55:53 +0200 (CEST) Received: by bogon.sigxcpu.org (Postfix, from userid 1000) id 0511245678; Mon, 21 Sep 2020 18:55:53 +0200 (CEST) From: =?UTF-8?q?Guido=20G=C3=BCnther?= To: Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Rob Herring , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v1 2/3] drm/panel: mantix: Fix panel reset Date: Mon, 21 Sep 2020 18:55:51 +0200 Message-Id: <66973d8182164fca9fc0f57970a6cd8f110759bb.1600707235.git.agx@sigxcpu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mantix panel needs two reset lines (RESX and TP_RSTN) deasserted to output an image. Only deasserting RESX is not enough and the display will stay blank. Deassert in prepare() and assert in unprepare() to keep device held in reset when off. Signed-off-by: Guido Günther --- .../gpu/drm/panel/panel-mantix-mlaf057we51.c | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c index 4a7fbf64bb7a..29d28c63bb72 100644 --- a/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +++ b/drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c @@ -23,10 +23,13 @@ #define MANTIX_CMD_OTP_STOP_RELOAD_MIPI 0x41 #define MANTIX_CMD_INT_CANCEL 0x4C +#define MANTIX_NUM_RESETS 2 + struct mantix { struct device *dev; struct drm_panel panel; - struct gpio_desc *reset_gpio; + /* RESX and TP_RSTN */ + struct gpio_descs *reset_gpios; struct regulator *avdd; struct regulator *avee; @@ -122,8 +125,13 @@ static int mantix_disable(struct drm_panel *panel) static int mantix_unprepare(struct drm_panel *panel) { + DECLARE_BITMAP(asserted_values, BITS_PER_TYPE(1)); struct mantix *ctx = panel_to_mantix(panel); + gpiod_set_array_value_cansleep(ctx->reset_gpios->ndescs, + ctx->reset_gpios->desc, + ctx->reset_gpios->info, asserted_values); + regulator_disable(ctx->avee); regulator_disable(ctx->avdd); /* T11 */ @@ -137,6 +145,7 @@ static int mantix_unprepare(struct drm_panel *panel) static int mantix_prepare(struct drm_panel *panel) { + DECLARE_BITMAP(deasserted_values, BITS_PER_TYPE(0)); struct mantix *ctx = panel_to_mantix(panel); int ret; @@ -165,14 +174,11 @@ static int mantix_prepare(struct drm_panel *panel) return ret; } - /* T3+T5 */ - usleep_range(10000, 12000); - - gpiod_set_value_cansleep(ctx->reset_gpio, 1); - usleep_range(5150, 7000); - - gpiod_set_value_cansleep(ctx->reset_gpio, 0); - + /* T3 + T4 + time for voltage to become stable: */ + usleep_range(6000, 7000); + gpiod_set_array_value_cansleep(ctx->reset_gpios->ndescs, + ctx->reset_gpios->desc, + ctx->reset_gpios->info, deasserted_values); /* T6 */ msleep(50); @@ -236,10 +242,15 @@ static int mantix_probe(struct mipi_dsi_device *dsi) if (!ctx) return -ENOMEM; - ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(ctx->reset_gpio)) { - dev_err(dev, "cannot get reset gpio\n"); - return PTR_ERR(ctx->reset_gpio); + ctx->reset_gpios = devm_gpiod_get_array(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(ctx->reset_gpios)) { + dev_err(dev, "cannot get reset gpios\n"); + return PTR_ERR(ctx->reset_gpios); + } + + if (ctx->reset_gpios->ndescs != MANTIX_NUM_RESETS) { + dev_err(dev, "Need exactly %d reset-gpios\n", MANTIX_NUM_RESETS); + return -EINVAL; } mipi_dsi_set_drvdata(dsi, ctx); -- 2.26.2