aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/drm/drm_edid.h102
1 files changed, 102 insertions, 0 deletions
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index b96031d947a0..c2f1bfa22010 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -207,6 +207,61 @@ struct detailed_timing {
207#define DRM_EDID_HDMI_DC_30 (1 << 4) 207#define DRM_EDID_HDMI_DC_30 (1 << 4)
208#define DRM_EDID_HDMI_DC_Y444 (1 << 3) 208#define DRM_EDID_HDMI_DC_Y444 (1 << 3)
209 209
210/* ELD Header Block */
211#define DRM_ELD_HEADER_BLOCK_SIZE 4
212
213#define DRM_ELD_VER 0
214# define DRM_ELD_VER_SHIFT 3
215# define DRM_ELD_VER_MASK (0x1f << 3)
216
217#define DRM_ELD_BASELINE_ELD_LEN 2 /* in dwords! */
218
219/* ELD Baseline Block for ELD_Ver == 2 */
220#define DRM_ELD_CEA_EDID_VER_MNL 4
221# define DRM_ELD_CEA_EDID_VER_SHIFT 5
222# define DRM_ELD_CEA_EDID_VER_MASK (7 << 5)
223# define DRM_ELD_CEA_EDID_VER_NONE (0 << 5)
224# define DRM_ELD_CEA_EDID_VER_CEA861 (1 << 5)
225# define DRM_ELD_CEA_EDID_VER_CEA861A (2 << 5)
226# define DRM_ELD_CEA_EDID_VER_CEA861BCD (3 << 5)
227# define DRM_ELD_MNL_SHIFT 0
228# define DRM_ELD_MNL_MASK (0x1f << 0)
229
230#define DRM_ELD_SAD_COUNT_CONN_TYPE 5
231# define DRM_ELD_SAD_COUNT_SHIFT 4
232# define DRM_ELD_SAD_COUNT_MASK (0xf << 4)
233# define DRM_ELD_CONN_TYPE_SHIFT 2
234# define DRM_ELD_CONN_TYPE_MASK (3 << 2)
235# define DRM_ELD_CONN_TYPE_HDMI (0 << 2)
236# define DRM_ELD_CONN_TYPE_DP (1 << 2)
237# define DRM_ELD_SUPPORTS_AI (1 << 1)
238# define DRM_ELD_SUPPORTS_HDCP (1 << 0)
239
240#define DRM_ELD_AUD_SYNCH_DELAY 6 /* in units of 2 ms */
241# define DRM_ELD_AUD_SYNCH_DELAY_MAX 0xfa /* 500 ms */
242
243#define DRM_ELD_SPEAKER 7
244# define DRM_ELD_SPEAKER_RLRC (1 << 6)
245# define DRM_ELD_SPEAKER_FLRC (1 << 5)
246# define DRM_ELD_SPEAKER_RC (1 << 4)
247# define DRM_ELD_SPEAKER_RLR (1 << 3)
248# define DRM_ELD_SPEAKER_FC (1 << 2)
249# define DRM_ELD_SPEAKER_LFE (1 << 1)
250# define DRM_ELD_SPEAKER_FLR (1 << 0)
251
252#define DRM_ELD_PORT_ID 8 /* offsets 8..15 inclusive */
253# define DRM_ELD_PORT_ID_LEN 8
254
255#define DRM_ELD_MANUFACTURER_NAME0 16
256#define DRM_ELD_MANUFACTURER_NAME1 17
257
258#define DRM_ELD_PRODUCT_CODE0 18
259#define DRM_ELD_PRODUCT_CODE1 19
260
261#define DRM_ELD_MONITOR_NAME_STRING 20 /* offsets 20..(20+mnl-1) inclusive */
262
263#define DRM_ELD_CEA_SAD(mnl, sad) (20 + (mnl) + 3 * (sad))
264
210struct edid { 265struct edid {
211 u8 header[8]; 266 u8 header[8];
212 /* Vendor & product info */ 267 /* Vendor & product info */
@@ -279,4 +334,51 @@ int
279drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 334drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame,
280 const struct drm_display_mode *mode); 335 const struct drm_display_mode *mode);
281 336
337/**
338 * drm_eld_mnl - Get ELD monitor name length in bytes.
339 * @eld: pointer to an eld memory structure with mnl set
340 */
341static inline int drm_eld_mnl(const uint8_t *eld)
342{
343 return (eld[DRM_ELD_CEA_EDID_VER_MNL] & DRM_ELD_MNL_MASK) >> DRM_ELD_MNL_SHIFT;
344}
345
346/**
347 * drm_eld_sad_count - Get ELD SAD count.
348 * @eld: pointer to an eld memory structure with sad_count set
349 */
350static inline int drm_eld_sad_count(const uint8_t *eld)
351{
352 return (eld[DRM_ELD_SAD_COUNT_CONN_TYPE] & DRM_ELD_SAD_COUNT_MASK) >>
353 DRM_ELD_SAD_COUNT_SHIFT;
354}
355
356/**
357 * drm_eld_calc_baseline_block_size - Calculate baseline block size in bytes
358 * @eld: pointer to an eld memory structure with mnl and sad_count set
359 *
360 * This is a helper for determining the payload size of the baseline block, in
361 * bytes, for e.g. setting the Baseline_ELD_Len field in the ELD header block.
362 */
363static inline int drm_eld_calc_baseline_block_size(const uint8_t *eld)
364{
365 return DRM_ELD_MONITOR_NAME_STRING - DRM_ELD_HEADER_BLOCK_SIZE +
366 drm_eld_mnl(eld) + drm_eld_sad_count(eld) * 3;
367}
368
369/**
370 * drm_eld_size - Get ELD size in bytes
371 * @eld: pointer to a complete eld memory structure
372 *
373 * The returned value does not include the vendor block. It's vendor specific,
374 * and comprises of the remaining bytes in the ELD memory buffer after
375 * drm_eld_size() bytes of header and baseline block.
376 *
377 * The returned value is guaranteed to be a multiple of 4.
378 */
379static inline int drm_eld_size(const uint8_t *eld)
380{
381 return DRM_ELD_HEADER_BLOCK_SIZE + eld[DRM_ELD_BASELINE_ELD_LEN] * 4;
382}
383
282#endif /* __DRM_EDID_H__ */ 384#endif /* __DRM_EDID_H__ */