From patchwork Mon May 20 09:03:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950615 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 69744933 for ; Mon, 20 May 2019 09:07:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 578A328787 for ; Mon, 20 May 2019 09:07:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C3C3287B1; Mon, 20 May 2019 09:07: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 9380028787 for ; Mon, 20 May 2019 09:07:28 +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=tucaqFvyhrh2JzGnU4OcDLubrKuEtkh7jeKt2haZm4k=; b=uMtQG2wEq/mWty s1kE0czdLMCA8/pw3rdTBRkZFOBiJf4CeACdVHbyR+urpjPuswYzRW0yIbzxz6UZ5A9dGKRXYsAI5 z+iRijspt4/OQ1qkUnWqMtyWi7eyufrSWD1Dpn1yitEElbCxFfrwGhIa2I/fM3iPc+ekrnI4ObzHK T0gZBKiwSYI74VQ0cstp5Xbkwb91Y8kgN5LDgY16vi2TySBWxLwUJJpZzphgJewQSJr8GW6Fq0Mnd n5vWkfNttRQ+1+vr1MgtRVziK70sfbZbLgUNLeGAxa5EBjNC3xNBlex0Ll2/xaT6//OQGKGvXV3zu LyReN5aaCHqaO2SNeJlw==; 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 1hSeGU-0002TL-Uj; Mon, 20 May 2019 09:07:26 +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 1hSeGM-0002IX-5y for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:07:21 +0000 Received: by mail-pg1-x541.google.com with SMTP id z16so6473300pgv.11 for ; Mon, 20 May 2019 02:07:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f8TMcXIdAGJzNv/R9JRXO6fjRcOJSJIXQUyqy5meT6c=; b=WCUUST4dq7ijeKPPxtUbr6aO58WNqDBsBlXXSQOyJpeIfn6f2NuzttBKnDaOZig/Ux yzsGhc6TWQwa/YBgxrQ+Gxxmu5oo4FVdpv6uYcCEhs9nQx7tUqkL4AgNvXd4xik2e9Ui vl6ja/ZwFJ8M7INXF3s66b9ZWiXctkZ9OvVjU= 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=f8TMcXIdAGJzNv/R9JRXO6fjRcOJSJIXQUyqy5meT6c=; b=TDCLUtK5wHWRFt1Lt2YMX81mvHZf3khMjHSp0M3iAcpYZDIQw69F7LH8LPWj8H5TZK sJrWeW4fBgRVpgMQ59DqQsOzw3kQFEk20DEDHa2O+70W8+SQnLe43wRjjK1Fffj936vf yaPKsLVqCK9gNvRQCm6oWHaY0PFFNrE9DiKrNOIxHnYgxsRHOjsVLLjIX2OceC5N4TJm 7VtKX9BwQkokzKfhJymIhgHv3uPv4hccd6Qf557aP8sYOgjlDOcFnaTXhCFyv8ixhHky Yd1ychI5ySCJTCUElb1QadivDb71H2J9sizJeVdGbG6DQxQQgcZP2t5oWhhUTp5Hseyi ZR2A== X-Gm-Message-State: APjAAAWTY/Ml6MM0kdEYsoQeI8iqfcaM8SUKcUrHjjBPgkW/Twpq1MAX j/3xtmP7ia0G7x8A0IHlZqDscw== X-Google-Smtp-Source: APXvYqyKk8wCu7LBJcthmTjkBK6xP9b9V3c5tRC6Ze10fUn4I/KWpBr8obPsSADT+KChssojzWHjfg== X-Received: by 2002:aa7:93c6:: with SMTP id y6mr25628819pff.0.1558343237216; Mon, 20 May 2019 02:07:17 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:16 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 01/11] drm/sun4i: dsi: Fix TCON DRQ set bits Date: Mon, 20 May 2019 14:33:08 +0530 Message-Id: <20190520090318.27570-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020718_464725_76C3B330 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 According to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h the current driver is trying to include sync timings along with front porch value while checking and computing drq set bits in non-burst mode. mode->hsync_end - mode->hdisplay => horizontal front porch + sync With adding additional sync timings, the dsi controller leads to wrong drq set bits for "bananapi,s070wv20-ct16" panel which indeed trigger panel flip_done timed out as: WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0 [CRTC:46:crtc-0] vblank wait timed out Modules linked in: CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00026-g01f0c75b902d-dirty #13 Hardware name: Allwinner sun8i Family Workqueue: events deferred_probe_work_func [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x84/0x98) [] (dump_stack) from [] (__warn+0xfc/0x114) [] (__warn) from [] (warn_slowpath_fmt+0x44/0x68) [] (warn_slowpath_fmt) from [] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0) [] (drm_atomic_helper_wait_for_vblanks.part.1) from [] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c) [] (drm_atomic_helper_commit_tail_rpm) from [] (commit_tail+0x40/0x6c) [] (commit_tail) from [] (drm_atomic_helper_commit+0xbc/0x128) [] (drm_atomic_helper_commit) from [] (restore_fbdev_mode_atomic+0x1cc/0x1dc) [] (restore_fbdev_mode_atomic) from [] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0) [] (drm_fb_helper_restore_fbdev_mode_unlocked) from [] (drm_fb_helper_set_par+0x30/0x54) [] (drm_fb_helper_set_par) from [] (fbcon_init+0x560/0x5ac) [] (fbcon_init) from [] (visual_init+0xbc/0x104) [] (visual_init) from [] (do_bind_con_driver+0x1b0/0x390) [] (do_bind_con_driver) from [] (do_take_over_console+0x13c/0x1c4) [] (do_take_over_console) from [] (do_fbcon_takeover+0x74/0xcc) [] (do_fbcon_takeover) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__blocking_notifier_call_chain+0x48/0x60) [] (__blocking_notifier_call_chain) from [] (blocking_notifier_call_chain+0x18/0x20) [] (blocking_notifier_call_chain) from [] (register_framebuffer+0x1e0/0x2f8) [] (register_framebuffer) from [] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c) [] (__drm_fb_helper_initial_config_and_unlock) from [] (drm_fbdev_client_hotplug+0xe8/0x1b8) [] (drm_fbdev_client_hotplug) from [] (drm_fbdev_generic_setup+0x88/0x118) [] (drm_fbdev_generic_setup) from [] (sun4i_drv_bind+0x128/0x160) [] (sun4i_drv_bind) from [] (try_to_bring_up_master+0x164/0x1a0) [] (try_to_bring_up_master) from [] (__component_add+0x94/0x140) [] (__component_add) from [] (sun6i_dsi_probe+0x144/0x234) [] (sun6i_dsi_probe) from [] (platform_drv_probe+0x48/0x9c) [] (platform_drv_probe) from [] (really_probe+0x1dc/0x2c8) [] (really_probe) from [] (driver_probe_device+0x60/0x160) [] (driver_probe_device) from [] (bus_for_each_drv+0x74/0xb8) [] (bus_for_each_drv) from [] (__device_attach+0xd0/0x13c) [] (__device_attach) from [] (bus_probe_device+0x84/0x8c) [] (bus_probe_device) from [] (deferred_probe_work_func+0x64/0x90) [] (deferred_probe_work_func) from [] (process_one_work+0x204/0x420) [] (process_one_work) from [] (worker_thread+0x274/0x5a0) [] (worker_thread) from [] (kthread+0x11c/0x14c) [] (kthread) from [] (ret_from_fork+0x14/0x2c) Exception stack(0xde539fb0 to 0xde539ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace b57eb1e5c64c6b8b ]--- random: fast init done [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out But according to Allwinner A33, A64 BSP code [1] [3] the TCON DRQ for non-burst DSI mode can be computed based on "horizontal front porch" value only (no sync timings included). Detailed evidence for drq set bits based on A33 BSP [1] [2] => panel->lcd_ht - panel->lcd_x - panel->lcd_hbp - 20 => (tt->hor_front_porch + lcdp->panel_info.lcd_hbp + lcdp->panel_info.lcd_x) - panel->lcd_x - panel->lcd_hbp - 20 => tt->hor_front_porch - 20 Which is mode->hsync_start - mode->hdisplay as per "DRM kernel-internal display mode structure" in include/drm/drm_modes.h So, This patch update the DRQ set bits to use front porch value. [3] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/de_dsi.c#L774 [2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2031 [1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L851 Tested-by: Merlijn Wajer 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 a9ed87956f6d..c5bec0096b7c 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -436,9 +436,9 @@ static void sun6i_dsi_setup_burst(struct sun6i_dsi *dsi, SUN6I_DSI_BURST_LINE_SYNC_POINT(SUN6I_DSI_SYNC_POINT)); val = SUN6I_DSI_TCON_DRQ_ENABLE_MODE; - } else if ((mode->hsync_end - mode->hdisplay) > 20) { + } else 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 Mon May 20 09:03:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950623 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 BECBB1390 for ; Mon, 20 May 2019 09:07:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB3A1286EE for ; Mon, 20 May 2019 09:07:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9F5A7287B8; Mon, 20 May 2019 09:07:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F1F44286EE for ; Mon, 20 May 2019 09:07:45 +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=MNFX9nLfdF0d7AemFHVz77pnVi2pNXKgQG6oo1b8Cv4=; b=izrll/3f4kvIDh jHOLAlcz/f1NIwrPWAPHunXcTF4f0MI87jPtXtYEkLdf7g/kG2yJ+rT+yj34gyXrQdQQqkiTCT8vo G1SVBGpuYY8uIUuDUpmappdQ4nXNAXx5Q81uA0G/bw8mvEsR6Vvk6vqXMRLfYz93Z8t48CU2t2TOf gpk5+5M32C6UDiT0RHgohvFvFp5J4vOtsUJGvMM2wWQ1tiCsOb3abqv0IQgHuVMbyeby49I4RjeT7 UPqV6WR1MqlKQBXROviiBwkJQyQVXk4eKX8ZGkJJw/vUc16Nqkn2j7DXmHJc0YSCSJ8wI21WJZWga Iciw1wmIbS22tZEXazCA==; 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 1hSeGi-0002k9-2j; Mon, 20 May 2019 09:07:40 +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 1hSeGS-0002Rp-US for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:07:27 +0000 Received: by mail-pg1-x542.google.com with SMTP id z3so6482560pgp.8 for ; Mon, 20 May 2019 02:07:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=axjwgmFLRM1+L1ustb875bbTzYApAFo/Jx5LqGuNXAY=; b=Fk3DTqyrXSG8DMVkQ5jpdd51WKOTXKnsgFqEzAEtHchQc+G9zhS3xB1IG7609RXfVX q75/4k3vKdMrJbBa8X4VuV/51N1jOEQsaWSoW90Qjyt4YPbticQxegvVVGoPchYpQXoc 5I8nhBuj8pJEGKNFi7ISyYNWx8OZwjG9ZIjFM= 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=axjwgmFLRM1+L1ustb875bbTzYApAFo/Jx5LqGuNXAY=; b=e7B7ZDUI5Z4SFpzTBq2PaYadR/rmPWZPZQ9DdMIhnReaMwJHwMaQ5J1ZQVFd7zbECb 0oK1yzcuiMmX8fZL3Oy40mZhlJpyhllyAngzD1Xfo74lu5h6Yfu1ZJaUeyPwHD/Y2KbL QGyCU/VW7VQ4izwBC/+UTGeAhi9Wg9TIq9OFozVQIS/b781+LWMGSLnEkRRKy0CYvLXY PFghczvW7ZWzzVrGfiQnsjbcQ+xfQ6oaStspFdtOlLML9wSDzH9hoC5a6mSHioJSbdwR SsvOZy4suD43N3hyQXAVhhfdWBKHVPrMXxJBu2ZDmL5JaRrpqgubNJLQUIBwxnAGbao5 Gb/A== X-Gm-Message-State: APjAAAWMJq1NwI8A8rEzFoaEYCU4FZDZaRo+4EWW8ogUjsf8SnJdkVKR vbF8/hNhc2IxxNStdpM1bx7Gtg== X-Google-Smtp-Source: APXvYqwGbaQMkKz2uPiQZnp7HtOpLgYa6O0yTNOI9ya7HqDNUc3JIKXW23gSNYmCnGZT1fCWbNiB+w== X-Received: by 2002:a62:36c1:: with SMTP id d184mr57798189pfa.49.1558343243972; Mon, 20 May 2019 02:07:23 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:23 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 02/11] drm/sun4i: dsi: Update start value in video start delay Date: Mon, 20 May 2019 14:33:09 +0530 Message-Id: <20190520090318.27570-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020724_986160_3BE1DD49 X-CRM114-Status: GOOD ( 16.47 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 start value in video start delay computation done in below commit is as per the legacy bsp drivers/video/sunxi/legacy.. "drm/sun4i: dsi: Change the start delay calculation" (sha1: da676c6aa6413d59ab0a80c97bbc273025e640b2) This existing start delay computation gives start value of 35, for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as: WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0 [CRTC:46:crtc-0] vblank wait timed out Modules linked in: CPU: 0 PID: 31 Comm: kworker/0:1 Tainted: G W 5.1.0-next-20190514-00025-gf928bc7cc146 #15 Hardware name: Allwinner sun8i Family Workqueue: events deferred_probe_work_func [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x84/0x98) [] (dump_stack) from [] (__warn+0xfc/0x114) [] (__warn) from [] (warn_slowpath_fmt+0x44/0x68) [] (warn_slowpath_fmt) from [] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0) [] (drm_atomic_helper_wait_for_vblanks.part.1) from [] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c) [] (drm_atomic_helper_commit_tail_rpm) from [] (commit_tail+0x40/0x6c) [] (commit_tail) from [] (drm_atomic_helper_commit+0xbc/0x128) [] (drm_atomic_helper_commit) from [] (restore_fbdev_mode_atomic+0x1cc/0x1dc) [] (restore_fbdev_mode_atomic) from [] (drm_fb_helper_pan_display+0xac/0x1d0) [] (drm_fb_helper_pan_display) from [] (fb_pan_display+0xcc/0x134) [] (fb_pan_display) from [] (bit_update_start+0x14/0x30) [] (bit_update_start) from [] (fbcon_switch+0x3d8/0x4e0) [] (fbcon_switch) from [] (redraw_screen+0x174/0x238) [] (redraw_screen) from [] (fbcon_prepare_logo+0x3c4/0x400) [] (fbcon_prepare_logo) from [] (fbcon_init+0x3c8/0x5ac) [] (fbcon_init) from [] (visual_init+0xbc/0x104) [] (visual_init) from [] (do_bind_con_driver+0x1b0/0x390) [] (do_bind_con_driver) from [] (do_take_over_console+0x13c/0x1c4) [] (do_take_over_console) from [] (do_fbcon_takeover+0x74/0xcc) [] (do_fbcon_takeover) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__blocking_notifier_call_chain+0x48/0x60) [] (__blocking_notifier_call_chain) from [] (blocking_notifier_call_chain+0x18/0x20) [] (blocking_notifier_call_chain) from [] (register_framebuffer+0x1e0/0x2f8) [] (register_framebuffer) from [] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c) [] (__drm_fb_helper_initial_config_and_unlock) from [] (drm_fbdev_client_hotplug+0xe8/0x1b8) [] (drm_fbdev_client_hotplug) from [] (drm_fbdev_generic_setup+0x88/0x118) [] (drm_fbdev_generic_setup) from [] (sun4i_drv_bind+0x128/0x160) [] (sun4i_drv_bind) from [] (try_to_bring_up_master+0x164/0x1a0) [] (try_to_bring_up_master) from [] (__component_add+0x94/0x140) [] (__component_add) from [] (sun6i_dsi_probe+0x144/0x234) [] (sun6i_dsi_probe) from [] (platform_drv_probe+0x48/0x9c) [] (platform_drv_probe) from [] (really_probe+0x1dc/0x2c8) [] (really_probe) from [] (driver_probe_device+0x60/0x160) [] (driver_probe_device) from [] (bus_for_each_drv+0x74/0xb8) [] (bus_for_each_drv) from [] (__device_attach+0xd0/0x13c) [] (__device_attach) from [] (bus_probe_device+0x84/0x8c) [] (bus_probe_device) from [] (deferred_probe_work_func+0x64/0x90) [] (deferred_probe_work_func) from [] (process_one_work+0x204/0x420) [] (process_one_work) from [] (worker_thread+0x274/0x5a0) [] (worker_thread) from [] (kthread+0x11c/0x14c) [] (kthread) from [] (ret_from_fork+0x14/0x2c) Exception stack(0xde539fb0 to 0xde539ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace 755e10f62b83f396 ]--- Console: switching to colour frame buffer device 100x30 [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out But the expected start delay value is 1 which is confirmed from new bsp [2]. The important and unclear note on legacy and new bsp codes [1] [2] is both use similar start computation initially but it later reassign it to 1 in new bsp. Unfortunately we don't have any evidence or documentation for this reassignment to 1 in new bsp, but it is working with all supported panels in A33, A64. So, use the start as per new bsp code since it is working in all the supported panels. [2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L807 [1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/legacy/disp/de_bsp/de/ebios/de_dsi.c#L682 Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index c5bec0096b7c..b3ca85410b2c 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -364,7 +364,17 @@ static void sun6i_dsi_inst_init(struct sun6i_dsi *dsi, static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, struct drm_display_mode *mode) { - u16 start = clamp(mode->vtotal - mode->vdisplay - 10, 8, 100); + /** + * Allwinner legacy (drivers/video/sunxi/legacy), + * new (drivers/video/sunxi/disp/de/lowlevel_sun8iw5) bsp drivers + * are evaluating start as: + * + * vtotal - vdisplay - 10 + * + * but the new drivers are reassigning start to 1, which seems to be + * working in all supported panels as of now. + */ + u8 start = 1; u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; if (delay > mode->vtotal) From patchwork Mon May 20 09:03:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950633 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 F2CDE17D2 for ; Mon, 20 May 2019 09:08:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEA4A284B9 for ; Mon, 20 May 2019 09:08:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D2DFF287AA; Mon, 20 May 2019 09:08:03 +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 DC0511FE8E for ; Mon, 20 May 2019 09:08:01 +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=8dXbm6hVwIzxpVpgYJYy27s1Ksn8tn147rR2xjkCxB0=; b=CWerXAM5kkKB7w NGEu9VzgVDLhS3GAWjnw4vESpMxZCzTh0/6Nh0Mrjq9zl9GJyeI2pbEa0rt5i2SyfEd5nnjRbz+u3 5B19QQitqIcUfCRC7qHAcw/Sz80wb/D1IxxSAe466FCKPiCTRDhq4IFe7QxrjENgQTN+I5GIO9Zwo GJ/TUCxhu3B9E1uEC2mB+4lXL+wPdAronF5xpIdpn8pL537d1zmXlHw4Wj0u47/vcohWt0OACBsOA l0e7VwYW2AC3k2NlmF/SJUrOBtA8QCOex4Z0MS9m1+wHvSCKM6Lm82TiYxFtmQlY1US35xak1M0SE O+T5lcQieD8mPRL2aifg==; 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 1hSeGx-00034G-Mx; Mon, 20 May 2019 09:07:55 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSeGY-0002Y0-3z for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:07:39 +0000 Received: by mail-pg1-x543.google.com with SMTP id h17so6501858pgv.0 for ; Mon, 20 May 2019 02:07:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kYczVIziVgtoXaMdiCSJdvyko6PsZTz3vls3yir8pOc=; b=KGiXud+0mWIzef+T+5928Tp2QLkZEwQdsube/Mgj1NsURWWBSmIr1e5eaY1DllcZ3t 6qJ6btrYaRzmtfjBPOQI2vNNXZoFKi5TvA20kzKNDW+cxd3g8pjk7qvGgaynXuvr2LA4 181A9OS01zODaG73aVNpLn7K8Pk5sHcKdrBRU= 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=kYczVIziVgtoXaMdiCSJdvyko6PsZTz3vls3yir8pOc=; b=I+DmuQ/UuPmBRmfYK5VaF45ftI/RWKqFLOkMTn/SQJ/F05uSspheXPs1P6i/H+sNiH tNkXGcJYYlH2KHduR1hUUd6R6fvmfj3ZtBMCX0wP1xDf0NujHCmKOMH6NLdKXm9Yyl7Z Xzf9QQTjLgkBWS4nuB58KThpjkKZ1abPz22W9gP4kE1IgvEGCGJ18/JoOiUDzISOH2BR BvU/XWboL4bu1bPROpZmPAFudUO+neSFrZYv4K/9/aO4lk0I9Mnp0FV125N68amemhCN girsxg67GSg5HbDaFLn+I4IcUuABa7goErgi90kPcNJv+VPAIYiHwIkZRnNMrAaKvye6 mxUw== X-Gm-Message-State: APjAAAVKWnewMXkATpyuCvrd9OX83Gz4Wb/irtNHF7z69T21gxJ74ngw keg+nrvWpGpbekfXkbLWFfKugQ== X-Google-Smtp-Source: APXvYqwM3CLUrDYKF/BBqBe7vJrcloDE2nkmCClqznvzdeHC5V98hdU+vn56RYsovMfxbvtGLzfsZg== X-Received: by 2002:a65:6449:: with SMTP id s9mr72257102pgv.90.1558343249223; Mon, 20 May 2019 02:07:29 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:28 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 03/11] drm/sun4i: dsi: Fix video start delay computation Date: Mon, 20 May 2019 14:33:10 +0530 Message-Id: <20190520090318.27570-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020730_889229_ED39FE56 X-CRM114-Status: GOOD ( 16.19 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 The current code is computing vertical video start delay as delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; On which the second parameter mode->vsync_end - mode->vdisplay = front porch + sync timings according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h With adding additional sync timings, the desired video start delay value as 510 for "bananapi,s070wv20-ct16" panel timings which indeed trigger panel flip_done timed out as: WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0 [CRTC:46:crtc-0] vblank wait timed out Modules linked in: CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00029-g09e5b0ed0a58 #18 Hardware name: Allwinner sun8i Family Workqueue: events deferred_probe_work_func [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x84/0x98) [] (dump_stack) from [] (__warn+0xfc/0x114) [] (__warn) from [] (warn_slowpath_fmt+0x44/0x68) [] (warn_slowpath_fmt) from [] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0) [] (drm_atomic_helper_wait_for_vblanks.part.1) from [] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c) [] (drm_atomic_helper_commit_tail_rpm) from [] (commit_tail+0x40/0x6c) [] (commit_tail) from [] (drm_atomic_helper_commit+0xbc/0x128) [] (drm_atomic_helper_commit) from [] (restore_fbdev_mode_atomic+0x1cc/0x1dc) [] (restore_fbdev_mode_atomic) from [] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0) [] (drm_fb_helper_restore_fbdev_mode_unlocked) from [] (drm_fb_helper_set_par+0x30/0x54) [] (drm_fb_helper_set_par) from [] (fbcon_init+0x560/0x5ac) [] (fbcon_init) from [] (visual_init+0xbc/0x104) [] (visual_init) from [] (do_bind_con_driver+0x1b0/0x390) [] (do_bind_con_driver) from [] (do_take_over_console+0x13c/0x1c4) [] (do_take_over_console) from [] (do_fbcon_takeover+0x74/0xcc) [] (do_fbcon_takeover) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__blocking_notifier_call_chain+0x48/0x60) [] (__blocking_notifier_call_chain) from [] (blocking_notifier_call_chain+0x18/0x20) [] (blocking_notifier_call_chain) from [] (register_framebuffer+0x1e0/0x2f8) [] (register_framebuffer) from [] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c) [] (__drm_fb_helper_initial_config_and_unlock) from [] (drm_fbdev_client_hotplug+0xe8/0x1b8) [] (drm_fbdev_client_hotplug) from [] (drm_fbdev_generic_setup+0x88/0x118) [] (drm_fbdev_generic_setup) from [] (sun4i_drv_bind+0x128/0x160) [] (sun4i_drv_bind) from [] (try_to_bring_up_master+0x164/0x1a0) [] (try_to_bring_up_master) from [] (__component_add+0x94/0x140) [] (__component_add) from [] (sun6i_dsi_probe+0x144/0x234) [] (sun6i_dsi_probe) from [] (platform_drv_probe+0x48/0x9c) [] (platform_drv_probe) from [] (really_probe+0x1dc/0x2c8) [] (really_probe) from [] (driver_probe_device+0x60/0x160) [] (driver_probe_device) from [] (bus_for_each_drv+0x74/0xb8) [] (bus_for_each_drv) from [] (__device_attach+0xd0/0x13c) [] (__device_attach) from [] (bus_probe_device+0x84/0x8c) [] (bus_probe_device) from [] (deferred_probe_work_func+0x64/0x90) [] (deferred_probe_work_func) from [] (process_one_work+0x204/0x420) [] (process_one_work) from [] (worker_thread+0x274/0x5a0) [] (worker_thread) from [] (kthread+0x11c/0x14c) [] (kthread) from [] (ret_from_fork+0x14/0x2c) Exception stack(0xde539fb0 to 0xde539ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace 495200a78b24980e ]--- random: fast init done [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CRTC:46:crtc-0] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [CONNECTOR:48:DSI-1] flip_done timed out [drm:drm_atomic_helper_wait_for_dependencies] *ERROR* [PLANE:30:plane-0] flip_done timed out But the expected video start delay value is 513 which states that the second parameter on the computation is "front porch" value (no sync timings included). This is clearly confirmed from the legacy [1] and new [2] bsp codes that the second parameter on the video start delay is "front porch" Here is the detailed evidence for calculating front porch as per bsp code. vfp = panel->lcd_vt - panel->lcd_y - panel->lcd_vbp => (panel->lcd_vt) - panel->lcd_y - panel->lcd_vbp => (tt->ver_front_porch + lcdp->panel_info.lcd_vbp + lcdp->panel_info.lcd_y) - panel->lcd_y - panel->lcd_vbp => tt->ver_front_porch Which is mode->vsync_start - mode->vdisplay according to "DRM kernel-internal display mode structure" in include/drm/drm_modes.h This patch fix this by updating the video start delay to use front porch value. [2] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L2051 [1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/lowlevel_sun8iw5/de_dsi.c#L803 Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index b3ca85410b2c..47d571d97600 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -375,7 +375,7 @@ static u16 sun6i_dsi_get_video_start_delay(struct sun6i_dsi *dsi, * working in all supported panels as of now. */ u8 start = 1; - u16 delay = mode->vtotal - (mode->vsync_end - mode->vdisplay) + start; + u16 delay = mode->vtotal - (mode->vsync_start - mode->vdisplay) + start; if (delay > mode->vtotal) delay = delay % mode->vtotal; From patchwork Mon May 20 09:03:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950637 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 A63061390 for ; Mon, 20 May 2019 09:08:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 94F4A287A0 for ; Mon, 20 May 2019 09:08:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8897B2875A; Mon, 20 May 2019 09:08:11 +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 DF7C5286EE for ; Mon, 20 May 2019 09:08:10 +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=q7qk+euZqyeBzKNdDgsc8LMZo23IfvQJQ6skm1y3Yjo=; b=WipsGKTSTWATp0 y57w+smutlfUzWVUR5eNDuMmrU1UzaJ9Gt9YRQjVXAMXd1tDkumph5QxOQRBtfetpFFMOgbb6SfVT 7d3YMxQ1RDYCcykWAFzLTd28OKgyGYRoW4pYI4RhLPHppTvh27sbFxL0rn8iXAJgx1WEv8Z5O1vxr f/AlxX6hO5ATkQE1YfqCjpC6O+gIOf/mfbSYIYgPtOdmPY4KCnaufbtVqxdT/CaICA838GsbWQI2x xxdRcY0y6eeNcs8MmW7CTNRNSUZrp6ptUUPQo+VNEOseRSPStU64wyHTyqAGWw5CDvlFBvlkepGKx QIcpbG3nOZCMOuYjP3fw==; 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 1hSeH6-0003Cn-7t; Mon, 20 May 2019 09:08:04 +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 1hSeGd-0002ft-Ci for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:07:39 +0000 Received: by mail-pf1-x442.google.com with SMTP id s11so6886294pfm.12 for ; Mon, 20 May 2019 02:07:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7Z3x6LljX02dT+qUsi4m5KdJMqoZuShmgkReRd7s7dw=; b=r3DLdZVquXFLKd1da1eZpPdtprimWp+1P0POwfA5UUeoTkxSobEqBi1KGSCQYbFCm3 2+XKlnETBnwFFt9LnbcyDPsWdhFiM1Gnmfc1RbgzFKham3n2VLaUJGTIbIybd814Kq++ Ei4GbfHHGH0cok44ayQvfwfcBprRzfTPJvGiE= 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=7Z3x6LljX02dT+qUsi4m5KdJMqoZuShmgkReRd7s7dw=; b=Z4qpZoeV+N5fXSjsDrca9kmWGFcMBRORS4po+h4l2Jc8NyW3jd2B9XP0FXV+AsJ8fq 3xL3wfojIYMuGqcLaVpfVA3sQphXSIiXRCp+eMbX+TbT8dxYCzTILLpQfUIigbc5f/JV /r6J8NzSlS36Nu0ZXOSr62s7Szj/M8oXcepzLkpLVSS5gXV2lDgvDvFAOgaC2jtSsO27 jad6NUmf5p1fsvN6XYo5jeXCD77O8bdWY3/+eHk3QDWpU/e2cShVSLiuLLKtGTcQaW+E oJBJrirBBsQUSinRRxpgsD0xcVa3bLMV/Uw2TXu7loxk3pFFlOAwxWN8DOo2wYwKJYrQ 7Jbw== X-Gm-Message-State: APjAAAVUb0dnsFGhtlqHJ6IOfO8XAoWDBRSFvQRDoKsBXCGaWpBtAixU yPIt2d3rvI+CzGmLBdxul8Hcmw== X-Google-Smtp-Source: APXvYqzLgYLTjFtQLw4oKcVl1iHzhftrgdySuDkHfC1rKahZhdIXQSYYBQYO4ZaxRqZhqAfjXafQQA== X-Received: by 2002:a62:62c1:: with SMTP id w184mr77662542pfb.95.1558343254514; Mon, 20 May 2019 02:07:34 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:34 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 04/11] drm/sun4i: tcon: Compute DCLK dividers based on format, lanes Date: Mon, 20 May 2019 14:33:11 +0530 Message-Id: <20190520090318.27570-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020735_499594_426C1E8D X-CRM114-Status: GOOD ( 14.17 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP pll-video => pll-mipi => tcon0 => tcon0-pixel-clock is the typical MIPI clock topology in Allwinner DSI controller. TCON dotclock driver is computing the desired DCLK divider based on panel pixel clock along with input DCLK min, max divider values from tcon driver and that would eventually set the pll-mipi clock rate. The current code is passing dsi min and max divider value as 4 via tcon driver which would ended-up triggering below vblank wait timed out warning on "bananapi,s070wv20-ct16" panel. WARNING: CPU: 0 PID: 31 at drivers/gpu/drm/drm_atomic_helper.c:1429 drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0 [CRTC:46:crtc-0] vblank wait timed out Modules linked in: CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.1.0-next-20190514-00025-g5186cdf10757-dirty #6 Hardware name: Allwinner sun8i Family Workqueue: events deferred_probe_work_func [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x84/0x98) [] (dump_stack) from [] (__warn+0xfc/0x114) [] (__warn) from [] (warn_slowpath_fmt+0x44/0x68) [] (warn_slowpath_fmt) from [] (drm_atomic_helper_wait_for_vblanks.part.1+0x298/0x2a0) [] (drm_atomic_helper_wait_for_vblanks.part.1) from [] (drm_atomic_helper_commit_tail_rpm+0x5c/0x6c) [] (drm_atomic_helper_commit_tail_rpm) from [] (commit_tail+0x40/0x6c) [] (commit_tail) from [] (drm_atomic_helper_commit+0xbc/0x128) [] (drm_atomic_helper_commit) from [] (restore_fbdev_mode_atomic+0x1cc/0x1dc) [] (restore_fbdev_mode_atomic) from [] (drm_fb_helper_restore_fbdev_mode_unlocked+0x54/0xa0) [] (drm_fb_helper_restore_fbdev_mode_unlocked) from [] (drm_fb_helper_set_par+0x30/0x54) [] (drm_fb_helper_set_par) from [] (fbcon_init+0x560/0x5ac) [] (fbcon_init) from [] (visual_init+0xbc/0x104) [] (visual_init) from [] (do_bind_con_driver+0x1b0/0x390) [] (do_bind_con_driver) from [] (do_take_over_console+0x13c/0x1c4) [] (do_take_over_console) from [] (do_fbcon_takeover+0x74/0xcc) [] (do_fbcon_takeover) from [] (notifier_call_chain+0x44/0x84) [] (notifier_call_chain) from [] (__blocking_notifier_call_chain+0x48/0x60) [] (__blocking_notifier_call_chain) from [] (blocking_notifier_call_chain+0x18/0x20) [] (blocking_notifier_call_chain) from [] (register_framebuffer+0x1e0/0x2f8) [] (register_framebuffer) from [] (__drm_fb_helper_initial_config_and_unlock+0x2fc/0x50c) [] (__drm_fb_helper_initial_config_and_unlock) from [] (drm_fbdev_client_hotplug+0xe8/0x1b8) [] (drm_fbdev_client_hotplug) from [] (drm_fbdev_generic_setup+0x88/0x118) [] (drm_fbdev_generic_setup) from [] (sun4i_drv_bind+0x128/0x160) [] (sun4i_drv_bind) from [] (try_to_bring_up_master+0x164/0x1a0) [] (try_to_bring_up_master) from [] (__component_add+0x94/0x140) [] (__component_add) from [] (sun6i_dsi_probe+0x144/0x234) [] (sun6i_dsi_probe) from [] (platform_drv_probe+0x48/0x9c) [] (platform_drv_probe) from [] (really_probe+0x1dc/0x2c8) [] (really_probe) from [] (driver_probe_device+0x60/0x160) [] (driver_probe_device) from [] (bus_for_each_drv+0x74/0xb8) [] (bus_for_each_drv) from [] (__device_attach+0xd0/0x13c) [] (__device_attach) from [] (bus_probe_device+0x84/0x8c) [] (bus_probe_device) from [] (deferred_probe_work_func+0x64/0x90) [] (deferred_probe_work_func) from [] (process_one_work+0x204/0x420) [] (process_one_work) from [] (worker_thread+0x274/0x5a0) [] (worker_thread) from [] (kthread+0x11c/0x14c) [] (kthread) from [] (ret_from_fork+0x14/0x2c) Exception stack(0xde539fb0 to 0xde539ff8) 9fa0: 00000000 00000000 00000000 00000000 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 ---[ end trace 4017fea4906ab391 ]--- But accordingly to Allwinner A33, A64 BSP codes [1] [2] this divider is clearly using 'format/lanes' for dsi divider value, dsi_clk.clk_div Which would compute the pll_freq and set a clock rate for it in [3] and [4] respectively. The same issue has reproduced in A33, A64 with 4-lane and 2-lane devices and got fixed with this computation logic 'format/lanes', so this patch using dclk min and max dividers as per BSP. [1] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1106 [2] https://github.com/BPI-SINOVOIP/BPI-M64-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp2/disp/de/lowlevel_sun50iw1/disp_al.c#L213 [3] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1127 [4] https://github.com/BPI-SINOVOIP/BPI-M2M-bsp/blob/master/linux-sunxi/drivers/video/sunxi/disp/de/disp_lcd.c#L1161 Tested-by: Merlijn Wajer Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 9d8d8124b1f6..8f93121fead4 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -341,8 +341,8 @@ static void sun4i_tcon0_mode_set_cpu(struct sun4i_tcon *tcon, u32 block_space, start_delay; u32 tcon_div; - tcon->dclk_min_div = SUN6I_DSI_TCON_DIV; - tcon->dclk_max_div = SUN6I_DSI_TCON_DIV; + tcon->dclk_min_div = bpp/lanes; + tcon->dclk_max_div = bpp/lanes; sun4i_tcon0_mode_set_common(tcon, mode); From patchwork Mon May 20 09:03:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950641 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 2843E1390 for ; Mon, 20 May 2019 09:08:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16F6728756 for ; Mon, 20 May 2019 09:08:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AFD9286B4; Mon, 20 May 2019 09:08:17 +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 A2EAB287A0 for ; Mon, 20 May 2019 09:08:16 +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=VlCh0Hm2VxbJf+wjVReU0+hPYOEQ2FnX7R13504XeL0=; b=T22SrQGgzprseI iMcd9OQb8lGacCnh8y+ywSNC5+2OI/97s8JYrltvuGZ5fi8g5FJNM4q19DxWsiGjkorpnr0JdD1B+ Vp5H//Ds44qpC3PrpNAfvLY7bOb+JC3VEC6oGDXRI9b11MXcI6xlneoOZCxiXN2UvT9X21/yeg38Y Ld4w3T+9Iq9pGFUcgMET96/XFMNJdpW2kAWYCjUnUM/9emM2cV8e0hFf+ZkdrUa42S7h6Ry+5yamY T1NSfOTv3+I3j0V13+g+F8E3NP6OOZ/C7xUfrFRS34IN7rFbjIYwx7UqZMHagTEZ4ihZmzpMxdIj0 4RcC6IfheBB/prN/Ko+A==; 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 1hSeHG-0003S8-RL; Mon, 20 May 2019 09:08:14 +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 1hSeGi-0002lQ-Av for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:07:48 +0000 Received: by mail-pg1-x542.google.com with SMTP id j26so6492638pgl.5 for ; Mon, 20 May 2019 02:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v9fCm6pJfwNnZtBLiOWDCiXX9M7MmpxMOv/deygL7hU=; b=DZf0IHTg+6ePioO6PbxXMr3b0sxOtlWkuB0Rp/4yTi2ZN5gA6vpKqzCt+E79/4xyLz sTb8V2qQqNyxh1FgxVCOw5Ro+uDhlkiDCr+Teqvov0ZjXg4xmEQAe9q73sschfeV2/7b 1umWfMmqWgnFDP9XQOT2EyjzH1L1l22e8ByC4= 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=v9fCm6pJfwNnZtBLiOWDCiXX9M7MmpxMOv/deygL7hU=; b=XfgzqoMJjjfnYAb24TE+br5q0CNINYHZM//PsdDKcPCQ61fq5jBq3W5tn3sqwOIIST 1xA7eAUu3cGhOaydL2Qd/rmFMTvV1kUyujso3AX4gxLBp1XE8n8azQqmpG7rc43Y1avK ee9NxFQlJ/nkNxNt+1jiASwBuUi+OSrykvJ4gaS5OGNTtHmMW6TgeqU8mEpjGiyXIgqB jFesvzW87f0bZNywCOxEKyYGSAiIPn0/2eINV99ISMlMmK2/16bRL8uMm1iwJ1cJViu8 0FDz1gqv+pxIIIKYS1hPEvor+lkpL4zRP4oZfRqooi7rAWvgmqLXB37YfcJTXwBvRIma vTGw== X-Gm-Message-State: APjAAAX3uSbf8FCSaQNNv4nkGmL+2t9YW7R7t+SqoHDZNkAJoM2daBJM ydTPR8zFtlenXfxfr0YVy4tP8w== X-Google-Smtp-Source: APXvYqySfQ3A6Yya3mnBJTmrp77lvlN5ou8ZoeGALRWlDGRY8S5yM7HkEEgoTE9x3zLO+IG5XbCEIA== X-Received: by 2002:a63:ee0b:: with SMTP id e11mr21644801pgi.453.1558343259840; Mon, 20 May 2019 02:07:39 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:39 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 05/11] drm/sun4i: tcon: Export get tcon0 routine Date: Mon, 20 May 2019 14:33:12 +0530 Message-Id: <20190520090318.27570-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020740_746356_E5DA6A90 X-CRM114-Status: GOOD ( 13.26 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 8f93121fead4..9e9d08ee8387 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); static 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 84cfb1952ff7..88e971d5f937 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -272,6 +272,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 Mon May 20 09:03:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950647 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 AA09B933 for ; Mon, 20 May 2019 09:08:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 95BD32875A for ; Mon, 20 May 2019 09:08:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FACF28756; Mon, 20 May 2019 09:08:52 +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 53FC228756 for ; Mon, 20 May 2019 09:08:42 +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=HN64ngpJ6viFd/365a465FKs0C2ztyXQy+fPTizmt0Y=; b=mpT6gSIN9x/i8g LWJUJbkIAm0wH18GdR8tZRfupO2iC2jntBjPvJ9V4rsCCsl5uw6W3TKycX8QJbnboJs5obJB751hd 7lGOOGrDHY9I446OFDZcLr0YSoy8KZCy1xfOUXFhEjbYcYjJt1Zty1Jh/ut6zqU7t8KU1yHGb8vPa KUupYeAyJCO0RYUkzv9m9CcX4C4UoBk+MV6Pk02m5NKMish39ReYTwsFyobHHm2mcme0SyDbUS+nM u1JQbFncKkmYTLLi0Psg1V/Y8f9OsFZbDyDV5R+jRAd3N4pJwaeqk8aXdX7yuKSte3GFQgYVprBXm uun6ln+wluJPt5vtItng==; 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 1hSeHc-0003n7-Jx; Mon, 20 May 2019 09:08:36 +0000 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSeGn-0002s2-I7 for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:07:54 +0000 Received: by mail-pg1-x543.google.com with SMTP id z3so6483049pgp.8 for ; Mon, 20 May 2019 02:07:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qhq8BOri8GqXtdsxg8qxzoiDzDhWP4zxzqC5ifM9GUM=; b=BwmX6vUwVXSoWUXZaDGxZnC4C2nA+2FLx9nM53JLcHkyAB5WcTW4XIBvaCMGkvN9l8 h8ifkdY4+WuJmXFbgWagA5sRceen0HDsv0Ox5dmquIwP9fPC2bcFhBAVP4TCIRHCSf4Y 7nZE/DDUbxoFttnsMo29hrKifDT5WRjCfoT3E= 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=qhq8BOri8GqXtdsxg8qxzoiDzDhWP4zxzqC5ifM9GUM=; b=efHzN3C+YcXmgXrxGwO8aKYLKKWSirxxrxv1Q5xh9zsVJo9I94+892XevvRQB5OeaJ AKv2h8VPJdQ8zFxz3QXXZqLNNmBovOsv9xeCiAMvykcKTl3WBzH77aMxsHnEI3atA9d6 3nd7G0lji/JKJ70aRJ0+5/3cnsKa4xlGERKDpwLyQByZgg5zf74rFTu2gBtNcFGzSCKM Fl5oDPz7/r3YN9xGbK8w3tr8B3GUvVz+lPVTxCqPGzmt1vb52QS8vcblVEz94nhpG3mU HrW7Ya8gXRofnAEQfn1DBUqMrsrGmQMfKtx7L9P0DB2snRPXnQavimqLnAK8qQJcKAw2 EwjQ== X-Gm-Message-State: APjAAAWDkmAdQ9u+gY53axKECH6D/UdGV6oFxvJNXo7sFySakZ20Iowz OH6BCyZxqT9i83ps3Uj7QIU8yQ== X-Google-Smtp-Source: APXvYqzQbGvwKqbUYTfkmz0DyTQcGldqq+MJrZmXW5rXq1utn0gBm9ge5J4w6ezaiZlHn0axjqJVLg== X-Received: by 2002:a65:628b:: with SMTP id f11mr71262665pgv.95.1558343265015; Mon, 20 May 2019 02:07:45 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:44 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 06/11] drm/sun4i: dsi: Probe tcon0 during dsi_bind Date: Mon, 20 May 2019 14:33:13 +0530 Message-Id: <20190520090318.27570-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020746_078334_38AF3121 X-CRM114-Status: GOOD ( 12.47 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 rates are available whenever it required. Tested-by: Merlijn Wajer Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 6 ++++++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 + 2 files changed, 7 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 47d571d97600..1f9ed2642a47 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1045,6 +1045,7 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, struct drm_device *drm = data; struct sun4i_drv *drv = drm->dev_private; struct sun6i_dsi *dsi = dev_get_drvdata(dev); + struct sun4i_tcon *tcon0 = sun4i_get_tcon0(drm); int ret; if (!(dsi->panel || dsi->bridge)) { @@ -1054,6 +1055,11 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, dsi->drv = drv; + if (!tcon0) + return -EINVAL; + + dsi->tcon = tcon0; + drm_encoder_helper_add(&dsi->encoder, &sun6i_dsi_enc_helper_funcs); ret = drm_encoder_init(drm, diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 9c140f55b822..f2826e3ea165 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -28,6 +28,7 @@ struct sun6i_dsi { struct device *dev; struct sun4i_drv *drv; + struct sun4i_tcon *tcon; struct mipi_dsi_device *device; struct drm_panel *panel; struct drm_bridge *bridge; From patchwork Mon May 20 09:03:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950651 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 7623E1390 for ; Mon, 20 May 2019 09:09:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6661D2875A for ; Mon, 20 May 2019 09:09:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A6D028715; Mon, 20 May 2019 09:09:01 +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 E1C7B2875A for ; Mon, 20 May 2019 09:09:00 +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=uDE53rj5Wr3tdNIMgdfhQvTXEvFapcjjsG6Hg0XNYh4=; b=cJ05/N5+PaRNVb 5MFc1U/f7cSSu8YNQZwTegV7a/2NBHxGZMkHS7kJrq69qrG6SknPSHrMQI1lIVtXaKr+pjy25wGof fraAPWA9/yjE+Uz0qRPXKY6J8LLLdJ+j94KJhBBOdz3nFr/LNqJ1epevy9dIf0HAo2Ucjwb4rYbTz YI2F2g3dXCBrulfLEF2o1z1NaTR2Txrn0eoGR4Uf9myh9qa+oGIvcLxXdiBMq8NWhU7IuQfv6JPUh ihp7dp0I42tNs9mV/Ja6+iK8b1FZyOgCN5+8MReOqXSsbJfyauM4ICByURlrebhmWPeX0QepSOTE1 gs7gr9G4CIU44XO2uMLA==; 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 1hSeHu-00048M-Mi; Mon, 20 May 2019 09:08:54 +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 1hSeGs-0002zR-4A for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:08:12 +0000 Received: by mail-pg1-x542.google.com with SMTP id t187so6466786pgb.13 for ; Mon, 20 May 2019 02:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l8/eiiMRzRHMeJJfg+NtIFfqaA+aEUt7A5oo1QrAYME=; b=izXs0xnF9WrDgcEPHUWlWp9gc4k0omlI5ON8oHnDXGfiCLU6GPTMi1TD53H72OhRJ9 07OMMo1ZEK+83bw3/ptHwy7G9/QEAx4InSSgtV6dQkAuKRvQpPcDFEGDovibhbsGZ46q q87tXjbcR5kzwiL8RKIASnKXgb7PvMxBB0tQA= 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=l8/eiiMRzRHMeJJfg+NtIFfqaA+aEUt7A5oo1QrAYME=; b=K6QQ63p+s6BnCiYXvlROQLqD8p23fmh30HaHbpHnODV4gRHiMe9cFIokkQ3ocq5leo 0m080zhtxO9xfzM+WP9soqjBY5hPJTszejjbUXMKkkq9btYCPwVwEF6Xu7duTsX1yeOH O+WJ4G9s8zcGhxQwrCmER6g+YLvWXT1dgLIZs+xuq+FChv0mf1bPZKqHnkNtxIhkw5rU YYl+8NYnwOqlzEKnaDDegasxgn+pLEbA4HUSEhPVKpm4Vzs9vpbW+nKg4GHpf1EHnHct SP4rl26ZMa8Z3IXoUh8bmAti4AmjVEpG6r3up3e+G87gv7y3dN6bcX+ZjqNNbGTMQIKS i/Zg== X-Gm-Message-State: APjAAAUHUF61j7BdSdK8DCeWqY7YLkt3gAgY3A1H0+pBuUq16OLgVU+S xlmdZClpj4ObMTKaen7WzYToIg== X-Google-Smtp-Source: APXvYqwLHvSwqQ0wDLSPdTFaZir99tjNhatCm3penvvdzh6SsenDaTxMVKo4xU4l8s1GExXu5p1q5Q== X-Received: by 2002:a62:51c2:: with SMTP id f185mr18546991pfb.16.1558343269570; Mon, 20 May 2019 02:07:49 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:49 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 07/11] drm/sun4i: dsi: Get tcon0_div at runtime Date: Mon, 20 May 2019 14:33:14 +0530 Message-Id: <20190520090318.27570-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020750_354616_50700713 X-CRM114-Status: GOOD ( 13.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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 tcon0 divider is used while computing drq edge0 for burst mode devices, currently driver is using default macro value 4 via SUN6I_DSI_TCON_DIV. Unfortunately not all the panel devices are working with this default divider value 4, so to make future changes on this divider value get the divider from tcon dot clock at runtime instead of static macro value. Tested-by: Merlijn Wajer Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 +++++++- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 1f9ed2642a47..5584e9c2f8bd 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -396,9 +396,15 @@ static u16 sun6i_dsi_get_drq_edge0(struct sun6i_dsi *dsi, struct drm_display_mode *mode, u16 line_num, u16 edge1) { + struct sun4i_tcon *tcon = dsi->tcon; + unsigned long dclk_rate, dclk_parent_rate, tcon0_div; u16 edge0 = edge1; - edge0 += (mode->hdisplay + 40) * SUN6I_DSI_TCON_DIV / 8; + dclk_rate = clk_get_rate(tcon->dclk); + dclk_parent_rate = clk_get_rate(clk_get_parent(tcon->dclk)); + tcon0_div = dclk_parent_rate / dclk_rate; + + edge0 += (mode->hdisplay + 40) * tcon0_div / 8; if (edge0 > line_num) return edge0 - line_num; diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index f2826e3ea165..156523859d82 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -13,8 +13,6 @@ #include #include -#define SUN6I_DSI_TCON_DIV 4 - struct sun6i_dsi { struct drm_connector connector; struct drm_encoder encoder; From patchwork Mon May 20 09:03:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950653 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 10DB5933 for ; Mon, 20 May 2019 09:09:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0044D286B4 for ; Mon, 20 May 2019 09:09:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E8514287AF; Mon, 20 May 2019 09:09: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=-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 8CADC2869D for ; Mon, 20 May 2019 09:09: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=+o2oQBZLg1b2QTnIBJjgsR1IOkf5hbLKQ6eH20ptUEA=; b=SxbpIPAzYe6TdW GiJXGLe6xQ/Af+BKxsh7PaokOdbrhAPmBnZEkrIMJ0rOIpMatVEXxUdHwBI9MbGPnjFiQVKRGI5DO d2+zPdxUDKIjH6AbZlO7Nbe4D8j4aq73dtbfhrdi8jqZTHPftbde0HMptD15mm/BkArZlpMHr9OCb R1Rc0wNfmvIDn/VIw02SZYwJxrfgd4xJY1O7u256boahNu975izkQU5J2uVQfLEKoFNAwbOZrvqGB V7gMdaeCu5LJa4mbySiaJCG8jfLagiPt2ARRze4Kh7DcrnZsTjdv5b4usJ3KvYZs19Ohx9atOvU12 xf8BflFdfbt1QCzgm3FA==; 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 1hSeIF-0004a6-2v; Mon, 20 May 2019 09:09:15 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSeGx-00033m-De for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:08:24 +0000 Received: by mail-pf1-x441.google.com with SMTP id y11so6891454pfm.13 for ; Mon, 20 May 2019 02:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RhhbywtZgL9mTL+/aS2gTie5gz+AOsOECX4GcmEvNm8=; b=r7FvqZFw/gu/2n+1603wdn3ygdOPws+IPKmHzr+7ytlLH74FqNbxJXLgMSH0OHamIK 1GA+Ua3+oxWE9TzHS9ArZ45MeQ3PutdmMb9mtkP1VwHF58tBHnNJdJzASpUAarmrwcbt hejMLtxkulq1eWgonL7tep/ehNu3uSZ2CB6PQ= 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=RhhbywtZgL9mTL+/aS2gTie5gz+AOsOECX4GcmEvNm8=; b=EMfRQyWx/ntc3YeLkVFpyUyqd6vDm0RxPapU5/Z+ZLhYEkKRxTkWecNtaTlYHPIuZG x/y8rlqkxcwqIdYdK4huWuSvbDT+D/rSiecit5louxKWRjeFDLwjfUKFEdGqi04RUK2F Z2GvarDXavQeP4Ehza+5MMfmPpm6kRQKJ76T+BGzHfpLZG7JDGvoIRfVMu5c5XyesWrJ N9bhK//PX5Oh19C61L+zNhDnbdTpel8GsKl4hCePj+kvww2InHQTsq12S5sjY24pVG/q sCPahHbjL3SUZ4i5+j/XNMxExnKIcRxHT/qO2W1MF4HHFj7PTe7fWeusNmAvQJLdjyjc L1qg== X-Gm-Message-State: APjAAAXnyPhhTOSrXlTZUG7YEpksiTVucznp1JH039D4//2Vv+zUc7Ux aPqn4DJw8NlQZRhlB4RLTIE0hA== X-Google-Smtp-Source: APXvYqz34UXPxRhzfdNer7tUP6i29zQxwtYM7NMLCp3pv/rNH5nWYiFi2u+2vMjGcD+MakpaE3MtkA== X-Received: by 2002:a63:1150:: with SMTP id 16mr74722565pgr.40.1558343274409; Mon, 20 May 2019 02:07:54 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:53 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 08/11] dt-bindings: sun6i-dsi: Add VCC-DSI supply property Date: Mon, 20 May 2019 14:33:15 +0530 Message-Id: <20190520090318.27570-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020755_639227_AE644790 X-CRM114-Status: GOOD ( 11.54 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 controllers are supplied with SoC DSI power rails via VCC-DSI pin. Some board still work without supplying this but give more faith on datasheet and hardware schematics and document this supply property in required property list. Reviewed-by: Rob Herring Tested-by: Merlijn Wajer Signed-off-by: Jagan Teki --- Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt index 6a6cf5de08b0..1cc40663b7a2 100644 --- a/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt +++ b/Documentation/devicetree/bindings/display/sunxi/sun6i-dsi.txt @@ -21,6 +21,7 @@ Required properties: - phys: phandle to the D-PHY - phy-names: must be "dphy" - resets: phandle to the reset controller driving the encoder + - vcc-dsi-supply: the VCC-DSI power supply of the DSI encoder - ports: A ports node with endpoint definitions as defined in Documentation/devicetree/bindings/media/video-interfaces.txt. The From patchwork Mon May 20 09:03:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950649 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 139481390 for ; Mon, 20 May 2019 09:08:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C0B71287CE for ; Mon, 20 May 2019 09:08:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE026287E3; Mon, 20 May 2019 09:08: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 77A6F287DC for ; Mon, 20 May 2019 09:08:50 +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=QBtT1lptEbkxaYGb8SOlcfJboco5+djD3bulGfIPXpI=; b=Mal/PPTXWP1bvb lE0UpDILPWOTbfpzTF1ufTuFCqfjAEcHjAy/+cIgYLP/xlqoTdHeELIAwF1tsdNhBlvIBovoBPymO OCkwqzAolmmB0ZqSd15XvdH7H+3iB/obgElOSYYrgqyK+9VePHggr9Q244hkDj0Q19blU9KXqvKk3 45sBgKUKg/ewRUzI949VgKwYENxp5WbSKh41+Tz+N53hl9OGyEKUP6QIhixwFDu2Bs/ZiptKdL/hg Gu6aSlPxAk5aBO01nRjpan8hE7KSmfSVRvzdwHV04SKzJpviohCyPRVc7rml4GuwHyh60AyOTi1f6 B6Kh5lLKrTaJIO+RGAqA==; 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 1hSeHk-0003tr-JV; Mon, 20 May 2019 09:08:44 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSeHA-0003Ko-Bb for linux-arm-kernel@bombadil.infradead.org; Mon, 20 May 2019 09:08:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xEFhsAjZ+Xzcbx2mHUcUiTH2Zxcv+pD6TtDJ+37nOCw=; b=bcci216byLoKF5k/TgR7dKN2uR 5XJsT9r4PArm9pYkI/iZq2/iy0O6i9SNLnsF5NIBxwIH3qJCLUALaH6krGKw3ct8Fctm1+KcfmV+p PXVfFxtEjyR87G12kPsyeb041HmQHHl89K9KrsSLo4ECHZjKi5dIdDiD0PodM7w74K1TA9ReA0PH0 0hrkgGpBrHLvMiqT71O1x/alfDPA0uhC1FdivSetgikOdqCPd1mhgSQofMvOONNXWmxtpP+eDzAQP QtA4RtqrnvOxXukxYKcWNNfZPpwfcNaiZjTs6Zqh3DbovEqxNlZ5WRsYd+FNr6sDVApkZjOSzySZU Jai2J6wA==; Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSeH6-0008Kq-RP for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:08:06 +0000 Received: by mail-pf1-x441.google.com with SMTP id g3so6911256pfi.4 for ; Mon, 20 May 2019 02:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xEFhsAjZ+Xzcbx2mHUcUiTH2Zxcv+pD6TtDJ+37nOCw=; b=pkRCUHr3PbHTjPtc0qjpfo1lrEPZql2aeKEwix+ScaX1hHjAmL8U69LjgqUEDGAHHZ vGACrzd6Kmoy1bkgevpRYfNdHQnemycdG4G1VtfGtCdNjhb2as9Ypzh0BOVLPtzBINyi lyIN9ZuCYdiVQB/9yqx/RnaZks4NbxiNnbEPg= 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=xEFhsAjZ+Xzcbx2mHUcUiTH2Zxcv+pD6TtDJ+37nOCw=; b=pTViPl3wREduUCgYY4mWOvfK06/I6ZPzEv7LRaXQCB5mV4pb1qlncY7vLgFqXPn3Sd FBw/Ca/XDC5ZSOJJZS0JfGq1+y7N6MjbpR3H9W5WEIYVCMcadVOy8YKs8GFkYej2Chsd rJzk+iHYdJblxXDqVW88nzRvFdTdO7RJMtFkgHnH6gCb7EYbx/mt5doGu3j9V1qN+qNh 5yrL6pxhW34xrsopgeTSo5+3GpTwafRyAPreLDWtOw4s5fpZCBUuDZKFu8tPYnr++z8X 4NmD+EccXIOzwwg7CIUFHuggpZCkBGrnXf6VmiC8KfP7W6tt6awTYUn50CwEttYsCEwH zFNw== X-Gm-Message-State: APjAAAUZEWmJyPFvIMxch3UAU9Cw7ypMKQnizL1/43j1KuAczWrycr+O pe4G0ckpZ7eemdRa3Xnq2vv2Fg== X-Google-Smtp-Source: APXvYqwqd4qJH6N7Gr6VNXBwWrTXaJZVOL3zSzQQK/VIAilUj4DHIF2KXdm0VmOuIoTm6pT2UMghGQ== X-Received: by 2002:a63:3ece:: with SMTP id l197mr36282516pga.268.1558343279532; Mon, 20 May 2019 02:07:59 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:07:59 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 09/11] drm/sun4i: sun6i_mipi_dsi: Add VCC-DSI regulator support Date: Mon, 20 May 2019 14:33:16 +0530 Message-Id: <20190520090318.27570-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_100804_905349_FEBE8999 X-CRM114-Status: GOOD ( 17.51 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 controllers are supplied with SoC DSI power rails via VCC-DSI pin. Add support for this supply pin by adding voltage regulator handling code to MIPI DSI driver. Tested-by: Merlijn Wajer Signed-off-by: Jagan Teki --- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 14 ++++++++++++++ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 3 +++ 2 files changed, 17 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 5584e9c2f8bd..a5d73a283ed7 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -1150,6 +1150,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev) return PTR_ERR(base); } + dsi->regulator = devm_regulator_get(dev, "vcc-dsi"); + if (IS_ERR(dsi->regulator)) { + dev_err(dev, "Couldn't get VCC-DSI supply\n"); + return PTR_ERR(dsi->regulator); + } + dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base, &sun6i_dsi_regmap_config); if (IS_ERR(dsi->regs)) { @@ -1223,6 +1229,13 @@ static int sun6i_dsi_remove(struct platform_device *pdev) static int __maybe_unused sun6i_dsi_runtime_resume(struct device *dev) { struct sun6i_dsi *dsi = dev_get_drvdata(dev); + int err; + + err = regulator_enable(dsi->regulator); + if (err) { + dev_err(dsi->dev, "failed to enable VCC-DSI supply: %d\n", err); + return err; + } reset_control_deassert(dsi->reset); clk_prepare_enable(dsi->mod_clk); @@ -1255,6 +1268,7 @@ static int __maybe_unused sun6i_dsi_runtime_suspend(struct device *dev) clk_disable_unprepare(dsi->mod_clk); reset_control_assert(dsi->reset); + regulator_disable(dsi->regulator); return 0; } diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 156523859d82..c76b71259d2e 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -13,6 +13,8 @@ #include #include +#include + struct sun6i_dsi { struct drm_connector connector; struct drm_encoder encoder; @@ -21,6 +23,7 @@ struct sun6i_dsi { struct clk *bus_clk; struct clk *mod_clk; struct regmap *regs; + struct regulator *regulator; struct reset_control *reset; struct phy *dphy; From patchwork Mon May 20 09:03:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950655 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 635771390 for ; Mon, 20 May 2019 09:09:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51AA728764 for ; Mon, 20 May 2019 09:09:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4625328717; Mon, 20 May 2019 09:09:33 +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 7698D284DC for ; Mon, 20 May 2019 09:09:32 +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=f3Dgx6Ndy0qyEh5YPDfbkca73PqTYPiggt27HhN/mJM=; b=ZB7WoE9R67G2YT EwUSZQ17dQDKBo+p+T22cLrNwkinyidzgQE44i5OCaKW01cczkFMsW1BO7G8d5BVWyfcAoROwjpno 798ffo0vS1L4Slfo3/jWYUf4dy8L2aNlzYBx1RgVGIgbCty7za+u8WxdPQw0wMkImtINM6EwLVZsb xW28op/I9JbonBXud+p5NjJvKXDmzJehG5tV613BwOuEI/tVr7ZgZAJNKF+aBOspeUsgCjAIxYdrD 0DqPfKR6VG2qtZgx3PO/TfvLoQ1fXgDunzHRE/He/r3X1ZdXn3vrPzfOYeyMTqwa7AcNxrFof2zv7 F8uQInNRmL3qTTx4ZSXw==; 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 1hSeIP-0004oq-1w; Mon, 20 May 2019 09:09:25 +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 1hSeH7-0003HC-MI for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:08:34 +0000 Received: by mail-pl1-x642.google.com with SMTP id w7so6437444plz.1 for ; Mon, 20 May 2019 02:08:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7sJQDWzqf6+kvBieyTTKW4hSHxAIvKsqSqX7fldZgo8=; b=EUXAqPD+zMUvEbG7428ww5mAsFGnQByCmuG6Qa/la8dfjS5+9P56gMC7p6dIcNnXF3 6wr1O4HDG01ShRzEo5mu9H399aUjZNZmcXVWTlHF1tlCB04vNwzyayniUsGNTbOubN08 lqmrhOo8mzww4VOUtAwgtay505OjXpm5afyco= 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=7sJQDWzqf6+kvBieyTTKW4hSHxAIvKsqSqX7fldZgo8=; b=tXNE/Cg0EiaxEWuytCxKR+955dnH8pyyTZZptH5MViWbDIC49BJDrSyr66fKqfjR/d 0YrulZMYxZhLOLH5eAYAEHKYyHgFw+l0o3/6eCCzCcTqApEkOgoCTTm1dHrEZ9vDIn+F KO1r23yXUWNVrwwBiGls2PZAGuVIYnONtQ2DYnsCh7VYTet/tO1/ALoD5M+rzATHvbg+ YLEhRmiNJlnDVAN9XXFyYqynC5ddz0kur7ZfqV1LruPsbxFWs1ovLUCwS+Jl8yiBRHlY dD/HDL1SvsbrfDTs2/XqL6ptUkWNwPLNVD3YQeqxOUbZnhnTciQxYRDZmheAIPreCFjK K0zw== X-Gm-Message-State: APjAAAX/j9fHrVwAXqp5KbpOvmIbOF2va7bnQEqxIroi3aN+YzNtEnbr HtcGGOa0F3uBQvsU9xZc3BF9+A== X-Google-Smtp-Source: APXvYqzoTzd5ibMnHOKs8QSmQ9ECHVoQtC6hvpcTGyZOav8pazdUE2AYu0ii2mIN7SWHvV1sThnX0Q== X-Received: by 2002:a17:902:bd06:: with SMTP id p6mr928736pls.112.1558343284692; Mon, 20 May 2019 02:08:04 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.07.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:08:04 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [DO NOT MERGE] [PATCH v10 10/11] drm/panel: Add Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge Date: Mon, 20 May 2019 14:33:17 +0530 Message-Id: <20190520090318.27570-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_020806_950956_4BF2A3C7 X-CRM114-Status: GOOD ( 19.52 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 Bananapi S070WV20-CT16 ICN6211 is 800x480, 4-lane MIPI-DSI to RGB bridge panel which can be used to connect via DSI port on BPI-M64 board, so add a driver for it. The same panel PCB comes with parallel RBG which is supported via panel-simple driver with "bananapi,s070wv20-ct16" compatible. Signed-off-by: Jagan Teki --- drivers/gpu/drm/panel/Kconfig | 9 + drivers/gpu/drm/panel/Makefile | 1 + .../panel/panel-bananapi-s070wv20-icn6211.c | 293 ++++++++++++++++++ 3 files changed, 303 insertions(+) create mode 100644 drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index e36dbb4df867..d0cb2fa3e721 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -17,6 +17,15 @@ config DRM_PANEL_ARM_VERSATILE reference designs. The panel is detected using special registers in the Versatile family syscon registers. +config DRM_PANEL_BANANAPI_S070WV20_ICN6211 + tristate "Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB bridge panel driver" + depends on OF + depends on DRM_MIPI_DSI + depends on BACKLIGHT_CLASS_DEVICE + help + Say Y if you want to enable support for panels based on the + Bananapi S070WV20-CT16 MIPI-DSI controller. + config DRM_PANEL_LVDS tristate "Generic LVDS panel driver" depends on OF diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 78e3dc376bdd..a68e990a4a73 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o +obj-$(CONFIG_DRM_PANEL_BANANAPI_S070WV20_ICN6211) += panel-bananapi-s070wv20-icn6211.o obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o diff --git a/drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c b/drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c new file mode 100644 index 000000000000..52a5b60278af --- /dev/null +++ b/drivers/gpu/drm/panel/panel-bananapi-s070wv20-icn6211.c @@ -0,0 +1,293 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2018 Amarula Solutions + * Author: Jagan Teki + */ + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include + +struct s070wv20 { + struct drm_panel panel; + struct mipi_dsi_device *dsi; + + struct backlight_device *backlight; + struct regulator *vdd; + struct gpio_desc *enable_gpio; + struct gpio_desc *reset_gpio; +}; + +static inline struct s070wv20 *panel_to_s070wv20(struct drm_panel *panel) +{ + return container_of(panel, struct s070wv20, panel); +} + +struct s070wv20_init_cmd { + size_t len; + const char *data; +}; + +#define S070WV20_INIT_CMD(...) { \ + .len = sizeof((char[]){__VA_ARGS__}), \ + .data = (char[]){__VA_ARGS__} } + +static const struct s070wv20_init_cmd s070wv20_init_cmds[] = { + S070WV20_INIT_CMD(0x7A, 0xC1), + S070WV20_INIT_CMD(0x20, 0x20), + S070WV20_INIT_CMD(0x21, 0xE0), + S070WV20_INIT_CMD(0x22, 0x13), + S070WV20_INIT_CMD(0x23, 0x28), + S070WV20_INIT_CMD(0x24, 0x30), + S070WV20_INIT_CMD(0x25, 0x28), + S070WV20_INIT_CMD(0x26, 0x00), + S070WV20_INIT_CMD(0x27, 0x0D), + S070WV20_INIT_CMD(0x28, 0x03), + S070WV20_INIT_CMD(0x29, 0x1D), + S070WV20_INIT_CMD(0x34, 0x80), + S070WV20_INIT_CMD(0x36, 0x28), + S070WV20_INIT_CMD(0xB5, 0xA0), + S070WV20_INIT_CMD(0x5C, 0xFF), + S070WV20_INIT_CMD(0x2A, 0x01), + S070WV20_INIT_CMD(0x56, 0x92), + S070WV20_INIT_CMD(0x6B, 0x71), + S070WV20_INIT_CMD(0x69, 0x2B), + S070WV20_INIT_CMD(0x10, 0x40), + S070WV20_INIT_CMD(0x11, 0x98), + S070WV20_INIT_CMD(0xB6, 0x20), + S070WV20_INIT_CMD(0x51, 0x20), + S070WV20_INIT_CMD(0x09, 0x10), +}; + +static int s070wv20_prepare(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + struct mipi_dsi_device *dsi = ctx->dsi; + unsigned int i; + int ret; + + ret = regulator_enable(ctx->vdd); + if (ret) + return ret; + + msleep(50); + + gpiod_set_value(ctx->reset_gpio, 1); + msleep(50); + + gpiod_set_value(ctx->enable_gpio, 1); + msleep(50); + + gpiod_set_value(ctx->reset_gpio, 0); + msleep(50); + + gpiod_set_value(ctx->reset_gpio, 1); + msleep(20); + + for (i = 0; i < ARRAY_SIZE(s070wv20_init_cmds); i++) { + const struct s070wv20_init_cmd *cmd = &s070wv20_init_cmds[i]; + + ret = mipi_dsi_generic_write(dsi, cmd->data, cmd->len); + if (ret < 0) + return ret; + + msleep(10); + } + + return 0; +} + +static int s070wv20_enable(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + + msleep(120); + + mipi_dsi_dcs_set_display_on(ctx->dsi); + backlight_enable(ctx->backlight); + + return 0; +} + +static int s070wv20_disable(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + + backlight_disable(ctx->backlight); + return mipi_dsi_dcs_set_display_on(ctx->dsi); +} + +static int s070wv20_unprepare(struct drm_panel *panel) +{ + struct s070wv20 *ctx = panel_to_s070wv20(panel); + int ret; + + ret = mipi_dsi_dcs_set_display_off(ctx->dsi); + if (ret < 0) + dev_err(panel->dev, "failed to set display off: %d\n", ret); + + ret = mipi_dsi_dcs_enter_sleep_mode(ctx->dsi); + if (ret < 0) + dev_err(panel->dev, "failed to enter sleep mode: %d\n", ret); + + msleep(100); + + gpiod_set_value(ctx->reset_gpio, 0); + + gpiod_set_value(ctx->reset_gpio, 1); + + gpiod_set_value(ctx->enable_gpio, 0); + + gpiod_set_value(ctx->reset_gpio, 0); + + regulator_disable(ctx->vdd); + + return 0; +} + +static const struct drm_display_mode s070wv20_default_mode = { + .clock = 30000, + .vrefresh = 60, + + .hdisplay = 800, + .hsync_start = 800 + 40, + .hsync_end = 800 + 40 + 48, + .htotal = 800 + 40 + 48 + 40, + + .vdisplay = 480, + .vsync_start = 480 + 13, + .vsync_end = 480 + 13 + 3, + .vtotal = 480 + 13 + 3 + 29, + + .width_mm = 86, + .height_mm = 154, +}; + +static int s070wv20_get_modes(struct drm_panel *panel) +{ + struct drm_connector *connector = panel->connector; + struct s070wv20 *ctx = panel_to_s070wv20(panel); + struct drm_display_mode *mode; + + mode = drm_mode_duplicate(panel->drm, &s070wv20_default_mode); + if (!mode) { + dev_err(&ctx->dsi->dev, "failed to add mode %ux%ux@%u\n", + s070wv20_default_mode.hdisplay, + s070wv20_default_mode.vdisplay, + s070wv20_default_mode.vrefresh); + return -ENOMEM; + } + + drm_mode_set_name(mode); + + mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED; + drm_mode_probed_add(connector, mode); + + panel->connector->display_info.width_mm = mode->width_mm; + panel->connector->display_info.height_mm = mode->height_mm; + + return 1; +} + +static const struct drm_panel_funcs s070wv20_funcs = { + .disable = s070wv20_disable, + .unprepare = s070wv20_unprepare, + .prepare = s070wv20_prepare, + .enable = s070wv20_enable, + .get_modes = s070wv20_get_modes, +}; + +static int s070wv20_dsi_probe(struct mipi_dsi_device *dsi) +{ + struct device_node *np; + struct s070wv20 *ctx; + int ret; + + ctx = devm_kzalloc(&dsi->dev, sizeof(*ctx), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + mipi_dsi_set_drvdata(dsi, ctx); + ctx->dsi = dsi; + + drm_panel_init(&ctx->panel); + ctx->panel.dev = &dsi->dev; + ctx->panel.funcs = &s070wv20_funcs; + + ctx->vdd = devm_regulator_get(&dsi->dev, "vdd"); + if (IS_ERR(ctx->vdd)) { + dev_err(&dsi->dev, "Couldn't get vdd regulator\n"); + return PTR_ERR(ctx->vdd); + } + + ctx->enable_gpio = devm_gpiod_get(&dsi->dev, "enable", GPIOD_OUT_LOW); + if (IS_ERR(ctx->enable_gpio)) { + dev_err(&dsi->dev, "Couldn't get our enable GPIO\n"); + return PTR_ERR(ctx->enable_gpio); + } + + ctx->reset_gpio = devm_gpiod_get(&dsi->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(ctx->reset_gpio)) { + dev_err(&dsi->dev, "Couldn't get our reset GPIO\n"); + return PTR_ERR(ctx->reset_gpio); + } + + np = of_parse_phandle(dsi->dev.of_node, "backlight", 0); + if (np) { + ctx->backlight = of_find_backlight_by_node(np); + of_node_put(np); + + if (!ctx->backlight) + return -EPROBE_DEFER; + } + + ret = drm_panel_add(&ctx->panel); + if (ret < 0) + return ret; + + dsi->mode_flags = MIPI_DSI_MODE_VIDEO_SYNC_PULSE; + dsi->format = MIPI_DSI_FMT_RGB888; + dsi->lanes = 4; + + return mipi_dsi_attach(dsi); +} + +static int s070wv20_dsi_remove(struct mipi_dsi_device *dsi) +{ + struct s070wv20 *ctx = mipi_dsi_get_drvdata(dsi); + + mipi_dsi_detach(dsi); + drm_panel_remove(&ctx->panel); + + if (ctx->backlight) + put_device(&ctx->backlight->dev); + + return 0; +} + +static const struct of_device_id s070wv20_of_match[] = { + { .compatible = "bananapi,s070wv20-ct16-icn6211", }, + { } +}; +MODULE_DEVICE_TABLE(of, s070wv20_of_match); + +static struct mipi_dsi_driver s070wv20_driver = { + .probe = s070wv20_dsi_probe, + .remove = s070wv20_dsi_remove, + .driver = { + .name = "bananapi-s070wv20-ct16-icn6211", + .of_match_table = s070wv20_of_match, + }, +}; +module_mipi_dsi_driver(s070wv20_driver); + +MODULE_AUTHOR("Jagan Teki "); +MODULE_DESCRIPTION("Bananapi S070WV20-CT16 ICN6211 MIPI-DSI to RGB"); +MODULE_LICENSE("GPL v2"); From patchwork Mon May 20 09:03:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 10950699 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 5D686912 for ; Mon, 20 May 2019 09:24:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C395285E2 for ; Mon, 20 May 2019 09:24:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40443287DE; Mon, 20 May 2019 09:24:03 +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 D7C83287BD for ; Mon, 20 May 2019 09:24: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=6q7LbRoCSJgRzElU/EDHLY1et2/E2f56JGZJb9yahr0=; b=LZgQxdE1VueY5D 37IMb/4PJhNmuTz//NBY+lrk2WsoD3i6XePXvePpvxUYst9+l6FgK41AzX1NpLZAuronkUF20tWOU 81o/fvcdUPZRRZAo7/VIfMzACesA9XAUKhEAm/g3Rt96D1WgPlM/AXvf3zQy0ObFEJOHHRA3gIBTt ESVQY3W5OKh5q+uqq1gDTmOX5ezixI0xrN37gcSoFGI0spSeMU8lX+NWYPFT57b9BXqHbiqHsZiyD A1UTzpNLqIE0o0vpkWYVwZ5yqEFonWiKx88sQaWM6xPpIFZv4RHkpnk0XzLwthBqVoYHsXMMAG+Fz CeI9FVG4peP+KSX3xpCw==; 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 1hSeWT-0002r4-7M; Mon, 20 May 2019 09:23:57 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSeWQ-0002Ln-M2 for linux-arm-kernel@bombadil.infradead.org; Mon, 20 May 2019 09:23:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=iobrvkxDT6nYXsPnTycSKoAi+/ZUGwRhXcWR3t2hhKA=; b=A1jTxM5p8gOHsh+teVzVBypWGs 0G0r1+PH8vr8f+OvVuR1oro5N2A2rnfZAvZq+XBAA1p34TARHxkNj+prRlYNOnj0HA2gk3GsU4BHg ktbXjw9iwb1bwFnficTf3N96J/JY3pnNfc9cOq356eo2obtkVsXEa38SHda4eM3ElRsu3zjtLtaMF 0mdvIWAErfaJNAMnwi11RlnBgnJxVe0zmfVe2X+t2ncMO87yAyjyBYrFEgsRJPmmx6p3NW+qV+Mik K5ptg65Ol7lbeh04aTW6evK72ok0ANCvJzC0JLf7XQ5NMf4OGaXNPbKjTUGWSkFqlG9osDiy4CTX1 3duwBM3w==; Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]) by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSeHD-0008Lt-Vx for linux-arm-kernel@lists.infradead.org; Mon, 20 May 2019 09:08:13 +0000 Received: by mail-pg1-x541.google.com with SMTP id w22so6487237pgi.6 for ; Mon, 20 May 2019 02:08:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iobrvkxDT6nYXsPnTycSKoAi+/ZUGwRhXcWR3t2hhKA=; b=YGMFMvzmnYk0vgW+1qinWeqho4ZrFohDa91VmDHH0o1w7TGJiw9k3Uv7vQnjo6c6DE +wAEgQCxg7/pT/3sX2p1y70F3SiL/Vb6nWGWHQTB1tfe3v0almhqdNOHCpJOEbIT5Dm8 Rm/nJSjTvc09FlYZ/xB3j0Fci3TvQU+Lwjnd0= 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=iobrvkxDT6nYXsPnTycSKoAi+/ZUGwRhXcWR3t2hhKA=; b=qQ8M7zKTVdyWrS+w1GOOgkxdz80+ZnYfc2v0SXUYAZdFrmgjB/hHRmGyURo672oAvF wwdpRE36Y7HPxoz6LRmc408nETEmrbyKlOUn1gBHM9vyJba3ZMdyOOzm2liMep/Iywfa ymVDZBE6RI9sxffR0kv+x8sETqImbXy2W6X+P9daAafEsuUfQG/s18OuzeaBrX51z1FS r6CB+gcP3qks7GBgYLLnunMuh3Z5WgGhfzgC9d/T1mmejBa5R7EwDEIWyEZG5EOXQpbU ///5v/qeDOgHKk8d69CH60H53OKWTDNihIsdr0v8RrlPiHyd+7LdBoqL3A49j7A/+CA2 Z2Yw== X-Gm-Message-State: APjAAAVqJe1n56HERQQiaHbDzE0cd5U4vnMSuHesHtVOQYoJDxXI8sHJ z5d5ksglMIFkcFj8Jb7/0DGszUTurCg= X-Google-Smtp-Source: APXvYqzDwmf2r63M8wJFjDamN8uTWypMZ/YvvCw1Tdx3AB1+JxAKjRinOny5iplJXhONAKLzQyVDGQ== X-Received: by 2002:a65:42cd:: with SMTP id l13mr21087709pgp.72.1558343289969; Mon, 20 May 2019 02:08:09 -0700 (PDT) Received: from localhost.localdomain ([183.82.227.193]) by smtp.gmail.com with ESMTPSA id d15sm51671614pfm.186.2019.05.20.02.08.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 May 2019 02:08:09 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , David Airlie , Daniel Vetter , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [DO NOT MERGE] [PATCH v10 11/11] ARM: dts: sun8i: bananapi-m2m: Enable Bananapi S070WV20-CT16 DSI panel Date: Mon, 20 May 2019 14:33:18 +0530 Message-Id: <20190520090318.27570-12-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20190520090318.27570-1-jagan@amarulasolutions.com> References: <20190520090318.27570-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190520_100812_102785_6AA1BE03 X-CRM114-Status: GOOD ( 15.06 ) 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: bshah@mykolab.com, powerpan@qq.com, linux-sunxi@googlegroups.com, Jagan Teki , michael@amarulasolutions.com, linux-amarula@amarulasolutions.com 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 patch add support for Bananapi S070WV20-CT16 DSI panel to BPI-M2M board. DSI panel connected via board DSI port with, - DCDC1 as VCC-DSI supply - DLDO1 as VDD supply - PL5 gpio for lcd reset gpio pin - PB7 gpio for lcd enable gpio pin - PL4 gpio for backlight enable pin Signed-off-by: Jagan Teki --- arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 40 ++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts index e1c75f7fa3ca..4e71e81d2bad 100644 --- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts +++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts @@ -44,6 +44,7 @@ #include "sun8i-a33.dtsi" #include +#include / { model = "BananaPi M2 Magic"; @@ -61,6 +62,14 @@ stdout-path = "serial0:115200n8"; }; + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>; + brightness-levels = <1 2 4 8 16 32 64 128 255>; + default-brightness-level = <8>; + enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 */ + }; + leds { compatible = "gpio-leds"; @@ -122,6 +131,27 @@ status = "okay"; }; +&de { + status = "okay"; +}; + +&dphy { + status = "okay"; +}; + +&dsi { + vcc-dsi-supply = <®_dcdc1>; /* VCC3V3-DSI */ + status = "okay"; + + panel@0 { + compatible = "bananapi,s070wv20-ct16-icn6211"; + reg = <0>; + enable-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */ + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */ + backlight = <&backlight>; + }; +}; + &ehci0 { status = "okay"; }; @@ -157,6 +187,12 @@ status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -269,6 +305,10 @@ status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;