~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/drm/drm_eld.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: MIT */
  2 /*
  3  * Copyright © 2023 Intel Corporation
  4  */
  5 
  6 #ifndef __DRM_ELD_H__
  7 #define __DRM_ELD_H__
  8 
  9 #include <linux/types.h>
 10 
 11 struct cea_sad;
 12 
 13 /* ELD Header Block */
 14 #define DRM_ELD_HEADER_BLOCK_SIZE       4
 15 
 16 #define DRM_ELD_VER                     0
 17 # define DRM_ELD_VER_SHIFT              3
 18 # define DRM_ELD_VER_MASK               (0x1f << 3)
 19 # define DRM_ELD_VER_CEA861D            (2 << 3) /* supports 861D or below */
 20 # define DRM_ELD_VER_CANNED             (0x1f << 3)
 21 
 22 #define DRM_ELD_BASELINE_ELD_LEN        2       /* in dwords! */
 23 
 24 /* ELD Baseline Block for ELD_Ver == 2 */
 25 #define DRM_ELD_CEA_EDID_VER_MNL        4
 26 # define DRM_ELD_CEA_EDID_VER_SHIFT     5
 27 # define DRM_ELD_CEA_EDID_VER_MASK      (7 << 5)
 28 # define DRM_ELD_CEA_EDID_VER_NONE      (0 << 5)
 29 # define DRM_ELD_CEA_EDID_VER_CEA861    (1 << 5)
 30 # define DRM_ELD_CEA_EDID_VER_CEA861A   (2 << 5)
 31 # define DRM_ELD_CEA_EDID_VER_CEA861BCD (3 << 5)
 32 # define DRM_ELD_MNL_SHIFT              0
 33 # define DRM_ELD_MNL_MASK               (0x1f << 0)
 34 
 35 #define DRM_ELD_SAD_COUNT_CONN_TYPE     5
 36 # define DRM_ELD_SAD_COUNT_SHIFT        4
 37 # define DRM_ELD_SAD_COUNT_MASK         (0xf << 4)
 38 # define DRM_ELD_CONN_TYPE_SHIFT        2
 39 # define DRM_ELD_CONN_TYPE_MASK         (3 << 2)
 40 # define DRM_ELD_CONN_TYPE_HDMI         (0 << 2)
 41 # define DRM_ELD_CONN_TYPE_DP           (1 << 2)
 42 # define DRM_ELD_SUPPORTS_AI            (1 << 1)
 43 # define DRM_ELD_SUPPORTS_HDCP          (1 << 0)
 44 
 45 #define DRM_ELD_AUD_SYNCH_DELAY         6       /* in units of 2 ms */
 46 # define DRM_ELD_AUD_SYNCH_DELAY_MAX    0xfa    /* 500 ms */
 47 
 48 #define DRM_ELD_SPEAKER                 7
 49 # define DRM_ELD_SPEAKER_MASK           0x7f
 50 # define DRM_ELD_SPEAKER_RLRC           (1 << 6)
 51 # define DRM_ELD_SPEAKER_FLRC           (1 << 5)
 52 # define DRM_ELD_SPEAKER_RC             (1 << 4)
 53 # define DRM_ELD_SPEAKER_RLR            (1 << 3)
 54 # define DRM_ELD_SPEAKER_FC             (1 << 2)
 55 # define DRM_ELD_SPEAKER_LFE            (1 << 1)
 56 # define DRM_ELD_SPEAKER_FLR            (1 << 0)
 57 
 58 #define DRM_ELD_PORT_ID                 8       /* offsets 8..15 inclusive */
 59 # define DRM_ELD_PORT_ID_LEN            8
 60 
 61 #define DRM_ELD_MANUFACTURER_NAME0      16
 62 #define DRM_ELD_MANUFACTURER_NAME1      17
 63 
 64 #define DRM_ELD_PRODUCT_CODE0           18
 65 #define DRM_ELD_PRODUCT_CODE1           19
 66 
 67 #define DRM_ELD_MONITOR_NAME_STRING     20      /* offsets 20..(20+mnl-1) inclusive */
 68 
 69 #define DRM_ELD_CEA_SAD(mnl, sad)       (20 + (mnl) + 3 * (sad))
 70 
 71 /**
 72  * drm_eld_mnl - Get ELD monitor name length in bytes.
 73  * @eld: pointer to an eld memory structure with mnl set
 74  */
 75 static inline int drm_eld_mnl(const u8 *eld)
 76 {
 77         return (eld[DRM_ELD_CEA_EDID_VER_MNL] & DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
 78 }
 79 
 80 int drm_eld_sad_get(const u8 *eld, int sad_index, struct cea_sad *cta_sad);
 81 int drm_eld_sad_set(u8 *eld, int sad_index, const struct cea_sad *cta_sad);
 82 
 83 /**
 84  * drm_eld_sad - Get ELD SAD structures.
 85  * @eld: pointer to an eld memory structure with sad_count set
 86  */
 87 static inline const u8 *drm_eld_sad(const u8 *eld)
 88 {
 89         unsigned int ver, mnl;
 90 
 91         ver = (eld[DRM_ELD_VER] & DRM_ELD_VER_MASK) >> DRM_ELD_VER_SHIFT;
 92         if (ver != 2 && ver != 31)
 93                 return NULL;
 94 
 95         mnl = drm_eld_mnl(eld);
 96         if (mnl > 16)
 97                 return NULL;
 98 
 99         return eld + DRM_ELD_CEA_SAD(mnl, 0);
100 }
101 
102 /**
103  * drm_eld_sad_count - Get ELD SAD count.
104  * @eld: pointer to an eld memory structure with sad_count set
105  */
106 static inline int drm_eld_sad_count(const u8 *eld)
107 {
108         return (eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_SAD_COUNT_MASK) >>
109                 DRM_ELD_SAD_COUNT_SHIFT;
110 }
111 
112 /**
113  * drm_eld_calc_baseline_block_size - Calculate baseline block size in bytes
114  * @eld: pointer to an eld memory structure with mnl and sad_count set
115  *
116  * This is a helper for determining the payload size of the baseline block, in
117  * bytes, for e.g. setting the Baseline_ELD_Len field in the ELD header block.
118  */
119 static inline int drm_eld_calc_baseline_block_size(const u8 *eld)
120 {
121         return DRM_ELD_MONITOR_NAME_STRING - DRM_ELD_HEADER_BLOCK_SIZE +
122                 drm_eld_mnl(eld) + drm_eld_sad_count(eld) * 3;
123 }
124 
125 /**
126  * drm_eld_size - Get ELD size in bytes
127  * @eld: pointer to a complete eld memory structure
128  *
129  * The returned value does not include the vendor block. It's vendor specific,
130  * and comprises of the remaining bytes in the ELD memory buffer after
131  * drm_eld_size() bytes of header and baseline block.
132  *
133  * The returned value is guaranteed to be a multiple of 4.
134  */
135 static inline int drm_eld_size(const u8 *eld)
136 {
137         return DRM_ELD_HEADER_BLOCK_SIZE + eld[DRM_ELD_BASELINE_ELD_LEN] * 4;
138 }
139 
140 /**
141  * drm_eld_get_spk_alloc - Get speaker allocation
142  * @eld: pointer to an ELD memory structure
143  *
144  * The returned value is the speakers mask. User has to use %DRM_ELD_SPEAKER
145  * field definitions to identify speakers.
146  */
147 static inline u8 drm_eld_get_spk_alloc(const u8 *eld)
148 {
149         return eld[DRM_ELD_SPEAKER] & DRM_ELD_SPEAKER_MASK;
150 }
151 
152 /**
153  * drm_eld_get_conn_type - Get device type hdmi/dp connected
154  * @eld: pointer to an ELD memory structure
155  *
156  * The caller need to use %DRM_ELD_CONN_TYPE_HDMI or %DRM_ELD_CONN_TYPE_DP to
157  * identify the display type connected.
158  */
159 static inline u8 drm_eld_get_conn_type(const u8 *eld)
160 {
161         return eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_CONN_TYPE_MASK;
162 }
163 
164 #endif /* __DRM_ELD_H__ */
165 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php