From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 83AABC433EF for ; Mon, 22 Nov 2021 15:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1yVFyWL4KtVSv1b+V2u95dGmBPuWIoos/urT7u9b5Tw=; b=egFF2r+hQzvclZ8AW4nRg/Oaws X3dVd2Z4SqgDXcW/CeM8V822G2Ar+1FsCJxnluMPyo1VpJkOFt2fmiwl/nJ4TdHc2IEoR9jUDyLT1 Iq6l/pgtrXDwVdDYO9NQOeFSQ6et1wFJly9dCvW3Qee63wtmsYaVArsIln7wlWFgTF6kT+xXZCaGN xcc/aVPeOMwvYpuwPsduqAVVCubhCO6ORyLTfXTveQolYssKGjrqgUbdPGbeJn4qEZrlt7mDMm6vk 2OeSSKCLFlSQqwVmkNQ106cbq72OaqCXG4ooEIsy4fY5102grL1K7smRd9MN2f4hpsqASlA5A0wCU 3JF7SKQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpBMC-00H3Lp-Hz; Mon, 22 Nov 2021 15:35:48 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mpBM8-00H3L3-3T for linux-arm-kernel@lists.infradead.org; Mon, 22 Nov 2021 15:35:46 +0000 Received: by mail-wm1-x336.google.com with SMTP id i8-20020a7bc948000000b0030db7b70b6bso17162678wml.1 for ; Mon, 22 Nov 2021 07:35:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tEysCCocALBU/rUp6AhyWkRhZMZjzwQs7VwnjhYTvPk=; b=fFb+naYoMcVI/gT3T/aM6fcLKB7O4tOdu7o7RvV/ZYLTgomjCsjm1H3MSFmxrLWdi3 irmDq7P8749xqRMqy1P+0AXHlgk+lae1sv/7SVrNjxdL1xRf6puY2wv/YL3KrHTNKhvO yZuCd1lpk8qMjAdoaS0tETj5H/+4WiHP5fr2bSOtKIwhe754C1IGLgrsJ5ds2GRa7Fcc qRRV0I8Rb6sY3OBe4eV9PSGDfJZUMX+30+1O1Uzy/aTefETKPMGi6RRGX1QJ3++b0i3K VmT+U0r9rWvX64LdSwGq6iA/jAZYw65qQ65di69BpvtUonDNBszRJRArRjHmzSppSgxV 8/Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=tEysCCocALBU/rUp6AhyWkRhZMZjzwQs7VwnjhYTvPk=; b=PhytV2d0BNxU118rSTjDBfNv0gIsV256wQwOVnOH2siAixsDbduaCCblFfq2g88cjq jcDpgC3BkTc24fqeAifxcriGxS+pJBC7MmAlQtiUOmcZ4kQqFR+dtGKSxsQQyTcrAm9b DT764mB6PFVYpe7ACsXY9Dxew5IpRNWYL/uHkOLAYPuxfsFBh4lKP/wmcDEb/XOFKAmJ sAsw4jZWw5nkuA8WQwmRSym3TsNNLnKg5Mv4YyP5yAULATBKlbk2CTD1lyVqsNyDL8ZK OqpohjX6hwjGZZ9+2AR0UBTiZiYbByWGbZdsOtLp6k8kuDk6e3o66qZhW0H3/fIUTKNS Ez2A== X-Gm-Message-State: AOAM530YMBCTnz8ZMWZqkNUvyoD85zP1WBzUwLKFMA+a/e2yp88m5lU6 StfMJF03UExEgMFcuhSdm0owTA== X-Google-Smtp-Source: ABdhPJyi2G+8oCyRLwWPNkZSI70OLFA95QCd+6GE7Il0Ktgf0j1ii6P7Rn6RweTgMCUAB34kwOrHsQ== X-Received: by 2002:a1c:5414:: with SMTP id i20mr30848635wmb.88.1637595341947; Mon, 22 Nov 2021 07:35:41 -0800 (PST) Received: from ?IPv6:2001:861:44c0:66c0:68f2:9b9a:7f6d:f86c? ([2001:861:44c0:66c0:68f2:9b9a:7f6d:f86c]) by smtp.gmail.com with ESMTPSA id h27sm23929091wmc.43.2021.11.22.07.35.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Nov 2021 07:35:41 -0800 (PST) Subject: Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver To: Jagan Teki Cc: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Robert Foss , Sam Ravnborg , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com References: <20211122065223.88059-1-jagan@amarulasolutions.com> <20211122065223.88059-4-jagan@amarulasolutions.com> <35a25992-741b-b3f1-c3cd-695a19b9a413@baylibre.com> From: Neil Armstrong Organization: Baylibre Message-ID: <9aa3d19d-4378-aaf3-6857-c40be5d252c7@baylibre.com> Date: Mon, 22 Nov 2021 16:35:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211122_073544_189505_7DC798BF X-CRM114-Status: GOOD ( 25.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, On 22/11/2021 14:16, Jagan Teki wrote: > Hi Neil, > > On Mon, Nov 22, 2021 at 6:22 PM Neil Armstrong wrote: >> >> On 22/11/2021 07:52, Jagan Teki wrote: >>> Some display panels would come up with a non-DSI output, those >>> can have an option to connect the DSI host by means of interface >>> bridge converter. >>> >>> This DSI to non-DSI interface bridge converter would requires >>> DSI Host to handle drm bridge functionalities in order to DSI >>> Host to Interface bridge. >>> >>> This patch convert the existing to a drm bridge driver with a >>> built-in encoder support for compatibility with existing >>> component drivers. >>> >>> Signed-off-by: Jagan Teki >>> --- >>> Changes for v5: >>> - add atomic APIs >>> - find host and device variant DSI devices. >>> Changes for v4, v3: >>> - none >>> >>> drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 ++++++++++++++++++++----- >>> drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 7 ++ >>> 2 files changed, 96 insertions(+), 23 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c >>> index 43d9c9e5198d..a6a272b55f77 100644 >>> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c >>> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c >>> @@ -21,6 +21,7 @@ >>> >>> #include >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi, >>> return 0; >>> } >>> >>> -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) >>> +static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge, >>> + struct drm_bridge_state *old_bridge_state) >>> { >>> - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; >>> - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); >>> + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); >>> + struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; >>> struct mipi_dsi_device *device = dsi->device; >>> union phy_configure_opts opts = { }; >>> struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; >>> @@ -772,6 +774,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) >>> if (dsi->panel) >>> drm_panel_prepare(dsi->panel); >>> >>> + if (dsi->next_bridge) >>> + dsi->next_bridge->funcs->atomic_pre_enable(dsi->next_bridge, old_bridge_state); >>> + >>> /* >>> * FIXME: This should be moved after the switch to HS mode. >>> * >>> @@ -787,6 +792,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) >>> if (dsi->panel) >>> drm_panel_enable(dsi->panel); >>> >>> + if (dsi->next_bridge) >>> + dsi->next_bridge->funcs->atomic_enable(dsi->next_bridge, old_bridge_state); >>> + >> >> >> No need to call the next bridge atomic pre_enable/enable/disable/post_disable since they will >> be called automatically on the bridge chain. > > Correct, but the existing bridge chain (stack) is not compatible with > sun6i DSI start sequence. We cannot send any DCS once we start HS > mode. > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c#n775 It's a classical DSI sequence init issue, look at dw-mipi-dsi: https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c We setup the "command-mode" (low-speed) withing mode_set so when the next bridge dsi_pre_enable is called, low-speed DCS can be sent, then the bridge enable() sets video mode (high-speed). The disable still needs to call the next_bridge post_disable : https://elixir.bootlin.com/linux/v5.16-rc2/source/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c#L893 You can send any low-speed DCS once HS mode is started if the HW supports it and the driver handles it, look at the https://elixir.bootlin.com/linux/v5.16-rc2/source/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c#L397 The MIPI_DSI_MODE_LPM and MIPI_DSI_MSG_USE_LPM is used for that. Neil > > This specific problem can be fixed only if we change the bridge chain > from stack to queue. Please check this series > https://patchwork.kernel.org/project/dri-devel/patch/20210214194102.126146-6-jagan@amarulasolutions.com/ > > Jagan. > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 180E6C433F5 for ; Mon, 22 Nov 2021 15:35:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 11C57897FB; Mon, 22 Nov 2021 15:35:45 +0000 (UTC) Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by gabe.freedesktop.org (Postfix) with ESMTPS id B4E2A89F4A for ; Mon, 22 Nov 2021 15:35:43 +0000 (UTC) Received: by mail-wm1-x32e.google.com with SMTP id p3-20020a05600c1d8300b003334fab53afso17165888wms.3 for ; Mon, 22 Nov 2021 07:35:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=subject:to:cc:references:from:organization:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=tEysCCocALBU/rUp6AhyWkRhZMZjzwQs7VwnjhYTvPk=; b=fFb+naYoMcVI/gT3T/aM6fcLKB7O4tOdu7o7RvV/ZYLTgomjCsjm1H3MSFmxrLWdi3 irmDq7P8749xqRMqy1P+0AXHlgk+lae1sv/7SVrNjxdL1xRf6puY2wv/YL3KrHTNKhvO yZuCd1lpk8qMjAdoaS0tETj5H/+4WiHP5fr2bSOtKIwhe754C1IGLgrsJ5ds2GRa7Fcc qRRV0I8Rb6sY3OBe4eV9PSGDfJZUMX+30+1O1Uzy/aTefETKPMGi6RRGX1QJ3++b0i3K VmT+U0r9rWvX64LdSwGq6iA/jAZYw65qQ65di69BpvtUonDNBszRJRArRjHmzSppSgxV 8/Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=tEysCCocALBU/rUp6AhyWkRhZMZjzwQs7VwnjhYTvPk=; b=DThdUkDIjNxdpa4O6O6RLJyX2v/k5ydJ+fUrM6Q59mSnpaIW+FcOcv0UYwRiBe9FRy m1G5X5TR/t+ujqa9Y3d0BYhVpIdLOsSfsVlSjCmgFK5wFWmtpbuO9DfjTZvnd5JymwfS Jl3qZlk9Llq0Z8fjsrD0wlo7AwK29/UBj/WKo6loCcmxzHfG/WnaB32m1IFatUTh0lMZ YwnlBCviU/gBrM1vnBbZOQXurbN+tS6D9XHBgWQsWww/+geWB0L9mck8zTb0WpR9MpTv il0aVYGDbwP/xlhBpG8Tb4UqFBkhWJfmINP5UbbsrLtjsdfL7TMEdZ5AHACaBaZgYdXq NbZw== X-Gm-Message-State: AOAM531iEfNJSTiSPbmc884liy7i8jiOzDn2Lt6HmMXmNb45gYjTSb1u Z5aTg97VV/Awe/ocyEG3tFV4pQ== X-Google-Smtp-Source: ABdhPJyi2G+8oCyRLwWPNkZSI70OLFA95QCd+6GE7Il0Ktgf0j1ii6P7Rn6RweTgMCUAB34kwOrHsQ== X-Received: by 2002:a1c:5414:: with SMTP id i20mr30848635wmb.88.1637595341947; Mon, 22 Nov 2021 07:35:41 -0800 (PST) Received: from ?IPv6:2001:861:44c0:66c0:68f2:9b9a:7f6d:f86c? ([2001:861:44c0:66c0:68f2:9b9a:7f6d:f86c]) by smtp.gmail.com with ESMTPSA id h27sm23929091wmc.43.2021.11.22.07.35.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Nov 2021 07:35:41 -0800 (PST) Subject: Re: [PATCH v5 3/7] drm: sun4i: dsi: Convert to bridge driver To: Jagan Teki References: <20211122065223.88059-1-jagan@amarulasolutions.com> <20211122065223.88059-4-jagan@amarulasolutions.com> <35a25992-741b-b3f1-c3cd-695a19b9a413@baylibre.com> From: Neil Armstrong Organization: Baylibre Message-ID: <9aa3d19d-4378-aaf3-6857-c40be5d252c7@baylibre.com> Date: Mon, 22 Nov 2021 16:35:40 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, dri-devel@lists.freedesktop.org, Chen-Yu Tsai , Robert Foss , Sam Ravnborg , linux-arm-kernel@lists.infradead.org, Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Hi, On 22/11/2021 14:16, Jagan Teki wrote: > Hi Neil, > > On Mon, Nov 22, 2021 at 6:22 PM Neil Armstrong wrote: >> >> On 22/11/2021 07:52, Jagan Teki wrote: >>> Some display panels would come up with a non-DSI output, those >>> can have an option to connect the DSI host by means of interface >>> bridge converter. >>> >>> This DSI to non-DSI interface bridge converter would requires >>> DSI Host to handle drm bridge functionalities in order to DSI >>> Host to Interface bridge. >>> >>> This patch convert the existing to a drm bridge driver with a >>> built-in encoder support for compatibility with existing >>> component drivers. >>> >>> Signed-off-by: Jagan Teki >>> --- >>> Changes for v5: >>> - add atomic APIs >>> - find host and device variant DSI devices. >>> Changes for v4, v3: >>> - none >>> >>> drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 ++++++++++++++++++++----- >>> drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 7 ++ >>> 2 files changed, 96 insertions(+), 23 deletions(-) >>> >>> diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c >>> index 43d9c9e5198d..a6a272b55f77 100644 >>> --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c >>> +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c >>> @@ -21,6 +21,7 @@ >>> >>> #include >>> #include >>> +#include >>> #include >>> #include >>> #include >>> @@ -713,10 +714,11 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi, >>> return 0; >>> } >>> >>> -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) >>> +static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge, >>> + struct drm_bridge_state *old_bridge_state) >>> { >>> - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; >>> - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); >>> + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); >>> + struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; >>> struct mipi_dsi_device *device = dsi->device; >>> union phy_configure_opts opts = { }; >>> struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; >>> @@ -772,6 +774,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) >>> if (dsi->panel) >>> drm_panel_prepare(dsi->panel); >>> >>> + if (dsi->next_bridge) >>> + dsi->next_bridge->funcs->atomic_pre_enable(dsi->next_bridge, old_bridge_state); >>> + >>> /* >>> * FIXME: This should be moved after the switch to HS mode. >>> * >>> @@ -787,6 +792,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) >>> if (dsi->panel) >>> drm_panel_enable(dsi->panel); >>> >>> + if (dsi->next_bridge) >>> + dsi->next_bridge->funcs->atomic_enable(dsi->next_bridge, old_bridge_state); >>> + >> >> >> No need to call the next bridge atomic pre_enable/enable/disable/post_disable since they will >> be called automatically on the bridge chain. > > Correct, but the existing bridge chain (stack) is not compatible with > sun6i DSI start sequence. We cannot send any DCS once we start HS > mode. > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c#n775 It's a classical DSI sequence init issue, look at dw-mipi-dsi: https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c We setup the "command-mode" (low-speed) withing mode_set so when the next bridge dsi_pre_enable is called, low-speed DCS can be sent, then the bridge enable() sets video mode (high-speed). The disable still needs to call the next_bridge post_disable : https://elixir.bootlin.com/linux/v5.16-rc2/source/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c#L893 You can send any low-speed DCS once HS mode is started if the HW supports it and the driver handles it, look at the https://elixir.bootlin.com/linux/v5.16-rc2/source/drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c#L397 The MIPI_DSI_MODE_LPM and MIPI_DSI_MSG_USE_LPM is used for that. Neil > > This specific problem can be fixed only if we change the bridge chain > from stack to queue. Please check this series > https://patchwork.kernel.org/project/dri-devel/patch/20210214194102.126146-6-jagan@amarulasolutions.com/ > > Jagan. >