From patchwork Mon Dec 5 17:33:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 13064874 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 E7495C4332F for ; Mon, 5 Dec 2022 17:33:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5CE1310E26C; Mon, 5 Dec 2022 17:33:56 +0000 (UTC) Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6576410E268 for ; Mon, 5 Dec 2022 17:33:48 +0000 (UTC) Received: by mail-wm1-x32f.google.com with SMTP id p13-20020a05600c468d00b003cf8859ed1bso10665214wmo.1 for ; Mon, 05 Dec 2022 09:33:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DbOHaQWKqvBS1JahcuSixvUAmOZjyYpYLqTykMsal3g=; b=OJDc2nXt4r56jdPyin7fZ9LKcGXuy8iONnQUru8POHQw3B1nqBgPYER5dqW9NAFeTG OIC6dObP+kJjCtLK1m/l+ixOOcbwvlu1us5OM4ndSRZAaRGUfX3bfEpPTThfoJd3grcE 8AVj7uu8tP0pnu18VkwtAYrcdPOtP71dgNmgYuEkKOcV2AbrjT8M5yHMD26DE2okFewh sC8Ft92x75Vq21FJADDv4Cg3DZTVDmkLDsg4Mmx4ssP9XpZvKyhBX74DI/7zf8xazHJT lva4UtBPGCuF9vT+UALqSK8gwVS66nQgSq97vJVE/RaBTSoSVukKTPrn4EIsCvznxDfW quZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DbOHaQWKqvBS1JahcuSixvUAmOZjyYpYLqTykMsal3g=; b=cx/7epRla2TvQMNwP8XZrkXQKZkL5Z7plwilW8cYlwZHBoI+cdIlt+KuE+X3xWMgMS k4elo5GZAm4X2dyWoleAcQDXTV06eFiw4gWFFAj76IEvfiL4uz03VrjRQ4aiCW4hkrhB pAeTm7aq/d+SDMtO1Ta8bV5xpxLjLGZS2lxZP3VtDXRMRKwEuTFz35Kwx+9MYWY6mUUI KHz9ny4vNoQHGf/kuZfhB7iw7+XnpP1G6eJwb6zWnuyvlhEzcE297d9R9Fwp/+3Db7tb yFjyb0OVsdmGhritJw7J92qwMCWevA/7fko1cxOgcGpMXIaQ4TuzDcMZOuthdsWVTKSK dMOw== X-Gm-Message-State: ANoB5plKlE3t0agTcls8C018Y4A5LEOeHXiO/YtGtjnj+2S1uafWP2Fa um1ws7Pi19iELvZoUFj11ltODQ== X-Google-Smtp-Source: AA0mqf4Sa/hXz+HQIjJMqWM+fo+koF1c3/WyuqO+yYE1Dp9Dr6xlmZQHPpo78Fk4qykgrfaMyQztIw== X-Received: by 2002:a05:600c:46c8:b0:3cf:8896:e1de with SMTP id q8-20020a05600c46c800b003cf8896e1demr54854609wmo.4.1670261626921; Mon, 05 Dec 2022 09:33:46 -0800 (PST) Received: from dave-Ubuntu2204.pitowers.org ([93.93.133.154]) by smtp.googlemail.com with ESMTPSA id v15-20020a5d6b0f000000b002421ed1d8c8sm14524245wrw.103.2022.12.05.09.33.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 09:33:46 -0800 (PST) From: Dave Stevenson To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v4 1/6] drm/bridge: ps8640: Use atomic variants of drm_bridge_funcs Date: Mon, 5 Dec 2022 17:33:23 +0000 Message-Id: <20221205173328.1395350-2-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> References: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 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: Marek Vasut , Chun-Kuang Hu , Philip Chen , Jitao Shi , Jonas Karlman , Robert Foss , Neil Armstrong , Douglas Anderson , Jernej Skrabec , Frieder Schrempf , andrzej.hajda@gmail.com, Laurent Pinchart , Andrzej Hajda , Dmitry Baryshkov , Dave Stevenson , Sam Ravnborg , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sam Ravnborg The atomic variants of enable/disable in drm_bridge_funcs are the preferred operations - introduce these. The ps8640 driver used the non-atomic variants of the drm_bridge_chain_pre_enable/ drm_bridge_chain_post_disable - convert these to the atomic variants. v2: - Init state operations in drm_bridge_funcs (Laurent) Signed-off-by: Sam Ravnborg Reviewed-by: Maxime Ripard Cc: Jitao Shi Cc: Philip Chen Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Reviewed-by: Laurent Pinchart Signed-off-by: Dave Stevenson --- drivers/gpu/drm/bridge/parade-ps8640.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index f74090a9cc9e..4b361d7d5e44 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -442,7 +443,8 @@ static const struct dev_pm_ops ps8640_pm_ops = { pm_runtime_force_resume) }; -static void ps8640_pre_enable(struct drm_bridge *bridge) +static void ps8640_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; @@ -476,7 +478,8 @@ static void ps8640_pre_enable(struct drm_bridge *bridge) ps_bridge->pre_enabled = true; } -static void ps8640_post_disable(struct drm_bridge *bridge) +static void ps8640_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct ps8640 *ps_bridge = bridge_to_ps8640(bridge); @@ -554,7 +557,7 @@ static struct edid *ps8640_bridge_get_edid(struct drm_bridge *bridge, * EDID, for this chip, we need to do a full poweron, otherwise it will * fail. */ - drm_bridge_chain_pre_enable(bridge); + drm_atomic_bridge_chain_pre_enable(bridge, connector->state->state); edid = drm_get_edid(connector, ps_bridge->page[PAGE0_DP_CNTL]->adapter); @@ -564,7 +567,7 @@ static struct edid *ps8640_bridge_get_edid(struct drm_bridge *bridge, * before, return the chip to its original power state. */ if (poweroff) - drm_bridge_chain_post_disable(bridge); + drm_atomic_bridge_chain_post_disable(bridge, connector->state->state); return edid; } @@ -579,8 +582,11 @@ static const struct drm_bridge_funcs ps8640_bridge_funcs = { .attach = ps8640_bridge_attach, .detach = ps8640_bridge_detach, .get_edid = ps8640_bridge_get_edid, - .post_disable = ps8640_post_disable, - .pre_enable = ps8640_pre_enable, + .atomic_post_disable = ps8640_atomic_post_disable, + .atomic_pre_enable = ps8640_atomic_pre_enable, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, }; static int ps8640_bridge_get_dsi_resources(struct device *dev, struct ps8640 *ps_bridge) From patchwork Mon Dec 5 17:33:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 13064879 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 5F2E6C4332F for ; Mon, 5 Dec 2022 17:34:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E8E8210E271; Mon, 5 Dec 2022 17:34:09 +0000 (UTC) Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5DF0910E268 for ; Mon, 5 Dec 2022 17:33:49 +0000 (UTC) Received: by mail-wr1-x42b.google.com with SMTP id u12so18774394wrr.11 for ; Mon, 05 Dec 2022 09:33:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=brT86hOry6dm+KHG3KdMkX+2L0L5VyauXhJ+PwKI4nU=; b=aXwLbJf6jZaYJXQ3T0Xa8HTHVhWePB55ab4352bibY9MEKOiYUCC7uc7zoSoK01O63 MyaMFdeeabzeyU8/Z17PhYjUoAh3FQ+NrkQfpe8zdLWqkxfmIA1PTC7mJssfN6gumF2i kP67EQxU9q15LkandCtf+tUVe6SRywoV/77ORKhVFhubEuqE9uUy8+Fz/JJrh35xp0vp 4rOIX83NJME48JgLR2I0a85cEyrewkwuYlSMEovRDL6HtZY9mF1p8E7rSDxwC0CM4gIH 5B3bQdRHV5xnb9vtC1hgIIrI7p46+hFo4/oosIRrsm7NjOHb11g7xB8OzdYPMn5tsevp uNgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=brT86hOry6dm+KHG3KdMkX+2L0L5VyauXhJ+PwKI4nU=; b=iaf98yHJYMS0U9kHIfPgUElOgS2VGi5QE0hFCH0rg6VjT45qXl3sBY4kIgstYnNamW ZaT+9UcdbrfZneikBL+iXFbOYz3E2FMx59RHzFsQpJpEiJCjIisPT47J0P/kl48t25fT 1nJoLRVmp4gszgVO3KG37D9EoUoRe5C89HuqhwFOD77vpG8hpNbo0IiL+b7AFR6mzEmi LCPOgWjubq9MY2C8fZ+oI3j6q89Q8ZcCXAyYt45lyVri0qdzQmzFYcZ+cWIPhgaVI5Yb rqCoyezJCpZaf062C/nuRz0AtFktIx1pHsftiwHUNtHJWtOlKin2Po6B3xnwX50+1jPR 5uYQ== X-Gm-Message-State: ANoB5pm6AyEHXJLrsGfpqfDcRNlw5+QfB9z8/vkxr9PqsU2ht661AaJI 4vV6tGtXKQl3c8GNidTJ6L2+6w== X-Google-Smtp-Source: AA0mqf5BsL4qsd3QBPn5wqGw570m5F/bUgIOkqGf2ET6Bli2bEUuk+xV3DIMKnpp5LB2NXv9d1lzpQ== X-Received: by 2002:adf:fa12:0:b0:242:1c:7507 with SMTP id m18-20020adffa12000000b00242001c7507mr31994871wrr.42.1670261627916; Mon, 05 Dec 2022 09:33:47 -0800 (PST) Received: from dave-Ubuntu2204.pitowers.org ([93.93.133.154]) by smtp.googlemail.com with ESMTPSA id v15-20020a5d6b0f000000b002421ed1d8c8sm14524245wrw.103.2022.12.05.09.33.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 09:33:47 -0800 (PST) From: Dave Stevenson To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v4 2/6] drm/mediatek: dp: Replace usage of drm_bridge_chain_ functions Date: Mon, 5 Dec 2022 17:33:24 +0000 Message-Id: <20221205173328.1395350-3-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> References: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 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: Marek Vasut , Chun-Kuang Hu , Jonas Karlman , Robert Foss , Neil Armstrong , Douglas Anderson , Jernej Skrabec , Frieder Schrempf , andrzej.hajda@gmail.com, Laurent Pinchart , Andrzej Hajda , Dmitry Baryshkov , Dave Stevenson , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Commit f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver") added usage of the drm_bridge_chain_ functions which are to be deprecated. Replace with the drm_atomic_bridge_chain_ variants using the current state. Signed-off-by: Dave Stevenson --- drivers/gpu/drm/mediatek/mtk_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c index 9d085c05c49c..b4feaabdb6a7 100644 --- a/drivers/gpu/drm/mediatek/mtk_dp.c +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -1981,7 +1981,7 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, struct cea_sad *sads; if (!enabled) { - drm_bridge_chain_pre_enable(bridge); + drm_atomic_bridge_chain_pre_enable(bridge, connector->state->state); /* power on aux */ mtk_dp_update_bits(mtk_dp, MTK_DP_TOP_PWR_STATE, @@ -2019,7 +2019,7 @@ static struct edid *mtk_dp_get_edid(struct drm_bridge *bridge, DP_PWR_STATE_BANDGAP_TPLL, DP_PWR_STATE_MASK); - drm_bridge_chain_post_disable(bridge); + drm_atomic_bridge_chain_post_disable(bridge, connector->state->state); } return new_edid; From patchwork Mon Dec 5 17:33:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 13064878 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 5D907C4332F for ; Mon, 5 Dec 2022 17:34:16 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7A70D10E270; Mon, 5 Dec 2022 17:34:09 +0000 (UTC) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9286210E26C for ; Mon, 5 Dec 2022 17:33:50 +0000 (UTC) Received: by mail-wr1-x432.google.com with SMTP id f18so19732009wrj.5 for ; Mon, 05 Dec 2022 09:33:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Yyvi/DW9V46SY2WuhKDn+T+jmYp9vsYS86YFdGA8dxY=; b=lb1VP2XCA0D1x1NTihsMPEN0l7HGUX6TXJRp15KsgcsWmftiu+J5z8u6AwBNTmEc+W 9rK2b8ianIE8hSUnjLMBC/bfOsTjWuKR/q7EnGhaIpfMtadrUmnxcQ/rWOxQlpH5R5jL YBwwtJjdAIvkFgVqaW+chjg4UvPAPhNUeyektjtN7S3Z6vg+wXPbZLpDUb7mWqMnFKCo Iz+ynHSXJr63E201ZGwlNM56og3O/uVyT7+WNqkjBPw81gax0md5lZIFI+x5C17Zg5oy mku6prNeY4eOGlNszcMSgf3dOSVqfIovLRIDiKfD2tvYr1rPo1qwSqjdJP2LJEd+1YTj FgnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Yyvi/DW9V46SY2WuhKDn+T+jmYp9vsYS86YFdGA8dxY=; b=qDurY7+S2mich97uamI0y5kjyMqSR2fq7mVAldHU8Ph+uFsBD837mylujFGauf6G+j Mv7ILUu5hqLIOMHlCSUFRaZZ6ZT1NHTvQIpAiHLhhNbomAgXAnnu465Y0C9bfC6XdjQx w8plO7fubauZQTyT0I/kYms4YtunhBMNa5yqdAKKXGP/0Gi4NH1rDJeW2getwLtYnQfq HVdRYJQUz4eMo4g/A2yqNuSBvoJ40yMQulo83nMep+MArDkFjoyCtYG8F/ug67G0SL72 oVHGrLAHAKBW/YPBZU9jHVZVkctBVXEAN/o8cjkeEXlLo/ZwmmUDgc0yLfSPvB99AxUN iAYw== X-Gm-Message-State: ANoB5pmSD/WF6joU30gQNbMst2TGAkvzkWYww/D7vx7pV3QH4AOAczUR Wz0esAnB0QX5UL+UzWVUAv304g== X-Google-Smtp-Source: AA0mqf45nBTD8aVbTv67KbQiK3ZXuzbI8JKPBhaN7yZtDFtdqRB79kvYBs3SAqMG9oTteYxvEOzoLA== X-Received: by 2002:a5d:66c5:0:b0:242:1809:7e14 with SMTP id k5-20020a5d66c5000000b0024218097e14mr21141505wrw.202.1670261628956; Mon, 05 Dec 2022 09:33:48 -0800 (PST) Received: from dave-Ubuntu2204.pitowers.org ([93.93.133.154]) by smtp.googlemail.com with ESMTPSA id v15-20020a5d6b0f000000b002421ed1d8c8sm14524245wrw.103.2022.12.05.09.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 09:33:48 -0800 (PST) From: Dave Stevenson To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v4 3/6] drm/bridge: Drop unused drm_bridge_chain functions Date: Mon, 5 Dec 2022 17:33:25 +0000 Message-Id: <20221205173328.1395350-4-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> References: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 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: Marek Vasut , Chun-Kuang Hu , Jonas Karlman , Robert Foss , Neil Armstrong , Douglas Anderson , Jernej Skrabec , Frieder Schrempf , Andrzej Hajda , andrzej.hajda@gmail.com, Laurent Pinchart , Andrzej Hajda , Dmitry Baryshkov , Dave Stevenson , Sam Ravnborg , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Sam Ravnborg The drm_bridge_chain_{pre_enable,enable,disable,post_disable} has no users left and we have atomic variants that should be used. Drop them so they do not gain new users. Adjust a few comments to avoid references to the dropped functions. Signed-off-by: Sam Ravnborg Reviewed-by: Maxime Ripard Reviewed-by: Laurent Pinchart Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Daniel Vetter Signed-off-by: Dave Stevenson --- drivers/gpu/drm/drm_bridge.c | 110 ----------------------------------- include/drm/drm_bridge.h | 28 --------- 2 files changed, 138 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 1545c50fd1c8..bb7fc09267af 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -509,61 +509,6 @@ drm_bridge_chain_mode_valid(struct drm_bridge *bridge, } EXPORT_SYMBOL(drm_bridge_chain_mode_valid); -/** - * drm_bridge_chain_disable - disables all bridges in the encoder chain - * @bridge: bridge control structure - * - * Calls &drm_bridge_funcs.disable op for all the bridges in the encoder - * chain, starting from the last bridge to the first. These are called before - * calling the encoder's prepare op. - * - * Note: the bridge passed should be the one closest to the encoder - */ -void drm_bridge_chain_disable(struct drm_bridge *bridge) -{ - struct drm_encoder *encoder; - struct drm_bridge *iter; - - if (!bridge) - return; - - encoder = bridge->encoder; - list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { - if (iter->funcs->disable) - iter->funcs->disable(iter); - - if (iter == bridge) - break; - } -} -EXPORT_SYMBOL(drm_bridge_chain_disable); - -/** - * drm_bridge_chain_post_disable - cleans up after disabling all bridges in the - * encoder chain - * @bridge: bridge control structure - * - * Calls &drm_bridge_funcs.post_disable op for all the bridges in the - * encoder chain, starting from the first bridge to the last. These are called - * after completing the encoder's prepare op. - * - * Note: the bridge passed should be the one closest to the encoder - */ -void drm_bridge_chain_post_disable(struct drm_bridge *bridge) -{ - struct drm_encoder *encoder; - - if (!bridge) - return; - - encoder = bridge->encoder; - list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { - if (bridge->funcs->post_disable) - bridge->funcs->post_disable(bridge); - } -} -EXPORT_SYMBOL(drm_bridge_chain_post_disable); - /** * drm_bridge_chain_mode_set - set proposed mode for all bridges in the * encoder chain @@ -593,61 +538,6 @@ void drm_bridge_chain_mode_set(struct drm_bridge *bridge, } EXPORT_SYMBOL(drm_bridge_chain_mode_set); -/** - * drm_bridge_chain_pre_enable - prepares for enabling all bridges in the - * encoder chain - * @bridge: bridge control structure - * - * Calls &drm_bridge_funcs.pre_enable op for all the bridges in the encoder - * chain, starting from the last bridge to the first. These are called - * before calling the encoder's commit op. - * - * Note: the bridge passed should be the one closest to the encoder - */ -void drm_bridge_chain_pre_enable(struct drm_bridge *bridge) -{ - struct drm_encoder *encoder; - struct drm_bridge *iter; - - if (!bridge) - return; - - encoder = bridge->encoder; - list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { - if (iter->funcs->pre_enable) - iter->funcs->pre_enable(iter); - - if (iter == bridge) - break; - } -} -EXPORT_SYMBOL(drm_bridge_chain_pre_enable); - -/** - * drm_bridge_chain_enable - enables all bridges in the encoder chain - * @bridge: bridge control structure - * - * Calls &drm_bridge_funcs.enable op for all the bridges in the encoder - * chain, starting from the first bridge to the last. These are called - * after completing the encoder's commit op. - * - * Note that the bridge passed should be the one closest to the encoder - */ -void drm_bridge_chain_enable(struct drm_bridge *bridge) -{ - struct drm_encoder *encoder; - - if (!bridge) - return; - - encoder = bridge->encoder; - list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { - if (bridge->funcs->enable) - bridge->funcs->enable(bridge); - } -} -EXPORT_SYMBOL(drm_bridge_chain_enable); - /** * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain * @bridge: bridge control structure diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 6b65b0dfb4fb..796567a203ac 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -297,12 +297,6 @@ struct drm_bridge_funcs { * not enable the display link feeding the next bridge in the chain (if * there is one) when this callback is called. * - * Note that this function will only be invoked in the context of an - * atomic commit. It will not be invoked from - * &drm_bridge_chain_pre_enable. It would be prudent to also provide an - * implementation of @pre_enable if you are expecting driver calls into - * &drm_bridge_chain_pre_enable. - * * The @atomic_pre_enable callback is optional. */ void (*atomic_pre_enable)(struct drm_bridge *bridge, @@ -323,11 +317,6 @@ struct drm_bridge_funcs { * callback must enable the display link feeding the next bridge in the * chain if there is one. * - * Note that this function will only be invoked in the context of an - * atomic commit. It will not be invoked from &drm_bridge_chain_enable. - * It would be prudent to also provide an implementation of @enable if - * you are expecting driver calls into &drm_bridge_chain_enable. - * * The @atomic_enable callback is optional. */ void (*atomic_enable)(struct drm_bridge *bridge, @@ -345,12 +334,6 @@ struct drm_bridge_funcs { * The bridge can assume that the display pipe (i.e. clocks and timing * signals) feeding it is still running when this callback is called. * - * Note that this function will only be invoked in the context of an - * atomic commit. It will not be invoked from - * &drm_bridge_chain_disable. It would be prudent to also provide an - * implementation of @disable if you are expecting driver calls into - * &drm_bridge_chain_disable. - * * The @atomic_disable callback is optional. */ void (*atomic_disable)(struct drm_bridge *bridge, @@ -370,13 +353,6 @@ struct drm_bridge_funcs { * signals) feeding it is no longer running when this callback is * called. * - * Note that this function will only be invoked in the context of an - * atomic commit. It will not be invoked from - * &drm_bridge_chain_post_disable. - * It would be prudent to also provide an implementation of - * @post_disable if you are expecting driver calls into - * &drm_bridge_chain_post_disable. - * * The @atomic_post_disable callback is optional. */ void (*atomic_post_disable)(struct drm_bridge *bridge, @@ -876,13 +852,9 @@ enum drm_mode_status drm_bridge_chain_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info, const struct drm_display_mode *mode); -void drm_bridge_chain_disable(struct drm_bridge *bridge); -void drm_bridge_chain_post_disable(struct drm_bridge *bridge); void drm_bridge_chain_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode); -void drm_bridge_chain_pre_enable(struct drm_bridge *bridge); -void drm_bridge_chain_enable(struct drm_bridge *bridge); int drm_atomic_bridge_chain_check(struct drm_bridge *bridge, struct drm_crtc_state *crtc_state, From patchwork Mon Dec 5 17:33:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 13064877 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 D3E26C4321E for ; Mon, 5 Dec 2022 17:34:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 091B410E26F; Mon, 5 Dec 2022 17:34:09 +0000 (UTC) Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 79BA410E26D for ; Mon, 5 Dec 2022 17:33:51 +0000 (UTC) Received: by mail-wm1-x32d.google.com with SMTP id o7-20020a05600c510700b003cffc0b3374so10686825wms.0 for ; Mon, 05 Dec 2022 09:33:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=W4MMrx+Do7XQ4KLK7o69mW7nRFVoUezHsmkFKu2scmo=; b=NVLlQAQj7Q0B5lykUm6ByN7Q9+eNuFHe3IelGiCI844PjoDjHEG8LAdUXJFqD3tB6B mYINPE4MHSQttHAKJsFw8iDdI0p4Fx48AvtnYT87eSosbiRI6NCvxNH0yewbjSAHvmn/ 65eE5gL74mA9ysKQ/KNE13YLaxcSsdsa+T5vIfQDngQn/gDWQugCd+YfIMcKoTZvCuZF I5t4msKgJbegWvgWgL2P7sjQUOH61ZPBaO+YUtcTZw92tQDXCWf50iDx6dBnld14rHyx ZCbCTxzOIAZKbQf1xsjrDnf25YZ2cM2kGyWCLrDlx0zLmq3vPvgLEw0NIh28iA5zTdts vi0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=W4MMrx+Do7XQ4KLK7o69mW7nRFVoUezHsmkFKu2scmo=; b=yZfALOKR25pQTIQQ7bXC9qaxWx6/4CukSnxhb0jh8cy5XifU+BkfX31uVXmFpLVgLf RJuKBQXwytQ6cFM2D53BYcG4jV8NdqWzWyo8GSu70tQLOqWztCo0DI3mZsOCo3b5U8pw A3eJp7a54zjm9MLvwO1GnMU8HqRim9D5pRXSEWtnKsE8j7hGqpoNNm4/Fs7NYoZB0koN 0PCghZZtl5eDsNFbcq7LJdpXehuwMiBkQDJc3coUQe4GybRXPecJYYFrZ69A75IpFmBW lY+lHxhpf3aAPeIgvrzD3LJSSOPnlYoR5aQn9CRu4+jwC/GYs5+v2hkjNgPKaglkz4D9 BSYw== X-Gm-Message-State: ANoB5pmxDpGgKUtRtgIgtbaL7pKJIdwF8psvc9j92gekeGcof5zE5dI+ ENv86kkAiEI3el8NOP7dIKwTVA== X-Google-Smtp-Source: AA0mqf6webQ5G2uQj1G2K6PUPqSrfcpLFWmjipNw+GJo9gKeQHClr288+AigDIfUYLAZ/brvi1ZyOQ== X-Received: by 2002:a05:600c:35cf:b0:3cf:aa11:93a8 with SMTP id r15-20020a05600c35cf00b003cfaa1193a8mr64923352wmq.31.1670261629726; Mon, 05 Dec 2022 09:33:49 -0800 (PST) Received: from dave-Ubuntu2204.pitowers.org ([93.93.133.154]) by smtp.googlemail.com with ESMTPSA id v15-20020a5d6b0f000000b002421ed1d8c8sm14524245wrw.103.2022.12.05.09.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 09:33:49 -0800 (PST) From: Dave Stevenson To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v4 4/6] drm/bridge: Introduce pre_enable_prev_first to alter bridge init order Date: Mon, 5 Dec 2022 17:33:26 +0000 Message-Id: <20221205173328.1395350-5-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> References: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 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: Marek Vasut , Chun-Kuang Hu , Jonas Karlman , Robert Foss , Neil Armstrong , Douglas Anderson , Jernej Skrabec , Frieder Schrempf , andrzej.hajda@gmail.com, Laurent Pinchart , Andrzej Hajda , Dmitry Baryshkov , Dave Stevenson , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DSI sink devices typically want the DSI host powered up and configured before they are powered up. pre_enable is the place this would normally happen, but they are called in reverse order from panel/connector towards the encoder, which is the "wrong" order. Add a new flag pre_enable_prev_first that any bridge can set to swap the order of pre_enable (and post_disable) for that and the immediately previous bridge. Should the immediately previous bridge also set the pre_enable_prev_first flag, the previous bridge to that will be called before either of those which requested pre_enable_prev_first. eg: - Panel - Bridge 1 - Bridge 2 pre_enable_prev_first - Bridge 3 - Bridge 4 pre_enable_prev_first - Bridge 5 pre_enable_prev_first - Bridge 6 - Encoder Would result in pre_enable's being called as Panel, Bridge 1, Bridge 3, Bridge 2, Bridge 6, Bridge 5, Bridge 4, Encoder. Signed-off-by: Dave Stevenson Tested-by: Frieder Schrempf Reviewed-by: Frieder Schrempf --- drivers/gpu/drm/drm_bridge.c | 145 +++++++++++++++++++++++++++++------ include/drm/drm_bridge.h | 8 ++ 2 files changed, 129 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index bb7fc09267af..5f40c83b1b42 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -581,6 +581,25 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, } EXPORT_SYMBOL(drm_atomic_bridge_chain_disable); +static void drm_atomic_bridge_call_post_disable(struct drm_bridge *bridge, + struct drm_atomic_state *old_state) +{ + if (old_state && bridge->funcs->atomic_post_disable) { + struct drm_bridge_state *old_bridge_state; + + old_bridge_state = + drm_atomic_get_old_bridge_state(old_state, + bridge); + if (WARN_ON(!old_bridge_state)) + return; + + bridge->funcs->atomic_post_disable(bridge, + old_bridge_state); + } else if (bridge->funcs->post_disable) { + bridge->funcs->post_disable(bridge); + } +} + /** * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges * in the encoder chain @@ -592,36 +611,86 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_disable); * starting from the first bridge to the last. These are called after completing * &drm_encoder_helper_funcs.atomic_disable * + * If a bridge sets @pre_enable_prev_first, then the @post_disable for that + * bridge will be called before the previous one to reverse the @pre_enable + * calling direction. + * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, struct drm_atomic_state *old_state) { struct drm_encoder *encoder; + struct drm_bridge *next, *limit; if (!bridge) return; encoder = bridge->encoder; + list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { - if (bridge->funcs->atomic_post_disable) { - struct drm_bridge_state *old_bridge_state; + limit = NULL; + + if (!list_is_last(&bridge->chain_node, &encoder->bridge_chain)) { + next = list_next_entry(bridge, chain_node); + + if (next->pre_enable_prev_first) { + /* next bridge had requested that prev + * was enabled first, so disabled last + */ + limit = next; + + /* Find the next bridge that has NOT requested + * prev to be enabled first / disabled last + */ + list_for_each_entry_from(next, &encoder->bridge_chain, + chain_node) { + if (next->pre_enable_prev_first) { + next = list_prev_entry(next, chain_node); + limit = next; + break; + } + } + + /* Call these bridges in reverse order */ + list_for_each_entry_from_reverse(next, &encoder->bridge_chain, + chain_node) { + if (next == bridge) + break; + + drm_atomic_bridge_call_post_disable(next, + old_state); + } + } + } - old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, - bridge); - if (WARN_ON(!old_bridge_state)) - return; + drm_atomic_bridge_call_post_disable(bridge, old_state); - bridge->funcs->atomic_post_disable(bridge, - old_bridge_state); - } else if (bridge->funcs->post_disable) { - bridge->funcs->post_disable(bridge); - } + if (limit) + /* Jump all bridges that we have already post_disabled */ + bridge = limit; } } EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable); +static void drm_atomic_bridge_call_pre_enable(struct drm_bridge *bridge, + struct drm_atomic_state *old_state) +{ + if (old_state && bridge->funcs->atomic_pre_enable) { + struct drm_bridge_state *old_bridge_state; + + old_bridge_state = + drm_atomic_get_old_bridge_state(old_state, + bridge); + if (WARN_ON(!old_bridge_state)) + return; + + bridge->funcs->atomic_pre_enable(bridge, old_bridge_state); + } else if (bridge->funcs->pre_enable) { + bridge->funcs->pre_enable(bridge); + } +} + /** * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in * the encoder chain @@ -633,32 +702,60 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_post_disable); * starting from the last bridge to the first. These are called before calling * &drm_encoder_helper_funcs.atomic_enable * + * If a bridge sets @pre_enable_prev_first, then the pre_enable for the + * prev bridge will be called before pre_enable of this bridge. + * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, struct drm_atomic_state *old_state) { struct drm_encoder *encoder; - struct drm_bridge *iter; + struct drm_bridge *iter, *next, *limit; if (!bridge) return; encoder = bridge->encoder; + list_for_each_entry_reverse(iter, &encoder->bridge_chain, chain_node) { - if (iter->funcs->atomic_pre_enable) { - struct drm_bridge_state *old_bridge_state; + if (iter->pre_enable_prev_first) { + next = iter; + limit = bridge; + list_for_each_entry_from_reverse(next, + &encoder->bridge_chain, + chain_node) { + if (next == bridge) + break; + + if (!next->pre_enable_prev_first) { + /* Found first bridge that does NOT + * request prev to be enabled first + */ + limit = list_prev_entry(next, chain_node); + break; + } + } + + list_for_each_entry_from(next, &encoder->bridge_chain, chain_node) { + /* Call requested prev bridge pre_enable + * in order. + */ + if (next == iter) + /* At the first bridge to request prev + * bridges called first. + */ + break; + + drm_atomic_bridge_call_pre_enable(next, old_state); + } + } - old_bridge_state = - drm_atomic_get_old_bridge_state(old_state, - iter); - if (WARN_ON(!old_bridge_state)) - return; + drm_atomic_bridge_call_pre_enable(iter, old_state); - iter->funcs->atomic_pre_enable(iter, old_bridge_state); - } else if (iter->funcs->pre_enable) { - iter->funcs->pre_enable(iter); - } + if (iter->pre_enable_prev_first) + /* Jump all bridges that we have already pre_enabled */ + iter = limit; if (iter == bridge) break; diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 796567a203ac..42f86327b40a 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -744,6 +744,14 @@ struct drm_bridge { * modes. */ bool interlace_allowed; + /** + * @pre_enable_prev_first: The bridge requires that the prev + * bridge @pre_enable function is called before its @pre_enable, + * and conversely for post_disable. This is most frequently a + * requirement for DSI devices which need the host to be initialised + * before the peripheral. + */ + bool pre_enable_prev_first; /** * @ddc: Associated I2C adapter for DDC access, if any. */ From patchwork Mon Dec 5 17:33:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 13064875 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 DB8ABC4332F for ; Mon, 5 Dec 2022 17:34:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F3E6710E26E; Mon, 5 Dec 2022 17:33:57 +0000 (UTC) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2E5E710E26C for ; Mon, 5 Dec 2022 17:33:52 +0000 (UTC) Received: by mail-wr1-x431.google.com with SMTP id y16so19759186wrm.2 for ; Mon, 05 Dec 2022 09:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jNbuTJsW5iDjZ5bVEjjDMURKNgB71MXg4jy8qHcnjho=; b=gnwP+Dr4JylUbLtMvI3OW7jFwd7LtHJF4DJwwIM0DaWpDWH05Hc6+wLPBCtdQWcrfw b5FaHgOxaPriZ5QXVw6dkPcmYLUtK7/uxSYcUCaYQYLl2hX5K8vcXM5Ujg8OyVdojRLi 7+Ddx0MXdvXqGQg95IfxxZ9n36bl5SGdO6mLBE6kowgCAUBwFaEiwzv0JQ/Gp+MYOb+9 3Fp0Ee/xNqku9alAen3zjdBU8720K8c2Ep7R2xkOiSr0EZXg8tplNRaWZMWJc28vWewU aq8VlstmaJdPQgdaGfZzWcOsY9GMvpNvT7gacd+MKLWBNsWnqK5QYht10lfjKMEON3Ep yXWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jNbuTJsW5iDjZ5bVEjjDMURKNgB71MXg4jy8qHcnjho=; b=Duln1lX2pxk1x9D7K0/48zSuwQhbyUOR28xiNGrJ3vc2O8uEU9mUKx4+T4ZW8zBLMN eE8PkaSVouXx0CrU+5SdM+5tDTA6kbHp8qJBh7VXo6FwMDddDVbuLAe5G7qwbJU1nVac 1ToPvMB220hSiBO+6JB1uchdhRFAj8l0qjiGh8hlfhc0Yj2ulvI2FTVT1FJcPUcMjzx7 HBMS7/PCV6a55KSzpzikwDqr9mWE4zAKoKSTQhIVJkbtkLbkGL8F0rXdnsAs5rqnG/RW VAa/so7cCLZjt8oJ4DvGvpzGo6iYYh+fp+tPqjhfJSlYgL18h5jC9vYcA1Kh9n/wip0x GG8g== X-Gm-Message-State: ANoB5pnsOhUtEUj5jEEdBSR95lb/tBmA+lrWy1ZBOYbsQn6WZ1yb6zk7 wwyw057Djm8EtAoBESuJrL0z8w== X-Google-Smtp-Source: AA0mqf7Qelq7reHIjlL501QumcXjcfkSapUbYyBd1H1XAtx2Mvh89bc7j/ZKZIrdtb2UVORCnEMW1g== X-Received: by 2002:a5d:68c1:0:b0:242:15b5:59ac with SMTP id p1-20020a5d68c1000000b0024215b559acmr22188015wrw.128.1670261630651; Mon, 05 Dec 2022 09:33:50 -0800 (PST) Received: from dave-Ubuntu2204.pitowers.org ([93.93.133.154]) by smtp.googlemail.com with ESMTPSA id v15-20020a5d6b0f000000b002421ed1d8c8sm14524245wrw.103.2022.12.05.09.33.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 09:33:50 -0800 (PST) From: Dave Stevenson To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v4 5/6] drm/panel: Add prepare_prev_first flag to drm_panel Date: Mon, 5 Dec 2022 17:33:27 +0000 Message-Id: <20221205173328.1395350-6-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> References: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 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: Marek Vasut , Chun-Kuang Hu , Jonas Karlman , Robert Foss , Neil Armstrong , Douglas Anderson , Jernej Skrabec , Frieder Schrempf , andrzej.hajda@gmail.com, Laurent Pinchart , Andrzej Hajda , Dmitry Baryshkov , Dave Stevenson , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Mapping to the drm_bridge flag pre_enable_prev_first, add a new flag prepare_prev_first to drm_panel to allow the panel driver to request that the upstream bridge should be pre_enabled before the panel prepare. Signed-off-by: Dave Stevenson Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/panel.c | 2 ++ include/drm/drm_panel.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 216af76d0042..03c3274dc3d9 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -364,6 +364,8 @@ struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, devres_free(ptr); } + bridge->pre_enable_prev_first = panel->prepare_prev_first; + return bridge; } EXPORT_SYMBOL(devm_drm_panel_bridge_add_typed); diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h index 994bfcdd84c5..432fab2347eb 100644 --- a/include/drm/drm_panel.h +++ b/include/drm/drm_panel.h @@ -188,6 +188,16 @@ struct drm_panel { * Panel entry in registry. */ struct list_head list; + + /** + * @prepare_prev_first: + * + * The previous controller should be prepared first, before the prepare + * for the panel is called. This is largely required for DSI panels + * where the DSI host controller should be initialised to LP-11 before + * the panel is powered up. + */ + bool prepare_prev_first; }; void drm_panel_init(struct drm_panel *panel, struct device *dev, From patchwork Mon Dec 5 17:33:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Stevenson X-Patchwork-Id: 13064876 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 54316C4332F for ; Mon, 5 Dec 2022 17:34:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F39B410E26D; Mon, 5 Dec 2022 17:34:00 +0000 (UTC) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id E1A8510E26C for ; Mon, 5 Dec 2022 17:33:52 +0000 (UTC) Received: by mail-wr1-x42a.google.com with SMTP id o5so19764356wrm.1 for ; Mon, 05 Dec 2022 09:33:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tJEwg+HGFHgbbDHyNHMMw1IwQlAdl2r5yFKGdkId1Z4=; b=MehxKT5Obo3Sk65ES/RTmIkfnCHQKynRfkAi8eNxE5+WES/+jnmVf0TMgzM2vtkmas 4NeBnU83Z/rksywEQFPnhz3ox5NL+NTGJv+SyhvYl1vTRID0R896XjJ3AdWjFuRf2GWk JPNIMRHU3iF46hY9jBoncfOkzAIQgqYO5AvAgLYaya14iUObKGvni6H+tCT5ihvZCleo x62qTrHH24BT/TBf2CqQwylX00y91OSo+3N+Xmq9QvslUVYimBCwwEa8tl8O2w3x6BmU jCXkBhuVwNJEzXKUUYVqoFwr2XpWa0DtWQxg0LznVebxSao2DKoMAvFJAAClkgdFUxvv HuAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tJEwg+HGFHgbbDHyNHMMw1IwQlAdl2r5yFKGdkId1Z4=; b=z9fy/R91Ynmncn4C686qRbLluEArqJSxJyiHRyJbkFHVhXVlHemOPzKSYTzRc+Zi3F xUvDqIRmkRabMYNTN3O3dFu41L20Aku1eeSiEgyI7x/uEBCuEa/Sh2mNU3md7q6AAyFS MI0cHIc0hwcv2OfxqypJ3BjilYufqo28Tzmu3nkKKRlFxIJBBx3R4qa+d+oiCqvi6rwg d4I1gW353VUvnT1oO7KTG2g1HWG90WQaAy899+uhl1vjAt+Ou5bCrL7ZTrSmiNw338ZL U4PT61gnGRnnvTrHB0x7gnGaZylDKcIFoNgyaDyH5WGmJ+zZHdZtXPhKplGc/gOPzPoD t8qw== X-Gm-Message-State: ANoB5pmR7WDGMcrxlq3aJWzAuCGtZmijrjVPPEiqkQ9MgKfG8/sz8KPr LlU37zy6OF9JNH0fUL8YSs344A== X-Google-Smtp-Source: AA0mqf454IqzP6YvX8azvCLrb2AIq2nBAGFDooTsedq6mSUI36F3tXYI5JmthByRmmKulby4tIP1Aw== X-Received: by 2002:adf:e2cd:0:b0:236:68aa:8da9 with SMTP id d13-20020adfe2cd000000b0023668aa8da9mr48450836wrj.442.1670261631413; Mon, 05 Dec 2022 09:33:51 -0800 (PST) Received: from dave-Ubuntu2204.pitowers.org ([93.93.133.154]) by smtp.googlemail.com with ESMTPSA id v15-20020a5d6b0f000000b002421ed1d8c8sm14524245wrw.103.2022.12.05.09.33.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Dec 2022 09:33:51 -0800 (PST) From: Dave Stevenson To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org Subject: [PATCH v4 6/6] drm/bridge: Document the expected behaviour of DSI host controllers Date: Mon, 5 Dec 2022 17:33:28 +0000 Message-Id: <20221205173328.1395350-7-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> References: <20221205173328.1395350-1-dave.stevenson@raspberrypi.com> MIME-Version: 1.0 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: Marek Vasut , Chun-Kuang Hu , Jonas Karlman , Robert Foss , Neil Armstrong , Douglas Anderson , Jernej Skrabec , Frieder Schrempf , andrzej.hajda@gmail.com, Laurent Pinchart , Andrzej Hajda , Dmitry Baryshkov , Dave Stevenson , Jagan Teki Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The exact behaviour of DSI host controllers is not specified, therefore define it. Signed-off-by: Dave Stevenson Reviewed-by: Laurent Pinchart --- Documentation/gpu/drm-kms-helpers.rst | 7 +++++ drivers/gpu/drm/drm_bridge.c | 39 +++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/drm-kms-helpers.rst index a4860ffd6e86..b8ab05e42dbb 100644 --- a/Documentation/gpu/drm-kms-helpers.rst +++ b/Documentation/gpu/drm-kms-helpers.rst @@ -188,6 +188,13 @@ Bridge Helper Reference .. kernel-doc:: drivers/gpu/drm/drm_bridge.c :export: +MIPI-DSI bridge operation +------------------------- + +.. kernel-doc:: drivers/gpu/drm/drm_bridge.c + :doc: dsi bridge operations + + Bridge Connector Helper Reference --------------------------------- diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 5f40c83b1b42..c3d69af02e79 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -153,6 +153,45 @@ * situation when probing. */ +/** + * DOC: dsi bridge operations + * + * DSI host interfaces are expected to be implemented as bridges rather than + * encoders, however there are a few aspects of their operation that need to + * be defined in order to provide a consistent interface. + * + * A DSI host should keep the PHY powered down until the pre_enable operation is + * called. All lanes are in an undefined idle state up to this point, and it + * must not be assumed that it is LP-11. + * pre_enable should initialise the PHY, set the data lanes to LP-11, and the + * clock lane to either LP-11 or HS depending on the mode_flag + * %MIPI_DSI_CLOCK_NON_CONTINUOUS. + * + * Ordinarily the downstream bridge DSI peripheral pre_enable will have been + * called before the DSI host. If the DSI peripheral requires LP-11 and/or + * the clock lane to be in HS mode prior to pre_enable, then it can set the + * &pre_enable_prev_first flag to request the pre_enable (and + * post_disable) order to be altered to enable the DSI host first. + * + * Either the CRTC being enabled, or the DSI host enable operation should switch + * the host to actively transmitting video on the data lanes. + * + * The reverse also applies. The DSI host disable operation or stopping the CRTC + * should stop transmitting video, and the data lanes should return to the LP-11 + * state. The DSI host &post_disable operation should disable the PHY. + * If the &pre_enable_prev_first flag is set, then the DSI peripheral's + * bridge &post_disable will be called before the DSI host's post_disable. + * + * Whilst it is valid to call &host_transfer prior to pre_enable or after + * post_disable, the exact state of the lanes is undefined at this point. The + * DSI host should initialise the interface, transmit the data, and then disable + * the interface again. + * + * Ultra Low Power State (ULPS) is not explicitly supported by DRM. If + * implemented, it therefore needs to be handled entirely within the DSI Host + * driver. + */ + static DEFINE_MUTEX(bridge_lock); static LIST_HEAD(bridge_list);