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