Home | History | Annotate | Line # | Download | only in include
      1 /*	$NetBSD: signal_types.h,v 1.2 2021/12/18 23:45:07 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 #ifndef __DC_SIGNAL_TYPES_H__
     29 #define __DC_SIGNAL_TYPES_H__
     30 
     31 /* Minimum pixel clock, in KHz. For TMDS signal is 25.00 MHz */
     32 #define TMDS_MIN_PIXEL_CLOCK 25000
     33 /* Maximum pixel clock, in KHz. For TMDS signal is 165.00 MHz */
     34 #define TMDS_MAX_PIXEL_CLOCK 165000
     35 
     36 enum signal_type {
     37 	SIGNAL_TYPE_NONE		= 0L,		/* no signal */
     38 	SIGNAL_TYPE_DVI_SINGLE_LINK	= (1 << 0),
     39 	SIGNAL_TYPE_DVI_DUAL_LINK	= (1 << 1),
     40 	SIGNAL_TYPE_HDMI_TYPE_A		= (1 << 2),
     41 	SIGNAL_TYPE_LVDS		= (1 << 3),
     42 	SIGNAL_TYPE_RGB			= (1 << 4),
     43 	SIGNAL_TYPE_DISPLAY_PORT	= (1 << 5),
     44 	SIGNAL_TYPE_DISPLAY_PORT_MST	= (1 << 6),
     45 	SIGNAL_TYPE_EDP			= (1 << 7),
     46 	SIGNAL_TYPE_VIRTUAL		= (1 << 9),	/* Virtual Display */
     47 };
     48 
     49 /* help functions for signal types manipulation */
     50 static inline bool dc_is_hdmi_tmds_signal(enum signal_type signal)
     51 {
     52 	return (signal == SIGNAL_TYPE_HDMI_TYPE_A);
     53 }
     54 
     55 static inline bool dc_is_hdmi_signal(enum signal_type signal)
     56 {
     57 	return (signal == SIGNAL_TYPE_HDMI_TYPE_A);
     58 }
     59 
     60 static inline bool dc_is_dp_sst_signal(enum signal_type signal)
     61 {
     62 	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
     63 		signal == SIGNAL_TYPE_EDP);
     64 }
     65 
     66 static inline bool dc_is_dp_signal(enum signal_type signal)
     67 {
     68 	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
     69 		signal == SIGNAL_TYPE_EDP ||
     70 		signal == SIGNAL_TYPE_DISPLAY_PORT_MST);
     71 }
     72 
     73 static inline bool dc_is_embedded_signal(enum signal_type signal)
     74 {
     75 	return (signal == SIGNAL_TYPE_EDP || signal == SIGNAL_TYPE_LVDS);
     76 }
     77 
     78 static inline bool dc_is_lvds_signal(enum signal_type signal)
     79 {
     80 	return (signal == SIGNAL_TYPE_LVDS);
     81 }
     82 
     83 static inline bool dc_is_dvi_signal(enum signal_type signal)
     84 {
     85 	switch (signal) {
     86 	case SIGNAL_TYPE_DVI_SINGLE_LINK:
     87 	case SIGNAL_TYPE_DVI_DUAL_LINK:
     88 		return true;
     89 	break;
     90 	default:
     91 		return false;
     92 	}
     93 }
     94 
     95 static inline bool dc_is_dvi_single_link_signal(enum signal_type signal)
     96 {
     97 	return (signal == SIGNAL_TYPE_DVI_SINGLE_LINK);
     98 }
     99 
    100 static inline bool dc_is_dual_link_signal(enum signal_type signal)
    101 {
    102 	return (signal == SIGNAL_TYPE_DVI_DUAL_LINK);
    103 }
    104 
    105 static inline bool dc_is_audio_capable_signal(enum signal_type signal)
    106 {
    107 	return (signal == SIGNAL_TYPE_DISPLAY_PORT ||
    108 		signal == SIGNAL_TYPE_DISPLAY_PORT_MST ||
    109 		dc_is_hdmi_signal(signal));
    110 }
    111 
    112 static inline bool dc_is_virtual_signal(enum signal_type signal)
    113 {
    114 	return (signal == SIGNAL_TYPE_VIRTUAL);
    115 }
    116 
    117 #endif
    118