From patchwork Tue Nov 13 11:16:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680243 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 59A2E14E2 for ; Tue, 13 Nov 2018 11:16:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49C4229A6B for ; Tue, 13 Nov 2018 11:16:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3D66C29A73; Tue, 13 Nov 2018 11:16:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E425D29A6B for ; Tue, 13 Nov 2018 11:16:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732391AbeKMVOf (ORCPT ); Tue, 13 Nov 2018 16:14:35 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:37562 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732389AbeKMVOf (ORCPT ); Tue, 13 Nov 2018 16:14:35 -0500 Received: by mail-pl1-f193.google.com with SMTP id p6-v6so5855980pll.4 for ; Tue, 13 Nov 2018 03:16:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8ES0cZhisRcmV8a8D5yir4UWuJgGe2haJZaAh1WF1HU=; b=Gc15ndhF1igW5AkAXKJxAnpVuJDtUW0qMYRXdTIStPPgOFBOXKz8iR5/W57SpditQh 4GX5n2L6FjJfhqGUoPaBYer2AHcSfAbXOqGfYMKzXZ16XcEsG54Y+v8VLjXaadakvLzO 8Gq6werHjrMD4a6/PoiVZrnr2pAqrJju/3EL4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8ES0cZhisRcmV8a8D5yir4UWuJgGe2haJZaAh1WF1HU=; b=Hh/TygT5Sjc9daODnhKzAfEN0VrfyT9nWrJi/1zIpZNbPVGUi9FjIRs34FC2mW6Y0C r4MoD+eb9tGu4rJvS0AYpTDLGxbb2IMwzRcac4TQUMvakNhab5CX/hG6kyYxlQAZV/kY azobTXvTMG58gyI3etYUQXzaBX443oaSOjz7249jAGs+tiseCPxj/04LwFMkleSxDkvp +3uDhtUCd5djaCJ8+hwcaFAkWUIfpmKYTv1SLdJeRv/VoPIRrLd0zD+tuXqwldEz0Etk exlOLBqQLs4wISxu4ySX4reoAxzZK/Sg5hSvtXSkKFMCjW8W73YPD72rnPEuYmDvUa5K 3yzQ== X-Gm-Message-State: AGRZ1gIEoQk8at0N9v+336JdeInIoQNEC5zdHHmenbt4lSumfXaYr9e4 VKHw3D/s1+y+rlFRgFlm12Dbqg== X-Google-Smtp-Source: AJdET5eJlzXrq6V6oaP76A2ePAOdAd0mPFR0yhAWAQjyuPvmz7DZ0/USu8zIOzcHyZXT/wKrpyDY/g== X-Received: by 2002:a17:902:d24:: with SMTP id 33-v6mr4725603plu.319.1542107816601; Tue, 13 Nov 2018 03:16:56 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.16.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:16:56 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 01/26] clk: sunxi-ng: a64: Fix gate bit of DSI DPHY Date: Tue, 13 Nov 2018 16:46:08 +0530 Message-Id: <20181113111633.20189-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP DSI DPHY gate bit on MIPI DSI clock register is bit 15 not bit 30. Signed-off-by: Jagan Teki Acked-by: Stephen Boyd --- drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c index f7d297368eb2..019d67bf97c4 100644 --- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c @@ -581,7 +581,7 @@ static const char * const dsi_dphy_parents[] = { "pll-video0", "pll-periph0" }; static const u8 dsi_dphy_table[] = { 0, 2, }; static SUNXI_CCU_M_WITH_MUX_TABLE_GATE(dsi_dphy_clk, "dsi-dphy", dsi_dphy_parents, dsi_dphy_table, - 0x168, 0, 4, 8, 2, BIT(31), CLK_SET_RATE_PARENT); + 0x168, 0, 4, 8, 2, BIT(15), CLK_SET_RATE_PARENT); static SUNXI_CCU_M_WITH_GATE(gpu_clk, "gpu", "pll-gpu", 0x1a0, 0, 3, BIT(31), CLK_SET_RATE_PARENT); From patchwork Tue Nov 13 11:16:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680245 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F15A13BF for ; Tue, 13 Nov 2018 11:17:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E1C529A6D for ; Tue, 13 Nov 2018 11:17:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8212B29A79; Tue, 13 Nov 2018 11:17:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BEE629A6D for ; Tue, 13 Nov 2018 11:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732389AbeKMVOl (ORCPT ); Tue, 13 Nov 2018 16:14:41 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37184 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732474AbeKMVOl (ORCPT ); Tue, 13 Nov 2018 16:14:41 -0500 Received: by mail-pf1-f194.google.com with SMTP id u3-v6so3202954pfm.4 for ; Tue, 13 Nov 2018 03:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yqEP2BzZ2jXeAZHhd1kTnxj7Hp6aFHA67iUShP1YZAg=; b=CT5tzK3FIIhy1SV/dTYRZshieXYn7lZws4/N07d+OFM1y06E6ppEDYyoNj4z+DiXHJ PKZOi3485lOdSDvdmpJfx1lIHydjsICF2QEc3hqlBgn9iLvI0p8LwUgC39dsfYEJVgI1 QjDVkRit1N407Ya9Vob3dqzxremR9OfsQ4uRc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yqEP2BzZ2jXeAZHhd1kTnxj7Hp6aFHA67iUShP1YZAg=; b=lJX6AKSzbWtP3vIVWcdkAhFSpOyrAoztjdfjY/Kxof63k0r9k39sPQdSoHCHBhYFEa KJQnAWYmpKdsxa7Kqkue7Hh29KcHkhKirwHwgykkLpSwTVPIsJHpkQpfID1g4FaObksg LLQqFEsWuPuJpErzB7M7f+kXK1KAMHSe0rG3aNL7rBKFkJtrMvCU2aX0z9skyD9LAnvE Q1pQw7w7qEiWxjby+Uh3GdDb0nuzR+IPGB/l/7P2Xf/Hsg4/PKtPlDAWE1ARmKMrIdqt T7D0bLjNs2uP2v2CQK8B9bP9uoiIyzuebbJ5dg3Hlfbys5C2QegFO2B6Y4wDWDtLEstt XIOw== X-Gm-Message-State: AGRZ1gLNLZGPGidPo8OgDeGJyk8wFnZ/K7pg+cNg7LHGp/lVa1uCOHt8 l+EXAR1IxEFz7GbYl1lk35eOPg== X-Google-Smtp-Source: AJdET5cmMrWyjSS6C6l9voHS7ZTX4u3lJ5zBE7LPx1Im9I1AC8wCAE6QwyFo514E2Hznjq6ngUFrDA== X-Received: by 2002:a62:1709:: with SMTP id 9mr3422529pfx.249.1542107822825; Tue, 13 Nov 2018 03:17:02 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.16.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:02 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 02/26] clk: sunxi-ng: Add check for minimal rate to NKM PLLs Date: Tue, 13 Nov 2018 16:46:09 +0530 Message-Id: <20181113111633.20189-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some NKM PLLs doesn't work well when their output clock rate is set below certain rate. So, add support for minimal rate for relevant PLLs. Signed-off-by: Jagan Teki Acked-by: Stephen Boyd --- drivers/clk/sunxi-ng/ccu_nkm.c | 3 +++ drivers/clk/sunxi-ng/ccu_nkm.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index 841840e35e61..6b5ad990f802 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -125,6 +125,9 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux, if (nkm->common.features & CCU_FEATURE_FIXED_POSTDIV) rate *= nkm->fixed_post_div; + if (rate < nkm->min_rate) + return nkm->min_rate; + ccu_nkm_find_best(*parent_rate, rate, &_nkm); rate = *parent_rate * _nkm.n * _nkm.k / _nkm.m; diff --git a/drivers/clk/sunxi-ng/ccu_nkm.h b/drivers/clk/sunxi-ng/ccu_nkm.h index cc6efb70a102..ff5bd00f429f 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.h +++ b/drivers/clk/sunxi-ng/ccu_nkm.h @@ -35,6 +35,7 @@ struct ccu_nkm { struct ccu_mux_internal mux; unsigned int fixed_post_div; + unsigned int min_rate; struct ccu_common common; }; From patchwork Tue Nov 13 11:16:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680249 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 585F113BF for ; Tue, 13 Nov 2018 11:17:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474AF29A6D for ; Tue, 13 Nov 2018 11:17:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3ADDF29A79; Tue, 13 Nov 2018 11:17:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DB6CF29A6D for ; Tue, 13 Nov 2018 11:17:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732471AbeKMVOs (ORCPT ); Tue, 13 Nov 2018 16:14:48 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35729 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732526AbeKMVOr (ORCPT ); Tue, 13 Nov 2018 16:14:47 -0500 Received: by mail-pl1-f196.google.com with SMTP id n4-v6so5857390plp.2 for ; Tue, 13 Nov 2018 03:17:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=ToJirpXfC1n3gWkryiJS7jnKRWpzntkBX5uluzEnPwvJIU74yr+59gNpfe4mkRJsr6 ZQy5ESBGNxw5piaq9yvaXKHONhOWo5FwD/GIy/35Wcz5fsEQXlRk5Y84iuWdjHRgs6Gi s0utKmQauGwjiO5oGX1Dkw79QTh+P4obBluIk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qbm/NIYuuBGisaoOf8xEjZz2GqJiY+po/xAr8VTc9Ho=; b=BmfUZPQ1EWJhzLIxs0LEwm+nXDtCUQ6Rhmsl9cEZIK5jrID16UKYwvcaIWvHLBPaZh hPLcgCMOHLVZ2s4NACCY49a5D3379ihl5fCwoSgAZvtx29zTBReUx7uH5o7vvzkbs76f XeMi3tWdO7XfpNSLQdCNsLO6EpALYyHtUE/NWsPQnJPYKRUOeT7RyMF6G7zb2v/3eZ6q AdfB5JlPc0ZvmTmL3e8NM0LSvgtUXk1zGuXVAgRfnswzq4YICtGH19+iuVY8tzGGlnK6 vDOqd8AXTMkbYI0K5PuYAIj3PV6DNjjfSoflcpyhkaQ3HFdpHFvsa1xQ++hpjR+qT4xo JLUQ== X-Gm-Message-State: AGRZ1gKCA5X/CI2APZPSLaXM7ag5YQ2gtbbRrVtD5Ik0G93/n+o1hqyV y3lHGSIv9qXM95yz8pwl8xfTWA== X-Google-Smtp-Source: AJdET5f30k2tAIaqToyDxrKODYMga/iJ046M4/2dIT577ikT4Iv4sylXZhUrbjRpWQ1GftQPeTw08Q== X-Received: by 2002:a17:902:3103:: with SMTP id w3-v6mr4770500plb.18.1542107828971; Tue, 13 Nov 2018 03:17:08 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:08 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 03/26] clk: sunxi-ng: Add check for maximum rate to NKM PLLs Date: Tue, 13 Nov 2018 16:46:10 +0530 Message-Id: <20181113111633.20189-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some NKM PLLs, frequency can be set above PLL working range. Add a constraint for maximum supported rate. This way, drivers can specify which is maximum allowed rate for PLL. Signed-off-by: Jagan Teki Acked-by: Stephen Boyd --- drivers/clk/sunxi-ng/ccu_nkm.c | 3 +++ drivers/clk/sunxi-ng/ccu_nkm.h | 1 + 2 files changed, 4 insertions(+) diff --git a/drivers/clk/sunxi-ng/ccu_nkm.c b/drivers/clk/sunxi-ng/ccu_nkm.c index 6b5ad990f802..b8b66cdd30bf 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.c +++ b/drivers/clk/sunxi-ng/ccu_nkm.c @@ -128,6 +128,9 @@ static unsigned long ccu_nkm_round_rate(struct ccu_mux_internal *mux, if (rate < nkm->min_rate) return nkm->min_rate; + if (nkm->max_rate && rate > nkm->max_rate) + return nkm->max_rate; + ccu_nkm_find_best(*parent_rate, rate, &_nkm); rate = *parent_rate * _nkm.n * _nkm.k / _nkm.m; diff --git a/drivers/clk/sunxi-ng/ccu_nkm.h b/drivers/clk/sunxi-ng/ccu_nkm.h index ff5bd00f429f..c82590481188 100644 --- a/drivers/clk/sunxi-ng/ccu_nkm.h +++ b/drivers/clk/sunxi-ng/ccu_nkm.h @@ -36,6 +36,7 @@ struct ccu_nkm { unsigned int fixed_post_div; unsigned int min_rate; + unsigned int max_rate; struct ccu_common common; }; From patchwork Tue Nov 13 11:16:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 040DB1747 for ; Tue, 13 Nov 2018 11:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6C1429A6D for ; Tue, 13 Nov 2018 11:17:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB06229A79; Tue, 13 Nov 2018 11:17:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CDC229A6D for ; Tue, 13 Nov 2018 11:17:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732580AbeKMVOy (ORCPT ); Tue, 13 Nov 2018 16:14:54 -0500 Received: from mail-pf1-f193.google.com ([209.85.210.193]:34462 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732554AbeKMVOx (ORCPT ); Tue, 13 Nov 2018 16:14:53 -0500 Received: by mail-pf1-f193.google.com with SMTP id y18-v6so5889051pfn.1 for ; Tue, 13 Nov 2018 03:17:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rlpTqVyJlpHFfIEuYuSfPKgTjg+EAGEL37BZe3O0asI=; b=Tvk0A1rdlZwU2H/erI9DCOI3BToAUw1PAWTAHaBJGG3DsugxHOyJCwM6I4o+M7frxs hux8cmRwJKcijqU6uahwgn1iB5td6SjmT4XgQHVYXDkCerfTc/qiMJrO7khluuURMwqA vVDswakxARyzigAU4v2iGvJuWcs4KgA/5uqCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rlpTqVyJlpHFfIEuYuSfPKgTjg+EAGEL37BZe3O0asI=; b=dIQz47qbALFEC4owcnjdehAcn98GpEA6s2XnqmH4h8OPSWrwuekTXbbS8FOo8mqkd1 5pfgctK37oeEeYSXwglEnWmnloKUSxRO6f3LuqAWCJxS7bQC3LYj3igg4NL/7ubAZGLL vmttery+HyiIZR/jtpekyx/nmogW7vMTF2NKSxO9GzD04uiGuwC4h73wm3LMWSjmIEPB K8+bLomGDFdUtmqFg+YK+N4lPz4aeSF4d/olOguOoQq0GDciPUS9lc2V0tg4/TmX6azp BSi14NyyjEOI9FtTWmRfEPXRVOlgvTUasQ+XtvcFudZqNmzhDMZM5sK09s2GfPGp61zF Olxg== X-Gm-Message-State: AGRZ1gJT3jjB+loLQ0bOOf48BftJHpHsw/bJsYv9lvkHvbPcEIALbiBW paUZ1vw5FeoRyrAuyu+HyCRpew== X-Google-Smtp-Source: AJdET5e4s1eDUbEu4nwnvqoJ/ehKzokEiQwLxAYbnJVDM1PfXE4LBpU/Y7lelG81j5T1dLCm7/m9HQ== X-Received: by 2002:a63:65c7:: with SMTP id z190mr4375174pgb.249.1542107835284; Tue, 13 Nov 2018 03:17:15 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:14 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 04/26] drm/sun4i: sun6i_mipi_dsi: Add has_mod_clk quirk Date: Tue, 13 Nov 2018 16:46:11 +0530 Message-Id: <20181113111633.20189-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Mod clock is not mandatory for all Allwinner MIPI DSI controllers, it is connected as CLK_DSI_SCLK for A31 and not available in A64. So add has_mod_clk quirk and process the clk accordingly. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 39 ++++++++++++++++++-------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 5 ++++ 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index e3b34a345546..561de393ea23 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -981,6 +982,8 @@ static int sun6i_dsi_probe(struct platform_device *pdev) dsi->host.ops = &sun6i_dsi_host_ops; dsi->host.dev = dev; + dsi->variant = of_device_get_match_data(dev); + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); base = devm_ioremap_resource(dev, res); if (IS_ERR(base)) { @@ -1001,17 +1004,20 @@ static int sun6i_dsi_probe(struct platform_device *pdev) return PTR_ERR(dsi->reset); } - dsi->mod_clk = devm_clk_get(dev, "mod"); - if (IS_ERR(dsi->mod_clk)) { - dev_err(dev, "Couldn't get the DSI mod clock\n"); - return PTR_ERR(dsi->mod_clk); + if (dsi->variant->has_mod_clk) { + dsi->mod_clk = devm_clk_get(dev, "mod"); + if (IS_ERR(dsi->mod_clk)) { + dev_err(dev, "Couldn't get the DSI mod clock\n"); + return PTR_ERR(dsi->mod_clk); + } } /* * In order to operate properly, that clock seems to be always * set to 297MHz. */ - clk_set_rate_exclusive(dsi->mod_clk, 297000000); + if (dsi->variant->has_mod_clk) + clk_set_rate_exclusive(dsi->mod_clk, 297000000); dphy_node = of_parse_phandle(dev->of_node, "phys", 0); ret = sun6i_dphy_probe(dsi, dphy_node); @@ -1043,7 +1049,8 @@ static int sun6i_dsi_probe(struct platform_device *pdev) pm_runtime_disable(dev); sun6i_dphy_remove(dsi); err_unprotect_clk: - clk_rate_exclusive_put(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_rate_exclusive_put(dsi->mod_clk); return ret; } @@ -1056,7 +1063,8 @@ static int sun6i_dsi_remove(struct platform_device *pdev) mipi_dsi_host_unregister(&dsi->host); pm_runtime_disable(dev); sun6i_dphy_remove(dsi); - clk_rate_exclusive_put(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_rate_exclusive_put(dsi->mod_clk); return 0; } @@ -1066,7 +1074,8 @@ static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev) struct sun6i_dsi *dsi = dev_get_drvdata(dev); reset_control_deassert(dsi->reset); - clk_prepare_enable(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_prepare_enable(dsi->mod_clk); /* * Enable the DSI block. @@ -1094,7 +1103,8 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev) { struct sun6i_dsi *dsi = dev_get_drvdata(dev); - clk_disable_unprepare(dsi->mod_clk); + if (dsi->variant->has_mod_clk) + clk_disable_unprepare(dsi->mod_clk); reset_control_assert(dsi->reset); return 0; @@ -1106,9 +1116,16 @@ static const struct dev_pm_ops sun6i_dsi_pm_ops = { NULL) }; +static const struct sun6i_dsi_variant sun6i_a31_dsi = { + .has_mod_clk = true, +}; + static const struct of_device_id sun6i_dsi_of_table[] = { - { .compatible = "allwinner,sun6i-a31-mipi-dsi" }, - { } + { + .compatible = "allwinner,sun6i-a31-mipi-dsi", + .data = &sun6i_a31_dsi, + }, + { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table); diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index dbbc5b3ecbda..597b62227019 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -20,6 +20,10 @@ struct sun6i_dphy { struct reset_control *reset; }; +struct sun6i_dsi_variant { + bool has_mod_clk; +}; + struct sun6i_dsi { struct drm_connector connector; struct drm_encoder encoder; @@ -35,6 +39,7 @@ struct sun6i_dsi { struct sun4i_drv *drv; struct mipi_dsi_device *device; struct drm_panel *panel; + const struct sun6i_dsi_variant *variant; }; static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) From patchwork Tue Nov 13 11:16:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7500F1747 for ; Tue, 13 Nov 2018 11:17:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 64CE729A6B for ; Tue, 13 Nov 2018 11:17:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5645729A73; Tue, 13 Nov 2018 11:17:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0397A29A6B for ; Tue, 13 Nov 2018 11:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732589AbeKMVPA (ORCPT ); Tue, 13 Nov 2018 16:15:00 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:33602 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732554AbeKMVPA (ORCPT ); Tue, 13 Nov 2018 16:15:00 -0500 Received: by mail-pl1-f195.google.com with SMTP id w22-v6so5865246plk.0 for ; Tue, 13 Nov 2018 03:17:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XHVyHtVc0G3Kpp5cjsZwGbecU0Xlg/ozATiwaeVvdoQ=; b=VFv7HyjaAFJVaEpP0/tABHxGq9IG4jR4+I+ksUJUO56HgHnRyQwSzsCIK68DbCybw1 vIx4QZL+RqAdezl0G/qE/QDPM9XmIrkJoPA114b73R/wMKK+pw+RpJm3SzxUs4pxA1tB 6WtQSPm2Hlt2w49QSHNL4CJek4wA+aQVJ8Uu8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XHVyHtVc0G3Kpp5cjsZwGbecU0Xlg/ozATiwaeVvdoQ=; b=JmiFLHGKvvgTH77Pn+GkIOZQmfz5wBUFNVYZOFwdjS1K9XYx5IubM2FoQ/gOVigE51 gu/pHbklBl9NXIjyGNOlMcRu2gj/U8NWMlVpZRfGPygBvu1VtaRMWPNPO43fTJpnErCs eVo0Ssaie1N08WUtOTsMxCRaC/s8rOzJzp4JVQ+IyICG2Xh2hu83Tqz/3L0JcALjXWXg zIxcRLRDhpfy0rst2jXmh5x9TCS4UywjH5TDfy/dRRygLTd1l+eyWhvzVQTe7WCbRkhM x4Okf+V9YN1Dh5YcTCh0i2C2/SMfYGRPfCk0h6u97b+DbFYJWWzi9gASPZU0bXYqC1PK cpqg== X-Gm-Message-State: AGRZ1gJrL7jh3OnD3Pt64yE4wBQTyqo8BREldICVBg3NmJwFrtCzGdD2 GEcYhJFKZ3biGTIvKlsQeIGG0w== X-Google-Smtp-Source: AJdET5c/DumAFiebpmj/z+JBlCmyxGzrIbyf8IeI/aUzuNs2L2St6T79kpwLkVA0B9wa9RjOhBEHNw== X-Received: by 2002:a17:902:bf03:: with SMTP id bi3-v6mr4742841plb.288.1542107841544; Tue, 13 Nov 2018 03:17:21 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:20 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 05/26] drm/sun4i: sun6i_mipi_dsi: Add Allwinner A64 MIPI DSI support Date: Tue, 13 Nov 2018 16:46:12 +0530 Message-Id: <20181113111633.20189-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The MIPI DSI controller on Allwinner A64 is similar to Allwinner A31 without support of DSI mod clock(CLK_DSI_SCLK) So, alter has_mod_clk bool via driver data for respective SoC's compatible. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 561de393ea23..50f535ae57e9 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1120,11 +1120,18 @@ static const struct sun6i_dsi_variant sun6i_a31_dsi = { .has_mod_clk = true, }; +static const struct sun6i_dsi_variant sun50i_a64_dsi = { +}; + static const struct of_device_id sun6i_dsi_of_table[] = { { .compatible = "allwinner,sun6i-a31-mipi-dsi", .data = &sun6i_a31_dsi, }, + { + .compatible = "allwinner,sun50i-a64-mipi-dsi", + .data = &sun50i_a64_dsi, + }, { /* sentinel */ } }; MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table); From patchwork Tue Nov 13 11:16:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65D3514E2 for ; Tue, 13 Nov 2018 11:17:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 55C5729A6B for ; Tue, 13 Nov 2018 11:17:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4978929A79; Tue, 13 Nov 2018 11:17:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EC6D029A6D for ; Tue, 13 Nov 2018 11:17:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732459AbeKMVPG (ORCPT ); Tue, 13 Nov 2018 16:15:06 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:38384 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732585AbeKMVPG (ORCPT ); Tue, 13 Nov 2018 16:15:06 -0500 Received: by mail-pl1-f195.google.com with SMTP id p4-v6so5852267plo.5 for ; Tue, 13 Nov 2018 03:17:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/FobAdk1F/zKxxqm1vIJo/CC8EUNzQ/B2arqE/fLkis=; b=Lp6RzImk9zFDdByGIZQ22YEdQrE7uHU0DNLy4iGOCKR/rj7ThaKZsH/7WW5KOXEOnc 0uQom4DLJkIv4V+lflKspqub1Q9MD8DWs/lJmXtUb0AgySySGt8z/uR3H6pe5HNqHdiy ZUgFnTxQoVQDMjSRjgpzALwURivXeucMmPjAg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/FobAdk1F/zKxxqm1vIJo/CC8EUNzQ/B2arqE/fLkis=; b=pvN72BBxBhb0qRpc8kB1HOa36z7YzXvno4SuE6/3l5S/4lnGb4liT/5Xd5UszxBrpR QWXT+nRhYxDoM9ZuNyjQ0i87AfAPx+qdOzAxOsJqNJBE4YwhEYhCRECapqz5td6EyYpH j7/xwHLA3R8+prVIUc6FZz7lkT70q5zA65iK2VOJGg2Fwo4VSYK0mUAWGNsavNNQPh/G 2kUcxvG/McSZd1UK8R+YKZ/4p+agxbQkDNa9Gbm0Jjkrdd6cBPIiq7+cXX7Rq00/GAnv LMNx0MOkgdhctsTpcrXWVamzELbQUdMDl6ztljbqKe2XJdUGUaAWj7ifUFOxPYaDRFfQ S//Q== X-Gm-Message-State: AGRZ1gJxopoz/FkfIIB/PDFdDezQTurHFHDIZgNXR3UUbJGmJDExIWcP VCeQVcCHDShDKJKC5gF8MUGQ+g== X-Google-Smtp-Source: AJdET5fTaQ+FfQnyD51qgCEnp5Y3G48fpwTUV2horBazemheZqC9R97OWEihi14MAuMxJDHR4WTFeA== X-Received: by 2002:a17:902:c5:: with SMTP id a63-v6mr4683490pla.201.1542107847654; Tue, 13 Nov 2018 03:17:27 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:27 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 06/26] dt-bindings: sun6i-dsi: Add compatible for A64 MIPI DSI Date: Tue, 13 Nov 2018 16:46:13 +0530 Message-Id: <20181113111633.20189-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The MIPI DSI controller on Allwinner A64 is similar to Allwinner A31 without support of DSI mod clock. Signed-off-by: Jagan Teki Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt index 6a6cf5de08b0..9fa6e7a758ad 100644 --- a/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt +++ b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt @@ -12,6 +12,7 @@ The DSI Encoder generates the DSI signal from the TCON's. Required properties: - compatible: value must be one of: * allwinner,sun6i-a31-mipi-dsi + * allwinner,sun50i-a64-mipi-dsi - reg: base address and size of memory-mapped region - interrupts: interrupt associated to this IP - clocks: phandles to the clocks feeding the DSI encoder From patchwork Tue Nov 13 11:16:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680259 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17E6814E2 for ; Tue, 13 Nov 2018 11:17:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0896E29A6B for ; Tue, 13 Nov 2018 11:17:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFFFE29A73; Tue, 13 Nov 2018 11:17:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A4DAB29A6B for ; Tue, 13 Nov 2018 11:17:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732525AbeKMVPN (ORCPT ); Tue, 13 Nov 2018 16:15:13 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35696 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732630AbeKMVPM (ORCPT ); Tue, 13 Nov 2018 16:15:12 -0500 Received: by mail-pf1-f194.google.com with SMTP id v9-v6so5885943pff.2 for ; Tue, 13 Nov 2018 03:17:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0G2Cm6yl0hA4By0n3opJjvWD4CEYft0z/6JnEL+u5rs=; b=aSMmA1084sc9DatC+qE4VXG7awzpcfUKikd6oTWB7eyTrf9ODoQfuf5Etu96/qBcX+ 03cdvO1sw/9NzdFqX+8zsxaeFlk1p/LR1xaDuBsY93XKDyev69dUD3M20Adl0ZQDf0tn U+rNrxAt4RL65nJOm+HVo6d8qkSFnB/Wtqfow= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0G2Cm6yl0hA4By0n3opJjvWD4CEYft0z/6JnEL+u5rs=; b=mPW0CtpLrEMYn/Z/Jn4OF2AckXAElrwhTmTspw6ArqpZlykSL4DZgonA0ii7WRI62A Z/VhhIyUR7FmHOsXA5/ufPGVV3nPQKmxGAhtKGe/FrE0GrDFgCrEWNMc/RIPq3KGmHCi HqWL9OPJF2OfRZER0sdAf8lXRt2nNeP/4ud2jyp3PDernNGEKXK7hiX1MEnsPu6zVKUV HOVeNLx2ptCX/WrK/O2DXk7kCS/DfQySVFYo1XAfImT8Q49T/MEtxwvYVoEkqNNig2QC /9sg7lENud9l6nTFqaKUrgW24c6SpQ8TaA5ysPrbnZrf+dEQFw5PX5KR8E7ukbEnntlE 7ewg== X-Gm-Message-State: AGRZ1gK0Bx/F3TjDm/4ZK2XWtxgTncGn0M+pUXI2Ci6705GxS+hHjV+j Cq7lzgbV+4nPX6Pr5PMv7cwMkA== X-Google-Smtp-Source: AJdET5cDlT6XtMHcyOVsrWKniVoN+18C/4yHXDyddrOPtOPRhnF/dieOiDayun0A4sA6Bb/nn3JuPA== X-Received: by 2002:a62:3101:: with SMTP id x1-v6mr4852009pfx.204.1542107854069; Tue, 13 Nov 2018 03:17:34 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:33 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 07/26] drm/sun4i: sun6i_mipi_dsi: Add DSI Generic short write 2 param transfer Date: Tue, 13 Nov 2018 16:46:14 +0530 Message-Id: <20181113111633.20189-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Short transfer write support for DCS and Generic transfer types share similar way to process command sequence in DSI block so add generic write 2 param transfer type macro so-that the panels which are requesting similar transfer type may process properly. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 50f535ae57e9..cdd44a1307b3 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -871,6 +871,7 @@ static ssize_t sun6i_dsi_transfer(struct mipi_dsi_host *host, switch (msg->type) { case MIPI_DSI_DCS_SHORT_WRITE: case MIPI_DSI_DCS_SHORT_WRITE_PARAM: + case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM: ret = sun6i_dsi_dcs_write_short(dsi, msg); break; From patchwork Tue Nov 13 11:16:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680263 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 42E5614E2 for ; Tue, 13 Nov 2018 11:17:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3250029A6B for ; Tue, 13 Nov 2018 11:17:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 266B629A73; Tue, 13 Nov 2018 11:17:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C562729A6B for ; Tue, 13 Nov 2018 11:17:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732658AbeKMVPT (ORCPT ); Tue, 13 Nov 2018 16:15:19 -0500 Received: from mail-pg1-f196.google.com ([209.85.215.196]:33008 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732657AbeKMVPT (ORCPT ); Tue, 13 Nov 2018 16:15:19 -0500 Received: by mail-pg1-f196.google.com with SMTP id z11so2909992pgu.0 for ; Tue, 13 Nov 2018 03:17:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rCYzhNJFb/CoGYAKzI3iqrtOUmQxW0PESvSyXzaqWC0=; b=etDac7bqHT32dF8RDX2MwDIBVJA/i0V11AP17F+Ht2+YiDq0pYU76iV+/vj9hlp+ds 8UdgzwRLq/ALedbrmvbMt5CLvl2vtjd3ffOUDwBGtsgKDcqhaQm2xDmFlvT5Vnjo81jn HKa2rq2zQpGB37h1+IWwjwkI+y8zjmIPk3uXs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rCYzhNJFb/CoGYAKzI3iqrtOUmQxW0PESvSyXzaqWC0=; b=OFq4oIZcKho+rqy/iplCfQqkmQRhdVT+ZGnAZDgBC8thBLgEIrMOVOiJEhq7jpdShj PVuwxwxexj6jxVapFWjiXRPBQZio3x2rIVUsKhKFzpw2naSts4Is7+QpCmiOSXyFrOwA aZE5ZOr1+YKuEYRq1N2E4M5GGvScz76Nq7i6cBimr2Q3f/BXRQNOs4xxFNKn4y7a054X kXcLyzQCfiClXOvDKdI6P9LH2p1JcZZ96etNp6z8D7w7F13yxgXaaLzH/m1W7pKg0Y6E MW6E4dRrQr7cdChDM3+IR72T+GnPvfWcDJGQj/4n4qgj76VxQEMc0H/qUIRW4talabaQ qsoQ== X-Gm-Message-State: AGRZ1gLoDCwGcwy3uwp3kfTz5Z7FOkkNtPL5/2MOoCDYT7i2AlxTQIml UWmhM8ylO9Z/30YAifVuG/BrRQ== X-Google-Smtp-Source: AJdET5fd6Ak8LnYIZTmTLiUWQkzpPt2VdM1kigR9OO35gNyARjAjey0ihqVua4K4gaL4ztKryT4wkg== X-Received: by 2002:a62:380e:: with SMTP id f14-v6mr4662628pfa.203.1542107860438; Tue, 13 Nov 2018 03:17:40 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:39 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 08/26] drm/sun4i: sun6i_mipi_dsi: Fix VBP size calculation Date: Tue, 13 Nov 2018 16:46:15 +0530 Message-Id: <20181113111633.20189-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The horizontal and vertical back porch calculation in BSP code is simply following the Linux drm comment diagram, in include/drm/drm_modes.h which is [hv]back porch = [hv]total - [hv]sync_end BSP code form BPI-M64-bsp is calculating vertical back porch as (from linux-sunxi/drivers/video/sunxi/disp2/disp/de/disp_lcd.c) timmings->ver_sync_time= panel_info->lcd_vspw; timmings->ver_back_porch= panel_info->lcd_vbp-panel_info->lcd_vspw; vbp = panel->lcd_vbp; vspw = panel->lcd_vspw; dsi_dev[sel]->dsi_basic_size0.bits.vbp = vbp-vspw; dsi_dev[sel]->dsi_basic_size0.bits.vbp = panel->lcd_vbp - panel->lcd_vspw; => timmings->ver_back_porch + panel_info->lcd_vspw - panel_info->lcd_vspw => timmings->ver_back_porch => mode->vtotal - mode->end Which evatually same as mode->vtotal - mode->vsync_end so update the same in SUN6I_DSI_BASIC_SIZE0_VBP On the information note, existing SUN6I_DSI_BASIC_SIZE0_VSA is proper value. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index cdd44a1307b3..eeea977604ac 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -526,8 +526,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, regmap_write(dsi->regs, SUN6I_DSI_BASIC_SIZE0_REG, SUN6I_DSI_BASIC_SIZE0_VSA(mode->vsync_end - mode->vsync_start) | - SUN6I_DSI_BASIC_SIZE0_VBP(mode->vsync_start - - mode->vdisplay)); + SUN6I_DSI_BASIC_SIZE0_VBP(mode->vtotal - + mode->vsync_end)); regmap_write(dsi->regs, SUN6I_DSI_BASIC_SIZE1_REG, SUN6I_DSI_BASIC_SIZE1_VACT(mode->vdisplay) | From patchwork Tue Nov 13 11:16:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 841A813BF for ; Tue, 13 Nov 2018 11:17:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 73A7529A6B for ; Tue, 13 Nov 2018 11:17:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 676FF29A73; Tue, 13 Nov 2018 11:17:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F332F29A6B for ; Tue, 13 Nov 2018 11:17:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732721AbeKMVPc (ORCPT ); Tue, 13 Nov 2018 16:15:32 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37267 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732683AbeKMVPZ (ORCPT ); Tue, 13 Nov 2018 16:15:25 -0500 Received: by mail-pf1-f195.google.com with SMTP id u3-v6so3203931pfm.4 for ; Tue, 13 Nov 2018 03:17:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P7xZtqhtyLeCo2JvRyz6iw0Lru8qOAi+ZigmyrveCcU=; b=NdohmiLlSkoZU7Pzu7EoT+xyfs525WMqHYtleWbiEdZFZ1GATwXlfcGC90RJWZ5kwb w2EXCRbbCqznsVVXsab5wiw0n8Z9t711nNCvvRfyahH41P24/DgeZduvUTAlxXU85tw2 5qBx8/DLB//dgneadmMZXbi9sEZHGbC/yr8Vk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P7xZtqhtyLeCo2JvRyz6iw0Lru8qOAi+ZigmyrveCcU=; b=CPrdoW3Fw66oZxVfK2sGhBJn+X7sI4Fo9p70Uf4j2RrqLk/3IkwaKjYwugpOhxKZn2 3jIhzYU5vhdMD26F4UiEg5l+Pa0osB9nHsA4AxTxmphLb89mKQRs8qhxsryGoUUxy9Wt /xg+z8tjRQ61gZKMvsk1uOyRBwKw4bOEulpRUjY7ou2tdmQQdg0lH7OwjRGrsyRm+wy6 5fDQTkpnm1PBz8TffTUeIbSJVOs0Ai+4qFYdg7DPob92hmErpqw5MSh6zWT1G7WJ0CT9 RAkYD7bmwIdHwarBejyXRL3+mQYFBQbhSgpQLaUc6IdWuV99Z93iQPkYhlQ6Yp/jxRsh iHaQ== X-Gm-Message-State: AGRZ1gKJebN+8pQJ4dty3+0f9CeKbJ3okeXAz6dM9KIMTsUCTLoRtLIO gYELayXGdBfLH4W5gyotgUSXEA== X-Google-Smtp-Source: AJdET5d7bo5xPOLc4beVgRh49IcW0C5gyV1OcsOSQF9PK3wCiSAKHP0magBN9Xl7LmfHgj2oXkUFRA== X-Received: by 2002:a62:9f42:: with SMTP id g63-v6mr4692347pfe.144.1542107866653; Tue, 13 Nov 2018 03:17:46 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:46 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 09/26] drm/sun4i: sun6i_mipi_dsi: Fix TCON DRQ set bits Date: Tue, 13 Nov 2018 16:46:16 +0530 Message-Id: <20181113111633.20189-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP TCON DRQ set bits for non-burst DSI mode can computed via horizontal front porch instead of front porch + sync timings. BSP code form BPI-M64-bsp is computing TCON DRQ set bits for non-burts as (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) => panel->lcd_ht - panel->lcd_x - panel->lcd_hbp => (timmings->hor_front_porch + panel->lcd_hbp + panel->lcd_x) - panel->lcd_x - panel->hbp => timmings->hor_front_porch => mode->hsync_start - mode->hdisplay So, update the DRQ set bits accordingly. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index eeea977604ac..fc4252d96c38 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -367,9 +367,9 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, struct mipi_dsi_device *device = dsi->device; u32 val = 0; - if ((mode->hsync_end - mode->hdisplay) > 20) { + if ((mode->hsync_start - mode->hdisplay) > 20) { /* Maaaaaagic */ - u16 drq = (mode->hsync_end - mode->hdisplay) - 20; + u16 drq = (mode->hsync_start - mode->hdisplay) - 20; drq *= mipi_dsi_pixel_format_to_bpp(device->format); drq /= 32; From patchwork Tue Nov 13 11:16:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680275 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CDCF513BF for ; Tue, 13 Nov 2018 11:18:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD39C29A73 for ; Tue, 13 Nov 2018 11:18:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0C9A29A9D; Tue, 13 Nov 2018 11:18:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADE1629A73 for ; Tue, 13 Nov 2018 11:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732709AbeKMVPc (ORCPT ); Tue, 13 Nov 2018 16:15:32 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:42732 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732711AbeKMVPb (ORCPT ); Tue, 13 Nov 2018 16:15:31 -0500 Received: by mail-pl1-f193.google.com with SMTP id x21-v6so3132274pln.9 for ; Tue, 13 Nov 2018 03:17:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=BB0oFzbyBv5R7z1uYdcQbXYHZO2ke8Q0JSzmYAAJZWqmBU7W5Tqu/qJ7oju5yLh+M0 BTgV76I3UqbTdBHAm6BjcOzNihrwYjRHiwEmhnLY77udO6WGyS3Ex0jEM+Ha0K21l5bw cMEldJXuCOXLShiEljxcKqsYpiIALUufk/jAk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2wK0OObhLhsS0pPHJTLpMNcuasLFqviyg6C5I9uXCbM=; b=YfuysOgSexzaNjMz+TVnH9q5I6R0wru5V6G+/kavr26rPGVDUB8wfag+YRHSnOS+f+ 3REVBHKE+ksCO8DbndiFk5pK8k6oFu9HhdfBYL3GGQlz9DHODtvX8tGaB+IRfwgVl4qP vpc146WyHYfFMM35Wnb+QSWdT6nEfy87OUdHCM+yDKgMRaGdkepJ8emplnTqqk4ZcGWR Zampaj3wrCMhM74bQElnvLd5hI7L/KzWjZfZ2Ua52b0JdTlNam9O3zF9t61GGrT7hOxT l54k3ZNiUkqMscnuV1qHsjlfDVi9Fn7Eo2l9IwNMv5ODKBM5bJj9IT7/jKMnT6PuswcY 3llA== X-Gm-Message-State: AGRZ1gIOcCftuqy8gogNYqYA4ef2j6YmpaGlv+TTHMxnDlrru0MGZFUu iy7fTRLctKc63Mp6PAN8WFjVVw== X-Google-Smtp-Source: AJdET5f+mrDZ5bDWWWhgJXCxIJAe+4fTOZKOyI/2QC3uHKEtUb3GM5vh0xIjgXuvGZyREvsF1uH0fQ== X-Received: by 2002:a17:902:b689:: with SMTP id c9-v6mr4796087pls.306.1542107873098; Tue, 13 Nov 2018 03:17:53 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:52 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 10/26] drm/sun4i: sun6i_mipi_dsi: Refactor vertical video start delay Date: Tue, 13 Nov 2018 16:46:17 +0530 Message-Id: <20181113111633.20189-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Video start delay can be computed by subtracting total vertical timing with front porch timing and with adding 1 delay line for TCON. BSP code form BPI-M64-bsp is computing video start delay as (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) u32 vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp; => (panel->lcd_vt) - panel->lcd_y - (panel->lcd_vbp) => (timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y) - panel->lcd_y - (panel->lcd_vbp) => timmings->ver_front_porch + panel->lcd_vbp + panel->lcd_y - panel->lcd_y - panel->lcd_vbp => timmings->ver_front_porch So, update the start delay computation accordingly. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index fc4252d96c38..f6e3df8d2490 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -358,7 +358,17 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { - return mode->vtotal - (mode->vsync_end - mode->vdisplay) + 1; + u32 vfp = mode->vsync_start - mode->vdisplay; + u32 start_delay; + + start_delay = mode->vtotal - vfp + 1; + if (start_delay > mode->vtotal) + start_delay -= mode->vtotal; + + if (!start_delay) + start_delay = 1; + + return start_delay; } static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, From patchwork Tue Nov 13 11:16:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 173C314E2 for ; Tue, 13 Nov 2018 11:18:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 05A3F29A6B for ; Tue, 13 Nov 2018 11:18:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC7F529A73; Tue, 13 Nov 2018 11:18:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8CDE629A6D for ; Tue, 13 Nov 2018 11:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732737AbeKMVPi (ORCPT ); Tue, 13 Nov 2018 16:15:38 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:35813 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732736AbeKMVPh (ORCPT ); Tue, 13 Nov 2018 16:15:37 -0500 Received: by mail-pl1-f194.google.com with SMTP id n4-v6so5858486plp.2 for ; Tue, 13 Nov 2018 03:17:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D5aorguBzgFaeno0vSryYlUmgZEQ0xASVydW10sQ7HQ=; b=H+CM64Jczyd+LORW/lL12eYfpWN3JDdI+Re9wVJiPhMeYsRaKt9+QRsF7kTrxS/xI4 Th7f+sxHCY6s4wWc5R6skD0IHvzCfHZz2/AJUqhHvfBrGRCvG8GeU8pDGC5CeKI4+FK/ elWmXUAt/MBX1MXhKzIA5d+R689b7HD0cIm+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=D5aorguBzgFaeno0vSryYlUmgZEQ0xASVydW10sQ7HQ=; b=b1/NpsF7kXXFJhbYcJhqNDOEMxkH/4pteFauEILv0AjPRwQIdxszbKRcrvk9Wq/bTJ sRuw9oWbxVzFqZaCD5s6+wrDKZ8dfT0GTo34L4kueC7zDX6jE0q+9gCH8tG4i9wkJ5ht U0Y7fMANiBPRi0rnxJh5ya0RI8FTBK2mCHSJrwuOeAwzSBOwia48V6jXKMwJ7D86nFqa EYZRatE780BlAeFWJkJAQf367Y/FKbDt+0iBrCmZSLTDQWa84B9REwIcG+lBWytcWeyu m8XqYcWbgCa2Cia5yygVmQK1Zz3khLFlvpg07i6Ehya2HbS4c747ISw2SDlDJbjyHdUN X+qg== X-Gm-Message-State: AGRZ1gJejJO1uU5whavBvW3j17f+b7KajvJ7Rg15mik4zGkTphFPUDP+ 3FVwfdNZHhep60zf3/5mkdww7Q== X-Google-Smtp-Source: AJdET5cTIzMDc08V05Z41yDOHL/XXmlckpZgqo3tzgOPa68Qrl2AJa6EG1UTbt02avvjpgvJgQxQ2g== X-Received: by 2002:a17:902:8a88:: with SMTP id p8-v6mr4582115plo.94.1542107879320; Tue, 13 Nov 2018 03:17:59 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:17:58 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 11/26] drm/sun4i: sun6i_mipi_dsi: Fix DSI hbp timing value Date: Tue, 13 Nov 2018 16:46:18 +0530 Message-Id: <20181113111633.20189-12-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current driver is calculating hbp maximum value by subtracting hsync_start with hdisplay which is front porch value, but the hbp refers to back porch. Back porch value is calculating by subtracting htotal with hsync_end as per drm_mode timings, and BSP code from BPI-M64-bsp is eventually following the same. BPI-M64-bsp is computing hbp as (in drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hbp = (hbp-hspw)*dsi_pixel_bits[format]/8 - (4+2); => (panel->lcd_hbp - timmings->hor_sync_time) => (timmings->hor_back_porch + timmings->hor_sync_time - timmings->hor_sync_time) => timmings->hor_back_porch => mode->htotal - mode->hsync_end So, update the MIPI-DSI hbp value accordingly. Tested on 2-lane, 4-lane DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index f6e3df8d2490..de0992052a90 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -482,7 +482,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, */ #define HBP_PACKET_OVERHEAD 6 hbp = max((unsigned int)HBP_PACKET_OVERHEAD, - (mode->hsync_start - mode->hdisplay) * Bpp - HBP_PACKET_OVERHEAD); + (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); /* * The frontporch is set using a blanking packet (4 bytes + From patchwork Tue Nov 13 11:16:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680269 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25A6B13BF for ; Tue, 13 Nov 2018 11:18:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 157A229A6B for ; Tue, 13 Nov 2018 11:18:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0916229A73; Tue, 13 Nov 2018 11:18:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BA4329A6B for ; Tue, 13 Nov 2018 11:18:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732765AbeKMVPo (ORCPT ); Tue, 13 Nov 2018 16:15:44 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37958 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732761AbeKMVPo (ORCPT ); Tue, 13 Nov 2018 16:15:44 -0500 Received: by mail-pf1-f195.google.com with SMTP id v76-v6so3054940pfa.5 for ; Tue, 13 Nov 2018 03:18:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WXeHiI0jTSc5wEU3J9SBtYcSgw6GuTxHUVUlo5pmyKk=; b=p3/0IBrO812eKj1R1+fv7pTnJ5BlZsDSp3Xty76yodWhSf0zNNIQV+aDpour9/S3v7 9Qh6ZwMkJik2siXMG4cUAylUmhjTkhqyLeY672rnkpg+oAW1yGakWzKkXNFgHothM/1x wqrFxa411CYZ3o9kpg8/G5QUQU66tWjK+kBHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WXeHiI0jTSc5wEU3J9SBtYcSgw6GuTxHUVUlo5pmyKk=; b=YKiOXChQ79gZUd4BxZGDYR1p1hbpkTZARvSx6Hes1ATgbL4jeZHDWsimu0FqSUwF0F 3b4nmFvNvSfzB8tyJQZkFLolTb0Hvu6L3ylrB+9w8RjbQMEuvD6swGg5PDmngFlW7iFl wbmgQtl6rUENmEqpWrZect1bHWqVGn/WWXxDGkwdZWKeZqXSxT5lyxHXIc1R7SBoJmvI ob92jaSg9BKVXo2Nim1bT86ybYLXRtzJYDS9awTfprkPRftP5t0vL2NYS4eqTM0elIK1 2aaZN7GuX8aaRQ5Yb76VkyehDY269gors2QhQ5UHa7roeId/YlSvWFkNOGs3x7dE0Zik Blig== X-Gm-Message-State: AGRZ1gLD9/TfkYYWEQmrEHW9nhsToZrGE+eNkZIB1pmLStCKpN/cFJd0 NHXXDCokJe6B/gsQiQrYFaZDXA== X-Google-Smtp-Source: AJdET5c5J5NcWM8pvY3YVB3gvLvx89Fw9LaZuo1pOtIkrkPRqUrf2SwgVQFH5WMzc/bki2dUopOW+w== X-Received: by 2002:a63:a16:: with SMTP id 22mr4382852pgk.318.1542107885602; Tue, 13 Nov 2018 03:18:05 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.17.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:05 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 12/26] drm/sun4i: sun6i_mipi_dsi: Fix DSI hblk timing calculation Date: Tue, 13 Nov 2018 16:46:19 +0530 Message-Id: <20181113111633.20189-13-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP hblk is adding line with all porch timing values, or timings values from htotal without sync time. Current driver is subtracting htotal with hsa, but the hsa is bounded with packet overhead. For real hblk calculation needed by subtracting htotal with back and front porch values and BSP code BPI-M64-bsp is eventually following the same. BPI-M64-bsp is computing hbp as (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); => (timmings->hor_total_time - timmings->hor_sync_time) => (mode->htotal - (mode->hsync_end - mode->hsync_start)) So, update the DSI hblk timing accordingly. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index de0992052a90..cd657ac4bdae 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -495,7 +495,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, /* * hblk seems to be the line + porches length. */ - hblk = mode->htotal * Bpp - hsa; + hblk = (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp; /* * And I'm not entirely sure what vblk is about. The driver in From patchwork Tue Nov 13 11:16:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 910D314E2 for ; Tue, 13 Nov 2018 11:18:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81F9929A6B for ; Tue, 13 Nov 2018 11:18:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 736B629A92; Tue, 13 Nov 2018 11:18:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B82329A6B for ; Tue, 13 Nov 2018 11:18:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732787AbeKMVPu (ORCPT ); Tue, 13 Nov 2018 16:15:50 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33057 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732762AbeKMVPu (ORCPT ); Tue, 13 Nov 2018 16:15:50 -0500 Received: by mail-pg1-f194.google.com with SMTP id z11so2910607pgu.0 for ; Tue, 13 Nov 2018 03:18:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jROG6UOjt8ak5A6N/TCD5RGHneXG5PcbkfCte5OCDJE=; b=LXQiTYVflyPz68NqHSTd3wz5D2x5gI+3PhqcDra3MGw0DkT17UbvZrk66pViGfiC9B GOMWxPd5ePBUmoH7U/lUANgAJS8we+wBGRDq24WwRJ6Tb9T1mrh8CYvuKwLqKYv4Zu+3 1S6P61wATkhCiHeoM5CrBF9FLYmmGkAz1azN4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jROG6UOjt8ak5A6N/TCD5RGHneXG5PcbkfCte5OCDJE=; b=dKLt4MbWfqzap15HlaNVdYSp7PAn1huTvhwaO/p5PXIahJS+al341aHoEjlR3G/tzk 4fEvJ3ObI1YYyZRf31ETvFH5FRdrvZpyU7VgRRL28nmMwuunMejtga6uSJRFgoIulOfB akSz5V6A8U79RZKNhGAYWvhqH5DDgeA+bueZ30Og0kUboWmkIMGDInFUTfAsDxkR9jCl TtANzgWU4pSdA0trCBm2eems19gfYVLm4ycvaRIUe6/ahiikfP9ezJlTpE6CCDw+naCb 8utdhv8/bs9nYg0wrF7ZVPfxhoDmWxmpUqclsCSJ5f5YPozWrJty4NvIDj04yq5lPEwK BZaw== X-Gm-Message-State: AGRZ1gK3yAztMsVklt7+RvnqhWCoioCo+kpm6zzQZ/5KV/sOhloj+EiJ O0plzffZgRlw6TEGgw6Fqurz9w== X-Google-Smtp-Source: AJdET5cb91fcvQbuJw5ySdoTmKHQBJBviUFXEGQXSzMxixvPh+JbeJWx95n0XPVVqY9oH1endkKtgg== X-Received: by 2002:a62:9f42:: with SMTP id g63-v6mr4693848pfe.144.1542107891914; Tue, 13 Nov 2018 03:18:11 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:11 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 13/26] drm/sun4i: sun6i_mipi_dsi: Add DSI hblk packet overhead Date: Tue, 13 Nov 2018 16:46:20 +0530 Message-Id: <20181113111633.20189-14-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add 10 bytes packet overhead for hblk where blank is set using a blanking packet like (4 bytes + 4 bytes + payload + 2 bytes) This is according to BSP code from BPI-M64-bsp (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); So, add 10 bytes packet overhead for DSI hblk. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index cd657ac4bdae..1a3cdd5b72a0 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -494,8 +494,13 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, /* * hblk seems to be the line + porches length. + * The blank is set using a blanking packet (4 bytes + 4 bytes + + * payload + 2 bytes). So minimal size is 10 bytes */ - hblk = (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp; +#define HBLK_PACKET_OVERHEAD 10 + hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, + (mode->htotal - (mode->hsync_end - mode->hsync_start)) * + Bpp - HBLK_PACKET_OVERHEAD); /* * And I'm not entirely sure what vblk is about. The driver in From patchwork Tue Nov 13 11:16:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6614E14E2 for ; Tue, 13 Nov 2018 11:18:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5333C29A6B for ; Tue, 13 Nov 2018 11:18:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 433DF29A73; Tue, 13 Nov 2018 11:18:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC10829A6B for ; Tue, 13 Nov 2018 11:18:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732814AbeKMVP5 (ORCPT ); Tue, 13 Nov 2018 16:15:57 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:41191 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732432AbeKMVP4 (ORCPT ); Tue, 13 Nov 2018 16:15:56 -0500 Received: by mail-pl1-f194.google.com with SMTP id p16-v6so5842329plr.8 for ; Tue, 13 Nov 2018 03:18:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y5PF+ZGgoffIRFFiAIPy5mU3TbDRA/z2eo11P9T0YNI=; b=jneNIuEv5or0LRXyR00yO91ezjvQhxMqVnleLvUvb0qMxNyG7xVaXRqtVmOLpeQ8y7 bM/uw98MojKBM5zVoHRwhs91BKOucHHDQa90ESFAlQNDH3U9BRF2f24ULc+h8U9eC0ut 7MrMG+wjGzZJpoAo/mTqqjh24Q0oiMiGgJAjE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y5PF+ZGgoffIRFFiAIPy5mU3TbDRA/z2eo11P9T0YNI=; b=LHfRhxQ+H5wm/Tf1y/fdNszcTR+GA+Ms1DRjIwF8fND5MALafZy5FSCLz362CWtdAD 4WS/WJUsyIuG/AvHX0ZlqhkPRRcK0OI4SctZGYiS0ZByKSh2zj+9cZSj8ZNJyM6ETP72 FKWxVzQIg2CUQwMdiV0mbDMDESzvfxdSnMMUGB4Nxi/wfW5tzJantLzV0BJC8yaSocWp yBlmXDfqmS6rpQpj5GkywTP1fL/FGhNOiGAO/q8WjY82p7wN/oE5cO6XZkIc2mqFl/oA 6+SGLhTyn4EHEWMPQv/M/FAPHELOKyzCZh97aRX5wXy2SS+2IqybG+OVmR+BolnJMfQA H26Q== X-Gm-Message-State: AGRZ1gLJw7z1ERJPEslT8e/+PTGQNaHsfBx8FWtydzYBWrvEWNRatPGN Pd6Y4r55M9EdzKjZj8IN72LeLQ== X-Google-Smtp-Source: AJdET5fl9EAyHLgxZVFheUocNrQY6STwhD2s/FM85M3Md5hDM5+9EYN+0fPkeAqE/mOqLUveOeLBdQ== X-Received: by 2002:a17:902:9681:: with SMTP id n1-v6mr4660594plp.126.1542107898182; Tue, 13 Nov 2018 03:18:18 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:17 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 14/26] drm/sun4i: sun6i_mipi_dsi: Fix DSI hfp timing value Date: Tue, 13 Nov 2018 16:46:21 +0530 Message-Id: <20181113111633.20189-15-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Current driver is calculating hfp maximum value by subtracting htotal with hsync_end which is front back value, but the hpp refers to front porch. Front porch value is calculating by subtracting hsync_start with hdisplay as per drm_mode timings, and BSP code from BPI-M64-bsp is eventually following the same. BPI-M64-bsp is computing hfp as (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hbp = (hbp-hspw)*dsi_pixel_bits[format]/8 - (4+2); dsi_hact = x * dsi_pixel_bits[format]/8; dsi_hblk = (ht-hspw)*dsi_pixel_bits[format]/8-(4+4+2); dsi_hfp = dsi_hblk - (4+dsi_hact+2) - (4+dsi_hbp+2); Example, u32 fmt = dsi_pixel_bits[format]/8; => ((ht-hspw)*fmt - 10) - (6 + x * fmt) - (6 + (hbp-hspw)*fmt - 6) => (ht - hspw - x - (hbp - hspw)) * fmt - 16 => (ht - x - hbp) * fmt - 16 => (ht - x - (timmings->hor_total_time - timmings->hor_front_porch - x) * fmt - 16 => (timmings->hor_total_time - x - timmings->hor_total_time + timmings->hor_front_porch + x) * fmt - 16 => timmings->hor_front_porch * fmt - 16 So, update the DSI hfp timing accordingly. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 1a3cdd5b72a0..63b924b89bd7 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -490,7 +490,8 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, */ #define HFP_PACKET_OVERHEAD 6 hfp = max((unsigned int)HFP_PACKET_OVERHEAD, - (mode->htotal - mode->hsync_end) * Bpp - HFP_PACKET_OVERHEAD); + (mode->hsync_start - mode->hdisplay) * Bpp - + HFP_PACKET_OVERHEAD); /* * hblk seems to be the line + porches length. From patchwork Tue Nov 13 11:16:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680291 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D304514E2 for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C259C297DD for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B5C3429822; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59717297DD for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732456AbeKMVQE (ORCPT ); Tue, 13 Nov 2018 16:16:04 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:42911 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732430AbeKMVQD (ORCPT ); Tue, 13 Nov 2018 16:16:03 -0500 Received: by mail-pg1-f193.google.com with SMTP id d72so2099706pga.9 for ; Tue, 13 Nov 2018 03:18:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KiNNAL5FNd2IGkoW7kve11vnz/CEWnCQcGVfDy5CmDU=; b=oqoD/W7vMonGUOH7jryCGWFxxLuL2hJXGRp68F8je6O2iyl8WOX187F0TSWv86bOvy HMvMWNDDjMuEgEEQS1iI5wIuQjlITCzQH1SMVGHzL3IHM+3ABfjqh5P4/6bxOx3H+eRu nZJn+pyvQSLQntbqnY51w32jkD9zGvo06EVIc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KiNNAL5FNd2IGkoW7kve11vnz/CEWnCQcGVfDy5CmDU=; b=V42eUP0MgROdU79xmFo8JJ7heKyc+9yksXub+Nb28HEIt22wMTzhuBX49F6nmKTkB8 pUialDGS9iKcDzZ1QsttRpTpRgIhbyMs6NJsF/3jzJ48MrV7CRiZYOlpRAbyEpks6hqq faszKNRR72Xd0wRnru28EiUamWbF6ck8MsMqeiTJItxDJkfi2V4lxj4fenG9btEg+ZWC 4nvCpE42PWH4iWg8P83xLjahqaBJeZ/Ef3piZfJ2SYye2w8dUk0yIHfvdHBYDCMUCLf+ Toxv2BVkczBM73WgLMe3rWtqPijOwex65mfLH2sCpdKl2OWiwv6E0OWWiNNKHFtw5J9S 1RIQ== X-Gm-Message-State: AGRZ1gKSr0Xrd4nnR/Wl4pA7D5A84UKMctj7bXr0rVcox7PkNdQlH43j K7x5Bfo8m+QBDD94W1UZ09jjmg== X-Google-Smtp-Source: AJdET5fxwmbnpRiHRLvlzdbDPt8wJDBKu18uNDB5dVMb8m8vNdS/K2Bz+hxnyOIAB/e0lbZCxnAjaQ== X-Received: by 2002:a62:8647:: with SMTP id x68-v6mr4951565pfd.252.1542107904617; Tue, 13 Nov 2018 03:18:24 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:24 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 15/26] drm/sun4i: sun6i_mipi_dsi: Set proper vblk timing calculation Date: Tue, 13 Nov 2018 16:46:22 +0530 Message-Id: <20181113111633.20189-16-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Unlike hblk, the vblk timings should follow an equation to compute the desired value for lane 4 devices and rest of devices it would be 0. BSP code from BPI-M64-bsp is computing vblk as for 4-lane devices (from linux-sunxi drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) tmp = (ht*dsi_pixel_bits[format]/8)*vt-(4+dsi_hblk+2); dsi_vblk = (lane-tmp%lane); So, update the vblk timing calculation accordingly. Tested on 2-lane, 4-lane MIPI-DSI LCD panels. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 32 ++++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 63b924b89bd7..703722f7c81b 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -355,6 +355,30 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, SUN6I_DSI_INST_JUMP_CFG_NUM(1)); }; +static u16 sun6i_dsi_get_timings_vblk(struct sun6i_dsi *dsi, + struct drm_display_mode *mode, u16 hblk) +{ + struct mipi_dsi_device *device = dsi->device; + u16 vblk = 0; + + /* + * The vertical blank is set using a blanking packet (4 bytes + + * payload + 2 bytes). Its minimal size is therefore 6 bytes + */ +#define VBLK_PACKET_OVERHEAD 6 + if (device->lanes == 4) { + unsigned int Bpp; + int tmp; + + Bpp = mipi_dsi_pixel_format_to_bpp(device->format) / 8; + tmp = (mode->htotal * Bpp) * mode->vtotal - + (hblk + VBLK_PACKET_OVERHEAD); + vblk = (device->lanes - tmp % device->lanes); + } + + return vblk; +} + static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { @@ -503,13 +527,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, (mode->htotal - (mode->hsync_end - mode->hsync_start)) * Bpp - HBLK_PACKET_OVERHEAD); - /* - * And I'm not entirely sure what vblk is about. The driver in - * Allwinner BSP is using a rather convoluted calculation - * there only for 4 lanes. However, using 0 (the !4 lanes - * case) even with a 4 lanes screen seems to work... - */ - vblk = 0; + vblk = sun6i_dsi_get_timings_vblk(dsi, mode, hblk); /* How many bytes do we need to send all payloads? */ bytes = max_t(size_t, max(max(hfp, hblk), max(hsa, hbp)), vblk); From patchwork Tue Nov 13 11:16:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680281 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 85CA013BF for ; Tue, 13 Nov 2018 11:18:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7633D28A05 for ; Tue, 13 Nov 2018 11:18:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68615297AE; Tue, 13 Nov 2018 11:18:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D24B328A05 for ; Tue, 13 Nov 2018 11:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732494AbeKMVQK (ORCPT ); Tue, 13 Nov 2018 16:16:10 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:35796 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732462AbeKMVQJ (ORCPT ); Tue, 13 Nov 2018 16:16:09 -0500 Received: by mail-pf1-f194.google.com with SMTP id v9-v6so5887196pff.2 for ; Tue, 13 Nov 2018 03:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=hIlJQVhVUdQcaqiwZ8zMD9S/GTPcfU6bGult6R0AmcVzWlMLUbeG3105tQrLOAYyXU yuu/MRK3A+caQcXCMNfAzdWQ0xzQGCaAVnjXCU0bdc47FRKo2002zGOEXkYBrjtmS5Vi S0683JP7LD80DGI7FN52fsFhJT4RBqaH7Qp4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OkLnvoOX4ZeeFgDP21cZlyAYt8eoNNgptp85ozSuxkM=; b=OcL+kfPW7qiHgsAnQ4zEe8o0hAqilrXNjuvykKnms935Hky9q4fErXuQXekJ9ghJ7a Uhhr9R9Ses0GGb0P7sC7673o2sqCTM1B/phQo0yMyWrxuNb02D3fb0m+Xh331Gbyju++ jBzmL3GPJiONRFGsfySChV+wNyuyTVxE/j01qYXMwL2IC6e2+MYsX5eUzCFKWop7QF8/ 6wQkQd2yKSz0WE3VQ3KPTpcJgqacLb24fEl7EcdqfL5U8pMpkyQ9oLDB3CkDxHPtHM0v SUzayGtE8knKN+jcam1IpYYjO3axywh4Mmte+/6uj5bNBW+F0QaOwsp19VtMkwfGhoRy 8WHw== X-Gm-Message-State: AGRZ1gJ0nnZyWv1ySfb0UB+VKrZQBGBVLOLYNZHxMKvzM3Gp92QHiawd 91GJhXzlroK3s+fbQRIb+tAtlQ== X-Google-Smtp-Source: AJdET5e4RQjmGf7Y5LCHGUZh9GSy6Fvzs9Y4bDH3tpboGx83iiu0Jce0FHPu48sC2J1+B+Be+HoBMA== X-Received: by 2002:a63:dd55:: with SMTP id g21mr4294702pgj.86.1542107910969; Tue, 13 Nov 2018 03:18:30 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:30 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 16/26] drm/sun4i: sun6i_mipi_dsi: Add support for VCC-DSI voltage regulator Date: Tue, 13 Nov 2018 16:46:23 +0530 Message-Id: <20181113111633.20189-17-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some boards have VCC-DSI pin connected to voltage regulator which may not be turned on by default. Add support for such boards by adding voltage regulator handling code to MIPI DSI driver. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 ++++++++++++++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 703722f7c81b..2ea33db61ae1 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1026,6 +1026,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev) return PTR_ERR(base); } + dsi->regulator = devm_regulator_get(dev, "vcc-dsi"); + if (IS_ERR(dsi->regulator)) { + dev_err(dev, "Couldn't get VCC-DSI supply\n"); + return PTR_ERR(dsi->regulator); + } + dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base, &sun6i_dsi_regmap_config); if (IS_ERR(dsi->regs)) { @@ -1107,6 +1113,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev) static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev) { struct sun6i_dsi *dsi = dev_get_drvdata(dev); + int err; + + err = regulator_enable(dsi->regulator); + if (err) { + dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err); + return err; + } reset_control_deassert(dsi->reset); if (dsi->variant->has_mod_clk) @@ -1141,6 +1154,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev) if (dsi->variant->has_mod_clk) clk_disable_unprepare(dsi->mod_clk); reset_control_assert(dsi->reset); + regulator_disable(dsi->regulator); return 0; } diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 597b62227019..0df60f84bab3 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -13,6 +13,8 @@ #include #include +#include + struct sun6i_dphy { struct clk *bus_clk; struct clk *mod_clk; @@ -32,6 +34,7 @@ struct sun6i_dsi { struct clk *bus_clk; struct clk *mod_clk; struct regmap *regs; + struct regulator *regulator; struct reset_control *reset; struct sun6i_dphy *dphy; From patchwork Tue Nov 13 11:16:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8FF81747 for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A07329800 for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DDDA29822; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 386A8297D8 for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732454AbeKMVQQ (ORCPT ); Tue, 13 Nov 2018 16:16:16 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:34858 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732517AbeKMVQQ (ORCPT ); Tue, 13 Nov 2018 16:16:16 -0500 Received: by mail-pl1-f195.google.com with SMTP id n4-v6so5859275plp.2 for ; Tue, 13 Nov 2018 03:18:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zfLa7sOo1lPPoVacUZ5Wanit4VpAlBcSuHBOx71Xco4=; b=Rs6xvWDNKx/2kr5ZDh/eLGXdZ7x8iZcX497FqxPOSjkZHI2He0DEYAQvKpMvFtUAtN fpLnj8F8Z/d9WA98jr2PexIoAjJnOtD8X2AHodTeaBwXsaMtZL8bQUaLGdCN7Qc/teVJ zzNd/g19/v6JVTnR97ln19D553AyUdmslsDMA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zfLa7sOo1lPPoVacUZ5Wanit4VpAlBcSuHBOx71Xco4=; b=MPdyqA6J+PAwyUfNNQyEUGuC7fj8R25inzgHh4pDqgMseJQHhzkaVSd3eltZ0MgdI8 ckAQM6MdJqmmcuSwY2Y+sHKfS1ZMVU9wBPn5iZe8BYc0TVoBbwgjRyZgW4xdITSgMKDH TU5202I044J+1yfzRD8Hm/GyKe01jDxcEL4lSsZAtOxed2UYlmIwzDXc2eASfPa93fN9 jSYGXiHAuFhidDuKKWdSSaB00+QHVPqERb27k2DURp3n8hq43rqOljbyHh51P9i1zB93 fWBV1PQjM8OAttTiBm6e32iGsLEFwu2DyEBi2+2JwTwkAykyWDxo2jnKymi2D/KnCSXu snXg== X-Gm-Message-State: AGRZ1gLTcaS6hc8RpTdshh9gZtHSIp5CS6RVLVQW+5O3qMsrxJVCksMZ tvMJ5HmRNGqZ5y2wnbD7z0/V7g== X-Google-Smtp-Source: AJdET5fWCIG/PUktT+gP9Mmm+M3x5yd8MyWqp6NN4xZFCdugq5/WFQYO+nejiwyaDMX4n3VL12WXyw== X-Received: by 2002:a17:902:7d89:: with SMTP id a9mr4191221plm.242.1542107917482; Tue, 13 Nov 2018 03:18:37 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:36 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 17/26] dt-bindings: sun6i-dsi: Add VCC-DSI supply property Date: Tue, 13 Nov 2018 16:46:24 +0530 Message-Id: <20181113111633.20189-18-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Most of the Allwinner MIPI DSI controllers are supply with VCC-DSI pin. which need to supply for some of the boards to trigger the power. So, document the supply property so-that the required board can eable it via device tree. Signed-off-by: Jagan Teki Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt index 9fa6e7a758ad..adc7cdf129dd 100644 --- a/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt +++ b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt @@ -28,6 +28,9 @@ Required properties: first port should be the input endpoint, usually coming from the associated TCON. +Optional properties: + - vcc-dsi-supply: the VCC-DSI power supply of the DSI encoder + Any MIPI-DSI device attached to this should be described according to the bindings defined in ../mipi-dsi-bus.txt From patchwork Tue Nov 13 11:16:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680287 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 304C713BF for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1E0C729454 for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1218C297AE; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A85B429454 for ; Tue, 13 Nov 2018 11:18:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732462AbeKMVQX (ORCPT ); Tue, 13 Nov 2018 16:16:23 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36115 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732873AbeKMVQW (ORCPT ); Tue, 13 Nov 2018 16:16:22 -0500 Received: by mail-pg1-f195.google.com with SMTP id z17-v6so5546112pgv.3 for ; Tue, 13 Nov 2018 03:18:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bezu7kJZ0Njo2tp9TTb/Vi97QjlcQqipnPzN/MWROLI=; b=dAqS7a6ocybtD8nrw1Axf8g9rZo4v1m5pFASPnJnrgZGsrdIwbOWDXEPnW3izMQSee IXtyXDQYiX2wwxVnc92mT1+eBA+QDFkISWYoPwYNjpPZ/Y8GMTsFUAyyCdBUYHfQ+m36 jGb2Psr1ymojpM7Wm0IXnzDnuI2Q6FGQSF7e0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bezu7kJZ0Njo2tp9TTb/Vi97QjlcQqipnPzN/MWROLI=; b=ZQRnhjMeJC2ik29UWQPdJPFPjQu6G8QXqUN6nz245/7HGlDOczbS8LzLXfPtQWLDqz egWFGXpL7TEOPVPDLeiohLWgcjQLsu7OsRX6zbV0dCcABw6EOTIdZB3S0EWbZFlY/MZW C8LrknAsr7WoqzAG9kMm8U79jE6muhBpMySZrtiCBvyWjh3j+4sAaLE1iNSwcMkJuwuf cCayLNvpcU+wR5oGJ3xPi0id5uf6tdr5bnYMXAx6Bm8Gzouw6Nd0w99aNMJCyH3KgXje D01Xk0ERSCzjbJNBe7iGosYdNBpbTWjAyZmJyqnWsQRu5djjAZo49iRCW0jKIAki9ubb lEMA== X-Gm-Message-State: AGRZ1gLa1VGnZo73aX5YiUl6ggOIJXHZ1zA6sRcl37fSDzelk9oWvjfB CYTVH2coFyDxa7sVDe+PxAyIjA== X-Google-Smtp-Source: AJdET5dLcpR4r1ZiXsuc5sWpJUAicNgYqjYRYQhgVTHlMZ4e7mGSt7n/tj7HdJI4t8H9yiejkK1N+Q== X-Received: by 2002:a63:310:: with SMTP id 16mr4255308pgd.79.1542107923736; Tue, 13 Nov 2018 03:18:43 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:43 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 18/26] dt-bindings: panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge Date: Tue, 13 Nov 2018 16:46:25 +0530 Message-Id: <20181113111633.20189-19-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Bananapi S070WV20-CT16 ICN6211 is 800x480, 4-lane MIPI-DSI to RGB bridge panel, which is available on same PCB with 24-bit RGB interface. So, this patch adds DSI specific binding details on existing dt-bindings file. Signed-off-by: Jagan Teki Reviewed-by: Rob Herring --- .../display/panel/bananapi,s070wv20-ct16.txt | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/panel/bananapi,s070wv20-ct16.txt b/Documentation/devicetree/bindings/display/panel/bananapi,s070wv20-ct16.txt index 35bc0c839f49..b7855dc7c66f 100644 --- a/Documentation/devicetree/bindings/display/panel/bananapi,s070wv20-ct16.txt +++ b/Documentation/devicetree/bindings/display/panel/bananapi,s070wv20-ct16.txt @@ -1,12 +1,39 @@ Banana Pi 7" (S070WV20-CT16) TFT LCD Panel +S070WV20-CT16 is 7" 800x480 panel connected through a 24-bit RGB interface. + +Depending on the variant, the PCB attached to the panel module either +supports DSI, or DSI + 24-bit RGB. DSI is converted to 24-bit RGB via +an onboard ICN6211 MIPI DSI - RGB bridge chip, then fed to the panel +itself + Required properties: -- compatible: should be "bananapi,s070wv20-ct16" +- compatible: + for 24-bit RGB interface, use "bananapi,s070wv20-ct16" + for ICN6211 MIPI-DSI to RGB bridge, use "bananapi,s070wv20-ct16-icn6211" + +Required properties for RGB: - power-supply: see ./panel-common.txt +Required properties for MIPI-DSI to RGB: +- reg: for DSI virtual channel used by that screen +- avdd-supply: analog regulator dc1 switch +- dvdd-supply: 3v3 digital regulator +- reset-gpios: a GPIO phandle for the reset pin + Optional properties: -- enable-gpios: see ./simple-panel.txt +- enable-gpios: see ./simple-panel.txt(not available in MIPI-DSI to RGB bridge) - backlight: see ./simple-panel.txt This binding is compatible with the simple-panel binding, which is specified in ./simple-panel.txt. + +Example: +panel@0 { + compatible = "bananapi,s070wv20-ct16-icn6211"; + reg = <0>; + avdd-supply = <®_dc1sw>; + dvdd-supply = <®_dldo1>; + reset-gpios = <&pio 3 6 GPIO_ACTIVE_HIGH>; /* PD6 */ + backlight = <&backlight_dsi>; +}; From patchwork Tue Nov 13 11:16:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680293 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8A43814E2 for ; Tue, 13 Nov 2018 11:18:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78DE5297D8 for ; Tue, 13 Nov 2018 11:18:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6CF6C29800; Tue, 13 Nov 2018 11:18:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90951297D8 for ; Tue, 13 Nov 2018 11:18:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732561AbeKMVQ3 (ORCPT ); Tue, 13 Nov 2018 16:16:29 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:35827 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732569AbeKMVQ3 (ORCPT ); Tue, 13 Nov 2018 16:16:29 -0500 Received: by mail-pf1-f195.google.com with SMTP id v9-v6so5887604pff.2 for ; Tue, 13 Nov 2018 03:18:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uqavFIRIxYiGdmCcvcWKFKbD5Oh0DSLWrDMSyCnH8ME=; b=D87dF98TsJpwntoHLiLEfQyogdv/sXKWtCK+j51yOqWz/bv9Lu5KgodHIFzZU7Wg3l zrq+2qBjOBCPze7tsoxB71DgkSAceQ7NVIQUakX32eBYcTKKdfbyQRVH9ZXftMFLmqFH dFTi28citfULfF5eQexJG2G1YtVSDWze8EkHA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uqavFIRIxYiGdmCcvcWKFKbD5Oh0DSLWrDMSyCnH8ME=; b=f4XH1gHhZvzJFOU92veFs4jettP2ULs4/Wfjx+LpAlHYaIZBl0wC/Q8wnFgCUYD04x p1a66zxOMtL1NE4xvmoozu3JVTvu8k2u738gNRMZzo4PYw1YVZjpQbhfXVxH4Qz0WIcc wTSRU8NZwksyntf27MfWzDEEg7axOQu8/EBxMTjB8vThrOaZPHyk21nmwEmSWrXzQEcj /qP5hzDlLf5Giiefemu6Pm8BxtxcslsnjXebttQ2inxRyJnHtyHxLeNmmHLxZisj0MNB GKHdeAfAeagM6JNS3uGlpGnpG/GpRVZqr9OLy7+fh0KC6mQeAeq0+huWu5uGbkAfTYML Chdw== X-Gm-Message-State: AGRZ1gLN6AlUi7OoYMf6ASbds+QZuWVc3CvrQxzU1+okPHF2OXqMYWAL h5iPJXX9BWGqVgW4jzVjIOC8Bg== X-Google-Smtp-Source: AJdET5f7RapWe43YkiB5Yl18yozf4AVZVNMklZOLMuT5AevTddZS0Jwl0VOrV/CNy97lneDn6XQMJQ== X-Received: by 2002:a65:6542:: with SMTP id a2mr4342538pgw.389.1542107930065; Tue, 13 Nov 2018 03:18:50 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:49 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 19/26] drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge Date: Tue, 13 Nov 2018 16:46:26 +0530 Message-Id: <20181113111633.20189-20-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Bananapi S070WV20-CT16 ICN6211 is 800x480, 4-lane MIPI-DSI to RGB bridge panel which can be used to connect via DSI port on BPI-M64 board, so add a driver for it. The same panel PCB comes with parallel RBG which is supported via panel-simple driver with "bananapi,s070wv20-ct16" compatible. BSP dclock of 30MHz is not working with existing sunxi-ng and sun4i sun4i_dclk_recalc, so updated to 55MHz can result proper working nkm dividers. Signed-off-by: Jagan Teki --- MAINTAINERS | 6 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + .../panel/panel-bananapi-s070wv20-icn6211.c | 298 ++++++++++++++++++ 4 files changed, 314 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c diff --git a/MAINTAINERS b/MAINTAINERS index a25549205cc1..f5bb2ffa1089 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4601,6 +4601,12 @@ M: Dave Airlie S: Odd Fixes F: drivers/gpu/drm/ast/ +DRM DRIVER FOR BANANAPI S070WV20-CT16 ICN6211 MIPI-DSI TO RGB PANELS +M: Jagan Teki +S: Maintained +F: drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c +F: Documentation/devicetree/bindings/display/panel/bananapi,s070wv20-ct16.txt + DRM DRIVER FOR BOCHS VIRTUAL GPU M: Gerd Hoffmann L: virtualization@lists.linux-foundation.org diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 6020c30a33b3..20b88c275421 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -17,6 +17,15 @@ config DRM_PANEL_ARM_VERSATILE reference designs. The panel is detected using special registers in the Versatile family syscon registers. +config DRM_PANEL_BANANAPI_S070WV20_ICN6211 + tristate "Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge panel driver" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y if you want to enable support for panels based on the + Bananapi S070WV20-CT16 MIPI-DSI controller. + config DRM_PANEL_LVDS tristate "Generic LVDS panel driver" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 5ccaaa9d13af..04696bb85218 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o +obj-$(CONFIG_DRM_PANEL_BANANAPI_S070WV20_ICN6211) += panel-bananapi-s070wv20-icn6211.o obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o diff --git a/drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c b/drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c new file mode 100644 index 000000000000..10174495a6c8 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c @@ -0,0 +1,298 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Amarula Solutions + * Author: Jagan Teki + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +struct s070wv20 { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + + struct backlight_device *backlight; + struct regulator *dvdd; + struct regulator *avdd; + struct gpio_desc *reset; +}; + +static inline struct s070wv20 *panel_to_s070wv20(struct drm_panel *panel) +{ + return container_of(panel, struct s070wv20, panel); +} + +struct s070wv20_init_cmd { + size_t len; + const char *data; +}; + +#define S070WV20_INIT_CMD(...) { \ + .len = sizeof((char[]){__VA_ARGS__}), \ + .data = (char[]){__VA_ARGS__} } + +static const struct s070wv20_init_cmd s070wv20_init_cmds[] = { + S070WV20_INIT_CMD(0x7A, 0xC1), + S070WV20_INIT_CMD(0x20, 0x20), + S070WV20_INIT_CMD(0x21, 0xE0), + S070WV20_INIT_CMD(0x22, 0x13), + S070WV20_INIT_CMD(0x23, 0x28), + S070WV20_INIT_CMD(0x24, 0x30), + S070WV20_INIT_CMD(0x25, 0x28), + S070WV20_INIT_CMD(0x26, 0x00), + S070WV20_INIT_CMD(0x27, 0x0D), + S070WV20_INIT_CMD(0x28, 0x03), + S070WV20_INIT_CMD(0x29, 0x1D), + S070WV20_INIT_CMD(0x34, 0x80), + S070WV20_INIT_CMD(0x36, 0x28), + S070WV20_INIT_CMD(0xB5, 0xA0), + S070WV20_INIT_CMD(0x5C, 0xFF), + S070WV20_INIT_CMD(0x2A, 0x01), + S070WV20_INIT_CMD(0x56, 0x92), + S070WV20_INIT_CMD(0x6B, 0x71), + S070WV20_INIT_CMD(0x69, 0x2B), + S070WV20_INIT_CMD(0x10, 0x40), + S070WV20_INIT_CMD(0x11, 0x98), + S070WV20_INIT_CMD(0xB6, 0x20), + S070WV20_INIT_CMD(0x51, 0x20), + S070WV20_INIT_CMD(0x09, 0x10), +}; + +static int s070wv20_prepare(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + struct mipi_dsi_device *dsi = ctx->dsi; + unsigned int i; + int ret; + + msleep(50); + + gpiod_set_value(ctx->reset, 1); + msleep(50); + + gpiod_set_value(ctx->reset, 0); + msleep(50); + + gpiod_set_value(ctx->reset, 1); + msleep(20); + + for (i = 0; i < ARRAY_SIZE(s070wv20_init_cmds); i++) { + const struct s070wv20_init_cmd *cmd = &s070wv20_init_cmds[i]; + + ret = mipi_dsi_generic_write(dsi, cmd->data, cmd->len); + if (ret < 0) + return ret; + + msleep(10); + } + + return 0; +} + +static int s070wv20_enable(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + + msleep(120); + + mipi_dsi_dcs_set_display_on(ctx->dsi); + backlight_enable(ctx->backlight); + + return 0; +} + +static int s070wv20_disable(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + + backlight_disable(ctx->backlight); + return mipi_dsi_dcs_set_display_on(ctx->dsi); +} + +static int s070wv20_unprepare(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + int ret; + + ret = mipi_dsi_dcs_set_display_off(ctx->dsi); + if (ret < 0) + dev_err(panel->dev, "failed to set display off: %d\n", ret); + + ret = mipi_dsi_dcs_enter_sleep_mode(ctx->dsi); + if (ret < 0) + dev_err(panel->dev, "failed to enter sleep mode: %d\n", ret); + + msleep(100); + + regulator_disable(ctx->avdd); + + regulator_disable(ctx->dvdd); + + gpiod_set_value(ctx->reset, 0); + + gpiod_set_value(ctx->reset, 1); + + gpiod_set_value(ctx->reset, 0); + + return 0; +} + +static const struct drm_display_mode s070wv20_default_mode = { + .clock = 55000, + .vrefresh = 60, + + .hdisplay = 800, + .hsync_start = 800 + 40, + .hsync_end = 800 + 40 + 48, + .htotal = 800 + 40 + 48 + 40, + + .vdisplay = 480, + .vsync_start = 480 + 13, + .vsync_end = 480 + 13 + 3, + .vtotal = 480 + 13 + 3 + 29, + + .width_mm = 86, + .height_mm = 154, +}; + +static int s070wv20_get_modes(struct drm_panel *panel) +{ + struct drm_connector *connector = panel->connector; + struct s070wv20 *ctx = panel_to_s070wv20(panel); + struct drm_display_mode *mode; + + mode = drm_mode_duplicate(panel->drm, &s070wv20_default_mode); + if (!mode) { + dev_err(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n", + s070wv20_default_mode.hdisplay, + s070wv20_default_mode.vdisplay, + s070wv20_default_mode.vrefresh); + return -ENOMEM; + } + + drm_mode_set_name(mode); + + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; + drm_mode_probed_add(connector, mode); + + panel->connector->display_info.width_mm = mode->width_mm; + panel->connector->display_info.height_mm = mode->height_mm; + + return 1; +} + +static const struct drm_panel_funcs s070wv20_funcs = { + .disable = s070wv20_disable, + .unprepare = s070wv20_unprepare, + .prepare = s070wv20_prepare, + .enable = s070wv20_enable, + .get_modes = s070wv20_get_modes, +}; + +static int s070wv20_dsi_probe(struct mipi_dsi_device *dsi) +{ + struct device_node *np; + struct s070wv20 *ctx; + int ret; + + ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + mipi_dsi_set_drvdata(dsi, ctx); + ctx->dsi = dsi; + + drm_panel_init(&ctx->panel); + ctx->panel.dev = &dsi->dev; + ctx->panel.funcs = &s070wv20_funcs; + + ctx->dvdd = devm_regulator_get(&dsi->dev, "dvdd"); + if (IS_ERR(ctx->dvdd)) { + dev_err(&dsi->dev, "Couldn't get dvdd regulator\n"); + return PTR_ERR(ctx->dvdd); + } + + ctx->avdd = devm_regulator_get(&dsi->dev, "avdd"); + if (IS_ERR(ctx->avdd)) { + dev_err(&dsi->dev, "Couldn't get avdd regulator\n"); + return PTR_ERR(ctx->avdd); + } + + ret = regulator_enable(ctx->dvdd); + if (ret) + return ret; + + msleep(5); + + ret = regulator_enable(ctx->avdd); + if (ret) + return ret; + + msleep(5); + + ctx->reset = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(ctx->reset)) { + dev_err(&dsi->dev, "Couldn't get our reset GPIO\n"); + return PTR_ERR(ctx->reset); + } + + np = of_parse_phandle(dsi->dev.of_node, "backlight", 0); + if (np) { + ctx->backlight = of_find_backlight_by_node(np); + of_node_put(np); + + if (!ctx->backlight) + return -EPROBE_DEFER; + } + + ret = drm_panel_add(&ctx->panel); + if (ret < 0) + return ret; + + dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE; + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->lanes = 4; + + return mipi_dsi_attach(dsi); +} + +static int s070wv20_dsi_remove(struct mipi_dsi_device *dsi) +{ + struct s070wv20 *ctx = mipi_dsi_get_drvdata(dsi); + + mipi_dsi_detach(dsi); + drm_panel_remove(&ctx->panel); + + if (ctx->backlight) + put_device(&ctx->backlight->dev); + + return 0; +} + +static const struct of_device_id s070wv20_of_match[] = { + { .compatible = "bananapi,s070wv20-ct16-icn6211", }, + { } +}; +MODULE_DEVICE_TABLE(of, s070wv20_of_match); + +static struct mipi_dsi_driver s070wv20_driver = { + .probe = s070wv20_dsi_probe, + .remove = s070wv20_dsi_remove, + .driver = { + .name = "bananapi-s070wv20-ct16-icn6211", + .of_match_table = s070wv20_of_match, + }, +}; +module_mipi_dsi_driver(s070wv20_driver); + +MODULE_AUTHOR("Jagan Teki "); +MODULE_DESCRIPTION("Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB"); +MODULE_LICENSE("GPL v2"); From patchwork Tue Nov 13 11:16:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680295 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5261013BF for ; Tue, 13 Nov 2018 11:19:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 41A1E2A30B for ; Tue, 13 Nov 2018 11:19:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3511D2A347; Tue, 13 Nov 2018 11:19:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCB2B2A30B for ; Tue, 13 Nov 2018 11:19:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732515AbeKMVQf (ORCPT ); Tue, 13 Nov 2018 16:16:35 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:42833 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732545AbeKMVQf (ORCPT ); Tue, 13 Nov 2018 16:16:35 -0500 Received: by mail-pl1-f195.google.com with SMTP id x21-v6so3133590pln.9 for ; Tue, 13 Nov 2018 03:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ARbx+KiDqhCi74+cAhwo58RvKAVcTpf7hF3ar2UJsU4=; b=JHQCKb3ouLpMhros5NSlW2hLMj3imUXO9M715UlGt/sId7BEZJ0g/b7lgE3V43hI/d 1tt0/kx0360VXsJk0OXfLrsg4LqquqQb1HFKoTBqlYM/5HVBCkpi9feuFAe/0v9z/YSg f/3Hmns1/suSl2ZVahLERdC0Cw2/xg/2qU4Sk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ARbx+KiDqhCi74+cAhwo58RvKAVcTpf7hF3ar2UJsU4=; b=oEXfTdhVoNYkGnwQuv4/dG3iREOLgja+UpPdW02vYdQS7rBnc3cwIztpmyho8D5teP o3E6zvPEuenZSXVMmHsTltAki4FLh6t0k9gbNH7A9wkGckzBSFnJ+trXO7RTgTAHmjVI NP0oQ2dysvbf1dCtNlFQTkLmzFoGmHZoRjyLZkDEtL/QABSAbEiWKCx8tavkEbZSWdy9 EPOAk3y1yF+6meKJ+tkbXBj+LMXxDsxY09KVvYty8+ootfYD2DH9TAT3/4NkS/EL1mE2 c8WL62ivcfrJpwoR28mD0ghC5YJBDcd2UmCs3IS/I8sE0iLZpqvRtpXqjU4TnFen/erC i/HA== X-Gm-Message-State: AGRZ1gJFkPfjPWEo3ctyIMqOQ4O4zjN052Z8LqH6fO/C/1+oY+myZm0w 9lSidVvqN5DIOZr+25kckeI1uQ== X-Google-Smtp-Source: AJdET5c8qnTkL3Bax9dwaHakX90eiDYy3C8cReHGRejspZd7oWDtEXwkZRExiCjw+pmGt9mKg94TNw== X-Received: by 2002:a17:902:b18c:: with SMTP id s12-v6mr4589153plr.16.1542107936124; Tue, 13 Nov 2018 03:18:56 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:18:55 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 20/26] dt-bindings: panel: Add Techstar TS8550B MIPI-DSI panel Date: Tue, 13 Nov 2018 16:46:27 +0530 Message-Id: <20181113111633.20189-21-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Techstar TS8550B MIPI DSI panel is 480x854, 2-lane MIPI DSI LCD panel. Add dt-bingings for it. Signed-off-by: Jagan Teki Reviewed-by: Rob Herring --- .../display/panel/techstar,ts8550b.txt | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Documentation/devicetree/bindings/display/panel/techstar,ts8550b.txt diff --git a/Documentation/devicetree/bindings/display/panel/techstar,ts8550b.txt b/Documentation/devicetree/bindings/display/panel/techstar,ts8550b.txt new file mode 100644 index 000000000000..9d3056dd8bf9 --- /dev/null +++ b/Documentation/devicetree/bindings/display/panel/techstar,ts8550b.txt @@ -0,0 +1,22 @@ +Techstar TS8550B MIPI-DSI LCD Panel + +Techstar TS8550B MIPI DSI panel is 480x854, 2-lane MIPI DSI LCD panel. + +Required properties: +- compatible: must be "techstar,ts8550b" +- reg: DSI virtual channel used by that screen +- avdd-supply: analog regulator dc1 switch +- dvdd-supply: 3v3 digital regulator +- reset-gpios: a GPIO phandle for the reset pin + +Optional properties: +- backlight: phandle for the backlight control. + +panel@0 { + compatible = "techstar,ts8550b"; + reg = <0>; + avdd-supply = <®_dc1sw>; + dvdd-supply = <®_dldo2>; + reset-gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */ + backlight = <&backlight>; +}; From patchwork Tue Nov 13 11:16:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10680297 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8D7013BF for ; Tue, 13 Nov 2018 11:19:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C4D062A31D for ; Tue, 13 Nov 2018 11:19:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8EFC2A355; Tue, 13 Nov 2018 11:19:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE6AC2A31D for ; Tue, 13 Nov 2018 11:19:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732934AbeKMVQm (ORCPT ); Tue, 13 Nov 2018 16:16:42 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39288 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732587AbeKMVQm (ORCPT ); Tue, 13 Nov 2018 16:16:42 -0500 Received: by mail-pf1-f194.google.com with SMTP id c72so1202099pfc.6 for ; Tue, 13 Nov 2018 03:19:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1ffbMwrT3Fv3KeJlLSZWFa/jJG9NP1xOyiBOskUUsgI=; b=fuO6h+ixQjrhdbyBkgp6clmVFxWuL0Zv/XlgTVnIofHvMWU0tSIcsfXargH3iUcr/R 0o8g2TP52ghFOHAK1JNooeU4eAQJaPAfqx867dVheY1sDieW/SWx7nHe/SC/MlAam1Wt /caqzX1hRhqgcPz5IBDlLJCRpxvOokMgkuygM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1ffbMwrT3Fv3KeJlLSZWFa/jJG9NP1xOyiBOskUUsgI=; b=ADTAwVpbRQ2h4kT/FHXsRCQGtq7PvR76LWxpcOMrkQsAavh+wPqq0EO4sFzbE6dhPP JgDVTv5Q1M2aAhuIMvzPTN+fUMBVVWsuSubLEc7VIp8ULuKXYJv19ldcCcdmsb9RqLI9 /Jne1gEn9VtLbTG+UaRD1iij4mLMo+Xg3/eVkoodzqFG/4A9CaGadH9BzbMuoi0wtbHR N+2A2Pn3RMnozOCwuJCtBScZQVBBz914sHERMny7rLVTIi0nF8RPw7zPlqKGOLl5T3UP rVfoaebR5aUOcVnpKPt6uaEcuq7RYqpXqjqU8WSk8/7+4SYL1QsN0PKMjIoNeDptndge fMTg== X-Gm-Message-State: AGRZ1gL2PKy0xONKzRlUCZmmw6Dv8RqIcBWF6fKm6WtRkDXj/BIYQ/G4 SEt16Nvr5XKpDfoKch5hfvqnZA== X-Google-Smtp-Source: AJdET5fKeVVA7FH0K3ycrVJkWoc/SudOwAyW0Zs5W0CvJ0YJ0X8l4mkCY/EWUorlk8nTGwlr0NO2rw== X-Received: by 2002:a62:3101:: with SMTP id x1-v6mr4857394pfx.204.1542107942470; Tue, 13 Nov 2018 03:19:02 -0800 (PST) Received: from localhost.localdomain ([2401:4900:3670:3f11:bc71:2ef7:4a39:e260]) by smtp.gmail.com with ESMTPSA id 27-v6sm28531377pfm.36.2018.11.13.03.18.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Nov 2018 03:19:01 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Cc: Jagan Teki Subject: [PATCH v4 21/26] drm/panel: Add Techstar TS8550B MIPI-DSI LCD panel Date: Tue, 13 Nov 2018 16:46:28 +0530 Message-Id: <20181113111633.20189-22-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181113111633.20189-1-jagan@amarulasolutions.com> References: <20181113111633.20189-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Techstar TS8550B MIPI DSI panel is 480x854, 2-lane MIPI DSI LCD panel. Add panel driver for it. Signed-off-by: Jagan Teki --- MAINTAINERS | 6 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + .../gpu/drm/panel/panel-techstar-ts8550b.c | 324 ++++++++++++++++++ 4 files changed, 340 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-techstar-ts8550b.c diff --git a/MAINTAINERS b/MAINTAINERS index f5bb2ffa1089..3dac08d0b3cb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4718,6 +4718,12 @@ S: Maintained F: drivers/gpu/drm/tinydrm/st7735r.c F: Documentation/devicetree/bindings/display/sitronix,st7735r.txt +DRM DRIVER FOR TECHSTAR TS8550B MIPI-DSI LCD PANELS +M: Jagan Teki +S: Maintained +F: drivers/gpu/drm/panel/panel-techstar-ts8550b.c +F: Documentation/devicetree/bindings/display/panel/techstar,ts8550b.txt + DRM DRIVER FOR TDFX VIDEO CARDS S: Orphan / Obsolete F: drivers/gpu/drm/tdfx/ diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index 20b88c275421..d0d4e60f5153 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -195,4 +195,13 @@ config DRM_PANEL_SITRONIX_ST7789V Say Y here if you want to enable support for the Sitronix ST7789V controller for 240x320 LCD panels +config DRM_PANEL_TECHSTAR_TS8550B + tristate "Techstar TS8550B MIPI-DSI panel driver" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y if you want to enable support for panels based on the + Techstar TS8550B MIPI-DSI interface. + endmenu diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 04696bb85218..88011f06edb8 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -20,3 +20,4 @@ obj-$(CONFIG_DRM_PANEL_SEIKO_43WVF1G) += panel-seiko-43wvf1g.o obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o +obj-$(CONFIG_DRM_PANEL_TECHSTAR_TS8550B) += panel-techstar-ts8550b.o diff --git a/drivers/gpu/drm/panel/panel-techstar-ts8550b.c b/drivers/gpu/drm/panel/panel-techstar-ts8550b.c new file mode 100644 index 000000000000..70a5f8ec6908 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-techstar-ts8550b.c @@ -0,0 +1,324 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019, Amarula Solutions. + * Author: Jagan Teki + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +#include