14562236bSHarry Wentland /*
24562236bSHarry Wentland * Copyright 2012-15 Advanced Micro Devices, Inc.
34562236bSHarry Wentland *
44562236bSHarry Wentland * Permission is hereby granted, free of charge, to any person obtaining a
54562236bSHarry Wentland * copy of this software and associated documentation files (the "Software"),
64562236bSHarry Wentland * to deal in the Software without restriction, including without limitation
74562236bSHarry Wentland * the rights to use, copy, modify, merge, publish, distribute, sublicense,
84562236bSHarry Wentland * and/or sell copies of the Software, and to permit persons to whom the
94562236bSHarry Wentland * Software is furnished to do so, subject to the following conditions:
104562236bSHarry Wentland *
114562236bSHarry Wentland * The above copyright notice and this permission notice shall be included in
124562236bSHarry Wentland * all copies or substantial portions of the Software.
134562236bSHarry Wentland *
144562236bSHarry Wentland * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
154562236bSHarry Wentland * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
164562236bSHarry Wentland * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
174562236bSHarry Wentland * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
184562236bSHarry Wentland * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
194562236bSHarry Wentland * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
204562236bSHarry Wentland * OTHER DEALINGS IN THE SOFTWARE.
214562236bSHarry Wentland *
224562236bSHarry Wentland * Authors: AMD
234562236bSHarry Wentland *
244562236bSHarry Wentland */
254562236bSHarry Wentland
264562236bSHarry Wentland #include "dm_services.h"
274562236bSHarry Wentland #include "dm_services_types.h"
284562236bSHarry Wentland
294562236bSHarry Wentland #include "virtual_link_encoder.h"
304562236bSHarry Wentland
virtual_link_encoder_validate_output_with_stream(struct link_encoder * enc,const struct dc_stream_state * stream)314562236bSHarry Wentland static bool virtual_link_encoder_validate_output_with_stream(
324562236bSHarry Wentland struct link_encoder *enc,
330971c40eSHarry Wentland const struct dc_stream_state *stream) { return true; }
344562236bSHarry Wentland
virtual_link_encoder_hw_init(struct link_encoder * enc)354562236bSHarry Wentland static void virtual_link_encoder_hw_init(struct link_encoder *enc) {}
364562236bSHarry Wentland
virtual_link_encoder_setup(struct link_encoder * enc,enum signal_type signal)374562236bSHarry Wentland static void virtual_link_encoder_setup(
384562236bSHarry Wentland struct link_encoder *enc,
394562236bSHarry Wentland enum signal_type signal) {}
404562236bSHarry Wentland
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)414562236bSHarry Wentland static void virtual_link_encoder_enable_tmds_output(
424562236bSHarry Wentland struct link_encoder *enc,
434562236bSHarry Wentland enum clock_source_id clock_source,
444562236bSHarry Wentland enum dc_color_depth color_depth,
4535c4c88cSHarry Wentland enum signal_type signal,
464562236bSHarry Wentland uint32_t pixel_clock) {}
474562236bSHarry Wentland
virtual_link_encoder_enable_dp_output(struct link_encoder * enc,const struct dc_link_settings * link_settings,enum clock_source_id clock_source)484562236bSHarry Wentland static void virtual_link_encoder_enable_dp_output(
494562236bSHarry Wentland struct link_encoder *enc,
504562236bSHarry Wentland const struct dc_link_settings *link_settings,
514562236bSHarry Wentland enum clock_source_id clock_source) {}
524562236bSHarry Wentland
virtual_link_encoder_enable_dp_mst_output(struct link_encoder * enc,const struct dc_link_settings * link_settings,enum clock_source_id clock_source)534562236bSHarry Wentland static void virtual_link_encoder_enable_dp_mst_output(
544562236bSHarry Wentland struct link_encoder *enc,
554562236bSHarry Wentland const struct dc_link_settings *link_settings,
564562236bSHarry Wentland enum clock_source_id clock_source) {}
574562236bSHarry Wentland
virtual_link_encoder_disable_output(struct link_encoder * link_enc,enum signal_type signal)584562236bSHarry Wentland static void virtual_link_encoder_disable_output(
594562236bSHarry Wentland struct link_encoder *link_enc,
60069d418fSAndrew Jiang enum signal_type signal) {}
614562236bSHarry Wentland
virtual_link_encoder_dp_set_lane_settings(struct link_encoder * enc,const struct dc_link_settings * link_settings,const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX])624562236bSHarry Wentland static void virtual_link_encoder_dp_set_lane_settings(
634562236bSHarry Wentland struct link_encoder *enc,
64*8788e066SWenjing Liu const struct dc_link_settings *link_settings,
65*8788e066SWenjing Liu const struct dc_lane_settings lane_settings[LANE_COUNT_DP_MAX]) {}
664562236bSHarry Wentland
virtual_link_encoder_dp_set_phy_pattern(struct link_encoder * enc,const struct encoder_set_dp_phy_pattern_param * param)674562236bSHarry Wentland static void virtual_link_encoder_dp_set_phy_pattern(
684562236bSHarry Wentland struct link_encoder *enc,
694562236bSHarry Wentland const struct encoder_set_dp_phy_pattern_param *param) {}
704562236bSHarry Wentland
virtual_link_encoder_update_mst_stream_allocation_table(struct link_encoder * enc,const struct link_mst_stream_allocation_table * table)714562236bSHarry Wentland static void virtual_link_encoder_update_mst_stream_allocation_table(
724562236bSHarry Wentland struct link_encoder *enc,
734562236bSHarry Wentland const struct link_mst_stream_allocation_table *table) {}
744562236bSHarry Wentland
virtual_link_encoder_connect_dig_be_to_fe(struct link_encoder * enc,enum engine_id engine,bool connect)754562236bSHarry Wentland static void virtual_link_encoder_connect_dig_be_to_fe(
764562236bSHarry Wentland struct link_encoder *enc,
774562236bSHarry Wentland enum engine_id engine,
784562236bSHarry Wentland bool connect) {}
794562236bSHarry Wentland
virtual_link_encoder_destroy(struct link_encoder ** enc)804562236bSHarry Wentland static void virtual_link_encoder_destroy(struct link_encoder **enc)
814562236bSHarry Wentland {
822004f45eSHarry Wentland kfree(*enc);
834562236bSHarry Wentland *enc = NULL;
844562236bSHarry Wentland }
854562236bSHarry Wentland
virtual_link_encoder_get_max_link_cap(struct link_encoder * enc,struct dc_link_settings * link_settings)868ccf0e20SWenjing Liu static void virtual_link_encoder_get_max_link_cap(struct link_encoder *enc,
878ccf0e20SWenjing Liu struct dc_link_settings *link_settings)
888ccf0e20SWenjing Liu {
898ccf0e20SWenjing Liu /* Set Default link settings */
908ccf0e20SWenjing Liu struct dc_link_settings max_link_cap = {LANE_COUNT_FOUR, LINK_RATE_HIGH,
918ccf0e20SWenjing Liu LINK_SPREAD_05_DOWNSPREAD_30KHZ, false, 0};
928ccf0e20SWenjing Liu *link_settings = max_link_cap;
938ccf0e20SWenjing Liu }
944562236bSHarry Wentland
954562236bSHarry Wentland static const struct link_encoder_funcs virtual_lnk_enc_funcs = {
964562236bSHarry Wentland .validate_output_with_stream =
974562236bSHarry Wentland virtual_link_encoder_validate_output_with_stream,
984562236bSHarry Wentland .hw_init = virtual_link_encoder_hw_init,
994562236bSHarry Wentland .setup = virtual_link_encoder_setup,
1004562236bSHarry Wentland .enable_tmds_output = virtual_link_encoder_enable_tmds_output,
1014562236bSHarry Wentland .enable_dp_output = virtual_link_encoder_enable_dp_output,
1024562236bSHarry Wentland .enable_dp_mst_output = virtual_link_encoder_enable_dp_mst_output,
1034562236bSHarry Wentland .disable_output = virtual_link_encoder_disable_output,
1048ccf0e20SWenjing Liu .get_max_link_cap = virtual_link_encoder_get_max_link_cap,
1054562236bSHarry Wentland .dp_set_lane_settings = virtual_link_encoder_dp_set_lane_settings,
1064562236bSHarry Wentland .dp_set_phy_pattern = virtual_link_encoder_dp_set_phy_pattern,
1074562236bSHarry Wentland .update_mst_stream_allocation_table =
1084562236bSHarry Wentland virtual_link_encoder_update_mst_stream_allocation_table,
1094562236bSHarry Wentland .connect_dig_be_to_fe = virtual_link_encoder_connect_dig_be_to_fe,
1104562236bSHarry Wentland .destroy = virtual_link_encoder_destroy
1114562236bSHarry Wentland };
1124562236bSHarry Wentland
virtual_link_encoder_construct(struct link_encoder * enc,const struct encoder_init_data * init_data)1134562236bSHarry Wentland bool virtual_link_encoder_construct(
1144562236bSHarry Wentland struct link_encoder *enc, const struct encoder_init_data *init_data)
1154562236bSHarry Wentland {
1164562236bSHarry Wentland enc->funcs = &virtual_lnk_enc_funcs;
1174562236bSHarry Wentland enc->ctx = init_data->ctx;
1184562236bSHarry Wentland enc->id = init_data->encoder;
1194562236bSHarry Wentland
1204562236bSHarry Wentland enc->hpd_source = init_data->hpd_source;
1214562236bSHarry Wentland enc->connector = init_data->connector;
1224562236bSHarry Wentland
1234562236bSHarry Wentland enc->transmitter = init_data->transmitter;
1244562236bSHarry Wentland
1254562236bSHarry Wentland enc->output_signals = SIGNAL_TYPE_VIRTUAL;
1264562236bSHarry Wentland
1274562236bSHarry Wentland enc->preferred_engine = ENGINE_ID_VIRTUAL;
1284562236bSHarry Wentland
1294562236bSHarry Wentland return true;
1304562236bSHarry Wentland }
1314562236bSHarry Wentland
1324562236bSHarry Wentland
133