]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - drivers/gpu/drm/amd/display/dc/dc.h
drm/amd/display: fix hotplug regression after code refactor
[mirror_ubuntu-bionic-kernel.git] / drivers / gpu / drm / amd / display / dc / dc.h
CommitLineData
4562236b
HW
1/*
2 * Copyright 2012-14 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#ifndef DC_INTERFACE_H_
27#define DC_INTERFACE_H_
28
29#include "dc_types.h"
30#include "dpcd_defs.h"
31#include "grph_object_defs.h"
32#include "logger_types.h"
33#include "gpio_types.h"
34#include "link_service_types.h"
35
36#define MAX_TARGETS 6
091a97e5 37#define MAX_SURFACES 3
4562236b
HW
38#define MAX_SINKS_PER_LINK 4
39
40/*******************************************************************************
41 * Display Core Interfaces
42 ******************************************************************************/
43
44struct dc_caps {
45 uint32_t max_targets;
46 uint32_t max_links;
47 uint32_t max_audios;
48 uint32_t max_slave_planes;
49 uint32_t max_downscale_ratio;
50 uint32_t i2c_speed_in_khz;
51};
52
53
54struct dc_dcc_surface_param {
55 enum surface_pixel_format format;
56 struct dc_size surface_size;
57 enum dc_scan_direction scan;
58};
59
60struct dc_dcc_setting {
61 unsigned int max_compressed_blk_size;
62 unsigned int max_uncompressed_blk_size;
63 bool independent_64b_blks;
64};
65
66struct dc_surface_dcc_cap {
67 bool capable;
68 bool const_color_support;
69
70 union {
71 struct {
72 struct dc_dcc_setting rgb;
73 } grph;
74
75 struct {
76 struct dc_dcc_setting luma;
77 struct dc_dcc_setting chroma;
78 } video;
79 };
80};
81
82/* Forward declaration*/
83struct dc;
84struct dc_surface;
85struct validate_context;
86
87struct dc_cap_funcs {
88 int i;
89};
90
91struct dc_stream_funcs {
92 bool (*adjust_vmin_vmax)(struct dc *dc,
93 const struct dc_stream **stream,
94 int num_streams,
95 int vmin,
96 int vmax);
97
98 void (*stream_update_scaling)(const struct dc *dc,
99 const struct dc_stream *dc_stream,
100 const struct rect *src,
101 const struct rect *dst);
102 bool (*set_gamut_remap)(struct dc *dc,
103 const struct dc_stream **stream, int num_streams);
104 bool (*set_backlight)(struct dc *dc, unsigned int backlight_level,
105 unsigned int frame_ramp, const struct dc_stream *stream);
106 bool (*init_dmcu_backlight_settings)(struct dc *dc);
107 bool (*set_abm_level)(struct dc *dc, unsigned int abm_level);
108 bool (*set_psr_enable)(struct dc *dc, bool enable);
109 bool (*setup_psr)(struct dc *dc, const struct dc_stream *stream);
110};
111
112struct link_training_settings;
113
114struct dc_link_funcs {
115 void (*set_drive_settings)(struct dc *dc,
116 struct link_training_settings *lt_settings);
117 void (*perform_link_training)(struct dc *dc,
118 struct dc_link_settings *link_setting,
119 bool skip_video_pattern);
120 void (*set_preferred_link_settings)(struct dc *dc,
121 struct dc_link_settings *link_setting);
122 void (*enable_hpd)(const struct dc_link *link);
123 void (*disable_hpd)(const struct dc_link *link);
124 void (*set_test_pattern)(
125 const struct dc_link *link,
126 enum dp_test_pattern test_pattern,
127 const struct link_training_settings *p_link_settings,
128 const unsigned char *p_custom_pattern,
129 unsigned int cust_pattern_size);
130};
131
132/* Structure to hold configuration flags set by dm at dc creation. */
133struct dc_config {
134 bool gpu_vm_support;
135 bool disable_disp_pll_sharing;
136};
137
138struct dc_debug {
139 bool surface_visual_confirm;
140 bool max_disp_clk;
141 bool target_trace;
142 bool surface_trace;
9474980a 143 bool timing_trace;
4562236b
HW
144 bool validation_trace;
145 bool disable_stutter;
146 bool disable_dcc;
147 bool disable_dfs_bypass;
148 bool disable_power_gate;
149 bool disable_clock_gate;
aa66df58 150 bool disable_dmcu;
4562236b
HW
151};
152
153struct dc {
154 struct dc_caps caps;
155 struct dc_cap_funcs cap_funcs;
156 struct dc_stream_funcs stream_funcs;
157 struct dc_link_funcs link_funcs;
158 struct dc_config config;
159 struct dc_debug debug;
160};
161
162enum frame_buffer_mode {
163 FRAME_BUFFER_MODE_LOCAL_ONLY = 0,
164 FRAME_BUFFER_MODE_ZFB_ONLY,
165 FRAME_BUFFER_MODE_MIXED_ZFB_AND_LOCAL,
166} ;
167
168struct dchub_init_data {
169 bool dchub_initialzied;
170 bool dchub_info_valid;
171 int64_t zfb_phys_addr_base;
172 int64_t zfb_mc_base_addr;
173 uint64_t zfb_size_in_byte;
174 enum frame_buffer_mode fb_mode;
175};
176
177struct dc_init_data {
178 struct hw_asic_id asic_id;
179 void *driver; /* ctx */
180 struct cgs_device *cgs_device;
181
182 int num_virtual_links;
183 /*
184 * If 'vbios_override' not NULL, it will be called instead
185 * of the real VBIOS. Intended use is Diagnostics on FPGA.
186 */
187 struct dc_bios *vbios_override;
188 enum dce_environment dce_environment;
189
190 struct dc_config flags;
191};
192
193struct dc *dc_create(const struct dc_init_data *init_params);
194
195void dc_destroy(struct dc **dc);
196
197bool dc_init_dchub(struct dc *dc, struct dchub_init_data *dh_data);
198
199/*******************************************************************************
200 * Surface Interfaces
201 ******************************************************************************/
202
203enum {
204 RGB_256X3X16 = 256,
fb735a9f
AK
205 FLOAT_GAMMA_RAMP_MAX = 1025,
206 TRANSFER_FUNC_POINTS = 1025
4562236b
HW
207};
208
209enum dc_gamma_ramp_type {
210 GAMMA_RAMP_RBG256X3X16,
211 GAMMA_RAMP_FLOAT,
212};
213
214struct float_rgb {
215 struct fixed32_32 red;
216 struct fixed32_32 green;
217 struct fixed32_32 blue;
218};
219
220struct dc_gamma_ramp_float {
221 struct float_rgb scale;
222 struct float_rgb offset;
223 struct float_rgb gamma_curve[FLOAT_GAMMA_RAMP_MAX];
224};
225
226struct dc_gamma_ramp_rgb256x3x16 {
227 uint16_t red[RGB_256X3X16];
228 uint16_t green[RGB_256X3X16];
229 uint16_t blue[RGB_256X3X16];
230};
231
232struct dc_gamma {
233 enum dc_gamma_ramp_type type;
234 union {
235 struct dc_gamma_ramp_rgb256x3x16 gamma_ramp_rgb256x3x16;
236 struct dc_gamma_ramp_float gamma_ramp_float;
237 };
238 uint32_t size;
239};
240
fb735a9f
AK
241enum dc_transfer_func_type {
242 TF_TYPE_PREDEFINED,
243 TF_TYPE_DISTRIBUTED_POINTS,
244};
245
246struct dc_transfer_func_distributed_points {
247 uint16_t red[TRANSFER_FUNC_POINTS];
248 uint16_t green[TRANSFER_FUNC_POINTS];
249 uint16_t blue[TRANSFER_FUNC_POINTS];
250 uint16_t end_exponent;
251 uint16_t x_point_at_y1;
252};
253
254enum dc_transfer_func_predefined {
255 TRANSFER_FUNCTION_SRGB,
256 TRANSFER_FUNCTION_BT709,
257 TRANSFER_FUNCTION_LINEAR,
258};
259
260struct dc_transfer_func {
261 enum dc_transfer_func_type type;
262 enum dc_transfer_func_predefined tf;
263 struct dc_transfer_func_distributed_points tf_pts;
264};
265
4562236b
HW
266struct dc_surface {
267 bool visible;
268 bool flip_immediate;
269 struct dc_plane_address address;
270
271 struct scaling_taps scaling_quality;
272 struct rect src_rect;
273 struct rect dst_rect;
274 struct rect clip_rect;
275
276 union plane_size plane_size;
277 union dc_tiling_info tiling_info;
278 struct dc_plane_dcc_param dcc;
279 enum dc_color_space color_space;
280
281 enum surface_pixel_format format;
282 enum dc_rotation_angle rotation;
283 bool horizontal_mirror;
284 enum plane_stereo_format stereo_format;
285
fb735a9f 286 /* TO BE REMOVED AFTER BELOW TRANSFER FUNCTIONS IMPLEMENTED */
4562236b 287 const struct dc_gamma *gamma_correction;
fb735a9f
AK
288
289 const struct dc_transfer_func *in_transfer_func;
290 const struct dc_transfer_func *out_transfer_func;
4562236b
HW
291};
292
293struct dc_plane_info {
294 union plane_size plane_size;
295 union dc_tiling_info tiling_info;
296 enum surface_pixel_format format;
297 enum dc_rotation_angle rotation;
298 bool horizontal_mirror;
299 enum plane_stereo_format stereo_format;
300 enum dc_color_space color_space; /*todo: wrong place, fits in scaling info*/
301 bool visible;
302};
303
304struct dc_scaling_info {
305 struct rect src_rect;
306 struct rect dst_rect;
307 struct rect clip_rect;
308 struct scaling_taps scaling_quality;
309};
310
311struct dc_surface_update {
312 const struct dc_surface *surface;
313
314 /* isr safe update parameters. null means no updates */
315 struct dc_flip_addrs *flip_addr;
316 struct dc_plane_info *plane_info;
317 struct dc_scaling_info *scaling_info;
318 /* following updates require alloc/sleep/spin that is not isr safe,
319 * null means no updates
320 */
fb735a9f 321 /* gamma TO BE REMOVED */
4562236b
HW
322 struct dc_gamma *gamma;
323
fb735a9f
AK
324 struct dc_transfer_func *in_transfer_func;
325 struct dc_transfer_func *out_transfer_func;
326
4562236b
HW
327
328};
329/*
330 * This structure is filled in by dc_surface_get_status and contains
331 * the last requested address and the currently active address so the called
332 * can determine if there are any outstanding flips
333 */
334struct dc_surface_status {
335 struct dc_plane_address requested_address;
336 struct dc_plane_address current_address;
337 bool is_flip_pending;
338};
339
340/*
341 * Create a new surface with default parameters;
342 */
343struct dc_surface *dc_create_surface(const struct dc *dc);
344const struct dc_surface_status *dc_surface_get_status(
345 const struct dc_surface *dc_surface);
346
347void dc_surface_retain(const struct dc_surface *dc_surface);
348void dc_surface_release(const struct dc_surface *dc_surface);
349
89e89630 350void dc_gamma_retain(const struct dc_gamma *dc_gamma);
4562236b
HW
351void dc_gamma_release(const struct dc_gamma *dc_gamma);
352struct dc_gamma *dc_create_gamma(void);
353
fb735a9f
AK
354void dc_transfer_func_retain(const struct dc_transfer_func *dc_tf);
355void dc_transfer_func_release(const struct dc_transfer_func *dc_tf);
356struct dc_transfer_func *dc_create_transfer_func(const struct dc *dc);
357
4562236b
HW
358/*
359 * This structure holds a surface address. There could be multiple addresses
360 * in cases such as Stereo 3D, Planar YUV, etc. Other per-flip attributes such
361 * as frame durations and DCC format can also be set.
362 */
363struct dc_flip_addrs {
364 struct dc_plane_address address;
365 bool flip_immediate;
366 /* TODO: DCC format info */
367 /* TODO: add flip duration for FreeSync */
368};
369
370/*
371 * Optimized flip address update function.
372 *
373 * After this call:
374 * Surface addresses and flip attributes are programmed.
375 * Surface flip occur at next configured time (h_sync or v_sync flip)
376 */
377void dc_flip_surface_addrs(struct dc *dc,
378 const struct dc_surface *const surfaces[],
379 struct dc_flip_addrs flip_addrs[],
380 uint32_t count);
381
382/*
383 * Set up surface attributes and associate to a target
384 * The surfaces parameter is an absolute set of all surface active for the target.
385 * If no surfaces are provided, the target will be blanked; no memory read.
386 * Any flip related attribute changes must be done through this interface.
387 *
388 * After this call:
389 * Surfaces attributes are programmed and configured to be composed into target.
390 * This does not trigger a flip. No surface address is programmed.
391 */
392
393bool dc_commit_surfaces_to_target(
394 struct dc *dc,
395 const struct dc_surface **dc_surfaces,
396 uint8_t surface_count,
397 struct dc_target *dc_target);
398
399bool dc_pre_update_surfaces_to_target(
400 struct dc *dc,
401 const struct dc_surface *const *new_surfaces,
402 uint8_t new_surface_count,
403 struct dc_target *dc_target);
404
405bool dc_post_update_surfaces_to_target(
406 struct dc *dc);
407
408void dc_update_surfaces_for_target(struct dc *dc, struct dc_surface_update *updates,
409 int surface_count, struct dc_target *dc_target);
410
411/*******************************************************************************
412 * Target Interfaces
413 ******************************************************************************/
414#define MAX_STREAM_NUM 1
415
416struct dc_target {
417 uint8_t stream_count;
418 const struct dc_stream *streams[MAX_STREAM_NUM];
419};
420
421/*
422 * Target status is returned from dc_target_get_status in order to get the
423 * the IRQ source, current frame counter and currently attached surfaces.
424 */
425struct dc_target_status {
426 int primary_otg_inst;
427 int cur_frame_count;
428 int surface_count;
429 const struct dc_surface *surfaces[MAX_SURFACE_NUM];
430};
431
432struct dc_target *dc_create_target_for_streams(
433 struct dc_stream *dc_streams[],
434 uint8_t stream_count);
435
436/*
437 * Get the current target status.
438 */
439const struct dc_target_status *dc_target_get_status(
440 const struct dc_target* dc_target);
441
442void dc_target_retain(const struct dc_target *dc_target);
443void dc_target_release(const struct dc_target *dc_target);
444void dc_target_log(
445 const struct dc_target *dc_target,
446 struct dal_logger *dc_logger,
447 enum dc_log_type log_type);
448
449uint8_t dc_get_current_target_count(const struct dc *dc);
450struct dc_target *dc_get_target_at_index(const struct dc *dc, uint8_t i);
451
452bool dc_target_is_connected_to_sink(
453 const struct dc_target *dc_target,
454 const struct dc_sink *dc_sink);
455
456uint32_t dc_target_get_vblank_counter(const struct dc_target *dc_target);
457
458/* TODO: Return parsed values rather than direct register read
459 * This has a dependency on the caller (amdgpu_get_crtc_scanoutpos)
460 * being refactored properly to be dce-specific
461 */
462uint32_t dc_target_get_scanoutpos(
463 const struct dc_target *dc_target,
464 uint32_t *vbl,
465 uint32_t *position);
466
467/*
468 * Structure to store surface/target associations for validation
469 */
470struct dc_validation_set {
471 const struct dc_target *target;
472 const struct dc_surface *surfaces[MAX_SURFACES];
473 uint8_t surface_count;
474};
475
476/*
477 * This function takes a set of resources and checks that they are cofunctional.
478 *
479 * After this call:
480 * No hardware is programmed for call. Only validation is done.
481 */
482bool dc_validate_resources(
483 const struct dc *dc,
484 const struct dc_validation_set set[],
485 uint8_t set_count);
486
487/*
488 * This function takes a target and checks if it is guaranteed to be supported.
489 * Guaranteed means that MAX_COFUNC*target is supported.
490 *
491 * After this call:
492 * No hardware is programmed for call. Only validation is done.
493 */
494
495bool dc_validate_guaranteed(
496 const struct dc *dc,
497 const struct dc_target *dc_target);
498
499/*
500 * Set up streams and links associated to targets to drive sinks
501 * The targets parameter is an absolute set of all active targets.
502 *
503 * After this call:
504 * Phy, Encoder, Timing Generator are programmed and enabled.
505 * New targets are enabled with blank stream; no memory read.
506 */
507bool dc_commit_targets(
508 struct dc *dc,
509 struct dc_target *targets[],
510 uint8_t target_count);
511
512/*******************************************************************************
513 * Stream Interfaces
514 ******************************************************************************/
515struct dc_stream {
516 const struct dc_sink *sink;
517 struct dc_crtc_timing timing;
518
519 enum dc_color_space output_color_space;
520
521 struct rect src; /* viewport in target space*/
522 struct rect dst; /* stream addressable area */
523
524 struct audio_info audio_info;
525
526 bool ignore_msa_timing_param;
527
528 struct freesync_context freesync_ctx;
529
530 /* TODO: dithering */
531 /* TODO: transfer function (CSC/regamma/gamut remap) */
532 struct colorspace_transform gamut_remap_matrix;
533 struct csc_transform csc_color_matrix;
534 /* TODO: custom INFO packets */
535 /* TODO: ABM info (DMCU) */
536 /* TODO: PSR info */
537 /* TODO: CEA VIC */
538};
539
540/**
541 * Create a new default stream for the requested sink
542 */
543struct dc_stream *dc_create_stream_for_sink(const struct dc_sink *dc_sink);
544
545void dc_stream_retain(const struct dc_stream *dc_stream);
546void dc_stream_release(const struct dc_stream *dc_stream);
547
548struct dc_stream_status {
549 /*
550 * link this stream passes through
551 */
552 const struct dc_link *link;
553};
554
555const struct dc_stream_status *dc_stream_get_status(
556 const struct dc_stream *dc_stream);
557
558/*******************************************************************************
559 * Link Interfaces
560 ******************************************************************************/
561
562/*
563 * A link contains one or more sinks and their connected status.
564 * The currently active signal type (HDMI, DP-SST, DP-MST) is also reported.
565 */
566struct dc_link {
567 const struct dc_sink *remote_sinks[MAX_SINKS_PER_LINK];
568 unsigned int sink_count;
569 const struct dc_sink *local_sink;
570 unsigned int link_index;
571 enum dc_connection_type type;
572 enum signal_type connector_signal;
573 enum dc_irq_source irq_source_hpd;
574 enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse */
575 /* caps is the same as reported_link_cap. link_traing use
576 * reported_link_cap. Will clean up. TODO
577 */
578 struct dc_link_settings reported_link_cap;
579 struct dc_link_settings verified_link_cap;
580 struct dc_link_settings max_link_setting;
581 struct dc_link_settings cur_link_settings;
582 struct dc_lane_settings cur_lane_setting;
583
584 uint8_t ddc_hw_inst;
585 uint8_t link_enc_hw_inst;
586
587 struct psr_caps psr_caps;
588 bool test_pattern_enabled;
589 union compliance_test_state compliance_test_state;
590};
591
592struct dpcd_caps {
593 union dpcd_rev dpcd_rev;
594 union max_lane_count max_ln_count;
595 union max_down_spread max_down_spread;
596
597 /* dongle type (DP converter, CV smart dongle) */
598 enum display_dongle_type dongle_type;
599 /* Dongle's downstream count. */
600 union sink_count sink_count;
601 /* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
602 indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
603 bool is_dp_hdmi_s3d_converter;
604
605 bool allow_invalid_MSA_timing_param;
606 bool panel_mode_edp;
607 uint32_t sink_dev_id;
608 uint32_t branch_dev_id;
609 int8_t branch_dev_name[6];
610 int8_t branch_hw_revision;
611};
612
613struct dc_link_status {
614 struct dpcd_caps *dpcd_caps;
615};
616
617const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link);
618
619/*
620 * Return an enumerated dc_link. dc_link order is constant and determined at
621 * boot time. They cannot be created or destroyed.
622 * Use dc_get_caps() to get number of links.
623 */
624const struct dc_link *dc_get_link_at_index(const struct dc *dc, uint32_t link_index);
625
626/* Return id of physical connector represented by a dc_link at link_index.*/
627const struct graphics_object_id dc_get_link_id_at_index(
628 struct dc *dc, uint32_t link_index);
629
630/* Set backlight level of an embedded panel (eDP, LVDS). */
631bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
632 uint32_t frame_ramp, const struct dc_stream *stream);
633
634bool dc_link_init_dmcu_backlight_settings(const struct dc_link *dc_link);
635
636bool dc_link_set_abm_level(const struct dc_link *dc_link, uint32_t level);
637
638bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);
639
640bool dc_link_setup_psr(const struct dc_link *dc_link,
641 const struct dc_stream *stream);
642
643/* Request DC to detect if there is a Panel connected.
644 * boot - If this call is during initial boot.
645 * Return false for any type of detection failure or MST detection
646 * true otherwise. True meaning further action is required (status update
647 * and OS notification).
648 */
649bool dc_link_detect(const struct dc_link *dc_link, bool boot);
650
651/* Notify DC about DP RX Interrupt (aka Short Pulse Interrupt).
652 * Return:
653 * true - Downstream port status changed. DM should call DC to do the
654 * detection.
655 * false - no change in Downstream port status. No further action required
656 * from DM. */
657bool dc_link_handle_hpd_rx_irq(const struct dc_link *dc_link);
658
659struct dc_sink_init_data;
660
661struct dc_sink *dc_link_add_remote_sink(
662 const struct dc_link *dc_link,
663 const uint8_t *edid,
664 int len,
665 struct dc_sink_init_data *init_data);
666
667void dc_link_remove_remote_sink(
668 const struct dc_link *link,
669 const struct dc_sink *sink);
670
671/* Used by diagnostics for virtual link at the moment */
672void dc_link_set_sink(const struct dc_link *link, struct dc_sink *sink);
673
674void dc_link_dp_set_drive_settings(
675 struct dc_link *link,
676 struct link_training_settings *lt_settings);
677
678bool dc_link_dp_perform_link_training(
679 struct dc_link *link,
680 const struct dc_link_settings *link_setting,
681 bool skip_video_pattern);
682
683void dc_link_dp_enable_hpd(const struct dc_link *link);
684
685void dc_link_dp_disable_hpd(const struct dc_link *link);
686
687bool dc_link_dp_set_test_pattern(
688 const struct dc_link *link,
689 enum dp_test_pattern test_pattern,
690 const struct link_training_settings *p_link_settings,
691 const unsigned char *p_custom_pattern,
692 unsigned int cust_pattern_size);
693
694/*******************************************************************************
695 * Sink Interfaces - A sink corresponds to a display output device
696 ******************************************************************************/
697
698/*
699 * The sink structure contains EDID and other display device properties
700 */
701struct dc_sink {
702 enum signal_type sink_signal;
703 struct dc_edid dc_edid; /* raw edid */
704 struct dc_edid_caps edid_caps; /* parse display caps */
705};
706
707void dc_sink_retain(const struct dc_sink *sink);
708void dc_sink_release(const struct dc_sink *sink);
709
710const struct audio **dc_get_audios(struct dc *dc);
711
712struct dc_sink_init_data {
713 enum signal_type sink_signal;
714 const struct dc_link *link;
715 uint32_t dongle_max_pix_clk;
716 bool converter_disable_audio;
717};
718
719struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params);
720
721/*******************************************************************************
722 * Cursor interfaces - To manages the cursor within a target
723 ******************************************************************************/
724/* TODO: Deprecated once we switch to dc_set_cursor_position */
725bool dc_target_set_cursor_attributes(
726 struct dc_target *dc_target,
727 const struct dc_cursor_attributes *attributes);
728
729bool dc_target_set_cursor_position(
730 struct dc_target *dc_target,
731 const struct dc_cursor_position *position);
732
733/* Newer interfaces */
734struct dc_cursor {
735 struct dc_plane_address address;
736 struct dc_cursor_attributes attributes;
737};
738
739/*
740 * Create a new cursor with default values for a given target.
741 */
742struct dc_cursor *dc_create_cursor_for_target(
743 const struct dc *dc,
744 struct dc_target *dc_target);
745
746/**
747 * Commit cursor attribute changes such as pixel format and dimensions and
748 * surface address.
749 *
750 * After this call:
751 * Cursor address and format is programmed to the new values.
752 * Cursor position is unmodified.
753 */
754bool dc_commit_cursor(
755 const struct dc *dc,
756 struct dc_cursor *cursor);
757
758/*
759 * Optimized cursor position update
760 *
761 * After this call:
762 * Cursor position will be programmed as well as enable/disable bit.
763 */
764bool dc_set_cursor_position(
765 const struct dc *dc,
766 struct dc_cursor *cursor,
767 struct dc_cursor_position *pos);
768
769/*******************************************************************************
770 * Interrupt interfaces
771 ******************************************************************************/
772enum dc_irq_source dc_interrupt_to_irq_source(
773 struct dc *dc,
774 uint32_t src_id,
775 uint32_t ext_id);
776void dc_interrupt_set(const struct dc *dc, enum dc_irq_source src, bool enable);
777void dc_interrupt_ack(struct dc *dc, enum dc_irq_source src);
778enum dc_irq_source dc_get_hpd_irq_source_at_index(
779 struct dc *dc, uint32_t link_index);
780
781/*******************************************************************************
782 * Power Interfaces
783 ******************************************************************************/
784
785void dc_set_power_state(
786 struct dc *dc,
787 enum dc_acpi_cm_power_state power_state,
788 enum dc_video_power_state video_power_state);
789void dc_resume(const struct dc *dc);
790
791/*******************************************************************************
792 * DDC Interfaces
793 ******************************************************************************/
794
795const struct ddc_service *dc_get_ddc_at_index(
796 struct dc *dc, uint32_t link_index);
797
798/*
799 * DPCD access interfaces
800 */
801
802bool dc_read_dpcd(
803 struct dc *dc,
804 uint32_t link_index,
805 uint32_t address,
806 uint8_t *data,
807 uint32_t size);
808
809bool dc_write_dpcd(
810 struct dc *dc,
811 uint32_t link_index,
812 uint32_t address,
813 const uint8_t *data,
814 uint32_t size);
815
816bool dc_submit_i2c(
817 struct dc *dc,
818 uint32_t link_index,
819 struct i2c_command *cmd);
820
821#endif /* DC_INTERFACE_H_ */