From patchwork Fri Nov 16 16:39:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10686657 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 C56DD17EE for ; Fri, 16 Nov 2018 16:40:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AE0882CE5D for ; Fri, 16 Nov 2018 16:40:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E2A92CE5F; Fri, 16 Nov 2018 16:40:07 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 4BBEC2CE5D for ; Fri, 16 Nov 2018 16:40:07 +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=kSuUwj6LtjOUr8875kdGhUz/6HizPql99/sonSNJvo4=; b=O3BWEaExgrTq20 DDDK1WQjK8ceriOFF4/xLiu18YwQdZnisdwwPTjKxvkb8GeXRZQv6iSe2JuauXi7+uOOoBYdSC2Fk 1bpD8plMHeHUpsP+JS6Cvszi20P/zdY1jmiwzT2cYETraeF2j3Iw9HAITHNfeWMOWzyl5BgAxh1vP jqEmSnXsEnz4yfF/9/TtFjlwjbn+jAfhSt895N6UygG0jBb11h8CJhyCaIdFL/nRKQscmbmIfL/FU EhvCEwCKJSgk3A5IK9hSIzbkTnXUgWl5DBwwZUaLDnzwmM5JxK/+ZSIJDnIYyiIivCIBzBGAkF5XH odx8ZuIz0DHRdw1E6R7w==; 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 1gNhA5-0004EC-HQ; Fri, 16 Nov 2018 16:40:05 +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 1gNh9w-00044u-Ck for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 16:39:57 +0000 Received: by mail-pg1-x542.google.com with SMTP id z11so8198612pgu.0 for ; Fri, 16 Nov 2018 08:39:46 -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=BNh71MWK36UL5AiiDZH8rXZrXUHyz8v782txUp4gWBo=; b=EyK+bgba2nKC1fjjlPMoGoh3rWCCaVlfNzniff3qtyDy/F5fcG5UNiGhSt+KquITP5 HrLzPxe/dblMmZJEx/tXfffWYYwcUyVTkxU+2oP3XISss7EOPXhPy8K8Q7P+QkGNwWQg IU57wwgUMVoXDoTptSs7Jan+2pCze5RLWI/og= 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=BNh71MWK36UL5AiiDZH8rXZrXUHyz8v782txUp4gWBo=; b=MuUTvxGShnpGpSA8UsqMZW49IMvbHWUfgjfti/p0nH1VWbtj/UkZvKAFR42twt1ix+ XpETdNqzb3R2GPgtAxj9eCZy1LBHmBOLYiAKQquhhN92UbJORYC9rnIVjfPM3RyejmJx M095mN/A03eVtqjIq3bQuR/qQTZQSxLxbBJMMU0r6unsa/NkYCy1ycqUGYNx6IlZVYgf 6PCiAmMtci1ROwA9tb0SkSlbgQl1avcPi3e0h1YNiG9oqEpA8RK9HOHXt4jgd3KHMXGH ncFakQVAIbF19ph2x0xW457VkJqr0ZYRAPqxnv8GJBQiS7axs/eoqaMXJEr89UjvEzbs KeeQ== X-Gm-Message-State: AGRZ1gKa2JphNOQc2Brd4lsWGS4nDppP7f8cm9pYEUViWlq7zqM0p3yQ /4xQ4w86me1W3Av504zuTCPMTQ== X-Google-Smtp-Source: AJdET5eXHxZ4xM+LvjmyLiNlmboyuD3m+i7gdVcgcnEP2CoFH0019SgoW2JEETJUfUgvunQKG/QeIA== X-Received: by 2002:a62:2292:: with SMTP id p18mr8881397pfj.9.1542386385490; Fri, 16 Nov 2018 08:39:45 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id p5-v6sm34622213pfb.109.2018.11.16.08.39.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 08:39:44 -0800 (PST) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: [PATCH v2 01/12] drm/sun4i: sun6i_mipi_dsi: Compute burst mode loop N1 instruction delay Date: Fri, 16 Nov 2018 22:09:05 +0530 Message-Id: <20181116163916.29621-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181116163916.29621-1-jagan@amarulasolutions.com> References: <20181116163916.29621-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_083956_439814_77BED023 X-CRM114-Status: GOOD ( 14.68 ) 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: Jagan Teki 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 Loop N1 instruction delay for burst mode lcd panel are computed as per BSP code. Reference code is available in BSP (from linux-sunxi drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_dev[sel]->dsi_inst_loop_num.bits.loop_n1= (panel->lcd_ht-panel->lcd_x)*(150)/(panel->lcd_dclk_freq*8) - 50; => (((mode->htotal - mode->hdisplay) * 150) / ((mode->clock / 1000) * 8)) - 50; So use the similar computation for loop N1 delay. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index def145086a5c..43ab7127d428 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -379,6 +379,24 @@ static u16 sun6i_dsi_get_timings_vblk(struct sun6i_dsi *dsi, return vblk; } +static u16 sun6i_dsi_setup_inst_delay(struct sun6i_dsi *dsi, + struct drm_display_mode *mode) +{ + struct mipi_dsi_device *device = dsi->device; + u32 hsync_porch, dclk; + u16 delay; + + hsync_porch = (mode->htotal - mode->hdisplay); + dclk = (mode->clock / 1000); + + if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + delay = ((hsync_porch * 150) / (dclk * 8)) - 50; + else + delay = 50 - 1; + + return delay; +} + static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { @@ -418,7 +436,7 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, static void sun6i_dsi_setup_inst_loop(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { - u16 delay = 50 - 1; + u16 delay = sun6i_dsi_setup_inst_delay(dsi, mode); regmap_write(dsi->regs, SUN6I_DSI_INST_LOOP_NUM_REG(0), SUN6I_DSI_INST_LOOP_NUM_N0(50 - 1) | From patchwork Fri Nov 16 16:39:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10686659 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 1EDB03CF1 for ; Fri, 16 Nov 2018 16:40:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BC162CE5D for ; Fri, 16 Nov 2018 16:40:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2F422CE5F; Fri, 16 Nov 2018 16:40:21 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 A00E52CE5D for ; Fri, 16 Nov 2018 16:40:21 +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=RRbFRNtIoccDkpbGdijwV6bwbIFGKQ7ZDUrhnwnPErg=; b=JtSbfIAmT8WrSx t9WD0CsZTv2Q7RQjyXSUCiDa4hlWsvdzwGzv5GsSJ3arEC759+Fn7npKPTZBPQx02mOO2hldu0vTQ kqcbq4fgtBV57x/GhvNrdG38GGlUNqxeA/Bq73MlSeCGSOldyOq0Waxc04+osfxElDMgIynmR052C qP7cK7cCxco2A7slAMTaEKeUvknjxnEuRYx5JaIfOo/sEQZd3VwprVFEFxF52CL1Fp0jmjjIjgVFD SeUr5qABoBlsbyh42MRTgseo6DoPibfKpO5prRqXXq5jvcVDdnU9cws350pgzsVJDVkhd9Q7dVMPq ntv6/mSTc2CDzPHxdvUA==; 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 1gNhAJ-0005hz-BL; Fri, 16 Nov 2018 16:40:19 +0000 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNhA3-00045E-NB for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 16:40:05 +0000 Received: by mail-pf1-x443.google.com with SMTP id h3so5109480pfg.1 for ; Fri, 16 Nov 2018 08:39: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=xfw1G45o1zFW41lhUipKSvIxM7Mirg3j/ORexArSSOI=; b=IHk+yUcwy3Tn5b7VhPIG+abilk0SHU+XJTb+kQZB4JwjlIALKaSnSDFcFKT4Y1E5IS 1/iepKrht5bJ0uOzBOX2bu81ePe+5Gduq0hdM7KgN7/DzCU1n7Lr85e7wS/OfmtfaeSM p/XcPpRXMqLoZ2JMGLUPoDpsvvfw/3Uce716Q= 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=xfw1G45o1zFW41lhUipKSvIxM7Mirg3j/ORexArSSOI=; b=cCbeYj5iTp1fZ8N4NyTkcXg1YbB0GSX9ZI8J8EtIWB+824/UdHWbfciJy+aBsEkI8R 3gyFcnMow4l0IiSS27I9+X/d8tiNx+71XUaHmJESBkxMt5Ve5PXQIerImwSPUyrwvCSW eif1SSOU0k/HQjGFucIWoZCjsjp31ofdFsL2CyZhmR1pboIboHcfmwEf8zk9J9jT11o0 WvYWSNEfIEg6DvAbdWgpbCmAsQqN03mLSAjTn0DCY86XMhddSNaBz+836rljr4nKuMeq vazH4qmTbdtt6XFQAw8cLjC6SnFQRm4KArKhkMQwdCTKT6Vdgic/zQ+j2XL7ba8YIGYD h7vQ== X-Gm-Message-State: AGRZ1gLXUjg+vC7FrRvzrfVWqbgtlDPrX0WVlyUF2GfJTrZI59X8cCWt C8RAGzaHuqeNXePwSWYubfDBcg== X-Google-Smtp-Source: AJdET5eOeBxmHRxMRv1dqm7bRxnMebtegzdvCjb6YXE5S3cuHLbQKjZ7d6YXgTvk+/tMRQ0dVsu/Fw== X-Received: by 2002:a62:6241:: with SMTP id w62-v6mr11758075pfb.69.1542386393003; Fri, 16 Nov 2018 08:39:53 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id p5-v6sm34622213pfb.109.2018.11.16.08.39.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 08:39:52 -0800 (PST) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: [PATCH v2 02/12] drm/sun4i: sun6i_mipi_dsi: Support instruction loop selection Date: Fri, 16 Nov 2018 22:09:06 +0530 Message-Id: <20181116163916.29621-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181116163916.29621-1-jagan@amarulasolutions.com> References: <20181116163916.29621-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_084003_775453_2E762EAE X-CRM114-Status: GOOD ( 12.24 ) 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: Jagan Teki 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 Instruction loop selection would require before writing loop number registers, so enable idle, LP11 bits on loop selection register. Reference code available in BSP (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) (dsi_dev[sel]->dsi_inst_loop_sel.dwval = 2<<(4*DSI_INST_ID_LP11) | 3<<(4*DSI_INST_ID_DLY); Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 43ab7127d428..3ac002c4d8b3 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -438,6 +438,9 @@ static void sun6i_dsi_setup_inst_loop(struct sun6i_dsi *dsi, { u16 delay = sun6i_dsi_setup_inst_delay(dsi, mode); + regmap_write(dsi->regs, SUN6I_DSI_INST_LOOP_SEL_REG, + DSI_INST_ID_HSC << (4 * DSI_INST_ID_LP11) | + DSI_INST_ID_HSD << (4 * DSI_INST_ID_DLY)); regmap_write(dsi->regs, SUN6I_DSI_INST_LOOP_NUM_REG(0), SUN6I_DSI_INST_LOOP_NUM_N0(50 - 1) | SUN6I_DSI_INST_LOOP_NUM_N1(delay)); From patchwork Fri Nov 16 16:39:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10686661 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 EB7AF3CF1 for ; Fri, 16 Nov 2018 16:40:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D888E2CE5D for ; Fri, 16 Nov 2018 16:40:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBD512CE5F; Fri, 16 Nov 2018 16:40: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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 423972CE5D for ; Fri, 16 Nov 2018 16:40:35 +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=YqmaL3PsvStWPv09ymkLnYaAKY78Z3omRw6fcJLgcAQ=; b=uFCPhg3+HEUwNz TBlnqR2f04VxItMI9lWdiP4BxbbXM8lmG4vAp8t7m7B7IFxhLzNyYLkqupi0Irm/NMZWmAeAkcvze EtN3YwtjOTIzLjoc4EXmQUapliaiDcC6vdWRUEgQKveRZfOQNYWLlQokuprPsw+4bjMvTVQTMALA5 adFixWPR1wmZeYGQFh3d4Ri109kblUrCTYe+C4IoKYbtC2ie/7GvfV0dcA/HmdsHgx4USJYMmR/RK Wtj9WhShPstgILrLLppiydzeGlnfuYFYVmMgomQ4Vd7BqNuIejthLVE5q6rcHAXbwLoD0O5k+Nmya mhgVs3/wVjG658+uGVow==; 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 1gNhAW-0005zS-Jk; Fri, 16 Nov 2018 16:40:32 +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 1gNhAA-0004DR-QN for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 16:40:13 +0000 Received: by mail-pg1-x542.google.com with SMTP id v28so328843pgk.10 for ; Fri, 16 Nov 2018 08:40:00 -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=1dP1vOMxWacxYs/v4J30IWXfhdx6NrRFGWFTZApmbYU=; b=ceOdo43zYnOrKMIPGlQ0esry5bfUFVF/Df0JtUOTVyXLGqWqUOl8lLG8JkXOZBBHrq Nf8/CG3ROgbIKq96C4PGcDlEiQK2tueHHSWEaQ+ulSv/wyQelWgUMGoZX3Js/MdszQid mF3lY/cxlqNQ6ydcU2UIQGoqtDY5qT48hu1Ho= 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=1dP1vOMxWacxYs/v4J30IWXfhdx6NrRFGWFTZApmbYU=; b=AIgYu0RLlaSQk7rq6ahOF5DTx4vjWp78s6Ypjo/vZkX63zNZoKKHHgp2vQmQuwNojG 304CL8x5ABW2jPK9Ad91gMCCO7WL1dLYGO3D797yurRZZ1zQuldnoflL7F0PntZ5t2vc 8Kjqz6Ed3zdhU7wQdT1T5j0q+VZuDYwWrFkuVwaD4EnP026dz1hnFjjeCbeFonQdMdJi mO3TyKpwp1Z8RnFoVCeFuU0EK/T9gjGIi9UwhgOevgYmNVsNkGbSNQ9KWBgP+wSNvj2A c5He+Wa0B8bl5dlB+IPFxX7Uo51WoeOEOPqDfmnmzeajqoybDbMuKDmJtmlHHHNmuee0 lTQg== X-Gm-Message-State: AGRZ1gLmGMldxYzd71l1VM/VT1hebZ6P3Bi3mFbzACTZEosOMrDfFBbX jyMqmna5B95z0lLBvSFIMYEbig== X-Google-Smtp-Source: AJdET5fGMWD5aEfG7Y4fJEE/G61lDZAjtMka0fozTIEeQN7ArhkBpjGNCtk5ziVjpVLkiBjLbIJTAQ== X-Received: by 2002:a63:1412:: with SMTP id u18mr10422416pgl.247.1542386400202; Fri, 16 Nov 2018 08:40:00 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id p5-v6sm34622213pfb.109.2018.11.16.08.39.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 08:39:59 -0800 (PST) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: [PATCH v2 03/12] drm/sun4i: sun6i_mipi_dsi: Setup burst mode timings Date: Fri, 16 Nov 2018 22:09:07 +0530 Message-Id: <20181116163916.29621-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181116163916.29621-1-jagan@amarulasolutions.com> References: <20181116163916.29621-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_084010_907600_531AFD3B X-CRM114-Status: GOOD ( 17.31 ) 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: Jagan Teki 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 Burst mode display timings are different from convectional video mode so update the horizontal and vertical timings. Reference code taken from BSP (from linux-sunxi/ drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c) dsi_hsa = 0; dsi_hbp = 0; dsi_hact = x*dsi_pixel_bits[format]/8; dsi_hblk = dsi_hact; dsi_hfp = 0; dsi_vblk = 0; Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 128 +++++++++++++++---------- 1 file changed, 80 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 3ac002c4d8b3..efd08bfd0cb8 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -153,6 +153,14 @@ #define SUN6I_DSI_CMD_TX_REG(n) (0x300 + (n) * 0x04) +struct sun6i_dsi_timings { + u16 hsa; + u16 hbp; + u16 hblk; + u16 hfp; + u16 vblk; +}; + enum sun6i_dsi_start_inst { DSI_START_LPRX, DSI_START_LPTX, @@ -379,6 +387,60 @@ static u16 sun6i_dsi_get_timings_vblk(struct sun6i_dsi *dsi, return vblk; } +static void sun6i_dsi_get_timings(struct sun6i_dsi *dsi, + struct drm_display_mode *mode, + struct sun6i_dsi_timings *timings) +{ + struct mipi_dsi_device *device = dsi->device; + unsigned int Bpp = mipi_dsi_pixel_format_to_bpp(device->format) / 8; + u16 hsa, hbp, hblk, hfp, vblk; + + /* + * A sync period is composed of a blanking packet (4 bytes + + * payload + 2 bytes) and a sync event packet (4 bytes). + * Its minimal size is therefore 10 bytes + */ +#define HSA_PACKET_OVERHEAD 10 + hsa = max((unsigned int)HSA_PACKET_OVERHEAD, + (mode->hsync_end - mode->hsync_start) * Bpp - + HSA_PACKET_OVERHEAD); + + /* + * The backporch is set using a blanking packet (4 bytes + + * payload + 2 bytes). Its minimal size is therefore 6 bytes + */ +#define HBP_PACKET_OVERHEAD 6 + hbp = max((unsigned int)HBP_PACKET_OVERHEAD, + (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); + + /* + * 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 + */ +#define HBLK_PACKET_OVERHEAD 10 + hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, + (mode->htotal - (mode->hsync_end - mode->hsync_start)) * + Bpp - HBLK_PACKET_OVERHEAD); + + /* + * The frontporch is set using a blanking packet (4 bytes + + * payload + 2 bytes). Its minimal size is therefore 6 bytes + */ +#define HFP_PACKET_OVERHEAD 6 + hfp = max((unsigned int)HFP_PACKET_OVERHEAD, + (mode->hsync_start - mode->hdisplay) * Bpp - + HFP_PACKET_OVERHEAD); + + vblk = sun6i_dsi_get_timings_vblk(dsi, mode, hblk); + + timings->hsa = hsa; + timings->hbp = hbp; + timings->hblk = hblk; + timings->hfp = hfp; + timings->vblk = vblk; +} + static u16 sun6i_dsi_setup_inst_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { @@ -506,52 +568,22 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, { struct mipi_dsi_device *device = dsi->device; unsigned int Bpp = mipi_dsi_pixel_format_to_bpp(device->format) / 8; - u16 hbp, hfp, hsa, hblk, vblk; + struct sun6i_dsi_timings timings; size_t bytes; u8 *buffer; /* Do all timing calculations up front to allocate buffer space */ - /* - * A sync period is composed of a blanking packet (4 bytes + - * payload + 2 bytes) and a sync event packet (4 bytes). Its - * minimal size is therefore 10 bytes - */ -#define HSA_PACKET_OVERHEAD 10 - hsa = max((unsigned int)HSA_PACKET_OVERHEAD, - (mode->hsync_end - mode->hsync_start) * Bpp - HSA_PACKET_OVERHEAD); + memset(&timings, 0, sizeof(timings)); - /* - * The backporch is set using a blanking packet (4 bytes + - * payload + 2 bytes). Its minimal size is therefore 6 bytes - */ -#define HBP_PACKET_OVERHEAD 6 - hbp = max((unsigned int)HBP_PACKET_OVERHEAD, - (mode->htotal - mode->hsync_end) * Bpp - HBP_PACKET_OVERHEAD); - - /* - * The frontporch is set using a blanking packet (4 bytes + - * payload + 2 bytes). Its minimal size is therefore 6 bytes - */ -#define HFP_PACKET_OVERHEAD 6 - hfp = max((unsigned int)HFP_PACKET_OVERHEAD, - (mode->hsync_start - mode->hdisplay) * Bpp - - HFP_PACKET_OVERHEAD); - - /* - * 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 - */ -#define HBLK_PACKET_OVERHEAD 10 - hblk = max((unsigned int)HBLK_PACKET_OVERHEAD, - (mode->htotal - (mode->hsync_end - mode->hsync_start)) * - Bpp - HBLK_PACKET_OVERHEAD); - - vblk = sun6i_dsi_get_timings_vblk(dsi, mode, hblk); + if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + timings.hblk = (mode->hdisplay * Bpp); + else + sun6i_dsi_get_timings(dsi, mode, &timings); /* How many bytes do we need to send all payloads? */ - bytes = max_t(size_t, max(max(hfp, hblk), max(hsa, hbp)), vblk); + bytes = max_t(size_t, max(max(timings.hfp, timings.hblk), + max(timings.hsa, timings.hbp)), timings.vblk); buffer = kmalloc(bytes, GFP_KERNEL); if (WARN_ON(!buffer)) return; @@ -590,33 +622,33 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, /* sync */ regmap_write(dsi->regs, SUN6I_DSI_BLK_HSA0_REG, - sun6i_dsi_build_blk0_pkt(device->channel, hsa)); + sun6i_dsi_build_blk0_pkt(device->channel, timings.hsa)); regmap_write(dsi->regs, SUN6I_DSI_BLK_HSA1_REG, - sun6i_dsi_build_blk1_pkt(0, buffer, hsa)); + sun6i_dsi_build_blk1_pkt(0, buffer, timings.hsa)); /* backporch */ regmap_write(dsi->regs, SUN6I_DSI_BLK_HBP0_REG, - sun6i_dsi_build_blk0_pkt(device->channel, hbp)); + sun6i_dsi_build_blk0_pkt(device->channel, timings.hbp)); regmap_write(dsi->regs, SUN6I_DSI_BLK_HBP1_REG, - sun6i_dsi_build_blk1_pkt(0, buffer, hbp)); + sun6i_dsi_build_blk1_pkt(0, buffer, timings.hbp)); /* frontporch */ regmap_write(dsi->regs, SUN6I_DSI_BLK_HFP0_REG, - sun6i_dsi_build_blk0_pkt(device->channel, hfp)); + sun6i_dsi_build_blk0_pkt(device->channel, timings.hfp)); regmap_write(dsi->regs, SUN6I_DSI_BLK_HFP1_REG, - sun6i_dsi_build_blk1_pkt(0, buffer, hfp)); + sun6i_dsi_build_blk1_pkt(0, buffer, timings.hfp)); /* hblk */ regmap_write(dsi->regs, SUN6I_DSI_BLK_HBLK0_REG, - sun6i_dsi_build_blk0_pkt(device->channel, hblk)); + sun6i_dsi_build_blk0_pkt(device->channel, timings.hblk)); regmap_write(dsi->regs, SUN6I_DSI_BLK_HBLK1_REG, - sun6i_dsi_build_blk1_pkt(0, buffer, hblk)); + sun6i_dsi_build_blk1_pkt(0, buffer, timings.hblk)); /* vblk */ regmap_write(dsi->regs, SUN6I_DSI_BLK_VBLK0_REG, - sun6i_dsi_build_blk0_pkt(device->channel, vblk)); + sun6i_dsi_build_blk0_pkt(device->channel, timings.vblk)); regmap_write(dsi->regs, SUN6I_DSI_BLK_VBLK1_REG, - sun6i_dsi_build_blk1_pkt(0, buffer, vblk)); + sun6i_dsi_build_blk1_pkt(0, buffer, timings.vblk)); kfree(buffer); } From patchwork Fri Nov 16 16:39: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: 10686663 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 D7C1713BF for ; Fri, 16 Nov 2018 16:41:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C48EB2CE5D for ; Fri, 16 Nov 2018 16:41:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7DF22CE5F; Fri, 16 Nov 2018 16:41: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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 29E5D2CE5D for ; Fri, 16 Nov 2018 16:41:04 +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=2M8jACt30wHNf07N/Q/U20KWV7L0pzSjOYz35lqyG8s=; b=j7luGNMdYfsbMo vczF4tjxmRRiPHINX+BZtPfoUPbilJUn4Nm4dxXJD+IZ0yBfNKrDeHbhUr1jGZjoDlj/+yoatmIw4 pmuhnZn0qTG/VvI0JVMOmoCmeoHNnJ8hLWACeZ9euOIeaUOP+ejkQ0sdwNai/3Qgdl/0wbMF0T1K4 6KdEMH4qbCRrD7jmKwB1d1dxlK1K0hCq52GLOpegazvArhuxoVFhcF3OoYdI5YbTSJ2C/UMWhb7HU RMmBKuoTZ6oymbiDG7/fH1oFd290a11hMjtwjny1TjcpK01qtNNl5+3kLc+wODlsYWU2hrrjp2ISZ NS7OQ9xa++0OA2i8F+bw==; 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 1gNhAx-0006M2-Gw; Fri, 16 Nov 2018 16:40:59 +0000 Received: from mail-pf1-x442.google.com ([2607:f8b0:4864:20::442]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNhAI-0004eF-Cr for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 16:40:20 +0000 Received: by mail-pf1-x442.google.com with SMTP id e22-v6so11647114pfn.8 for ; Fri, 16 Nov 2018 08:40:08 -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=YBsrf76ZM/i+rqqgf+m+LE5qjwwWDpXcodR4cqVxPuQ=; b=WB18R8BfhzYgZ8PV7X/XRfYMIAIQzuqSvdw8GvUoE8MchkdJ5CQx1pwo1Z2AqQynTY wab2418IG2H5iQBRD56tNCpzUnUQumNMa27A7L4BHjrVsFsT7S3QN7T+0seFkWJzaDpb ocmMwZY36ulZgMXmIfc66gtW6k3wUb3m4FmEU= 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=YBsrf76ZM/i+rqqgf+m+LE5qjwwWDpXcodR4cqVxPuQ=; b=VoY2WU+YsHDZ/A2w4qGCl78pvuQwSRuugncVQ/W+cg1Ob/5OyPY5brpNKf+3KGXR4x nQyqIBOPKSXmyKZX31l3N8upVmqJfj17P3i0NhfzeAOP/0kk0NkGUWLNozmmpxQ/SHql 2z9l+4e/zY5TSEBrTqrV8mPm7F3N9TaazwyCMpvzwkG9DDUMqgwj/0/OPJ4tfaoxmosJ ANwIwtLp/keJAJySjgVuFKlMa4QEjlITs2gxVrbQwlrWi7e740knJPayoTRy9JhH+99D HF7VJi4ysIc8vzbl/iqOwR/W6hymZEa4+ZejLZTyu19wUVeK3352JNDFhOatYiFXBzb3 zcXA== X-Gm-Message-State: AGRZ1gKF5rRcJyk+QFqi0OfBN4yKga9JgPoC4sybgKVj1Qkv3UZRJdbY 99y6g+xVId6I9PT7qoQ+VQUvNg== X-Google-Smtp-Source: AJdET5dLcC4ia6XQOMeChAGQ+PpLrfV212072zXMAz/H5w2/HqWBTXxsNpTbqcIes6VU8Qumxt9PsA== X-Received: by 2002:a63:8ac4:: with SMTP id y187mr10597592pgd.446.1542386407688; Fri, 16 Nov 2018 08:40:07 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id p5-v6sm34622213pfb.109.2018.11.16.08.40.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 08:40:07 -0800 (PST) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: [PATCH v2 04/12] drm/sun4i: sun6i_mipi_dsi: Simplify drq set to support all modes Date: Fri, 16 Nov 2018 22:09:08 +0530 Message-Id: <20181116163916.29621-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181116163916.29621-1-jagan@amarulasolutions.com> References: <20181116163916.29621-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_084018_439295_9C75D716 X-CRM114-Status: GOOD ( 16.16 ) 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: Jagan Teki 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 Allwinner MIPI DSI DRQ set value can be varied with respective video modes. - burst mode the set value is always 0 - video modes whose front porch greater than 20, the set value can be computed based front porch and bpp. - video modes whose front porch is not greater than 20, the set value is simply 0 This patch simplifies existing drq set value code by grouping into sun6i_dsi_get_drq and support all video modes. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 38 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index efd08bfd0cb8..d60955880c43 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -363,6 +363,26 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, SUN6I_DSI_INST_JUMP_CFG_NUM(1)); }; +static int sun6i_dsi_get_drq(struct sun6i_dsi *dsi, + struct drm_display_mode *mode) +{ + struct mipi_dsi_device *device = dsi->device; + int drq = 0; + + if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + return drq; + + if ((mode->hsync_start - mode->hdisplay) > 20) { + /* Maaaaaagic */ + u16 drq = (mode->hsync_start - mode->hdisplay) - 20; + + drq *= mipi_dsi_pixel_format_to_bpp(device->format); + drq /= 32; + } + + return drq; +} + static u16 sun6i_dsi_get_timings_vblk(struct sun6i_dsi *dsi, struct drm_display_mode *mode, u16 hblk) { @@ -478,21 +498,9 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { - struct mipi_dsi_device *device = dsi->device; - u32 val = 0; - - if ((mode->hsync_start - mode->hdisplay) > 20) { - /* Maaaaaagic */ - u16 drq = (mode->hsync_start - mode->hdisplay) - 20; - - drq *= mipi_dsi_pixel_format_to_bpp(device->format); - drq /= 32; - - val = (SUN6I_DSI_TCON_DRQ_ENABLE_MODE | - SUN6I_DSI_TCON_DRQ_SET(drq)); - } - - regmap_write(dsi->regs, SUN6I_DSI_TCON_DRQ_REG, val); + regmap_write(dsi->regs, SUN6I_DSI_TCON_DRQ_REG, + SUN6I_DSI_TCON_DRQ_ENABLE_MODE | + SUN6I_DSI_TCON_DRQ_SET(sun6i_dsi_get_drq(dsi, mode))); } static void sun6i_dsi_setup_inst_loop(struct sun6i_dsi *dsi, From patchwork Fri Nov 16 16:39: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: 10686665 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 70AE617DE for ; Fri, 16 Nov 2018 16:41:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E46A2CE5E for ; Fri, 16 Nov 2018 16:41:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F72E2CE62; Fri, 16 Nov 2018 16:41:25 +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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 DB4032CE5E for ; Fri, 16 Nov 2018 16:41:24 +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=uWjunX3Af6xKZakBM7wHArONGdeAqasdsWLg/SI06Hc=; b=n1z8d4xm1L3FzR TghNaNNwtmicp2VR8fvHov6vjC7HExNJqMc2EywX2w1WEj9NV/hCiZPsqZs4Q03/LFbDNe6jDQWTc +1UpIp9WL0Ijw8t1+rlG9ngmAdJ/A2VMk2w3HbYzu1okWxJPYE0ZNDbxcs2Lsq6nWIqDF54sdnN91 vKox8M1k/KbnAozEnf+dWwcor9etSekawVJm6VK8H57eH+tYYK7trBNUOVXQCqvNcJHHOZtnafoIo wOPV2q00yKrYEKRgOiYm1ycRU6Cs1aftAfn/PdSd0gYOLV48szeSkHyAcnITBsfykPc4YfzYuInKO FkTjZNFQDtofIR4ihYKg==; 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 1gNhBI-0006eb-Qj; Fri, 16 Nov 2018 16:41:20 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNhAP-0005T1-UR for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 16:40:29 +0000 Received: by mail-pl1-x643.google.com with SMTP id g59-v6so11400304plb.10 for ; Fri, 16 Nov 2018 08:40: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=gDd9dwA7Hm3WuIogwPjaX9WwN0ho9g9ngVvPoG/csZ0=; b=gQD9oYMwThWN8kj06UxshzAdzal6EVUtSUhSdsEaXUcctoiObYz8MyTBzXf4a34rWM ddKz8bnDNbe4PwV0NMRIVM5TmFhc1Pv763Lo4G3gNp3KM7IxOQmUGySJoqmobi7hVl+T ngG+/XgcFfVlWbqNYdsd42p28A3Axvx2lqajE= 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=gDd9dwA7Hm3WuIogwPjaX9WwN0ho9g9ngVvPoG/csZ0=; b=M/Aoqdl28jIjeneUSe+NgvAjSgjSdFaK+Tb//8+PMbdpI6PaIQWeIvIMXvbv9eT5lL 0FmBum8XMz4EAuFqy+/A+FJoMIf9O1deWLZHpDXpteQNPqsj1NfdkFhAV9NNBtnkjknz 8IBf2W/CIAztBcPqRIuwyV75kJT0DDciVO6VOUPmpA9C+3rQxlMuxKP9L9Dkb4IViFfb 6rjZwY/xiEpPtduf489n4Q/NDzeS1EX7lATqcQ9YRgtvO3+7OmULToUnECMUSGd7ex6o xIg7ecK/m+WTIUNOsJsrrERU1Wd3wPC+fDSt93Dhez0NSEuskuL7YxA7Edo3i+4z9OLv 8FMg== X-Gm-Message-State: AGRZ1gLtdIXXZDIuowZl6yXpDjx0oEEVGckM3LTk8An3i9/DdACMwcYP NikN/3KiQKJ+Weprk8E92MLA4Q== X-Google-Smtp-Source: AJdET5foe954ne/ZJRo/LsEbnW6Tmi3EDZpn+VLwY6I7yD0dzmArTSXooBVraL8h8KbMPNDKAHTbLw== X-Received: by 2002:a17:902:d03:: with SMTP id 3-v6mr9444498plu.66.1542386415050; Fri, 16 Nov 2018 08:40:15 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id p5-v6sm34622213pfb.109.2018.11.16.08.40.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 08:40:14 -0800 (PST) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: [PATCH v2 05/12] drm/sun4i: tcon: Export get tcon0 routine Date: Fri, 16 Nov 2018 22:09:09 +0530 Message-Id: <20181116163916.29621-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181116163916.29621-1-jagan@amarulasolutions.com> References: <20181116163916.29621-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_084026_092914_A7FF051D X-CRM114-Status: GOOD ( 14.93 ) 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: Jagan Teki 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 Sometimes tcon attributes like tcon divider, clock rate etc are needed in interface drivers like DSI. So for such cases interface driver must probe the respective tcon and get the attributes. Instead of probing tcon explictly, better export the existing sun5i_get_tcon0 so-that the relevant interface can reuse. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 3 ++- drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index c78cd35a1294..6e85a33c6828 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -221,7 +221,7 @@ EXPORT_SYMBOL(sun4i_tcon_enable_vblank); * are located in TCON0. This helper returns a pointer to TCON0's * sun4i_tcon structure, or NULL if not found. */ -static struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm) +struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm) { struct sun4i_drv *drv = drm->dev_private; struct sun4i_tcon *tcon; @@ -235,6 +235,7 @@ static struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm) return NULL; } +EXPORT_SYMBOL(sun4i_get_tcon0); void sun4i_tcon_set_mux(struct sun4i_tcon *tcon, int channel, const struct drm_encoder *encoder) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h index 3d492c8be1fc..195deb9db57a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -273,6 +273,7 @@ struct sun4i_tcon { struct drm_bridge *sun4i_tcon_find_bridge(struct device_node *node); struct drm_panel *sun4i_tcon_find_panel(struct device_node *node); +struct sun4i_tcon *sun4i_get_tcon0(struct drm_device *drm); void sun4i_tcon_enable_vblank(struct sun4i_tcon *tcon, bool enable); void sun4i_tcon_mode_set(struct sun4i_tcon *tcon, const struct drm_encoder *encoder, From patchwork Fri Nov 16 16:39: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: 10686667 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 530E713BF for ; Fri, 16 Nov 2018 16:41:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40B1B2CE5D for ; Fri, 16 Nov 2018 16:41:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 34CE12CE5F; Fri, 16 Nov 2018 16:41: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=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW 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 A70A12CE5D for ; Fri, 16 Nov 2018 16:41:47 +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=ZVPZlWxn22aTvzfXn7ZToiYrzbwMO629O1MKWT2UVbU=; b=lwDkyDVktN7d5Y 81Bja54n768M3Hwmic8j8woKFy/x9xBKZYq7+R742/MMvSh9uj/7zWd7PpHbqqBA05qhdsvX6f29y CttiNLByY+uUMQssm/Rly8RgXydCSZrRJ0Kbxy0+2l4kJ5XpWvm/mLx8ZiIAZ0JvBRKkG4rocfd6a Hsrelzj/Tnbmy1UqW19Uh18D3U9yaOXNLJxDHFWl1DVgV4aiHIPu13n/uy8kSw+iKX1lp1UeJzPEX V8KcT8IqcsKntpcOqMmKyxSrSqUvczro/qIU6lLzzOhSVILUW5FT4HcrmWBZWoMOdW2h3DQ4N/EPh L/tqGSlqRumuWcswazpw==; 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 1gNhBg-00071E-RE; Fri, 16 Nov 2018 16:41:44 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNhAP-0005oN-W0 for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 16:40:29 +0000 Received: by mail-pl1-x643.google.com with SMTP id g59-v6so11400424plb.10 for ; Fri, 16 Nov 2018 08:40:23 -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=LrO967p/LnLVx88kJuV1gNk2tEKJ/CRJkfeL25hLlO0=; b=lcFeO38EkuHtEVZZxHqTYGwWbEsj+75OqWcZaVmAKsEwLbTfkmEcl5G5dj6Zw4K9ll t6NDSDov3dzCN2Kj1wgscpqPD9X341bZOTpz3LNAfnP4+kV8YWIfpzYMIDB33jxcq1LD pb3U3EH2Xx5jYwVBivKe39kFaNdYpW1wYAoG0= 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=LrO967p/LnLVx88kJuV1gNk2tEKJ/CRJkfeL25hLlO0=; b=FEYO3hq0vgKu76PWyMqW6dPCVZ5nsDiYnOzcVgLC1C+vipe5ageI6smdB31NPqu3HW dp0Ucq8GFwKhFbw2tYvcB3m59Z9gOFE9nOdHJrkprAPVxK+4gFA1Fvui6RoTsQSV0nln CFxnmMqpoYqjPzr8LbliCJjD+cwxsfoq0nEACy64ZBxl/ET0Le+l9hEKhTe3t5oc2J+R f2lrttYknPDzjL6bl416oa7oyIXFXHDb4tTtRDKXe7loCpUhuPMC8DF4Sl74PIL/qt8f jhqv9yfqMAhgcQnyfCgUMMcSQr91QWNLWpILteibhsOrjHbfahNDtcO59G1K7T9Y0Ss6 ZXbA== X-Gm-Message-State: AGRZ1gJwGJ1i2Y4gDPXX29lmlbg4KqpT0sILPTF+D9vUKck5K/xtSud0 buDymEqUSfB92K+sNDNCXAEtlg== X-Google-Smtp-Source: AJdET5erv9h7lRt09RuyLXuV0IN625iih7tW9lkD9ZmbQJ+pj6wI8ScTUsFiB7XriP8o+Rid3dmxmA== X-Received: by 2002:a17:902:8608:: with SMTP id f8-v6mr11311783plo.95.1542386422513; Fri, 16 Nov 2018 08:40:22 -0800 (PST) Received: from localhost.localdomain ([115.97.190.86]) by smtp.gmail.com with ESMTPSA id p5-v6sm34622213pfb.109.2018.11.16.08.40.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Nov 2018 08:40:22 -0800 (PST) From: Jagan Teki To: Maarten Lankhorst , Maxime Ripard , Sean Paul , David Airlie , Rob Herring , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Thierry Reding , Mark Rutland , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Michael Trimarchi , TL Lim , linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com Subject: [PATCH v2 06/12] drm/sun4i: sun6i_mipi_dsi: Probe tcon0 during dsi_bind Date: Fri, 16 Nov 2018 22:09:10 +0530 Message-Id: <20181116163916.29621-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20181116163916.29621-1-jagan@amarulasolutions.com> References: <20181116163916.29621-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181116_084026_135066_DDA31345 X-CRM114-Status: GOOD ( 14.22 ) 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: Jagan Teki 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 Probe tcon0 during dsi_bind, so-that the tcon attributes like divider value, clock rate can get whenever it need. Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 7 +++++++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 + 2 files changed, 8 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index d60955880c43..66a01061e51d 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -25,6 +25,7 @@ #include #include "sun4i_drv.h" +#include "sun4i_tcon.h" #include "sun6i_mipi_dsi.h" #include