File: intel_encoder.c

package info (click to toggle)
linux 6.12.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,673,568 kB
  • sloc: ansic: 25,888,630; asm: 268,782; sh: 136,481; python: 64,809; makefile: 55,668; perl: 38,052; xml: 19,270; cpp: 5,893; yacc: 4,923; lex: 2,939; awk: 1,592; sed: 28; ruby: 25
file content (83 lines) | stat: -rw-r--r-- 2,109 bytes parent folder | download | duplicates (15)
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// SPDX-License-Identifier: MIT
/*
 * Copyright © 2024 Intel Corporation
 */

#include <linux/workqueue.h>

#include "i915_drv.h"

#include "intel_display_types.h"
#include "intel_encoder.h"

static void intel_encoder_link_check_work_fn(struct work_struct *work)
{
	struct intel_encoder *encoder =
		container_of(work, typeof(*encoder), link_check_work.work);

	encoder->link_check(encoder);
}

void intel_encoder_link_check_init(struct intel_encoder *encoder,
				   void (*callback)(struct intel_encoder *encoder))
{
	INIT_DELAYED_WORK(&encoder->link_check_work, intel_encoder_link_check_work_fn);
	encoder->link_check = callback;
}

void intel_encoder_link_check_flush_work(struct intel_encoder *encoder)
{
	cancel_delayed_work_sync(&encoder->link_check_work);
}

void intel_encoder_link_check_queue_work(struct intel_encoder *encoder, int delay_ms)
{
	struct drm_i915_private *i915 = to_i915(encoder->base.dev);

	mod_delayed_work(i915->unordered_wq,
			 &encoder->link_check_work, msecs_to_jiffies(delay_ms));
}

void intel_encoder_suspend_all(struct intel_display *display)
{
	struct intel_encoder *encoder;

	if (!HAS_DISPLAY(display))
		return;

	/*
	 * TODO: check and remove holding the modeset locks if none of
	 * the encoders depends on this.
	 */
	drm_modeset_lock_all(display->drm);
	for_each_intel_encoder(display->drm, encoder)
		if (encoder->suspend)
			encoder->suspend(encoder);
	drm_modeset_unlock_all(display->drm);

	for_each_intel_encoder(display->drm, encoder)
		if (encoder->suspend_complete)
			encoder->suspend_complete(encoder);
}

void intel_encoder_shutdown_all(struct intel_display *display)
{
	struct intel_encoder *encoder;

	if (!HAS_DISPLAY(display))
		return;

	/*
	 * TODO: check and remove holding the modeset locks if none of
	 * the encoders depends on this.
	 */
	drm_modeset_lock_all(display->drm);
	for_each_intel_encoder(display->drm, encoder)
		if (encoder->shutdown)
			encoder->shutdown(encoder);
	drm_modeset_unlock_all(display->drm);

	for_each_intel_encoder(display->drm, encoder)
		if (encoder->shutdown_complete)
			encoder->shutdown_complete(encoder);
}