1 1.1 jmcneill /* $NetBSD: eldreg.h,v 1.1 2015/03/28 14:09:59 jmcneill Exp $ */ 2 1.1 jmcneill 3 1.1 jmcneill /* 4 1.1 jmcneill * Copyright (c) 2011 Jared D. McNeill <jmcneill (at) invisible.ca> 5 1.1 jmcneill * All rights reserved. 6 1.1 jmcneill * 7 1.1 jmcneill * Redistribution and use in source and binary forms, with or without 8 1.1 jmcneill * modification, are permitted provided that the following conditions 9 1.1 jmcneill * are met: 10 1.1 jmcneill * 1. Redistributions of source code must retain the above copyright 11 1.1 jmcneill * notice, this list of conditions and the following disclaimer. 12 1.1 jmcneill * 2. The name of the author may not be used to endorse or promote products 13 1.1 jmcneill * derived from this software without specific prior written permission. 14 1.1 jmcneill * 15 1.1 jmcneill * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 1.1 jmcneill * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 1.1 jmcneill * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 1.1 jmcneill * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 1.1 jmcneill * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 1.1 jmcneill * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 1.1 jmcneill * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 1.1 jmcneill * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 1.1 jmcneill * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 1.1 jmcneill * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 1.1 jmcneill * SUCH DAMAGE. 26 1.1 jmcneill */ 27 1.1 jmcneill 28 1.1 jmcneill #ifndef _ELDREG_H 29 1.1 jmcneill #define _ELDREG_H 30 1.1 jmcneill 31 1.1 jmcneill #define ELD_MAX_NBYTES 80 /* version 2; 15 SAD count */ 32 1.1 jmcneill 33 1.1 jmcneill struct eld_header_block { 34 1.1 jmcneill uint8_t flags; /* ver */ 35 1.1 jmcneill uint8_t reserved1; 36 1.1 jmcneill uint8_t baseline_eld_len; /* dword count */ 37 1.1 jmcneill uint8_t reserved2; 38 1.1 jmcneill } __packed; 39 1.1 jmcneill 40 1.1 jmcneill struct eld_baseline_block { 41 1.1 jmcneill struct eld_header_block header; 42 1.1 jmcneill uint8_t flags[4]; /* cea_edid_ver, mnl, 43 1.1 jmcneill * sad_count, conn_type, s_ai, hdcp, 44 1.1 jmcneill * aud_synch_delay, 45 1.1 jmcneill * rlrc, flrc, rc, rlr, fc, lfe, flr 46 1.1 jmcneill */ 47 1.1 jmcneill uint64_t port_id; 48 1.1 jmcneill uint16_t vendor; 49 1.1 jmcneill uint16_t product; 50 1.1 jmcneill /* monitor name string, CEA SADs, vendor data ... */ 51 1.1 jmcneill } __packed; 52 1.1 jmcneill 53 1.1 jmcneill #define ELD_VER(block) (((block)->header.flags >> 3) & 0x1f) 54 1.1 jmcneill #define ELD_VER_2 0x02 55 1.1 jmcneill #define ELD_VER_UNCONF 0x1f 56 1.1 jmcneill #define ELD_CEA_EDID_VER(block) (((block)->flags[0] >> 5) & 0x07) 57 1.1 jmcneill #define ELD_CEA_EDID_VER_NONE 0x0 58 1.1 jmcneill #define ELD_CEA_EDID_VER_861 0x1 59 1.1 jmcneill #define ELD_CEA_EDID_VER_861A 0x2 60 1.1 jmcneill #define ELD_CEA_EDID_VER_861BCD 0x3 61 1.1 jmcneill #define ELD_MNL(block) (((block)->flags[0] >> 0) & 0x1f) 62 1.1 jmcneill #define ELD_SAD_COUNT(block) (((block)->flags[1] >> 4) & 0x0f) 63 1.1 jmcneill #define ELD_CONN_TYPE(block) (((block)->flags[1] >> 2) & 0x03) 64 1.1 jmcneill #define ELD_CONN_TYPE_HDMI 0x0 65 1.1 jmcneill #define ELD_S_AI(block) (((block)->flags[1] >> 1) & 0x01) 66 1.1 jmcneill #define ELD_HDCP(block) (((block)->flags[1] >> 0) & 0x01) 67 1.1 jmcneill #define ELD_AUDIO_DELAY(block) ((block)->flags[2]) 68 1.1 jmcneill #define ELD_AUDIO_DELAY_NONE 0x00 69 1.1 jmcneill #define ELD_AUDIO_DELAY_MS(x) ((x) * 2) 70 1.1 jmcneill #define ELD_AUDIO_DELAY_MS_MAX 500 71 1.1 jmcneill #define ELD_SPEAKER(block) ((block)->flags[3]) 72 1.1 jmcneill #define ELD_SPEAKER_RLRC 0x40 73 1.1 jmcneill #define ELD_SPEAKER_FLRC 0x20 74 1.1 jmcneill #define ELD_SPEAKER_RC 0x10 75 1.1 jmcneill #define ELD_SPEAKER_RLR 0x08 76 1.1 jmcneill #define ELD_SPEAKER_FC 0x04 77 1.1 jmcneill #define ELD_SPEAKER_LFE 0x02 78 1.1 jmcneill #define ELD_SPEAKER_FLR 0x01 79 1.1 jmcneill 80 1.1 jmcneill #endif /* !_ELDREG_H */ 81