Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp497468ybt; Wed, 1 Jul 2020 03:35:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwc9sfdE4f+UHpdwahXOo0SN3bboFdNL6XXV96qipTy/+ZSs8qLuRKr7Um9I0PVIyOXQHib X-Received: by 2002:a17:906:594c:: with SMTP id g12mr22148195ejr.255.1593599743776; Wed, 01 Jul 2020 03:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593599743; cv=none; d=google.com; s=arc-20160816; b=FMBWR2J1+AtpqqSxA7S6wvNVrAC9qqqkQe1laY/szDqp2XfTHrUzV6Zd6bQX21ah/m LJp3JCRQEFIHPhsLhfjlzaCF3JdI/S1BmembHHSk9inQQLsewbSmEpto5GFxEIBNkD70 jz7WLpHPIbyi8hSB5lles2AVZTPycTFVG/KYrUkoJ5cMsjZ9OiSF3EAfEHC/z8/JRP4i TRUQPoKHrszFuWw6DbEm6qJuqjQJEZI3GftHslel6XOVmHLv3JGsrQB4RZlpXJLUuoF+ fv7cg+dBTBu0qMqPOD/qnTiKutHT0eIiJIANStqcyONfSGq+hNui5ubLf6RA5Urc57zP vzdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9SrEubKjUg8s/b6mDpMuUsWD/WhfxRybTQ3g948sB+A=; b=XAB3C/AtbMHL11u5zla2wPy7eHTx4TJbz2XyDZqQnr5a62EZzeLRcABHaiVNwh8IRS /NXPC21IyW4/UYbHWk52eAytq34rcqm4zWlsb+WQnPL+8G5HsMnBRhCXXYh0DFGGsYkr Na85B0ksCzDD66BKrK10UMgEh1F/Anq+gmpHrmU8acrLGPQnTeARCvuIavRryUSB0HCH P8NvjaAM/d2kBX/m2MqzN4tLx37BCvyEa5hRxrvmkyeAjYuo3M6w30CFh4CKNlwUEe+k n8l30Xkvq4zqdtEi8yxBM8ngtrgKL74EFC04KWXzNexFwvtXZetF2ZLlBEw/gb08Pg5Q TTWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=Gifwo9Il; 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=megous.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ci12si3541457ejb.448.2020.07.01.03.35.21; Wed, 01 Jul 2020 03:35:43 -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=@megous.com header.s=mail header.b=Gifwo9Il; 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=megous.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730135AbgGAKc3 (ORCPT + 99 others); Wed, 1 Jul 2020 06:32:29 -0400 Received: from vps.xff.cz ([195.181.215.36]:42454 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730000AbgGAKbk (ORCPT ); Wed, 1 Jul 2020 06:31:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1593599492; bh=d01KMfiwzeoisglB/Cqi2m/MksDraHInx82M1f3A4AM=; h=From:To:Cc:Subject:Date:References:From; b=Gifwo9IlizZraP++g7fxaRVhefFdSUYC88bZmUbpa8t/gEnzliNnDv4zJkYcB4l2r MK4CTX2OzESfRq7iHZ0ZnsKJaKn7b12At5OgkiPtHqmXrIbCMsXiAzwFPMZN0R+7nO +hg17nsGHYfLXNJgs1zZ+8x4C/eip0taAhEu5syE= From: Ondrej Jirman To: linux-sunxi@googlegroups.com, Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , =?UTF-8?q?Guido=20G=C3=BCnther?= , Purism Kernel Team , Rob Herring , Maxime Ripard , Chen-Yu Tsai , Linus Walleij , Icenowy Zheng Cc: Ondrej Jirman , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Samuel Holland , Martijn Braam , Luca Weiss , Bhushan Shah Subject: [PATCH v6 08/13] drm/panel: st7703: Move generic part of init sequence to enable callback Date: Wed, 1 Jul 2020 12:31:21 +0200 Message-Id: <20200701103126.1512615-9-megous@megous.com> In-Reply-To: <20200701103126.1512615-1-megous@megous.com> References: <20200701103126.1512615-1-megous@megous.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Calling sleep out and display on is a controller specific part of the initialization process. Move it out of the panel specific initialization function to the enable callback. Signed-off-by: Ondrej Jirman Reviewed-by: Linus Walleij --- drivers/gpu/drm/panel/panel-sitronix-st7703.c | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c index d03aab10cfef..cdbf7dfb4dd4 100644 --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c @@ -84,8 +84,6 @@ static inline struct st7703 *panel_to_st7703(struct drm_panel *panel) static int jh057n_init_sequence(struct st7703 *ctx) { struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); - struct device *dev = ctx->dev; - int ret; /* * Init sequence was supplied by the panel vendor. Most of the commands @@ -136,20 +134,7 @@ static int jh057n_init_sequence(struct st7703 *ctx) 0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41, 0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10, 0x11, 0x18); - msleep(20); - - ret = mipi_dsi_dcs_exit_sleep_mode(dsi); - if (ret < 0) { - DRM_DEV_ERROR(dev, "Failed to exit sleep mode: %d\n", ret); - return ret; - } - /* Panel is operational 120 msec after reset */ - msleep(60); - ret = mipi_dsi_dcs_set_display_on(dsi); - if (ret) - return ret; - DRM_DEV_DEBUG_DRIVER(dev, "Panel init sequence done\n"); return 0; } @@ -181,6 +166,7 @@ struct st7703_panel_desc jh057n00900_panel_desc = { static int st7703_enable(struct drm_panel *panel) { struct st7703 *ctx = panel_to_st7703(panel); + struct mipi_dsi_device *dsi = to_mipi_dsi_device(ctx->dev); int ret; ret = ctx->desc->init_sequence(ctx); @@ -190,6 +176,23 @@ static int st7703_enable(struct drm_panel *panel) return ret; } + msleep(20); + + ret = mipi_dsi_dcs_exit_sleep_mode(dsi); + if (ret < 0) { + DRM_DEV_ERROR(ctx->dev, "Failed to exit sleep mode: %d\n", ret); + return ret; + } + + /* Panel is operational 120 msec after reset */ + msleep(60); + + ret = mipi_dsi_dcs_set_display_on(dsi); + if (ret) + return ret; + + DRM_DEV_DEBUG_DRIVER(ctx->dev, "Panel init sequence done\n"); + return 0; } -- 2.27.0