From patchwork Wed Oct 20 18:18:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12572945 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58D0AC433F5 for ; Wed, 20 Oct 2021 18:20:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2157B61212 for ; Wed, 20 Oct 2021 18:20:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2157B61212 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=F2+xYtu87K3QZbzo159Rx/KqvKoEgDbrfNtFOzN8CVY=; b=h20u7KtGm/waWJ IMXQNeVSbAIj1j3aNrk0zotZaD3OLqRxWjBeV03qyZFhY/t6tdVA5zj731I8dQFBNjG5H9o02VM75 E2Ll3aGXstClV8ZxnaWtPaMV6OwKNf/4kzAV7RVBwrkWDB4LtfZKNs7teRgSRp4jU8DJIEKXMos7z CGHGaDYSlNfqTwdYW+E+xhHRhJ3vTRnyZjVeJpuIag+I2ukvBsByGBAf5pkh89g7OL1/3YJ1jhtD1 I7easjbrFTEtt+vGkJ50toDPaPx6fZ76kgM2d3TP0GyQ4zqBY19iOxvHnVMz0NpSxxzg3HPhW5nvy JeGmF+AuMuRbiGp4NbTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBw-005PKO-7c; Wed, 20 Oct 2021 18:19:56 +0000 Received: from mx1.smtp.larsendata.com ([91.221.196.215]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBI-005P1N-T9 for linux-mediatek@lists.infradead.org; Wed, 20 Oct 2021 18:19:20 +0000 Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx1.smtp.larsendata.com (Halon) with ESMTPS id 3c28bb8a-31d2-11ec-9c3f-0050568c148b; Wed, 20 Oct 2021 18:19:16 +0000 (UTC) Received: from saturn.localdomain (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id C5CEA194B05; Wed, 20 Oct 2021 20:19:10 +0200 (CEST) X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Jernej Skrabec , Jitao Shi , Jonas Karlman , Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Neil Armstrong , Philip Chen , Philipp Zabel , Robert Foss , Thomas Zimmermann , Sam Ravnborg , Maxime Ripard , Andrzej Hajda , Laurent Pinchart Subject: [PATCH v2 1/7] drm/bridge: ps8640: Use atomic variants of drm_bridge_funcs Date: Wed, 20 Oct 2021 20:18:55 +0200 Message-Id: <20211020181901.2114645-2-sam@ravnborg.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020181901.2114645-1-sam@ravnborg.org> References: <20211020181901.2114645-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_111917_236048_3A3FF07F X-CRM114-Status: GOOD ( 14.36 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 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: - Added a few more people to cc: (Jitao, Enric, Philip) to increase possibility to get test feedback Signed-off-by: Sam Ravnborg Reviewed-by: Maxime Ripard Cc: Jitao Shi Cc: Enric Balletbo i Serra Cc: Philip Chen Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec --- drivers/gpu/drm/bridge/parade-ps8640.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index 3aaa90913bf8..0b620afe99c0 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -376,7 +376,8 @@ static void ps8640_bridge_poweroff(struct ps8640 *ps_bridge) ps_bridge->powered = false; } -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); int ret; @@ -388,7 +389,8 @@ static void ps8640_pre_enable(struct drm_bridge *bridge) ps8640_bridge_poweroff(ps_bridge); } -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); @@ -489,7 +491,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); @@ -499,7 +501,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; } @@ -508,8 +510,8 @@ 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, }; static int ps8640_probe(struct i2c_client *client) From patchwork Wed Oct 20 18:18:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12572947 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B46EFC433FE for ; Wed, 20 Oct 2021 18:20:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 78C8D60FC3 for ; Wed, 20 Oct 2021 18:20:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 78C8D60FC3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C/TuJqrS8Jd4t+RV9I2DpC+wBcw8lkCNtjzE+6nBMwQ=; b=T09I2y5FlN9n8I yqmgdYKjAEKLB5E3tNxYFvz/kkyPBG1wDIW3VfED26l7cbmqd1X4hpDLcYnUazoIJ7+M7eTswyNRv CmlSZeHiyNfQEI16HvfYlxPoAGtBSHJNcYwCMhOrBglfMSBM0NdnzEhnYZJRCVub8cc/U+pQT8FZH pXT+HeFhFBBdjMc94aauVtcyYD6/1wAZREWUC7efphk3xPi7I38vQ+RRlsww1qE2KMlr9t53FAQ8n 57aVCkiImVys5DOG1+M6/BIOuKAgw/quCTbsKi0/NLMI85veahMjdz8NsvtEMjGncCauxK3sWft6M F0f93/+Ve9dxk6PSbYNQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBx-005PKv-GF; Wed, 20 Oct 2021 18:19:57 +0000 Received: from mx1.smtp.larsendata.com ([91.221.196.215]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBL-005P31-5O for linux-mediatek@lists.infradead.org; Wed, 20 Oct 2021 18:19:21 +0000 Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx1.smtp.larsendata.com (Halon) with ESMTPS id 3f191319-31d2-11ec-9c3f-0050568c148b; Wed, 20 Oct 2021 18:19:21 +0000 (UTC) Received: from saturn.localdomain (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 5E84F194B13; Wed, 20 Oct 2021 20:19:16 +0200 (CEST) X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Jernej Skrabec , Jitao Shi , Jonas Karlman , Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Neil Armstrong , Philip Chen , Philipp Zabel , Robert Foss , Thomas Zimmermann , Sam Ravnborg , Maxime Ripard , Andrzej Hajda Subject: [PATCH v2 2/7] drm/bridge: Drop unused drm_bridge_chain functions Date: Wed, 20 Oct 2021 20:18:56 +0200 Message-Id: <20211020181901.2114645-3-sam@ravnborg.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020181901.2114645-1-sam@ravnborg.org> References: <20211020181901.2114645-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_111919_397188_02E8CDA9 X-CRM114-Status: GOOD ( 16.92 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org 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 Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Daniel Vetter --- 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 c96847fc0ebc..7a57d6816105 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -485,61 +485,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 @@ -569,61 +514,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 061d87313fac..f1eb71ff5379 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, @@ -868,13 +844,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 Wed Oct 20 18:18:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12572949 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EEC1C433EF for ; Wed, 20 Oct 2021 18:20:43 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E674B60F6E for ; Wed, 20 Oct 2021 18:20:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E674B60F6E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Zq0Hyw4u9yl6w2/aGJei3hBoHF/mHZDYJJvfS8nnrmA=; b=KSp97IU3ABc1lO 5QVmvbDK2DuV8DzLZE/UDNDGZ1M980clmnupXiXx/zN1Zqx4Cf1HfHrfprSqY3010+c3OeseYo5b0 nPb97iX9nJCsMpWgtXYXtKz5JtESG4kTjVW6iM/40CNerlf0CUQYB5c9bvbh8/HtUR/iFMat3+heA RWVv0oSoP/FfDFaCIVwGkTQdIlqJVRUR18u0bPX403C/ltHLzzJtZo/eoeyIVfehCKCM6VhddiygZ tCnS+Oj3vshpspqDGJTTbfCu3UCDIgoPTnMJc0Vv41k8Xq1l9VXpuSDrrlCqLhb+P0puGllhKFH5w GAm5xKIPKY7QnD4ayCRA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGCX-005PfI-8S; Wed, 20 Oct 2021 18:20:33 +0000 Received: from mx2.smtp.larsendata.com ([91.221.196.228]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBM-005P3g-R3 for linux-mediatek@lists.infradead.org; Wed, 20 Oct 2021 18:19:23 +0000 Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id 446a2974-31d2-11ec-ac3c-0050568cd888; Wed, 20 Oct 2021 18:19:30 +0000 (UTC) Received: from saturn.localdomain (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 1D569194B68; Wed, 20 Oct 2021 20:19:17 +0200 (CEST) X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Jernej Skrabec , Jitao Shi , Jonas Karlman , Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Neil Armstrong , Philip Chen , Philipp Zabel , Robert Foss , Thomas Zimmermann , Sam Ravnborg , Andrzej Hajda Subject: [PATCH v2 3/7] drm/bridge: Add drm_atomic_get_new_crtc_for_bridge() helper Date: Wed, 20 Oct 2021 20:18:57 +0200 Message-Id: <20211020181901.2114645-4-sam@ravnborg.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020181901.2114645-1-sam@ravnborg.org> References: <20211020181901.2114645-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_111921_263097_EFC5DD24 X-CRM114-Status: GOOD ( 18.26 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org drm_atomic_get_new_crtc_for_bridge() will be used by bridge drivers to provide easy access to the mode from the drm_bridge_funcs operations. The helper will be useful in the conversion to the atomic operations of struct drm_bridge_funcs. v2: - Renamed to drm_atomic_get_new_crtc_for_bridge (Maxime) - Use atomic_state, not bridge_State (Maxime) - Drop WARN on crtc_state as it is a valid case (Maxime) - Added small code snip to help readers - Updated description, fixed kernel-doc and exported the symbol Signed-off-by: Sam Ravnborg Suggested-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 --- drivers/gpu/drm/drm_atomic.c | 42 ++++++++++++++++++++++++++++++++++++ include/drm/drm_atomic.h | 3 +++ 2 files changed, 45 insertions(+) diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c index ff1416cd609a..8b107194b157 100644 --- a/drivers/gpu/drm/drm_atomic.c +++ b/drivers/gpu/drm/drm_atomic.c @@ -1134,6 +1134,48 @@ drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, } EXPORT_SYMBOL(drm_atomic_get_new_bridge_state); +/** + * drm_atomic_get_new_crtc_for_bridge - get new crtc_state for the bridge + * @state: state of the bridge + * @bridge: bridge object + * + * This function is often used in the &struct drm_bridge_funcs operations + * to provide easy access to the mode like this: + * + * .. code-block:: c + * + * crtc_state = drm_atomic_get_new_crtc_for_bridge(old_bridge_state->base.state, + * bridge); + * if (crtc_state) { + * mode = &crtc_state->mode; + * ... + * + * If no connector can be looked up or if no connector state is available + * then this will be logged using WARN(). + * + * Returns: + * The &struct drm_crtc_state for the given bridge/state, or NULL + * if no crtc_state could be looked up. + */ +const struct drm_crtc_state * +drm_atomic_get_new_crtc_for_bridge(struct drm_atomic_state *state, + struct drm_bridge *bridge) +{ + const struct drm_connector_state *conn_state; + struct drm_connector *connector; + + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); + if (WARN_ON(!connector)) + return NULL; + + conn_state = drm_atomic_get_new_connector_state(state, connector); + if (WARN_ON(!conn_state || !conn_state->crtc)) + return NULL; + + return drm_atomic_get_new_crtc_state(state, conn_state->crtc); +} +EXPORT_SYMBOL(drm_atomic_get_new_crtc_for_bridge); + /** * drm_atomic_add_encoder_bridges - add bridges attached to an encoder * @state: atomic state diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h index 1701c2128a5c..f861d73296cc 100644 --- a/include/drm/drm_atomic.h +++ b/include/drm/drm_atomic.h @@ -1119,5 +1119,8 @@ drm_atomic_get_old_bridge_state(struct drm_atomic_state *state, struct drm_bridge_state * drm_atomic_get_new_bridge_state(struct drm_atomic_state *state, struct drm_bridge *bridge); +const struct drm_crtc_state * +drm_atomic_get_new_crtc_for_bridge(struct drm_atomic_state *state, + struct drm_bridge *bridge); #endif /* DRM_ATOMIC_H_ */ From patchwork Wed Oct 20 18:18:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12572953 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9206C433EF for ; Wed, 20 Oct 2021 18:21:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 8801B60F6E for ; Wed, 20 Oct 2021 18:21:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 8801B60F6E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=2sEL17FtEus+XNnK7wQkrm+ggBfroZD1izdavFRLMyg=; b=SSJXkQRFCSJPXZ 6dA0hbwmdgx49YcjcR7x9eXxUr2TrawKfgwR/9N/cu31rYC5aH4rbWF2AZesRqhNDze4eqzL6y98U SY5cLVHlJgF5viNIOdQQtPqZ+n0FRoRr6/YdgTtd384hrOezwqDd1NyiBUpkaw3fod3fdr0UjfY1L VuOeKc7qXjtvs0uhex724immPPpGR8mtxqw8zdeKLbXUwXcFjwefgSjdRh3vhU6Qkt3wH5KFtL/Tr k2SKFtz2jLwnwnFAWkQd4uh7qWhafcx2QwLBjSpJ3Uw0/yJi8Z+or6ifsHy4LE/wLKU1syCZL6gIw ZPbyrMHcWydu97F2ybeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGDN-005QD6-Qu; Wed, 20 Oct 2021 18:21:25 +0000 Received: from mx2.smtp.larsendata.com ([91.221.196.228]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBM-005P4I-S0 for linux-mediatek@lists.infradead.org; Wed, 20 Oct 2021 18:19:25 +0000 Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id 44dc8572-31d2-11ec-ac3c-0050568cd888; Wed, 20 Oct 2021 18:19:30 +0000 (UTC) Received: from saturn.localdomain (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id E73F2194B6F; Wed, 20 Oct 2021 20:19:17 +0200 (CEST) X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Jernej Skrabec , Jitao Shi , Jonas Karlman , Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Neil Armstrong , Philip Chen , Philipp Zabel , Robert Foss , Thomas Zimmermann , Sam Ravnborg , Maxime Ripard , Andrzej Hajda , Laurent Pinchart Subject: [PATCH v2 4/7] drm/bridge: lontium-lt9611: Use atomic variants of drm_bridge_funcs Date: Wed, 20 Oct 2021 20:18:58 +0200 Message-Id: <20211020181901.2114645-5-sam@ravnborg.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020181901.2114645-1-sam@ravnborg.org> References: <20211020181901.2114645-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_111921_337662_92809202 X-CRM114-Status: GOOD ( 15.73 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The atomic variants of enable/disable in drm_bridge_funcs are the preferred operations - introduce these. Use of mode_set is deprecated - merge the functionality with atomic_enable() v2: - Added check if crtc_state is NULL (Maxime) - Updated to use drm_atomic_get_new_crtc_for_bridge() Signed-off-by: Sam Ravnborg Cc: Maxime Ripard Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec --- drivers/gpu/drm/bridge/lontium-lt9611.c | 75 +++++++++++-------------- 1 file changed, 33 insertions(+), 42 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 29b1ce2140ab..cdc3d5f8dcac 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -700,9 +700,23 @@ lt9611_connector_mode_valid(struct drm_connector *connector, } /* bridge funcs */ -static void lt9611_bridge_enable(struct drm_bridge *bridge) +static void lt9611_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); + const struct drm_display_mode *mode; + const struct drm_crtc_state *crtc_state; + struct hdmi_avi_infoframe avi_frame; + int ret; + + crtc_state = drm_atomic_get_new_crtc_for_bridge(old_bridge_state->base.state, + bridge); + if (!crtc_state) { + dev_err(lt9611->dev, "no crtc_state available\n"); + return; + } + + mode = &crtc_state->mode; if (lt9611_power_on(lt9611)) { dev_err(lt9611->dev, "power on failed\n"); @@ -719,9 +733,21 @@ static void lt9611_bridge_enable(struct drm_bridge *bridge) /* Enable HDMI output */ regmap_write(lt9611->regmap, 0x8130, 0xea); + + lt9611_mipi_input_digital(lt9611, mode); + lt9611_pll_setup(lt9611, mode); + lt9611_mipi_video_setup(lt9611, mode); + lt9611_pcr_setup(lt9611, mode); + + ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, + <9611->connector, + mode); + if (!ret) + lt9611->vic = avi_frame.video_code; } -static void lt9611_bridge_disable(struct drm_bridge *bridge) +static void lt9611_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); int ret; @@ -877,48 +903,14 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, return MODE_OK; } -static void lt9611_bridge_pre_enable(struct drm_bridge *bridge) -{ - struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - - if (!lt9611->sleep) - return; - - lt9611_reset(lt9611); - regmap_write(lt9611->regmap, 0x80ee, 0x01); - - lt9611->sleep = false; -} - -static void lt9611_bridge_post_disable(struct drm_bridge *bridge) +static void lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); lt9611_sleep_setup(lt9611); } -static void lt9611_bridge_mode_set(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - const struct drm_display_mode *adj_mode) -{ - struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - struct hdmi_avi_infoframe avi_frame; - int ret; - - lt9611_bridge_pre_enable(bridge); - - lt9611_mipi_input_digital(lt9611, mode); - lt9611_pll_setup(lt9611, mode); - lt9611_mipi_video_setup(lt9611, mode); - lt9611_pcr_setup(lt9611, mode); - - ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, - <9611->connector, - mode); - if (!ret) - lt9611->vic = avi_frame.video_code; -} - static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); @@ -954,10 +946,9 @@ static const struct drm_bridge_funcs lt9611_bridge_funcs = { .attach = lt9611_bridge_attach, .detach = lt9611_bridge_detach, .mode_valid = lt9611_bridge_mode_valid, - .enable = lt9611_bridge_enable, - .disable = lt9611_bridge_disable, - .post_disable = lt9611_bridge_post_disable, - .mode_set = lt9611_bridge_mode_set, + .atomic_enable = lt9611_bridge_atomic_enable, + .atomic_disable = lt9611_bridge_atomic_disable, + .atomic_post_disable = lt9611_bridge_atomic_post_disable, .detect = lt9611_bridge_detect, .get_edid = lt9611_bridge_get_edid, .hpd_enable = lt9611_bridge_hpd_enable, From patchwork Wed Oct 20 18:18:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12572951 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67E52C433EF for ; Wed, 20 Oct 2021 18:21:35 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 30C2560F6E for ; Wed, 20 Oct 2021 18:21:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 30C2560F6E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=dBq+ub9rm7u4++/4HKtsuCit3mAxlPgoxAOKhEtVi5E=; b=lbwth1IFBK6FJU DGP1MxHZKv9ZC8gusaGCDg56I8aaNNejreW0Zlsgvg8yMQRBX07/aXsPuybSU1eA02f7/7DxQE/Sr gXFDPMSbqS69dqQjW8qHjwJvU27Vd3phvhi/07GSwmOm6I09bF+DrVIlrjWnVPM02ab+cvrnSLe44 8H5BoBFUGZ3pi4Cds1kWGwAg/ncLAMaCcAqpaL7CkBa7yucZrVlQoqG7YU42ZZbw86U5IedtpmGyr npwPNxYI2WULmbJzhoEbaFUycXdnHcZ6J92thFwIFt7CFehB7YKEZ62w+LWBLlB9M8SfoBJspG664 1fpwP2VdYrEGBT0nifSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGDL-005QBt-Il; Wed, 20 Oct 2021 18:21:23 +0000 Received: from mx1.smtp.larsendata.com ([91.221.196.215]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBN-005P4a-11 for linux-mediatek@lists.infradead.org; Wed, 20 Oct 2021 18:19:25 +0000 Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx1.smtp.larsendata.com (Halon) with ESMTPS id 4068f037-31d2-11ec-9c3f-0050568c148b; Wed, 20 Oct 2021 18:19:23 +0000 (UTC) Received: from saturn.localdomain (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id A2910194B05; Wed, 20 Oct 2021 20:19:18 +0200 (CEST) X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Jernej Skrabec , Jitao Shi , Jonas Karlman , Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Neil Armstrong , Philip Chen , Philipp Zabel , Robert Foss , Thomas Zimmermann , Sam Ravnborg , Maxime Ripard Subject: [PATCH v2 5/7] drm/mediatek: Drop chain_mode_fixup call in mode_valid() Date: Wed, 20 Oct 2021 20:18:59 +0200 Message-Id: <20211020181901.2114645-6-sam@ravnborg.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020181901.2114645-1-sam@ravnborg.org> References: <20211020181901.2114645-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_111921_454191_F189E7C2 X-CRM114-Status: GOOD ( 18.17 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org The mode_valid implementation had a call to drm_bridge_chain_mode_fixup() which would be wrong as the mode_valid is not allowed to change anything - only to validate the mode. As the next bridge is often/always a connector the call had no effect anyway. So drop it. From the git history I could see this call was included in the original version of the driver so there was no help there to find out why it was added in the first place. But a lot has changed since the initial driver were added and is seems safe to remove the call now. Signed-off-by: Sam Ravnborg Reviewed-by: Maxime Ripard Cc: Chun-Kuang Hu Cc: Philipp Zabel Cc: Matthias Brugger Cc: Dafna Hirschfeld Cc: linux-mediatek@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 5838c44cbf6f..bade1cbd782d 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1208,22 +1208,11 @@ static int mtk_hdmi_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_mode *mode) { struct mtk_hdmi *hdmi = hdmi_ctx_from_bridge(bridge); - struct drm_bridge *next_bridge; dev_dbg(hdmi->dev, "xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", mode->hdisplay, mode->vdisplay, drm_mode_vrefresh(mode), !!(mode->flags & DRM_MODE_FLAG_INTERLACE), mode->clock * 1000); - next_bridge = drm_bridge_get_next_bridge(&hdmi->bridge); - if (next_bridge) { - struct drm_display_mode adjusted_mode; - - drm_mode_copy(&adjusted_mode, mode); - if (!drm_bridge_chain_mode_fixup(next_bridge, mode, - &adjusted_mode)) - return MODE_BAD; - } - if (hdmi->conf->cea_modes_only && !drm_match_cea_mode(mode)) return MODE_BAD; From patchwork Wed Oct 20 18:19:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12572955 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34925C433FE for ; Wed, 20 Oct 2021 18:22:17 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id DF96260EFE for ; Wed, 20 Oct 2021 18:22:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org DF96260EFE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=abpD2zStIfGH2YhFRgJv4/eUG2EyiO6lplJ0Vy7kjPc=; b=D17WD/B7EAPgwZ o1nMdqU2/KJ8/PcPYKX4YGxa/I2oteyMtm88pPL4LSZ7naPkV3y2tQsut+W5mNxKYLun13oLKDK8w LyKcJ6B9Z5dLnsmb1Tlb5D98szeVrKKNGA7BqtbQ44T9wjOE07liG4p7nqHNmN7GWLk4sJIqAPZD7 Jqrm4Ncsi72fE1araqb7/jU7Rb/5/AOLdBhbIiBPAzRzbzDldB/hscO1EHP0sVT2vdYoIokrsh97v fzQZaGlFJc6IkCHTDqPMPQc0MLfjDtJr5OX4TAlzQM/6HruKVIIO2lFh+u6bEu9uoMsVfNyXDo4Hi xiM/u+gT9J36lk45IPnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGE1-005Qd6-V5; Wed, 20 Oct 2021 18:22:06 +0000 Received: from mx2.smtp.larsendata.com ([91.221.196.228]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBN-005P4x-Pg for linux-mediatek@lists.infradead.org; Wed, 20 Oct 2021 18:19:27 +0000 Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id 45a216f6-31d2-11ec-ac3c-0050568cd888; Wed, 20 Oct 2021 18:19:32 +0000 (UTC) Received: from saturn.localdomain (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id 4C2EA194B13; Wed, 20 Oct 2021 20:19:19 +0200 (CEST) X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Jernej Skrabec , Jitao Shi , Jonas Karlman , Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Neil Armstrong , Philip Chen , Philipp Zabel , Robert Foss , Thomas Zimmermann , Sam Ravnborg , Maxime Ripard Subject: [PATCH v2 6/7] drm/bridge: Drop drm_bridge_chain_mode_fixup Date: Wed, 20 Oct 2021 20:19:00 +0200 Message-Id: <20211020181901.2114645-7-sam@ravnborg.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020181901.2114645-1-sam@ravnborg.org> References: <20211020181901.2114645-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_111922_003665_C50D996B X-CRM114-Status: GOOD ( 13.13 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org There are no users left of drm_bridge_chain_mode_fixup() and we do not want to have this function available, so drop it. Signed-off-by: Sam Ravnborg Reviewed-by: Maxime Ripard Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter --- drivers/gpu/drm/drm_bridge.c | 37 ------------------------------------ include/drm/drm_bridge.h | 3 --- 2 files changed, 40 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 7a57d6816105..57a864d9a87f 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -406,43 +406,6 @@ void drm_bridge_detach(struct drm_bridge *bridge) * needed, in order to gradually transition to the new model. */ -/** - * drm_bridge_chain_mode_fixup - fixup proposed mode for all bridges in the - * encoder chain - * @bridge: bridge control structure - * @mode: desired mode to be set for the bridge - * @adjusted_mode: updated mode that works for this bridge - * - * Calls &drm_bridge_funcs.mode_fixup for all the bridges in the - * encoder chain, starting from the first bridge to the last. - * - * Note: the bridge passed should be the one closest to the encoder - * - * RETURNS: - * true on success, false on failure - */ -bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct drm_encoder *encoder; - - if (!bridge) - return true; - - encoder = bridge->encoder; - list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { - if (!bridge->funcs->mode_fixup) - continue; - - if (!bridge->funcs->mode_fixup(bridge, mode, adjusted_mode)) - return false; - } - - return true; -} -EXPORT_SYMBOL(drm_bridge_chain_mode_fixup); - /** * drm_bridge_chain_mode_valid - validate the mode against all bridges in the * encoder chain. diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index f1eb71ff5379..c8d07bd27f63 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -837,9 +837,6 @@ drm_bridge_chain_get_first_bridge(struct drm_encoder *encoder) #define drm_for_each_bridge_in_chain(encoder, bridge) \ list_for_each_entry(bridge, &(encoder)->bridge_chain, chain_node) -bool drm_bridge_chain_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); enum drm_mode_status drm_bridge_chain_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info, From patchwork Wed Oct 20 18:19:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12572957 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A84C2C433EF for ; Wed, 20 Oct 2021 18:22:50 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 62C7660EFE for ; Wed, 20 Oct 2021 18:22:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 62C7660EFE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ravnborg.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FXOSXJJ6Ivifbyq50zoAWvPDnKYo0bZrbaUiRKb3F6Y=; b=Sn7nKPVoAYh4xa hZVYHX5PqR1/zXT/+7hT1NlBnKDe6hnUs57IjtgPaSnvwiugVD0lBtJN7FlbJqjaBcFlL3c0a9TCk d49Gi81SncVl4rbfw0LttNmwNP08FfgYUau+R+qtV9nzy1ZZUeaI2y8LI8ziv5jjxd1vwbew4hCxE WArRqc2qE4f0NJU5klNvbp5ovK7jHejfX6srnXZF8/S8LO2XDdhuVrU/f+E0LINjqejufSvFFrqx0 kri+xixpudR586w5JnAbFGeUSbM6LElBkdqJA4zYJqkiA5hKpgYBtJCwcvBSMH5jywqCpriYaBFOF fFZI6/6DLLWz/ieBGcOA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGEZ-005Qzb-V0; Wed, 20 Oct 2021 18:22:39 +0000 Received: from mx2.smtp.larsendata.com ([91.221.196.228]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdGBO-005P6B-Hp for linux-mediatek@lists.infradead.org; Wed, 20 Oct 2021 18:19:28 +0000 Received: from mail01.mxhotel.dk (mail01.mxhotel.dk [91.221.196.236]) by mx2.smtp.larsendata.com (Halon) with ESMTPS id 461401bb-31d2-11ec-ac3c-0050568cd888; Wed, 20 Oct 2021 18:19:33 +0000 (UTC) Received: from saturn.localdomain (80-162-45-141-cable.dk.customer.tdc.net [80.162.45.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sam@ravnborg.org) by mail01.mxhotel.dk (Postfix) with ESMTPSA id E9595194B6F; Wed, 20 Oct 2021 20:19:19 +0200 (CEST) X-Report-Abuse-To: abuse@mxhotel.dk From: Sam Ravnborg To: dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Jernej Skrabec , Jitao Shi , Jonas Karlman , Laurent Pinchart , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Neil Armstrong , Philip Chen , Philipp Zabel , Robert Foss , Thomas Zimmermann , Sam Ravnborg , Maxime Ripard Subject: [PATCH v2 7/7] drm/todo: Add bridge related todo items Date: Wed, 20 Oct 2021 20:19:01 +0200 Message-Id: <20211020181901.2114645-8-sam@ravnborg.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20211020181901.2114645-1-sam@ravnborg.org> References: <20211020181901.2114645-1-sam@ravnborg.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211020_111922_782069_54C3819A X-CRM114-Status: GOOD ( 18.07 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org - deprecated callbacks in drm_bridge_funcs - move connector creation to display drivers v2: - Updated descriptions in todo.rst Signed-off-by: Sam Ravnborg Acked-by: Maxime Ripard Cc: Laurent Pinchart Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter --- Documentation/gpu/todo.rst | 49 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index 60d1d7ee0719..17c03e7c41e5 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -463,6 +463,55 @@ Contact: Thomas Zimmermann , Christian König, Daniel Vette Level: Intermediate +Drop use of deprecated operations in bridge drivers +-------------------------------------------------- + +&struct drm_bridge_funcs contains a number of deprecated operations +which use can be replaced by the atomic variants. + +The following is more or less 1:1 replacements whit the arguments +and names adjusted: +* pre_enable => atomic_pre_enable +* enable => atomic_enable +* disable => atomic_disable +* post_disable => atomic_post_disable + +* mode_set is no longer required and the implementation shall be merged + with atomic_enable. + +* mode_fixup => atomic_check + mode_fixup() was created a long time ago, when we were supposed to have + a single bridge at the output of the CRTC. The bridge could then instruct + the CRTC to output a different mode than what the display requires. + Now that we have support for multiple bridges, it's not as straightforward, + and we've so far just pretended to ignore the problem. The .mode_fixup() + operation is used and abused, and just telling people to use .atomic_check() + will likely make things worse as that operation has access to the full atomic + commit and can alter the mode of pretty much anything. We need to define clear + semantics for .atomic_check() in bridges. + + +Contact: bridge maintainers, Sam Ravnborg , + Laurent Pinchart + +Level: Beginner or intermediate (depending on the driver) + +Move connector creation to display drivers +------------------------------------------ + +With the introduction of chained bridges the creation of connectors are moved +to the display drivers. The flag DRM_BRIDGE_ATTACH_NO_CONNECTOR is used to +signal to the bridge driver that no connector shall be created and that the +display driver will take care. Display drivers will in most cases be able to +utilise drm_bridge_connector_init() for all the logic. + +Step 1 is to have all bridge drivers supporting DRM_BRIDGE_ATTACH_NO_CONNECTOR. +Step 2 is to move connector creation to all relevant display drivers, utilizing +the drm_bridge_connector where possible. + +Contact: Sam Ravnborg , bridge and/or driver maintainer(s) + +Level: Intermediate or advanced (depending on the driver) Core refactorings =================