summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/display/dc/virtual/virtual_link_encoder.c
blob: bb4433ff3b6ecc69ae3973bad710a2ec8fa533f9 (plain)
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
 * Copyright 2012-15 Advanced Micro Devices, Inc.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * and/or sell copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * Authors: AMD
 *
 */

#include "dm_services.h"
#include "dm_services_types.h"

#include "virtual_link_encoder.h"

#define VIRTUAL_MAX_PIXEL_CLK_IN_KHZ 600000

static bool virtual_link_encoder_validate_output_with_stream(
	struct link_encoder *enc,
	struct pipe_ctx *pipe_ctx) { return true; }

static void virtual_link_encoder_hw_init(struct link_encoder *enc) {}

static void virtual_link_encoder_setup(
	struct link_encoder *enc,
	enum signal_type signal) {}

static void virtual_link_encoder_enable_tmds_output(
	struct link_encoder *enc,
	enum clock_source_id clock_source,
	enum dc_color_depth color_depth,
	bool hdmi,
	bool dual_link,
	uint32_t pixel_clock) {}

static void virtual_link_encoder_enable_dp_output(
	struct link_encoder *enc,
	const struct dc_link_settings *link_settings,
	enum clock_source_id clock_source) {}

static void virtual_link_encoder_enable_dp_mst_output(
	struct link_encoder *enc,
	const struct dc_link_settings *link_settings,
	enum clock_source_id clock_source) {}

static void virtual_link_encoder_disable_output(
	struct link_encoder *link_enc,
	enum signal_type signal) {}

static void virtual_link_encoder_dp_set_lane_settings(
	struct link_encoder *enc,
	const struct link_training_settings *link_settings) {}

static void virtual_link_encoder_dp_set_phy_pattern(
	struct link_encoder *enc,
	const struct encoder_set_dp_phy_pattern_param *param) {}

static void virtual_link_encoder_update_mst_stream_allocation_table(
	struct link_encoder *enc,
	const struct link_mst_stream_allocation_table *table) {}

static void virtual_link_encoder_set_lcd_backlight_level(
	struct link_encoder *enc,
	uint32_t level) {}

static void virtual_link_encoder_set_dmcu_backlight_level(
	struct link_encoder *enc,
	uint32_t level,
	uint32_t frame_ramp,
	uint32_t controller_id) {}

static void virtual_link_encoder_edp_backlight_control(
	struct link_encoder *enc,
	bool enable) {}

static void virtual_link_encoder_edp_power_control(
	struct link_encoder *enc,
	bool power_up) {}

static void virtual_link_encoder_connect_dig_be_to_fe(
	struct link_encoder *enc,
	enum engine_id engine,
	bool connect) {}

static void virtual_link_encoder_destroy(struct link_encoder **enc)
{
	dm_free(*enc);
	*enc = NULL;
}


static const struct link_encoder_funcs virtual_lnk_enc_funcs = {
	.validate_output_with_stream =
		virtual_link_encoder_validate_output_with_stream,
	.hw_init = virtual_link_encoder_hw_init,
	.setup = virtual_link_encoder_setup,
	.enable_tmds_output = virtual_link_encoder_enable_tmds_output,
	.enable_dp_output = virtual_link_encoder_enable_dp_output,
	.enable_dp_mst_output = virtual_link_encoder_enable_dp_mst_output,
	.disable_output = virtual_link_encoder_disable_output,
	.dp_set_lane_settings = virtual_link_encoder_dp_set_lane_settings,
	.dp_set_phy_pattern = virtual_link_encoder_dp_set_phy_pattern,
	.update_mst_stream_allocation_table =
		virtual_link_encoder_update_mst_stream_allocation_table,
	.set_lcd_backlight_level = virtual_link_encoder_set_lcd_backlight_level,
	.set_dmcu_backlight_level =
			virtual_link_encoder_set_dmcu_backlight_level,
	.backlight_control = virtual_link_encoder_edp_backlight_control,
	.power_control = virtual_link_encoder_edp_power_control,
	.connect_dig_be_to_fe = virtual_link_encoder_connect_dig_be_to_fe,
	.destroy = virtual_link_encoder_destroy
};

bool virtual_link_encoder_construct(
	struct link_encoder *enc, const struct encoder_init_data *init_data)
{
	enc->funcs = &virtual_lnk_enc_funcs;
	enc->ctx = init_data->ctx;
	enc->id = init_data->encoder;

	enc->hpd_source = init_data->hpd_source;
	enc->connector = init_data->connector;

	enc->transmitter = init_data->transmitter;

	enc->features.max_pixel_clock = VIRTUAL_MAX_PIXEL_CLK_IN_KHZ;

	enc->output_signals = SIGNAL_TYPE_VIRTUAL;

	enc->preferred_engine = ENGINE_ID_VIRTUAL;

	return true;
}