drm/bridge: Various quality of life improvements
Subsystems (35)
Maxime Ripard
maintainerv3 cover drm/bridge: Various quality of life improvements
Hi,
Here's a series of changes after to the KMS helpers and bridge API following a bunch of reviews I did.
It's mostly centered across providing an easier time to deal with bridge states, and a somewhat consistent with the other entities API.
It's build tested only, with arm64 allmodconfig.
Maxime
---
Changes in v3:
- Add tags
- Fix compilation breakages
- Reword some commit messages
- Create drm_bridge_is_atomic() helper
- Retrieve the CRTC state through drm_atomic_get_new_crtc_state()
instead of crtc->state in bridges
- Fix ti-sn65dsi86
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Pass the full atomic state to bridge atomic hooks
- Make attach take the encoder as a parameter
- Mark bridge->encoder as deprecated
- Rework the logic to detect if a bridge uses a state or not at
atomic_check time
- Add lockdep assertion to drm_bridge_get_current_state()
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Maxime Ripard (37):
drm/atomic: Document history of drm_atomic_state
drm/bridge: Pass full state to atomic_pre_enable
drm/bridge: Pass full state to atomic_enable
drm/bridge: Pass full state to atomic_disable
drm/bridge: Pass full state to atomic_post_disable
drm/atomic-helper: Fix commit_tail state variable name
drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_dependencies() drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail() drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail_rpm() drm/atomic-helper: Change parameter name of drm_atomic_helper_modeset_disables() drm/atomic-helper: Change parameter name of disable_outputs()
drm/bridge: Change parameter name of drm_atomic_bridge_chain_disable() drm/bridge: Change parameter name of drm_atomic_bridge_chain_post_disable() drm/atomic-helper: Change parameter name of drm_atomic_helper_update_legacy_modeset_state() drm/atomic-helper: Change parameter name of crtc_set_mode() drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_planes() drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_modeset_enables() drm/bridge: Change parameter name of drm_atomic_bridge_chain_pre_enable() drm/bridge: Change parameter name of drm_atomic_bridge_chain_enable() drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_writebacks() drm/atomic-helper: Change parameter name of drm_atomic_helper_fake_vblank() drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_hw_done() drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_vblanks() drm/atomic-helper: Change parameter name of drm_atomic_helper_cleanup_planes() drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_cleanup_done() drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_flip_done() drm/bridge: Add encoder parameter to drm_bridge_funcs.attach
drm/bridge: Provide a helper to retrieve current bridge state
drm/bridge: Introduce drm_bridge_is_atomic() helper
drm/bridge: Assume that a bridge is atomic if it has atomic_reset drm/bridge: Provide pointers to the connector and crtc in bridge state drm/bridge: Make encoder pointer deprecated
drm/bridge: cdns-csi: Switch to atomic helpers
drm/bridge: tc358775: Switch to atomic commit
drm/bridge: tc358768: Stop disabling when failing to enable
drm/bridge: tc358768: Convert to atomic helpers
drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 +- drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 3 +- drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 3 +- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 26 +-- drivers/gpu/drm/bridge/analogix/anx7625.c | 11 +- drivers/gpu/drm/bridge/aux-bridge.c | 3 +- drivers/gpu/drm/bridge/aux-hpd-bridge.c | 1 + drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 32 ++- .../gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 6 +- drivers/gpu/drm/bridge/chipone-icn6211.c | 13 +- drivers/gpu/drm/bridge/chrontel-ch7033.c | 5 +- drivers/gpu/drm/bridge/display-connector.c | 1 + drivers/gpu/drm/bridge/fsl-ldb.c | 8 +- drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 7 +- drivers/gpu/drm/bridge/imx/imx-ldb-helper.h | 2 +- drivers/gpu/drm/bridge/imx/imx-legacy-bridge.c | 3 +- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 10 +- drivers/gpu/drm/bridge/imx/imx8qm-ldb.c | 10 +- drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 21 +- .../gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 8 +- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 13 +- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 11 +- drivers/gpu/drm/bridge/ite-it6263.c | 18 +- drivers/gpu/drm/bridge/ite-it6505.c | 10 +- drivers/gpu/drm/bridge/ite-it66121.c | 8 +- drivers/gpu/drm/bridge/lontium-lt8912b.c | 3 +- drivers/gpu/drm/bridge/lontium-lt9211.c | 8 +- drivers/gpu/drm/bridge/lontium-lt9611.c | 21 +- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 3 +- drivers/gpu/drm/bridge/lvds-codec.c | 3 +- .../drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 1 + drivers/gpu/drm/bridge/microchip-lvds.c | 3 +- drivers/gpu/drm/bridge/nwl-dsi.c | 13 +- drivers/gpu/drm/bridge/nxp-ptn3460.c | 5 +- drivers/gpu/drm/bridge/panel.c | 15 +- drivers/gpu/drm/bridge/parade-ps8622.c | 1 + drivers/gpu/drm/bridge/parade-ps8640.c | 7 +- drivers/gpu/drm/bridge/samsung-dsim.c | 11 +- drivers/gpu/drm/bridge/sii902x.c | 9 +- drivers/gpu/drm/bridge/sil-sii8620.c | 1 + drivers/gpu/drm/bridge/simple-bridge.c | 5 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 5 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 8 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 11 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 11 +- drivers/gpu/drm/bridge/tc358762.c | 12 +- drivers/gpu/drm/bridge/tc358764.c | 3 +- drivers/gpu/drm/bridge/tc358767.c | 22 +- drivers/gpu/drm/bridge/tc358768.c | 39 ++-- drivers/gpu/drm/bridge/tc358775.c | 44 ++-- drivers/gpu/drm/bridge/thc63lvd1024.c | 3 +- drivers/gpu/drm/bridge/ti-dlpc3433.c | 10 +- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 10 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 69 ++++-- drivers/gpu/drm/bridge/ti-tdp158.c | 12 +- drivers/gpu/drm/bridge/ti-tfp410.c | 5 +- drivers/gpu/drm/bridge/ti-tpd12s015.c | 3 +- drivers/gpu/drm/drm_atomic_helper.c | 242 ++++++++++----------- drivers/gpu/drm/drm_atomic_state_helper.c | 5 + drivers/gpu/drm/drm_bridge.c | 107 ++++----- drivers/gpu/drm/i2c/tda998x_drv.c | 1 + drivers/gpu/drm/imx/ipuv3/parallel-display.c | 3 +- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 9 +- drivers/gpu/drm/mcde/mcde_dsi.c | 3 +- drivers/gpu/drm/mediatek/mtk_dp.c | 9 +- drivers/gpu/drm/mediatek/mtk_dpi.c | 3 +- drivers/gpu/drm/mediatek/mtk_dsi.c | 11 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 12 +- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 8 +- drivers/gpu/drm/meson/meson_encoder_dsi.c | 8 +- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 8 +- drivers/gpu/drm/msm/dp/dp_display.c | 28 +-- drivers/gpu/drm/msm/dp/dp_drm.c | 19 +- drivers/gpu/drm/msm/dp/dp_drm.h | 6 +- drivers/gpu/drm/msm/dsi/dsi_manager.c | 3 +- drivers/gpu/drm/omapdrm/dss/dpi.c | 3 +- drivers/gpu/drm/omapdrm/dss/dsi.c | 3 +- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 8 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 8 +- drivers/gpu/drm/omapdrm/dss/sdi.c | 3 +- drivers/gpu/drm/omapdrm/dss/venc.c | 3 +- drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 8 +- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 7 +- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 8 +- drivers/gpu/drm/stm/lvds.c | 16 +- drivers/gpu/drm/tidss/tidss_encoder.c | 3 +- drivers/gpu/drm/vc4/vc4_dsi.c | 12 +- drivers/gpu/drm/xlnx/zynqmp_dp.c | 17 +- drivers/platform/arm64/acer-aspire1-ec.c | 3 +- include/drm/drm_atomic.h | 45 ++++ include/drm/drm_bridge.h | 39 +++- 91 files changed, 697 insertions(+), 590 deletions(-)
---
base-commit: 50625eab3972e5d37dcf3a250d9e3cdecbd6c13b
change-id: 20250115-bridge-connector-f93194e267ff
Best regards,
Signature · 1 line
Maxime Ripard <[email protected]>
Maxime Ripard
maintainerPATCH v3 1/37 drm/atomic: Document history of drm_atomic_state
After some discussions on the mailing-list for an earlier revision of the series, it was suggested to document the evolution of drm_atomic_state and its use by drivers to explain some of the confusion one might still encounter when reading the framework code.
--- include/drm/drm_atomic.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
include/drm/drm_atomic.h +31 -0
@@ -355,10 +355,41 @@ struct __drm_private_objs_state {* these. * * States are added to an atomic update by calling drm_atomic_get_crtc_state(), * drm_atomic_get_plane_state(), drm_atomic_get_connector_state(), or for * private state structures, drm_atomic_get_private_obj_state(). +* +* NOTE: struct drm_atomic_state first started as a single collection of +* entities state pointers (drm_plane_state, drm_crtc_state, etc.). +* +* At atomic_check time, you could get the state about to be committed +* from drm_atomic_state, and the one currently running from the +* entities state pointer (drm_crtc.state, for example). After the call +* to drm_atomic_helper_swap_state(), the entities state pointer would +* contain the state previously checked, and the drm_atomic_state +* structure the old state. +* +* Over time, and in order to avoid confusion, drm_atomic_state has +* grown to have both the old state (ie, the state we replace) and the +* new state (ie, the state we want to apply). Those names are stable +* during the commit process, which makes it easier to reason about. +* +* You can still find some traces of that evolution through some hooks +* or callbacks taking a drm_atomic_state parameter called names like +* "old_state". This doesn't necessarily mean that the previous +* drm_atomic_state is passed, but rather that this used to be the state +* collection we were replacing after drm_atomic_helper_swap_state(), +* but the variable name was never updated. +* +* Some atomic operations implementations followed a similar process. We +* first started to pass the entity state only. However, it was pretty +* cumbersome for drivers, and especially CRTCs, to retrieve the states +* of other components. Thus, we switched to passing the whole +* drm_atomic_state as a parameter to those operations. Similarly, the +* transition isn't complete yet, and one might still find atomic +* operations taking a drm_atomic_state pointer, or a component state +* pointer. The former is the preferred form. */ struct drm_atomic_state {/** * @ref: *
Signature · 1 line
2.48.0
Re: [PATCH v3 01/37] drm/atomic: Document history of drm_atomic_state
Quoted 8 lines · Maxime Ripard
After some discussions on the mailing-list for an earlier revision of the series, it was suggested to document the evolution of
drm_atomic_stateand its use by drivers to explain some of the confusion one might still encounter when reading the framework code.Suggested-by Simona Vetter <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
Thanks for documenting that little bit of lore!
Cheers, Sima
Quoted 54 lines
--- include/drm/drm_atomic.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)include/drm/drm_atomic.h +31
-0@@ -355,10 +355,41 @@ struct __drm_private_objs_state {* these. * * States are added to an atomic update by calling drm_atomic_get_crtc_state(), * drm_atomic_get_plane_state(), drm_atomic_get_connector_state(), or for * private state structures, drm_atomic_get_private_obj_state(). +* +* NOTE: struct drm_atomic_state first started as a single collection of +* entities state pointers (drm_plane_state, drm_crtc_state, etc.). +* +* At atomic_check time, you could get the state about to be committed +* from drm_atomic_state, and the one currently running from the +* entities state pointer (drm_crtc.state, for example). After the call +* to drm_atomic_helper_swap_state(), the entities state pointer would +* contain the state previously checked, and the drm_atomic_state +* structure the old state. +* +* Over time, and in order to avoid confusion, drm_atomic_state has +* grown to have both the old state (ie, the state we replace) and the +* new state (ie, the state we want to apply). Those names are stable +* during the commit process, which makes it easier to reason about. +* +* You can still find some traces of that evolution through some hooks +* or callbacks taking a drm_atomic_state parameter called names like +* "old_state". This doesn't necessarily mean that the previous +* drm_atomic_state is passed, but rather that this used to be the state +* collection we were replacing after drm_atomic_helper_swap_state(), +* but the variable name was never updated. +* +* Some atomic operations implementations followed a similar process. We +* first started to pass the entity state only. However, it was pretty +* cumbersome for drivers, and especially CRTCs, to retrieve the states +* of other components. Thus, we switched to passing the whole +* drm_atomic_state as a parameter to those operations. Similarly, the +* transition isn't complete yet, and one might still find atomic +* operations taking a drm_atomic_state pointer, or a component state +* pointer. The former is the preferred form. */ struct drm_atomic_state {/** * @ref: * Signature · 2 lines
-- 2.48.0
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Maxime Ripard
maintainerPATCH v3 2/37 drm/bridge: Pass full state to atomic_pre_enable
In reply to Maxime RipardIt's pretty inconvenient to access the full atomic state from drm_bridges, so let's change the atomic_pre_enable hook prototype to pass it directly.
--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 6 ++---- drivers/gpu/drm/bridge/chipone-icn6211.c | 2 +- drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 7 +++---- drivers/gpu/drm/bridge/ite-it6505.c | 2 +- drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +- drivers/gpu/drm/bridge/panel.c | 3 +-- drivers/gpu/drm/bridge/parade-ps8640.c | 2 +- drivers/gpu/drm/bridge/samsung-dsim.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 2 +- drivers/gpu/drm/bridge/tc358762.c | 3 ++- drivers/gpu/drm/bridge/ti-dlpc3433.c | 2 +- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 3 +-- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 +- drivers/gpu/drm/drm_bridge.c | 15 +++------------ drivers/gpu/drm/mediatek/mtk_dsi.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +- drivers/gpu/drm/vc4/vc4_dsi.c | 3 +-- include/drm/drm_bridge.h | 2 +- 19 files changed, 25 insertions(+), 39 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 -4
@@ -1195,15 +1195,13 @@ struct drm_crtc *analogix_dp_get_new_crtc(struct analogix_dp_device *dp,return NULL ;return conn_state->crtc; } -static void -analogix_dp_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void analogix_dp_bridge_atomic_pre_enable (struct drm_bridge *bridge, +struct drm_atomic_state *old_state) { -struct drm_atomic_state *old_state = old_bridge_state->base.state;struct analogix_dp_device *dp = bridge->driver_private;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;int ret;
drivers/gpu/drm/bridge/chipone-icn6211.c +1 -1
@@ -443,11 +443,11 @@ static void chipone_atomic_enable(struct drm_bridge *bridge,usleep_range (10000 ,11000 ); }static void chipone_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct chipone *icn =bridge_to_chipone (bridge);int ret;if (icn->vdd1) {
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c +3 -4
@@ -201,13 +201,12 @@ imx8qxp_ldb_bridge_mode_set(struct drm_bridge *bridge,if (is_split && companion) companion->funcs->mode_set (companion, mode, adjusted_mode); } -static void -imx8qxp_ldb_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qxp_ldb_bridge_atomic_pre_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct ldb_channel *ldb_ch = bridge->driver_private;struct ldb *ldb = ldb_ch->ldb;struct imx8qxp_ldb *imx8qxp_ldb =base_to_imx8qxp_ldb (ldb);struct drm_bridge *companion = imx8qxp_ldb->companion;
@@ -215,11 +214,11 @@ imx8qxp_ldb_bridge_atomic_pre_enable(struct drm_bridge *bridge,clk_prepare_enable (imx8qxp_ldb->clk_pixel);clk_prepare_enable (imx8qxp_ldb->clk_bypass);if (is_split && companion) - companion->funcs->atomic_pre_enable (companion, old_bridge_state); + companion->funcs->atomic_pre_enable (companion, state); }static void imx8qxp_ldb_bridge_atomic_enable (struct drm_bridge *bridge,struct drm_bridge_state *old_bridge_state)
drivers/gpu/drm/bridge/ite-it6505.c +1 -1
@@ -3252,11 +3252,11 @@ static void it6505_bridge_atomic_disable(struct drm_bridge *bridge,it6505_video_disable (it6505); } }static void it6505_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct it6505 *it6505 =bridge_to_it6505 (bridge);struct device *dev = it6505->dev;DRM_DEV_DEBUG_DRIVER (dev,"start" );
drivers/gpu/drm/bridge/lontium-lt9611.c +1 -1
@@ -765,11 +765,11 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge,return MODE_OK ; }static void lt9611_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct lt9611 *lt9611 =bridge_to_lt9611 (bridge);static const struct reg_sequence reg_cfg[] = { {0x8102 ,0x12 }, {0x8123 ,0x40 },
drivers/gpu/drm/bridge/panel.c +1 -2
@@ -107,14 +107,13 @@ static void panel_bridge_detach(struct drm_bridge *bridge)if (connector->dev)drm_connector_cleanup (connector); }static void panel_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *atomic_state) {struct panel_bridge *panel_bridge =drm_bridge_to_panel_bridge (bridge); -struct drm_atomic_state *atomic_state = old_bridge_state->base.state;struct drm_encoder *encoder = bridge->encoder;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state; crtc =drm_atomic_get_new_crtc_for_encoder (atomic_state, encoder);
drivers/gpu/drm/bridge/parade-ps8640.c +1 -1
@@ -435,11 +435,11 @@ static const struct dev_pm_ops ps8640_pm_ops = {SET_SYSTEM_SLEEP_PM_OPS (pm_runtime_force_suspend, pm_runtime_force_resume) };static void ps8640_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ps8640 *ps_bridge =bridge_to_ps8640 (bridge);struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL ];struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL ]->dev;int ret;
drivers/gpu/drm/bridge/samsung-dsim.c +1 -1
@@ -1455,11 +1455,11 @@ static int samsung_dsim_init(struct samsung_dsim *dsi)return 0 ; }static void samsung_dsim_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct samsung_dsim *dsi =bridge_to_dsi (bridge);int ret;if (dsi->state &DSIM_STATE_ENABLED )
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -1
@@ -1020,11 +1020,11 @@ static void dw_mipi_dsi_mode_set(struct dw_mipi_dsi *dsi,if (phy_ops->power_on) phy_ops->power_on (dsi->plat_data->priv_data); }static void dw_mipi_dsi_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge);/* Power up the dsi ctl into a command mode */ dw_mipi_dsi_mode_set (dsi, &dsi->mode);
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c +1 -1
@@ -819,11 +819,11 @@ static void dw_mipi_dsi2_mode_set(struct dw_mipi_dsi2 *dsi2,dw_mipi_dsi2_ipi_set (dsi2); }static void dw_mipi_dsi2_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dw_mipi_dsi2 *dsi2 =bridge_to_dsi2 (bridge);/* Power up the dsi ctl into a command mode */ dw_mipi_dsi2_mode_set (dsi2, &dsi2->mode);
drivers/gpu/drm/bridge/tc358762.c +2 -1
@@ -169,11 +169,12 @@ static void tc358762_post_disable(struct drm_bridge *bridge, struct drm_bridge_s ret =regulator_disable (ctx->regulator);if (ret <0 )dev_err (ctx->dev,"error disabling regulators (%d)\n" , ret); } -static void tc358762_pre_enable (struct drm_bridge *bridge,struct drm_bridge_state *state) +static void tc358762_pre_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc358762 *ctx =bridge_to_tc358762 (bridge);int ret; ret =regulator_enable (ctx->regulator);
drivers/gpu/drm/bridge/ti-dlpc3433.c +1 -1
@@ -168,11 +168,11 @@ static void dlpc_atomic_enable(struct drm_bridge *bridge,msleep (10 ); }static void dlpc_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dlpc *dlpc =bridge_to_dlpc (bridge);int ret;gpiod_set_value (dlpc->enable_gpio,1 );
drivers/gpu/drm/bridge/ti-sn65dsi83.c +1 -2
@@ -361,14 +361,13 @@ static u8 sn65dsi83_get_dsi_div(struct sn65dsi83 *ctx)return dsi_div -1 ; }static void sn65dsi83_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct sn65dsi83 *ctx =bridge_to_sn65dsi83 (bridge); -struct drm_atomic_state *state = old_bridge_state->base.state;const struct drm_bridge_state *bridge_state;const struct drm_crtc_state *crtc_state;const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc;
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -1
@@ -1162,11 +1162,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge,regmap_update_bits (pdata->regmap,SN_ENH_FRAME_REG ,VSTREAM_ENABLE ,VSTREAM_ENABLE ); }static void ti_sn_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);pm_runtime_get_sync (pdata->dev);
drivers/gpu/drm/drm_bridge.c +3 -12
@@ -696,23 +696,14 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,EXPORT_SYMBOL (drm_atomic_bridge_chain_post_disable);static void drm_atomic_bridge_call_pre_enable (struct drm_bridge *bridge,struct drm_atomic_state *old_state) { -if (old_state && bridge->funcs->atomic_pre_enable) { -struct drm_bridge_state *old_bridge_state; - - old_bridge_state = -drm_atomic_get_old_bridge_state (old_state, - bridge); -if (WARN_ON (!old_bridge_state)) -return ; - - bridge->funcs->atomic_pre_enable (bridge, old_bridge_state); - }else if (bridge->funcs->pre_enable) { +if (old_state && bridge->funcs->atomic_pre_enable) + bridge->funcs->atomic_pre_enable (bridge, old_state); +else if (bridge->funcs->pre_enable) bridge->funcs->pre_enable (bridge); - } }/** * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in * the encoder chain
drivers/gpu/drm/mediatek/mtk_dsi.c +1 -1
@@ -843,11 +843,11 @@ static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge,mtk_output_dsi_enable (dsi); }static void mtk_dsi_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct mtk_dsi *dsi =bridge_to_dsi (bridge);int ret; ret =mtk_dsi_poweron (dsi);
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -1
@@ -1360,11 +1360,11 @@ static void mtk_hdmi_bridge_mode_set(struct drm_bridge *bridge,drm_mode_copy (&hdmi->mode, adjusted_mode); }static void mtk_hdmi_bridge_atomic_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct mtk_hdmi *hdmi =hdmi_ctx_from_bridge (bridge);mtk_hdmi_hw_make_reg_writable (hdmi, true);mtk_hdmi_hw_1p4_version_enable (hdmi, true);
drivers/gpu/drm/vc4/vc4_dsi.c +1 -2
@@ -871,13 +871,12 @@ static bool vc4_dsi_bridge_mode_fixup(struct drm_bridge *bridge,return true; }static void vc4_dsi_bridge_pre_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) { -struct drm_atomic_state *state = old_state->base.state;struct vc4_dsi *dsi =bridge_to_vc4_dsi (bridge);const struct drm_crtc_state *crtc_state;struct device *dev = &dsi->pdev->dev;const struct drm_display_mode *mode;struct drm_connector *connector;
include/drm/drm_bridge.h +1 -1
@@ -303,11 +303,11 @@ struct drm_bridge_funcs {* there is one) when this callback is called. * * The @atomic_pre_enable callback is optional. */ void (*atomic_pre_enable)(struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state); +struct drm_atomic_state *state);/** * @atomic_enable: * * This callback should enable the bridge. It is called right after
Signature · 1 line
2.48.0
Re: [PATCH v3 02/37] drm/bridge: Pass full state to atomic_pre_enable
Hi,
Quoted 7 lines · Maxime Ripard
It's pretty inconvenient to access the full atomic state from
drm_bridges, so let's change theatomic_pre_enablehook prototype to pass it directly.Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
From the point of view of ti-sn65dsi86 and parade-ps8640:
Maxime Ripard
maintainerPATCH v3 3/37 drm/bridge: Pass full state to atomic_enable
In reply to Maxime RipardIt's pretty inconvenient to access the full atomic state from drm_bridges, so let's change the atomic_enable hook prototype to pass it directly.
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 2 +- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 6 ++---- drivers/gpu/drm/bridge/analogix/anx7625.c | 6 +++--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 3 +-- drivers/gpu/drm/bridge/chipone-icn6211.c | 3 +-- drivers/gpu/drm/bridge/fsl-ldb.c | 3 +-- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 5 +++-- drivers/gpu/drm/bridge/imx/imx8qm-ldb.c | 5 ++--- drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 7 +++---- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 5 ++--- drivers/gpu/drm/bridge/ite-it6263.c | 6 ++---- drivers/gpu/drm/bridge/ite-it6505.c | 3 +-- drivers/gpu/drm/bridge/ite-it66121.c | 3 +-- drivers/gpu/drm/bridge/lontium-lt9211.c | 3 +-- drivers/gpu/drm/bridge/lontium-lt9611.c | 6 ++---- drivers/gpu/drm/bridge/nwl-dsi.c | 5 ++--- drivers/gpu/drm/bridge/panel.c | 3 +-- drivers/gpu/drm/bridge/samsung-dsim.c | 2 +- drivers/gpu/drm/bridge/sii902x.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 3 +-- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 +-- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 2 +- drivers/gpu/drm/bridge/tc358762.c | 3 ++- drivers/gpu/drm/bridge/tc358767.c | 10 ++++------ drivers/gpu/drm/bridge/ti-dlpc3433.c | 2 +- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 4 ++-- drivers/gpu/drm/bridge/ti-tdp158.c | 3 ++- drivers/gpu/drm/drm_bridge.c | 10 +--------- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +- drivers/gpu/drm/mediatek/mtk_dp.c | 4 ++-- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 3 +-- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 3 +-- drivers/gpu/drm/meson/meson_encoder_dsi.c | 3 +-- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 3 +-- drivers/gpu/drm/msm/dp/dp_display.c | 12 ++++++------ drivers/gpu/drm/msm/dp/dp_drm.c | 9 ++++----- drivers/gpu/drm/msm/dp/dp_drm.h | 2 +- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 3 +-- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 3 +-- drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 3 +-- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 2 +- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 3 +-- drivers/gpu/drm/stm/lvds.c | 3 +-- drivers/gpu/drm/vc4/vc4_dsi.c | 2 +- drivers/gpu/drm/xlnx/zynqmp_dp.c | 10 ++++------ include/drm/drm_bridge.h | 2 +- 49 files changed, 79 insertions(+), 117 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -1
@@ -909,11 +909,11 @@ static struct adv7511 *bridge_to_adv7511(struct drm_bridge *bridge) { return container_of(bridge, struct adv7511, bridge); }static void adv7511_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct adv7511 *adv =bridge_to_adv7511 (bridge);adv7511_power_on (adv); }
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 -4
@@ -1253,15 +1253,13 @@ static int analogix_dp_set_bridge(struct analogix_dp_device *dp)pm_runtime_put_sync (dp->dev);return ret; } -static void -analogix_dp_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void analogix_dp_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *old_state) { -struct drm_atomic_state *old_state = old_bridge_state->base.state;struct analogix_dp_device *dp = bridge->driver_private;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;int timeout_loop =0 ;int ret;
drivers/gpu/drm/bridge/analogix/anx7625.c +3 -3
@@ -2378,20 +2378,20 @@ static int anx7625_bridge_atomic_check(struct drm_bridge *bridge,return 0 ; }static void anx7625_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *state) +struct drm_atomic_state *state) {struct anx7625_data *ctx =bridge_to_anx7625 (bridge);struct device *dev = ctx->dev;struct drm_connector *connector;struct drm_connector_state *conn_state;dev_dbg (dev,"drm atomic enable\n" ); - connector =drm_atomic_get_new_connector_for_encoder (state->base.state, + connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);if (!connector)return ; ctx->connector = connector;
@@ -2399,11 +2399,11 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge,pm_runtime_get_sync (dev);_anx7625_hpd_polling (ctx,5000 *100 );anx7625_dp_start (ctx); - conn_state =drm_atomic_get_new_connector_state (state->base.state, connector); + conn_state =drm_atomic_get_new_connector_state (state, connector);if (WARN_ON (!conn_state))return ;if (conn_state->content_protection ==DRM_MODE_CONTENT_PROTECTION_DESIRED ) {
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1 -2
@@ -1977,14 +1977,13 @@ static void cdns_mhdp_sst_enable(struct cdns_mhdp_device *mhdp,cdns_mhdp_configure_video (mhdp, mode); }static void cdns_mhdp_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct cdns_mhdp_device *mhdp =bridge_to_mhdp (bridge); -struct drm_atomic_state *state = bridge_state->base.state;struct cdns_mhdp_bridge_state *mhdp_state;struct drm_crtc_state *crtc_state;struct drm_connector *connector;struct drm_connector_state *conn_state;struct drm_bridge_state *new_state;
drivers/gpu/drm/bridge/chipone-icn6211.c +1 -2
@@ -339,14 +339,13 @@ static void chipone_configure_pll(struct chipone *icn,chipone_writeb (icn,PLL_REF_DIV , ref_div);chipone_writeb (icn,PLL_INT (0 ), best_m); }static void chipone_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct chipone *icn =bridge_to_chipone (bridge); -struct drm_atomic_state *state = old_bridge_state->base.state;struct drm_display_mode *mode = &icn->mode;const struct drm_bridge_state *bridge_state;u16 hfp, hbp, hsync;u32 bus_flags;u8 pol, sys_ctrl_1, id[4 ];
drivers/gpu/drm/bridge/fsl-ldb.c +1 -2
@@ -120,14 +120,13 @@ static int fsl_ldb_attach(struct drm_bridge *bridge,return drm_bridge_attach (bridge->encoder, fsl_ldb->panel_bridge, bridge, flags); }static void fsl_ldb_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct fsl_ldb *fsl_ldb =to_fsl_ldb (bridge); -struct drm_atomic_state *state = old_bridge_state->base.state;const struct drm_bridge_state *bridge_state;const struct drm_crtc_state *crtc_state;const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc;
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c +3 -2
@@ -47,20 +47,21 @@ static int imx8mp_hdmi_pvi_bridge_attach(struct drm_bridge *bridge,return drm_bridge_attach (bridge->encoder, pvi->next_bridge, bridge, flags); }static void imx8mp_hdmi_pvi_bridge_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) { -struct drm_atomic_state *state = bridge_state->base.state;struct imx8mp_hdmi_pvi *pvi =to_imx8mp_hdmi_pvi (bridge);struct drm_connector_state *conn_state; +struct drm_bridge_state *bridge_state;const struct drm_display_mode *mode;struct drm_crtc_state *crtc_state;struct drm_connector *connector;u32 bus_flags =0 , val; + bridge_state =drm_atomic_get_new_bridge_state (state, bridge); connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder); conn_state =drm_atomic_get_new_connector_state (state, connector); crtc_state =drm_atomic_get_new_crtc_state (state, conn_state->crtc);if (WARN_ON (pm_runtime_resume_and_get (pvi->dev)))
drivers/gpu/drm/bridge/imx/imx8qm-ldb.c +2 -3
@@ -198,13 +198,12 @@ imx8qm_ldb_bridge_mode_set(struct drm_bridge *bridge,else if (adjusted_mode->flags &DRM_MODE_FLAG_PHSYNC )regmap_update_bits (ldb->regmap,SS_CTRL ,CH_HSYNC_M (chno),CH_PHSYNC (chno)); } -static void -imx8qm_ldb_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qm_ldb_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct ldb_channel *ldb_ch = bridge->driver_private;struct ldb *ldb = ldb_ch->ldb;struct imx8qm_ldb_channel *imx8qm_ldb_ch =base_to_imx8qm_ldb_channel (ldb_ch);
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c +3 -4
@@ -217,13 +217,12 @@ static void imx8qxp_ldb_bridge_atomic_pre_enable(struct drm_bridge *bridge,if (is_split && companion) companion->funcs->atomic_pre_enable (companion, state); } -static void -imx8qxp_ldb_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qxp_ldb_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct ldb_channel *ldb_ch = bridge->driver_private;struct ldb *ldb = ldb_ch->ldb;struct imx8qxp_ldb_channel *imx8qxp_ldb_ch =base_to_imx8qxp_ldb_channel (ldb_ch);
@@ -249,11 +248,11 @@ imx8qxp_ldb_bridge_atomic_enable(struct drm_bridge *bridge, ret =phy_power_on (imx8qxp_ldb_ch->phy);if (ret)DRM_DEV_ERROR (dev,"failed to power on PHY: %d\n" , ret);if (is_split && companion) - companion->funcs->atomic_enable (companion, old_bridge_state); + companion->funcs->atomic_enable (companion, state); }static void imx8qxp_ldb_bridge_atomic_disable (struct drm_bridge *bridge,struct drm_bridge_state *old_bridge_state)
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +2 -3
@@ -151,13 +151,12 @@ imx8qxp_pixel_link_bridge_mode_set(struct drm_bridge *bridge,struct imx8qxp_pixel_link *pl = bridge->driver_private;imx8qxp_pixel_link_set_mst_addr (pl); } -static void -imx8qxp_pixel_link_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qxp_pixel_link_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct imx8qxp_pixel_link *pl = bridge->driver_private;imx8qxp_pixel_link_enable_mst_en (pl);imx8qxp_pixel_link_enable_mst_vld (pl);
drivers/gpu/drm/bridge/ite-it6263.c +2 -4
@@ -579,15 +579,13 @@ it6263_bridge_atomic_disable(struct drm_bridge *bridge,regmap_write (it->hdmi_regmap,HDMI_REG_PKT_GENERAL_CTRL ,0 );regmap_write (it->hdmi_regmap,HDMI_REG_AFE_DRV_CTRL ,AFE_DRV_RST |AFE_DRV_PWD ); } -static void -it6263_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void it6263_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) { -struct drm_atomic_state *state = old_bridge_state->base.state;struct it6263 *it =bridge_to_it6263 (bridge);const struct drm_crtc_state *crtc_state;struct regmap *regmap = it->hdmi_regmap;const struct drm_display_mode *mode;struct drm_connector *connector;
drivers/gpu/drm/bridge/ite-it6505.c +1 -2
@@ -3181,15 +3181,14 @@ it6505_bridge_mode_valid(struct drm_bridge *bridge,return MODE_OK ; }static void it6505_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct it6505 *it6505 =bridge_to_it6505 (bridge);struct device *dev = it6505->dev; -struct drm_atomic_state *state = old_state->base.state;struct hdmi_avi_infoframe frame;struct drm_crtc_state *crtc_state;struct drm_connector_state *conn_state;struct drm_display_mode *mode;struct drm_connector *connector;
drivers/gpu/drm/bridge/ite-it66121.c +1 -2
@@ -719,14 +719,13 @@ static u32 *it66121_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,return input_fmts; }static void it66121_bridge_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) { struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge); -struct drm_atomic_state *state = bridge_state->base.state; ctx->connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);it66121_set_mute (ctx, false); }
drivers/gpu/drm/bridge/lontium-lt9211.c +1 -2
@@ -453,14 +453,13 @@ static int lt9211_configure_tx(struct lt9211 *ctx, bool jeida,return 0 ; }static void lt9211_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct lt9211 *ctx =bridge_to_lt9211 (bridge); -struct drm_atomic_state *state = old_bridge_state->base.state;const struct drm_bridge_state *bridge_state;const struct drm_crtc_state *crtc_state;const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc;
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -4
@@ -638,16 +638,14 @@ lt9611_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len)return 0 ; }/* bridge funcs */ -static void -lt9611_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void lt9611_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct lt9611 *lt9611 =bridge_to_lt9611 (bridge); -struct drm_atomic_state *state = old_bridge_state->base.state;struct drm_connector *connector;struct drm_connector_state *conn_state;struct drm_crtc_state *crtc_state;struct drm_display_mode *mode;unsigned int postdiv;
drivers/gpu/drm/bridge/nwl-dsi.c +2 -3
@@ -896,13 +896,12 @@ nwl_dsi_bridge_mode_set(struct drm_bridge *bridge, runtime_put:pm_runtime_put_sync (dev); } -static void -nwl_dsi_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void nwl_dsi_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct nwl_dsi *dsi =bridge_to_dsi (bridge);int ret;/* Step 5 from DSI reset-out instructions */
drivers/gpu/drm/bridge/panel.c +1 -2
@@ -126,14 +126,13 @@ static void panel_bridge_atomic_pre_enable(struct drm_bridge *bridge,drm_panel_prepare (panel_bridge->panel); }static void panel_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *atomic_state) {struct panel_bridge *panel_bridge =drm_bridge_to_panel_bridge (bridge); -struct drm_atomic_state *atomic_state = old_bridge_state->base.state;struct drm_encoder *encoder = bridge->encoder;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state; crtc =drm_atomic_get_new_crtc_for_encoder (atomic_state, encoder);
drivers/gpu/drm/bridge/samsung-dsim.c +1 -1
@@ -1483,11 +1483,11 @@ static void samsung_dsim_atomic_pre_enable(struct drm_bridge *bridge,return ; } }static void samsung_dsim_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct samsung_dsim *dsi =bridge_to_dsi (bridge);samsung_dsim_set_display_mode (dsi);samsung_dsim_set_display_enable (dsi, true);
drivers/gpu/drm/bridge/sii902x.c +1 -1
@@ -337,11 +337,11 @@ static void sii902x_bridge_atomic_disable(struct drm_bridge *bridge,mutex_unlock (&sii902x->mutex); }static void sii902x_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct sii902x *sii902x =bridge_to_sii902x (bridge);mutex_lock (&sii902x->mutex);
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +1 -2
@@ -360,14 +360,13 @@ static int dw_hdmi_qp_config_drm_infoframe(struct dw_hdmi_qp *hdmi,return 0 ; }static void dw_hdmi_qp_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct dw_hdmi_qp *hdmi = bridge->driver_private; -struct drm_atomic_state *state = old_state->base.state;struct drm_connector_state *conn_state;struct drm_connector *connector;unsigned int op_mode; connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -2
@@ -2957,14 +2957,13 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge,handle_plugged_change (hdmi, false);mutex_unlock (&hdmi->mutex); }static void dw_hdmi_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct dw_hdmi *hdmi = bridge->driver_private; -struct drm_atomic_state *state = old_state->base.state;struct drm_connector *connector; connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -1
@@ -1041,11 +1041,11 @@ static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge,/* Store the display mode for later use in pre_enable callback */ drm_mode_copy (&dsi->mode, adjusted_mode); }static void dw_mipi_dsi_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge);/* Switch to video mode for panel-bridge enable & panel enable */ dw_mipi_dsi_set_mode (dsi,MIPI_DSI_MODE_VIDEO );
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c +1 -1
@@ -838,11 +838,11 @@ static void dw_mipi_dsi2_bridge_mode_set(struct drm_bridge *bridge,/* Store the display mode for later use in pre_enable callback */ drm_mode_copy (&dsi2->mode, adjusted_mode); }static void dw_mipi_dsi2_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dw_mipi_dsi2 *dsi2 =bridge_to_dsi2 (bridge);/* Switch to video mode for panel-bridge enable & panel enable */ if (dsi2->mode_flags &MIPI_DSI_MODE_VIDEO )
drivers/gpu/drm/bridge/tc358762.c +2 -1
@@ -187,11 +187,12 @@ static void tc358762_pre_enable(struct drm_bridge *bridge, } ctx->pre_enabled = true; } -static void tc358762_enable (struct drm_bridge *bridge,struct drm_bridge_state *state) +static void tc358762_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc358762 *ctx =bridge_to_tc358762 (bridge);int ret; ret =tc358762_init (ctx);
drivers/gpu/drm/bridge/tc358767.c +4 -6
@@ -1546,13 +1546,12 @@ static int tc_edp_stream_disable(struct tc_data *tc)tc_pxl_pll_dis (tc);return 0 ; } -static void -tc_dpi_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void tc_dpi_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc_data *tc =bridge_to_tc (bridge);int ret;
@@ -1574,13 +1573,12 @@ tc_dpi_bridge_atomic_disable(struct drm_bridge *bridge, ret =tc_dpi_stream_disable (tc);if (ret <0 )dev_err (tc->dev,"main link stream stop error: %d\n" , ret); } -static void -tc_edp_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void tc_edp_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc_data *tc =bridge_to_tc (bridge);int ret; ret =tc_get_display_props (tc);
drivers/gpu/drm/bridge/ti-dlpc3433.c +1 -1
@@ -103,11 +103,11 @@ static const struct regmap_config dlpc_regmap_config = { .cache_type = REGCACHE_MAPLE, .name = "dlpc3433", };static void dlpc_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dlpc *dlpc =bridge_to_dlpc (bridge);struct device *dev = dlpc->dev;struct drm_display_mode *mode = &dlpc->mode;struct regmap *regmap = dlpc->regmap;
drivers/gpu/drm/bridge/ti-sn65dsi83.c +1 -1
@@ -531,11 +531,11 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,/* Wait for 10ms after soft reset as specified in datasheet */ usleep_range (10000 ,12000 ); }static void sn65dsi83_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct sn65dsi83 *ctx =bridge_to_sn65dsi83 (bridge);unsigned int pval;/* Clear all errors that got asserted during initialization. */
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -2
@@ -1071,11 +1071,11 @@ static int ti_sn_link_training(struct ti_sn65dsi86 *pdata, int dp_rate_idx,return ret; }static void ti_sn_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);struct drm_connector *connector;const char *last_err_str ="No supported DP rate" ;unsigned int valid_rates;
@@ -1083,11 +1083,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge,unsigned int val;int ret = -EINVAL ;int max_dp_lanes;unsigned int bpp; - connector =drm_atomic_get_new_connector_for_encoder (old_bridge_state->base.state, + connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);if (!connector) {dev_err_ratelimited (pdata->dev,"Could not get the connector\n" );return ; }
drivers/gpu/drm/bridge/ti-tdp158.c +2 -1
@@ -16,11 +16,12 @@ struct tdp158 {struct regulator *vcc;// 3.3V struct regulator *vdd;// 1.1V struct device *dev; }; -static void tdp158_enable (struct drm_bridge *bridge,struct drm_bridge_state *prev) +static void tdp158_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {int err;struct tdp158 *tdp158 = bridge->driver_private; err =regulator_enable (tdp158->vcc);
drivers/gpu/drm/drm_bridge.c +1 -9
@@ -804,19 +804,11 @@ void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge,return ; encoder = bridge->encoder;list_for_each_entry_from (bridge, &encoder->bridge_chain, chain_node) {if (bridge->funcs->atomic_enable) { -struct drm_bridge_state *old_bridge_state; - - old_bridge_state = -drm_atomic_get_old_bridge_state (old_state, - bridge); -if (WARN_ON (!old_bridge_state)) -return ; - - bridge->funcs->atomic_enable (bridge, old_bridge_state); + bridge->funcs->atomic_enable (bridge, old_state); }else if (bridge->funcs->enable) { bridge->funcs->enable (bridge); } } }
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +1 -1
@@ -227,11 +227,11 @@ static int ingenic_drm_update_pixclk(struct notifier_block *nb,return NOTIFY_OK ; } }static void ingenic_drm_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ingenic_drm *priv =drm_device_get_priv (bridge->dev);regmap_write (priv->map,JZ_REG_LCD_STATE ,0 );
drivers/gpu/drm/mediatek/mtk_dp.c +2 -2
@@ -2348,16 +2348,16 @@ static void mtk_dp_bridge_detach(struct drm_bridge *bridge)mtk_dp_poweroff (mtk_dp);drm_dp_aux_unregister (&mtk_dp->aux); }static void mtk_dp_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct mtk_dp *mtk_dp =mtk_dp_from_bridge (bridge);int ret; - mtk_dp->conn =drm_atomic_get_new_connector_for_encoder (old_state->base.state, + mtk_dp->conn =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);if (!mtk_dp->conn) {drm_err (mtk_dp->drm_dev,"Can't enable bridge as connector is missing\n" );return ;
drivers/gpu/drm/mediatek/mtk_dsi.c +1 -1
@@ -832,11 +832,11 @@ static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge,mtk_output_dsi_disable (dsi); }static void mtk_dsi_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct mtk_dsi *dsi =bridge_to_dsi (bridge);if (dsi->refcount ==0 )return ;
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -2
@@ -1381,13 +1381,12 @@ static void mtk_hdmi_send_infoframe(struct mtk_hdmi *hdmi,if (mode->flags &DRM_MODE_FLAG_3D_MASK )mtk_hdmi_setup_vendor_specific_infoframe (hdmi, mode); }static void mtk_hdmi_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) { -struct drm_atomic_state *state = old_state->base.state;struct mtk_hdmi *hdmi =hdmi_ctx_from_bridge (bridge);/* Retrieve the connector through the atomic state. */ hdmi->curr_conn =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);
drivers/gpu/drm/meson/meson_encoder_cvbs.c +1 -2
@@ -137,14 +137,13 @@ static int meson_encoder_cvbs_atomic_check(struct drm_bridge *bridge,return -EINVAL ; }static void meson_encoder_cvbs_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct meson_encoder_cvbs *encoder_cvbs =bridge_to_meson_encoder_cvbs (bridge); -struct drm_atomic_state *state = bridge_state->base.state;struct meson_drm *priv = encoder_cvbs->priv;const struct meson_cvbs_mode *meson_mode;struct drm_connector_state *conn_state;struct drm_crtc_state *crtc_state;struct drm_connector *connector;
drivers/gpu/drm/meson/meson_encoder_dsi.c +1 -2
@@ -40,14 +40,13 @@ static int meson_encoder_dsi_attach(struct drm_bridge *bridge,return drm_bridge_attach (bridge->encoder, encoder_dsi->next_bridge, &encoder_dsi->bridge, flags); }static void meson_encoder_dsi_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct meson_encoder_dsi *encoder_dsi =bridge_to_meson_encoder_dsi (bridge); -struct drm_atomic_state *state = bridge_state->base.state;struct meson_drm *priv = encoder_dsi->priv;struct drm_connector_state *conn_state;struct drm_crtc_state *crtc_state;struct drm_connector *connector;
drivers/gpu/drm/meson/meson_encoder_hdmi.c +1 -2
@@ -184,14 +184,13 @@ static enum drm_mode_status meson_encoder_hdmi_mode_valid(struct drm_bridge *brireturn meson_vclk_vic_supported_freq (priv, phy_freq, vclk_freq); }static void meson_encoder_hdmi_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct meson_encoder_hdmi *encoder_hdmi =bridge_to_meson_encoder_hdmi (bridge); -struct drm_atomic_state *state = bridge_state->base.state;unsigned int ycrcb_map =VPU_HDMI_OUTPUT_CBYCR ;struct meson_drm *priv = encoder_hdmi->priv;struct drm_connector_state *conn_state;const struct drm_display_mode *mode;struct drm_crtc_state *crtc_state;
drivers/gpu/drm/msm/dp/dp_display.c +6 -6
@@ -1489,17 +1489,17 @@ int msm_dp_modeset_init(struct msm_dp *msm_dp_display, struct drm_device *dev,return 0 ; }void msm_dp_bridge_atomic_enable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct msm_dp_bridge *msm_dp_bridge =to_dp_bridge (drm_bridge);struct msm_dp *dp = msm_dp_bridge->msm_dp_display;int rc =0 ;struct msm_dp_display_private *msm_dp_display; -u32 state; +u32 hpd_state;bool force_link_train = false; msm_dp_display = container_of(dp, struct msm_dp_display_private, msm_dp_display);if (!msm_dp_display->msm_dp_mode.drm_mode.clock) {DRM_ERROR ("invalid params\n" );
@@ -1514,12 +1514,12 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,DRM_ERROR ("failed to pm_runtime_resume\n" );mutex_unlock (&msm_dp_display->event_mutex);return ; } - state = msm_dp_display->hpd_state; -if (state !=ST_DISPLAY_OFF && state !=ST_MAINLINK_READY ) { + hpd_state = msm_dp_display->hpd_state; +if (hpd_state !=ST_DISPLAY_OFF && hpd_state !=ST_MAINLINK_READY ) {mutex_unlock (&msm_dp_display->event_mutex);return ; } rc =msm_dp_display_set_mode (dp, &msm_dp_display->msm_dp_mode);
@@ -1527,13 +1527,13 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,DRM_ERROR ("Failed to perform a mode set, rc=%d\n" , rc);mutex_unlock (&msm_dp_display->event_mutex);return ; } - state = msm_dp_display->hpd_state; + hpd_state = msm_dp_display->hpd_state; -if (state ==ST_DISPLAY_OFF ) { +if (hpd_state ==ST_DISPLAY_OFF ) {msm_dp_display_host_phy_init (msm_dp_display); force_link_train = true; }msm_dp_display_enable (msm_dp_display, force_link_train);
drivers/gpu/drm/msm/dp/dp_drm.c +4 -5
@@ -135,13 +135,12 @@ static int msm_edp_bridge_atomic_check(struct drm_bridge *drm_bridge,return 0 ; }static void msm_edp_bridge_atomic_enable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) { -struct drm_atomic_state *atomic_state = old_bridge_state->base.state;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;struct msm_dp_bridge *msm_dp_bridge =to_dp_bridge (drm_bridge);struct msm_dp *dp = msm_dp_bridge->msm_dp_display;
@@ -149,23 +148,23 @@ static void msm_edp_bridge_atomic_enable(struct drm_bridge *drm_bridge,* Check the old state of the crtc to determine if the panel * was put into psr state previously by the msm_edp_bridge_atomic_disable. * If the panel is in psr, just exit psr state and skip the full * bridge enable sequence. */ - crtc =drm_atomic_get_new_crtc_for_encoder (atomic_state, + crtc =drm_atomic_get_new_crtc_for_encoder (state, drm_bridge->encoder);if (!crtc)return ; - old_crtc_state =drm_atomic_get_old_crtc_state (atomic_state, crtc); + old_crtc_state =drm_atomic_get_old_crtc_state (state, crtc);if (old_crtc_state && old_crtc_state->self_refresh_active) {msm_dp_display_set_psr (dp, false);return ; } -msm_dp_bridge_atomic_enable (drm_bridge, old_bridge_state); +msm_dp_bridge_atomic_enable (drm_bridge, state); }static void msm_edp_bridge_atomic_disable (struct drm_bridge *drm_bridge,struct drm_bridge_state *old_bridge_state) {
drivers/gpu/drm/msm/dp/dp_drm.h +1 -1
@@ -24,11 +24,11 @@ struct drm_connector *msm_dp_drm_connector_init(struct msm_dp *msm_dp_display,int msm_dp_bridge_init (struct msm_dp *msm_dp_display,struct drm_device *dev,struct drm_encoder *encoder,bool yuv_supported);void msm_dp_bridge_atomic_enable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state); +struct drm_atomic_state *state);void msm_dp_bridge_atomic_disable (struct drm_bridge *drm_bridge,struct drm_bridge_state *old_bridge_state);void msm_dp_bridge_atomic_post_disable (struct drm_bridge *drm_bridge,struct drm_bridge_state *old_bridge_state); enum drm_mode_status msm_dp_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/omapdrm/dss/hdmi4.c +1 -2
@@ -339,14 +339,13 @@ static void hdmi4_bridge_mode_set(struct drm_bridge *bridge,mutex_unlock (&hdmi->lock); }static void hdmi4_bridge_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct omap_hdmi *hdmi =drm_bridge_to_hdmi (bridge); -struct drm_atomic_state *state = bridge_state->base.state;struct drm_connector_state *conn_state;struct drm_connector *connector;struct drm_crtc_state *crtc_state;unsigned long flags;int ret;
drivers/gpu/drm/omapdrm/dss/hdmi5.c +1 -2
@@ -337,14 +337,13 @@ static void hdmi5_bridge_mode_set(struct drm_bridge *bridge,mutex_unlock (&hdmi->lock); }static void hdmi5_bridge_enable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct omap_hdmi *hdmi =drm_bridge_to_hdmi (bridge); -struct drm_atomic_state *state = bridge_state->base.state;struct drm_connector_state *conn_state;struct drm_connector *connector;struct drm_crtc_state *crtc_state;unsigned long flags;int ret;
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c +1 -2
@@ -580,13 +580,12 @@ EXPORT_SYMBOL_GPL(rcar_lvds_pclk_disable);/* ----------------------------------------------------------------------------- * Bridge */ static void rcar_lvds_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) { -struct drm_atomic_state *state = old_bridge_state->base.state;struct drm_connector *connector;struct drm_crtc *crtc; connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c +1 -1
@@ -806,11 +806,11 @@ static int rcar_mipi_dsi_attach(struct drm_bridge *bridge,return drm_bridge_attach (bridge->encoder, dsi->next_bridge, bridge, flags); }static void rcar_mipi_dsi_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct rcar_mipi_dsi *dsi =bridge_to_rcar_mipi_dsi (bridge);rcar_mipi_dsi_start_video (dsi); }
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1 -2
@@ -530,13 +530,12 @@ static int rzg2l_mipi_dsi_attach(struct drm_bridge *bridge,return drm_bridge_attach (bridge->encoder, dsi->next_bridge, bridge, flags); }static void rzg2l_mipi_dsi_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) { -struct drm_atomic_state *state = old_bridge_state->base.state;struct rzg2l_mipi_dsi *dsi =bridge_to_rzg2l_mipi_dsi (bridge);const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc;int ret;
drivers/gpu/drm/stm/lvds.c +1 -2
@@ -978,13 +978,12 @@ static int lvds_attach(struct drm_bridge *bridge,return ret; }static void lvds_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) { -struct drm_atomic_state *state = old_bridge_state->base.state;struct stm_lvds *lvds =bridge_to_stm_lvds (bridge);struct drm_connector_state *conn_state;struct drm_connector *connector;int ret;
drivers/gpu/drm/vc4/vc4_dsi.c +1 -1
@@ -1140,11 +1140,11 @@ static void vc4_dsi_bridge_pre_enable(struct drm_bridge *bridge, DSI_DISP0_COMMAND_MODE); } }static void vc4_dsi_bridge_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct vc4_dsi *dsi =bridge_to_vc4_dsi (bridge);bool debug_dump_regs = false;u32 disp0_ctrl;
drivers/gpu/drm/xlnx/zynqmp_dp.c +4 -6
@@ -1435,22 +1435,21 @@ zynqmp_dp_disp_connected_live_layer(struct zynqmp_dp *dp)else return NULL ; }static void zynqmp_dp_disp_enable (struct zynqmp_dp *dp, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct zynqmp_disp_layer *layer;struct drm_bridge_state *bridge_state;u32 bus_fmt; layer =zynqmp_dp_disp_connected_live_layer (dp);if (!layer)return ; - bridge_state =drm_atomic_get_new_bridge_state (old_bridge_state->base.state, - old_bridge_state->bridge); + bridge_state =drm_atomic_get_new_bridge_state (state, &dp->bridge);if (WARN_ON (!bridge_state))return ; bus_fmt = bridge_state->input_bus_cfg.format;zynqmp_disp_layer_set_live_format (layer, bus_fmt);
@@ -1547,14 +1546,13 @@ zynqmp_dp_bridge_mode_valid(struct drm_bridge *bridge,return MODE_OK ; }static void zynqmp_dp_bridge_atomic_enable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct zynqmp_dp *dp =bridge_to_dp (bridge); -struct drm_atomic_state *state = old_bridge_state->base.state;const struct drm_crtc_state *crtc_state;const struct drm_display_mode *adjusted_mode;const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc;
@@ -1563,11 +1561,11 @@ static void zynqmp_dp_bridge_atomic_enable(struct drm_bridge *bridge,int ret;pm_runtime_get_sync (dp->dev);guard (mutex)(&dp->lock); -zynqmp_dp_disp_enable (dp, old_bridge_state); +zynqmp_dp_disp_enable (dp, state);/* * Retrieve the CRTC mode and adjusted mode. This requires a little * dance to go from the bridge to the encoder, to the connector and to * the CRTC.
include/drm/drm_bridge.h +1 -1
@@ -323,11 +323,11 @@ struct drm_bridge_funcs {* chain if there is one. * * The @atomic_enable callback is optional. */ void (*atomic_enable)(struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state); +struct drm_atomic_state *state);/** * @atomic_disable: * * This callback should disable the bridge. It is called right before * the preceding element in the display pipe is disabled. If the
Signature · 1 line
2.48.0
Re: [PATCH v3 03/37] drm/bridge: Pass full state to atomic_enable
Hi,
Quoted 7 lines · Maxime Ripard
It's pretty inconvenient to access the full atomic state from
drm_bridges, so let's change theatomic_enablehook prototype to pass it directly.Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
From the point of view of ti-sn65dsi86:
Maxime Ripard
maintainerPATCH v3 4/37 drm/bridge: Pass full state to atomic_disable
In reply to Maxime RipardIt's pretty inconvenient to access the full atomic state from drm_bridges, so let's change the atomic_disable hook prototype to pass it directly.
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 2 +- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 6 ++---- drivers/gpu/drm/bridge/analogix/anx7625.c | 2 +- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 2 +- drivers/gpu/drm/bridge/fsl-ldb.c | 2 +- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 2 +- drivers/gpu/drm/bridge/imx/imx8qm-ldb.c | 5 ++--- drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c | 7 +++---- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 5 ++--- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 5 ++--- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 8 +++----- drivers/gpu/drm/bridge/ite-it6263.c | 5 ++--- drivers/gpu/drm/bridge/ite-it6505.c | 2 +- drivers/gpu/drm/bridge/ite-it66121.c | 2 +- drivers/gpu/drm/bridge/lontium-lt9211.c | 2 +- drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++--- drivers/gpu/drm/bridge/nwl-dsi.c | 5 ++--- drivers/gpu/drm/bridge/panel.c | 3 +-- drivers/gpu/drm/bridge/samsung-dsim.c | 2 +- drivers/gpu/drm/bridge/sii902x.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 2 +- drivers/gpu/drm/bridge/tc358767.c | 10 ++++------ drivers/gpu/drm/bridge/ti-sn65dsi83.c | 2 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 +- drivers/gpu/drm/bridge/ti-tdp158.c | 3 ++- drivers/gpu/drm/drm_bridge.c | 10 +--------- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 2 +- drivers/gpu/drm/mediatek/mtk_dp.c | 2 +- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 2 +- drivers/gpu/drm/meson/meson_encoder_dsi.c | 2 +- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 2 +- drivers/gpu/drm/msm/dp/dp_display.c | 2 +- drivers/gpu/drm/msm/dp/dp_drm.c | 5 ++--- drivers/gpu/drm/msm/dp/dp_drm.h | 2 +- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 2 +- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 2 +- drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 2 +- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 2 +- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 2 +- drivers/gpu/drm/stm/lvds.c | 2 +- drivers/gpu/drm/vc4/vc4_dsi.c | 2 +- drivers/gpu/drm/xlnx/zynqmp_dp.c | 4 +++- include/drm/drm_bridge.h | 2 +- 46 files changed, 64 insertions(+), 84 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +1 -1
@@ -917,11 +917,11 @@ static void adv7511_bridge_atomic_enable(struct drm_bridge *bridge,adv7511_power_on (adv); }static void adv7511_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct adv7511 *adv =bridge_to_adv7511 (bridge);adv7511_power_off (adv); }
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 -4
@@ -1321,15 +1321,13 @@ static void analogix_dp_bridge_disable(struct drm_bridge *bridge) dp->fast_train_enable = false; dp->psr_supported = false; dp->dpms_mode =DRM_MODE_DPMS_OFF ; } -static void -analogix_dp_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void analogix_dp_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *old_state) { -struct drm_atomic_state *old_state = old_bridge_state->base.state;struct analogix_dp_device *dp = bridge->driver_private;struct drm_crtc *old_crtc, *new_crtc;struct drm_crtc_state *old_crtc_state =NULL ;struct drm_crtc_state *new_crtc_state =NULL ;int ret;
drivers/gpu/drm/bridge/analogix/anx7625.c +1 -1
@@ -2417,11 +2417,11 @@ static void anx7625_bridge_atomic_enable(struct drm_bridge *bridge, } } }static void anx7625_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old) +struct drm_atomic_state *state) {struct anx7625_data *ctx =bridge_to_anx7625 (bridge);struct device *dev = ctx->dev;dev_dbg (dev,"drm atomic disable\n" );
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1 -1
@@ -2067,11 +2067,11 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge,if (ret <0 )schedule_work (&mhdp->modeset_retry_work); }static void cdns_mhdp_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct cdns_mhdp_device *mhdp =bridge_to_mhdp (bridge);u32 resp;dev_dbg (mhdp->dev,"%s\n" , __func__);
drivers/gpu/drm/bridge/fsl-ldb.c +1 -1
@@ -221,11 +221,11 @@ static void fsl_ldb_atomic_enable(struct drm_bridge *bridge,regmap_write (fsl_ldb->regmap, fsl_ldb->devdata->lvds_ctrl, reg); }static void fsl_ldb_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct fsl_ldb *fsl_ldb =to_fsl_ldb (bridge);/* Stop channel(s). */ if (fsl_ldb->devdata->lvds_en_bit)
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c +1 -1
@@ -87,11 +87,11 @@ static void imx8mp_hdmi_pvi_bridge_enable(struct drm_bridge *bridge,writel (val, pvi->regs +HTX_PVI_CTRL ); }static void imx8mp_hdmi_pvi_bridge_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct imx8mp_hdmi_pvi *pvi =to_imx8mp_hdmi_pvi (bridge);writel (0x0 , pvi->regs +HTX_PVI_CTRL );
drivers/gpu/drm/bridge/imx/imx8qm-ldb.c +2 -3
@@ -244,13 +244,12 @@ static void imx8qm_ldb_bridge_atomic_enable(struct drm_bridge *bridge, }ldb_bridge_enable_helper (bridge); } -static void -imx8qm_ldb_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qm_ldb_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct ldb_channel *ldb_ch = bridge->driver_private;struct ldb *ldb = ldb_ch->ldb;struct imx8qm_ldb_channel *imx8qm_ldb_ch =base_to_imx8qm_ldb_channel (ldb_ch);
drivers/gpu/drm/bridge/imx/imx8qxp-ldb.c +3 -4
@@ -251,13 +251,12 @@ static void imx8qxp_ldb_bridge_atomic_enable(struct drm_bridge *bridge,if (is_split && companion) companion->funcs->atomic_enable (companion, state); } -static void -imx8qxp_ldb_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qxp_ldb_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct ldb_channel *ldb_ch = bridge->driver_private;struct ldb *ldb = ldb_ch->ldb;struct imx8qxp_ldb_channel *imx8qxp_ldb_ch =base_to_imx8qxp_ldb_channel (ldb_ch);
@@ -279,11 +278,11 @@ imx8qxp_ldb_bridge_atomic_disable(struct drm_bridge *bridge,clk_disable_unprepare (imx8qxp_ldb->clk_bypass);clk_disable_unprepare (imx8qxp_ldb->clk_pixel);if (is_split && companion) - companion->funcs->atomic_disable (companion, old_bridge_state); + companion->funcs->atomic_disable (companion, state); ret =pm_runtime_put (dev);if (ret <0 )DRM_DEV_ERROR (dev,"failed to put runtime PM: %d\n" , ret); }
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +2 -3
@@ -174,13 +174,12 @@ imx8qxp_pc_bridge_mode_set(struct drm_bridge *bridge,imx8qxp_pc_write_set (pc,PC_CTRL_REG ,PC_DISP_BYPASS (ch->stream_id));clk_disable_unprepare (pc->clk_apb); } -static void -imx8qxp_pc_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qxp_pc_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct imx8qxp_pc_channel *ch = bridge->driver_private;struct imx8qxp_pc *pc = ch->pc;int ret;
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +2 -3
@@ -161,13 +161,12 @@ static void imx8qxp_pixel_link_bridge_atomic_enable(struct drm_bridge *bridge,imx8qxp_pixel_link_enable_mst_en (pl);imx8qxp_pixel_link_enable_mst_vld (pl);imx8qxp_pixel_link_enable_sync (pl); } -static void -imx8qxp_pixel_link_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qxp_pixel_link_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct imx8qxp_pixel_link *pl = bridge->driver_private;imx8qxp_pixel_link_disable_mst_en (pl);imx8qxp_pixel_link_disable_mst_vld (pl);
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c +3 -5
@@ -120,24 +120,22 @@ imx8qxp_pxl2dpi_bridge_mode_set(struct drm_bridge *bridge, p2d->companion->funcs->mode_set (p2d->companion, mode, adjusted_mode); } } -static void -imx8qxp_pxl2dpi_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void imx8qxp_pxl2dpi_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct imx8qxp_pxl2dpi *p2d = bridge->driver_private;int ret; ret =pm_runtime_put (p2d->dev);if (ret <0 )DRM_DEV_ERROR (p2d->dev,"failed to put runtime PM: %d\n" , ret);if (p2d->companion) - p2d->companion->funcs->atomic_disable (p2d->companion, - old_bridge_state); + p2d->companion->funcs->atomic_disable (p2d->companion, state); }static const u32 imx8qxp_pxl2dpi_bus_output_fmts[] = {MEDIA_BUS_FMT_RGB888_1X24 ,MEDIA_BUS_FMT_RGB666_1X24_CPADHI ,
drivers/gpu/drm/bridge/ite-it6263.c +2 -3
@@ -567,13 +567,12 @@ static int it6263_read_edid(void *data, u8 *buf, unsigned int block, size_t len) }return 0 ; } -static void -it6263_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void it6263_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct it6263 *it =bridge_to_it6263 (bridge);regmap_write_bits (it->hdmi_regmap,HDMI_REG_GCP ,AVMUTE ,AVMUTE );regmap_write (it->hdmi_regmap,HDMI_REG_PKT_GENERAL_CTRL ,0 );
drivers/gpu/drm/bridge/ite-it6505.c +1 -1
@@ -3236,11 +3236,11 @@ static void it6505_bridge_atomic_enable(struct drm_bridge *bridge,it6505_drm_dp_link_set_power (&it6505->aux, &it6505->link,DP_SET_POWER_D0 ); }static void it6505_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct it6505 *it6505 =bridge_to_it6505 (bridge);struct device *dev = it6505->dev;DRM_DEV_DEBUG_DRIVER (dev,"start" );
drivers/gpu/drm/bridge/ite-it66121.c +1 -1
@@ -729,11 +729,11 @@ static void it66121_bridge_enable(struct drm_bridge *bridge,it66121_set_mute (ctx, false); }static void it66121_bridge_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) { struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge);it66121_set_mute (ctx, true);
drivers/gpu/drm/bridge/lontium-lt9211.c +1 -1
@@ -550,11 +550,11 @@ static void lt9211_atomic_enable(struct drm_bridge *bridge,dev_dbg (ctx->dev,"LT9211 enabled.\n" ); }static void lt9211_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct lt9211 *ctx =bridge_to_lt9211 (bridge);int ret;/*
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -3
@@ -685,13 +685,12 @@ static void lt9611_bridge_atomic_enable(struct drm_bridge *bridge,/* Enable HDMI output */ regmap_write (lt9611->regmap,0x8130 ,0xea ); } -static void -lt9611_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void lt9611_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct lt9611 *lt9611 =bridge_to_lt9611 (bridge);int ret;/* Disable HDMI output */
drivers/gpu/drm/bridge/nwl-dsi.c +2 -3
@@ -734,13 +734,12 @@ static int nwl_dsi_disable(struct nwl_dsi *dsi)clk_disable_unprepare (dsi->tx_esc_clk);return 0 ; } -static void -nwl_dsi_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void nwl_dsi_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct nwl_dsi *dsi =bridge_to_dsi (bridge);int ret;nwl_dsi_disable (dsi);
drivers/gpu/drm/bridge/panel.c +1 -2
@@ -145,14 +145,13 @@ static void panel_bridge_atomic_enable(struct drm_bridge *bridge,drm_panel_enable (panel_bridge->panel); }static void panel_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *atomic_state) {struct panel_bridge *panel_bridge =drm_bridge_to_panel_bridge (bridge); -struct drm_atomic_state *atomic_state = old_bridge_state->base.state;struct drm_encoder *encoder = bridge->encoder;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state; crtc =drm_atomic_get_old_crtc_for_encoder (atomic_state, encoder);
drivers/gpu/drm/bridge/samsung-dsim.c +1 -1
@@ -1494,11 +1494,11 @@ static void samsung_dsim_atomic_enable(struct drm_bridge *bridge, dsi->state |=DSIM_STATE_VIDOUT_AVAILABLE ; }static void samsung_dsim_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct samsung_dsim *dsi =bridge_to_dsi (bridge);if (!(dsi->state &DSIM_STATE_ENABLED ))return ;
drivers/gpu/drm/bridge/sii902x.c +1 -1
@@ -323,11 +323,11 @@ static int sii902x_get_modes(struct drm_connector *connector)static const struct drm_connector_helper_funcs sii902x_connector_helper_funcs = { .get_modes = sii902x_get_modes, };static void sii902x_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct sii902x *sii902x =bridge_to_sii902x (bridge);mutex_lock (&sii902x->mutex);
drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +1 -1
@@ -393,11 +393,11 @@ static void dw_hdmi_qp_bridge_atomic_enable(struct drm_bridge *bridge,drm_atomic_helper_connector_hdmi_update_infoframes (connector, state); }static void dw_hdmi_qp_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct dw_hdmi_qp *hdmi = bridge->driver_private; hdmi->phy.ops->disable (hdmi, hdmi->phy.data); }
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +1 -1
@@ -2943,11 +2943,11 @@ static void dw_hdmi_bridge_mode_set(struct drm_bridge *bridge,mutex_unlock (&hdmi->mutex); }static void dw_hdmi_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct dw_hdmi *hdmi = bridge->driver_private;mutex_lock (&hdmi->mutex); hdmi->disabled = true;
drivers/gpu/drm/bridge/tc358767.c +4 -6
@@ -1561,13 +1561,12 @@ static void tc_dpi_bridge_atomic_enable(struct drm_bridge *bridge,tc_main_link_disable (tc);return ; } } -static void -tc_dpi_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void tc_dpi_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc_data *tc =bridge_to_tc (bridge);int ret; ret =tc_dpi_stream_disable (tc);
@@ -1599,13 +1598,12 @@ static void tc_edp_bridge_atomic_enable(struct drm_bridge *bridge,tc_main_link_disable (tc);return ; } } -static void -tc_edp_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void tc_edp_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc_data *tc =bridge_to_tc (bridge);int ret; ret =tc_edp_stream_disable (tc);
drivers/gpu/drm/bridge/ti-sn65dsi83.c +1 -1
@@ -548,11 +548,11 @@ static void sn65dsi83_atomic_enable(struct drm_bridge *bridge,if (pval)dev_err (ctx->dev,"Unexpected link status 0x%02x\n" , pval); }static void sn65dsi83_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct sn65dsi83 *ctx =bridge_to_sn65dsi83 (bridge);int ret;/* Put the chip in reset, pull EN line low, and assure 10ms reset low timing. */
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -1
@@ -811,11 +811,11 @@ ti_sn_bridge_mode_valid(struct drm_bridge *bridge,return MODE_OK ; }static void ti_sn_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);/* disable video stream */ regmap_update_bits (pdata->regmap,SN_ENH_FRAME_REG ,VSTREAM_ENABLE ,0 );
drivers/gpu/drm/bridge/ti-tdp158.c +2 -1
@@ -33,11 +33,12 @@ static void tdp158_enable(struct drm_bridge *bridge,dev_err (tdp158->dev,"failed to enable vdd: %d" , err);gpiod_set_value_cansleep (tdp158->enable,1 ); } -static void tdp158_disable (struct drm_bridge *bridge,struct drm_bridge_state *prev) +static void tdp158_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tdp158 *tdp158 = bridge->driver_private;gpiod_set_value_cansleep (tdp158->enable,0 );regulator_disable (tdp158->vdd);
drivers/gpu/drm/drm_bridge.c +1 -9
@@ -569,19 +569,11 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,return ; encoder = bridge->encoder;list_for_each_entry_reverse (iter, &encoder->bridge_chain, chain_node) {if (iter->funcs->atomic_disable) { -struct drm_bridge_state *old_bridge_state; - - old_bridge_state = -drm_atomic_get_old_bridge_state (old_state, - iter); -if (WARN_ON (!old_bridge_state)) -return ; - - iter->funcs->atomic_disable (iter, old_bridge_state); + iter->funcs->atomic_disable (iter, old_state); }else if (iter->funcs->disable) { iter->funcs->disable (iter); }if (iter == bridge)
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +1 -1
@@ -258,11 +258,11 @@ static void ingenic_drm_crtc_atomic_enable(struct drm_crtc *crtc,drm_crtc_vblank_on (crtc); }static void ingenic_drm_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ingenic_drm *priv =drm_device_get_priv (bridge->dev);unsigned int var; regmap_update_bits(priv->map, JZ_REG_LCD_CTRL,
drivers/gpu/drm/mediatek/mtk_dp.c +1 -1
@@ -2398,11 +2398,11 @@ static void mtk_dp_bridge_atomic_enable(struct drm_bridge *bridge,DP_PWR_STATE_BANDGAP_TPLL , DP_PWR_STATE_MASK); }static void mtk_dp_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct mtk_dp *mtk_dp =mtk_dp_from_bridge (bridge); mtk_dp->enabled = false;mtk_dp_update_plugged_status (mtk_dp);
drivers/gpu/drm/mediatek/mtk_dsi.c +1 -1
@@ -824,11 +824,11 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge,drm_display_mode_to_videomode (adjusted, &dsi->vm); }static void mtk_dsi_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct mtk_dsi *dsi =bridge_to_dsi (bridge);mtk_output_dsi_disable (dsi); }
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -1
@@ -1307,11 +1307,11 @@ static bool mtk_hdmi_bridge_mode_fixup(struct drm_bridge *bridge, {return true; }static void mtk_hdmi_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct mtk_hdmi *hdmi =hdmi_ctx_from_bridge (bridge);if (!hdmi->enabled)return ;
drivers/gpu/drm/meson/meson_encoder_cvbs.c +1 -1
@@ -188,11 +188,11 @@ static void meson_encoder_cvbs_atomic_enable(struct drm_bridge *bridge,regmap_write (priv->hhi,HHI_VDAC_CNTL1_G12A ,0 ); } }static void meson_encoder_cvbs_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct meson_encoder_cvbs *meson_encoder_cvbs =bridge_to_meson_encoder_cvbs (bridge);struct meson_drm *priv = meson_encoder_cvbs->priv;
drivers/gpu/drm/meson/meson_encoder_dsi.c +1 -1
@@ -77,11 +77,11 @@ static void meson_encoder_dsi_atomic_enable(struct drm_bridge *bridge,writel_relaxed (1 , priv->io_base +_REG (ENCL_VIDEO_EN )); }static void meson_encoder_dsi_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct meson_encoder_dsi *meson_encoder_dsi =bridge_to_meson_encoder_dsi (bridge);struct meson_drm *priv = meson_encoder_dsi->priv;
drivers/gpu/drm/meson/meson_encoder_hdmi.c +1 -1
@@ -247,11 +247,11 @@ static void meson_encoder_hdmi_atomic_enable(struct drm_bridge *bridge,else writel_relaxed (1 , priv->io_base +_REG (ENCP_VIDEO_EN )); }static void meson_encoder_hdmi_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct meson_encoder_hdmi *encoder_hdmi =bridge_to_meson_encoder_hdmi (bridge);struct meson_drm *priv = encoder_hdmi->priv; writel_bits_relaxed(0x3, 0,
drivers/gpu/drm/msm/dp/dp_display.c +1 -1
@@ -1550,11 +1550,11 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,drm_dbg_dp (dp->drm_dev,"type=%d Done\n" , dp->connector_type);mutex_unlock (&msm_dp_display->event_mutex); }void msm_dp_bridge_atomic_disable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct msm_dp_bridge *msm_dp_bridge =to_dp_bridge (drm_bridge);struct msm_dp *dp = msm_dp_bridge->msm_dp_display;struct msm_dp_display_private *msm_dp_display;
drivers/gpu/drm/msm/dp/dp_drm.c +2 -3
@@ -164,13 +164,12 @@ static void msm_edp_bridge_atomic_enable(struct drm_bridge *drm_bridge,msm_dp_bridge_atomic_enable (drm_bridge, state); }static void msm_edp_bridge_atomic_disable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *atomic_state) { -struct drm_atomic_state *atomic_state = old_bridge_state->base.state;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state =NULL , *old_crtc_state =NULL ;struct msm_dp_bridge *msm_dp_bridge =to_dp_bridge (drm_bridge);struct msm_dp *dp = msm_dp_bridge->msm_dp_display;
@@ -205,11 +204,11 @@ static void msm_edp_bridge_atomic_disable(struct drm_bridge *drm_bridge,msm_dp_display_set_psr (dp, false);return ; } out: -msm_dp_bridge_atomic_disable (drm_bridge, old_bridge_state); +msm_dp_bridge_atomic_disable (drm_bridge, atomic_state); }static void msm_edp_bridge_atomic_post_disable (struct drm_bridge *drm_bridge,struct drm_bridge_state *old_bridge_state) {
drivers/gpu/drm/msm/dp/dp_drm.h +1 -1
@@ -26,11 +26,11 @@ int msm_dp_bridge_init(struct msm_dp *msm_dp_display, struct drm_device *dev, bool yuv_supported);void msm_dp_bridge_atomic_enable (struct drm_bridge *drm_bridge,struct drm_atomic_state *state);void msm_dp_bridge_atomic_disable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state); +struct drm_atomic_state *state);void msm_dp_bridge_atomic_post_disable (struct drm_bridge *drm_bridge,struct drm_bridge_state *old_bridge_state);enum drm_mode_status msm_dp_bridge_mode_valid (struct drm_bridge *bridge,const struct drm_display_info *info,const struct drm_display_mode *mode);
drivers/gpu/drm/omapdrm/dss/hdmi4.c +1 -1
@@ -407,11 +407,11 @@ static void hdmi4_bridge_enable(struct drm_bridge *bridge, done:mutex_unlock (&hdmi->lock); }static void hdmi4_bridge_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct omap_hdmi *hdmi =drm_bridge_to_hdmi (bridge);unsigned long flags;mutex_lock (&hdmi->lock);
drivers/gpu/drm/omapdrm/dss/hdmi5.c +1 -1
@@ -405,11 +405,11 @@ static void hdmi5_bridge_enable(struct drm_bridge *bridge, done:mutex_unlock (&hdmi->lock); }static void hdmi5_bridge_disable (struct drm_bridge *bridge, -struct drm_bridge_state *bridge_state) +struct drm_atomic_state *state) {struct omap_hdmi *hdmi =drm_bridge_to_hdmi (bridge);unsigned long flags;mutex_lock (&hdmi->lock);
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c +1 -1
@@ -593,11 +593,11 @@ static void rcar_lvds_atomic_enable(struct drm_bridge *bridge,rcar_lvds_enable (bridge, state, crtc, connector); }static void rcar_lvds_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct rcar_lvds *lvds =bridge_to_rcar_lvds (bridge);/* * For D3 and E3, disabling the LVDS encoder before the DU would stall
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c +1 -1
@@ -814,11 +814,11 @@ static void rcar_mipi_dsi_atomic_enable(struct drm_bridge *bridge,rcar_mipi_dsi_start_video (dsi); }static void rcar_mipi_dsi_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct rcar_mipi_dsi *dsi =bridge_to_rcar_mipi_dsi (bridge);rcar_mipi_dsi_stop_video (dsi); }
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1 -1
@@ -565,11 +565,11 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge, err_stop:rzg2l_mipi_dsi_stop (dsi); }static void rzg2l_mipi_dsi_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct rzg2l_mipi_dsi *dsi =bridge_to_rzg2l_mipi_dsi (bridge);rzg2l_mipi_dsi_stop_video (dsi);rzg2l_mipi_dsi_stop_hs_clock (dsi);
drivers/gpu/drm/stm/lvds.c +1 -1
@@ -1014,11 +1014,11 @@ static void lvds_atomic_enable(struct drm_bridge *bridge,drm_panel_enable (lvds->panel); } }static void lvds_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct stm_lvds *lvds =bridge_to_stm_lvds (bridge);if (lvds->panel) {drm_panel_disable (lvds->panel);
drivers/gpu/drm/vc4/vc4_dsi.c +1 -1
@@ -798,11 +798,11 @@ dsi_esc_timing(u32 ns) {return DIV_ROUND_UP (ns,ESC_TIME_NS ); }static void vc4_dsi_bridge_disable (struct drm_bridge *bridge, -struct drm_bridge_state *state) +struct drm_atomic_state *state) {struct vc4_dsi *dsi =bridge_to_vc4_dsi (bridge);u32 disp0_ctrl; disp0_ctrl =DSI_PORT_READ (DISP0_CTRL );
drivers/gpu/drm/xlnx/zynqmp_dp.c +3 -1
@@ -1623,12 +1623,14 @@ static void zynqmp_dp_bridge_atomic_enable(struct drm_bridge *bridge, ZYNQMP_DP_SOFTWARE_RESET_ALL);zynqmp_dp_write (dp,ZYNQMP_DP_MAIN_STREAM_ENABLE ,1 ); }static void zynqmp_dp_bridge_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) { +struct drm_bridge_state *old_bridge_state =drm_atomic_get_old_bridge_state (state, + bridge);struct zynqmp_dp *dp =bridge_to_dp (bridge);mutex_lock (&dp->lock); dp->enabled = false;cancel_work (&dp->hpd_work);
include/drm/drm_bridge.h +1 -1
@@ -340,11 +340,11 @@ struct drm_bridge_funcs {* signals) feeding it is still running when this callback is called. * * The @atomic_disable callback is optional. */ void (*atomic_disable)(struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state); +struct drm_atomic_state *state);/** * @atomic_post_disable: * * This callback should disable the bridge. It is called right after the
Signature · 1 line
2.48.0
Re: [PATCH v3 04/37] drm/bridge: Pass full state to atomic_disable
Hi,
Quoted 7 lines · Maxime Ripard
It's pretty inconvenient to access the full atomic state from
drm_bridges, so let's change theatomic_disablehook prototype to pass it directly.Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
From the point of view of ti-sn65dsi86:
Maxime Ripard
maintainerPATCH v3 5/37 drm/bridge: Pass full state to atomic_post_disable
In reply to Maxime RipardIt's pretty inconvenient to access the full atomic state from drm_bridges, so let's change the atomic_post_disable hook prototype to pass it directly.
--- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 6 ++---- drivers/gpu/drm/bridge/chipone-icn6211.c | 2 +- drivers/gpu/drm/bridge/ite-it6505.c | 2 +- drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++--- drivers/gpu/drm/bridge/panel.c | 3 +-- drivers/gpu/drm/bridge/parade-ps8640.c | 2 +- drivers/gpu/drm/bridge/samsung-dsim.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 2 +- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 2 +- drivers/gpu/drm/bridge/tc358762.c | 3 ++- drivers/gpu/drm/bridge/ti-dlpc3433.c | 2 +- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 2 +- drivers/gpu/drm/drm_bridge.c | 16 +++------------- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 +- drivers/gpu/drm/mediatek/mtk_hdmi.c | 2 +- drivers/gpu/drm/msm/dp/dp_display.c | 14 +++++++------- drivers/gpu/drm/msm/dp/dp_drm.c | 5 ++--- drivers/gpu/drm/msm/dp/dp_drm.h | 2 +- drivers/gpu/drm/vc4/vc4_dsi.c | 2 +- include/drm/drm_bridge.h | 2 +- 20 files changed, 32 insertions(+), 46 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +2 -4
@@ -1359,15 +1359,13 @@ static void analogix_dp_bridge_atomic_disable(struct drm_bridge *bridge, }analogix_dp_bridge_disable (bridge); } -static void -analogix_dp_bridge_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void analogix_dp_bridge_atomic_post_disable (struct drm_bridge *bridge, +struct drm_atomic_state *old_state) { -struct drm_atomic_state *old_state = old_bridge_state->base.state;struct analogix_dp_device *dp = bridge->driver_private;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state;int ret;
drivers/gpu/drm/bridge/chipone-icn6211.c +1 -1
@@ -479,11 +479,11 @@ static void chipone_atomic_pre_enable(struct drm_bridge *bridge,usleep_range (10000 ,11000 ); }static void chipone_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct chipone *icn =bridge_to_chipone (bridge);clk_disable_unprepare (icn->refclk);
drivers/gpu/drm/bridge/ite-it6505.c +1 -1
@@ -3262,11 +3262,11 @@ static void it6505_bridge_atomic_pre_enable(struct drm_bridge *bridge,pm_runtime_get_sync (dev); }static void it6505_bridge_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct it6505 *it6505 =bridge_to_it6505 (bridge);struct device *dev = it6505->dev;DRM_DEV_DEBUG_DRIVER (dev,"start" );
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -3
@@ -781,13 +781,12 @@ static void lt9611_bridge_atomic_pre_enable(struct drm_bridge *bridge, reg_cfg, ARRAY_SIZE(reg_cfg)); lt9611->sleep = false; } -static void -lt9611_bridge_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +static void lt9611_bridge_atomic_post_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct lt9611 *lt9611 =bridge_to_lt9611 (bridge);lt9611_sleep_setup (lt9611); }
drivers/gpu/drm/bridge/panel.c +1 -2
@@ -164,14 +164,13 @@ static void panel_bridge_atomic_disable(struct drm_bridge *bridge,drm_panel_disable (panel_bridge->panel); }static void panel_bridge_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *atomic_state) {struct panel_bridge *panel_bridge =drm_bridge_to_panel_bridge (bridge); -struct drm_atomic_state *atomic_state = old_bridge_state->base.state;struct drm_encoder *encoder = bridge->encoder;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state; crtc =drm_atomic_get_old_crtc_for_encoder (atomic_state, encoder);
drivers/gpu/drm/bridge/parade-ps8640.c +1 -1
@@ -470,11 +470,11 @@ static void ps8640_atomic_pre_enable(struct drm_bridge *bridge, ps_bridge->pre_enabled = true; }static void ps8640_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ps8640 *ps_bridge =bridge_to_ps8640 (bridge); ps_bridge->pre_enabled = false;
drivers/gpu/drm/bridge/samsung-dsim.c +1 -1
@@ -1506,11 +1506,11 @@ static void samsung_dsim_atomic_disable(struct drm_bridge *bridge,samsung_dsim_set_display_enable (dsi, false); dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE ; }static void samsung_dsim_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct samsung_dsim *dsi =bridge_to_dsi (bridge); dsi->state &= ~DSIM_STATE_ENABLED ;pm_runtime_put_sync (dsi->dev);
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +1 -1
@@ -932,11 +932,11 @@ static void dw_mipi_dsi_clear_err(struct dw_mipi_dsi *dsi)dsi_write (dsi,DSI_INT_MSK0 ,0 );dsi_write (dsi,DSI_INT_MSK1 ,0 ); }static void dw_mipi_dsi_bridge_post_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge);const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;/*
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c +1 -1
@@ -743,11 +743,11 @@ static int dw_mipi_dsi2_bridge_atomic_check(struct drm_bridge *bridge,return 0 ; }static void dw_mipi_dsi2_bridge_post_atomic_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dw_mipi_dsi2 *dsi2 =bridge_to_dsi2 (bridge);const struct dw_mipi_dsi2_phy_ops *phy_ops = dsi2->plat_data->phy_ops;regmap_write (dsi2->regmap,DSI2_IPI_PIX_PKT_CFG ,0 );
drivers/gpu/drm/bridge/tc358762.c +2 -1
@@ -147,11 +147,12 @@ static int tc358762_init(struct tc358762 *ctx)msleep (100 );return tc358762_clear_error (ctx); } -static void tc358762_post_disable (struct drm_bridge *bridge,struct drm_bridge_state *state) +static void tc358762_post_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc358762 *ctx =bridge_to_tc358762 (bridge);int ret;/*
drivers/gpu/drm/bridge/ti-dlpc3433.c +1 -1
@@ -191,11 +191,11 @@ static void dlpc_atomic_pre_enable(struct drm_bridge *bridge,msleep (10 ); }static void dlpc_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct dlpc *dlpc =bridge_to_dlpc (bridge);regulator_disable (dlpc->vcc_flsh);regulator_disable (dlpc->vcc_intf);
drivers/gpu/drm/bridge/ti-sn65dsi86.c +1 -1
@@ -1176,11 +1176,11 @@ static void ti_sn_bridge_atomic_pre_enable(struct drm_bridge *bridge,/* td7: min 100 us after enable before DSI data */ usleep_range (100 ,110 ); }static void ti_sn_bridge_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);/* semi auto link training mode OFF */ regmap_write (pdata->regmap,SN_ML_TX_MODE_REG ,0 );
drivers/gpu/drm/drm_bridge.c +3 -13
@@ -583,24 +583,14 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge,EXPORT_SYMBOL (drm_atomic_bridge_chain_disable);static void drm_atomic_bridge_call_post_disable (struct drm_bridge *bridge,struct drm_atomic_state *old_state) { -if (old_state && bridge->funcs->atomic_post_disable) { -struct drm_bridge_state *old_bridge_state; - - old_bridge_state = -drm_atomic_get_old_bridge_state (old_state, - bridge); -if (WARN_ON (!old_bridge_state)) -return ; - - bridge->funcs->atomic_post_disable (bridge, - old_bridge_state); - }else if (bridge->funcs->post_disable) { +if (old_state && bridge->funcs->atomic_post_disable) + bridge->funcs->atomic_post_disable (bridge, old_state); +else if (bridge->funcs->post_disable) bridge->funcs->post_disable (bridge); - } }/** * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges * in the encoder chain
drivers/gpu/drm/mediatek/mtk_dsi.c +1 -1
@@ -854,11 +854,11 @@ static void mtk_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,if (ret <0 )DRM_ERROR ("failed to power on dsi\n" ); }static void mtk_dsi_bridge_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct mtk_dsi *dsi =bridge_to_dsi (bridge);mtk_dsi_poweroff (dsi); }
drivers/gpu/drm/mediatek/mtk_hdmi.c +1 -1
@@ -1324,11 +1324,11 @@ static void mtk_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, hdmi->enabled = false; }static void mtk_hdmi_bridge_atomic_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *old_state) +struct drm_atomic_state *state) {struct mtk_hdmi *hdmi =hdmi_ctx_from_bridge (bridge);if (!hdmi->powered)return ;
drivers/gpu/drm/msm/dp/dp_display.c +7 -7
@@ -1562,33 +1562,33 @@ void msm_dp_bridge_atomic_disable(struct drm_bridge *drm_bridge,msm_dp_ctrl_push_idle (msm_dp_display->ctrl); }void msm_dp_bridge_atomic_post_disable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *state) {struct msm_dp_bridge *msm_dp_bridge =to_dp_bridge (drm_bridge);struct msm_dp *dp = msm_dp_bridge->msm_dp_display; -u32 state; +u32 hpd_state;struct msm_dp_display_private *msm_dp_display; msm_dp_display = container_of(dp, struct msm_dp_display_private, msm_dp_display);if (dp->is_edp)msm_dp_hpd_unplug_handle (msm_dp_display,0 );mutex_lock (&msm_dp_display->event_mutex); - state = msm_dp_display->hpd_state; -if (state !=ST_DISCONNECT_PENDING && state !=ST_CONNECTED ) + hpd_state = msm_dp_display->hpd_state; +if (hpd_state !=ST_DISCONNECT_PENDING && hpd_state !=ST_CONNECTED )drm_dbg_dp (dp->drm_dev,"type=%d wrong hpd_state=%d\n" , - dp->connector_type, state); + dp->connector_type, hpd_state);msm_dp_display_disable (msm_dp_display); - state = msm_dp_display->hpd_state; -if (state ==ST_DISCONNECT_PENDING ) { + hpd_state = msm_dp_display->hpd_state; +if (hpd_state ==ST_DISCONNECT_PENDING ) {/* completed disconnection */ msm_dp_display->hpd_state =ST_DISCONNECTED ; }else { msm_dp_display->hpd_state =ST_DISPLAY_OFF ; }
drivers/gpu/drm/msm/dp/dp_drm.c +2 -3
@@ -208,13 +208,12 @@ static void msm_edp_bridge_atomic_disable(struct drm_bridge *drm_bridge, out:msm_dp_bridge_atomic_disable (drm_bridge, atomic_state); }static void msm_edp_bridge_atomic_post_disable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state) +struct drm_atomic_state *atomic_state) { -struct drm_atomic_state *atomic_state = old_bridge_state->base.state;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state =NULL ; crtc =drm_atomic_get_old_crtc_for_encoder (atomic_state, drm_bridge->encoder);
@@ -229,11 +228,11 @@ static void msm_edp_bridge_atomic_post_disable(struct drm_bridge *drm_bridge,* Self refresh mode is already set in msm_edp_bridge_atomic_disable. */ if (new_crtc_state->self_refresh_active)return ; -msm_dp_bridge_atomic_post_disable (drm_bridge, old_bridge_state); +msm_dp_bridge_atomic_post_disable (drm_bridge, atomic_state); }/** * msm_edp_bridge_mode_valid - callback to determine if specified mode is valid * @bridge: Pointer to drm bridge structure
drivers/gpu/drm/msm/dp/dp_drm.h +1 -1
@@ -28,11 +28,11 @@ int msm_dp_bridge_init(struct msm_dp *msm_dp_display, struct drm_device *dev,void msm_dp_bridge_atomic_enable (struct drm_bridge *drm_bridge,struct drm_atomic_state *state);void msm_dp_bridge_atomic_disable (struct drm_bridge *drm_bridge,struct drm_atomic_state *state);void msm_dp_bridge_atomic_post_disable (struct drm_bridge *drm_bridge, -struct drm_bridge_state *old_bridge_state); +struct drm_atomic_state *state);enum drm_mode_status msm_dp_bridge_mode_valid (struct drm_bridge *bridge,const struct drm_display_info *info,const struct drm_display_mode *mode); void msm_dp_bridge_mode_set(struct drm_bridge *drm_bridge, const struct drm_display_mode *mode,
drivers/gpu/drm/vc4/vc4_dsi.c +1 -1
@@ -809,11 +809,11 @@ static void vc4_dsi_bridge_disable(struct drm_bridge *bridge, disp0_ctrl &= ~DSI_DISP0_ENABLE ;DSI_PORT_WRITE (DISP0_CTRL , disp0_ctrl); }static void vc4_dsi_bridge_post_disable (struct drm_bridge *bridge, -struct drm_bridge_state *state) +struct drm_atomic_state *state) {struct vc4_dsi *dsi =bridge_to_vc4_dsi (bridge);struct device *dev = &dsi->pdev->dev;clk_disable_unprepare (dsi->pll_phy_clock);
include/drm/drm_bridge.h +1 -1
@@ -359,11 +359,11 @@ struct drm_bridge_funcs {* called. * * The @atomic_post_disable callback is optional. */ void (*atomic_post_disable)(struct drm_bridge *bridge, -struct drm_bridge_state *old_bridge_state); +struct drm_atomic_state *state);/** * @atomic_duplicate_state: * * Duplicate the current bridge state object (which is guaranteed to be
Signature · 1 line
2.48.0
Re: [PATCH v3 05/37] drm/bridge: Pass full state to atomic_post_disable
Hi,
Quoted 7 lines · Maxime Ripard
It's pretty inconvenient to access the full atomic state from
drm_bridges, so let's change theatomic_post_disablehook prototype to pass it directly.Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
From the point of view of ti-sn65dsi86 and parade-ps8640:
Maxime Ripard
maintainerPATCH v3 6/37 drm/atomic-helper: Fix commit_tail state variable name
In reply to Maxime RipardEven though the commit_tail () drm_atomic_state parameter is called old_state, it's actually the state being committed which is confusing.
It's even more confusing since the atomic_commit_tail hook being called by commit_tail() parameter is called state.
Let's rename the variable from old_state to state to make it less confusing.
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +10 -10
@@ -1828,13 +1828,13 @@ void drm_atomic_helper_commit_tail_rpm(struct drm_atomic_state *old_state)drm_atomic_helper_cleanup_planes (dev, old_state); }EXPORT_SYMBOL (drm_atomic_helper_commit_tail_rpm); -static void commit_tail (struct drm_atomic_state *old_state) +static void commit_tail (struct drm_atomic_state *state) { -struct drm_device *dev = old_state->dev; +struct drm_device *dev = state->dev;const struct drm_mode_config_helper_funcs *funcs;struct drm_crtc_state *new_crtc_state;struct drm_crtc *crtc;ktime_t start;s64 commit_time_ms;
@@ -1852,37 +1852,37 @@ static void commit_tail(struct drm_atomic_state *old_state)* These times will be averaged out in the self refresh helpers to avoid * overreacting over one outlier frame */ start =ktime_get (); -drm_atomic_helper_wait_for_fences (dev, old_state, false); +drm_atomic_helper_wait_for_fences (dev, state, false); -drm_atomic_helper_wait_for_dependencies (old_state); +drm_atomic_helper_wait_for_dependencies (state);/* * We cannot safely access new_crtc_state after * drm_atomic_helper_commit_hw_done() so figure out which crtc's have * self-refresh active beforehand: */ -for_each_new_crtc_in_state (old_state, crtc, new_crtc_state, i) +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i)if (new_crtc_state->self_refresh_active) new_self_refresh_mask |=BIT (i);if (funcs && funcs->atomic_commit_tail) - funcs->atomic_commit_tail (old_state); + funcs->atomic_commit_tail (state);else -drm_atomic_helper_commit_tail (old_state); +drm_atomic_helper_commit_tail (state); commit_time_ms =ktime_ms_delta (ktime_get (), start);if (commit_time_ms >0 ) -drm_self_refresh_helper_update_avg_times (old_state, +drm_self_refresh_helper_update_avg_times (state, (unsigned long )commit_time_ms, new_self_refresh_mask); -drm_atomic_helper_commit_cleanup_done (old_state); +drm_atomic_helper_commit_cleanup_done (state); -drm_atomic_state_put (old_state); +drm_atomic_state_put (state); }static void commit_work (struct work_struct *work) { struct drm_atomic_state *state = container_of(work,
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 7/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_dependencies()
In reply to Maxime Riparddrm_atomic_helper_wait_for_dependencies() waits for all the dependencies a commit has before going forward with it. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +6 -6
@@ -2421,48 +2421,48 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, }EXPORT_SYMBOL (drm_atomic_helper_setup_commit);/** * drm_atomic_helper_wait_for_dependencies - wait for required preceding commits -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This function waits for all preceding commits that touch the same CRTC as -* @old_state to both be committed to the hardware (as signalled by +* @state to both be committed to the hardware (as signalled by * drm_atomic_helper_commit_hw_done()) and executed by the hardware (as signalled * by calling drm_crtc_send_vblank_event() on the &drm_crtc_state.event). * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_wait_for_dependencies (struct drm_atomic_state *old_state) +void drm_atomic_helper_wait_for_dependencies (struct drm_atomic_state *state) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;struct drm_plane *plane;struct drm_plane_state *old_plane_state;struct drm_connector *conn;struct drm_connector_state *old_conn_state;int i;long ret; -for_each_old_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_old_crtc_in_state (state, crtc, old_crtc_state, i) { ret =drm_crtc_commit_wait (old_crtc_state->commit);if (ret)drm_err (crtc->dev,"[CRTC:%d:%s] commit wait timed out\n" , crtc->base.id, crtc->name); } -for_each_old_connector_in_state (old_state, conn, old_conn_state, i) { +for_each_old_connector_in_state (state, conn, old_conn_state, i) { ret =drm_crtc_commit_wait (old_conn_state->commit);if (ret)drm_err (conn->dev,"[CONNECTOR:%d:%s] commit wait timed out\n" , conn->base.id, conn->name); } -for_each_old_plane_in_state (old_state, plane, old_plane_state, i) { +for_each_old_plane_in_state (state, plane, old_plane_state, i) { ret =drm_crtc_commit_wait (old_plane_state->commit);if (ret)drm_err (plane->dev,"[PLANE:%d:%s] commit wait timed out\n" , plane->base.id, plane->name);
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 8/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail()
In reply to Maxime Riparddrm_atomic_helper_commit_tail() is the final part of an atomic commit, and is given a parameter with the drm_atomic_state being committed.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +10 -10
@@ -1766,38 +1766,38 @@ void drm_atomic_helper_wait_for_flip_done(struct drm_device *dev, }EXPORT_SYMBOL (drm_atomic_helper_wait_for_flip_done);/** * drm_atomic_helper_commit_tail - commit atomic update to hardware -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This is the default implementation for the * &drm_mode_config_helper_funcs.atomic_commit_tail hook, for drivers * that do not support runtime_pm or do not need the CRTC to be * enabled to perform a commit. Otherwise, see * drm_atomic_helper_commit_tail_rpm(). * * Note that the default ordering of how the various stages are called is to * match the legacy modeset helper library closest. */ -void drm_atomic_helper_commit_tail (struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_tail (struct drm_atomic_state *state) { -struct drm_device *dev = old_state->dev; +struct drm_device *dev = state->dev; -drm_atomic_helper_commit_modeset_disables (dev, old_state); +drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_planes (dev, old_state,0 ); +drm_atomic_helper_commit_planes (dev, state,0 ); -drm_atomic_helper_commit_modeset_enables (dev, old_state); +drm_atomic_helper_commit_modeset_enables (dev, state); -drm_atomic_helper_fake_vblank (old_state); +drm_atomic_helper_fake_vblank (state); -drm_atomic_helper_commit_hw_done (old_state); +drm_atomic_helper_commit_hw_done (state); -drm_atomic_helper_wait_for_vblanks (dev, old_state); +drm_atomic_helper_wait_for_vblanks (dev, state); -drm_atomic_helper_cleanup_planes (dev, old_state); +drm_atomic_helper_cleanup_planes (dev, state); }EXPORT_SYMBOL (drm_atomic_helper_commit_tail);/** * drm_atomic_helper_commit_tail_rpm - commit atomic update to hardware
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 9/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_tail_rpm()
In reply to Maxime Riparddrm_atomic_helper_commit_tail_rpm() is the final part of an atomic commit, and is given the state being committed as a parameter.
However, that parameter is named old_state, but documented as the "new modeset state" which is all super confusing.
Let's rename that parameter to state.
--- drivers/gpu/drm/drm_atomic_helper.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +10 -10
@@ -1799,36 +1799,36 @@ void drm_atomic_helper_commit_tail(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_helper_commit_tail);/** * drm_atomic_helper_commit_tail_rpm - commit atomic update to hardware -* @old_state: new modeset state to be committed +* @state: new modeset state to be committed * * This is an alternative implementation for the * &drm_mode_config_helper_funcs.atomic_commit_tail hook, for drivers * that support runtime_pm or need the CRTC to be enabled to perform a * commit. Otherwise, one should use the default implementation * drm_atomic_helper_commit_tail(). */ -void drm_atomic_helper_commit_tail_rpm (struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_tail_rpm (struct drm_atomic_state *state) { -struct drm_device *dev = old_state->dev; +struct drm_device *dev = state->dev; -drm_atomic_helper_commit_modeset_disables (dev, old_state); +drm_atomic_helper_commit_modeset_disables (dev, state); -drm_atomic_helper_commit_modeset_enables (dev, old_state); +drm_atomic_helper_commit_modeset_enables (dev, state); -drm_atomic_helper_commit_planes (dev, old_state, +drm_atomic_helper_commit_planes (dev, state,DRM_PLANE_COMMIT_ACTIVE_ONLY ); -drm_atomic_helper_fake_vblank (old_state); +drm_atomic_helper_fake_vblank (state); -drm_atomic_helper_commit_hw_done (old_state); +drm_atomic_helper_commit_hw_done (state); -drm_atomic_helper_wait_for_vblanks (dev, old_state); +drm_atomic_helper_wait_for_vblanks (dev, state); -drm_atomic_helper_cleanup_planes (dev, old_state); +drm_atomic_helper_cleanup_planes (dev, state); }EXPORT_SYMBOL (drm_atomic_helper_commit_tail_rpm);static void commit_tail (struct drm_atomic_state *state) {
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 10/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_modeset_disables()
In reply to Maxime Riparddrm_atomic_helper_modeset_disables() disables all the outputs affected by a commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +6 -6
@@ -1437,11 +1437,11 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) }/** * drm_atomic_helper_commit_modeset_disables - modeset commit to disable outputs * @dev: DRM device -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This function shuts down all the outputs that need to be shut down and * prepares them (if required) with the new mode. * * For compatibility with legacy CRTC helpers this should be called before
@@ -1449,18 +1449,18 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state)* does. But drivers with different needs can group the modeset commits together * and do the plane commits at the end. This is useful for drivers doing runtime * PM since planes updates then only happen when the CRTC is actually enabled. */ void drm_atomic_helper_commit_modeset_disables (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) { -disable_outputs (dev, old_state); +disable_outputs (dev, state); -drm_atomic_helper_update_legacy_modeset_state (dev, old_state); -drm_atomic_helper_calc_timestamping_constants (old_state); +drm_atomic_helper_update_legacy_modeset_state (dev, state); +drm_atomic_helper_calc_timestamping_constants (state); -crtc_set_mode (dev, old_state); +crtc_set_mode (dev, state); }EXPORT_SYMBOL (drm_atomic_helper_commit_modeset_disables);static void drm_atomic_helper_commit_writebacks (struct drm_device *dev,struct drm_atomic_state *old_state)
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 11/37 drm/atomic-helper: Change parameter name of disable_outputs()
In reply to Maxime Riparddisable_outputs() disables all connectors and CRTCs affected by a commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +9 -9
@@ -1158,19 +1158,19 @@ crtc_needs_disable(struct drm_crtc_state *old_state, (old_state->self_refresh_active && !new_state->active) || new_state->self_refresh_active; }static void -disable_outputs (struct drm_device *dev,struct drm_atomic_state *old_state) +disable_outputs (struct drm_device *dev,struct drm_atomic_state *state) {struct drm_connector *connector;struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i; -for_each_oldnew_connector_in_state (old_state, connector, old_conn_state, new_conn_state, i) { +for_each_oldnew_connector_in_state (state, connector, old_conn_state, new_conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;struct drm_bridge *bridge;/*
@@ -1178,15 +1178,15 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)* still on. So need to check the old, saved state. */ if (!old_conn_state->crtc)continue ; - old_crtc_state =drm_atomic_get_old_crtc_state (old_state, old_conn_state->crtc); + old_crtc_state =drm_atomic_get_old_crtc_state (state, old_conn_state->crtc);if (new_conn_state->crtc) new_crtc_state =drm_atomic_get_new_crtc_state ( - old_state, + state, new_conn_state->crtc);else new_crtc_state =NULL ; if (!crtc_needs_disable(old_crtc_state, new_crtc_state) ||
@@ -1209,28 +1209,28 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)/* * Each encoder has at most one connector (since we always steal * it away), so we won't call disable hooks twice. */ bridge =drm_bridge_chain_get_first_bridge (encoder); -drm_atomic_bridge_chain_disable (bridge, old_state); +drm_atomic_bridge_chain_disable (bridge, state);/* Right function depends upon target state. */ if (funcs) {if (funcs->atomic_disable) - funcs->atomic_disable (encoder, old_state); + funcs->atomic_disable (encoder, state);else if (new_conn_state->crtc && funcs->prepare) funcs->prepare (encoder);else if (funcs->disable) funcs->disable (encoder);else if (funcs->dpms) funcs->dpms (encoder,DRM_MODE_DPMS_OFF ); } -drm_atomic_bridge_chain_post_disable (bridge, old_state); +drm_atomic_bridge_chain_post_disable (bridge, state); } -for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs;int ret;/* Shut down everything that needs a full modeset. */ if (!drm_atomic_crtc_needs_modeset (new_crtc_state))
@@ -1247,11 +1247,11 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state)/* Right function depends upon target state. */ if (new_crtc_state->enable && funcs->prepare) funcs->prepare (crtc);else if (funcs->atomic_disable) - funcs->atomic_disable (crtc, old_state); + funcs->atomic_disable (crtc, state);else if (funcs->disable) funcs->disable (crtc);else if (funcs->dpms) funcs->dpms (crtc,DRM_MODE_DPMS_OFF );
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 12/37 drm/bridge: Change parameter name of drm_atomic_bridge_chain_disable()
In reply to Maxime Riparddrm_atomic_bridge_chain_disable() disables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_bridge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_bridge.c +3 -3
@@ -548,32 +548,32 @@ void drm_bridge_chain_mode_set(struct drm_bridge *bridge,EXPORT_SYMBOL (drm_bridge_chain_mode_set);/** * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain * @bridge: bridge control structure -* @old_state: old atomic state +* @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_disable (falls back on * &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 * &drm_encoder_helper_funcs.atomic_disable * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_disable (struct drm_bridge *bridge, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {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->atomic_disable) { - iter->funcs->atomic_disable (iter, old_state); + iter->funcs->atomic_disable (iter, state); }else if (iter->funcs->disable) { iter->funcs->disable (iter); }if (iter == bridge)
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 13/37 drm/bridge: Change parameter name of drm_atomic_bridge_chain_post_disable()
In reply to Maxime Riparddrm_atomic_bridge_chain_post_disable() disables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_bridge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_bridge.c +7 -7
@@ -581,23 +581,23 @@ void drm_atomic_bridge_chain_disable(struct drm_bridge *bridge, } }EXPORT_SYMBOL (drm_atomic_bridge_chain_disable);static void drm_atomic_bridge_call_post_disable (struct drm_bridge *bridge, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) { -if (old_state && bridge->funcs->atomic_post_disable) - bridge->funcs->atomic_post_disable (bridge, old_state); +if (state && bridge->funcs->atomic_post_disable) + bridge->funcs->atomic_post_disable (bridge, state);else if (bridge->funcs->post_disable) bridge->funcs->post_disable (bridge); }/** * drm_atomic_bridge_chain_post_disable - cleans up after disabling all bridges * in the encoder chain * @bridge: bridge control structure -* @old_state: old atomic state +* @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_post_disable (falls back on * &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 * &drm_encoder_helper_funcs.atomic_disable
@@ -614,11 +614,11 @@ static void drm_atomic_bridge_call_post_disable(struct drm_bridge *bridge,* Bridge B, Bridge A, Bridge E, Bridge D, Bridge C. * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_post_disable (struct drm_bridge *bridge, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_encoder *encoder;struct drm_bridge *next, *limit;if (!bridge)
@@ -661,16 +661,16 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, chain_node) {if (next == bridge)break ;drm_atomic_bridge_call_post_disable (next, - old_state); + state); } } } -drm_atomic_bridge_call_post_disable (bridge, old_state); +drm_atomic_bridge_call_post_disable (bridge, state);if (limit)/* Jump all bridges that we have already post_disabled */ bridge = limit; }
Signature · 1 line
2.48.0
Re: [PATCH v3 13/37] drm/bridge: Change parameter name of drm_atomic_bridge_chain_post_disable()
Quoted 4 lines · Maxime Ripard
drm_atomic_bridge_chain_post_disable()disables all bridges affected by a new commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_bridge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 14/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_update_legacy_modeset_state()
In reply to Maxime Riparddrm_atomic_helper_update_legacy_modeset_state() updates all the legacy modeset pointers a connector, encoder or CRTC might have with the ones being setup by a given commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +6 -6
@@ -1275,11 +1275,11 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *state) }/** * drm_atomic_helper_update_legacy_modeset_state - update legacy modeset state * @dev: DRM device -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This function updates all the various legacy modeset state pointers in * connectors, encoders and CRTCs. * * Drivers can use this for building their own atomic commit if they don't have
@@ -1291,20 +1291,20 @@ disable_outputs(struct drm_device *dev, struct drm_atomic_state *state)* the legacy state pointers are only really useful for transitioning an * existing driver to the atomic world. */ void drm_atomic_helper_update_legacy_modeset_state (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_connector *connector;struct drm_connector_state *old_conn_state, *new_conn_state;struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state;int i;/* clear out existing links and update dpms */ -for_each_oldnew_connector_in_state (old_state, connector, old_conn_state, new_conn_state, i) { +for_each_oldnew_connector_in_state (state, connector, old_conn_state, new_conn_state, i) {if (connector->encoder) {WARN_ON (!connector->encoder->crtc); connector->encoder->crtc =NULL ; connector->encoder =NULL ;
@@ -1321,11 +1321,11 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, connector->dpms = mode; } }/* set new links */ -for_each_new_connector_in_state (old_state, connector, new_conn_state, i) { +for_each_new_connector_in_state (state, connector, new_conn_state, i) {if (!new_conn_state->crtc)continue ;if (WARN_ON (!new_conn_state->best_encoder))continue ;
@@ -1333,19 +1333,19 @@ drm_atomic_helper_update_legacy_modeset_state(struct drm_device *dev, connector->encoder = new_conn_state->best_encoder; connector->encoder->crtc = new_conn_state->crtc; }/* set legacy state in the crtc structure */ -for_each_new_crtc_in_state (old_state, crtc, new_crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {struct drm_plane *primary = crtc->primary;struct drm_plane_state *new_plane_state; crtc->mode = new_crtc_state->mode; crtc->enabled = new_crtc_state->enable; new_plane_state = -drm_atomic_get_new_plane_state (old_state, primary); +drm_atomic_get_new_plane_state (state, primary);if (new_plane_state && new_plane_state->crtc == crtc) { crtc->x = new_plane_state->src_x >>16 ; crtc->y = new_plane_state->src_y >>16 ; }
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 15/37 drm/atomic-helper: Change parameter name of crtc_set_mode()
In reply to Maxime Ripardcrtc_set_mode() deals with calling the modeset related hooks for CRTC, connectors and bridges if and when a new commit changes them. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +3 -3
@@ -1373,19 +1373,19 @@ void drm_atomic_helper_calc_timestamping_constants(struct drm_atomic_state *stat } }EXPORT_SYMBOL (drm_atomic_helper_calc_timestamping_constants);static void -crtc_set_mode (struct drm_device *dev,struct drm_atomic_state *old_state) +crtc_set_mode (struct drm_device *dev,struct drm_atomic_state *state) {struct drm_crtc *crtc;struct drm_crtc_state *new_crtc_state;struct drm_connector *connector;struct drm_connector_state *new_conn_state;int i; -for_each_new_crtc_in_state (old_state, crtc, new_crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs;if (!new_crtc_state->mode_changed)continue ;
@@ -1397,11 +1397,11 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) funcs->mode_set_nofb (crtc); } } -for_each_new_connector_in_state (old_state, connector, new_conn_state, i) { +for_each_new_connector_in_state (state, connector, new_conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;struct drm_display_mode *mode, *adjusted_mode;struct drm_bridge *bridge;
Signature · 1 line
2.48.0
Maxime Ripard
maintainerPATCH v3 16/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_planes()
In reply to Maxime Riparddrm_atomic_helper_commit_planes() updates all planes affected by a new commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +12 -12
@@ -2729,19 +2729,19 @@ static bool plane_crtc_active(const struct drm_plane_state *state) }/** * drm_atomic_helper_commit_planes - commit plane state * @dev: DRM device -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * @flags: flags for committing plane state * * This function commits the new plane state using the plane and atomic helper * functions for planes and CRTCs. It assumes that the atomic state has already * been pushed into the relevant object state pointers, since this step can no * longer fail. * -* It still requires the global state object @old_state to know which planes and +* It still requires the global state object @state to know which planes and * crtcs need to be updated though. * * Note that this function does all plane updates across all CRTCs in one step. * If the hardware can't support this approach look at * drm_atomic_helper_commit_planes_on_crtc() instead.
@@ -2768,36 +2768,36 @@ static bool plane_crtc_active(const struct drm_plane_state *state)* The drm_atomic_helper_commit() default implementation doesn't set the * ACTIVE_ONLY flag to most closely match the behaviour of the legacy helpers. * This should not be copied blindly by drivers. */ void drm_atomic_helper_commit_planes (struct drm_device *dev, -struct drm_atomic_state *old_state, +struct drm_atomic_state *state,uint32_t flags) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_plane *plane;struct drm_plane_state *old_plane_state, *new_plane_state;int i;bool active_only = flags &DRM_PLANE_COMMIT_ACTIVE_ONLY ;bool no_disable = flags &DRM_PLANE_COMMIT_NO_DISABLE_AFTER_MODESET ; -for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;if (!funcs || !funcs->atomic_begin)continue ;if (active_only && !new_crtc_state->active)continue ; - funcs->atomic_begin (crtc, old_state); + funcs->atomic_begin (crtc, state); } -for_each_oldnew_plane_in_state (old_state, plane, old_plane_state, new_plane_state, i) { +for_each_oldnew_plane_in_state (state, plane, old_plane_state, new_plane_state, i) {const struct drm_plane_helper_funcs *funcs;bool disabling; funcs = plane->helper_private;
@@ -2831,40 +2831,40 @@ void drm_atomic_helper_commit_planes(struct drm_device *dev,if (drm_atomic_crtc_needs_modeset (crtc_state) && no_disable)continue ; - funcs->atomic_disable (plane, old_state); + funcs->atomic_disable (plane, state); }else if (new_plane_state->crtc || disabling) { - funcs->atomic_update (plane, old_state); + funcs->atomic_update (plane, state);if (!disabling && funcs->atomic_enable) {if (drm_atomic_plane_enabling (old_plane_state, new_plane_state)) - funcs->atomic_enable (plane, old_state); + funcs->atomic_enable (plane, state); } } } -for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs; funcs = crtc->helper_private;if (!funcs || !funcs->atomic_flush)continue ;if (active_only && !new_crtc_state->active)continue ; - funcs->atomic_flush (crtc, old_state); + funcs->atomic_flush (crtc, state); }/* * Signal end of framebuffer access here before hw_done. After hw_done, * a later commit might have already released the plane state. */ -for_each_old_plane_in_state (old_state, plane, old_plane_state, i) { +for_each_old_plane_in_state (state, plane, old_plane_state, i) {const struct drm_plane_helper_funcs *funcs = plane->helper_private;if (funcs->end_fb_access) funcs->end_fb_access (plane, old_plane_state); }
Signature · 1 line
2.48.0
Re: [PATCH v3 16/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_planes()
Quoted 11 lines · Maxime Ripard
drm_atomic_helper_commit_planes()updates all planes affected by a new commit. It takes thedrm_atomic_statebeing committed as a parameter.However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 17/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_modeset_enables()
In reply to Maxime Riparddrm_atomic_helper_commit_modeset_enables() enables all outputs affected by a new commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +9 -9
@@ -1484,11 +1484,11 @@ static void drm_atomic_helper_commit_writebacks(struct drm_device *dev, }/** * drm_atomic_helper_commit_modeset_enables - modeset commit to enable outputs * @dev: DRM device -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This function enables all the outputs with the new configuration which had to * be turned off for the update. * * For compatibility with legacy CRTC helpers this should be called after
@@ -1496,20 +1496,20 @@ static void drm_atomic_helper_commit_writebacks(struct drm_device *dev,* does. But drivers with different needs can group the modeset commits together * and do the plane commits at the end. This is useful for drivers doing runtime * PM since planes updates then only happen when the CRTC is actually enabled. */ void drm_atomic_helper_commit_modeset_enables (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;struct drm_crtc_state *new_crtc_state;struct drm_connector *connector;struct drm_connector_state *new_conn_state;int i; -for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {const struct drm_crtc_helper_funcs *funcs;/* Need to filter out CRTCs where only planes change. */ if (!drm_atomic_crtc_needs_modeset (new_crtc_state))continue ;
@@ -1521,17 +1521,17 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,if (new_crtc_state->enable) {drm_dbg_atomic (dev,"enabling [CRTC:%d:%s]\n" , crtc->base.id, crtc->name);if (funcs->atomic_enable) - funcs->atomic_enable (crtc, old_state); + funcs->atomic_enable (crtc, state);else if (funcs->commit) funcs->commit (crtc); } } -for_each_new_connector_in_state (old_state, connector, new_conn_state, i) { +for_each_new_connector_in_state (state, connector, new_conn_state, i) {const struct drm_encoder_helper_funcs *funcs;struct drm_encoder *encoder;struct drm_bridge *bridge;if (!new_conn_state->best_encoder)
@@ -1550,25 +1550,25 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev,/* * Each encoder has at most one connector (since we always steal * it away), so we won't call enable hooks twice. */ bridge =drm_bridge_chain_get_first_bridge (encoder); -drm_atomic_bridge_chain_pre_enable (bridge, old_state); +drm_atomic_bridge_chain_pre_enable (bridge, state);if (funcs) {if (funcs->atomic_enable) - funcs->atomic_enable (encoder, old_state); + funcs->atomic_enable (encoder, state);else if (funcs->enable) funcs->enable (encoder);else if (funcs->commit) funcs->commit (encoder); } -drm_atomic_bridge_chain_enable (bridge, old_state); +drm_atomic_bridge_chain_enable (bridge, state); } -drm_atomic_helper_commit_writebacks (dev, old_state); +drm_atomic_helper_commit_writebacks (dev, state); }EXPORT_SYMBOL (drm_atomic_helper_commit_modeset_enables);/* * For atomic updates which touch just a single CRTC, calculate the time of the
Signature · 1 line
2.48.0
Re: [PATCH v3 17/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_modeset_enables()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_commit_modeset_enables()enables all outputs affected by a new commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 18/37 drm/bridge: Change parameter name of drm_atomic_bridge_chain_pre_enable()
In reply to Maxime Riparddrm_atomic_bridge_chain_pre_enable() enables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_bridge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_bridge.c +7 -7
@@ -676,23 +676,23 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge, } }EXPORT_SYMBOL (drm_atomic_bridge_chain_post_disable);static void drm_atomic_bridge_call_pre_enable (struct drm_bridge *bridge, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) { -if (old_state && bridge->funcs->atomic_pre_enable) - bridge->funcs->atomic_pre_enable (bridge, old_state); +if (state && bridge->funcs->atomic_pre_enable) + bridge->funcs->atomic_pre_enable (bridge, state);else if (bridge->funcs->pre_enable) bridge->funcs->pre_enable (bridge); }/** * drm_atomic_bridge_chain_pre_enable - prepares for enabling all bridges in * the encoder chain * @bridge: bridge control structure -* @old_state: old atomic state +* @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_pre_enable (falls back on * &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 * &drm_encoder_helper_funcs.atomic_enable
@@ -708,11 +708,11 @@ static void drm_atomic_bridge_call_pre_enable(struct drm_bridge *bridge,* Bridge C, Bridge D, Bridge E, Bridge A, Bridge B. * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_pre_enable (struct drm_bridge *bridge, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_encoder *encoder;struct drm_bridge *iter, *next, *limit;if (!bridge)
@@ -747,15 +747,15 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,/* At the first bridge to request prev * bridges called first. */ break ; -drm_atomic_bridge_call_pre_enable (next, old_state); +drm_atomic_bridge_call_pre_enable (next, state); } } -drm_atomic_bridge_call_pre_enable (iter, old_state); +drm_atomic_bridge_call_pre_enable (iter, state);if (iter->pre_enable_prev_first)/* Jump all bridges that we have already pre_enabled */ iter = limit;
Signature · 1 line
2.48.0
Re: [PATCH v3 18/37] drm/bridge: Change parameter name of drm_atomic_bridge_chain_pre_enable()
Quoted 4 lines · Maxime Ripard
drm_atomic_bridge_chain_pre_enable()enables all bridges affected by a new commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_bridge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 19/37 drm/bridge: Change parameter name of drm_atomic_bridge_chain_enable()
In reply to Maxime Riparddrm_atomic_bridge_chain_enable() enables all bridges affected by a new commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_bridge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_bridge.c +3 -3
@@ -766,31 +766,31 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,EXPORT_SYMBOL (drm_atomic_bridge_chain_pre_enable);/** * drm_atomic_bridge_chain_enable - enables all bridges in the encoder chain * @bridge: bridge control structure -* @old_state: old atomic state +* @state: atomic state being committed * * Calls &drm_bridge_funcs.atomic_enable (falls back on * &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 * &drm_encoder_helper_funcs.atomic_enable * * Note: the bridge passed should be the one closest to the encoder */ void drm_atomic_bridge_chain_enable (struct drm_bridge *bridge, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_encoder *encoder;if (!bridge)return ; encoder = bridge->encoder;list_for_each_entry_from (bridge, &encoder->bridge_chain, chain_node) {if (bridge->funcs->atomic_enable) { - bridge->funcs->atomic_enable (bridge, old_state); + bridge->funcs->atomic_enable (bridge, state); }else if (bridge->funcs->enable) { bridge->funcs->enable (bridge); } } }
Signature · 1 line
2.48.0
Re: [PATCH v3 19/37] drm/bridge: Change parameter name of drm_atomic_bridge_chain_enable()
Quoted 10 lines · Maxime Ripard
drm_atomic_bridge_chain_enable()enables all bridges affected by a new commit. It takes thedrm_atomic_statebeing committed as a parameter.However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_bridge.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 20/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_writebacks()
In reply to Maxime Riparddrm_atomic_helper_commit_writebacks() updates all writeback connectors affected by a new commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +3 -3
@@ -1461,26 +1461,26 @@ void drm_atomic_helper_commit_modeset_disables(struct drm_device *dev,crtc_set_mode (dev, state); }EXPORT_SYMBOL (drm_atomic_helper_commit_modeset_disables);static void drm_atomic_helper_commit_writebacks (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_connector *connector;struct drm_connector_state *new_conn_state;int i; -for_each_new_connector_in_state (old_state, connector, new_conn_state, i) { +for_each_new_connector_in_state (state, connector, new_conn_state, i) {const struct drm_connector_helper_funcs *funcs; funcs = connector->helper_private;if (!funcs->atomic_commit)continue ;if (new_conn_state->writeback_job && new_conn_state->writeback_job->fb) {WARN_ON (connector->connector_type !=DRM_MODE_CONNECTOR_WRITEBACK ); - funcs->atomic_commit (connector, old_state); + funcs->atomic_commit (connector, state); } } }/**
Signature · 1 line
2.48.0
Re: [PATCH v3 20/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_writebacks()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_commit_writebacks()updates all writeback connectors affected by a new commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 21/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_fake_vblank()
In reply to Maxime Riparddrm_atomic_helper_fake_vblank() fake a vblank event if needed when a new commit is being applied. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +5 -5
@@ -2470,11 +2470,11 @@ void drm_atomic_helper_wait_for_dependencies(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_helper_wait_for_dependencies);/** * drm_atomic_helper_fake_vblank - fake VBLANK events if needed -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This function walks all CRTCs and fakes VBLANK events on those with * &drm_crtc_state.no_vblank set to true and &drm_crtc_state.event != NULL. * The primary use of this function is writeback connectors working in oneshot * mode and faking VBLANK events. In this case they only fake the VBLANK event
@@ -2486,29 +2486,29 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_dependencies);* VBLANK interrupt. * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_fake_vblank (struct drm_atomic_state *old_state) +void drm_atomic_helper_fake_vblank (struct drm_atomic_state *state) {struct drm_crtc_state *new_crtc_state;struct drm_crtc *crtc;int i; -for_each_new_crtc_in_state (old_state, crtc, new_crtc_state, i) { +for_each_new_crtc_in_state (state, crtc, new_crtc_state, i) {unsigned long flags;if (!new_crtc_state->no_vblank)continue ; -spin_lock_irqsave (&old_state->dev->event_lock, flags); +spin_lock_irqsave (&state->dev->event_lock, flags);if (new_crtc_state->event) {drm_crtc_send_vblank_event (crtc, new_crtc_state->event); new_crtc_state->event =NULL ; } -spin_unlock_irqrestore (&old_state->dev->event_lock, flags); +spin_unlock_irqrestore (&state->dev->event_lock, flags); } }EXPORT_SYMBOL (drm_atomic_helper_fake_vblank);/**
Signature · 1 line
2.48.0
Re: [PATCH v3 21/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_fake_vblank()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_fake_vblank()fake a vblank event if needed when a new commit is being applied. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 22/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_hw_done()
In reply to Maxime Riparddrm_atomic_helper_commit_hw_done() signals hardware completion of a given commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +6 -6
@@ -2511,11 +2511,11 @@ void drm_atomic_helper_fake_vblank(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_helper_fake_vblank);/** * drm_atomic_helper_commit_hw_done - setup possible nonblocking commit -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This function is used to signal completion of the hardware commit step. After * this step the driver is not allowed to read or change any permanent software * or hardware modeset state. The only exception is state protected by other * means than &drm_modeset_lock locks.
@@ -2524,18 +2524,18 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank);* this function is called. * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_commit_hw_done (struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_hw_done (struct drm_atomic_state *state) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state, *new_crtc_state;struct drm_crtc_commit *commit;int i; -for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { commit = new_crtc_state->commit;if (!commit)continue ;/*
@@ -2551,13 +2551,13 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state)/* backend must have consumed any event by now */ WARN_ON (new_crtc_state->event);complete_all (&commit->hw_done); } -if (old_state->fake_commit) { -complete_all (&old_state->fake_commit->hw_done); -complete_all (&old_state->fake_commit->flip_done); +if (state->fake_commit) { +complete_all (&state->fake_commit->hw_done); +complete_all (&state->fake_commit->flip_done); } }EXPORT_SYMBOL (drm_atomic_helper_commit_hw_done);/**
Signature · 1 line
2.48.0
Re: [PATCH v3 22/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_hw_done()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_commit_hw_done()signals hardware completion of a given commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 23/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_vblanks()
In reply to Maxime Riparddrm_atomic_helper_wait_for_vblanks() waits for vblank events on all the CRTCs affected by a commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +9 -9
@@ -1666,11 +1666,11 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev,EXPORT_SYMBOL (drm_atomic_helper_wait_for_fences);/** * drm_atomic_helper_wait_for_vblanks - wait for vblank on CRTCs * @dev: DRM device -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * Helper to, after atomic commit, wait for vblanks on all affected * CRTCs (ie. before cleaning up old framebuffers using * drm_atomic_helper_cleanup_planes()). It will only wait on CRTCs where the * framebuffers have actually changed to optimize for the legacy cursor and
@@ -1680,44 +1680,44 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_fences);* drm_atomic_helper_setup_commit() should look at * drm_atomic_helper_wait_for_flip_done() as an alternative. */ void drm_atomic_helper_wait_for_vblanks (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state, *new_crtc_state;int i, ret;unsigned int crtc_mask =0 ;/* * Legacy cursor ioctls are completely unsynced, and userspace * relies on that (by doing tons of cursor updates). */ -if (old_state->legacy_cursor_update) +if (state->legacy_cursor_update)return ; -for_each_oldnew_crtc_in_state (old_state, crtc, old_crtc_state, new_crtc_state, i) { +for_each_oldnew_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {if (!new_crtc_state->active)continue ; ret =drm_crtc_vblank_get (crtc);if (ret !=0 )continue ; crtc_mask |=drm_crtc_mask (crtc); - old_state->crtcs[i].last_vblank_count =drm_crtc_vblank_count (crtc); + state->crtcs[i].last_vblank_count =drm_crtc_vblank_count (crtc); } -for_each_old_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_old_crtc_in_state (state, crtc, old_crtc_state, i) {if (!(crtc_mask &drm_crtc_mask (crtc)))continue ; ret =wait_event_timeout (dev->vblank[i].queue, - old_state->crtcs[i].last_vblank_count != -drm_crtc_vblank_count (crtc), -msecs_to_jiffies (100 )); + state->crtcs[i].last_vblank_count != +drm_crtc_vblank_count (crtc), +msecs_to_jiffies (100 ));WARN (!ret,"[CRTC:%d:%s] vblank wait timed out\n" , crtc->base.id, crtc->name);drm_crtc_vblank_put (crtc);
Signature · 1 line
2.48.0
Re: [PATCH v3 23/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_vblanks()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_wait_for_vblanks()waits for vblank events on all the CRTCs affected by a commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 24/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_cleanup_planes()
In reply to Maxime Riparddrm_atomic_helper_cleanup_planes() is one of the final part of a commit, and will free up all plane resources used in the previous commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +4 -4
@@ -2987,28 +2987,28 @@ drm_atomic_helper_disable_planes_on_crtc(struct drm_crtc_state *old_crtc_state,EXPORT_SYMBOL (drm_atomic_helper_disable_planes_on_crtc);/** * drm_atomic_helper_cleanup_planes - cleanup plane resources after commit * @dev: DRM device -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * This function cleans up plane state, specifically framebuffers, from the old -* configuration. Hence the old configuration must be perserved in @old_state to +* configuration. Hence the old configuration must be perserved in @state to * be able to call this function. * * This function may not be called on the new state when the atomic update * fails at any point after calling drm_atomic_helper_prepare_planes(). Use * drm_atomic_helper_unprepare_planes() in this case. */ void drm_atomic_helper_cleanup_planes (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_plane *plane;struct drm_plane_state *old_plane_state;int i; -for_each_old_plane_in_state (old_state, plane, old_plane_state, i) { +for_each_old_plane_in_state (state, plane, old_plane_state, i) {const struct drm_plane_helper_funcs *funcs = plane->helper_private;if (funcs->cleanup_fb) funcs->cleanup_fb (plane, old_plane_state); }
Signature · 1 line
2.48.0
Re: [PATCH v3 24/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_cleanup_planes()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_cleanup_planes()is one of the final part of a commit, and will free up all plane resources used in the previous commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 25/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_cleanup_done()
In reply to Maxime Riparddrm_atomic_helper_wait_for_dependencies() is the final part of a commit and signals it completion. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +7 -7
@@ -2560,27 +2560,27 @@ void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *state) }EXPORT_SYMBOL (drm_atomic_helper_commit_hw_done);/** * drm_atomic_helper_commit_cleanup_done - signal completion of commit -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * -* This signals completion of the atomic update @old_state, including any +* This signals completion of the atomic update @state, including any * cleanup work. If used, it must be called right before calling * drm_atomic_state_put(). * * This is part of the atomic helper support for nonblocking commits, see * drm_atomic_helper_setup_commit() for an overview. */ -void drm_atomic_helper_commit_cleanup_done (struct drm_atomic_state *old_state) +void drm_atomic_helper_commit_cleanup_done (struct drm_atomic_state *state) {struct drm_crtc *crtc;struct drm_crtc_state *old_crtc_state;struct drm_crtc_commit *commit;int i; -for_each_old_crtc_in_state (old_state, crtc, old_crtc_state, i) { +for_each_old_crtc_in_state (state, crtc, old_crtc_state, i) { commit = old_crtc_state->commit;if (WARN_ON (!commit))continue ;complete_all (&commit->cleanup_done);
@@ -2589,13 +2589,13 @@ void drm_atomic_helper_commit_cleanup_done(struct drm_atomic_state *old_state)spin_lock (&crtc->commit_lock);list_del (&commit->commit_entry);spin_unlock (&crtc->commit_lock); } -if (old_state->fake_commit) { -complete_all (&old_state->fake_commit->cleanup_done); -WARN_ON (!try_wait_for_completion (&old_state->fake_commit->hw_done)); +if (state->fake_commit) { +complete_all (&state->fake_commit->cleanup_done); +WARN_ON (!try_wait_for_completion (&state->fake_commit->hw_done)); } }EXPORT_SYMBOL (drm_atomic_helper_commit_cleanup_done);/**
Signature · 1 line
2.48.0
Re: [PATCH v3 25/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_commit_cleanup_done()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_wait_for_dependencies()is the final part of a commit and signals it completion. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 26/37 drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_flip_done()
In reply to Maxime Riparddrm_atomic_helper_wait_for_flip_done() will wait for pages flips on all CRTCs affected by a given commit. It takes the drm_atomic_state being committed as a parameter.
However, that parameter name is called (and documented) as old_state, which is pretty confusing. Let's rename that variable as state.
--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_atomic_helper.c +6 -6
@@ -1726,11 +1726,11 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev,EXPORT_SYMBOL (drm_atomic_helper_wait_for_vblanks);/** * drm_atomic_helper_wait_for_flip_done - wait for all page flips to be done * @dev: DRM device -* @old_state: atomic state object with old state structures +* @state: atomic state object being committed * * Helper to, after atomic commit, wait for page flips on all affected * crtcs (ie. before cleaning up old framebuffers using * drm_atomic_helper_cleanup_planes()). Compared to * drm_atomic_helper_wait_for_vblanks() this waits for the completion on all
@@ -1739,32 +1739,32 @@ EXPORT_SYMBOL(drm_atomic_helper_wait_for_vblanks);* * This requires that drivers use the nonblocking commit tracking support * initialized using drm_atomic_helper_setup_commit(). */ void drm_atomic_helper_wait_for_flip_done (struct drm_device *dev, -struct drm_atomic_state *old_state) +struct drm_atomic_state *state) {struct drm_crtc *crtc;int i;for (i =0 ; i < dev->mode_config.num_crtc; i++) { -struct drm_crtc_commit *commit = old_state->crtcs[i].commit; +struct drm_crtc_commit *commit = state->crtcs[i].commit;int ret; - crtc = old_state->crtcs[i].ptr; + crtc = state->crtcs[i].ptr;if (!crtc || !commit)continue ; ret =wait_for_completion_timeout (&commit->flip_done,10 *HZ );if (ret ==0 )drm_err (dev,"[CRTC:%d:%s] flip_done timed out\n" , crtc->base.id, crtc->name); } -if (old_state->fake_commit) -complete_all (&old_state->fake_commit->flip_done); +if (state->fake_commit) +complete_all (&state->fake_commit->flip_done); }EXPORT_SYMBOL (drm_atomic_helper_wait_for_flip_done);/** * drm_atomic_helper_commit_tail - commit atomic update to hardware
Signature · 1 line
2.48.0
Re: [PATCH v3 26/37] drm/atomic-helper: Change parameter name of drm_atomic_helper_wait_for_flip_done()
Quoted 4 lines · Maxime Ripard
drm_atomic_helper_wait_for_flip_done()will wait for pages flips on all CRTCs affected by a given commit. It takes thedrm_atomic_statebeing committed as a parameter.
Quoted 8 lines
However, that parameter name is called (and documented) as
old_state, which is pretty confusing. Let's rename that variable as state.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_helper.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 27/37 drm/bridge: Add encoder parameter to drm_bridge_funcs.attach
In reply to Maxime RipardThe drm_bridge structure contains an encoder pointer that is widely used by bridge drivers. This pattern is largely documented as deprecated in other KMS entities for atomic drivers.
However, one of the main use of that pointer is done in attach to just call drm_bridge_attach on the next bridge to add it to the bridge list. While this dereferences the bridge->encoder pointer, it's effectively the same encoder the bridge was being attached to.
We can make it more explicit by adding the encoder the bridge is attached to to the list of attach parameters. This also removes the need to dereference bridge->encoder in most drivers.
--- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 3 ++- drivers/gpu/drm/bridge/analogix/analogix-anx6345.c | 3 ++- drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c | 3 ++- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 2 +- drivers/gpu/drm/bridge/analogix/anx7625.c | 3 ++- drivers/gpu/drm/bridge/aux-bridge.c | 3 ++- drivers/gpu/drm/bridge/aux-hpd-bridge.c | 1 + drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 3 ++- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 1 + drivers/gpu/drm/bridge/chipone-icn6211.c | 6 ++++-- drivers/gpu/drm/bridge/chrontel-ch7033.c | 5 +++-- drivers/gpu/drm/bridge/display-connector.c | 1 + drivers/gpu/drm/bridge/fsl-ldb.c | 3 ++- drivers/gpu/drm/bridge/imx/imx-ldb-helper.c | 7 +++---- drivers/gpu/drm/bridge/imx/imx-ldb-helper.h | 2 +- drivers/gpu/drm/bridge/imx/imx-legacy-bridge.c | 3 ++- drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c | 3 ++- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c | 3 ++- drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c | 3 ++- drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 3 ++- drivers/gpu/drm/bridge/ite-it6263.c | 7 ++++--- drivers/gpu/drm/bridge/ite-it6505.c | 1 + drivers/gpu/drm/bridge/ite-it66121.c | 3 ++- drivers/gpu/drm/bridge/lontium-lt8912b.c | 3 ++- drivers/gpu/drm/bridge/lontium-lt9211.c | 3 ++- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 3 ++- drivers/gpu/drm/bridge/lvds-codec.c | 3 ++- drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c | 1 + drivers/gpu/drm/bridge/microchip-lvds.c | 3 ++- drivers/gpu/drm/bridge/nwl-dsi.c | 3 ++- drivers/gpu/drm/bridge/nxp-ptn3460.c | 5 +++-- drivers/gpu/drm/bridge/panel.c | 3 ++- drivers/gpu/drm/bridge/parade-ps8622.c | 1 + drivers/gpu/drm/bridge/parade-ps8640.c | 3 ++- drivers/gpu/drm/bridge/samsung-dsim.c | 3 ++- drivers/gpu/drm/bridge/sii902x.c | 5 +++-- drivers/gpu/drm/bridge/sil-sii8620.c | 1 + drivers/gpu/drm/bridge/simple-bridge.c | 5 +++-- drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 3 ++- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c | 5 +++-- drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c | 5 +++-- drivers/gpu/drm/bridge/tc358762.c | 3 ++- drivers/gpu/drm/bridge/tc358764.c | 3 ++- drivers/gpu/drm/bridge/tc358767.c | 2 ++ drivers/gpu/drm/bridge/tc358768.c | 3 ++- drivers/gpu/drm/bridge/tc358775.c | 3 ++- drivers/gpu/drm/bridge/thc63lvd1024.c | 3 ++- drivers/gpu/drm/bridge/ti-dlpc3433.c | 4 ++-- drivers/gpu/drm/bridge/ti-sn65dsi83.c | 3 ++- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 3 ++- drivers/gpu/drm/bridge/ti-tdp158.c | 6 ++++-- drivers/gpu/drm/bridge/ti-tfp410.c | 5 +++-- drivers/gpu/drm/bridge/ti-tpd12s015.c | 3 ++- drivers/gpu/drm/drm_bridge.c | 2 +- drivers/gpu/drm/i2c/tda998x_drv.c | 1 + drivers/gpu/drm/imx/ipuv3/parallel-display.c | 3 ++- drivers/gpu/drm/ingenic/ingenic-drm-drv.c | 5 +++-- drivers/gpu/drm/mcde/mcde_dsi.c | 3 ++- drivers/gpu/drm/mediatek/mtk_dp.c | 3 ++- drivers/gpu/drm/mediatek/mtk_dpi.c | 3 ++- drivers/gpu/drm/mediatek/mtk_dsi.c | 3 ++- drivers/gpu/drm/mediatek/mtk_hdmi.c | 3 ++- drivers/gpu/drm/meson/meson_encoder_cvbs.c | 3 ++- drivers/gpu/drm/meson/meson_encoder_dsi.c | 3 ++- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 3 ++- drivers/gpu/drm/msm/dsi/dsi_manager.c | 3 ++- drivers/gpu/drm/omapdrm/dss/dpi.c | 3 ++- drivers/gpu/drm/omapdrm/dss/dsi.c | 3 ++- drivers/gpu/drm/omapdrm/dss/hdmi4.c | 3 ++- drivers/gpu/drm/omapdrm/dss/hdmi5.c | 3 ++- drivers/gpu/drm/omapdrm/dss/sdi.c | 3 ++- drivers/gpu/drm/omapdrm/dss/venc.c | 3 ++- drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c | 3 ++- drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c | 3 ++- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 3 ++- drivers/gpu/drm/stm/lvds.c | 11 +++++------ drivers/gpu/drm/tidss/tidss_encoder.c | 3 ++- drivers/gpu/drm/vc4/vc4_dsi.c | 3 ++- drivers/gpu/drm/xlnx/zynqmp_dp.c | 3 ++- drivers/platform/arm64/acer-aspire1-ec.c | 3 ++- include/drm/drm_bridge.h | 2 +- 82 files changed, 170 insertions(+), 94 deletions(-)
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +2 -1
@@ -946,17 +946,18 @@ static enum drm_mode_status adv7511_bridge_mode_valid(struct drm_bridge *bridge,else return adv7511_mode_valid (adv, mode); }static int adv7511_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct adv7511 *adv =bridge_to_adv7511 (bridge);int ret =0 ;if (adv->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, adv->next_bridge, bridge, + ret =drm_bridge_attach (encoder, adv->next_bridge, bridge, flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret)return ret; }
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c +2 -1
@@ -515,10 +515,11 @@ static const struct drm_connector_funcs anx6345_connector_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int anx6345_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct anx6345 *anx6345 =bridge_to_anx6345 (bridge);int err;
@@ -551,11 +552,11 @@ static int anx6345_bridge_attach(struct drm_bridge *bridge, &anx6345_connector_helper_funcs); anx6345->connector.polled =DRM_CONNECTOR_POLL_HPD ; err =drm_connector_attach_encoder (&anx6345->connector, - bridge->encoder); + encoder);if (err) {DRM_ERROR ("Failed to link up connector to encoder: %d\n" , err); goto connector_cleanup; }
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c +2 -1
@@ -886,10 +886,11 @@ static const struct drm_connector_funcs anx78xx_connector_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int anx78xx_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct anx78xx *anx78xx =bridge_to_anx78xx (bridge);int err;
@@ -922,11 +923,11 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge, &anx78xx_connector_helper_funcs); anx78xx->connector.polled =DRM_CONNECTOR_POLL_HPD ; err =drm_connector_attach_encoder (&anx78xx->connector, - bridge->encoder); + encoder);if (err) {DRM_ERROR ("Failed to link up connector to encoder: %d\n" , err); goto connector_cleanup; }
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +1 -1
@@ -1111,14 +1111,14 @@ static const struct drm_connector_funcs analogix_dp_connector_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int analogix_dp_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct analogix_dp_device *dp = bridge->driver_private; -struct drm_encoder *encoder = dp->encoder;struct drm_connector *connector =NULL ;int ret =0 ;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) {DRM_ERROR ("Fix bridge driver to make connector optional!" );
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -1
@@ -2139,10 +2139,11 @@ static void hdcp_check_work_func(struct work_struct *work)mutex_unlock (&ctx->hdcp_wq_lock);drm_modeset_unlock (&drm_dev->mode_config.connection_mutex); }static int anx7625_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct anx7625_data *ctx =bridge_to_anx7625 (bridge);int err;struct device *dev = ctx->dev;
@@ -2157,11 +2158,11 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge,dev_err (dev,"failed to register aux channel: %d\n" , err);return err; }if (ctx->pdata.panel_bridge) { - err =drm_bridge_attach (bridge->encoder, + err =drm_bridge_attach (encoder, ctx->pdata.panel_bridge, &ctx->bridge, flags);if (err)return err; }
drivers/gpu/drm/bridge/aux-bridge.c +2 -1
@@ -84,20 +84,21 @@ struct drm_aux_bridge_data {struct drm_bridge *next_bridge;struct device *dev; };static int drm_aux_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct drm_aux_bridge_data *data;if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; data = container_of(bridge, struct drm_aux_bridge_data, bridge); -return drm_bridge_attach (bridge->encoder, data->next_bridge, bridge, +return drm_bridge_attach (encoder, data->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR ); }static const struct drm_bridge_funcs drm_aux_bridge_funcs = { .attach = drm_aux_bridge_attach,
drivers/gpu/drm/bridge/aux-hpd-bridge.c +1 -0
@@ -154,10 +154,11 @@ void drm_aux_hpd_bridge_notify(struct device *dev, enum drm_connector_status stadrm_bridge_hpd_notify (&data->bridge, status); }EXPORT_SYMBOL_GPL (drm_aux_hpd_bridge_notify);static int drm_aux_hpd_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {return flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ?0 : -EINVAL ; }
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +2 -1
@@ -603,10 +603,11 @@ static int cdns_dsi_check_conf(struct cdns_dsi *dsi,return 0 ; }static int cdns_dsi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct cdns_dsi_input *input =bridge_to_cdns_dsi_input (bridge);struct cdns_dsi *dsi =input_to_dsi (input);struct cdns_dsi_output *output = &dsi->output;
@@ -615,11 +616,11 @@ static int cdns_dsi_bridge_attach(struct drm_bridge *bridge,dev_err (dsi->base.dev,"cdns-dsi driver is only compatible with DRM devices supporting atomic updates" );return -ENOTSUPP ; } -return drm_bridge_attach (bridge->encoder, output->bridge, bridge, +return drm_bridge_attach (encoder, output->bridge, bridge, flags); } static enum drm_mode_status cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +1 -0
@@ -1724,10 +1724,11 @@ static int cdns_mhdp_connector_init(struct cdns_mhdp_device *mhdp)return ret; }static int cdns_mhdp_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct cdns_mhdp_device *mhdp =bridge_to_mhdp (bridge);bool hw_ready;int ret;
drivers/gpu/drm/bridge/chipone-icn6211.c +4 -2
@@ -578,15 +578,17 @@ static int chipone_dsi_host_attach(struct chipone *icn)mipi_dsi_device_unregister (dsi);return ret; } -static int chipone_attach (struct drm_bridge *bridge,enum drm_bridge_attach_flags flags) +static int chipone_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder, +enum drm_bridge_attach_flags flags) {struct chipone *icn =bridge_to_chipone (bridge); -return drm_bridge_attach (bridge->encoder, icn->panel_bridge, bridge, flags); +return drm_bridge_attach (encoder, icn->panel_bridge, bridge, flags); }#define MAX_INPUT_SEL_FORMATS 1 static u32 *
drivers/gpu/drm/bridge/chrontel-ch7033.c +3 -2
@@ -266,17 +266,18 @@ static void ch7033_hpd_event(void *arg, enum drm_connector_status status)if (priv->bridge.dev)drm_helper_hpd_irq_event (priv->connector.dev); }static int ch7033_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct ch7033_priv *priv =bridge_to_ch7033_priv (bridge);struct drm_connector *connector = &priv->connector;int ret; - ret =drm_bridge_attach (bridge->encoder, priv->next_bridge, bridge, + ret =drm_bridge_attach (encoder, priv->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret)return ret;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )
@@ -303,11 +304,11 @@ static int ch7033_bridge_attach(struct drm_bridge *bridge,if (ret) {DRM_ERROR ("Failed to initialize connector\n" );return ret; } -return drm_connector_attach_encoder (&priv->connector, bridge->encoder); +return drm_connector_attach_encoder (&priv->connector, encoder); }static void ch7033_bridge_detach (struct drm_bridge *bridge) {struct ch7033_priv *priv =bridge_to_ch7033_priv (bridge);
drivers/gpu/drm/bridge/display-connector.c +1 -0
@@ -32,10 +32,11 @@ to_display_connector(struct drm_bridge *bridge) { return container_of(bridge, struct display_connector, bridge); }static int display_connector_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {return flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ?0 : -EINVAL ; }
drivers/gpu/drm/bridge/fsl-ldb.c +2 -1
@@ -111,15 +111,16 @@ static unsigned long fsl_ldb_link_frequency(struct fsl_ldb *fsl_ldb, int clock)else return clock *7000 ; }static int fsl_ldb_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct fsl_ldb *fsl_ldb =to_fsl_ldb (bridge); -return drm_bridge_attach (bridge->encoder, fsl_ldb->panel_bridge, +return drm_bridge_attach (encoder, fsl_ldb->panel_bridge, bridge, flags); }static void fsl_ldb_atomic_enable (struct drm_bridge *bridge,struct drm_atomic_state *state)
drivers/gpu/drm/bridge/imx/imx-ldb-helper.c +3 -4
@@ -102,11 +102,11 @@ void ldb_bridge_disable_helper(struct drm_bridge *bridge)regmap_write (ldb->regmap, ldb->ctrl_reg, ldb->ldb_ctrl); }EXPORT_SYMBOL_GPL (ldb_bridge_disable_helper); -int ldb_bridge_attach_helper (struct drm_bridge *bridge, +int ldb_bridge_attach_helper (struct drm_bridge *bridge,struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct ldb_channel *ldb_ch = bridge->driver_private;struct ldb *ldb = ldb_ch->ldb;
@@ -114,13 +114,12 @@ int ldb_bridge_attach_helper(struct drm_bridge *bridge,DRM_DEV_ERROR (ldb->dev,"do not support creating a drm_connector\n" );return -EINVAL ; } -return drm_bridge_attach (bridge->encoder, - ldb_ch->next_bridge, bridge, -DRM_BRIDGE_ATTACH_NO_CONNECTOR ); +return drm_bridge_attach (encoder, ldb_ch->next_bridge, bridge, +DRM_BRIDGE_ATTACH_NO_CONNECTOR ); }EXPORT_SYMBOL_GPL (ldb_bridge_attach_helper);int ldb_init_helper (struct ldb *ldb) {
drivers/gpu/drm/bridge/imx/imx-ldb-helper.h +1 -1
@@ -79,11 +79,11 @@ void ldb_bridge_mode_set_helper(struct drm_bridge *bridge,void ldb_bridge_enable_helper (struct drm_bridge *bridge);void ldb_bridge_disable_helper (struct drm_bridge *bridge); -int ldb_bridge_attach_helper (struct drm_bridge *bridge, +int ldb_bridge_attach_helper (struct drm_bridge *bridge,struct drm_encoder *encoder,enum drm_bridge_attach_flags flags);int ldb_init_helper (struct ldb *ldb);int ldb_find_next_bridge_helper (struct ldb *ldb);
drivers/gpu/drm/bridge/imx/imx-legacy-bridge.c +2 -1
@@ -21,11 +21,12 @@ struct imx_legacy_bridge { };#define to_imx_legacy_bridge (bridge) container_of(bridge, struct imx_legacy_bridge, base)static int imx_legacy_bridge_attach (struct drm_bridge *bridge, -enum drm_bridge_attach_flags flags) +struct drm_encoder *encoder, +enum drm_bridge_attach_flags flags) {if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ;return 0 ;
drivers/gpu/drm/bridge/imx/imx8mp-hdmi-pvi.c +2 -1
@@ -38,15 +38,16 @@ to_imx8mp_hdmi_pvi(struct drm_bridge *bridge) { return container_of(bridge, struct imx8mp_hdmi_pvi, bridge); }static int imx8mp_hdmi_pvi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct imx8mp_hdmi_pvi *pvi =to_imx8mp_hdmi_pvi (bridge); -return drm_bridge_attach (bridge->encoder, pvi->next_bridge, +return drm_bridge_attach (encoder, pvi->next_bridge, bridge, flags); }static void imx8mp_hdmi_pvi_bridge_enable (struct drm_bridge *bridge,struct drm_atomic_state *state)
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-combiner.c +2 -1
@@ -106,10 +106,11 @@ imx8qxp_pc_bridge_mode_valid(struct drm_bridge *bridge,return MODE_OK ; }static int imx8qxp_pc_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct imx8qxp_pc_channel *ch = bridge->driver_private;struct imx8qxp_pc *pc = ch->pc;
@@ -117,11 +118,11 @@ static int imx8qxp_pc_bridge_attach(struct drm_bridge *bridge,DRM_DEV_ERROR (pc->dev,"do not support creating a drm_connector\n" );return -EINVAL ; } -return drm_bridge_attach (bridge->encoder, +return drm_bridge_attach (encoder, ch->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR ); } static void
drivers/gpu/drm/bridge/imx/imx8qxp-pixel-link.c +2 -1
@@ -126,21 +126,22 @@ static void imx8qxp_pixel_link_set_mst_addr(struct imx8qxp_pixel_link *pl)"failed to set DC%u stream%u pixel link mst addr(%u): %d\n" , pl->dc_id, pl->stream_id, pl->mst_addr, ret); }static int imx8qxp_pixel_link_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct imx8qxp_pixel_link *pl = bridge->driver_private;if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) {DRM_DEV_ERROR (pl->dev,"do not support creating a drm_connector\n" );return -EINVAL ; } -return drm_bridge_attach (bridge->encoder, +return drm_bridge_attach (encoder, pl->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR ); } static void
drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c +2 -1
@@ -46,21 +46,22 @@ struct imx8qxp_pxl2dpi { };#define bridge_to_p2d (b) container_of(b, struct imx8qxp_pxl2dpi, bridge)static int imx8qxp_pxl2dpi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct imx8qxp_pxl2dpi *p2d = bridge->driver_private;if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )) {DRM_DEV_ERROR (p2d->dev,"do not support creating a drm_connector\n" );return -EINVAL ; } -return drm_bridge_attach (bridge->encoder, +return drm_bridge_attach (encoder, p2d->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR ); } static int
drivers/gpu/drm/bridge/ite-it6263.c +4 -3
@@ -663,33 +663,34 @@ it6263_bridge_mode_valid(struct drm_bridge *bridge,return bridge->funcs->hdmi_tmds_char_rate_valid (bridge, mode, rate); }static int it6263_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct it6263 *it =bridge_to_it6263 (bridge);struct drm_connector *connector;int ret; - ret =drm_bridge_attach (bridge->encoder, it->next_bridge, bridge, + ret =drm_bridge_attach (encoder, it->next_bridge, bridge, flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret <0 )return ret;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )return 0 ; - connector =drm_bridge_connector_init (bridge->dev, bridge->encoder); + connector =drm_bridge_connector_init (bridge->dev, encoder);if (IS_ERR (connector)) { ret =PTR_ERR (connector);dev_err (it->dev,"failed to initialize bridge connector: %d\n" , ret);return ret; } -drm_connector_attach_encoder (connector, bridge->encoder); +drm_connector_attach_encoder (connector, encoder);return 0 ; }static enum drm_connector_status it6263_bridge_detect (struct drm_bridge *bridge)
drivers/gpu/drm/bridge/ite-it6505.c +1 -0
@@ -3122,10 +3122,11 @@ static inline struct it6505 *bridge_to_it6505(struct drm_bridge *bridge) { return container_of(bridge, struct it6505, bridge); }static int it6505_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct it6505 *it6505 =bridge_to_it6505 (bridge);struct device *dev = it6505->dev;int ret;
drivers/gpu/drm/bridge/ite-it66121.c +2 -1
@@ -584,19 +584,20 @@ static bool it66121_is_hpd_detect(struct it66121_ctx *ctx)return val &IT66121_SYS_STATUS_HPDETECT ; }static int it66121_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) { struct it66121_ctx *ctx = container_of(bridge, struct it66121_ctx, bridge);int ret;if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; - ret =drm_bridge_attach (bridge->encoder, ctx->next_bridge, bridge, flags); + ret =drm_bridge_attach (encoder, ctx->next_bridge, bridge, flags);if (ret)return ret;if (ctx->info->id ==ID_IT66121 ) { ret = regmap_write_bits(ctx->regmap, IT66121_CLK_BANK_REG,
drivers/gpu/drm/bridge/lontium-lt8912b.c +2 -1
@@ -541,16 +541,17 @@ static int lt8912_bridge_connector_init(struct drm_bridge *bridge) exit:return ret; }static int lt8912_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct lt8912 *lt =bridge_to_lt8912 (bridge);int ret; - ret =drm_bridge_attach (bridge->encoder, lt->hdmi_port, bridge, + ret =drm_bridge_attach (encoder, lt->hdmi_port, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret <0 ) {dev_err (lt->dev,"Failed to attach next bridge (%d)\n" , ret);return ret; }
drivers/gpu/drm/bridge/lontium-lt9211.c +2 -1
@@ -97,15 +97,16 @@ static struct lt9211 *bridge_to_lt9211(struct drm_bridge *bridge) { return container_of(bridge, struct lt9211, bridge); }static int lt9211_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct lt9211 *ctx =bridge_to_lt9211 (bridge); -return drm_bridge_attach (bridge->encoder, ctx->panel_bridge, +return drm_bridge_attach (encoder, ctx->panel_bridge, &ctx->bridge, flags); }static int lt9211_read_chipid (struct lt9211 *ctx) {
drivers/gpu/drm/bridge/lontium-lt9611.c +2 -1
@@ -738,15 +738,16 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,return dsi; }static int lt9611_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct lt9611 *lt9611 =bridge_to_lt9611 (bridge); -return drm_bridge_attach (bridge->encoder, lt9611->next_bridge, +return drm_bridge_attach (encoder, lt9611->next_bridge, bridge, flags); } static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info,
drivers/gpu/drm/bridge/lontium-lt9611uxc.c +2 -1
@@ -278,15 +278,16 @@ static struct mipi_dsi_device *lt9611uxc_attach_dsi(struct lt9611uxc *lt9611uxc,return dsi; }static int lt9611uxc_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct lt9611uxc *lt9611uxc =bridge_to_lt9611uxc (bridge); -return drm_bridge_attach (bridge->encoder, lt9611uxc->next_bridge, +return drm_bridge_attach (encoder, lt9611uxc->next_bridge, bridge, flags); } static enum drm_mode_status lt9611uxc_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/bridge/lvds-codec.c +2 -1
@@ -32,15 +32,16 @@ static inline struct lvds_codec *to_lvds_codec(struct drm_bridge *bridge) { return container_of(bridge, struct lvds_codec, bridge); }static int lvds_codec_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct lvds_codec *lvds_codec =to_lvds_codec (bridge); -return drm_bridge_attach (bridge->encoder, lvds_codec->panel_bridge, +return drm_bridge_attach (encoder, lvds_codec->panel_bridge, bridge, flags); }static void lvds_codec_enable (struct drm_bridge *bridge) {
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c +1 -0
@@ -188,10 +188,11 @@ static irqreturn_t ge_b850v3_lvds_irq_handler(int irq, void *dev_id)return IRQ_HANDLED ; }static int ge_b850v3_lvds_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct i2c_client *stdp4028_i2c = ge_b850v3_lvds_ptr->stdp4028_i2c;
drivers/gpu/drm/bridge/microchip-lvds.c +2 -1
@@ -102,15 +102,16 @@ static void lvds_serialiser_on(struct mchp_lvds *lvds)/* Enable the LVDS serializer */ lvds_writel (lvds,LVDSC_CR ,LVDSC_CR_SER_EN ); }static int mchp_lvds_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct mchp_lvds *lvds =bridge_to_lvds (bridge); -return drm_bridge_attach (bridge->encoder, lvds->panel_bridge, +return drm_bridge_attach (encoder, lvds->panel_bridge, bridge, flags); }static void mchp_lvds_enable (struct drm_bridge *bridge) {
drivers/gpu/drm/bridge/nwl-dsi.c +2 -1
@@ -908,20 +908,21 @@ static void nwl_dsi_bridge_atomic_enable(struct drm_bridge *bridge,if (ret <0 )DRM_DEV_ERROR (dsi->dev,"Failed to deassert DPI: %d\n" , ret); }static int nwl_dsi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct nwl_dsi *dsi =bridge_to_dsi (bridge);struct drm_bridge *panel_bridge; panel_bridge =devm_drm_of_get_bridge (dsi->dev, dsi->dev->of_node,1 ,0 );if (IS_ERR (panel_bridge))return PTR_ERR (panel_bridge); -return drm_bridge_attach (bridge->encoder, panel_bridge, bridge, flags); +return drm_bridge_attach (encoder, panel_bridge, bridge, flags); } static u32 *nwl_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state,
drivers/gpu/drm/bridge/nxp-ptn3460.c +3 -2
@@ -212,17 +212,18 @@ static const struct drm_connector_funcs ptn3460_connector_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int ptn3460_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct ptn3460_bridge *ptn_bridge =bridge_to_ptn3460 (bridge);int ret;/* Let this driver create connector if requested */ - ret =drm_bridge_attach (bridge->encoder, ptn_bridge->panel_bridge, + ret =drm_bridge_attach (encoder, ptn_bridge->panel_bridge, bridge, flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret <0 )return ret;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )
@@ -237,11 +238,11 @@ static int ptn3460_bridge_attach(struct drm_bridge *bridge, }drm_connector_helper_add (&ptn_bridge->connector, &ptn3460_connector_helper_funcs);drm_connector_register (&ptn_bridge->connector);drm_connector_attach_encoder (&ptn_bridge->connector, - bridge->encoder); + encoder);drm_helper_hpd_irq_event (ptn_bridge->connector.dev);return ret; }
drivers/gpu/drm/bridge/panel.c +2 -1
@@ -56,10 +56,11 @@ static const struct drm_connector_funcs panel_bridge_connector_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int panel_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct panel_bridge *panel_bridge =drm_bridge_to_panel_bridge (bridge);struct drm_connector *connector = &panel_bridge->connector;int ret;
@@ -79,11 +80,11 @@ static int panel_bridge_attach(struct drm_bridge *bridge, }drm_panel_bridge_set_orientation (connector, bridge);drm_connector_attach_encoder (&panel_bridge->connector, - bridge->encoder); + encoder);if (bridge->dev->registered) {if (connector->funcs->reset) connector->funcs->reset (connector);drm_connector_register (connector);
drivers/gpu/drm/bridge/parade-ps8622.c +1 -0
@@ -416,10 +416,11 @@ static void ps8622_post_disable(struct drm_bridge *bridge)msleep (PS8622_POWER_OFF_T17_MS ); }static int ps8622_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct ps8622_bridge *ps8622 =bridge_to_ps8622 (bridge); return drm_bridge_attach(ps8622->bridge.encoder, ps8622->panel_bridge,
drivers/gpu/drm/bridge/parade-ps8640.c +2 -1
@@ -492,10 +492,11 @@ static void ps8640_atomic_post_disable(struct drm_bridge *bridge,mutex_unlock (&ps_bridge->aux_lock); }static int ps8640_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct ps8640 *ps_bridge =bridge_to_ps8640 (bridge);struct device *dev = &ps_bridge->page[0 ]->dev;int ret;
@@ -516,11 +517,11 @@ static int ps8640_bridge_attach(struct drm_bridge *bridge, ret = -EINVAL ; goto err_devlink; }/* Attach the panel-bridge to the dsi bridge */ - ret =drm_bridge_attach (bridge->encoder, ps_bridge->panel_bridge, + ret =drm_bridge_attach (encoder, ps_bridge->panel_bridge, &ps_bridge->bridge, flags);if (ret) goto err_bridge_attach;return 0 ;
drivers/gpu/drm/bridge/samsung-dsim.c +2 -1
@@ -1638,15 +1638,16 @@ static void samsung_dsim_mode_set(struct drm_bridge *bridge,drm_mode_copy (&dsi->mode, adjusted_mode); }static int samsung_dsim_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct samsung_dsim *dsi =bridge_to_dsi (bridge); -return drm_bridge_attach (bridge->encoder, dsi->out_bridge, bridge, +return drm_bridge_attach (encoder, dsi->out_bridge, bridge, flags); }static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
drivers/gpu/drm/bridge/sii902x.c +3 -2
@@ -414,19 +414,20 @@ static void sii902x_bridge_mode_set(struct drm_bridge *bridge, out:mutex_unlock (&sii902x->mutex); }static int sii902x_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct sii902x *sii902x =bridge_to_sii902x (bridge);u32 bus_format =MEDIA_BUS_FMT_RGB888_1X24 ;struct drm_device *drm = bridge->dev;int ret;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) -return drm_bridge_attach (bridge->encoder, sii902x->next_bridge, +return drm_bridge_attach (encoder, sii902x->next_bridge, bridge, flags);drm_connector_helper_add (&sii902x->connector, &sii902x_connector_helper_funcs);
@@ -450,11 +451,11 @@ static int sii902x_bridge_attach(struct drm_bridge *bridge, ret =drm_display_info_set_bus_formats (&sii902x->connector.display_info, &bus_format,1 );if (ret)return ret; -drm_connector_attach_encoder (&sii902x->connector, bridge->encoder); +drm_connector_attach_encoder (&sii902x->connector, encoder);return 0 ; }static enum drm_connector_status sii902x_bridge_detect (struct drm_bridge *bridge)
drivers/gpu/drm/bridge/sil-sii8620.c +1 -0
@@ -2201,10 +2201,11 @@ static inline struct sii8620 *bridge_to_sii8620(struct drm_bridge *bridge) { return container_of(bridge, struct sii8620, bridge); }static int sii8620_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct sii8620 *ctx =bridge_to_sii8620 (bridge);sii8620_init_rcp_input_dev (ctx);
drivers/gpu/drm/bridge/simple-bridge.c +3 -2
@@ -101,16 +101,17 @@ static const struct drm_connector_funcs simple_bridge_con_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int simple_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct simple_bridge *sbridge =drm_bridge_to_simple_bridge (bridge);int ret; - ret =drm_bridge_attach (bridge->encoder, sbridge->next_bridge, bridge, + ret =drm_bridge_attach (encoder, sbridge->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret <0 )return ret;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )
@@ -125,11 +126,11 @@ static int simple_bridge_attach(struct drm_bridge *bridge,if (ret) {DRM_ERROR ("Failed to initialize connector\n" );return ret; } -drm_connector_attach_encoder (&sbridge->connector, bridge->encoder); +drm_connector_attach_encoder (&sbridge->connector, encoder);return 0 ; }static void simple_bridge_enable (struct drm_bridge *bridge)
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c +2 -1
@@ -2887,16 +2887,17 @@ static int dw_hdmi_bridge_atomic_check(struct drm_bridge *bridge,return 0 ; }static int dw_hdmi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct dw_hdmi *hdmi = bridge->driver_private;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) -return drm_bridge_attach (bridge->encoder, hdmi->next_bridge, +return drm_bridge_attach (encoder, hdmi->next_bridge, bridge, flags);return dw_hdmi_connector_create (hdmi); }
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c +3 -2
@@ -1070,19 +1070,20 @@ dw_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge,return mode_status; }static int dw_mipi_dsi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct dw_mipi_dsi *dsi =bridge_to_dsi (bridge);/* Set the encoder type as caller does not know it */ - bridge->encoder->encoder_type =DRM_MODE_ENCODER_DSI ; + encoder->encoder_type =DRM_MODE_ENCODER_DSI ;/* Attach the panel-bridge to the dsi bridge */ -return drm_bridge_attach (bridge->encoder, dsi->panel_bridge, bridge, +return drm_bridge_attach (encoder, dsi->panel_bridge, bridge, flags); }static const struct drm_bridge_funcs dw_mipi_dsi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi2.c +3 -2
@@ -868,19 +868,20 @@ dw_mipi_dsi2_bridge_mode_valid(struct drm_bridge *bridge,return mode_status; }static int dw_mipi_dsi2_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct dw_mipi_dsi2 *dsi2 =bridge_to_dsi2 (bridge);/* Set the encoder type as caller does not know it */ - bridge->encoder->encoder_type =DRM_MODE_ENCODER_DSI ; + encoder->encoder_type =DRM_MODE_ENCODER_DSI ;/* Attach the panel-bridge to the dsi bridge */ -return drm_bridge_attach (bridge->encoder, dsi2->panel_bridge, bridge, +return drm_bridge_attach (encoder, dsi2->panel_bridge, bridge, flags); }static const struct drm_bridge_funcs dw_mipi_dsi2_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
drivers/gpu/drm/bridge/tc358762.c +2 -1
@@ -200,15 +200,16 @@ static void tc358762_enable(struct drm_bridge *bridge,if (ret <0 )dev_err (ctx->dev,"error initializing bridge (%d)\n" , ret); }static int tc358762_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tc358762 *ctx =bridge_to_tc358762 (bridge); -return drm_bridge_attach (bridge->encoder, ctx->panel_bridge, +return drm_bridge_attach (encoder, ctx->panel_bridge, bridge, flags); } static void tc358762_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode,
drivers/gpu/drm/bridge/tc358764.c +2 -1
@@ -293,15 +293,16 @@ static void tc358764_pre_enable(struct drm_bridge *bridge)if (ret <0 )dev_err (ctx->dev,"error initializing bridge (%d)\n" , ret); }static int tc358764_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tc358764 *ctx =bridge_to_tc358764 (bridge); -return drm_bridge_attach (bridge->encoder, ctx->next_bridge, bridge, flags); +return drm_bridge_attach (encoder, ctx->next_bridge, bridge, flags); }static const struct drm_bridge_funcs tc358764_bridge_funcs = { .post_disable = tc358764_post_disable, .pre_enable = tc358764_pre_enable,
drivers/gpu/drm/bridge/tc358767.c +2 -0
@@ -1793,10 +1793,11 @@ static const struct drm_connector_funcs tc_connector_funcs = { .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, };static int tc_dpi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tc_data *tc =bridge_to_tc (bridge);if (!tc->panel_bridge)
@@ -1805,10 +1806,11 @@ static int tc_dpi_bridge_attach(struct drm_bridge *bridge,return drm_bridge_attach (tc->bridge.encoder, tc->panel_bridge, &tc->bridge, flags); }static int tc_edp_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {u32 bus_format =MEDIA_BUS_FMT_RGB888_1X24 ;struct tc_data *tc =bridge_to_tc (bridge);struct drm_device *drm = bridge->dev;
drivers/gpu/drm/bridge/tc358768.c +2 -1
@@ -552,20 +552,21 @@ static const struct mipi_dsi_host_ops tc358768_dsi_host_ops = { .detach = tc358768_dsi_host_detach, .transfer = tc358768_dsi_host_transfer, };static int tc358768_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tc358768_priv *priv =bridge_to_tc358768 (bridge);if (!drm_core_check_feature (bridge->dev,DRIVER_ATOMIC )) {dev_err (priv->dev,"needs atomic updates support\n" );return -ENOTSUPP ; } -return drm_bridge_attach (bridge->encoder, priv->output.bridge, bridge, +return drm_bridge_attach (encoder, priv->output.bridge, bridge, flags); } static enum drm_mode_status tc358768_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/bridge/tc358775.c +2 -1
@@ -587,16 +587,17 @@ static int tc358775_parse_dt(struct device_node *np, struct tc_data *tc)return 0 ; }static int tc_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tc_data *tc =bridge_to_tc (bridge);/* Attach the panel-bridge to the dsi bridge */ -return drm_bridge_attach (bridge->encoder, tc->panel_bridge, +return drm_bridge_attach (encoder, tc->panel_bridge, &tc->bridge, flags); }static const struct drm_bridge_funcs tc_bridge_funcs = { .attach = tc_bridge_attach,
drivers/gpu/drm/bridge/thc63lvd1024.c +2 -1
@@ -41,15 +41,16 @@ static inline struct thc63_dev *to_thc63(struct drm_bridge *bridge) { return container_of(bridge, struct thc63_dev, bridge); }static int thc63_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct thc63_dev *thc63 =to_thc63 (bridge); -return drm_bridge_attach (bridge->encoder, thc63->next, bridge, flags); +return drm_bridge_attach (encoder, thc63->next, bridge, flags); }static enum drm_mode_status thc63_mode_valid (struct drm_bridge *bridge,const struct drm_display_info *info,const struct drm_display_mode *mode)
drivers/gpu/drm/bridge/ti-dlpc3433.c +2 -2
@@ -240,16 +240,16 @@ static void dlpc_mode_set(struct drm_bridge *bridge,struct dlpc *dlpc =bridge_to_dlpc (bridge);drm_mode_copy (&dlpc->mode, adjusted_mode); } -static int dlpc_attach (struct drm_bridge *bridge, +static int dlpc_attach (struct drm_bridge *bridge,struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct dlpc *dlpc =bridge_to_dlpc (bridge); -return drm_bridge_attach (bridge->encoder, dlpc->next_bridge, bridge, flags); +return drm_bridge_attach (encoder, dlpc->next_bridge, bridge, flags); }static const struct drm_bridge_funcs dlpc_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
drivers/gpu/drm/bridge/ti-sn65dsi83.c +2 -1
@@ -282,15 +282,16 @@ static struct sn65dsi83 *bridge_to_sn65dsi83(struct drm_bridge *bridge) { return container_of(bridge, struct sn65dsi83, bridge); }static int sn65dsi83_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct sn65dsi83 *ctx =bridge_to_sn65dsi83 (bridge); -return drm_bridge_attach (bridge->encoder, ctx->panel_bridge, +return drm_bridge_attach (encoder, ctx->panel_bridge, &ctx->bridge, flags); }static void sn65dsi83_detach (struct drm_bridge *bridge) {
drivers/gpu/drm/bridge/ti-sn65dsi86.c +2 -1
@@ -730,10 +730,11 @@ static int ti_sn_attach_host(struct auxiliary_device *adev, struct ti_sn65dsi86return devm_mipi_dsi_attach (&adev->dev, dsi); }static int ti_sn_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);int ret;
@@ -746,11 +747,11 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge,/* * Attach the next bridge. * We never want the next bridge to *also* create a connector. */ - ret =drm_bridge_attach (bridge->encoder, pdata->next_bridge, + ret =drm_bridge_attach (encoder, pdata->next_bridge, &pdata->bridge, flags |DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret <0 ) goto err_initted_aux;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )
drivers/gpu/drm/bridge/ti-tdp158.c +4 -2
@@ -43,15 +43,17 @@ static void tdp158_disable(struct drm_bridge *bridge,gpiod_set_value_cansleep (tdp158->enable,0 );regulator_disable (tdp158->vdd);regulator_disable (tdp158->vcc); } -static int tdp158_attach (struct drm_bridge *bridge,enum drm_bridge_attach_flags flags) +static int tdp158_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder, +enum drm_bridge_attach_flags flags) {struct tdp158 *tdp158 = bridge->driver_private; -return drm_bridge_attach (bridge->encoder, tdp158->next, bridge, flags); +return drm_bridge_attach (encoder, tdp158->next, bridge, flags); }static const struct drm_bridge_funcs tdp158_bridge_funcs = { .attach = tdp158_attach, .atomic_enable = tdp158_enable,
drivers/gpu/drm/bridge/ti-tfp410.c +3 -2
@@ -118,16 +118,17 @@ static void tfp410_hpd_callback(void *arg, enum drm_connector_status status)mod_delayed_work (system_wq, &dvi->hpd_work,msecs_to_jiffies (HOTPLUG_DEBOUNCE_MS )); }static int tfp410_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tfp410 *dvi =drm_bridge_to_tfp410 (bridge);int ret; - ret =drm_bridge_attach (bridge->encoder, dvi->next_bridge, bridge, + ret =drm_bridge_attach (encoder, dvi->next_bridge, bridge,DRM_BRIDGE_ATTACH_NO_CONNECTOR );if (ret <0 )return ret;if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR )
@@ -157,11 +158,11 @@ static int tfp410_attach(struct drm_bridge *bridge, }drm_display_info_set_bus_formats (&dvi->connector.display_info, &dvi->bus_format,1 ); -drm_connector_attach_encoder (&dvi->connector, bridge->encoder); +drm_connector_attach_encoder (&dvi->connector, encoder);return 0 ; }static void tfp410_detach (struct drm_bridge *bridge)
drivers/gpu/drm/bridge/ti-tpd12s015.c +2 -1
@@ -36,19 +36,20 @@ static inline struct tpd12s015_device *to_tpd12s015(struct drm_bridge *bridge) { return container_of(bridge, struct tpd12s015_device, bridge); }static int tpd12s015_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tpd12s015_device *tpd =to_tpd12s015 (bridge);int ret;if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; - ret =drm_bridge_attach (bridge->encoder, tpd->next_bridge, + ret =drm_bridge_attach (encoder, tpd->next_bridge, bridge, flags);if (ret <0 )return ret;gpiod_set_value_cansleep (tpd->ls_oe_gpio,1 );
drivers/gpu/drm/drm_bridge.c +1 -1
@@ -325,11 +325,11 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge,list_add (&bridge->chain_node, &previous->chain_node); else list_add(&bridge->chain_node, &encoder->bridge_chain);if (bridge->funcs->attach) { - ret = bridge->funcs->attach (bridge, flags); + ret = bridge->funcs->attach (bridge, encoder, flags);if (ret <0 ) goto err_reset_bridge; }if (bridge->funcs->atomic_reset) {
drivers/gpu/drm/i2c/tda998x_drv.c +1 -0
@@ -1362,10 +1362,11 @@ static int tda998x_connector_init(struct tda998x_priv *priv, }/* DRM bridge functions */ static int tda998x_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tda998x_priv *priv =bridge_to_tda998x_priv (bridge);if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) {
drivers/gpu/drm/imx/ipuv3/parallel-display.c +2 -1
@@ -160,15 +160,16 @@ static int imx_pd_bridge_atomic_check(struct drm_bridge *bridge,return 0 ; }static int imx_pd_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct imx_parallel_display *imxpd =bridge_to_imxpd (bridge); -return drm_bridge_attach (bridge->encoder, imxpd->next_bridge, bridge, flags); +return drm_bridge_attach (encoder, imxpd->next_bridge, bridge, flags); }static const struct drm_bridge_funcs imx_pd_bridge_funcs = { .attach = imx_pd_bridge_attach, .atomic_reset = drm_atomic_helper_bridge_reset,
drivers/gpu/drm/ingenic/ingenic-drm-drv.c +3 -2
@@ -789,15 +789,16 @@ static void ingenic_drm_encoder_atomic_mode_set(struct drm_encoder *encoder,regmap_write (priv->map,JZ_REG_LCD_CFG , cfg);regmap_write (priv->map,JZ_REG_LCD_RGBC , rgbcfg); }static int ingenic_drm_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) { -struct ingenic_drm_bridge *ib =to_ingenic_drm_bridge (bridge->encoder); +struct ingenic_drm_bridge *ib =to_ingenic_drm_bridge (encoder); -return drm_bridge_attach (bridge->encoder, ib->next_bridge, +return drm_bridge_attach (encoder, ib->next_bridge, &ib->bridge, flags); } static int ingenic_drm_bridge_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state,
drivers/gpu/drm/mcde/mcde_dsi.c +2 -1
@@ -1046,10 +1046,11 @@ void mcde_dsi_disable(struct drm_bridge *bridge)clk_disable_unprepare (d->hs_clk);clk_disable_unprepare (d->lp_clk); }static int mcde_dsi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct mcde_dsi *d =bridge_to_mcde_dsi (bridge);struct drm_device *drm = bridge->dev;
@@ -1057,11 +1058,11 @@ static int mcde_dsi_bridge_attach(struct drm_bridge *bridge,dev_err (d->dev,"we need atomic updates\n" );return -ENOTSUPP ; }/* Attach the DSI bridge to the output (panel etc) bridge */ -return drm_bridge_attach (bridge->encoder, d->bridge_out, bridge, flags); +return drm_bridge_attach (encoder, d->bridge_out, bridge, flags); }static const struct drm_bridge_funcs mcde_dsi_bridge_funcs = { .attach = mcde_dsi_bridge_attach, .mode_set = mcde_dsi_bridge_mode_set,
drivers/gpu/drm/mediatek/mtk_dp.c +2 -1
@@ -2285,10 +2285,11 @@ static void mtk_dp_poweroff(struct mtk_dp *mtk_dp)mtk_dp_power_disable (mtk_dp);phy_exit (mtk_dp->phy); }static int mtk_dp_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct mtk_dp *mtk_dp =mtk_dp_from_bridge (bridge);int ret;
@@ -2308,11 +2309,11 @@ static int mtk_dp_bridge_attach(struct drm_bridge *bridge, ret =mtk_dp_poweron (mtk_dp);if (ret) goto err_aux_register;if (mtk_dp->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, mtk_dp->next_bridge, + ret =drm_bridge_attach (encoder, mtk_dp->next_bridge, &mtk_dp->bridge, flags);if (ret) {drm_warn (mtk_dp->drm_dev,"Failed to attach external bridge: %d\n" , ret); goto err_bridge_attach;
drivers/gpu/drm/mediatek/mtk_dpi.c +2 -1
@@ -699,10 +699,11 @@ static int mtk_dpi_bridge_atomic_check(struct drm_bridge *bridge,return 0 ; }static int mtk_dpi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct mtk_dpi *dpi =bridge_to_dpi (bridge);int ret;
@@ -717,11 +718,11 @@ static int mtk_dpi_bridge_attach(struct drm_bridge *bridge,if (IS_ERR (dpi->next_bridge))return dev_err_probe (dpi->dev,PTR_ERR (dpi->next_bridge),"Failed to get bridge\n" ); } -return drm_bridge_attach (bridge->encoder, dpi->next_bridge, +return drm_bridge_attach (encoder, dpi->next_bridge, &dpi->bridge, flags); } static void mtk_dpi_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode,
drivers/gpu/drm/mediatek/mtk_dsi.c +2 -1
@@ -805,16 +805,17 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) dsi->enabled = false; }static int mtk_dsi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct mtk_dsi *dsi =bridge_to_dsi (bridge);/* Attach the panel or bridge to the dsi bridge */ -return drm_bridge_attach (bridge->encoder, dsi->next_bridge, +return drm_bridge_attach (encoder, dsi->next_bridge, &dsi->bridge, flags); } static void mtk_dsi_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode,
drivers/gpu/drm/mediatek/mtk_hdmi.c +2 -1
@@ -1276,10 +1276,11 @@ static const struct drm_edid *mtk_hdmi_bridge_edid_read(struct drm_bridge *bridgreturn drm_edid; }static int mtk_hdmi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct mtk_hdmi *hdmi =hdmi_ctx_from_bridge (bridge);int ret;
@@ -1288,11 +1289,11 @@ static int mtk_hdmi_bridge_attach(struct drm_bridge *bridge, __func__);return -EINVAL ; }if (hdmi->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, hdmi->next_bridge, + ret =drm_bridge_attach (encoder, hdmi->next_bridge, bridge, flags);if (ret)return ret; }
drivers/gpu/drm/meson/meson_encoder_cvbs.c +2 -1
@@ -81,16 +81,17 @@ meson_cvbs_get_mode(const struct drm_display_mode *req_mode)return NULL ; }static int meson_encoder_cvbs_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct meson_encoder_cvbs *meson_encoder_cvbs =bridge_to_meson_encoder_cvbs (bridge); -return drm_bridge_attach (bridge->encoder, meson_encoder_cvbs->next_bridge, +return drm_bridge_attach (encoder, meson_encoder_cvbs->next_bridge, &meson_encoder_cvbs->bridge, flags); }static int meson_encoder_cvbs_get_modes (struct drm_bridge *bridge,struct drm_connector *connector)
drivers/gpu/drm/meson/meson_encoder_dsi.c +2 -1
@@ -31,15 +31,16 @@ struct meson_encoder_dsi {#define bridge_to_meson_encoder_dsi (x) \ container_of(x, struct meson_encoder_dsi, bridge)static int meson_encoder_dsi_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct meson_encoder_dsi *encoder_dsi =bridge_to_meson_encoder_dsi (bridge); -return drm_bridge_attach (bridge->encoder, encoder_dsi->next_bridge, +return drm_bridge_attach (encoder, encoder_dsi->next_bridge, &encoder_dsi->bridge, flags); }static void meson_encoder_dsi_atomic_enable (struct drm_bridge *bridge,struct drm_atomic_state *state)
drivers/gpu/drm/meson/meson_encoder_hdmi.c +2 -1
@@ -47,15 +47,16 @@ struct meson_encoder_hdmi {#define bridge_to_meson_encoder_hdmi (x) \ container_of(x, struct meson_encoder_hdmi, bridge)static int meson_encoder_hdmi_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct meson_encoder_hdmi *encoder_hdmi =bridge_to_meson_encoder_hdmi (bridge); -return drm_bridge_attach (bridge->encoder, encoder_hdmi->next_bridge, +return drm_bridge_attach (encoder, encoder_hdmi->next_bridge, &encoder_hdmi->bridge, flags); }static void meson_encoder_hdmi_detach (struct drm_bridge *bridge) {
drivers/gpu/drm/msm/dsi/dsi_manager.c +2 -1
@@ -422,16 +422,17 @@ static enum drm_mode_status dsi_mgr_bridge_mode_valid(struct drm_bridge *bridge,return msm_dsi_host_check_dsc (host, mode); }static int dsi_mgr_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {int id =dsi_mgr_bridge_get_id (bridge);struct msm_dsi *msm_dsi =dsi_mgr_get_dsi (id); -return drm_bridge_attach (bridge->encoder, msm_dsi->next_bridge, +return drm_bridge_attach (encoder, msm_dsi->next_bridge, bridge, flags); }static const struct drm_bridge_funcs dsi_mgr_bridge_funcs = { .attach = dsi_mgr_bridge_attach,
drivers/gpu/drm/omapdrm/dss/dpi.c +2 -1
@@ -418,20 +418,21 @@ static void dpi_init_pll(struct dpi_data *dpi)/* ----------------------------------------------------------------------------- * DRM Bridge Operations */ static int dpi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct dpi_data *dpi =drm_bridge_to_dpi (bridge);if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ;dpi_init_pll (dpi); -return drm_bridge_attach (bridge->encoder, dpi->output.next_bridge, +return drm_bridge_attach (encoder, dpi->output.next_bridge, bridge, flags); } static enum drm_mode_status dpi_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/omapdrm/dss/dsi.c +2 -1
@@ -4615,18 +4615,19 @@ static const struct component_ops dsi_component_ops = {/* ----------------------------------------------------------------------------- * DRM Bridge Operations */ static int dsi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct dsi_data *dsi =drm_bridge_to_dsi (bridge);if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; -return drm_bridge_attach (bridge->encoder, dsi->output.next_bridge, +return drm_bridge_attach (encoder, dsi->output.next_bridge, bridge, flags); } static enum drm_mode_status dsi_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/omapdrm/dss/hdmi4.c +2 -1
@@ -312,18 +312,19 @@ void hdmi4_core_disable(struct hdmi_core_data *core)/* ----------------------------------------------------------------------------- * DRM Bridge Operations */ static int hdmi4_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct omap_hdmi *hdmi =drm_bridge_to_hdmi (bridge);if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; -return drm_bridge_attach (bridge->encoder, hdmi->output.next_bridge, +return drm_bridge_attach (encoder, hdmi->output.next_bridge, bridge, flags); } static void hdmi4_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode,
drivers/gpu/drm/omapdrm/dss/hdmi5.c +2 -1
@@ -310,18 +310,19 @@ static void hdmi_core_disable(struct omap_hdmi *hdmi)/* ----------------------------------------------------------------------------- * DRM Bridge Operations */ static int hdmi5_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct omap_hdmi *hdmi =drm_bridge_to_hdmi (bridge);if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; -return drm_bridge_attach (bridge->encoder, hdmi->output.next_bridge, +return drm_bridge_attach (encoder, hdmi->output.next_bridge, bridge, flags); } static void hdmi5_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode,
drivers/gpu/drm/omapdrm/dss/sdi.c +2 -1
@@ -126,18 +126,19 @@ static void sdi_config_lcd_manager(struct sdi_device *sdi)/* ----------------------------------------------------------------------------- * DRM Bridge Operations */ static int sdi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct sdi_device *sdi =drm_bridge_to_sdi (bridge);if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; -return drm_bridge_attach (bridge->encoder, sdi->output.next_bridge, +return drm_bridge_attach (encoder, sdi->output.next_bridge, bridge, flags); } static enum drm_mode_status sdi_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/omapdrm/dss/venc.c +2 -1
@@ -536,18 +536,19 @@ static int venc_get_clocks(struct venc_device *venc)/* ----------------------------------------------------------------------------- * DRM Bridge Operations */ static int venc_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct venc_device *venc =drm_bridge_to_venc (bridge);if (!(flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ))return -EINVAL ; -return drm_bridge_attach (bridge->encoder, venc->output.next_bridge, +return drm_bridge_attach (encoder, venc->output.next_bridge, bridge, flags); } static enum drm_mode_status venc_bridge_mode_valid(struct drm_bridge *bridge,
drivers/gpu/drm/renesas/rcar-du/rcar_lvds.c +2 -1
@@ -632,18 +632,19 @@ static bool rcar_lvds_mode_fixup(struct drm_bridge *bridge,return true; }static int rcar_lvds_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct rcar_lvds *lvds =bridge_to_rcar_lvds (bridge);if (!lvds->next_bridge)return 0 ; -return drm_bridge_attach (bridge->encoder, lvds->next_bridge, bridge, +return drm_bridge_attach (encoder, lvds->next_bridge, bridge, flags); }static const struct drm_bridge_funcs rcar_lvds_bridge_ops = { .attach = rcar_lvds_attach,
drivers/gpu/drm/renesas/rcar-du/rcar_mipi_dsi.c +2 -1
@@ -797,15 +797,16 @@ static void rcar_mipi_dsi_stop_video(struct rcar_mipi_dsi *dsi)/* ----------------------------------------------------------------------------- * Bridge */ static int rcar_mipi_dsi_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct rcar_mipi_dsi *dsi =bridge_to_rcar_mipi_dsi (bridge); -return drm_bridge_attach (bridge->encoder, dsi->next_bridge, bridge, +return drm_bridge_attach (encoder, dsi->next_bridge, bridge, flags); }static void rcar_mipi_dsi_atomic_enable (struct drm_bridge *bridge,struct drm_atomic_state *state)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +2 -1
@@ -521,15 +521,16 @@ static int rzg2l_mipi_dsi_stop_video(struct rzg2l_mipi_dsi *dsi)/* ----------------------------------------------------------------------------- * Bridge */ static int rzg2l_mipi_dsi_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct rzg2l_mipi_dsi *dsi =bridge_to_rzg2l_mipi_dsi (bridge); -return drm_bridge_attach (bridge->encoder, dsi->next_bridge, bridge, +return drm_bridge_attach (encoder, dsi->next_bridge, bridge, flags); }static void rzg2l_mipi_dsi_atomic_enable (struct drm_bridge *bridge,struct drm_atomic_state *state)
drivers/gpu/drm/stm/lvds.c +5 -6
@@ -932,32 +932,31 @@ static const struct drm_connector_funcs lvds_conn_funcs = { .destroy = drm_connector_cleanup, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static int lvds_attach (struct drm_bridge *bridge, +static int lvds_attach (struct drm_bridge *bridge,struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct stm_lvds *lvds =bridge_to_stm_lvds (bridge);struct drm_connector *connector = &lvds->connector; -struct drm_encoder *encoder = bridge->encoder;int ret; -if (!bridge->encoder) { +if (!encoder) {drm_err (bridge->dev,"Parent encoder object not found\n" );return -ENODEV ; }/* Set the encoder type as caller does not know it */ - bridge->encoder->encoder_type =DRM_MODE_ENCODER_LVDS ; + encoder->encoder_type =DRM_MODE_ENCODER_LVDS ;/* No cloning support */ - bridge->encoder->possible_clones =0 ; + encoder->possible_clones =0 ;/* If we have a next bridge just attach it. */ if (lvds->next_bridge) -return drm_bridge_attach (bridge->encoder, lvds->next_bridge, +return drm_bridge_attach (encoder, lvds->next_bridge, bridge, flags);if (flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ) {drm_err (bridge->dev,"Fix bridge driver to make connector optional!" );return -EINVAL ;
drivers/gpu/drm/tidss/tidss_encoder.c +2 -1
@@ -32,15 +32,16 @@ static inline struct tidss_encoder { return container_of(b, struct tidss_encoder, bridge); }static int tidss_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct tidss_encoder *t_enc =bridge_to_tidss_encoder (bridge); -return drm_bridge_attach (bridge->encoder, t_enc->next_bridge, +return drm_bridge_attach (encoder, t_enc->next_bridge, bridge, flags); } static int tidss_bridge_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state,
drivers/gpu/drm/vc4/vc4_dsi.c +2 -1
@@ -1158,16 +1158,17 @@ static void vc4_dsi_bridge_enable(struct drm_bridge *bridge,drm_print_regset32 (&p, &dsi->regset); } }static int vc4_dsi_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct vc4_dsi *dsi =bridge_to_vc4_dsi (bridge);/* Attach the panel or bridge to the dsi bridge */ -return drm_bridge_attach (bridge->encoder, dsi->out_bridge, +return drm_bridge_attach (encoder, dsi->out_bridge, &dsi->bridge, flags); }static ssize_t vc4_dsi_host_transfer (struct mipi_dsi_host *host,const struct mipi_dsi_msg *msg)
drivers/gpu/drm/xlnx/zynqmp_dp.c +2 -1
@@ -1479,10 +1479,11 @@ static void zynqmp_dp_disp_disable(struct zynqmp_dp *dp,/* ----------------------------------------------------------------------------- * DRM Bridge */ static int zynqmp_dp_bridge_attach (struct drm_bridge *bridge, +struct drm_encoder *encoder,enum drm_bridge_attach_flags flags) {struct zynqmp_dp *dp =bridge_to_dp (bridge);int ret;
@@ -1492,11 +1493,11 @@ static int zynqmp_dp_bridge_attach(struct drm_bridge *bridge,dev_err (dp->dev,"failed to initialize DP aux\n" );return ret; }if (dp->next_bridge) { - ret =drm_bridge_attach (bridge->encoder, dp->next_bridge, + ret =drm_bridge_attach (encoder, dp->next_bridge, bridge, flags);if (ret <0 ) goto error; }
drivers/platform/arm64/acer-aspire1-ec.c +2 -1
@@ -364,11 +364,12 @@ static const struct power_supply_desc aspire_ec_adp_psy_desc = {/* * USB-C DP Alt mode HPD. */ -static int aspire_ec_bridge_attach (struct drm_bridge *bridge,enum drm_bridge_attach_flags flags) +static int aspire_ec_bridge_attach (struct drm_bridge *bridge,struct drm_encoder *encoder, +enum drm_bridge_attach_flags flags) {return flags &DRM_BRIDGE_ATTACH_NO_CONNECTOR ?0 : -EINVAL ; }static void aspire_ec_bridge_update_hpd_work (struct work_struct *work)
include/drm/drm_bridge.h +1 -1
@@ -71,11 +71,11 @@ struct drm_bridge_funcs {* * RETURNS: * * Zero on success, error code on failure. */ -int (*attach)(struct drm_bridge *bridge, +int (*attach)(struct drm_bridge *bridge,struct drm_encoder *encoder,enum drm_bridge_attach_flags flags);/** * @detach: *
Signature · 1 line
2.48.0
Re: [PATCH v3 27/37] drm/bridge: Add encoder parameter to drm_bridge_funcs.attach
Hi,
Quoted 10 lines · Maxime Ripard
The
drm_bridgestructure contains an encoder pointer that is widely used by bridge drivers. This pattern is largely documented as deprecated in other KMS entities for atomic drivers.However, one of the main use of that pointer is done in attach to just call
drm_bridge_attachon the next bridge to add it to the bridge list. While this dereferences thebridge->encoderpointer, it's effectively the same encoder the bridge was being attached to.
Quoted 6 lines
We can make it more explicit by adding the encoder the bridge is attached to to the list of attach parameters. This also removes the need to dereference
bridge->encoderin most drivers.Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>
From the point of view of ti-sn65dsi86 and parade-ps8640:
Maxime Ripard
maintainerPATCH v3 28/37 drm/bridge: Provide a helper to retrieve current bridge state
In reply to Maxime RipardThe current bridge state is accessible from the drm_bridge structure, but since it's fairly indirect it's not easy to figure out.
Provide a helper to retrieve it.
--- include/drm/drm_bridge.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
include/drm/drm_bridge.h +21 -0
@@ -955,10 +955,31 @@ static inline struct drm_bridge *of_drm_find_bridge(struct device_node *np) {return NULL ; }#endif +/** +* @drm_bridge_get_current_state() - Get the current bridge state +* @bridge: bridge object +* +* This function must be called with the modeset lock held. +* +* RETURNS: +* +* The current bridge state, or NULL if there is none. +*/ +static inline struct drm_bridge_state * +drm_bridge_get_current_state (struct drm_bridge *bridge) +{ +drm_modeset_lock_assert_held (&bridge->base.lock); + +if (!bridge) +return NULL ; + +return drm_priv_to_bridge_state (bridge->base.state); +} +/** * drm_bridge_get_next_bridge() - Get the next bridge in the chain * @bridge: bridge object * * RETURNS:
Signature · 1 line
2.48.0
Re: [PATCH v3 28/37] drm/bridge: Provide a helper to retrieve current bridge state
Quoted 10 lines · Maxime Ripard
The current bridge state is accessible from the
drm_bridgestructure, but since it's fairly indirect it's not easy to figure out.Provide a helper to retrieve it.
Signed-off-by Maxime Ripard <[email protected]>--- include/drm/drm_bridge.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 29/37 drm/bridge: Introduce drm_bridge_is_atomic() helper
In reply to Maxime RipardWe test for whether the bridge is atomic in several places in the source code, so let's consolidate them.
--- drivers/gpu/drm/drm_bridge.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_bridge.c +7 -2
@@ -278,10 +278,15 @@ drm_bridge_atomic_destroy_priv_state(struct drm_private_obj *obj,static const struct drm_private_state_funcs drm_bridge_priv_state_funcs = { .atomic_duplicate_state = drm_bridge_atomic_duplicate_priv_state, .atomic_destroy_state = drm_bridge_atomic_destroy_priv_state, }; +static bool drm_bridge_is_atomic (struct drm_bridge *bridge) +{ +return bridge->funcs->atomic_reset !=NULL ; +} +/** * drm_bridge_attach - attach the bridge to an encoder's chain * * @encoder: DRM encoder * @bridge: bridge to attach
@@ -330,11 +335,11 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, ret = bridge->funcs->attach (bridge, encoder, flags);if (ret <0 ) goto err_reset_bridge; } -if (bridge->funcs->atomic_reset) { +if (drm_bridge_is_atomic (bridge)) {struct drm_bridge_state *state; state = bridge->funcs->atomic_reset (bridge);if (IS_ERR (state)) { ret =PTR_ERR (state);
@@ -375,11 +380,11 @@ void drm_bridge_detach(struct drm_bridge *bridge)return ;if (WARN_ON (!bridge->dev))return ; -if (bridge->funcs->atomic_reset) +if (drm_bridge_is_atomic (bridge))drm_atomic_private_obj_fini (&bridge->base);if (bridge->funcs->detach) bridge->funcs->detach (bridge);
Signature · 1 line
2.48.0
Re: [PATCH v3 29/37] drm/bridge: Introduce drm_bridge_is_atomic() helper
Quoted 9 lines · Maxime Ripard
We test for whether the bridge is atomic in several places in the source code, so let's consolidate them.
Suggested-by Dmitry Baryshkov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_bridge.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 30/37 drm/bridge: Assume that a bridge is atomic if it has atomic_reset
In reply to Maxime RipardThe drm_atomic_bridge_check() runs the atomic_check callback if needed, or falls back to mode_fixup if it's not there.
Going forward, we'll need to setup the bridge atomic state even though drivers might not be implementing atomic_check at all.
We can thus switch to using drm_bridge_is_atomic() to take the atomic path, and do additional things there in the future, or go the mode_fixup route.
--- drivers/gpu/drm/drm_bridge.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/drm_bridge.c +7 -5
@@ -803,23 +803,25 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_enable);static int drm_atomic_bridge_check (struct drm_bridge *bridge,struct drm_crtc_state *crtc_state,struct drm_connector_state *conn_state) { -if (bridge->funcs->atomic_check) { +if (drm_bridge_is_atomic (bridge)) {struct drm_bridge_state *bridge_state;int ret; bridge_state =drm_atomic_get_new_bridge_state (crtc_state->state, bridge);if (WARN_ON (!bridge_state))return -EINVAL ; - ret = bridge->funcs->atomic_check (bridge, bridge_state, - crtc_state, conn_state); -if (ret) -return ret; +if (bridge->funcs->atomic_check) { + ret = bridge->funcs->atomic_check (bridge, bridge_state, + 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 ; }
Signature · 1 line
2.48.0
Re: [PATCH v3 30/37] drm/bridge: Assume that a bridge is atomic if it has atomic_reset
Quoted 9 lines · Maxime Ripard
The
drm_atomic_bridge_check()runs theatomic_checkcallback if needed, or falls back tomode_fixupif it's not there.Going forward, we'll need to setup the bridge atomic state even though drivers might not be implementing
atomic_checkat all.We can thus switch to using
drm_bridge_is_atomic()to take the atomic path, and do additional things there in the future, or go themode_fixuproute.
This will break bridges like tc358768, rcar_lvds and mtk_hdmi: they implement atomic_reset() and mode_fixup().
Quoted 45 lines
Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_bridge.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/drm_bridge.c +7
-5@@ -803,23 +803,25 @@ EXPORT_SYMBOL(drm_atomic_bridge_chain_enable);static int drm_atomic_bridge_check (struct drm_bridge *bridge,struct drm_crtc_state *crtc_state,struct drm_connector_state *conn_state) { -if (bridge->funcs->atomic_check) { +if (drm_bridge_is_atomic (bridge)) {struct drm_bridge_state *bridge_state;int ret; bridge_state =drm_atomic_get_new_bridge_state (crtc_state->state, bridge);if (WARN_ON (!bridge_state))return -EINVAL ; - ret = bridge->funcs->atomic_check (bridge, bridge_state, - crtc_state, conn_state); -if (ret) -return ret; +if (bridge->funcs->atomic_check) { + ret = bridge->funcs->atomic_check (bridge, bridge_state, + 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 ; }Signature · 2 lines
-- 2.48.0
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerRe: [PATCH v3 30/37] drm/bridge: Assume that a bridge is atomic if it has atomic_reset
Quoted 7 lines · Dmitry Baryshkov
Quoted 6 lines · Maxime Ripard
The
drm_atomic_bridge_check()runs theatomic_checkcallback if needed, or falls back tomode_fixupif it's not there.Going forward, we'll need to setup the bridge atomic state even though drivers might not be implementing
atomic_checkat all.
Quoted 6 lines
Quoted 3 lines
We can thus switch to using
drm_bridge_is_atomic()to take the atomic path, and do additional things there in the future, or go themode_fixuproute.This will break bridges like tc358768,
rcar_lvdsandmtk_hdmi: they implementatomic_reset()andmode_fixup().
What is your suggestion then? I kind of did what you were suggesting on patch 1, but it wasn't working. Then you want me to roll back to that, or something else?
Maxime
Re: [PATCH v3 30/37] drm/bridge: Assume that a bridge is atomic if it has atomic_reset
Quoted 12 lines · Maxime Ripard
Quoted 11 lines · Dmitry Baryshkov
Quoted 9 lines · Maxime Ripard
The
drm_atomic_bridge_check()runs theatomic_checkcallback if needed, or falls back tomode_fixupif it's not there.Going forward, we'll need to setup the bridge atomic state even though drivers might not be implementing
atomic_checkat all.We can thus switch to using
drm_bridge_is_atomic()to take the atomic path, and do additional things there in the future, or go themode_fixuproute.
Quoted 6 lines
Quoted 2 lines
This will break bridges like tc358768,
rcar_lvdsandmtk_hdmi: they implementatomic_reset()andmode_fixup().What is your suggestion then? I kind of did what you were suggesting on patch 1, but it wasn't working. Then you want me to roll back to that, or something else?
Well, we just need to call mode_fixup. So something like:
if (drm_bridge_is_atomic(bridge)) {
bridge_state = drm_atomic_get_new_bridge_state(crtc_state->state,
bridge);
if (WARN_ON(!bridge_state))
return -EINVAL;
}
if (bridge->funcs->atomic_check) {
/* drm_bridge_add() returns void, so there is no way to
* reject non-atomic bridges with atomic_check()
* callback.
*/
if (!bridge_state)
return -EINVAL;
ret = bridge->funcs->atomic_check(bridge, bridge_state,
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;
}Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 31/37 drm/bridge: Provide pointers to the connector and crtc in bridge state
In reply to Maxime RipardNow that connectors are no longer necessarily created by the bridges drivers themselves but might be created by drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.
Indeed, the only way to retrieve the CRTC is to follow the drm_bridge encoder field, and then the drm_encoder crtc field, both of them being deprecated.
And for the connector, since we can have multiple connectors attached to a CRTC, we don't really have a reliable way to get it.
Let's provide both pointers in the drm_bridge_state structure so we don't have to follow deprecated, non-atomic, pointers, and be more consistent with the other KMS entities.
--- drivers/gpu/drm/drm_atomic_state_helper.c | 5 +++++ drivers/gpu/drm/drm_bridge.c | 5 +++++ include/drm/drm_atomic.h | 14 ++++++++++++++ 3 files changed, 24 insertions(+)
drivers/gpu/drm/drm_atomic_state_helper.c +5 -0
@@ -777,10 +777,15 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state);* that don't subclass the bridge state. */ void drm_atomic_helper_bridge_destroy_state (struct drm_bridge *bridge,struct drm_bridge_state *state) { +if (state->connector) { +drm_connector_put (state->connector); + state->connector =NULL ; + } +kfree (state); }EXPORT_SYMBOL (drm_atomic_helper_bridge_destroy_state);/**
drivers/gpu/drm/drm_bridge.c +5 -0
@@ -812,10 +812,15 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, bridge_state =drm_atomic_get_new_bridge_state (crtc_state->state, bridge);if (WARN_ON (!bridge_state))return -EINVAL ; + bridge_state->crtc = crtc_state->crtc; + +drm_connector_get (conn_state->connector); + bridge_state->connector = conn_state->connector; +if (bridge->funcs->atomic_check) { ret = bridge->funcs->atomic_check (bridge, bridge_state, crtc_state, conn_state);if (ret)return ret;
include/drm/drm_atomic.h +14 -0
@@ -1216,10 +1216,24 @@ struct drm_bridge_state {/** * @bridge: the bridge this state refers to */ struct drm_bridge *bridge; +/** +* @crtc: CRTC the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_crtc *crtc; + +/** +* @connector: The connector the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_connector *connector; +/** * @input_bus_cfg: input bus configuration */ struct drm_bus_cfg input_bus_cfg;
Signature · 1 line
2.48.0
Re: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 11 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.And for the connector, since we can have multiple connectors attached to a CRTC, we don't really have a reliable way to get it.
The same comment as for v2:
It's not very precise:
connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);
Is that unreliable somehow?
Quoted 85 lines
Let's provide both pointers in the
drm_bridge_statestructure so we don't have to follow deprecated, non-atomic, pointers, and be more consistent with the other KMS entities.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_state_helper.c | 5 +++++ drivers/gpu/drm/drm_bridge.c | 5 +++++ include/drm/drm_atomic.h | 14 ++++++++++++++ 3 files changed, 24 insertions(+)drivers/gpu/drm/drm_atomic_state_helper.c +5
-0@@ -777,10 +777,15 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state);* that don't subclass the bridge state. */ void drm_atomic_helper_bridge_destroy_state (struct drm_bridge *bridge,struct drm_bridge_state *state) { +if (state->connector) { +drm_connector_put (state->connector); + state->connector =NULL ; + } +kfree (state); }EXPORT_SYMBOL (drm_atomic_helper_bridge_destroy_state);/** drivers/gpu/drm/drm_bridge.c +5
-0@@ -812,10 +812,15 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, bridge_state =drm_atomic_get_new_bridge_state (crtc_state->state, bridge);if (WARN_ON (!bridge_state))return -EINVAL ; + bridge_state->crtc = crtc_state->crtc; + +drm_connector_get (conn_state->connector); + bridge_state->connector = conn_state->connector; +if (bridge->funcs->atomic_check) { ret = bridge->funcs->atomic_check (bridge, bridge_state, crtc_state, conn_state);if (ret)return ret;include/drm/drm_atomic.h +14
-0@@ -1216,10 +1216,24 @@ struct drm_bridge_state {/** * @bridge: the bridge this state refers to */ struct drm_bridge *bridge; +/** +* @crtc: CRTC the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_crtc *crtc; + +/** +* @connector: The connector the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_connector *connector; +/** * @input_bus_cfg: input bus configuration */ struct drm_bus_cfg input_bus_cfg;Signature · 2 lines
-- 2.48.0
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerRe: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 13 lines · Dmitry Baryshkov
Quoted 11 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.And for the connector, since we can have multiple connectors attached to a CRTC, we don't really have a reliable way to get it.
Quoted 7 lines
The same comment as for v2:
It's not very precise:
connector =
drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);Is that unreliable somehow?
Then I'm not sure what you want here (and in v2) either. Do you want me to drop this patch because it's redundant, drop it, something else?
Maxime
Re: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 16 lines · Maxime Ripard
Quoted 15 lines · Dmitry Baryshkov
Quoted 11 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.And for the connector, since we can have multiple connectors attached to a CRTC, we don't really have a reliable way to get it.
The same comment as for v2:
Quoted 8 lines
Quoted 5 lines
It's not very precise:
connector =
drm_atomic_get_new_connector_for_encoder(state, bridge->encoder);Is that unreliable somehow?
Then I'm not sure what you want here (and in v2) either. Do you want me to drop this patch because it's redundant, drop it, something else?
No, basically to expand the commit message. It states that there was no reliable way to get the connector, but there was one. I'd mention that getting CRTC and connector via the state results in a boilerplate code and complicates bridge drivers.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
In reply to Maxime RipardQuoted 8 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.
Eh, this isn't quite how this works. So unless bridges have become very dynamic and gained flexible routing the bridge(->bridge->...)->encoder chain is static. And the crtc for an encoder you find by walking the connector states in a drm_atomic_state, finding the right one that points at your encoder, and then return the ->crtc pointer from that connector state.
It's a bit bonkers, but I think it's better to compute this than adding more pointers that potentially diverge. Unless there's a grand plan here, but then I think we want some safety checks that all the pointers never get out of sync here.
-Sima
Quoted 88 lines
And for the connector, since we can have multiple connectors attached to a CRTC, we don't really have a reliable way to get it.
Let's provide both pointers in the
drm_bridge_statestructure so we don't have to follow deprecated, non-atomic, pointers, and be more consistent with the other KMS entities.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_state_helper.c | 5 +++++ drivers/gpu/drm/drm_bridge.c | 5 +++++ include/drm/drm_atomic.h | 14 ++++++++++++++ 3 files changed, 24 insertions(+)drivers/gpu/drm/drm_atomic_state_helper.c +5
-0@@ -777,10 +777,15 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state);* that don't subclass the bridge state. */ void drm_atomic_helper_bridge_destroy_state (struct drm_bridge *bridge,struct drm_bridge_state *state) { +if (state->connector) { +drm_connector_put (state->connector); + state->connector =NULL ; + } +kfree (state); }EXPORT_SYMBOL (drm_atomic_helper_bridge_destroy_state);/** drivers/gpu/drm/drm_bridge.c +5
-0@@ -812,10 +812,15 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, bridge_state =drm_atomic_get_new_bridge_state (crtc_state->state, bridge);if (WARN_ON (!bridge_state))return -EINVAL ; + bridge_state->crtc = crtc_state->crtc; + +drm_connector_get (conn_state->connector); + bridge_state->connector = conn_state->connector; +if (bridge->funcs->atomic_check) { ret = bridge->funcs->atomic_check (bridge, bridge_state, crtc_state, conn_state);if (ret)return ret;include/drm/drm_atomic.h +14
-0@@ -1216,10 +1216,24 @@ struct drm_bridge_state {/** * @bridge: the bridge this state refers to */ struct drm_bridge *bridge; +/** +* @crtc: CRTC the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_crtc *crtc; + +/** +* @connector: The connector the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_connector *connector; +/** * @input_bus_cfg: input bus configuration */ struct drm_bus_cfg input_bus_cfg;Signature · 2 lines
-- 2.48.0
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 17 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.Eh, this isn't quite how this works. So unless bridges have become very dynamic and gained flexible routing the bridge(->bridge->...)->encoder chain is static. And the crtc for an encoder you find by walking the connector states in a
drm_atomic_state, finding the right one that points at your encoder, and then return the ->crtc pointer from that connector state.
Quoted 4 lines
It's a bit bonkers, but I think it's better to compute this than adding more pointers that potentially diverge. Unless there's a grand plan here, but then I think we want some safety checks that all the pointers never get out of sync here.
Luca is working on bridges hotplug, so connectors are dynamic now. And at least my humble opinion is that we'd better provide the corresponding pointers rather than having a lot of boilerplate code in the drivers. (there are enough drivers which look up connector and/or CRTC) and there are even more drivers (I think, I haven't actually checked the source tree) that could have benefited from thaving the connector or CRTC in the state. Instead they store a pointer to the connector or perform other fancy tricks.
Quoted 95 lines
-Sima
Quoted 88 lines
And for the connector, since we can have multiple connectors attached to a CRTC, we don't really have a reliable way to get it.
Let's provide both pointers in the
drm_bridge_statestructure so we don't have to follow deprecated, non-atomic, pointers, and be more consistent with the other KMS entities.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/drm_atomic_state_helper.c | 5 +++++ drivers/gpu/drm/drm_bridge.c | 5 +++++ include/drm/drm_atomic.h | 14 ++++++++++++++ 3 files changed, 24 insertions(+)drivers/gpu/drm/drm_atomic_state_helper.c +5
-0@@ -777,10 +777,15 @@ EXPORT_SYMBOL(drm_atomic_helper_bridge_duplicate_state);* that don't subclass the bridge state. */ void drm_atomic_helper_bridge_destroy_state (struct drm_bridge *bridge,struct drm_bridge_state *state) { +if (state->connector) { +drm_connector_put (state->connector); + state->connector =NULL ; + } +kfree (state); }EXPORT_SYMBOL (drm_atomic_helper_bridge_destroy_state);/** drivers/gpu/drm/drm_bridge.c +5
-0@@ -812,10 +812,15 @@ static int drm_atomic_bridge_check(struct drm_bridge *bridge, bridge_state =drm_atomic_get_new_bridge_state (crtc_state->state, bridge);if (WARN_ON (!bridge_state))return -EINVAL ; + bridge_state->crtc = crtc_state->crtc; + +drm_connector_get (conn_state->connector); + bridge_state->connector = conn_state->connector; +if (bridge->funcs->atomic_check) { ret = bridge->funcs->atomic_check (bridge, bridge_state, crtc_state, conn_state);if (ret)return ret;include/drm/drm_atomic.h +14
-0@@ -1216,10 +1216,24 @@ struct drm_bridge_state {/** * @bridge: the bridge this state refers to */ struct drm_bridge *bridge; +/** +* @crtc: CRTC the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_crtc *crtc; + +/** +* @connector: The connector the bridge is connected to, NULL if disabled. +* +* Do not change this directly. +*/ +struct drm_connector *connector; +/** * @input_bus_cfg: input bus configuration */ struct drm_bus_cfg input_bus_cfg;Signature · 2 lines
-- 2.48.0Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 23 lines · Dmitry Baryshkov
Quoted 17 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.Eh, this isn't quite how this works. So unless bridges have become very dynamic and gained flexible routing the bridge(->bridge->...)->encoder chain is static. And the crtc for an encoder you find by walking the connector states in a
drm_atomic_state, finding the right one that points at your encoder, and then return the ->crtc pointer from that connector state.Quoted 4 lines
It's a bit bonkers, but I think it's better to compute this than adding more pointers that potentially diverge. Unless there's a grand plan here, but then I think we want some safety checks that all the pointers never get out of sync here.
Quoted 8 lines
Luca is working on bridges hotplug, so connectors are dynamic now. And at least my humble opinion is that we'd better provide the corresponding pointers rather than having a lot of boilerplate code in the drivers. (there are enough drivers which look up connector and/or CRTC) and there are even more drivers (I think, I haven't actually checked the source tree) that could have benefited from thaving the connector or CRTC in the state. Instead they store a pointer to the connector or perform other fancy tricks.
Yeah definitely don't replicate this across drivers, it needs to be a helper function. What I meant to say is that we have a way to do this already, and it also works for dp mst drivers. So full blast fun of dynamically selecting the right encoder _and_ hotplug/unplug of connectors.
Unless bridge is very special, this should work for bridges too. -Sima
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Maxime Ripard
maintainerRe: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
In reply to Simona VetterHi,
Thanks for your answer
Quoted 17 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.Eh, this isn't quite how this works. So unless bridges have become very dynamic and gained flexible routing the bridge(->bridge->...)->encoder chain is static. And the crtc for an encoder you find by walking the connector states in a
drm_atomic_state, finding the right one that points at your encoder, and then return the ->crtc pointer from that connector state.
Quoted 4 lines
It's a bit bonkers, but I think it's better to compute this than adding more pointers that potentially diverge. Unless there's a grand plan here, but then I think we want some safety checks that all the pointers never get out of sync here.
That work stemed from this series
https://lore.kernel.org/all/[email protected]/
and in particular:
https://lore.kernel.org/all/[email protected]/
Bridges, outside of the modesetting code path, don't have a way to access the drm_atomic_state since drm_bridge_state->state is typically cleared after swap_state. So accessing the connectors and CRTCs don't work anymore.
In this particular case, we needed to access those from the bridge interrupt handler.
Maxime
Re: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 33 lines · Maxime Ripard
Hi,
Thanks for your answer
Quoted 17 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.Eh, this isn't quite how this works. So unless bridges have become very dynamic and gained flexible routing the bridge(->bridge->...)->encoder chain is static. And the crtc for an encoder you find by walking the connector states in a
drm_atomic_state, finding the right one that points at your encoder, and then return the ->crtc pointer from that connector state.Quoted 4 lines
It's a bit bonkers, but I think it's better to compute this than adding more pointers that potentially diverge. Unless there's a grand plan here, but then I think we want some safety checks that all the pointers never get out of sync here.
That work stemed from this series
https://lore.kernel.org/all/[email protected]/and in particular:
https://lore.kernel.org/all/[email protected]/
Quoted 7 lines
Bridges, outside of the modesetting code path, don't have a way to access the
drm_atomic_statesincedrm_bridge_state->stateis typically cleared afterswap_state. So accessing the connectors and CRTCs don't work anymore.In this particular case, we needed to access those from the bridge interrupt handler.
Uh for interrupt handler you can't use anything stored in state objects anyway. So I'm even more confused.
-Sima
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Maxime Ripard
maintainerRe: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 39 lines · Simona Vetter
Quoted 38 lines · Maxime Ripard
Hi,
Thanks for your answer
Quoted 17 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.Eh, this isn't quite how this works. So unless bridges have become very dynamic and gained flexible routing the bridge(->bridge->...)->encoder chain is static. And the crtc for an encoder you find by walking the connector states in a
drm_atomic_state, finding the right one that points at your encoder, and then return the ->crtc pointer from that connector state.Quoted 4 lines
It's a bit bonkers, but I think it's better to compute this than adding more pointers that potentially diverge. Unless there's a grand plan here, but then I think we want some safety checks that all the pointers never get out of sync here.
That work stemed from this series
https://lore.kernel.org/all/[email protected]/and in particular:
https://lore.kernel.org/all/[email protected]/Bridges, outside of the modesetting code path, don't have a way to access the
drm_atomic_statesincedrm_bridge_state->stateis typically cleared afterswap_state. So accessing the connectors and CRTCs don't work anymore.
Quoted 5 lines
Quoted 2 lines
In this particular case, we needed to access those from the bridge interrupt handler.
Uh for interrupt handler you can't use anything stored in state objects anyway. So I'm even more confused.
Why not? As long as we're in a threaded handler, and take the proper locks, what's wrong with it, and how is it fundamentally different than, idk, cec or audio hooks?
Maxime
Re: [PATCH v3 31/37] drm/bridge: Provide pointers to the connector and crtc in bridge state
Quoted 43 lines · Maxime Ripard
Quoted 42 lines · Simona Vetter
Quoted 40 lines · Maxime Ripard
Hi,
Thanks for your answer
Quoted 17 lines · Simona Vetter
Quoted 8 lines · Maxime Ripard
Now that connectors are no longer necessarily created by the bridges drivers themselves but might be created by
drm_bridge_connector, it's pretty hard for bridge drivers to retrieve pointers to the connector and CRTC they are attached to.Indeed, the only way to retrieve the CRTC is to follow the
drm_bridgeencoder field, and then thedrm_encodercrtc field, both of them being deprecated.Eh, this isn't quite how this works. So unless bridges have become very dynamic and gained flexible routing the bridge(->bridge->...)->encoder chain is static. And the crtc for an encoder you find by walking the connector states in a
drm_atomic_state, finding the right one that points at your encoder, and then return the ->crtc pointer from that connector state.Quoted 4 lines
It's a bit bonkers, but I think it's better to compute this than adding more pointers that potentially diverge. Unless there's a grand plan here, but then I think we want some safety checks that all the pointers never get out of sync here.
That work stemed from this series
https://lore.kernel.org/all/[email protected]/and in particular:
https://lore.kernel.org/all/[email protected]/Bridges, outside of the modesetting code path, don't have a way to access the
drm_atomic_statesincedrm_bridge_state->stateis typically cleared afterswap_state. So accessing the connectors and CRTCs don't work anymore.In this particular case, we needed to access those from the bridge interrupt handler.
Quoted 6 lines
Quoted 2 lines
Uh for interrupt handler you can't use anything stored in state objects anyway. So I'm even more confused.
Why not? As long as we're in a threaded handler, and take the proper locks, what's wrong with it, and how is it fundamentally different than, idk, cec or audio hooks?
Well, _threaded_ interrupt handler is a quite important distinction. Then it's indeed fine from a locking pov. I'm still not sure it's actually what you want, because obj->state is the logical state. It does not reflect the hw state, and grabbing a lock won't change that. You can do nonblocking atomic modeset changes after all. So you might still run the risk that your irq handler is looking at state which does not reflect the actual hw configuration. And if it's then messing around with it, you're racing against a concurrent atomic commit work.
This is why all the vblank state is protected by separate spinlocks, and copied over to that separate state at the appropriate time within the atomic commit sequence. So if you need something like this for bridges, you probably need still need the spinlock (or a mutex, for threaded interrupt handlers) and separate state.
Meaning: I'm still rather skeptical of what you're doing here ... -Sima
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Maxime Ripard
maintainerPATCH v3 32/37 drm/bridge: Make encoder pointer deprecated
In reply to Maxime RipardOther entities (drm_connector.crtc, drm_encoder.crtc, etc.) have pointer to other currently bound entities. They are all considered relevant only for non-atomic drivers, and generally perceived as deprecated in favour of the equivalent pointers in the atomic states.
It used to be useful because we didn't have alternatives, but now that we do, let's make sure it's done for drm_bridge.encoder too.
--- include/drm/drm_bridge.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
include/drm/drm_bridge.h +7 -1
@@ -822,12 +822,18 @@ enum drm_bridge_ops {struct drm_bridge {/** @base: inherit from &drm_private_object */ struct drm_private_obj base;/** @dev: DRM device this bridge belongs to */ struct drm_device *dev; -/** @encoder: encoder to which this bridge is connected */ + +/** @encoder: +* +* encoder to which this bridge is connected. Only meaningful +* for non-atomic drivers. Deprecated. +*/ struct drm_encoder *encoder; +/** @chain_node: used to form a bridge chain */ struct list_head chain_node;/** @of_node: device node pointer to the bridge */ struct device_node *of_node;/** @list: to keep track of all added bridges */
Signature · 1 line
2.48.0
Re: [PATCH v3 32/37] drm/bridge: Make encoder pointer deprecated
Quoted 4 lines · Maxime Ripard
Other entities (drm_connector.crtc, drm_encoder.crtc, etc.) have pointer to other currently bound entities. They are all considered relevant only for non-atomic drivers, and generally perceived as deprecated in favour of the equivalent pointers in the atomic states.
I think there is a significant difference between mentioned fields and drm_bridge.encoder: the former fields are variable and can change. The latter one is static and set at the bridge attachment time. Nevertheless I think it is a good idea to deprecate it.
Quoted 9 lines
It used to be useful because we didn't have alternatives, but now that we do, let's make sure it's done for drm_bridge.encoder too.
Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by Maxime Ripard <[email protected]>--- include/drm/drm_bridge.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerRe: [PATCH v3 32/37] drm/bridge: Make encoder pointer deprecated
Quoted 10 lines · Dmitry Baryshkov
Quoted 4 lines · Maxime Ripard
Other entities (drm_connector.crtc, drm_encoder.crtc, etc.) have pointer to other currently bound entities. They are all considered relevant only for non-atomic drivers, and generally perceived as deprecated in favour of the equivalent pointers in the atomic states.
I think there is a significant difference between mentioned fields and drm_bridge.encoder: the former fields are variable and can change. The latter one is static and set at the bridge attachment time. Nevertheless I think it is a good idea to deprecate it.
I'm sorry, it's not clear to me here what you want here either. Do you want me to change anything to that patch?
Maxime
Re: [PATCH v3 32/37] drm/bridge: Make encoder pointer deprecated
Quoted 7 lines · Maxime Ripard
Quoted 6 lines · Dmitry Baryshkov
Quoted 4 lines · Maxime Ripard
Other entities (drm_connector.crtc, drm_encoder.crtc, etc.) have pointer to other currently bound entities. They are all considered relevant only for non-atomic drivers, and generally perceived as deprecated in favour of the equivalent pointers in the atomic states.
Quoted 7 lines
Quoted 4 lines
I think there is a significant difference between mentioned fields and drm_bridge.encoder: the former fields are variable and can change. The latter one is static and set at the bridge attachment time. Nevertheless I think it is a good idea to deprecate it.
I'm sorry, it's not clear to me here what you want here either. Do you want me to change anything to that patch?
Well... I was thinking if we should expand the commit message. Most likely it's fine though. In the end, I've r-b'ed the patch.
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v3 32/37] drm/bridge: Make encoder pointer deprecated
Quoted 13 lines · Dmitry Baryshkov
Quoted 12 lines · Maxime Ripard
Quoted 10 lines · Dmitry Baryshkov
Quoted 4 lines · Maxime Ripard
Other entities (drm_connector.crtc, drm_encoder.crtc, etc.) have pointer to other currently bound entities. They are all considered relevant only for non-atomic drivers, and generally perceived as deprecated in favour of the equivalent pointers in the atomic states.
I think there is a significant difference between mentioned fields and drm_bridge.encoder: the former fields are variable and can change. The latter one is static and set at the bridge attachment time. Nevertheless I think it is a good idea to deprecate it.
Quoted 5 lines
Quoted 2 lines
I'm sorry, it's not clear to me here what you want here either. Do you want me to change anything to that patch?
Well... I was thinking if we should expand the commit message. Most likely it's fine though. In the end, I've r-b'ed the patch.
I think this one is wrong, since the bridge->encoder link is static. This is unlike the connector->encoder->crtc chain, which isn't, and where you really want to go through the atomic states or you get funny stuff.
I don't think we have bridge chains with multiple connectors though, so this is fairly academic and so maybe still a good idea to make this all more flexible? Unless I've missed the memo and atomic bridges have flexible routing, and in that case yes this shouldn't be used.
Mildly confused ...
-Sima
Signature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Re: [PATCH v3 32/37] drm/bridge: Make encoder pointer deprecated
Quoted 20 lines · Simona Vetter
Quoted 13 lines · Dmitry Baryshkov
Quoted 12 lines · Maxime Ripard
Quoted 10 lines · Dmitry Baryshkov
Quoted 4 lines · Maxime Ripard
Other entities (drm_connector.crtc, drm_encoder.crtc, etc.) have pointer to other currently bound entities. They are all considered relevant only for non-atomic drivers, and generally perceived as deprecated in favour of the equivalent pointers in the atomic states.
I think there is a significant difference between mentioned fields and drm_bridge.encoder: the former fields are variable and can change. The latter one is static and set at the bridge attachment time. Nevertheless I think it is a good idea to deprecate it.
Quoted 5 lines
Quoted 2 lines
I'm sorry, it's not clear to me here what you want here either. Do you want me to change anything to that patch?
Well... I was thinking if we should expand the commit message. Most likely it's fine though. In the end, I've r-b'ed the patch.
Quoted 8 lines
I think this one is wrong, since the
bridge->encoderlink is static. This is unlike theconnector->encoder->crtcchain, which isn't, and where you really want to go through the atomic states or you get funny stuff.I don't think we have bridge chains with multiple connectors though, so this is fairly academic and so maybe still a good idea to make this all more flexible? Unless I've missed the memo and atomic bridges have flexible routing, and in that case yes this shouldn't be used.
No, bridges are still attached to a single encoder, however I see Maxime's idea in uniformity. It's easier to remember that all direct pointers are deprecated rather than remembering that bridge->encoder is static, but everything else is dynamic and should be accessed through the state.
Quoted 7 lines
Mildly confused ...
-SimaSignature · 3 lines
Simona Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerRe: [PATCH v3 32/37] drm/bridge: Make encoder pointer deprecated
Quoted 30 lines · Dmitry Baryshkov
Quoted 20 lines · Simona Vetter
Quoted 13 lines · Dmitry Baryshkov
Quoted 12 lines · Maxime Ripard
Quoted 10 lines · Dmitry Baryshkov
Quoted 4 lines · Maxime Ripard
Other entities (drm_connector.crtc, drm_encoder.crtc, etc.) have pointer to other currently bound entities. They are all considered relevant only for non-atomic drivers, and generally perceived as deprecated in favour of the equivalent pointers in the atomic states.
I think there is a significant difference between mentioned fields and drm_bridge.encoder: the former fields are variable and can change. The latter one is static and set at the bridge attachment time. Nevertheless I think it is a good idea to deprecate it.
Quoted 5 lines
Quoted 2 lines
I'm sorry, it's not clear to me here what you want here either. Do you want me to change anything to that patch?
Well... I was thinking if we should expand the commit message. Most likely it's fine though. In the end, I've r-b'ed the patch.
Quoted 8 lines
I think this one is wrong, since the
bridge->encoderlink is static. This is unlike theconnector->encoder->crtcchain, which isn't, and where you really want to go through the atomic states or you get funny stuff.I don't think we have bridge chains with multiple connectors though, so this is fairly academic and so maybe still a good idea to make this all more flexible? Unless I've missed the memo and atomic bridges have flexible routing, and in that case yes this shouldn't be used.
Quoted 5 lines
No, bridges are still attached to a single encoder, however I see Maxime's idea in uniformity. It's easier to remember that all direct pointers are deprecated rather than remembering that
bridge->encoderis static, but everything else is dynamic and should be accessed through the state.
Yeah, I still find it a bit inconsistent, but the new approach Sima suggested on IRC the other day increases its usage, so it's even more weird to both deprecate and use it more heavily in this series :)
I've dropped that patch
Maxime
Maxime Ripard
maintainerPATCH v3 33/37 drm/bridge: cdns-csi: Switch to atomic helpers
In reply to Maxime RipardThe Cadence DSI driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers.
This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the CRTC pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
--- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 29 ++++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c +20 -9
@@ -654,11 +654,12 @@ cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge,return MODE_BAD ;return MODE_OK ; } -static void cdns_dsi_bridge_disable (struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct cdns_dsi_input *input =bridge_to_cdns_dsi_input (bridge);struct cdns_dsi *dsi =input_to_dsi (input);u32 val;
@@ -674,11 +675,12 @@ static void cdns_dsi_bridge_disable(struct drm_bridge *bridge) dsi->platform_ops->disable (dsi);pm_runtime_put (dsi->base.dev); } -static void cdns_dsi_bridge_post_disable (struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_post_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct cdns_dsi_input *input =bridge_to_cdns_dsi_input (bridge);struct cdns_dsi *dsi =input_to_dsi (input);pm_runtime_put (dsi->base.dev);
@@ -751,15 +753,18 @@ static void cdns_dsi_init_link(struct cdns_dsi *dsi)writel (val, dsi->regs +MCTL_MAIN_EN ); dsi->link_initialized = true; } -static void cdns_dsi_bridge_enable (struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct cdns_dsi_input *input =bridge_to_cdns_dsi_input (bridge);struct cdns_dsi *dsi =input_to_dsi (input);struct cdns_dsi_output *output = &dsi->output; +struct drm_bridge_state *bridge_state; +struct drm_crtc_state *crtc_state;struct drm_display_mode *mode;struct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy;unsigned long tx_byte_period;struct cdns_dsi_cfg dsi_cfg;u32 tmp, reg_wakeup, div;
@@ -769,11 +774,13 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)return ;if (dsi->platform_ops && dsi->platform_ops->enable) dsi->platform_ops->enable (dsi); - mode = &bridge->encoder->crtc->state->adjusted_mode; + bridge_state =drm_atomic_get_new_bridge_state (state, bridge); + crtc_state =drm_atomic_get_new_crtc_state (state, bridge_state->crtc); + mode = &crtc_state->adjusted_mode; nlanes = output->dev->lanes;WARN_ON_ONCE (cdns_dsi_check_conf (dsi, mode, &dsi_cfg, false));cdns_dsi_hs_init (dsi);
@@ -891,11 +898,12 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge) tmp =readl (dsi->regs +MCTL_MAIN_EN ) |IF_EN (input->id);writel (tmp, dsi->regs +MCTL_MAIN_EN ); } -static void cdns_dsi_bridge_pre_enable (struct drm_bridge *bridge) +static void cdns_dsi_bridge_atomic_pre_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct cdns_dsi_input *input =bridge_to_cdns_dsi_input (bridge);struct cdns_dsi *dsi =input_to_dsi (input);if (WARN_ON (pm_runtime_get_sync (dsi->base.dev) <0 ))
@@ -906,14 +914,17 @@ static void cdns_dsi_bridge_pre_enable(struct drm_bridge *bridge) }static const struct drm_bridge_funcs cdns_dsi_bridge_funcs = { .attach = cdns_dsi_bridge_attach, .mode_valid = cdns_dsi_bridge_mode_valid, - .disable = cdns_dsi_bridge_disable, - .pre_enable = cdns_dsi_bridge_pre_enable, - .enable = cdns_dsi_bridge_enable, - .post_disable = cdns_dsi_bridge_post_disable, + .atomic_disable = cdns_dsi_bridge_atomic_disable, + .atomic_pre_enable = cdns_dsi_bridge_atomic_pre_enable, + .atomic_enable = cdns_dsi_bridge_atomic_enable, + .atomic_post_disable = cdns_dsi_bridge_atomic_post_disable, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, };static int cdns_dsi_attach (struct mipi_dsi_host *host,struct mipi_dsi_device *dev) {
Signature · 1 line
2.48.0
Re: [PATCH v3 33/37] drm/bridge: cdns-csi: Switch to atomic helpers
Quoted 8 lines · Maxime Ripard
The Cadence DSI driver follows the
drm_encoder->crtcpointer that is deprecated and shouldn't be used by atomic drivers.This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the CRTC pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
Quoted 5 lines
Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/bridge/cadence/cdns-dsi-core.c | 29 ++++++++++++++++++-------- 1 file changed, 20 insertions(+), 9 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 34/37 drm/bridge: tc358775: Switch to atomic commit
In reply to Maxime RipardThe tc358775 driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers.
This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the CRTC pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
--- drivers/gpu/drm/bridge/tc358775.c | 41 +++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 23 deletions(-)
drivers/gpu/drm/bridge/tc358775.c +18 -23
@@ -284,11 +284,12 @@ struct tc_data {static inline struct tc_data *bridge_to_tc (struct drm_bridge *b) { return container_of(b, struct tc_data, bridge); } -static void tc_bridge_pre_enable (struct drm_bridge *bridge) +static void tc_bridge_atomic_pre_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc_data *tc =bridge_to_tc (bridge);struct device *dev = &tc->dsi->dev;int ret;
@@ -307,11 +308,12 @@ static void tc_bridge_pre_enable(struct drm_bridge *bridge)gpiod_set_value (tc->reset_gpio,0 );usleep_range (10 ,20 ); } -static void tc_bridge_post_disable (struct drm_bridge *bridge) +static void tc_bridge_atomic_post_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc_data *tc =bridge_to_tc (bridge);struct device *dev = &tc->dsi->dev;int ret;
@@ -366,34 +368,24 @@ static void d2l_write(struct i2c_client *i2c, u16 addr, u32 val)if (ret <0 )dev_err (&i2c->dev,"Error %d writing to subaddress 0x%x\n" , ret, addr); } -/* helper function to access bus_formats */ -static struct drm_connector *get_connector (struct drm_encoder *encoder) -{ -struct drm_device *dev = encoder->dev; -struct drm_connector *connector; - -list_for_each_entry (connector, &dev->mode_config.connector_list, head) -if (connector->encoder == encoder) -return connector; - -return NULL ; -} - -static void tc_bridge_enable (struct drm_bridge *bridge) +static void tc_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc_data *tc =bridge_to_tc (bridge);u32 hback_porch, hsync_len, hfront_porch, hactive, htime1, htime2;u32 vback_porch, vsync_len, vfront_porch, vactive, vtime1, vtime2;u32 val =0 ;u16 dsiclk, clkdiv, byteclk, t1, t2, t3, vsdelay; -struct drm_display_mode *mode; -struct drm_connector *connector =get_connector (bridge->encoder); - - mode = &bridge->encoder->crtc->state->adjusted_mode; +struct drm_bridge_state *bridge_state = +drm_atomic_get_new_bridge_state (state, bridge); +struct drm_connector *connector = bridge_state->connector; +struct drm_crtc_state *crtc_state = +drm_atomic_get_new_crtc_state (state, bridge_state->crtc); +struct drm_display_mode *mode = &crtc_state->adjusted_mode; hback_porch = mode->htotal - mode->hsync_end; hsync_len = mode->hsync_end - mode->hsync_start; vback_porch = mode->vtotal - mode->vsync_end; vsync_len = mode->vsync_end - mode->vsync_start;
@@ -599,14 +591,17 @@ static int tc_bridge_attach(struct drm_bridge *bridge, &tc->bridge, flags); }static const struct drm_bridge_funcs tc_bridge_funcs = { .attach = tc_bridge_attach, - .pre_enable = tc_bridge_pre_enable, - .enable = tc_bridge_enable, + .atomic_pre_enable = tc_bridge_atomic_pre_enable, + .atomic_enable = tc_bridge_atomic_enable, .mode_valid = tc_mode_valid, - .post_disable = tc_bridge_post_disable, + .atomic_post_disable = tc_bridge_atomic_post_disable, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, };static int tc_attach_host (struct tc_data *tc) {struct device *dev = &tc->i2c->dev;
Signature · 1 line
2.48.0
Re: [PATCH v3 34/37] drm/bridge: tc358775: Switch to atomic commit
Quoted 8 lines · Maxime Ripard
The tc358775 driver follows the
drm_encoder->crtcpointer that is deprecated and shouldn't be used by atomic drivers.This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the CRTC pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
Quoted 5 lines
Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/bridge/tc358775.c | 41 +++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 23 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 35/37 drm/bridge: tc358768: Stop disabling when failing to enable
In reply to Maxime RipardThe tc358768 bridge driver, if enabling it fails, tries to disable it. This is pretty uncommon in bridge drivers, and also stands in the way for further reworks.
Worse, since pre_enable and enable aren't expected to fail, disable and post_disable might be called twice: once to handle the failure, and once to actually disable the bridge.
Since post_disable uses regulators and clocks, this would lead to enable count imbalances.
In order to prevent that imbalance, and to allow further reworks, let's drop the calls to disable and post_disable, but keep the warning to let users know about what's going on.
--- drivers/gpu/drm/bridge/tc358768.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/gpu/drm/bridge/tc358768.c +2 -8
@@ -1075,15 +1075,12 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) val =TC358768_DSI_CONFW_MODE_CLR |TC358768_DSI_CONFW_ADDR_DSI_CONTROL ; val |=TC358768_DSI_CONTROL_DIS_MODE ;/* DSI mode */ tc358768_write (priv,TC358768_DSI_CONFW , val); ret =tc358768_clear_error (priv); -if (ret) { +if (ret)dev_err (dev,"Bridge pre_enable failed: %d\n" , ret); -tc358768_bridge_disable (bridge); -tc358768_bridge_post_disable (bridge); - } }static void tc358768_bridge_enable (struct drm_bridge *bridge) {struct tc358768_priv *priv =bridge_to_tc358768 (bridge);
@@ -1099,15 +1096,12 @@ static void tc358768_bridge_enable(struct drm_bridge *bridge)/* set PP_en */ tc358768_update_bits (priv,TC358768_CONFCTL ,BIT (6 ),BIT (6 )); ret =tc358768_clear_error (priv); -if (ret) { +if (ret)dev_err (priv->dev,"Bridge enable failed: %d\n" , ret); -tc358768_bridge_disable (bridge); -tc358768_bridge_post_disable (bridge); - } }#define MAX_INPUT_SEL_FORMATS 1 static u32 *
Signature · 1 line
2.48.0
Re: [PATCH v3 35/37] drm/bridge: tc358768: Stop disabling when failing to enable
Quoted 11 lines · Maxime Ripard
The tc358768 bridge driver, if enabling it fails, tries to disable it. This is pretty uncommon in bridge drivers, and also stands in the way for further reworks.
Worse, since
pre_enableand enable aren't expected to fail, disable andpost_disablemight be called twice: once to handle the failure, and once to actually disable the bridge.Since
post_disableuses regulators and clocks, this would lead to enable count imbalances.
Quoted 9 lines
In order to prevent that imbalance, and to allow further reworks, let's drop the calls to disable and
post_disable, but keep the warning to let users know about what's going on.Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/bridge/tc358768.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
Quoted 1 line
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 36/37 drm/bridge: tc358768: Convert to atomic helpers
In reply to Maxime RipardThe tc358768 driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers.
This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
--- drivers/gpu/drm/bridge/tc358768.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
drivers/gpu/drm/bridge/tc358768.c +17 -9
@@ -579,11 +579,12 @@ tc358768_bridge_mode_valid(struct drm_bridge *bridge,return MODE_CLOCK_RANGE ;return MODE_OK ; } -static void tc358768_bridge_disable (struct drm_bridge *bridge) +static void tc358768_bridge_atomic_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc358768_priv *priv =bridge_to_tc358768 (bridge);int ret;/* set FrmStop */
@@ -601,11 +602,12 @@ static void tc358768_bridge_disable(struct drm_bridge *bridge) ret =tc358768_clear_error (priv);if (ret)dev_warn (priv->dev,"Software disable failed: %d\n" , ret); } -static void tc358768_bridge_post_disable (struct drm_bridge *bridge) +static void tc358768_bridge_atomic_post_disable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc358768_priv *priv =bridge_to_tc358768 (bridge);tc358768_hw_disable (priv); }
@@ -681,17 +683,20 @@ static u32 tc358768_dsi_bytes_to_ns(struct tc358768_priv *priv, u32 val)u64 n = priv->dsiclk /4 * priv->dsi_lanes;return (u32 )div_u64 (m, n); } -static void tc358768_bridge_pre_enable (struct drm_bridge *bridge) +static void tc358768_bridge_atomic_pre_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc358768_priv *priv =bridge_to_tc358768 (bridge);struct mipi_dsi_device *dsi_dev = priv->output.dev;unsigned long mode_flags = dsi_dev->mode_flags;u32 val, val2, lptxcnt, hact, data_type;s32 raw_val; +struct drm_crtc_state *crtc_state; +struct drm_bridge_state *bridge_state;const struct drm_display_mode *mode;u32 hsbyteclk_ps, dsiclk_ps, ui_ps;u32 dsiclk, hsbyteclk;int ret, i;struct videomode vm;
@@ -718,11 +723,13 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge)dev_err (dev,"Software reset failed: %d\n" , ret);tc358768_hw_disable (priv);return ; } - mode = &bridge->encoder->crtc->state->adjusted_mode; + bridge_state =drm_atomic_get_new_bridge_state (state, bridge); + crtc_state =drm_atomic_get_new_crtc_state (state, bridge_state->crtc); + mode = &crtc_state->adjusted_mode; ret =tc358768_setup_pll (priv, mode);if (ret) {dev_err (dev,"PLL setup failed: %d\n" , ret);tc358768_hw_disable (priv);return ;
@@ -1079,11 +1086,12 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) ret =tc358768_clear_error (priv);if (ret)dev_err (dev,"Bridge pre_enable failed: %d\n" , ret); } -static void tc358768_bridge_enable (struct drm_bridge *bridge) +static void tc358768_bridge_atomic_enable (struct drm_bridge *bridge, +struct drm_atomic_state *state) {struct tc358768_priv *priv =bridge_to_tc358768 (bridge);int ret;if (!priv->enabled) {
@@ -1159,14 +1167,14 @@ static bool tc358768_mode_fixup(struct drm_bridge *bridge,static const struct drm_bridge_funcs tc358768_bridge_funcs = { .attach = tc358768_bridge_attach, .mode_valid = tc358768_bridge_mode_valid, .mode_fixup = tc358768_mode_fixup, - .pre_enable = tc358768_bridge_pre_enable, - .enable = tc358768_bridge_enable, - .disable = tc358768_bridge_disable, - .post_disable = tc358768_bridge_post_disable, + .atomic_pre_enable = tc358768_bridge_atomic_pre_enable, + .atomic_enable = tc358768_bridge_atomic_enable, + .atomic_disable = tc358768_bridge_atomic_disable, + .atomic_post_disable = tc358768_bridge_atomic_post_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, .atomic_get_input_bus_fmts = tc358768_atomic_get_input_bus_fmts,
Signature · 1 line
2.48.0
Re: [PATCH v3 36/37] drm/bridge: tc358768: Convert to atomic helpers
Quoted 8 lines · Maxime Ripard
The tc358768 driver follows the
drm_encoder->crtcpointer that is deprecated and shouldn't be used by atomic drivers.This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
Quoted 5 lines
Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/bridge/tc358768.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-)
Signature · 2 lines
With best wishes Dmitry
Maxime Ripard
maintainerPATCH v3 37/37 drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer
In reply to Maxime RipardThe TI sn65dsi86 driver follows the drm_encoder->crtc pointer that is deprecated and shouldn't be used by atomic drivers.
This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 58 +++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 19 deletions(-)
drivers/gpu/drm/bridge/ti-sn65dsi86.c +39 -19
@@ -241,15 +241,28 @@ static void ti_sn65dsi86_write_u16(struct ti_sn65dsi86 *pdata,u8 buf[2 ] = { val &0xff , val >>8 };regmap_bulk_write (pdata->regmap, reg, buf,ARRAY_SIZE (buf)); } -static u32 ti_sn_bridge_get_dsi_freq (struct ti_sn65dsi86 *pdata) +static struct drm_display_mode * +get_new_adjusted_display_mode (struct drm_bridge *bridge, +struct drm_atomic_state *state) +{ +struct drm_bridge_state *bridge_state = +drm_atomic_get_new_bridge_state (state, bridge); +struct drm_crtc_state *crtc_state = +drm_atomic_get_new_crtc_state (state, bridge_state->crtc); + +return &crtc_state->adjusted_mode; +} + +static u32 ti_sn_bridge_get_dsi_freq (struct ti_sn65dsi86 *pdata, +struct drm_atomic_state *state) {u32 bit_rate_khz, clk_freq_khz;struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; +get_new_adjusted_display_mode (&pdata->bridge, state); bit_rate_khz = mode->clock *mipi_dsi_pixel_format_to_bpp (pdata->dsi->format); clk_freq_khz = bit_rate_khz / (pdata->dsi->lanes *2 );
@@ -272,11 +285,12 @@ static const u32 ti_sn_bridge_dsiclk_lut[] = {416000000 ,486000000 , 460800000, }; -static void ti_sn_bridge_set_refclk_freq (struct ti_sn65dsi86 *pdata) +static void ti_sn_bridge_set_refclk_freq (struct ti_sn65dsi86 *pdata, +struct drm_atomic_state *state) {int i;u32 refclk_rate;const u32 *refclk_lut;size_t refclk_lut_size;
@@ -285,11 +299,11 @@ static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata) refclk_rate =clk_get_rate (pdata->refclk); refclk_lut = ti_sn_bridge_refclk_lut; refclk_lut_size =ARRAY_SIZE (ti_sn_bridge_refclk_lut);clk_prepare_enable (pdata->refclk); }else { - refclk_rate =ti_sn_bridge_get_dsi_freq (pdata) *1000 ; + refclk_rate =ti_sn_bridge_get_dsi_freq (pdata, state) *1000 ; refclk_lut = ti_sn_bridge_dsiclk_lut; refclk_lut_size =ARRAY_SIZE (ti_sn_bridge_dsiclk_lut); }/* for i equals to refclk_lut_size means default frequency */
@@ -309,16 +323,17 @@ static void ti_sn_bridge_set_refclk_freq(struct ti_sn65dsi86 *pdata)* regardless of its actual sourcing. */ pdata->pwm_refclk_freq = ti_sn_bridge_refclk_lut[i]; } -static void ti_sn65dsi86_enable_comms (struct ti_sn65dsi86 *pdata) +static void ti_sn65dsi86_enable_comms (struct ti_sn65dsi86 *pdata, +struct drm_atomic_state *state) {mutex_lock (&pdata->comms_mutex);/* configure bridge ref_clk */ -ti_sn_bridge_set_refclk_freq (pdata); +ti_sn_bridge_set_refclk_freq (pdata, state);/* * HPD on this bridge chip is a bit useless. This is an eDP bridge * so the HPD is an internal signal that's only there to signal that * the panel is done powering up. ...but the bridge chip debounces
@@ -374,11 +389,11 @@ static int __maybe_unused ti_sn65dsi86_resume(struct device *dev)* so we can do it in resume which lets us read the EDID before * pre_enable(). Without a reference clock we need the MIPI reference * clock so reading early doesn't work. */ if (pdata->refclk) -ti_sn65dsi86_enable_comms (pdata); +ti_sn65dsi86_enable_comms (pdata,NULL );return ret; }static int __maybe_unused ti_sn65dsi86_suspend (struct device *dev)
@@ -820,16 +835,17 @@ static void ti_sn_bridge_atomic_disable(struct drm_bridge *bridge,/* disable video stream */ regmap_update_bits (pdata->regmap,SN_ENH_FRAME_REG ,VSTREAM_ENABLE ,0 ); } -static void ti_sn_bridge_set_dsi_rate (struct ti_sn65dsi86 *pdata) +static void ti_sn_bridge_set_dsi_rate (struct ti_sn65dsi86 *pdata, +struct drm_atomic_state *state) {unsigned int bit_rate_mhz, clk_freq_mhz;unsigned int val;struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; +get_new_adjusted_display_mode (&pdata->bridge, state);/* set DSIA clk frequency */ bit_rate_mhz = (mode->clock /1000 ) *mipi_dsi_pixel_format_to_bpp (pdata->dsi->format); clk_freq_mhz = bit_rate_mhz / (pdata->dsi->lanes *2 );
@@ -855,16 +871,18 @@ static unsigned int ti_sn_bridge_get_bpp(struct drm_connector *connector)*/ static const unsigned int ti_sn_bridge_dp_rate_lut[] = {0 ,1620 ,2160 ,2430 ,2700 ,3240 ,4320 ,5400 }; -static int ti_sn_bridge_calc_min_dp_rate_idx (struct ti_sn65dsi86 *pdata,unsigned int bpp) +static int ti_sn_bridge_calc_min_dp_rate_idx (struct ti_sn65dsi86 *pdata, +struct drm_atomic_state *state, +unsigned int bpp) {unsigned int bit_rate_khz, dp_rate_mhz;unsigned int i;struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; +get_new_adjusted_display_mode (&pdata->bridge, state);/* Calculate minimum bit rate based on our pixel clock. */ bit_rate_khz = mode->clock * bpp;/* Calculate minimum DP data rate, taking 80% as per DP spec */
@@ -959,14 +977,15 @@ static unsigned int ti_sn_bridge_read_valid_rates(struct ti_sn65dsi86 *pdata) }return valid_rates; } -static void ti_sn_bridge_set_video_timings (struct ti_sn65dsi86 *pdata) +static void ti_sn_bridge_set_video_timings (struct ti_sn65dsi86 *pdata, +struct drm_atomic_state *state) {struct drm_display_mode *mode = - &pdata->bridge.encoder->crtc->state->adjusted_mode; +get_new_adjusted_display_mode (&pdata->bridge, state);u8 hsync_polarity =0 , vsync_polarity =0 ;if (mode->flags &DRM_MODE_FLAG_NHSYNC ) hsync_polarity =CHA_HSYNC_POLARITY ;if (mode->flags &DRM_MODE_FLAG_NVSYNC )
@@ -1075,21 +1094,22 @@ static int ti_sn_link_training(struct ti_sn65dsi86 *pdata, int dp_rate_idx,static void ti_sn_bridge_atomic_enable (struct drm_bridge *bridge,struct drm_atomic_state *state) {struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge); +struct drm_bridge_state *bridge_state;struct drm_connector *connector;const char *last_err_str ="No supported DP rate" ;unsigned int valid_rates;int dp_rate_idx;unsigned int val;int ret = -EINVAL ;int max_dp_lanes;unsigned int bpp; - connector =drm_atomic_get_new_connector_for_encoder (state, - bridge->encoder); + bridge_state =drm_atomic_get_new_bridge_state (state, bridge); + connector = bridge_state->connector;if (!connector) {dev_err_ratelimited (pdata->dev,"Could not get the connector\n" );return ; }
@@ -1104,11 +1124,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge,regmap_write (pdata->regmap,SN_LN_ASSIGN_REG , pdata->ln_assign);regmap_update_bits (pdata->regmap,SN_ENH_FRAME_REG ,LN_POLRS_MASK , pdata->ln_polrs <<LN_POLRS_OFFSET );/* set dsi clk frequency value */ -ti_sn_bridge_set_dsi_rate (pdata); +ti_sn_bridge_set_dsi_rate (pdata, state);/* * The SN65DSI86 only supports ASSR Display Authentication method and * this method is enabled for eDP panels. An eDP panel must support this * authentication method. We need to enable this method in the eDP panel
@@ -1139,11 +1159,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge, val); valid_rates =ti_sn_bridge_read_valid_rates (pdata);/* Train until we run out of rates */ -for (dp_rate_idx =ti_sn_bridge_calc_min_dp_rate_idx (pdata, bpp); +for (dp_rate_idx =ti_sn_bridge_calc_min_dp_rate_idx (pdata, state, bpp); dp_rate_idx <ARRAY_SIZE (ti_sn_bridge_dp_rate_lut); dp_rate_idx++) {if (!(valid_rates &BIT (dp_rate_idx)))continue ;
@@ -1155,11 +1175,11 @@ static void ti_sn_bridge_atomic_enable(struct drm_bridge *bridge,DRM_DEV_ERROR (pdata->dev,"%s (%d)\n" , last_err_str, ret);return ; }/* config video parameters */ -ti_sn_bridge_set_video_timings (pdata); +ti_sn_bridge_set_video_timings (pdata, state);/* enable video stream */ regmap_update_bits (pdata->regmap,SN_ENH_FRAME_REG ,VSTREAM_ENABLE ,VSTREAM_ENABLE ); }
@@ -1170,11 +1190,11 @@ static void ti_sn_bridge_atomic_pre_enable(struct drm_bridge *bridge,struct ti_sn65dsi86 *pdata =bridge_to_ti_sn65dsi86 (bridge);pm_runtime_get_sync (pdata->dev);if (!pdata->refclk) -ti_sn65dsi86_enable_comms (pdata); +ti_sn65dsi86_enable_comms (pdata, state);/* td7: min 100 us after enable before DSI data */ usleep_range (100 ,110 ); }
Signature · 1 line
2.48.0
Re: [PATCH v3 37/37] drm/bridge: ti-sn65dsi86: Use bridge_state crtc pointer
Hi,
Quoted 9 lines · Maxime Ripard
The TI sn65dsi86 driver follows the
drm_encoder->crtcpointer that is deprecated and shouldn't be used by atomic drivers.This was due to the fact that we did't have any other alternative to retrieve the CRTC pointer. Fortunately, the crtc pointer is now provided in the bridge state, so we can move to atomic callbacks and drop that deprecated pointer usage.
Quoted 4 lines
Signed-off-by Maxime Ripard <[email protected]>--- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 58 +++++++++++++++++++++++------------ 1 file changed, 39 insertions(+), 19 deletions(-)
While I'm not an expert on all the concepts addressed in this series, the patch does look reasonable to me from the point of view of ti-sn65dsi86. Thus:
I can confirm that on sc7180-trogdor-coachz that the display still comes up after this patch:
Maxime Ripard
maintainerQuoted 5 lines · Maxime Ripard
Hi,
Here's a series of changes after to the KMS helpers and bridge API following a bunch of reviews I did.
Quoted 8 lines
It's mostly centered across providing an easier time to deal with bridge states, and a somewhat consistent with the other entities API.
It's build tested only, with arm64 allmodconfig.
Maxime
Signed-off-by Maxime Ripard <[email protected]>
Merged patches 1-26 into drm-misc-next
Maxime