From patchwork Mon Mar 11 13:36:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10847515 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 D6DD7139A for ; Mon, 11 Mar 2019 13:37:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAB1A2919F for ; Mon, 11 Mar 2019 13:37:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE13F291E9; Mon, 11 Mar 2019 13:37:46 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 35AB72919F for ; Mon, 11 Mar 2019 13:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GzFkHAbblqawmeO2m42v2o2uwSQhffpACDGI8GWY4LU=; b=bVQB8uLnwgwQyw 7VEMYCJecOSNpLLWk0G/Jath6JUECWy7J3DwYd+FF9t37dk/AoDbPqJiLd88SOaDXfxOliMn10gAP 1pAVo2nRPDfMb/IgS2kRw8KhjynGvyHqE5ai/CDZmBQRUTF0dCKcxatUrs8V5OUVnCEKqWzgvVI7u STlZXPKJR8c75khxQbBtZSRkz5oRcZ1VxNsHtCqxTHLvbooz2KSM9C/ONQqpiuCIQ5c6JZdReyjt3 MbdTiN+IPUuzCB71DvrTyxH9Q1d6bGoFJQ5ygUo83+HkfpENFa88A7uSRVrWZCjKvmDImz7nafv2v 6sDJyYNeD73Zv2720T9A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3L7b-0005Fj-At; Mon, 11 Mar 2019 13:37:39 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h3L7I-0004nv-69 for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2019 13:37:26 +0000 Received: by mail-pg1-x542.google.com with SMTP id m2so4063745pgl.5 for ; Mon, 11 Mar 2019 06:37:20 -0700 (PDT) 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=/ET2SANK/wHVq0QXTm2x4G8KkMw/va+BLQnLjopmn8Q=; b=GE40YkM+ZtlVQujTvvWvz08Y0k50Gs4IFQSnWhXytWqhMAQvtUTh851ppkbGr3m7Tn Nj8IteZ6gBkbX3BN/RPEs/iDiD62mXrsqzEK983QlGLrpXODx8LQh18hCbwVjyZtGQVC pn0h6vOSoVPIClJDZYYeRojApw/n4+Oj7iwOI= 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=/ET2SANK/wHVq0QXTm2x4G8KkMw/va+BLQnLjopmn8Q=; b=uBA/RcWI5Izp/2nMqPMm0vHcLXeR7oMEqy1dMdixcF65vaMdCKtO2aPrW2RmjErziQ kM2nhTad67lKS3iJlkKeLRmPzVyBnALQB0v8SuHknFTRccZ0pJ7vBuHn9/zoqFKiAl3D yBtLbFsDnCLorQJC+YP7gZA+NiA2v1cXtIkppwcfUSUmXWcLFTgGCNW5pnX9yGBhio9+ VsrikoavdWB/WU0IeLexR5k6h+4rWWUqmjbEbiBFO0IylFgJ9OaB9sA+N5Vut5d8qiR5 cFQDR8bQcfJNDq2um8I5GYyHkKWASeuw0kvM/UEXDPJIHMBjACHGvRrdXG7VOCC/rUgJ UEiw== X-Gm-Message-State: APjAAAUw6J6EMHparPvydNJ5I/0CsCFfYOZHcR3RNf7MMD1H/eeCF5zi jT/8aDCcy92E2ORzqTxa0EeTOw== X-Google-Smtp-Source: APXvYqwhenf7qGpkwbdKLmXya+DJF9KRSA/4ff40kcLVV9BisaDGzvPeZllZF+e0BN1f6mu538eh/Q== X-Received: by 2002:aa7:8847:: with SMTP id k7mr32426578pfo.99.1552311439648; Mon, 11 Mar 2019 06:37:19 -0700 (PDT) Received: from localhost.localdomain ([183.82.224.199]) by smtp.gmail.com with ESMTPSA id s79sm9960397pfa.61.2019.03.11.06.37.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Mar 2019 06:37:18 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , Michael Turquette , Rob Herring , Mark Rutland Subject: [PATCH v8 02/15] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes Date: Mon, 11 Mar 2019 19:06:24 +0530 Message-Id: <20190311133637.18334-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190311133637.18334-1-jagan@amarulasolutions.com> References: <20190311133637.18334-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190311_063720_281628_C719F039 X-CRM114-Status: GOOD ( 14.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@googlegroups.com, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller. TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate. The current code allows the TCON clock divider to have a default 4 for min, max ranges that would fail to compute the desired pll-mipi rate while supporting new panels. So, add the computation logic 'format/lanes' to dclk min and max dividers and instead of default 4. This computation logic align with Allwinner A64 BSP, hoping that would work even for A33. Tested this on 4 different DSI panels. Signed-off-by: Jagan Teki Tested-by: Merlijn Wajer --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e75f77ff8e0f..339f9b1f5745 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -341,8 +341,8 @@ static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon *tcon, u32 block_space, start_delay; u32 tcon_div; - tcon->dclk_min_div = SUN6I_DSI_TCON_DIV; - tcon->dclk_max_div = SUN6I_DSI_TCON_DIV; + tcon->dclk_min_div = bpp/lanes; + tcon->dclk_max_div = bpp/lanes; sun4i_tcon0_mode_set_common(tcon, mode);