File: drm_bridge_helper.c

package info (click to toggle)
linux 6.16.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,724,576 kB
  • sloc: ansic: 26,558,545; asm: 271,315; sh: 143,998; python: 72,469; makefile: 57,126; perl: 36,821; xml: 19,553; cpp: 5,820; yacc: 4,915; lex: 2,955; awk: 1,667; sed: 28; ruby: 25
file content (58 lines) | stat: -rw-r--r-- 1,497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// SPDX-License-Identifier: GPL-2.0-or-later

#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
#include <drm/drm_bridge_helper.h>
#include <drm/drm_modeset_lock.h>

/**
 * drm_bridge_helper_reset_crtc - Reset the pipeline feeding a bridge
 * @bridge: DRM bridge to reset
 * @ctx: lock acquisition context
 *
 * Reset a @bridge pipeline. It will power-cycle all active components
 * between the CRTC and connector that bridge is connected to.
 *
 * As it relies on drm_atomic_helper_reset_crtc(), the same limitations
 * apply.
 *
 * Returns:
 *
 * 0 on success or a negative error code on failure. If the error
 * returned is EDEADLK, the whole atomic sequence must be restarted.
 */
int drm_bridge_helper_reset_crtc(struct drm_bridge *bridge,
				 struct drm_modeset_acquire_ctx *ctx)
{
	struct drm_connector *connector;
	struct drm_encoder *encoder = bridge->encoder;
	struct drm_device *dev = encoder->dev;
	struct drm_crtc *crtc;
	int ret;

	ret = drm_modeset_lock(&dev->mode_config.connection_mutex, ctx);
	if (ret)
		return ret;

	connector = drm_atomic_get_connector_for_encoder(encoder, ctx);
	if (IS_ERR(connector)) {
		ret = PTR_ERR(connector);
		goto out;
	}

	if (!connector->state) {
		ret = -EINVAL;
		goto out;
	}

	crtc = connector->state->crtc;
	ret = drm_atomic_helper_reset_crtc(crtc, ctx);
	if (ret)
		goto out;

out:
	drm_modeset_unlock(&dev->mode_config.connection_mutex);
	return ret;
}
EXPORT_SYMBOL(drm_bridge_helper_reset_crtc);