From patchwork Tue Oct 23 15:50:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10653275 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 6F48513A9 for ; Tue, 23 Oct 2018 15:51:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57EBE29FB8 for ; Tue, 23 Oct 2018 15:51:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 55AFC29F90; Tue, 23 Oct 2018 15:51:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable 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 4531F29F71 for ; Tue, 23 Oct 2018 15:51:12 +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: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:In-Reply-To:References: List-Owner; bh=UpORiBRhOE0CS6Ns6VqqvlRuXELVVLj6uaMqttT0tVM=; b=PfWMs41pgbeYWx /JS54raq554cjWJW11uLumByF9BnJNWAt9SQgs/tzIRzz8m/fqBp+g0q2GXCCPfL5WhI42ga3zi2L PsWagEYTRUCOqd7G5Vs5EwAauSB7wOiahddOUvK5N7i6BN2LgPtw4jHOVW7dg8TNvRKGOdJFsnnNU 8+w72KJ8iOIalUoDLUiGXhtvUCizQocGBNWA7QSeP/O9u585oDl24Us7uq0LjYb5eKo5H9ux3QIgL gF0GK3C+Gq0n6UCUNFKY6rCm5XmRyH47eHNVKFJGiPpJIPswMtDFE5Si2P5Ln1qx7iexli7QqKNXc z11mPDR1ADIpJZ2UtFcQ==; 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 1gEyxX-0004DU-7Q; Tue, 23 Oct 2018 15:51:07 +0000 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gEyxT-0004Bt-9l for linux-arm-kernel@lists.infradead.org; Tue, 23 Oct 2018 15:51:05 +0000 Received: by mail-pg1-x541.google.com with SMTP id f8-v6so854744pgq.5 for ; Tue, 23 Oct 2018 08:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fm/1JcRA96PqCYEdOfnDPHVhFDIrc5YYnKuJMBWFkjo=; b=pp5zt4Gd+K4SdC1Yb2R7Sz3VlYAOD+oc0SA9ZFGHcnzxgrn4S4sjn8X7EHeo/PQVAO 8jXMbAPwX2DKQ/+Aka5+e4yde96C7Rk0M6YC51hbWUnrq73jTxCbW1Ftbb1HKp3bI8iS U71bzSemxCCYmcLXc8hc/lY3WSomJpFm8V7HY= 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:mime-version :content-transfer-encoding; bh=fm/1JcRA96PqCYEdOfnDPHVhFDIrc5YYnKuJMBWFkjo=; b=FD2a9KPV/pXsSkp1kEPPU/bpwZ2uiGULl3AXHjx/liATqlnUrzg3KW43cQFLi2weTR x7t42TsBpRMkkCshKeBTRZKtowhthGzmfT5DiPdjPuLcFWfa3rJeriEiIQkyh98pjIRN fIlmS83tVV+A1+tpOB0Ap6A0xGGvEHTbkUy1IQcpxOQ183dHIvV9wLKStY95nCJgL9B/ E+ioA48cMrVidqb+tCldv7woxZLAJj//SdF/37882GPXiw4t38+0zzCRofAmzMUanQ/2 KnkHpNwEAZ0aongWa216KCqcD84DyN0hBUirpB+VOh/5K65exL7pG/UmDSQYRsvRVIla D3qg== X-Gm-Message-State: AGRZ1gIIDYMKpUa03eBVN/ju6o11MpeRVpnoH79eeWh3Vn8/1ZTQfEkd 5W5BUeyvdD1O4leSQwRK5YDiYA== X-Google-Smtp-Source: AJdET5fVSC+l7DnnXw2SYK/a8NSjpv5G4K3DJST6Va/JfYtSBsmF/rnSKyY+XhdXVVHrZRB3iAeilQ== X-Received: by 2002:a63:8d44:: with SMTP id z65mr4648355pgd.57.1540309852048; Tue, 23 Oct 2018 08:50:52 -0700 (PDT) Received: from localhost.localdomain ([27.7.51.1]) by smtp.gmail.com with ESMTPSA id o75-v6sm7442829pfg.0.2018.10.23.08.50.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Oct 2018 08:50:51 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Icenowy Zheng , Jernej Skrabec , Vasily Khoruzhick , Rob Herring , Mark Rutland , Catalin Marinas , Will Deacon , David Airlie , dri-devel@lists.freedesktop.org, Michael Turquette , Stephen Boyd , linux-clk@vger.kernel.org, Michael Trimarchi , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Subject: [PATCH v2 00/15] drm/sun4i: Allwinner A64 MIPI-DSI support Date: Tue, 23 Oct 2018 21:20:20 +0530 Message-Id: <20181023155035.9101-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181023_085103_345490_5EDE0DB3 X-CRM114-Status: GOOD ( 15.74 ) 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 This series add MIPI-DSI support on Allwinner A64. The same A31 controller is reused and tweaked for A64 since the register space for both SoC's look same. A64 PLL_MIPI look difficult to set the proper dclk nkm dividers with existing clock driver. But Setting the dclk on panel set to 55MHz (BSP says 30MHz) and min PLL_MIPI rate used as 30MHz. This logic make proper rounded rate by sun4i_dclk_round_rate which eventually working. 24 / 4 * 55000 = 330000 (24 bit format with 4 lane and 55MHz clock) [ 2.360344] sun4i-drm display-engine: bound 1100000.mixer (ops sun8i_mixer_ops) [ 2.367899] sun4i_dclk_recalc_rate: val = 1, rate = 594000000 [ 2.373827] sun4i-drm display-engine: No panel or bridge found... RGB output disabled [ 2.381666] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops sun4i_tcon_ops) [ 2.389691] sun4i-drm display-engine: bound 1ca0000.dsi (ops sun6i_dsi_ops) [ 2.396653] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 2.403266] [drm] No driver support for vblank timestamp query. [ 2.411632] sun4i_dclk_round_rate: min_div = 4 max_div = 127, rate = 55000000 [ 2.411693] ideal = 220000000, rounded = 0 [ 2.411698] ideal = 275000000, rounded = 0 [ 2.411716] ideal = 330000000, rounded = 330000000 [ 2.411720] sun4i_dclk_round_rate: div = 6 rate = 55000000 [ 2.411725] sun4i_dclk_round_rate: min_div = 4 max_div = 127, rate = 55000000 [ 2.411729] ideal = 220000000, rounded = 0 [ 2.411732] ideal = 275000000, rounded = 0 [ 2.411750] ideal = 330000000, rounded = 330000000 [ 2.411753] sun4i_dclk_round_rate: div = 6 rate = 55000000 [ 2.411790] sun4i_dclk_recalc_rate: val = 1, rate = 330000000 [ 2.411794] sun4i_dclk_recalc_rate: val = 1, rate = 330000000 [ 2.411817] NKM: rate = 330000000 [ 2.411819] NKM: parent_rate = 297000000 [ 2.411821] NKM: _nkm.n = 5 [ 2.411823] NKM: _nkm.k = 2 [ 2.411825] NKM: _nkm.m = 9 [ 2.412175] sun4i_dclk_set_rate div 6 [ 2.412182] sun4i_dclk_recalc_rate: val = 6, rate = 55000000 But the same logic seems "not working" on 2-lane panel where dclk on panel set to 27.5MHz(BSP says 29MHz) 24/2 * 27500 = 330000 (24 bit format with 2 lane and 27.5 MHz clock) [ 1.877154] sun4i-drm display-engine: bound 1100000.mixer (ops sun8i_mixer_ops) [ 1.884695] sun4i_dclk_recalc_rate: val = 1, rate = 594000000 [ 1.890659] sun4i-drm display-engine: No panel or bridge found... RGB output disabled [ 1.898515] sun4i-drm display-engine: bound 1c0c000.lcd-controller (ops sun4i_tcon_ops) [ 1.906563] sun4i-drm display-engine: bound 1ca0000.dsi (ops sun6i_dsi_ops) [ 1.913542] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013). [ 1.920173] [drm] No driver support for vblank timestamp query. [ 1.929330] sun4i_dclk_round_rate: min_div = 4 max_div = 127, rate = 27500000 [ 1.929388] ideal = 110000000, rounded = 0 [ 1.929392] ideal = 137500000, rounded = 0 [ 1.929396] ideal = 165000000, rounded = 0 [ 1.929400] ideal = 192500000, rounded = 0 [ 1.929403] ideal = 220000000, rounded = 0 [ 1.929407] ideal = 247500000, rounded = 0 [ 1.929410] ideal = 275000000, rounded = 0 [ 1.929429] ideal = 302500000, rounded = 297000000 [ 1.929446] ideal = 330000000, rounded = 330000000 [ 1.929449] sun4i_dclk_round_rate: div = 12 rate = 27500000 [ 1.929454] sun4i_dclk_round_rate: min_div = 4 max_div = 127, rate = 27500000 [ 1.929458] ideal = 110000000, rounded = 0 [ 1.929462] ideal = 137500000, rounded = 0 [ 1.929465] ideal = 165000000, rounded = 0 [ 1.929469] ideal = 192500000, rounded = 0 [ 1.929472] ideal = 220000000, rounded = 0 [ 1.929476] ideal = 247500000, rounded = 0 [ 1.929479] ideal = 275000000, rounded = 0 [ 1.929496] ideal = 302500000, rounded = 297000000 [ 1.929536] ideal = 330000000, rounded = 330000000 [ 1.929539] sun4i_dclk_round_rate: div = 12 rate = 27500000 [ 1.929576] sun4i_dclk_recalc_rate: val = 1, rate = 330000000 [ 1.929580] sun4i_dclk_recalc_rate: val = 1, rate = 330000000 [ 1.929613] NKM: rate = 330000000 [ 1.929616] NKM: parent_rate = 297000000 [ 1.929619] NKM: _nkm.n = 5 [ 1.929620] NKM: _nkm.k = 2 [ 1.929622] NKM: _nkm.m = 9 [ 1.929966] sun4i_dclk_set_rate div 12 [ 1.929974] sun4i_dclk_recalc_rate: val = 12, rate = 27500000 [ 1.957513] random: fast init done [ 1.967893] mmc0: new high speed SDIO card at address 0001 [ 1.971835] mmc1: new DDR MMC card at address 0001 [ 1.973250] mmcblk1: mmc1:0001 8GND3R 7.28 GiB [ 1.974391] mmcblk1boot0: mmc1:0001 8GND3R partition 1 4.00 MiB [ 1.975528] mmcblk1boot1: mmc1:0001 8GND3R partition 2 4.00 MiB [ 1.982660] mmcblk1: p1 p2 p3 p4 p5 p6 [ 3.221053] ------------[ cut here ]------------ [ 3.221059] [CRTC:36:crtc-0] vblank wait timed out [ 3.221136] WARNING: CPU: 2 PID: 42 at drivers/gpu/drm/drm_atomic_helper.c:1387 drm_atomic_helper_ wait_for_vblanks.part.9+0x294/0x2a0 [ 3.221139] Modules linked in: [ 3.221151] CPU: 2 PID: 42 Comm: kworker/2:1 Not tainted 4.19.0-rc8-next-20181016-00024-g11217d38f d10-dirty #5 [ 3.221154] Hardware name: Amarula A64-Relic (DT) [ 3.221166] Workqueue: events deferred_probe_work_func [ 3.221173] pstate: 60000005 (nZCv daif -PAN -UAO) [ 3.221179] pc : drm_atomic_helper_wait_for_vblanks.part.9+0x294/0x2a0 [ 3.221185] lr : drm_atomic_helper_wait_for_vblanks.part.9+0x294/0x2a0 [ 3.221187] sp : ffff0000095fb3e0 [ 3.221190] x29: ffff0000095fb3e0 x28: 0000000000000001 [ 3.221196] x27: 0000000000000000 x26: 0000000000000000 [ 3.221202] x25: ffff80003c057000 x24: ffff80003bdbb000 [ 3.221207] x23: 0000000000000001 x22: 0000000000000030 [ 3.221213] x21: 0000000000000001 x20: ffff80003bdbc018 [ 3.221218] x19: 0000000000000000 x18: ffffffffffffffff [ 3.221224] x17: 0000000000000000 x16: 0000000000000000 [ 3.221229] x15: ffff0000091d96c8 x14: 00000000fffffff0 [ 3.221235] x13: ffff000009340ba0 x12: ffff0000091f1348 [ 3.221240] x11: ffff0000091f1000 x10: ffff000009340000 [ 3.221246] x9 : 0000000000000000 x8 : 0000000000000000 [ 3.221251] x7 : 0000000000000000 x6 : 000000000dc21395 [ 3.221256] x5 : 0000000000000000 x4 : 0000000000000000 [ 3.221262] x3 : ffffffffffffffff x2 : ffff0000091f1378 [ 3.221267] x1 : de241ee6737e7400 x0 : 0000000000000000 [ 3.221273] Call trace: [ 3.221279] drm_atomic_helper_wait_for_vblanks.part.9+0x294/0x2a0 [ 3.221285] drm_atomic_helper_commit_tail_rpm+0x60/0x78 [ 3.221289] commit_tail+0x44/0x78 [ 3.221294] drm_atomic_helper_commit+0xcc/0x148 [ 3.221301] drm_atomic_commit+0x48/0x58 [ 3.221309] restore_fbdev_mode_atomic+0x17c/0x1e8 [ 3.221316] restore_fbdev_mode+0x50/0x190 [ 3.221322] drm_fb_helper_restore_fbdev_mode_unlocked+0x70/0xc8 [ 3.221328] drm_fb_helper_set_par+0x2c/0x60 [ 3.221335] fbcon_init+0x4d8/0x528 [ 3.221341] visual_init+0xb0/0x108 [ 3.221346] do_bind_con_driver+0x1d0/0x3b0 [ 3.221351] do_take_over_console+0x148/0x1d8 [ 3.221355] do_fbcon_takeover+0x6c/0xf0 [ 3.221361] fbcon_event_notify+0x9a4/0x9d0 [ 3.221370] notifier_call_chain+0x50/0x90 [ 3.221376] __blocking_notifier_call_chain+0x4c/0x90 [ 3.221382] blocking_notifier_call_chain+0x14/0x20 [ 3.221390] fb_notifier_call_chain+0x1c/0x28 [ 3.221396] register_framebuffer+0x1ec/0x320 [ 3.221402] __drm_fb_helper_initial_config_and_unlock+0x22c/0x3b0 [ 3.221408] drm_fb_helper_fbdev_setup+0xd4/0x1f8 [ 3.221414] drm_fbdev_cma_init+0x9c/0xe8 [ 3.221420] drm_fb_cma_fbdev_init+0xc/0x20 [ 3.221426] sun4i_framebuffer_init+0x48/0x58 [ 3.221431] sun4i_drv_bind+0x14c/0x1a0 [ 3.221436] try_to_bring_up_master+0x144/0x1a8 [ 3.221440] component_add+0x98/0x160 [ 3.221447] sun8i_mixer_probe+0x18/0x20 [ 3.221453] platform_drv_probe+0x50/0xa8 [ 3.221458] really_probe+0x1e4/0x2a8 [ 3.221464] driver_probe_device+0x58/0x100 [ 3.221470] __device_attach_driver+0x9c/0xf8 [ 3.221475] bus_for_each_drv+0x70/0xc8 [ 3.221480] __device_attach+0xdc/0x138 [ 3.221486] device_initial_probe+0x10/0x18 [ 3.221492] bus_probe_device+0x94/0xa0 [ 3.221497] deferred_probe_work_func+0x6c/0xa0 [ 3.221505] process_one_work+0x1c8/0x318 [ 3.221511] worker_thread+0x234/0x428 [ 3.221516] kthread+0xf8/0x128 [ 3.221523] ret_from_fork+0x10/0x18 [ 3.221527] ---[ end trace af12203776f67ca9 ]--- [ 13.277055] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:36:crtc-0] flip_done timed out [ 23.517053] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:38:DSI-1] flip_done t imed out [ 33.757052] [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-1] flip_done tim ed out [ 33.813049] ------------[ cut here ]------------ [ 33.813053] [CRTC:36:crtc-0] vblank wait timed out Any suggestions, Jagan. Jagan Teki (15): clk: sunxi-ng: a64: Fix gate bit of DSI DPHY clk: sunxi-ng: Add check for minimal rate to NKM PLLs clk: sunxi-ng: Add check for maximum rate to NKM PLLs drm/sun4i: sun6i_mipi_dsi: Add Allwinner A64 MIPI DSI support dt-bindings: sun6i-dsi: Add compatible for A64 MIPI DSI drm/sun4i: sun6i_mipi_dsi: Add DSI Generic short write 2 param transfer drm/sun4i: sun6i_mipi_dsi: Fix VBP size calculation drm/sun4i: sun6i_mipi_dsi: Fix TCON DRQ set bits drm/sun4i: sun6i_mipi_dsi: Refactor vertical video start delay dt-bindings: panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge clk: sunxi-ng: a64: Add min and max rate for PLL_MIPI dt-bindings: sun6i-dsi: Add compatible for A64 DPHY arm64: dts: allwinner: a64: Add DSI pipeline arm64: dts: allwinner: bananapi-m64: Bananapi S070WV20-CT16 DSI panel .../panel/bananapi,s070wv20-ct16-icn6211.txt | 21 ++ .../bindings/display/sunxi/sun6i-dsi.txt | 3 +- .../dts/allwinner/sun50i-a64-bananapi-m64.dts | 42 +++ arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 45 +++ drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 4 +- drivers/clk/sunxi-ng/ccu_nkm.c | 14 + drivers/clk/sunxi-ng/ccu_nkm.h | 2 + drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + .../panel/panel-bananapi-s070wv20-icn6211.c | 336 ++++++++++++++++++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 68 +++- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 5 + 12 files changed, 532 insertions(+), 18 deletions(-) create mode 100644 Documentation/devicetree/bindings/display/panel/bananapi,s070wv20-ct16-icn6211.txt create mode 100644 drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c