From patchwork Mon May 20 09:03:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 424 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 804473F36B for ; Mon, 20 May 2019 11:07:51 +0200 (CEST) Received: by mail-pf1-f199.google.com with SMTP id c7sf9539302pfp.14 for ; Mon, 20 May 2019 02:07:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1558343270; cv=pass; d=google.com; s=arc-20160816; b=bvTu+N8S7T+LnY4AucyoQeE1imGraPg95ZrBPcSE4BgeOAZ+ja3mNddjPu28q4Id28 rjdJfl8UDpPjNI18TGKggEhfravgyU6kOW1weDdXSEXFy/+2VyX1k6aAqnYNqjkbz83G NSOUfhcL3zMXPR4L29zSV4MbWA5VHzEjcozDhjzUda5AJmisaUuYqvrtb7TQUmJkQLkt WP+yUp4VkTfiXqlWQq/ZUTB5HuhSb9ZE9nCSAVPt7wQ+0vjBUypFO0giS98nJd3pQDA4 XU1aEYhRUrO0kqRFnrxSWwkeQ2aAxDzD8L756BTy2hnt7Viv3rj9GslYoxCzxr7yCieL KmwA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TRrA+QLSOVtxQZf8ClABpH1Nv8ibguJl94X0bMJW5Uw=; b=l+hkMAljyXmm3Ry8qycCWXVtYCWnnMv4csFiC3h6S2OUImyvQ2BvMT/VUlqMSTJdGP dH9kKkII+1AMJR2XwryCOl39N4WUs/9Sy3kb2HHCzSpRA0j3TmjAFIRdVdbYQBeefEzG ROZ3RHTaoWr2g26o0w4S8ipNqx5HGpp6D4OXmm71KcbCPh6D0YLSRjbGfR61Fg5OFuyP TmKN/SM2hh1ukFyIZ+t2kAyWicXLahsSf1xZ3Rf5qKG03S2Owc5MWDsu7VELXtBin/kz MuCF8aFYa+1wUWJaJI//lsdis11vlkcqWvHlDgT+MlHZZbkmJY2fK2GiUZxgy+XYuzr0 wolg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=izXs0xnF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=TRrA+QLSOVtxQZf8ClABpH1Nv8ibguJl94X0bMJW5Uw=; b=kEUmYfBqBYQGlKNsk40qG0nANYtZzGQsODAMtg8tRxsH3MmBuBNHWQkp3ASJ8J/d5O Q3G30remIYR0emvC7evcOHE1qtdPWHBVYYO9bIZHh4QYEF4TV0Dcpn1Gzswo5ylfxWW9 8EwYNqlSOfwurwfhxXovwLkblcL08IsPT/Obo= 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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=TRrA+QLSOVtxQZf8ClABpH1Nv8ibguJl94X0bMJW5Uw=; b=kkATDqo5wxRZR0CFDTDyIfPkHeap8Mpq0467QTaon4T4EEUpwt1DyWwNsjKGOfRAFS ytsDrJVcdAdNtyA4KosvffOjIS77S1ZjrNW1QSEE0cVdF+Nv5BWj5BK3rtjfPmF6NLVI fVsGCfbzcCrri8nICUl9o9WiAH7i62KetCpRd/3ApHN7+61xszL63yXV0iGvvb8cc+2S 2SqwnOv+BbDFlhQD9kMObrTEjvS5EZoRNipSoZpe1ge2eQ8yEDHm0m6f5L0h0g4cHq2R nX1Din/FOAHRTh4ryvUnjV+E/Tgw5jfepHYQ7/CoYeJgQUaXLI/9IsORDV6YCPNqTlhV sBnA== X-Gm-Message-State: APjAAAX9u8RUjCHvb1eb/3IwoVhoDtbe1lrtKVjy1Ykc4gK0nqzqpe1I 1p8wj5MECGZd+BamVgy0Fe5J82iT X-Google-Smtp-Source: APXvYqwHDVJ4Kw3xedc49r3PrXK4HIEsJzLIqeXHI4wQ00OosG8p2BP+u6u2orlkXa2f5d5iFy+Qbg== X-Received: by 2002:a62:460a:: with SMTP id t10mr77655958pfa.3.1558343270363; Mon, 20 May 2019 02:07:50 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:1cc:: with SMTP id 195ls4112255pgb.2.gmail; Mon, 20 May 2019 02:07:50 -0700 (PDT) X-Received: by 2002:a65:5c4c:: with SMTP id v12mr29805182pgr.283.1558343269897; Mon, 20 May 2019 02:07:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558343269; cv=none; d=google.com; s=arc-20160816; b=v9CAO/nW+iPlSvJhvXFLpJaoTb5IWdmS/PlizZxl0ELP8fYhrc29CsQBVbuadMz88B PqNFtyzeW8W9LDGMmE6ug/DwHMNm7xa0ZfxVCT9Bjds76fUSzcNJ4RKF0BE+0NS8fcGN 3y1Rxy6or9z0bdtsAB4iReIJMGd29wH8BgXfTjUZgWu1nhmt948cWgzR7GP5z5Z2g5WW ZGBy1Or7SAu7nrtvlKRrdXt0qu4xRtXKjMVR1VkLNKYbxxxpKjS2tnUi5GklC0Iq7OyO XcNKVBO8FqOBd9sFUsvN8aPa+zwKk49fW3Lx4OFS1nnBViJd2t6okUMr7cTal8W2T/Ac DO5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=l8/eiiMRzRHMeJJfg+NtIFfqaA+aEUt7A5oo1QrAYME=; b=w+bTecO/gxoCX1RDocsu1fnORSaMYOFI5V06N+8Nq7Dtd7Rr+FDjyCDuz7LVC/Am3g l7UkRlyhg2qIsYxWSbtYjdHJC9vP01SlIQeS3kPpyYFBUzHGXiEDwNRv9k62HvCaB2GF nRWsbSXdLjQl3fvx6vG03PiyaajP5iypI3pVgkWD3xUsr7RxH0NRQ3xXi5oKt+YCZFKQ iNCXes6rRKpvH/ydC/mlq+cuWpu8A5NFOln4wcKvEq2RZ9V9+sax1t5z8e21kb3oLJSY LWYTbnBjyC1b/Pd0HMuPQqdFs3tnHOSqKx80xwF94+B/yxciBdu0Oxgzc9Xt+ldIhNAv iAkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=izXs0xnF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id y16sor18589939pfl.18.2019.05.20.02.07.49 for (Google Transport Security); Mon, 20 May 2019 02:07:49 -0700 (PDT) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a62:51c2:: with SMTP id f185mr18546991pfb.16.1558343269570; Mon, 20 May 2019 02:07:49 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:49 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: bshah@mykolab.com, Vasily Khoruzhick , powerpan@qq.com, michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v10 07/11] drm/sun4i: dsi: Get tcon0_div at runtime Date: Mon, 20 May 2019 14:33:14 +0530 Message-Id: <20190520090318.27570-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=izXs0xnF; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , tcon0 divider is used while computing drq edge0 for burst mode devices, currently driver is using default macro value 4 via SUN6I_DSI_TCON_DIV. Unfortunately not all the panel devices are working with this default divider value 4, so to make future changes on this divider value get the divider from tcon dot clock at runtime instead of static macro value. Tested-by: Merlijn Wajer Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 +++++++- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 1f9ed2642a47..5584e9c2f8bd 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -396,9 +396,15 @@ static u16 sun6i_dsi_get_drq_edge0(struct sun6i_dsi *dsi, struct drm_display_mode *mode, u16 line_num, u16 edge1) { + struct sun4i_tcon *tcon = dsi->tcon; + unsigned long dclk_rate, dclk_parent_rate, tcon0_div; u16 edge0 = edge1; - edge0 += (mode->hdisplay + 40) * SUN6I_DSI_TCON_DIV / 8; + dclk_rate = clk_get_rate(tcon->dclk); + dclk_parent_rate = clk_get_rate(clk_get_parent(tcon->dclk)); + tcon0_div = dclk_parent_rate / dclk_rate; + + edge0 += (mode->hdisplay + 40) * tcon0_div / 8; if (edge0 > line_num) return edge0 - line_num; diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index f2826e3ea165..156523859d82 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -13,8 +13,6 @@ #include #include -#define SUN6I_DSI_TCON_DIV 4 - struct sun6i_dsi { struct drm_connector connector; struct drm_encoder encoder;