From patchwork Thu Feb 14 19:32:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813631 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 270F013B5 for ; Thu, 14 Feb 2019 19:33:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 14CA82EF28 for ; Thu, 14 Feb 2019 19:33:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 086062EF2C; Thu, 14 Feb 2019 19:33:08 +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 9C36A2EF28 for ; Thu, 14 Feb 2019 19:33: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=ugcWT/btqQCwiMeaFsQmW9tC2FI/wda+G89UL+emgyo=; b=nnfleWN8NS9Auq Pw6KKcHV12sxDgQvaTUPIx2mgNxheTAbFLL8oa7691qD9JzHqIcBGyc06uawlkcA8BNQ8Mcan/snN U+qDZ2ktZKqgyZ99nOztkqfkQphTk4++AY7iC98u46CnW5Yi9jMSVWhFv9ya2+FDZRXJy4vE8hV2q cq95s57HjvFdVtBIJehWc7n678YfatNV2TG0JqXTPX8w/7IVlMzR4hM7n5BD+Aheh0SYY9h8yUtZ2 boexZE8QuU5QWebtGbD5kBruoEXQrdvEdqKJjXyFTBhPap/errarlbKGAcOYnCWxY3bwarostHiEz twwMU+VGKkyg2lvnBmCA==; 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 1guMks-0005l9-KN; Thu, 14 Feb 2019 19:33:06 +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 1guMkh-0005Wf-46 for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:32:57 +0000 Received: by mail-pl1-x643.google.com with SMTP id o6so3652756pls.13 for ; Thu, 14 Feb 2019 11:32:55 -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=sMYAwY4ous29UnB5Oi5EE6ejKMZVZfyoGoBh/UV0aBA=; b=PDVQJJ9lTnIR2obHuE8IXjqrGZaBG4bTXc/s/YlPuONeKs6obUjPfE3bRIwDtftPqD inGbuX4SqIuL8+GS/1HAjQXeoL/eab3hVu0vZLyAUhlbBq1IQw085V5pIU3jbu7XuOfs h+sl/CMRnyVdT/rU7BlJF2VWfHkpyldB7LjBQ= 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=sMYAwY4ous29UnB5Oi5EE6ejKMZVZfyoGoBh/UV0aBA=; b=MZcp7P6rOwYABqtSlMmHF/TZKzUklPMoNsdkdoq2wAYwt0N5HzG6PDQhUpK4w54i/9 jATibYMFxPNnLEqgyb1V2PSoQB2o4k9HXYeY6jKNNWdTK5BYC+/0v60fbNVS7rYm8hiu sWyyouSxz834W2izicQKCs/TvThvJ1EzFBliJ33dUp3FXfydxTvRvhRhX9TzSE7ESq76 kEtFyVdfV44e2nulpnsDAGTTD8ORxNYdwS+QaWPPmFV2yJ7pQqtahR0DYPxUfAoFeHdZ Iq76NVYx+oXzY37Mi+jPOTUBnIgIVhcrcfgxDwqORNssQhi5bSWOSp8bZCwyiPXMDlay sjnQ== X-Gm-Message-State: AHQUAuaTebnnLxdJ6X5YQZ46hkQkVfVzq1y9D5GV5iOi0cIhkQMkCzWJ HSBavTN5l04rsWL94r+Uq+gn1w== X-Google-Smtp-Source: AHgI3IYrryFfvBkMudqDb5MR15tKo+bXCkdnvLwU/O93NmFvAdhsZeXXx/m3+32FEnW/CaLE3ptqxg== X-Received: by 2002:a17:902:6a4:: with SMTP id 33mr5804993plh.99.1550172774582; Thu, 14 Feb 2019 11:32:54 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id o23sm10808832pfa.140.2019.02.14.11.32.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:32:53 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 01/10] drm/sun4i: sun6i_mipi_dsi: Compute burst mode loop N1 instruction delay Date: Fri, 15 Feb 2019 01:02:28 +0530 Message-Id: <20190214193236.7504-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214193236.7504-1-jagan@amarulasolutions.com> References: <20190214193236.7504-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_113255_312287_56A9506B X-CRM114-Status: GOOD ( 14.69 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, 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 Loop N1 instruction delay varies between burst and non-burst video modes. 1) for burst mode panels it is computed based on the panel pixel clock along with horizontal sync and porch timings. 2) for non-burst mode panels, it is same as existing (50 - 1) 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; This patch add loop N1 computation for burst mode by simplifying existing code to support all possible modes. Signed-off-by: Jagan Teki Tested-by: Merlijn Wajer --- 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 3a28d70dbdc1..8184fbcfd9fd 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -355,6 +355,24 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, SUN6I_DSI_INST_JUMP_CFG_NUM(1)); }; +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) { @@ -401,7 +419,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 Thu Feb 14 19:32:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813641 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 6860A13A4 for ; Thu, 14 Feb 2019 19:33:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56ECB2EF28 for ; Thu, 14 Feb 2019 19:33:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4B42F2EF36; Thu, 14 Feb 2019 19:33: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=-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 01F342EF28 for ; Thu, 14 Feb 2019 19:33:23 +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=/wb8eWOlqti2R0cqP3TFssTVX5Py3R3rTIa96Fw0hP0=; b=jlHXh7rtEM2594 B9h/BtlC8JI02t+eTkkBfX1imnJxNdkYqocwaXjDQOnFBw0+ciOHLB2XNBxoka8XD1RBLYtLO0+Vq eNAJmb1aI57/rS70f3Kj0YwdDTFrxCA4pqPm+c9gsNDmycAWE+HiOB39egi5+mLzG8Rga4X1mX9vs IMx9fkfc+scPfi6/eL2rcXmOS6eNjSeUfvKHeMjJ/0RT/Mc2OjtRzhIvFtFvkhsMZrR0wKL9mfUQm p3SC8+sH3EoWp0t60p3K5hBLAfJ2l3VEuI0Tvr9/r6ozDV7fUIWW2tfJl+VS3GVCkhGoUh64n3mbF jNLEBS2NJqLze7aIaE8A==; 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 1guMl2-0005wo-ID; Thu, 14 Feb 2019 19:33:16 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMkk-0005bR-Je for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:33:02 +0000 Received: by mail-pl1-x644.google.com with SMTP id g9so3675897plo.3 for ; Thu, 14 Feb 2019 11:32:58 -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=9m6ReoBLBZFOeMQ09Fo4ZfosvrNH9XVGYhAEmEbH5dY=; b=OeoCqo+1i6jzEn5S5XDmRKxrzslqlqYs/BvduK85Glf5ZV1W2o23Sx7cdG38olCj7e hdkC78PBImdtCLjMwJS+HAmt0f9+vy/Xu9y6Hx44az+uv6BqY4ycKa2Y6P2KOMJPlB+0 /TwNNnv5NyIJsMfZCaKrAJGzu0pZ2Bx3MEdiU= 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=9m6ReoBLBZFOeMQ09Fo4ZfosvrNH9XVGYhAEmEbH5dY=; b=KLxeIl9pupvAdyBokPwrHzQ/9ym3jEKIEwKvVeCmxJHeJ+hHGbYvieZVe93pxkO4sf OHdMIh0FZDshfUVRnG7FaM2K3Jy9382xdFPeHUcL2hpyhVrR3dnCE3ZkMfVc4eqqFgxZ NhRa8lnOPr7VcLmy8UiKttoZUOcHrfTuiZjAO/hahSqGYpswDnxY9NCits3NcFKiE+vi 5aBvSpSYVyyiEDc9WT5SB5NUyjiKwpGB2HPwX42Jzsd8H1h+LD8NNJoqrzgsc7pSR9H2 Ddk+PEddJf+nZycunlnRU0HQSWzLp9r8JXieUrxFRN+ttI9O/aEuMOtYh4Ni1bSpWvPD 0V4w== X-Gm-Message-State: AHQUAuZUrLqgcEt8Ocn3Lc/XYqDprXVu1CqySq6RCEWlmBzm+YTbZdPj O3Px7rd1nHYYIlfUFsnSYk/QKg== X-Google-Smtp-Source: AHgI3IapVc576RPyNQeLXBiOhwHc8LrJB3pQYJLbmAl68gLhk5RNwUKAtczEDY1JZy+5na4RFvDE4w== X-Received: by 2002:a17:902:2ba8:: with SMTP id l37mr5888652plb.243.1550172778007; Thu, 14 Feb 2019 11:32:58 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id o23sm10808832pfa.140.2019.02.14.11.32.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:32:57 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 02/10] drm/sun4i: sun6i_mipi_dsi: Support instruction loop selection Date: Fri, 15 Feb 2019 01:02:29 +0530 Message-Id: <20190214193236.7504-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214193236.7504-1-jagan@amarulasolutions.com> References: <20190214193236.7504-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_113259_357702_8175A0F2 X-CRM114-Status: GOOD ( 11.45 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, 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 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 Tested-by: Merlijn Wajer --- 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 8184fbcfd9fd..1a0707468121 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -421,6 +421,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 Thu Feb 14 19:32:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813647 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 E9DB813A4 for ; Thu, 14 Feb 2019 19:33:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D819D2EF28 for ; Thu, 14 Feb 2019 19:33:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C97582EF36; Thu, 14 Feb 2019 19:33:29 +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 745ED2EF28 for ; Thu, 14 Feb 2019 19:33:29 +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=bHft8+xMqoR+vg7WWf5ySCm4tsYhHeyT9iUODyXmqNY=; b=USEw/9SfpqmyBo oN7FplqLbSpKRqoUv+lEorZclI56b4Ktodv1HY0HKPp4USeiCM4rDnfLgyan5JbUEzGBWl6/PklMQ POAOOlp8MUfQjnGe9V5M4jcwBz0CYrOuPg9/Cq6cGmX44rppb9YHKwU5+dfIEecPOQysfxB8vax+x gM0pWroa8KQA3Fk/CHLncAwaHg2KuRCUjziXcU6lNm34wokRrRI86Ma7gV8GqjXVCt2LpaezIbQKz 6xeSCYTLCG3Eu69e07s2TmYx9TSswtoX31q1YOzM4Qo2OqmAaqv0q7hcjdxsJlQYMCiSzF/C+MNSl tINHMdKy3IssSICkC0MQ==; 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 1guMlC-0006EB-VK; Thu, 14 Feb 2019 19:33:26 +0000 Received: from mail-pl1-x642.google.com ([2607:f8b0:4864:20::642]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMko-0005gL-1P for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:33:04 +0000 Received: by mail-pl1-x642.google.com with SMTP id f90so3659159plb.10 for ; Thu, 14 Feb 2019 11:33:01 -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=5VMKk6PGn9i1BoO8FOUUuNIi7jW6XyTdiZlLmf93b6U=; b=JTxgTxcwgB81iNX1gtQGeVHqLDQQE8FtOIge1cIWQ2bunLOPZjShyWmZOlOpFEZmc+ UjQ6nu7sPn3AYX/ZprtwNCfKHWcuQOJxbSZ2X1cYy3ArI6ZuYRKIRPpMY5kvy9GZCDEC dmisNUAInbvCt/1Cvuy9seOMYsl/6Oj6bgwE8= 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=5VMKk6PGn9i1BoO8FOUUuNIi7jW6XyTdiZlLmf93b6U=; b=P7yxR4qME8GKTU04Nx3rUVeX+D11n5+sRxE4VAxFlWNSSVHnq8aS5R1XEQUe1dQfIO 7MXa8gPhfXAZEOsz//JHu/X/v7006VVpUViOO2FQkf4V3sz4cAa9eS9nnmHEtN/v5MhY HctJJHbj30RYWv32cFF07FjfHpuP+b120/z/Uvy2G7SucmqFkp4kO53pf7FM9YP1NiHE Vojd/A6mOETN0V0tdZq8YN42rg0Ua73wtuZc8qlb9AxoLb2JQISV6EZlaFTWHEGQShMd 8BTUoCQAQzHAwD6bHqw4hM7WpGaQerPv7YU869c6kuXVfn8sUhmi6/81yty6Rcq65xHq KLGA== X-Gm-Message-State: AHQUAuaLES4p1mPFcr9ftYg9rVHhT0F0MEhVXLQ9ghwjFNzafhy1Dtrf 5XYBKcmI+MXEK3PhidbR49+9/g== X-Google-Smtp-Source: AHgI3IaVnH7vqxvpWqtMvQ+l205UdbIhTt83vP7v58ygsEbw0XAdgz53meHQSapcpkoZoDen9txtQQ== X-Received: by 2002:a17:902:8e8a:: with SMTP id bg10mr5933126plb.192.1550172781435; Thu, 14 Feb 2019 11:33:01 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id o23sm10808832pfa.140.2019.02.14.11.32.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:33:00 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 03/10] drm/sun4i: sun6i_mipi_dsi: Setup burst mode timings Date: Fri, 15 Feb 2019 01:02:30 +0530 Message-Id: <20190214193236.7504-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214193236.7504-1-jagan@amarulasolutions.com> References: <20190214193236.7504-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_113302_104825_94A4D38D X-CRM114-Status: GOOD ( 14.10 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, 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 Burst mode display timings are different from conventional video mode. For burst mode most of the timings hsa, hbp, hfp, vblk are 0 and hblk is computed as (mode->hdisplay * Bpp) This patch simply add burst mode timings without touching existing mode 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 Tested-by: Merlijn Wajer --- 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 1a0707468121..4362d9df1da6 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -516,6 +516,12 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, /* Do all timing calculations up front to allocate buffer space */ + if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { + hbp = hfp = hsa = vblk = 0; + hblk = (mode->hdisplay * Bpp); + goto alloc_buf; + } + /* * A sync period is composed of a blanking packet (4 bytes + * payload + 2 bytes) and a sync event packet (4 bytes). Its @@ -554,6 +560,7 @@ static void sun6i_dsi_setup_timings(struct sun6i_dsi *dsi, vblk = sun6i_dsi_get_timings_vblk(dsi, mode, hblk); +alloc_buf: /* How many bytes do we need to send all payloads? */ bytes = max_t(size_t, max(max(hfp, hblk), max(hsa, hbp)), vblk); buffer = kmalloc(bytes, GFP_KERNEL); From patchwork Thu Feb 14 19:32:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813651 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 2E02313B5 for ; Thu, 14 Feb 2019 19:33:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AE6C2A915 for ; Thu, 14 Feb 2019 19:33:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F1FC2E037; Thu, 14 Feb 2019 19:33:53 +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 B45BA2A915 for ; Thu, 14 Feb 2019 19:33:52 +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=c+oy/k/gGZGIb7tAVwIcT1bVzJd75n0pswOEaJ31JN0=; b=fqBjogtkJRqZeo PHZQyVX/vL7+8OdMXiPXmOCfIrAhDEn/pSRpez8XaDySCgP47XoX5eaCAt1F+/vMaR7cwiEPZgJ2a 8f4NA0LzykZxDtMq8lVorg3LHB23O5/zy07d4kmfKTtoFuEfXILc147DYFfyOFfLUDWcLnszwmwv2 LVOLXkhk3hjm6Lon6neNynlfR+pjLy71QmExl+LUpw5DQ++uJF/jQZ4JzEzsyLX9jD4/xQxigFk5W rDjZwXss+2Dh4XEMHv60pVIR7+NwBf0/qtH/pvKPMJx5vyj03V91GRpoSu8pjY5XyuXIgcrcI+TVj p6Zlbr4WN2vCQIV3u88A==; 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 1guMlb-0006kU-FA; Thu, 14 Feb 2019 19:33:51 +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 1guMkr-0005k6-Eq for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:33:06 +0000 Received: by mail-pf1-x442.google.com with SMTP id s22so3596879pfh.4 for ; Thu, 14 Feb 2019 11:33:05 -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=qvbRbLJNQrsLfwewB47cDz1+x+w3diwoF9YMEG+Lj2w=; b=YR4mdKifcOd155tlUu0XmyU8rruftlI51Kjs+rpvMbzCLOanKN7+Zm5SEIYoSPn0AD OYiFaiLBugYD2TndvL1ZHsEL5XyHwzRSMZSscmrHyVCwbhah+TgL2n14TCXsgLQF6rzf X1Csi3MkYq4O1WgnGF2Ikw+VrM2Fn/wHPhGyg= 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=qvbRbLJNQrsLfwewB47cDz1+x+w3diwoF9YMEG+Lj2w=; b=b3F5VjPIhhJ2g1QS+y3GANNcqf0Vwp/1peyxlP8M8KjyE2qcUE+pCrRdAURMcM69nK GXuiHxhLxbcYAIEnAYGioCpYgxH0nccBrNsiUOCGM7BLlOwGkJWW11BnKAq1TojiuF9l xnvUo6j0JegljuEpwrspuF1VeLztK7MrEAob5vVg1vEtkakvmtk9A12bTJSX+R8aKla/ 2PvU2SDQsn38Eup0gTLhHSb4dLw2DRTscciKkuyrnF+fUxjhVTfZhUvsmJymJJeOm+UC oO5dXdKvbp2+EbTr+SIzu7hDW5ZwZufIYI8ruj5EI17HG17FIxGI7z2QlnQx2lxGccz/ squA== X-Gm-Message-State: AHQUAuagfSqpBjTLxne1wObJ6q7gRoeqR8Um8PipwvHdp8dRPZRy97s6 lAQzGuHusJvm29vuBUMlIVUaRQ== X-Google-Smtp-Source: AHgI3IaXLCw5eOUQoSanll7LQS8yH4nSacOv4VCAnqLTy0+Ye++cPlgHKZ8Fr/lYbgeuA/sqStqOcQ== X-Received: by 2002:a62:6e07:: with SMTP id j7mr5869683pfc.135.1550172784895; Thu, 14 Feb 2019 11:33:04 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id o23sm10808832pfa.140.2019.02.14.11.33.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:33:04 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 04/10] drm/sun4i: sun6i_mipi_dsi: Fix TCON DRQ set bits Date: Fri, 15 Feb 2019 01:02:31 +0530 Message-Id: <20190214193236.7504-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214193236.7504-1-jagan@amarulasolutions.com> References: <20190214193236.7504-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_113305_495818_17CDA29E X-CRM114-Status: GOOD ( 14.46 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, 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 TCON DRQ for non-burst DSI mode can computed based on horizontal front porch value, but the current driver trying to include sync timings along with front porch resulting wrong drq. This patch is trying to update the drq by subtracting hsync_start with hdisplay, which is horizontal front porch. Current code: ------------ mode->hsync_end - mode->hdisplay => horizontal front porch + sync With this patch: ---------------- mode->hsync_start - mode->hdisplay => horizontal front porch 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 4362d9df1da6..a4360aed17bf 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -402,9 +402,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 Thu Feb 14 19:32:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813653 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 DFBAE13B5 for ; Thu, 14 Feb 2019 19:34:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C30E22E037 for ; Thu, 14 Feb 2019 19:34:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B64A52E6E2; Thu, 14 Feb 2019 19:34:02 +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 499A82E037 for ; Thu, 14 Feb 2019 19:34:02 +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=rWVpvGf9Rr0uKz/g8L4GYUe/4ApuHIXrzogSgyPYgUw=; b=lJaR2pH23fu/Yk 1Jtoa9YD6cLPu/TVLNJOJwrPfthvpFoMCjF2nmpnJR6qJtoJPXBxqMb2AUX+7f7Q46s6FTFCGylSe g4anODXIpy7Gdq2gTR6w4uKD0vIpQMIdYvDDzqSpEDWMCxW858y0fwSBz35wsHAQ0JavGSJGC8vfg v/7Mr0QPbucDFUWNWaUGjWCBgz/gbemegkr/U8NpJkHXHO3dYgWcPBdn2rTS0etxVoJ2Tx6pK+Hf8 L/1fS7K+QAvFOiYdLCOXCecm6FzTC/1LuVTokqOs8aOwfyvn2+DCLBYXOfEJPjKOPhRQ19kQG1nSb UaZM5lvC2g0KPKi+Fncg==; 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 1guMlj-0006tZ-TS; Thu, 14 Feb 2019 19:33:59 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMkv-0005oE-2h for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:33:17 +0000 Received: by mail-pf1-x444.google.com with SMTP id n74so3584798pfi.9 for ; Thu, 14 Feb 2019 11:33: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=dmLB70XfR2J1D03CPPvqliqiD+PkiFMaZcieUMY43lg=; b=kXBtTe/clCxAbpE5dE4G/zYOQM5UWkCoZ8dYjMIC9oKZLt+EX4u/msuGADKWI4qMwe NAjFd0bR1BORcLV9cm3xRxZ6UVMVvCniFOFeDyrXkvCS/g/ghZJxIHWbiR5x65Mi8jbq Y12bxshHcvuqf8c5eLDHHik34DCAfHamojyo8= 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=dmLB70XfR2J1D03CPPvqliqiD+PkiFMaZcieUMY43lg=; b=W4rj57FQQtxAdx8Y+bAxjel+qqvUMaNN47g9Umsg7H7XQ/M8dDPKwbnIKT+ul/DO2s lzF7OcBUkbhhcHlhtfM1T+/RUHH+alNdMo7pva+z9I2XRCFiobYKN0f5z1qJEtWKphyj fLsW2a3X0dS+iHYDN3dqfghdjjaUM0HxnlArrmXRmzWtrLLHl4S5S7vQtMKn07UyEs3z 6QJd/HkIk06pBH9j/KVtvnR9SLEGblgVyDiTnIoMFt932LOTjge4dL+6WqKAFIHV/AaK PbKCNonDVveKoMrxPNqXheZK26F8OEGhFWGtSh+KjVPMm88dXIK8BkLA/aKyVUdr135N /EEA== X-Gm-Message-State: AHQUAuZF51g3z+um95N1a0p7UWLb+HgfhOWyzS7ZIuBwIzJOxXWI4YB8 NOcVBRhU0uWv9JEdsBcIvgBo7w== X-Google-Smtp-Source: AHgI3IbHhb1emtbzhHKeCm+L56KqhBW7mFSfErni09bP9cRLuonoxPPLn1mJD0iOb9MTS6ldkEZmzQ== X-Received: by 2002:a63:e915:: with SMTP id i21mr1455445pgh.409.1550172788374; Thu, 14 Feb 2019 11:33:08 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id o23sm10808832pfa.140.2019.02.14.11.33.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:33:07 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 05/10] drm/sun4i: sun6i_mipi_dsi: Simplify drq to support all modes Date: Fri, 15 Feb 2019 01:02:32 +0530 Message-Id: <20190214193236.7504-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214193236.7504-1-jagan@amarulasolutions.com> References: <20190214193236.7504-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_113309_662076_DC71353D X-CRM114-Status: GOOD ( 14.80 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, 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 Allwinner MIPI DSI drq has enable mode bit and set bits. 1) drq for non-burst, with front porch less than 20 would need to set both enable mode bit and set bits. 2) drq for non-burst, with front porch greater or equal to 20 would not require to do any drq bit setup. 3) drq for burst mode, would only need to set enable mode bit. This patch simplifies existing drq code by grouping into sun6i_dsi_get_drq and support all video modes. Signed-off-by: Jagan Teki Tested-by: Merlijn Wajer --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 39 ++++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index a4360aed17bf..ab95e2a873b5 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -355,6 +355,28 @@ 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; + + if (device->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) + return SUN6I_DSI_TCON_DRQ_ENABLE_MODE; + + 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 (SUN6I_DSI_TCON_DRQ_ENABLE_MODE | + SUN6I_DSI_TCON_DRQ_SET(drq)); + } + + return 0; +} + static u16 sun6i_dsi_setup_inst_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { @@ -399,21 +421,8 @@ 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_get_drq(dsi, mode)); } static void sun6i_dsi_setup_inst_loop(struct sun6i_dsi *dsi, From patchwork Thu Feb 14 19:32:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813655 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 1F8101390 for ; Thu, 14 Feb 2019 19:34:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D35A2E7BC for ; Thu, 14 Feb 2019 19:34:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 013CE2EB30; Thu, 14 Feb 2019 19:34: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=-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 8B3FE2E7BC for ; Thu, 14 Feb 2019 19:34:23 +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=8ReZo0pFYv3h0IM2E1cXhoGvv0AZBDmTWLiyB5ZtsBI=; b=I0ZLBEyINDttZh dU7WG//61xSSm+eh+S/ElacGpiZVR8N7rgDx7jM+OvDruX5fDbzsZranbAgXyisYo6GKcoIoaF6tX 7fV+/ZsB4KwSJH/s1NHNKmA1iA9eEg1ZDE9ar1Lv/RqMAkN2MurgRFGIkXQWTSDH50uZDSrpdlbQC nNtqU8e1qafnxqYR67isSyiiM666+iiAjcvftIQq5fgO7eMIgh8/2VTVnZUg0DffRtUKwioq7vUzo 9rFG/QaICuGDDc1Jd5v065vUSDaiGaUKA5zv912cKnHCUj/P8eBrvN+tPl5pln70zO3CkuEomatZV hQ6ml4VEoIIHTTILt/+w==; 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 1guMlv-00078l-Sy; Thu, 14 Feb 2019 19:34:11 +0000 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMky-0005sn-Iy for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:33:27 +0000 Received: by mail-pg1-x544.google.com with SMTP id d72so3549494pga.9 for ; Thu, 14 Feb 2019 11:33: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=2IvGrusmnL/Aou1wugSnS6px5st/Z0p64m7B6OiPnzc=; b=Fi8MqaPcIxGKR7Yzp0F8zn6F1VZ/N22K3AfaYUJXqdIeKAlYZPwmHaiFjwjRCcB0Kt 2fEzYBYvqfk3C6DASFb+0QLNeEIxsuP4g0pJxBPetZpJnilhPokZgiBKz/DHMFJAiB8X dMEUBFpENR3eyuV/myAH9aCFmqWwERt8EXQ2c= 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=2IvGrusmnL/Aou1wugSnS6px5st/Z0p64m7B6OiPnzc=; b=oJk5S+uibBW/ftEMXYIh813xRiWD7kDtDNQ4JgC9n5IDByOJnOHhAsJzOjXz5g075y yrdY2JSnzAeg4W7SVjUivMOG/FplfVev94ss3mYbPrpSypYlRZz2HjI+o3zj+JZ7Hryl z/SoS2ch4W/JrJIpSbk4Tl4Nb+eUEt9Csr+rYE6pGObY+UMvn9P0artyjImCwRri7Jc3 rn/PdG8Dpa/t9F+zWJO6A8Bz/8TIpS6d4jejj+uiG3mtTgfToGI/t7O9aZgmmohv+55e LJUK7ciWtrFsrjP2AvHZ2e0/5AaMOmekqYklg+YswL9+NEdcEWSi2NNvftyk/IUWYA9W 8sLQ== X-Gm-Message-State: AHQUAuarp1sD6zmC9r2vTZ2MylpTi7Hx+kU24TO4dA+V5gh0cUhzgLBS eACbGYN0iFVcRMOEGF3EhqbK6A== X-Google-Smtp-Source: AHgI3Ib+1+e8H9z4Pwke0tlc8r+YEYJdjpJ38IlWiXWurtSImc7BJmn9yEj1Vf3/xNFL5r+kAJ2fuQ== X-Received: by 2002:a63:e410:: with SMTP id a16mr1483811pgi.28.1550172791847; Thu, 14 Feb 2019 11:33:11 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id o23sm10808832pfa.140.2019.02.14.11.33.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:33:11 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 06/10] drm/sun4i: tcon: Export get tcon0 routine Date: Fri, 15 Feb 2019 01:02:33 +0530 Message-Id: <20190214193236.7504-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214193236.7504-1-jagan@amarulasolutions.com> References: <20190214193236.7504-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_113313_195329_3493A8A5 X-CRM114-Status: GOOD ( 13.67 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, 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 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. Since tcon0 probe is already available, via sun4i_get_tcon0 function, export the same instead of probing tcon explicitly. Signed-off-by: Jagan Teki Tested-by: Merlijn Wajer --- 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 7136fc91c603..4bb36ceb786b 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 b5214d71610f..a52696db14a5 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -274,6 +274,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 Thu Feb 14 19:32:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10813657 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 A15E313B5 for ; Thu, 14 Feb 2019 19:34:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 885112E7BC for ; Thu, 14 Feb 2019 19:34:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C23D2EB30; Thu, 14 Feb 2019 19:34:29 +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 2747A2E7BC for ; Thu, 14 Feb 2019 19:34:29 +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=JpqjtAwRD6Omksc7BEVmyVTWxe6uHvDir4nzQtSrVC4=; b=FdG6uyFY/RUo+R Rvx/cqFT4eJQ84nkcAryLJr+FKnvXQNI/u294sJwMeJDMsTiikz04/O3ULsrLRclocYUBXOBRTL6Q k5wVUs8aloVXi3AYF3OH5UFg3x5v9V2SNdNXobAKpPLm2bdht0GAtD1c3lpK9Admcms05FiPk1Qcf VAzSBeOETHBa69tFHfVD+jRCsIi4fXDckIWAevT97TWQOutZDnldzRrazq1Jcev40oAAiA59/vapn FqXmTTVHlMoonF9kq5Q1EQ6+SRLrFIMjE4TThn9QVjr147acNSNzu3MJxLwA9rqK70tlfopVmSYWz QXxWOI+XW1+9OnYtPQLA==; 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 1guMm6-0007NI-MU; Thu, 14 Feb 2019 19:34:22 +0000 Received: from mail-pl1-x644.google.com ([2607:f8b0:4864:20::644]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMl1-0005y0-SU for linux-arm-kernel@lists.infradead.org; Thu, 14 Feb 2019 19:33:37 +0000 Received: by mail-pl1-x644.google.com with SMTP id r14so3647056pls.12 for ; Thu, 14 Feb 2019 11:33: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=K6AGEDEznrcyIAQu7pFk0JzPvtPdj8NLMH+33kB6pi0=; b=SGW1B5akvXzvsxDyeejD9mmfcNx8ja4vu84TPtTlU19Xk9kLsVx4nL/ePLdO27zelG 6h7fFzxs/YzTGWdvUJYojyW80NIZGRAFmi5o5GhNhlUyaJqJpACVXAC4noTN55OZuQBD DmlhgD/fLzNgau6GvLRzm2wq0EhPXaMSxBZKw= 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=K6AGEDEznrcyIAQu7pFk0JzPvtPdj8NLMH+33kB6pi0=; b=fT7UaD+iklM3QoHUyss3gW5sqjDhh4UyJcV+4rYO5Fq7dhdGlt3X1UWvgbeMUR1coy p9w135iLqNjEWSo8wiYjWtFCKH6Kwgzb1pkja6olSR7KXbji9BrLaBw7SPX2kSDKbDSl yUHcaDf4JlNKQBSgwBFpLFYRgDIdpwyfcNN8kKGN05GjR16Y4OQCSql2OQ8ryRGDbLMa GBdbHoHAQHf4vy1hMSytlElJnYRdPWmBVtJM0tBP73vJ7I+yDcEvXJIKlW3IF5XS58sf NpsRtVFKXLiqacKo4Ag0ybAuaioO2sqgxcQkiQM0z5ZjVqJE4KO3fmRu6ok6g3jA+EWQ yJng== X-Gm-Message-State: AHQUAuacEAF7JTnoAAuch1CuggBNAxUmjez87RehC58DQsKKzPh+4Dsb 0LhZ/YxyqTtGkWWl4JR7xKWETg== X-Google-Smtp-Source: AHgI3IbudX+KX/Xlne9o+VRFvpKSm10YpgxqmC05vhloYEmTQVaMjo2QK/RRqs8kz1huw4dQFI88yQ== X-Received: by 2002:a17:902:b60a:: with SMTP id b10mr5589873pls.303.1550172795331; Thu, 14 Feb 2019 11:33:15 -0800 (PST) Received: from localhost.localdomain ([115.97.184.151]) by smtp.gmail.com with ESMTPSA id o23sm10808832pfa.140.2019.02.14.11.33.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Feb 2019 11:33:14 -0800 (PST) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai Subject: [PATCH v8 07/10] drm/sun4i: sun6i_mipi_dsi: Probe tcon0 during dsi_bind Date: Fri, 15 Feb 2019 01:02:34 +0530 Message-Id: <20190214193236.7504-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190214193236.7504-1-jagan@amarulasolutions.com> References: <20190214193236.7504-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190214_113316_453382_C7676955 X-CRM114-Status: GOOD ( 13.23 ) 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: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Michael Trimarchi , linux-amarula@amarulasolutions.com, 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 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 Tested-by: Merlijn Wajer --- 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 ab95e2a873b5..62b4c822bf18 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