Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "drm/atomic-helper: Re-order bridge chain pre-enable and post-disable"

This reverts commit c9b1150a68d9362a0827609fc0dc1664c0d8bfe1.

Changing the enable/disable sequence has caused regressions on multiple
platforms: R-Car, MCDE, Rockchip. A series (see link below) was sent to
fix these, but it was decided that it's better to revert the original
patch and change the enable/disable sequence only in the tidss driver.

Reverting this commit breaks tidss's DSI and OLDI outputs, which will be
fixed in the following commits.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Link: https://lore.kernel.org/all/20251202-mcde-drm-regression-thirdfix-v6-0-f1bffd4ec0fa%40kernel.org/
Fixes: c9b1150a68d9 ("drm/atomic-helper: Re-order bridge chain pre-enable and post-disable")
Cc: stable@vger.kernel.org # v6.17+
Reviewed-by: Aradhya Bhatia <aradhya.bhatia@linux.dev>
Reviewed-by: Maxime Ripard <mripard@kernel.org>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Tested-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20251205-drm-seq-fix-v1-1-fda68fa1b3de@ideasonboard.com

authored by

Tomi Valkeinen and committed by
Linus Walleij
c1ef9a6c 0ddd3bb4

+70 -187
+4 -4
drivers/gpu/drm/drm_atomic_helper.c
··· 1341 1341 { 1342 1342 encoder_bridge_disable(dev, state); 1343 1343 1344 - crtc_disable(dev, state); 1345 - 1346 1344 encoder_bridge_post_disable(dev, state); 1345 + 1346 + crtc_disable(dev, state); 1347 1347 } 1348 1348 1349 1349 /** ··· 1682 1682 void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, 1683 1683 struct drm_atomic_state *state) 1684 1684 { 1685 - encoder_bridge_pre_enable(dev, state); 1686 - 1687 1685 crtc_enable(dev, state); 1686 + 1687 + encoder_bridge_pre_enable(dev, state); 1688 1688 1689 1689 encoder_bridge_enable(dev, state); 1690 1690
+66 -183
include/drm/drm_bridge.h
··· 176 176 /** 177 177 * @disable: 178 178 * 179 - * The @disable callback should disable the bridge. 179 + * This callback should disable the bridge. It is called right before 180 + * the preceding element in the display pipe is disabled. If the 181 + * preceding element is a bridge this means it's called before that 182 + * bridge's @disable vfunc. If the preceding element is a &drm_encoder 183 + * it's called right before the &drm_encoder_helper_funcs.disable, 184 + * &drm_encoder_helper_funcs.prepare or &drm_encoder_helper_funcs.dpms 185 + * hook. 180 186 * 181 187 * The bridge can assume that the display pipe (i.e. clocks and timing 182 188 * signals) feeding it is still running when this callback is called. 183 - * 184 - * 185 - * If the preceding element is a &drm_bridge, then this is called before 186 - * that bridge is disabled via one of: 187 - * 188 - * - &drm_bridge_funcs.disable 189 - * - &drm_bridge_funcs.atomic_disable 190 - * 191 - * If the preceding element of the bridge is a display controller, then 192 - * this callback is called before the encoder is disabled via one of: 193 - * 194 - * - &drm_encoder_helper_funcs.atomic_disable 195 - * - &drm_encoder_helper_funcs.prepare 196 - * - &drm_encoder_helper_funcs.disable 197 - * - &drm_encoder_helper_funcs.dpms 198 - * 199 - * and the CRTC is disabled via one of: 200 - * 201 - * - &drm_crtc_helper_funcs.prepare 202 - * - &drm_crtc_helper_funcs.atomic_disable 203 - * - &drm_crtc_helper_funcs.disable 204 - * - &drm_crtc_helper_funcs.dpms. 205 189 * 206 190 * The @disable callback is optional. 207 191 * ··· 199 215 /** 200 216 * @post_disable: 201 217 * 218 + * This callback should disable the bridge. It is called right after the 219 + * preceding element in the display pipe is disabled. If the preceding 220 + * element is a bridge this means it's called after that bridge's 221 + * @post_disable function. If the preceding element is a &drm_encoder 222 + * it's called right after the encoder's 223 + * &drm_encoder_helper_funcs.disable, &drm_encoder_helper_funcs.prepare 224 + * or &drm_encoder_helper_funcs.dpms hook. 225 + * 202 226 * The bridge must assume that the display pipe (i.e. clocks and timing 203 - * signals) feeding this bridge is no longer running when the 204 - * @post_disable is called. 205 - * 206 - * This callback should perform all the actions required by the hardware 207 - * after it has stopped receiving signals from the preceding element. 208 - * 209 - * If the preceding element is a &drm_bridge, then this is called after 210 - * that bridge is post-disabled (unless marked otherwise by the 211 - * @pre_enable_prev_first flag) via one of: 212 - * 213 - * - &drm_bridge_funcs.post_disable 214 - * - &drm_bridge_funcs.atomic_post_disable 215 - * 216 - * If the preceding element of the bridge is a display controller, then 217 - * this callback is called after the encoder is disabled via one of: 218 - * 219 - * - &drm_encoder_helper_funcs.atomic_disable 220 - * - &drm_encoder_helper_funcs.prepare 221 - * - &drm_encoder_helper_funcs.disable 222 - * - &drm_encoder_helper_funcs.dpms 223 - * 224 - * and the CRTC is disabled via one of: 225 - * 226 - * - &drm_crtc_helper_funcs.prepare 227 - * - &drm_crtc_helper_funcs.atomic_disable 228 - * - &drm_crtc_helper_funcs.disable 229 - * - &drm_crtc_helper_funcs.dpms 227 + * signals) feeding it is no longer running when this callback is 228 + * called. 230 229 * 231 230 * The @post_disable callback is optional. 232 231 * ··· 252 285 /** 253 286 * @pre_enable: 254 287 * 288 + * This callback should enable the bridge. It is called right before 289 + * the preceding element in the display pipe is enabled. If the 290 + * preceding element is a bridge this means it's called before that 291 + * bridge's @pre_enable function. If the preceding element is a 292 + * &drm_encoder it's called right before the encoder's 293 + * &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or 294 + * &drm_encoder_helper_funcs.dpms hook. 295 + * 255 296 * The display pipe (i.e. clocks and timing signals) feeding this bridge 256 - * will not yet be running when the @pre_enable is called. 257 - * 258 - * This callback should perform all the necessary actions to prepare the 259 - * bridge to accept signals from the preceding element. 260 - * 261 - * If the preceding element is a &drm_bridge, then this is called before 262 - * that bridge is pre-enabled (unless marked otherwise by 263 - * @pre_enable_prev_first flag) via one of: 264 - * 265 - * - &drm_bridge_funcs.pre_enable 266 - * - &drm_bridge_funcs.atomic_pre_enable 267 - * 268 - * If the preceding element of the bridge is a display controller, then 269 - * this callback is called before the CRTC is enabled via one of: 270 - * 271 - * - &drm_crtc_helper_funcs.atomic_enable 272 - * - &drm_crtc_helper_funcs.commit 273 - * 274 - * and the encoder is enabled via one of: 275 - * 276 - * - &drm_encoder_helper_funcs.atomic_enable 277 - * - &drm_encoder_helper_funcs.enable 278 - * - &drm_encoder_helper_funcs.commit 297 + * will not yet be running when this callback is called. The bridge must 298 + * not enable the display link feeding the next bridge in the chain (if 299 + * there is one) when this callback is called. 279 300 * 280 301 * The @pre_enable callback is optional. 281 302 * ··· 277 322 /** 278 323 * @enable: 279 324 * 280 - * The @enable callback should enable the bridge. 325 + * This callback should enable the bridge. It is called right after 326 + * the preceding element in the display pipe is enabled. If the 327 + * preceding element is a bridge this means it's called after that 328 + * bridge's @enable function. If the preceding element is a 329 + * &drm_encoder it's called right after the encoder's 330 + * &drm_encoder_helper_funcs.enable, &drm_encoder_helper_funcs.commit or 331 + * &drm_encoder_helper_funcs.dpms hook. 281 332 * 282 333 * The bridge can assume that the display pipe (i.e. clocks and timing 283 334 * signals) feeding it is running when this callback is called. This 284 335 * callback must enable the display link feeding the next bridge in the 285 336 * chain if there is one. 286 - * 287 - * If the preceding element is a &drm_bridge, then this is called after 288 - * that bridge is enabled via one of: 289 - * 290 - * - &drm_bridge_funcs.enable 291 - * - &drm_bridge_funcs.atomic_enable 292 - * 293 - * If the preceding element of the bridge is a display controller, then 294 - * this callback is called after the CRTC is enabled via one of: 295 - * 296 - * - &drm_crtc_helper_funcs.atomic_enable 297 - * - &drm_crtc_helper_funcs.commit 298 - * 299 - * and the encoder is enabled via one of: 300 - * 301 - * - &drm_encoder_helper_funcs.atomic_enable 302 - * - &drm_encoder_helper_funcs.enable 303 - * - drm_encoder_helper_funcs.commit 304 337 * 305 338 * The @enable callback is optional. 306 339 * ··· 302 359 /** 303 360 * @atomic_pre_enable: 304 361 * 362 + * This callback should enable the bridge. It is called right before 363 + * the preceding element in the display pipe is enabled. If the 364 + * preceding element is a bridge this means it's called before that 365 + * bridge's @atomic_pre_enable or @pre_enable function. If the preceding 366 + * element is a &drm_encoder it's called right before the encoder's 367 + * &drm_encoder_helper_funcs.atomic_enable hook. 368 + * 305 369 * The display pipe (i.e. clocks and timing signals) feeding this bridge 306 - * will not yet be running when the @atomic_pre_enable is called. 307 - * 308 - * This callback should perform all the necessary actions to prepare the 309 - * bridge to accept signals from the preceding element. 310 - * 311 - * If the preceding element is a &drm_bridge, then this is called before 312 - * that bridge is pre-enabled (unless marked otherwise by 313 - * @pre_enable_prev_first flag) via one of: 314 - * 315 - * - &drm_bridge_funcs.pre_enable 316 - * - &drm_bridge_funcs.atomic_pre_enable 317 - * 318 - * If the preceding element of the bridge is a display controller, then 319 - * this callback is called before the CRTC is enabled via one of: 320 - * 321 - * - &drm_crtc_helper_funcs.atomic_enable 322 - * - &drm_crtc_helper_funcs.commit 323 - * 324 - * and the encoder is enabled via one of: 325 - * 326 - * - &drm_encoder_helper_funcs.atomic_enable 327 - * - &drm_encoder_helper_funcs.enable 328 - * - &drm_encoder_helper_funcs.commit 370 + * will not yet be running when this callback is called. The bridge must 371 + * not enable the display link feeding the next bridge in the chain (if 372 + * there is one) when this callback is called. 329 373 * 330 374 * The @atomic_pre_enable callback is optional. 331 375 */ ··· 322 392 /** 323 393 * @atomic_enable: 324 394 * 325 - * The @atomic_enable callback should enable the bridge. 395 + * This callback should enable the bridge. It is called right after 396 + * the preceding element in the display pipe is enabled. If the 397 + * preceding element is a bridge this means it's called after that 398 + * bridge's @atomic_enable or @enable function. If the preceding element 399 + * is a &drm_encoder it's called right after the encoder's 400 + * &drm_encoder_helper_funcs.atomic_enable hook. 326 401 * 327 402 * The bridge can assume that the display pipe (i.e. clocks and timing 328 403 * signals) feeding it is running when this callback is called. This 329 404 * callback must enable the display link feeding the next bridge in the 330 405 * chain if there is one. 331 - * 332 - * If the preceding element is a &drm_bridge, then this is called after 333 - * that bridge is enabled via one of: 334 - * 335 - * - &drm_bridge_funcs.enable 336 - * - &drm_bridge_funcs.atomic_enable 337 - * 338 - * If the preceding element of the bridge is a display controller, then 339 - * this callback is called after the CRTC is enabled via one of: 340 - * 341 - * - &drm_crtc_helper_funcs.atomic_enable 342 - * - &drm_crtc_helper_funcs.commit 343 - * 344 - * and the encoder is enabled via one of: 345 - * 346 - * - &drm_encoder_helper_funcs.atomic_enable 347 - * - &drm_encoder_helper_funcs.enable 348 - * - drm_encoder_helper_funcs.commit 349 406 * 350 407 * The @atomic_enable callback is optional. 351 408 */ ··· 341 424 /** 342 425 * @atomic_disable: 343 426 * 344 - * The @atomic_disable callback should disable the bridge. 427 + * This callback should disable the bridge. It is called right before 428 + * the preceding element in the display pipe is disabled. If the 429 + * preceding element is a bridge this means it's called before that 430 + * bridge's @atomic_disable or @disable vfunc. If the preceding element 431 + * is a &drm_encoder it's called right before the 432 + * &drm_encoder_helper_funcs.atomic_disable hook. 345 433 * 346 434 * The bridge can assume that the display pipe (i.e. clocks and timing 347 435 * signals) feeding it is still running when this callback is called. 348 - * 349 - * If the preceding element is a &drm_bridge, then this is called before 350 - * that bridge is disabled via one of: 351 - * 352 - * - &drm_bridge_funcs.disable 353 - * - &drm_bridge_funcs.atomic_disable 354 - * 355 - * If the preceding element of the bridge is a display controller, then 356 - * this callback is called before the encoder is disabled via one of: 357 - * 358 - * - &drm_encoder_helper_funcs.atomic_disable 359 - * - &drm_encoder_helper_funcs.prepare 360 - * - &drm_encoder_helper_funcs.disable 361 - * - &drm_encoder_helper_funcs.dpms 362 - * 363 - * and the CRTC is disabled via one of: 364 - * 365 - * - &drm_crtc_helper_funcs.prepare 366 - * - &drm_crtc_helper_funcs.atomic_disable 367 - * - &drm_crtc_helper_funcs.disable 368 - * - &drm_crtc_helper_funcs.dpms. 369 436 * 370 437 * The @atomic_disable callback is optional. 371 438 */ ··· 359 458 /** 360 459 * @atomic_post_disable: 361 460 * 461 + * This callback should disable the bridge. It is called right after the 462 + * preceding element in the display pipe is disabled. If the preceding 463 + * element is a bridge this means it's called after that bridge's 464 + * @atomic_post_disable or @post_disable function. If the preceding 465 + * element is a &drm_encoder it's called right after the encoder's 466 + * &drm_encoder_helper_funcs.atomic_disable hook. 467 + * 362 468 * The bridge must assume that the display pipe (i.e. clocks and timing 363 - * signals) feeding this bridge is no longer running when the 364 - * @atomic_post_disable is called. 365 - * 366 - * This callback should perform all the actions required by the hardware 367 - * after it has stopped receiving signals from the preceding element. 368 - * 369 - * If the preceding element is a &drm_bridge, then this is called after 370 - * that bridge is post-disabled (unless marked otherwise by the 371 - * @pre_enable_prev_first flag) via one of: 372 - * 373 - * - &drm_bridge_funcs.post_disable 374 - * - &drm_bridge_funcs.atomic_post_disable 375 - * 376 - * If the preceding element of the bridge is a display controller, then 377 - * this callback is called after the encoder is disabled via one of: 378 - * 379 - * - &drm_encoder_helper_funcs.atomic_disable 380 - * - &drm_encoder_helper_funcs.prepare 381 - * - &drm_encoder_helper_funcs.disable 382 - * - &drm_encoder_helper_funcs.dpms 383 - * 384 - * and the CRTC is disabled via one of: 385 - * 386 - * - &drm_crtc_helper_funcs.prepare 387 - * - &drm_crtc_helper_funcs.atomic_disable 388 - * - &drm_crtc_helper_funcs.disable 389 - * - &drm_crtc_helper_funcs.dpms 469 + * signals) feeding it is no longer running when this callback is 470 + * called. 390 471 * 391 472 * The @atomic_post_disable callback is optional. 392 473 */