Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp768079ybt; Wed, 1 Jul 2020 09:30:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxCcZeqR/pm/Hsugine6fIYJ9D2K3ETYbCRmhQRSAKUwqj73nyD9dms2cvWmQyngOYATEA X-Received: by 2002:a50:fe16:: with SMTP id f22mr23291250edt.315.1593621027845; Wed, 01 Jul 2020 09:30:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593621027; cv=none; d=google.com; s=arc-20160816; b=zkXbskN8P3UJ6TkmYQENC1M+Q/NeqsQ1h3lvIogBP0UPzH8WXz6IEcMHvOpPn/wx/w fJyi/ru5jReViSlelbFzFee/PpYxR8ewdN/DFCIUuyJyjVwnU77MLFJ1HFMgskd1Besp V4zuJqNWgsA7CMzBR/Ypk3ftft2r4ZmFrp9gjcIR0thYYwmBqmDqvuAsntDidAKG3sll kHXKssqH35oGwKWS8NyF7GxeFtSuRKRirXAj/scP5kZyAkydniBoRlv3a3ze7pNrQdHT 9xlyMdE3TqdR9r1bdDA2SxQwDLq/54wzEciB6mTcMPlMMuJxW7nLCtqpt1f9KVTs95aR 6eEA== 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=dtLfY839SOy9+ynoPu5CpwAKet+82DJe8/g5Ic+NVCU=; b=ICbZk+3he7kkdcZBmbQJ8r29f5NXbJz7UX+2vwof18lDJaHFZVq6vG/Dk2nNBRBFX8 Mu0RCMmzyOvFBUGf/sLuGToGgOntqNyqZK/HF66IOLOjwmnEf2dO+hB93o+eoGGvk5V8 PQSLzwQZMRWA3neZkediZhes8rPpeObkRtiGQ97DRxnxGSmMQMX4Beg2wQCdizsuAQf4 uo1VYzPvDqJMkbQptvnlrUzk6S+iUIOu2doXwN55Cc8iWNiNABl0FyDcXdwG5DIqvzLk PUDUp0OCiC1oFp0FrW1PxLMr1SLrTBg0Pi9/yImKlfgQTjRB8ygsaiAMwO9DHawQZP6Y wIgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@megous.com header.s=mail header.b=VlBBBRxm; 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 36si4816408edp.290.2020.07.01.09.30.04; Wed, 01 Jul 2020 09:30:27 -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=VlBBBRxm; 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 S1732443AbgGAQ3o (ORCPT + 99 others); Wed, 1 Jul 2020 12:29:44 -0400 Received: from vps.xff.cz ([195.181.215.36]:52352 "EHLO vps.xff.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732391AbgGAQ3i (ORCPT ); Wed, 1 Jul 2020 12:29:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megous.com; s=mail; t=1593620974; bh=zkODNCMULY1qflHx9pXN2q3BlZBV4YZQDDm3YdTOqMc=; h=From:To:Cc:Subject:Date:References:From; b=VlBBBRxm4dDrG8c8iIovoYlpXJu+hCvaSfB9J6AdHQbVWWGBO2bvdhfMmVvMC2EHw Uqy0FqKroZVhout9bEXq4bvkuOj9owK0wfJTFenzrZhxZmPKIu0T/8a8tfsnZ2fgcs +olWZv1pbU3QzvCoNqACDfZVI1nXZ+nC6PQW9wBo= 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 v7 08/13] drm/panel: st7703: Move generic part of init sequence to enable callback Date: Wed, 1 Jul 2020 18:29:23 +0200 Message-Id: <20200701162928.1638874-9-megous@megous.com> In-Reply-To: <20200701162928.1638874-1-megous@megous.com> References: <20200701162928.1638874-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 61872f623fff..96e39ec94900 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; } @@ -180,6 +165,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); @@ -189,6 +175,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