Linux Audio

Check our new training course

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