1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev * Copyright 2012-15 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev *
4*b843c749SSergey Zigachev * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev * and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev *
11*b843c749SSergey Zigachev * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev *
14*b843c749SSergey Zigachev * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17*b843c749SSergey Zigachev * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev *
22*b843c749SSergey Zigachev * Authors: AMD
23*b843c749SSergey Zigachev *
24*b843c749SSergey Zigachev */
25*b843c749SSergey Zigachev
26*b843c749SSergey Zigachev #include "dm_services.h"
27*b843c749SSergey Zigachev #include "dm_services_types.h"
28*b843c749SSergey Zigachev
29*b843c749SSergey Zigachev #include "virtual_link_encoder.h"
30*b843c749SSergey Zigachev
virtual_link_encoder_validate_output_with_stream(struct link_encoder * enc,const struct dc_stream_state * stream)31*b843c749SSergey Zigachev static bool virtual_link_encoder_validate_output_with_stream(
32*b843c749SSergey Zigachev struct link_encoder *enc,
33*b843c749SSergey Zigachev const struct dc_stream_state *stream) { return true; }
34*b843c749SSergey Zigachev
virtual_link_encoder_hw_init(struct link_encoder * enc)35*b843c749SSergey Zigachev static void virtual_link_encoder_hw_init(struct link_encoder *enc) {}
36*b843c749SSergey Zigachev
virtual_link_encoder_setup(struct link_encoder * enc,enum signal_type signal)37*b843c749SSergey Zigachev static void virtual_link_encoder_setup(
38*b843c749SSergey Zigachev struct link_encoder *enc,
39*b843c749SSergey Zigachev enum signal_type signal) {}
40*b843c749SSergey Zigachev
virtual_link_encoder_enable_tmds_output(struct link_encoder * enc,enum clock_source_id clock_source,enum dc_color_depth color_depth,enum signal_type signal,uint32_t pixel_clock)41*b843c749SSergey Zigachev static void virtual_link_encoder_enable_tmds_output(
42*b843c749SSergey Zigachev struct link_encoder *enc,
43*b843c749SSergey Zigachev enum clock_source_id clock_source,
44*b843c749SSergey Zigachev enum dc_color_depth color_depth,
45*b843c749SSergey Zigachev enum signal_type signal,
46*b843c749SSergey Zigachev uint32_t pixel_clock) {}
47*b843c749SSergey Zigachev
virtual_link_encoder_enable_dp_output(struct link_encoder * enc,const struct dc_link_settings * link_settings,enum clock_source_id clock_source)48*b843c749SSergey Zigachev static void virtual_link_encoder_enable_dp_output(
49*b843c749SSergey Zigachev struct link_encoder *enc,
50*b843c749SSergey Zigachev const struct dc_link_settings *link_settings,
51*b843c749SSergey Zigachev enum clock_source_id clock_source) {}
52*b843c749SSergey Zigachev
virtual_link_encoder_enable_dp_mst_output(struct link_encoder * enc,const struct dc_link_settings * link_settings,enum clock_source_id clock_source)53*b843c749SSergey Zigachev static void virtual_link_encoder_enable_dp_mst_output(
54*b843c749SSergey Zigachev struct link_encoder *enc,
55*b843c749SSergey Zigachev const struct dc_link_settings *link_settings,
56*b843c749SSergey Zigachev enum clock_source_id clock_source) {}
57*b843c749SSergey Zigachev
virtual_link_encoder_disable_output(struct link_encoder * link_enc,enum signal_type signal)58*b843c749SSergey Zigachev static void virtual_link_encoder_disable_output(
59*b843c749SSergey Zigachev struct link_encoder *link_enc,
60*b843c749SSergey Zigachev enum signal_type signal) {}
61*b843c749SSergey Zigachev
virtual_link_encoder_dp_set_lane_settings(struct link_encoder * enc,const struct link_training_settings * link_settings)62*b843c749SSergey Zigachev static void virtual_link_encoder_dp_set_lane_settings(
63*b843c749SSergey Zigachev struct link_encoder *enc,
64*b843c749SSergey Zigachev const struct link_training_settings *link_settings) {}
65*b843c749SSergey Zigachev
virtual_link_encoder_dp_set_phy_pattern(struct link_encoder * enc,const struct encoder_set_dp_phy_pattern_param * param)66*b843c749SSergey Zigachev static void virtual_link_encoder_dp_set_phy_pattern(
67*b843c749SSergey Zigachev struct link_encoder *enc,
68*b843c749SSergey Zigachev const struct encoder_set_dp_phy_pattern_param *param) {}
69*b843c749SSergey Zigachev
virtual_link_encoder_update_mst_stream_allocation_table(struct link_encoder * enc,const struct link_mst_stream_allocation_table * table)70*b843c749SSergey Zigachev static void virtual_link_encoder_update_mst_stream_allocation_table(
71*b843c749SSergey Zigachev struct link_encoder *enc,
72*b843c749SSergey Zigachev const struct link_mst_stream_allocation_table *table) {}
73*b843c749SSergey Zigachev
virtual_link_encoder_connect_dig_be_to_fe(struct link_encoder * enc,enum engine_id engine,bool connect)74*b843c749SSergey Zigachev static void virtual_link_encoder_connect_dig_be_to_fe(
75*b843c749SSergey Zigachev struct link_encoder *enc,
76*b843c749SSergey Zigachev enum engine_id engine,
77*b843c749SSergey Zigachev bool connect) {}
78*b843c749SSergey Zigachev
virtual_link_encoder_destroy(struct link_encoder ** enc)79*b843c749SSergey Zigachev static void virtual_link_encoder_destroy(struct link_encoder **enc)
80*b843c749SSergey Zigachev {
81*b843c749SSergey Zigachev kfree(*enc);
82*b843c749SSergey Zigachev *enc = NULL;
83*b843c749SSergey Zigachev }
84*b843c749SSergey Zigachev
85*b843c749SSergey Zigachev
86*b843c749SSergey Zigachev static const struct link_encoder_funcs virtual_lnk_enc_funcs = {
87*b843c749SSergey Zigachev .validate_output_with_stream =
88*b843c749SSergey Zigachev virtual_link_encoder_validate_output_with_stream,
89*b843c749SSergey Zigachev .hw_init = virtual_link_encoder_hw_init,
90*b843c749SSergey Zigachev .setup = virtual_link_encoder_setup,
91*b843c749SSergey Zigachev .enable_tmds_output = virtual_link_encoder_enable_tmds_output,
92*b843c749SSergey Zigachev .enable_dp_output = virtual_link_encoder_enable_dp_output,
93*b843c749SSergey Zigachev .enable_dp_mst_output = virtual_link_encoder_enable_dp_mst_output,
94*b843c749SSergey Zigachev .disable_output = virtual_link_encoder_disable_output,
95*b843c749SSergey Zigachev .dp_set_lane_settings = virtual_link_encoder_dp_set_lane_settings,
96*b843c749SSergey Zigachev .dp_set_phy_pattern = virtual_link_encoder_dp_set_phy_pattern,
97*b843c749SSergey Zigachev .update_mst_stream_allocation_table =
98*b843c749SSergey Zigachev virtual_link_encoder_update_mst_stream_allocation_table,
99*b843c749SSergey Zigachev .connect_dig_be_to_fe = virtual_link_encoder_connect_dig_be_to_fe,
100*b843c749SSergey Zigachev .destroy = virtual_link_encoder_destroy
101*b843c749SSergey Zigachev };
102*b843c749SSergey Zigachev
virtual_link_encoder_construct(struct link_encoder * enc,const struct encoder_init_data * init_data)103*b843c749SSergey Zigachev bool virtual_link_encoder_construct(
104*b843c749SSergey Zigachev struct link_encoder *enc, const struct encoder_init_data *init_data)
105*b843c749SSergey Zigachev {
106*b843c749SSergey Zigachev enc->funcs = &virtual_lnk_enc_funcs;
107*b843c749SSergey Zigachev enc->ctx = init_data->ctx;
108*b843c749SSergey Zigachev enc->id = init_data->encoder;
109*b843c749SSergey Zigachev
110*b843c749SSergey Zigachev enc->hpd_source = init_data->hpd_source;
111*b843c749SSergey Zigachev enc->connector = init_data->connector;
112*b843c749SSergey Zigachev
113*b843c749SSergey Zigachev enc->transmitter = init_data->transmitter;
114*b843c749SSergey Zigachev
115*b843c749SSergey Zigachev enc->output_signals = SIGNAL_TYPE_VIRTUAL;
116*b843c749SSergey Zigachev
117*b843c749SSergey Zigachev enc->preferred_engine = ENGINE_ID_VIRTUAL;
118*b843c749SSergey Zigachev
119*b843c749SSergey Zigachev return true;
120*b843c749SSergey Zigachev }
121*b843c749SSergey Zigachev
122*b843c749SSergey Zigachev
123