From patchwork Sun Jul 17 17:44:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920562 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B966C43334 for ; Sun, 17 Jul 2022 17:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229670AbiGQRpN (ORCPT ); Sun, 17 Jul 2022 13:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiGQRpM (ORCPT ); Sun, 17 Jul 2022 13:45:12 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA077DF89 for ; Sun, 17 Jul 2022 10:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=WpiIdNNw+YlTh9md/y+SUXBy5qWi7g/wD1nN6Hjb1fc=; b=SjCvmsX9tnzAHlHfFQXP3UhAFt18chTJzMiyXQ+UoMt0QyZf7K0VE1DoIAW1C/Duvc7sWvoumlhce j2i3Qd7o6D5Q/dk2n0Dz/XxdCpxxtoz2El2RB0bokmhqvF187EjAXnbBMQBG6w9IX0jZK9Gh0mHPlP O0i0RQm85ZiWrlMs2z8nNBvZSgg0+z75rj9wSxH+oXW+vbKhmj9a8zSkat0T6aaIpCKl3WecyGewmk 7yXtGASEKJ8AcFEoKUTypPWlfwrrgaensGSjEAxYwuUjB/ukU//Ewhm8b5Uyp/fNO2qchgWHM/W8/l YxgkfgDlNmsmCAMfpdWqRcKDSxFw/jg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=WpiIdNNw+YlTh9md/y+SUXBy5qWi7g/wD1nN6Hjb1fc=; b=ZWBPwkyfGgn0kvJgaogmSdBAPG6nzGfyaPcxggdpAs13BTMtZRIg4j7psRs7rpYPlCJi1YhA99Biz HN2hVycAA== X-HalOne-Cookie: 8bc88d894888cda86d4c72cfc609f8fc5424586e X-HalOne-ID: 32858be4-05f8-11ed-823f-d0431ea8bb10 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 32858be4-05f8-11ed-823f-d0431ea8bb10; Sun, 17 Jul 2022 17:45:08 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen , Andrzej Hajda , Laurent Pinchart Subject: [PATCH v1 01/12] drm/bridge: ps8640: Use atomic variants of drm_bridge_funcs Date: Sun, 17 Jul 2022 19:44:43 +0200 Message-Id: <20220717174454.46616-2-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.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: - Init state operations in drm_bridge_funcs (Laurent) 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 Reviewed-by: Laurent Pinchart --- 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 31e88cb39f8a..bb8076fb8625 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 @@ -409,7 +410,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]; @@ -443,7 +445,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); @@ -521,7 +524,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); @@ -531,7 +534,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; } @@ -546,8 +549,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 Sun Jul 17 17:44:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920563 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 347BBC433EF for ; Sun, 17 Jul 2022 17:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229696AbiGQRpO (ORCPT ); Sun, 17 Jul 2022 13:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbiGQRpN (ORCPT ); Sun, 17 Jul 2022 13:45:13 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5245AE038 for ; Sun, 17 Jul 2022 10:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=vrmH6j/pag/TAHd5gacgg6+hIq0bIhmlmYC9SVvEMUk=; b=tur3vjZ7J5oe2xh9gBjsYeCwZv849URfw9ROdiNmQiSlkx0FQYkXfzsaeNFbePNG+TyzDCuniVR3k pVjTv1kIAJSjnXcn0NaeDCnMKFdBmpdPNQ16pcpfPU67FATNXCLI+7evlJSV0oa3N1rO6d7mndQ77N JfBqYGnw0ZJzb18en13cKmkcjZzr5D7wnw6lKgbXvPitNf5pIbxUZLNUV1Y2flWr0oqfeqq1IQFh+f sMXwMRJhbPpMrwV3cLWY/ch5f2BLFyu6dW7WMgkcVf/dgJIT0yI+pE+N7I2p4oOFaxWdZ5pUceTRtK KL6h8JXqTa6tPM4tz0q/m54ThuLhv1g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=vrmH6j/pag/TAHd5gacgg6+hIq0bIhmlmYC9SVvEMUk=; b=+m/XHXsgtEpjZ5j3R9aVPSvnjjYAZc6JEPKo8LoxlH/6YgxdDvNrg3llrRha5yJ/VYTjnqkt2rIqy hevrPu3BA== X-HalOne-Cookie: da2ff8231e04c1e7940b3ca9b98092ce5455aff1 X-HalOne-ID: 336b8041-05f8-11ed-823f-d0431ea8bb10 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 336b8041-05f8-11ed-823f-d0431ea8bb10; Sun, 17 Jul 2022 17:45:09 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen , Andrzej Hajda Subject: [PATCH v1 02/12] drm/bridge: Drop unused drm_bridge_chain functions Date: Sun, 17 Jul 2022 19:44:44 +0200 Message-Id: <20220717174454.46616-3-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.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 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 --- --- 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 dba5d81e3b4a..1eca9c4c3346 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 Sun Jul 17 17:44:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920564 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9254DCCA47B for ; Sun, 17 Jul 2022 17:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229536AbiGQRpP (ORCPT ); Sun, 17 Jul 2022 13:45:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbiGQRpO (ORCPT ); Sun, 17 Jul 2022 13:45:14 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60CD0DF89 for ; Sun, 17 Jul 2022 10:45:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=khsqBXRM54QJ2q7TOizpyWUV+ilhMIlPa9CBnk0oMYM=; b=JqMVyi++sVW9vegkEzG1P8/bWVglvBFotUUJ7xMMP1WjvBA/fdg1s7FRHhRrGG4k7nbk0/eCVB1Ts xm84rftCcNrZusJ5wtb3S/mhScM3y7tF8aGomk8cqAPor/rRsEzUKR8TPilTBKW+nr6Wg1xYS0/Ksw XOhZupgkIVKYoYxQFoEOc2Pn7A1Hr2A+oOdv1EGDX09/Beb1da9H5vlfXIBYGQe+9730nxblEztuv5 xnzigYW5Wm77uoCTqA7CYzD0FxuNoB+yhuniEYPNpiURqPS5f40OYNwvSmqmxDEMwpHYpx+nveDW4q XpNd11d0hlPcKRc6nI8CVP7gGnctDUw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=khsqBXRM54QJ2q7TOizpyWUV+ilhMIlPa9CBnk0oMYM=; b=8nI+HJ6COK6NBXeBpaMj21RW9LZPgXsN1/LCu8lKQCSM5tDQ2G3jIbOgOwmV8AI/vIjVrukxxeD/G AfOclUnCg== X-HalOne-Cookie: 170ca66534e4be9ddd0a7847aca552fa493452f1 X-HalOne-ID: 34560b44-05f8-11ed-823f-d0431ea8bb10 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 34560b44-05f8-11ed-823f-d0431ea8bb10; Sun, 17 Jul 2022 17:45:11 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 03/12] drm/mediatek: Drop chain_mode_fixup call in mode_valid() Date: Sun, 17 Jul 2022 19:44:45 +0200 Message-Id: <20220717174454.46616-4-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.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 Acked-by: Chun-Kuang Hu Reviewed-by: Laurent Pinchart --- 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 3196189429bc..a63b76055f81 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) { if (hdmi->conf->cea_modes_only && !drm_match_cea_mode(mode)) return MODE_BAD; From patchwork Sun Jul 17 17:44:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920565 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37411C43334 for ; Sun, 17 Jul 2022 17:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229722AbiGQRpQ (ORCPT ); Sun, 17 Jul 2022 13:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbiGQRpQ (ORCPT ); Sun, 17 Jul 2022 13:45:16 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B62C0E038 for ; Sun, 17 Jul 2022 10:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=tUNzKCt4Zms15cwedQlM5lolVcnjoxkbNdM9xZbtnXY=; b=HdFn1ETyit4OaCqBQQGlXtNovIrF5rsy8lLAHWcEcybftrSgiT5SCEwEt72LJrOHNE2arLyDhwwam PR28Mf/SOxeBE/mtbQmHDcINjP8Gb038jncvvFlMp/FwdDn8Vyg/pYBfUBM9651pUIxN3qB0Ijw1fz LUgVEmwfBhU/sgSVPfRFJmwTnbKEGmOFX7ocgIJGLqNdaUloXEgjWnfaoYCSaoew7QYNfklTOBOm5c Vw1b5xHu5hmm+1R7u1EZVZGYWd8JXe+FbmhMnUYstOJSSxINZFiBZBjDh+HFuv9+yI6eP2HbA85Ys4 vL6jXWNWdDL8gTcY60TOIXPESd1Z3hw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=tUNzKCt4Zms15cwedQlM5lolVcnjoxkbNdM9xZbtnXY=; b=KEmxVha5B+qyEWKB+Yxxo71t4ryP28oUobas/F9bGwH0PvgiUzrAUENXT4o5Oa9vcpdEQUPfW15dr H17Zrc5Ag== X-HalOne-Cookie: c5eba13afd76c8abb22d288d6bb6ff2fa5436d67 X-HalOne-ID: 3503b0f2-05f8-11ed-823f-d0431ea8bb10 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 3503b0f2-05f8-11ed-823f-d0431ea8bb10; Sun, 17 Jul 2022 17:45:12 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 04/12] drm/bridge: Drop drm_bridge_chain_mode_fixup Date: Sun, 17 Jul 2022 19:44:46 +0200 Message-Id: <20220717174454.46616-5-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.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 Reviewed-by: Laurent Pinchart --- 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 bb7fc09267af..b6f56d8f3547 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -430,43 +430,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 1eca9c4c3346..7496f41535b1 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -845,9 +845,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 Sun Jul 17 17:44:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920566 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDF2BC433EF for ; Sun, 17 Jul 2022 17:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229760AbiGQRpR (ORCPT ); Sun, 17 Jul 2022 13:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbiGQRpQ (ORCPT ); Sun, 17 Jul 2022 13:45:16 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D97D6DF89 for ; Sun, 17 Jul 2022 10:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Fr26D2ca3PHdfYt82xP4O3qHYRqQcjO5dKvaWIOgNBE=; b=JSzummkp8PX0dmwtxN7hkOfqVk7KPXZXT7dncb2h2pW3SYrZ/UfnCOkF4nppkRoKbtxjnWZwl2gnJ FeSMcCKfdkQ4EK7Y6LYEeJr5oWd+ugr7K8yF14/xdIE5VNrJWK674ChkoxvC+lN5mB5m2qcpZOQ1aJ ek8Ws35wRL8qerXjhvihzyUYJOQ6xKVMIUIJ649yQgXsIUKJ2pBxE6q48HqA+yODr0tIwUTCV16qbz yvq8byD+gr3niIpINXHUXMCOOFzfCID9YqSSnAAA5XPmJP5ikuQ6syRVMiAoXRxUwphkz01y+rPKxA 9w/kYQVbMh9QwmGl2ugD1ltNGVQyh0A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Fr26D2ca3PHdfYt82xP4O3qHYRqQcjO5dKvaWIOgNBE=; b=bp33bWHdJ/F16zfPQlZFJBx92uYHy/9BWgyz/kR+lggXBSx57hYIjg8TJIbpKYHWB1EyGye2UDt18 DYaeHfzBQ== X-HalOne-Cookie: 31248d9cf3a18da4ee56357dc78f2dda447207e8 X-HalOne-ID: 35c44d3c-05f8-11ed-823f-d0431ea8bb10 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 35c44d3c-05f8-11ed-823f-d0431ea8bb10; Sun, 17 Jul 2022 17:45:13 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen , Laurent Pinchart Subject: [PATCH v1 05/12] drm/bridge: sii8620: Use drm_bridge_funcs.atomic_check Date: Sun, 17 Jul 2022 19:44:47 +0200 Message-Id: <20220717174454.46616-6-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Replace the deprecated drm_bridge_funcs.mode_fixup() with drm_bridge_funcs.atomic_check(). drm_bridge_funcs.atomic_check() requires the atomic state operations, update these to the default implementations. Signed-off-by: Sam Ravnborg Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Reviewed-by: Dave Stevenson Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/sil-sii8620.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/sil-sii8620.c index ab0bce4a988c..b6e5c285c8ea 100644 --- a/drivers/gpu/drm/bridge/sil-sii8620.c +++ b/drivers/gpu/drm/bridge/sil-sii8620.c @@ -8,6 +8,7 @@ #include +#include #include #include #include @@ -2262,26 +2263,30 @@ static enum drm_mode_status sii8620_mode_valid(struct drm_bridge *bridge, } } -static bool sii8620_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int sii8620_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct sii8620 *ctx = bridge_to_sii8620(bridge); mutex_lock(&ctx->lock); - ctx->use_packed_pixel = sii8620_is_packing_required(ctx, adjusted_mode); + ctx->use_packed_pixel = sii8620_is_packing_required(ctx, &crtc_state->adjusted_mode); mutex_unlock(&ctx->lock); - return true; + return 0; } static const struct drm_bridge_funcs sii8620_bridge_funcs = { .attach = sii8620_attach, .detach = sii8620_detach, - .mode_fixup = sii8620_mode_fixup, + .atomic_check = sii8620_atomic_check, .mode_valid = sii8620_mode_valid, + .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 sii8620_probe(struct i2c_client *client, From patchwork Sun Jul 17 17:44:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920567 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97EB2C43334 for ; Sun, 17 Jul 2022 17:45:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230462AbiGQRpS (ORCPT ); Sun, 17 Jul 2022 13:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbiGQRpS (ORCPT ); Sun, 17 Jul 2022 13:45:18 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38D60DF89 for ; Sun, 17 Jul 2022 10:45:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=OH+7B1dv6A/IsRaDuE+rP9ZN0s2pjNrgOB/nzBGQAF4=; b=fWaLsgjbGnWlwD1onXdQrk08KNmgroH9ExsH4/Ift4sAngkj5dHZZeaU6aUso4nGiFWB4+XSXh5Ws pmqYAI4z6M60JDgostVEB+rl7FUJckPUEDUN4xhel4YIgWWOZWCGr35ofFTmCaR08iCoTw9THx9YCw o0pWj2Jn1T/2JB/U1HaFXekXWJ+0KhCkAZSle+lF/tVrfKXydHBJTLlSCx00y7cAJEM+6e7yAnJDMD qr2K5KY1vgubuZVeA2LpLDuOtJp3T4uMUh1PFVnGhn9FvOOtftDrivGqYMgcDsYeH0ldGOHyT95jDt qiDfcDerFT5tBGGxdEplvsJWhnJdOrA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=OH+7B1dv6A/IsRaDuE+rP9ZN0s2pjNrgOB/nzBGQAF4=; b=n2sJMNE96nAy24OFbfHMHie+x45T7Ns0ZQgtqjazvcJXj1t5lB0PGXZsCWOlRyX3uwu92NbAFY70O +S9MCToCw== X-HalOne-Cookie: 0b59a70e3f6c156b2b4c6740a14cbfe11b04ef81 X-HalOne-ID: 3677d553-05f8-11ed-823f-d0431ea8bb10 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 3677d553-05f8-11ed-823f-d0431ea8bb10; Sun, 17 Jul 2022 17:45:14 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen , Laurent Pinchart Subject: [PATCH v1 06/12] drm/bridge: cros-ec-anx7688: Use drm_bridge_funcs.atomic_check Date: Sun, 17 Jul 2022 19:44:48 +0200 Message-Id: <20220717174454.46616-7-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Replace the deprecated drm_bridge_funcs.mode_fixup() with drm_bridge_funcs.atomic_check(). drm_bridge_funcs.atomic_check() requires the atomic state operations, update these to the default implementations. Signed-off-by: Sam Ravnborg Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Cc: Benson Leung Cc: Guenter Roeck Cc: chrome-platform@lists.linux.dev Reviewed-by: Dave Stevenson Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/cros-ec-anx7688.c | 28 +++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/cros-ec-anx7688.c b/drivers/gpu/drm/bridge/cros-ec-anx7688.c index 0f6d907432e3..fc19ea87926f 100644 --- a/drivers/gpu/drm/bridge/cros-ec-anx7688.c +++ b/drivers/gpu/drm/bridge/cros-ec-anx7688.c @@ -5,6 +5,7 @@ * Copyright 2020 Google LLC */ +#include #include #include #include @@ -45,9 +46,10 @@ bridge_to_cros_ec_anx7688(struct drm_bridge *bridge) return container_of(bridge, struct cros_ec_anx7688, bridge); } -static bool cros_ec_anx7688_bridge_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int cros_ec_anx7688_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct cros_ec_anx7688 *anx = bridge_to_cros_ec_anx7688(bridge); int totalbw, requiredbw; @@ -56,13 +58,13 @@ static bool cros_ec_anx7688_bridge_mode_fixup(struct drm_bridge *bridge, int ret; if (!anx->filter) - return true; + return 0; /* Read both regs 0x85 (bandwidth) and 0x86 (lane count). */ ret = regmap_bulk_read(anx->regmap, ANX7688_DP_BANDWIDTH_REG, regs, 2); if (ret < 0) { DRM_ERROR("Failed to read bandwidth/lane count\n"); - return false; + return ret; } dpbw = regs[0]; lanecount = regs[1]; @@ -71,28 +73,34 @@ static bool cros_ec_anx7688_bridge_mode_fixup(struct drm_bridge *bridge, if (dpbw > 0x19 || lanecount > 2) { DRM_ERROR("Invalid bandwidth/lane count (%02x/%d)\n", dpbw, lanecount); - return false; + return -EINVAL; } /* Compute available bandwidth (kHz) */ totalbw = dpbw * lanecount * 270000 * 8 / 10; /* Required bandwidth (8 bpc, kHz) */ - requiredbw = mode->clock * 8 * 3; + requiredbw = crtc_state->mode.clock * 8 * 3; DRM_DEBUG_KMS("DP bandwidth: %d kHz (%02x/%d); mode requires %d Khz\n", totalbw, dpbw, lanecount, requiredbw); if (totalbw == 0) { DRM_ERROR("Bandwidth/lane count are 0, not rejecting modes\n"); - return true; + return 0; } - return totalbw >= requiredbw; + if (totalbw < requiredbw) + return -EINVAL; + + return 0; } static const struct drm_bridge_funcs cros_ec_anx7688_bridge_funcs = { - .mode_fixup = cros_ec_anx7688_bridge_mode_fixup, + .atomic_check = cros_ec_anx7688_bridge_atomic_check, + .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 cros_ec_anx7688_bridge_probe(struct i2c_client *client) From patchwork Sun Jul 17 17:44:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920568 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D03EFC433EF for ; Sun, 17 Jul 2022 17:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbiGQRpU (ORCPT ); Sun, 17 Jul 2022 13:45:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbiGQRpT (ORCPT ); Sun, 17 Jul 2022 13:45:19 -0400 Received: from mailrelay4-1.pub.mailoutpod1-cph3.one.com (mailrelay4-1.pub.mailoutpod1-cph3.one.com [46.30.210.185]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 799A9DF89 for ; Sun, 17 Jul 2022 10:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=AfH9Qs5wD3KTt5THnRe+Ywjg0HUrKrXd9QuokU8dlm0=; b=Whtuk9yCXNltyVJGmT82ZE4RWmxFP7coq6NApU3N75TVhXACkuISqTzMPgwY3klO2WNeY+jCl3zVT cvHoial7JYydrOcg9fv+SqI0Sd+rk+osanLTDy7He13QxZuomFQuS4At/XvbMfYdloXKi3a6dWHtmh K9ebjOe3pMxB2vMUKtvscXqEx34W8uUULIqlxt8SWUhNWHHjCZo9tQMNSTkTvfhyWVrUk/VjFcYQET U7jPe2MjAjdMAP4WCXCbCltkT1fTYo0VEtBqG5iB6Mr+c91FFX4YsupMFADh1X9H58XNT9iuHp5bIN ghBXg1IPcvLuRMEY15JCJsCqziMtLFA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=AfH9Qs5wD3KTt5THnRe+Ywjg0HUrKrXd9QuokU8dlm0=; b=GmKuQ7a3DwmGvbT3CzG3kUtioZ1YWa2gzXDCeVLowhKKayjpOz3rDyS2iPsoetCSiHFRqO12MrH2e 5ipeInWBg== X-HalOne-Cookie: 281e936c87613b4ea5f8a9a665e5e773c0d67fb2 X-HalOne-ID: 3745decf-05f8-11ed-823f-d0431ea8bb10 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 3745decf-05f8-11ed-823f-d0431ea8bb10; Sun, 17 Jul 2022 17:45:16 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen , Laurent Pinchart Subject: [PATCH v1 07/12] drm/bridge: tc358767: Use drm_bridge_funcs.atomic_check Date: Sun, 17 Jul 2022 19:44:49 +0200 Message-Id: <20220717174454.46616-8-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org When atomic_check() is defined, then mode_fixup() is ignored, so it had no effect that drm_bridge_funcs.mode_fixup was assigned. Embed the original implementation in the caller and drop the function. Signed-off-by: Sam Ravnborg Cc: Andrzej Hajda Cc: Neil Armstrong Cc: Robert Foss Cc: Laurent Pinchart Cc: Jonas Karlman Cc: Jernej Skrabec Reviewed-by: Dave Stevenson Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/bridge/tc358767.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c index 02bd757a8987..b2ab967504af 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1496,26 +1496,18 @@ tc_edp_bridge_atomic_disable(struct drm_bridge *bridge, dev_err(tc->dev, "main link disable error: %d\n", ret); } -static bool tc_bridge_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adj) -{ - /* Fixup sync polarities, both hsync and vsync are active low */ - adj->flags = mode->flags; - adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); - adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); - - return true; -} - static int tc_common_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state, const unsigned int max_khz) { - tc_bridge_mode_fixup(bridge, &crtc_state->mode, - &crtc_state->adjusted_mode); + struct drm_display_mode *adj = &crtc_state->adjusted_mode; + + /* Fixup sync polarities, both hsync and vsync are active low */ + adj->flags = crtc_state->mode.flags; + adj->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); + adj->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); if (crtc_state->adjusted_mode.clock > max_khz) return -EINVAL; @@ -1783,7 +1775,6 @@ static const struct drm_bridge_funcs tc_edp_bridge_funcs = { .atomic_check = tc_edp_atomic_check, .atomic_enable = tc_edp_bridge_atomic_enable, .atomic_disable = tc_edp_bridge_atomic_disable, - .mode_fixup = tc_bridge_mode_fixup, .detect = tc_bridge_detect, .get_edid = tc_get_edid, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, From patchwork Sun Jul 17 17:57:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920601 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40B1BC433EF for ; Sun, 17 Jul 2022 17:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbiGQR6Q (ORCPT ); Sun, 17 Jul 2022 13:58:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbiGQR6P (ORCPT ); Sun, 17 Jul 2022 13:58:15 -0400 Received: from mailrelay3-1.pub.mailoutpod1-cph3.one.com (mailrelay3-1.pub.mailoutpod1-cph3.one.com [46.30.210.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 093C613D5D for ; Sun, 17 Jul 2022 10:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Ie8mdCntK7qyM1ThoHTn0tAb6FNFfAz8fYfoPn1nKpM=; b=Owd4TR+EIAcR/w4IS9ir8ZcJOxNC7zfMKnLLOvEYaWyNhBD6xHyXdMeyWVSlHv8yuBoUu6GTdlV0M +N5PjTde+3Ugkzo3EnTrBclAEoZabbMu5LbWyaFQ2Xqq1dsx+GvCku2SfiQseFlvC9y1szOx/UjCz7 sVDLt2A+KV6QCO4bTytrBcXafvcny+Bw9DonGSumNPJmvm9J4HlydnWkQO0E87ZmJfQsSsjO69Tpe4 X3QqfpcIY1s30KdBaNVnCsaxv1IxTL7VGjS9nDe3aC9eTCv8FRR3uMzBT3QSRCcVccCY4NtCo1BXuQ 0nJuEkYd8XyKOt8aZfKhOB6lxCuNSgg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Ie8mdCntK7qyM1ThoHTn0tAb6FNFfAz8fYfoPn1nKpM=; b=SJAzZOPeRrw1zNoIoWtZEdkJbmL6Ihhfv4xQ6otdBCl2YYmEUOZQyubn0ANmkK9oD5aYtc7xczVbI J81A1uACg== X-HalOne-Cookie: 1e041dfdbe31dc4e91bc574cc7fddbd785b1642b X-HalOne-ID: 05046757-05fa-11ed-be7f-d0431ea8bb03 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 05046757-05fa-11ed-be7f-d0431ea8bb03; Sun, 17 Jul 2022 17:58:11 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 08/12] drm/mediatek: Drop mtk_hdmi_bridge_mode_fixup Date: Sun, 17 Jul 2022 19:57:57 +0200 Message-Id: <20220717175801.78668-1-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717174454.46616-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org The implementation of drm_bridge_funcs.mode_fixup is optional so there is no need to provide an empty implementation. Drop mtk_hdmi_bridge_mode_fixup() so the driver no longer uses the deprecated drm_bridge_funcs.mode_fixup() operation. Signed-off-by: Sam Ravnborg Cc: Chun-Kuang Hu Cc: Philipp Zabel Cc: Matthias Brugger Cc: linux-mediatek@lists.infradead.org Cc: linux-arm-kernel@lists.infradead.org Reviewed-by: Dave Stevenson Acked-by: Chun-Kuang Hu Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index a63b76055f81..7321aa1ee6f0 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -1293,13 +1293,6 @@ static int mtk_hdmi_bridge_attach(struct drm_bridge *bridge, return 0; } -static bool mtk_hdmi_bridge_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - return true; -} - static void mtk_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { @@ -1399,7 +1392,6 @@ static const struct drm_bridge_funcs mtk_hdmi_bridge_funcs = { .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, .attach = mtk_hdmi_bridge_attach, - .mode_fixup = mtk_hdmi_bridge_mode_fixup, .atomic_disable = mtk_hdmi_bridge_atomic_disable, .atomic_post_disable = mtk_hdmi_bridge_atomic_post_disable, .mode_set = mtk_hdmi_bridge_mode_set, From patchwork Sun Jul 17 17:57:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920602 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 005E5C43334 for ; Sun, 17 Jul 2022 17:58:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230264AbiGQR6U (ORCPT ); Sun, 17 Jul 2022 13:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiGQR6S (ORCPT ); Sun, 17 Jul 2022 13:58:18 -0400 Received: from mailrelay3-1.pub.mailoutpod1-cph3.one.com (mailrelay3-1.pub.mailoutpod1-cph3.one.com [46.30.210.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599D713D61 for ; Sun, 17 Jul 2022 10:58:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=8xMDkuUfPGn0o735pjsKmzPk0fBw5yBNOtUUSLza8y8=; b=aoi4B6bMH3Cqlb15Pt+qz0yBgpA74ySyu5WsJzQLwhx5nXceezPGoNu2Dqm1PJmOVmPfMNmxT8+8h 0Z8/JDQXKMg5v/f8+33EPObPtz1JjmoIBjNYH9+G06LdnT2ou2XsjpoEZ4OfqrlHYKAU1oX/v5+Luz 7SzvdZPdevTuMpVnkjvrPHOkAfai+pByhDs9StAky2XNzasryvXV076zl6t+g/jFbpF2S2pwUmZAH3 PkK/hbcyi9sLuRsnXX8sX9tBeK09kP/oW35yL5r/9rOuLbWdtgL8BG03YWgXvHVz/i+PkmDkViwUFv a+pBpQwd7vsayyeD4gKIwygIJU1cvUQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=8xMDkuUfPGn0o735pjsKmzPk0fBw5yBNOtUUSLza8y8=; b=wNVu+OQTZtFBwr05sqKFwWIn3xsPomNIVKtIlMY7HEFSLGeaKUoEF2OW6IeHdYoYe+yv3O5YQE2zM tjk/AzvAA== X-HalOne-Cookie: cb254aee6c7ec574bf0b0b704723fae5f8c7f5e7 X-HalOne-ID: 0789e88e-05fa-11ed-be7f-d0431ea8bb03 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 0789e88e-05fa-11ed-be7f-d0431ea8bb03; Sun, 17 Jul 2022 17:58:15 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 09/12] drm/rcar-du: lvds: Use drm_bridge_funcs.atomic_check Date: Sun, 17 Jul 2022 19:57:58 +0200 Message-Id: <20220717175801.78668-2-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717175801.78668-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> <20220717175801.78668-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Replace the deprecated drm_bridge_funcs.mode_fixup() with drm_bridge_funcs.atomic_check(). The driver implements the state operations, so no other changes are required for the replacement. Signed-off-by: Sam Ravnborg Cc: Laurent Pinchart Cc: Kieran Bingham Cc: linux-renesas-soc@vger.kernel.org Reviewed-by: Dave Stevenson Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/rcar-du/rcar_lvds.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/rcar-du/rcar_lvds.c b/drivers/gpu/drm/rcar-du/rcar_lvds.c index 830aac0a2cb4..c4adbcede090 100644 --- a/drivers/gpu/drm/rcar-du/rcar_lvds.c +++ b/drivers/gpu/drm/rcar-du/rcar_lvds.c @@ -554,10 +554,12 @@ static void rcar_lvds_atomic_disable(struct drm_bridge *bridge, clk_disable_unprepare(lvds->clocks.mod); } -static bool rcar_lvds_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int rcar_lvds_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { + struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; struct rcar_lvds *lvds = bridge_to_rcar_lvds(bridge); int min_freq; @@ -569,7 +571,7 @@ static bool rcar_lvds_mode_fixup(struct drm_bridge *bridge, min_freq = lvds->info->quirks & RCAR_LVDS_QUIRK_EXT_PLL ? 5000 : 31000; adjusted_mode->clock = clamp(adjusted_mode->clock, min_freq, 148500); - return true; + return 0; } static int rcar_lvds_attach(struct drm_bridge *bridge, @@ -591,7 +593,7 @@ static const struct drm_bridge_funcs rcar_lvds_bridge_ops = { .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = rcar_lvds_atomic_enable, .atomic_disable = rcar_lvds_atomic_disable, - .mode_fixup = rcar_lvds_mode_fixup, + .atomic_check = rcar_lvds_atomic_check, }; bool rcar_lvds_dual_link(struct drm_bridge *bridge) From patchwork Sun Jul 17 17:57:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920603 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7F70CCA47B for ; Sun, 17 Jul 2022 17:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229487AbiGQR6W (ORCPT ); Sun, 17 Jul 2022 13:58:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229873AbiGQR6V (ORCPT ); Sun, 17 Jul 2022 13:58:21 -0400 Received: from mailrelay3-1.pub.mailoutpod1-cph3.one.com (mailrelay3-1.pub.mailoutpod1-cph3.one.com [46.30.210.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6D613D5D for ; Sun, 17 Jul 2022 10:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=s+/PjTNqyYmpEcNmfZriFAlvBGd84NJkEF+Q3a7qslc=; b=qjEDcuaoSr76+r/j9HYYkyumPDe6D9/KE/Wu6qYodgdiQoHstOPt59Q/4j7R9rptgf2r74SVd8p11 qUHuyAqHY6iKgOM/tib3Fs8WulBopsJ+37pFeIsnkxM+oQHiEGhIthL18V87Wo4rOfJ7tNLskhuf4H 2K/Y6hvHRKU+vV3aJWgLgKT1Y7UiTLA36YsyrT0oBTnPCCUP9NQB/ykhfbNgNa/V8ex5FtZmOBeqCw gRC9MU7knL8BRK23zTv+DAoUlZ3GTTeIjH/BfhRvBrGGn/U5z769omAytqBJFdhMOTeYsBdfa2q7Tq 0RTXJKfYlThtiIWT7zZGUNe99K3Abpg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=s+/PjTNqyYmpEcNmfZriFAlvBGd84NJkEF+Q3a7qslc=; b=4b4u/5GgsckUncPGlqb7pCwa1nBsdQZTe9Szqe0r5EA04IjHkagekoZwE+72FLdiZ8g3O/8uEgZ4g U/PbaNGAQ== X-HalOne-Cookie: 829284897e10912949ceddc418dae9e9939d39de X-HalOne-ID: 08e0e86d-05fa-11ed-be7f-d0431ea8bb03 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 08e0e86d-05fa-11ed-be7f-d0431ea8bb03; Sun, 17 Jul 2022 17:58:17 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 10/12] drm/omapdrm: Use drm_bridge_funcs.atomic_check Date: Sun, 17 Jul 2022 19:57:59 +0200 Message-Id: <20220717175801.78668-3-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717175801.78668-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> <20220717175801.78668-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Replace the deprecated drm_bridge_funcs.mode_fixup() with drm_bridge_funcs.atomic_check(). drm_bridge_funcs.atomic_check() requires the atomic state operations, update these to the default implementations. Likewise update enable/disable to their atomic variants. With these changes omapdrm now implement the full bridge atomic API. Signed-off-by: Sam Ravnborg Cc: Sam Ravnborg Cc: Tomi Valkeinen Cc: Cai Huoqing Cc: Arnd Bergmann Cc: Laurent Pinchart Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/dpi.c | 31 ++++++++++++++++++------------ drivers/gpu/drm/omapdrm/dss/sdi.c | 31 ++++++++++++++++++------------ drivers/gpu/drm/omapdrm/dss/venc.c | 28 +++++++++++++++++---------- 3 files changed, 56 insertions(+), 34 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dpi.c b/drivers/gpu/drm/omapdrm/dss/dpi.c index 030f997eccd0..0a0b49750eca 100644 --- a/drivers/gpu/drm/omapdrm/dss/dpi.c +++ b/drivers/gpu/drm/omapdrm/dss/dpi.c @@ -21,6 +21,7 @@ #include #include +#include #include #include "dss.h" @@ -454,21 +455,22 @@ dpi_bridge_mode_valid(struct drm_bridge *bridge, return MODE_OK; } -static bool dpi_bridge_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int dpi_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct dpi_data *dpi = drm_bridge_to_dpi(bridge); - unsigned long clock = mode->clock * 1000; + unsigned long clock = crtc_state->mode.clock * 1000; int ret; ret = dpi_clock_update(dpi, &clock); if (ret < 0) - return false; + return ret; - adjusted_mode->clock = clock / 1000; + crtc_state->adjusted_mode.clock = clock / 1000; - return true; + return 0; } static void dpi_bridge_mode_set(struct drm_bridge *bridge, @@ -480,7 +482,8 @@ static void dpi_bridge_mode_set(struct drm_bridge *bridge, dpi->pixelclock = adjusted_mode->clock * 1000; } -static void dpi_bridge_enable(struct drm_bridge *bridge) +static void dpi_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct dpi_data *dpi = drm_bridge_to_dpi(bridge); int r; @@ -531,7 +534,8 @@ static void dpi_bridge_enable(struct drm_bridge *bridge) regulator_disable(dpi->vdds_dsi_reg); } -static void dpi_bridge_disable(struct drm_bridge *bridge) +static void dpi_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct dpi_data *dpi = drm_bridge_to_dpi(bridge); @@ -552,10 +556,13 @@ static void dpi_bridge_disable(struct drm_bridge *bridge) static const struct drm_bridge_funcs dpi_bridge_funcs = { .attach = dpi_bridge_attach, .mode_valid = dpi_bridge_mode_valid, - .mode_fixup = dpi_bridge_mode_fixup, + .atomic_check = dpi_bridge_atomic_check, .mode_set = dpi_bridge_mode_set, - .enable = dpi_bridge_enable, - .disable = dpi_bridge_disable, + .atomic_enable = dpi_bridge_atomic_enable, + .atomic_disable = dpi_bridge_atomic_disable, + .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 void dpi_bridge_init(struct dpi_data *dpi) diff --git a/drivers/gpu/drm/omapdrm/dss/sdi.c b/drivers/gpu/drm/omapdrm/dss/sdi.c index 91eaae3b9481..73b728722c2f 100644 --- a/drivers/gpu/drm/omapdrm/dss/sdi.c +++ b/drivers/gpu/drm/omapdrm/dss/sdi.c @@ -15,6 +15,7 @@ #include #include +#include #include #include "dss.h" @@ -159,12 +160,13 @@ sdi_bridge_mode_valid(struct drm_bridge *bridge, return MODE_OK; } -static bool sdi_bridge_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int sdi_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { struct sdi_device *sdi = drm_bridge_to_sdi(bridge); - unsigned long pixelclock = mode->clock * 1000; + unsigned long pixelclock = crtc_state->mode.clock * 1000; struct dispc_clock_info dispc_cinfo; unsigned long fck; unsigned long pck; @@ -172,7 +174,7 @@ static bool sdi_bridge_mode_fixup(struct drm_bridge *bridge, ret = sdi_calc_clock_div(sdi, pixelclock, &fck, &dispc_cinfo); if (ret < 0) - return false; + return ret; pck = fck / dispc_cinfo.lck_div / dispc_cinfo.pck_div; @@ -181,9 +183,9 @@ static bool sdi_bridge_mode_fixup(struct drm_bridge *bridge, "pixel clock adjusted from %lu Hz to %lu Hz\n", pixelclock, pck); - adjusted_mode->clock = pck / 1000; + crtc_state->adjusted_mode.clock = pck / 1000; - return true; + return 0; } static void sdi_bridge_mode_set(struct drm_bridge *bridge, @@ -195,7 +197,8 @@ static void sdi_bridge_mode_set(struct drm_bridge *bridge, sdi->pixelclock = adjusted_mode->clock * 1000; } -static void sdi_bridge_enable(struct drm_bridge *bridge) +static void sdi_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct sdi_device *sdi = drm_bridge_to_sdi(bridge); struct dispc_clock_info dispc_cinfo; @@ -258,7 +261,8 @@ static void sdi_bridge_enable(struct drm_bridge *bridge) regulator_disable(sdi->vdds_sdi_reg); } -static void sdi_bridge_disable(struct drm_bridge *bridge) +static void sdi_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct sdi_device *sdi = drm_bridge_to_sdi(bridge); @@ -274,10 +278,13 @@ static void sdi_bridge_disable(struct drm_bridge *bridge) static const struct drm_bridge_funcs sdi_bridge_funcs = { .attach = sdi_bridge_attach, .mode_valid = sdi_bridge_mode_valid, - .mode_fixup = sdi_bridge_mode_fixup, + .atomic_check = sdi_bridge_atomic_check, .mode_set = sdi_bridge_mode_set, - .enable = sdi_bridge_enable, - .disable = sdi_bridge_disable, + .atomic_enable = sdi_bridge_atomic_enable, + .atomic_disable = sdi_bridge_atomic_disable, + .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 void sdi_bridge_init(struct sdi_device *sdi) diff --git a/drivers/gpu/drm/omapdrm/dss/venc.c b/drivers/gpu/drm/omapdrm/dss/venc.c index 4480b69ab5a7..994e6399d574 100644 --- a/drivers/gpu/drm/omapdrm/dss/venc.c +++ b/drivers/gpu/drm/omapdrm/dss/venc.c @@ -25,6 +25,7 @@ #include #include +#include #include #include "omapdss.h" @@ -564,11 +565,13 @@ venc_bridge_mode_valid(struct drm_bridge *bridge, } } -static bool venc_bridge_mode_fixup(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static int venc_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) { const struct drm_display_mode *venc_mode; + struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; switch (venc_get_videomode(adjusted_mode)) { case VENC_MODE_PAL: @@ -580,14 +583,14 @@ static bool venc_bridge_mode_fixup(struct drm_bridge *bridge, break; default: - return false; + return -EINVAL; } drm_mode_copy(adjusted_mode, venc_mode); drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V); drm_mode_set_name(adjusted_mode); - return true; + return 0; } static void venc_bridge_mode_set(struct drm_bridge *bridge, @@ -613,14 +616,16 @@ static void venc_bridge_mode_set(struct drm_bridge *bridge, dispc_set_tv_pclk(venc->dss->dispc, 13500000); } -static void venc_bridge_enable(struct drm_bridge *bridge) +static void venc_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct venc_device *venc = drm_bridge_to_venc(bridge); venc_power_on(venc); } -static void venc_bridge_disable(struct drm_bridge *bridge) +static void venc_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct venc_device *venc = drm_bridge_to_venc(bridge); @@ -654,11 +659,14 @@ static int venc_bridge_get_modes(struct drm_bridge *bridge, static const struct drm_bridge_funcs venc_bridge_funcs = { .attach = venc_bridge_attach, .mode_valid = venc_bridge_mode_valid, - .mode_fixup = venc_bridge_mode_fixup, + .atomic_check = venc_bridge_atomic_check, .mode_set = venc_bridge_mode_set, - .enable = venc_bridge_enable, - .disable = venc_bridge_disable, + .atomic_enable = venc_bridge_atomic_enable, + .atomic_disable = venc_bridge_atomic_disable, .get_modes = venc_bridge_get_modes, + .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 void venc_bridge_init(struct venc_device *venc) From patchwork Sun Jul 17 17:58:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920604 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53012CCA47B for ; Sun, 17 Jul 2022 17:58:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230403AbiGQR6Y (ORCPT ); Sun, 17 Jul 2022 13:58:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229629AbiGQR6X (ORCPT ); Sun, 17 Jul 2022 13:58:23 -0400 Received: from mailrelay3-1.pub.mailoutpod1-cph3.one.com (mailrelay3-1.pub.mailoutpod1-cph3.one.com [46.30.210.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A1A613D61 for ; Sun, 17 Jul 2022 10:58:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Q5AK+4NypIlk8rRS3I711RmXejfY0OnnESySL2cldlE=; b=h+bfBHFSeG2CbL7laYU1YY2xRf6vZMMRMk5qvEAomwTsvBfDLqtntGSkQ9DVsG5VCzhE/TlCDpbRS neJVUzwik7sUmhoAVmFTXOJbY8kXjBNIIs1i5+3fZ3LZnsGMSqKX+UVW+SANGh7k2nmfI/SB5yj86d paP/zrB7Rn7Q30OjeHsEIPW3J0lYufB9/6t78mO3XPlgjFEyjfDhOlcTlayHPhErDiKzuDnRknKbj9 /ietNxnf15VZVa7EvobBvv9v0idp2Oq1KKLek7bFj+83PZA4AjxNqS0qWmbk4b6qWOiE0EPVSLAWLj F2gBFwxUkXOyRGDYStplHVVE6fn+QtA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=Q5AK+4NypIlk8rRS3I711RmXejfY0OnnESySL2cldlE=; b=bQm2AFkfu8hxjpuiE8TTBMzELBXKR/wSzafBmVuen8WRQNu21XRea3D9JUrytgKpVLGuhsbs8Jt2e 2sP1etwAA== X-HalOne-Cookie: 24d84fb73bff50a580c06332d25b99da2f041561 X-HalOne-ID: 0a676264-05fa-11ed-be7f-d0431ea8bb03 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 0a676264-05fa-11ed-be7f-d0431ea8bb03; Sun, 17 Jul 2022 17:58:19 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 11/12] drm/bridge: Drop drm_bridge_funcs.mode_fixup Date: Sun, 17 Jul 2022 19:58:00 +0200 Message-Id: <20220717175801.78668-4-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717175801.78668-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> <20220717175801.78668-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org All users are converted over to drm_bridge_funcs.atomic_check() so it is safe to drop the mode_fixup support. Update the comment for atomic_check with relevant parts from mode_fixup. Signed-off-by: Sam Ravnborg Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Thomas Zimmermann Cc: David Airlie Cc: Daniel Vetter Reviewed-by: Dave Stevenson Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/drm_bridge.c | 7 +---- include/drm/drm_bridge.h | 60 ++++++++++-------------------------- 2 files changed, 17 insertions(+), 50 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index b6f56d8f3547..3f5acb19957c 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -685,10 +685,6 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, crtc_state, conn_state); if (ret) return ret; - } else if (bridge->funcs->mode_fixup) { - if (!bridge->funcs->mode_fixup(bridge, &crtc_state->mode, - &crtc_state->adjusted_mode)) - return -EINVAL; } return 0; @@ -934,8 +930,7 @@ drm_atomic_bridge_propagate_bus_flags(struct drm_bridge *bridge, * @conn_state: new connector state * * First trigger a bus format negotiation before calling - * &drm_bridge_funcs.atomic_check() (falls back on - * &drm_bridge_funcs.mode_fixup()) op for all the bridges in the encoder chain, + * &drm_bridge_funcs.atomic_check() op for all the bridges in the encoder chain, * starting from the last bridge to the first. These are called before calling * &drm_encoder_helper_funcs.atomic_check() * diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 7496f41535b1..8c93369bcc74 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -106,7 +106,7 @@ struct drm_bridge_funcs { * to look at anything else but the passed-in mode, and validate it * against configuration-invariant hardward constraints. Any further * limits which depend upon the configuration can only be checked in - * @mode_fixup. + * @atomic_check. * * RETURNS: * @@ -116,46 +116,6 @@ struct drm_bridge_funcs { const struct drm_display_info *info, const struct drm_display_mode *mode); - /** - * @mode_fixup: - * - * This callback is used to validate and adjust a mode. The parameter - * mode is the display mode that should be fed to the next element in - * the display chain, either the final &drm_connector or the next - * &drm_bridge. The parameter adjusted_mode is the input mode the bridge - * requires. It can be modified by this callback and does not need to - * match mode. See also &drm_crtc_state.adjusted_mode for more details. - * - * This is the only hook that allows a bridge to reject a modeset. If - * this function passes all other callbacks must succeed for this - * configuration. - * - * The mode_fixup callback is optional. &drm_bridge_funcs.mode_fixup() - * is not called when &drm_bridge_funcs.atomic_check() is implemented, - * so only one of them should be provided. - * - * NOTE: - * - * This function is called in the check phase of atomic modesets, which - * can be aborted for any reason (including on userspace's request to - * just check whether a configuration would be possible). Drivers MUST - * NOT touch any persistent state (hardware or software) or data - * structures except the passed in @state parameter. - * - * Also beware that userspace can request its own custom modes, neither - * core nor helpers filter modes to the list of probe modes reported by - * the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure - * that modes are filtered consistently put any bridge constraints and - * limits checks into @mode_valid. - * - * RETURNS: - * - * True if an acceptable configuration is possible, false if the modeset - * operation should be rejected. - */ - bool (*mode_fixup)(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode); /** * @disable: * @@ -466,9 +426,7 @@ struct drm_bridge_funcs { * &drm_bridge_funcs.atomic_check() hooks are called in reverse * order (from the last to the first bridge). * - * This method is optional. &drm_bridge_funcs.mode_fixup() is not - * called when &drm_bridge_funcs.atomic_check() is implemented, so only - * one of them should be provided. + * This method is optional. * * If drivers need to tweak &drm_bridge_state.input_bus_cfg.flags or * &drm_bridge_state.output_bus_cfg.flags it should happen in @@ -478,6 +436,20 @@ struct drm_bridge_funcs { * &drm_connector.display_info.bus_flags if the bridge is the last * element in the chain. * + * NOTE: + * + * This function is called in the check phase of atomic modesets, which + * can be aborted for any reason (including on userspace's request to + * just check whether a configuration would be possible). Drivers MUST + * NOT touch any persistent state (hardware or software) or data + * structures except the passed in @state parameter. + * + * Also beware that userspace can request its own custom modes, neither + * core nor helpers filter modes to the list of probe modes reported by + * the GETCONNECTOR IOCTL and stored in &drm_connector.modes. To ensure + * that modes are filtered consistently put any bridge constraints and + * limits checks into @mode_valid. + * * RETURNS: * zero if the check passed, a negative error code otherwise. */ From patchwork Sun Jul 17 17:58:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sam Ravnborg X-Patchwork-Id: 12920605 X-Patchwork-Delegate: kieran@bingham.xyz 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7C7DCCA47B for ; Sun, 17 Jul 2022 17:58:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229629AbiGQR6a (ORCPT ); Sun, 17 Jul 2022 13:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230429AbiGQR62 (ORCPT ); Sun, 17 Jul 2022 13:58:28 -0400 Received: from mailrelay3-1.pub.mailoutpod1-cph3.one.com (mailrelay3-1.pub.mailoutpod1-cph3.one.com [46.30.210.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED1D613D5D for ; Sun, 17 Jul 2022 10:58:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ravnborg.org; s=rsa1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=k798q7ML9R4Plrb6TqpakxyUbx1g5KWRA3qhCOyn4ek=; b=e4C90Y5+4w0vcw6rF3D2f2kPP3t7AKAHZcUH+DI7+w2S/TiSCVHlJIIDo1BTHWu8uXzcUjI1wRu52 2zJtbAOys8Wv+uhj3pGNnfUOZEh/aY+NUpDDduf4CZ7mHj8+XoRYw2DYuVYiaWYk9eM9m1vqSFoJnJ MbGBsjKP3B+RERK182PCh3q8+RcvUgJ2bgxltXrqQAZZPOkqIRdhdzcDHFLQf+dsy8+Zf0WFmDf5vT suoUhkWliBi2VSyuOrwsDNYnBd4E0tI3lJ345y1HAwNMjxKe9UvyirlmZxYr5+qmnk20MXk8HcEv4Z VVKzfw1WQwbfXSE32Q1WGB1w08q0cLQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ravnborg.org; s=ed1; h=content-transfer-encoding:mime-version:references:in-reply-to:message-id:date: subject:cc:to:from:from; bh=k798q7ML9R4Plrb6TqpakxyUbx1g5KWRA3qhCOyn4ek=; b=atAGNS4/GuLbsXt6VCubT00JfzK8dji6XUbvCGx+kiMBvBk+yhcp7ECF/qD3gslmtsoc7xgAbAlme hMikQjUAw== X-HalOne-Cookie: e93fb8437fd3034790c1dedaf93d71e57f69d988 X-HalOne-ID: 0dd61fc2-05fa-11ed-be7f-d0431ea8bb03 Received: from mailproxy1.cst.dirpod4-cph3.one.com (2-105-2-98-cable.dk.customer.tdc.net [2.105.2.98]) by mailrelay3.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 0dd61fc2-05fa-11ed-be7f-d0431ea8bb03; Sun, 17 Jul 2022 17:58:25 +0000 (UTC) From: Sam Ravnborg To: dri-devel@lists.freedesktop.org, Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: Arnd Bergmann , Benson Leung , Cai Huoqing , chrome-platform@lists.linux.dev, Chun-Kuang Hu , Dafna Hirschfeld , Daniel Vetter , David Airlie , Enric Balletbo i Serra , Guenter Roeck , Jitao Shi , Kieran Bingham , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Maarten Lankhorst , Matthias Brugger , Maxime Ripard , Philip Chen , Philipp Zabel , Sam Ravnborg , Thomas Zimmermann , Tomi Valkeinen Subject: [PATCH v1 12/12] drm/todo: Add bridge related todo items Date: Sun, 17 Jul 2022 19:58:01 +0200 Message-Id: <20220717175801.78668-5-sam@ravnborg.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220717175801.78668-1-sam@ravnborg.org> References: <20220717174454.46616-1-sam@ravnborg.org> <20220717175801.78668-1-sam@ravnborg.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org Add todo in the hope someone will help updating the bridge 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 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Documentation/gpu/todo.rst b/Documentation/gpu/todo.rst index 10bfb50908d1..fbcc232e0bc1 100644 --- a/Documentation/gpu/todo.rst +++ b/Documentation/gpu/todo.rst @@ -480,6 +480,26 @@ Contact: Thomas Zimmermann Level: Starter +Drop use of deprecated operations in bridge drivers +-------------------------------------------------- + +&struct drm_bridge_funcs contains a number of deprecated operations +which can be replaced by the atomic variants. + +The following is more or less 1:1 replacements with 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. + +Contact: bridge maintainers, Sam Ravnborg , + Laurent Pinchart + +Level: Beginner or intermediate (depending on the driver) Core refactorings =================