Home | History | Annotate | Download | only in msm7k
      1 /*
      2  * Copyright (c) 2008, Google Inc.
      3  * All rights reserved.
      4  *
      5  * Redistribution and use in source and binary forms, with or without
      6  * modification, are permitted provided that the following conditions
      7  * are met:
      8  *  * Redistributions of source code must retain the above copyright
      9  *    notice, this list of conditions and the following disclaimer.
     10  *  * Redistributions in binary form must reproduce the above copyright
     11  *    notice, this list of conditions and the following disclaimer in
     12  *    the documentation and/or other materials provided with the
     13  *    distribution.
     14  *
     15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     16  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     17  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     18  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     19  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
     20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
     22  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     25  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  * SUCH DAMAGE.
     27  */
     28 
     29 #ifndef __ASM_ARCH_MSM7200_MDDI_H
     30 #define __ASM_ARCH_MSM7200_MDDI_H
     31 
     32 #define MSM_MDDI_BASE 0xAA600000
     33 
     34 /* see 80-VA736-2 C pp 776-787 */
     35 
     36 #define MDDI_REG(off) (MSM_MDDI_BASE + (off))
     37 
     38 #define MDDI_CMD               MDDI_REG(0x0000)
     39 #define MDDI_VERSION           MDDI_REG(0x0004)
     40 #define MDDI_PRI_PTR           MDDI_REG(0x0008)
     41 #define MDDI_SEC_PTR           MDDI_REG(0x000C)
     42 #define MDDI_BPS               MDDI_REG(0x0010)
     43 #define MDDI_SPM               MDDI_REG(0x0014)
     44 #define MDDI_INT               MDDI_REG(0x0018)
     45 
     46 #define MDDI_INT_PRI_PTR_READ          (1 << 0)
     47 #define MDDI_INT_SEC_PTR_READ          (1 << 1)
     48 #define MDDI_INT_REV_DATA_AVAIL        (1 << 2)
     49 #define MDDI_INT_DISP_REQ              (1 << 3)
     50 #define MDDI_INT_PRI_UNDERFLOW         (1 << 4)
     51 #define MDDI_INT_SEC_UNDERFLOW         (1 << 5)
     52 #define MDDI_INT_REV_OVERFLOW          (1 << 6)
     53 #define MDDI_INT_CRC_ERROR             (1 << 7)
     54 #define MDDI_INT_MDDI_IN               (1 << 8)
     55 #define MDDI_INT_PRI_OVERWRITE         (1 << 9)
     56 #define MDDI_INT_SEC_OVERWRITE         (1 << 10)
     57 #define MDDI_INT_REV_OVERWRITE         (1 << 11)
     58 #define MDDI_INT_DMA_FAILURE           (1 << 12)
     59 #define MDDI_INT_LINK_ACTIVE           (1 << 13)
     60 #define MDDI_INT_IN_HIBERNATION        (1 << 14)
     61 #define MDDI_INT_PRI_LINK_LIST_DONE    (1 << 15)
     62 #define MDDI_INT_SEC_LINK_LIST_DONE    (1 << 16)
     63 #define MDDI_INT_NO_REQ_PKTS_PENDING   (1 << 17)
     64 #define MDDI_INT_RTD_FAILURE           (1 << 18)
     65 #define MDDI_INT_REV_PKT_RECEIVED      (1 << 19)
     66 #define MDDI_INT_REV_PKTS_AVAIL        (1 << 20)
     67 
     68 #define MDDI_INTEN             MDDI_REG(0x001C)
     69 #define MDDI_REV_PTR           MDDI_REG(0x0020)
     70 #define MDDI_REV_SIZE          MDDI_REG(0x0024)
     71 #define MDDI_STAT              MDDI_REG(0x0028)
     72 
     73 #define MDDI_STAT_LINK_ACTIVE                (1 << 0)
     74 #define MDDI_STAT_NEW_REV_PTR                (1 << 1)
     75 #define MDDI_STAT_NEW_PRI_PTR                (1 << 2)
     76 #define MDDI_STAT_NEW_SEC_PTR                (1 << 3)
     77 #define MDDI_STAT_IN_HIBERNATION             (1 << 4)
     78 #define MDDI_STAT_PRI_LINK_LIST_DONE         (1 << 5)
     79 #define MDDI_STAT_SEC_LINK_LIST_DONE         (1 << 6)
     80 #define MDDI_STAT_SEND_TIMING_PKT            (1 << 7)
     81 #define MDDI_STAT_SEND_REV_ENCAP_WITH_FLAGS  (1 << 8)
     82 #define MDDI_STAT_SEND_POWER_DOWN            (1 << 9)
     83 #define MDDI_STAT_DO_HANDSHAKE               (1 << 10)
     84 #define MDDI_STAT_RTD_MEAS_FAIL              (1 << 11)
     85 #define MDDI_STAT_CLIENT_WAKEUP_REQ          (1 << 12)
     86 #define MDDI_STAT_DMA_ABORT                  (1 << 13)
     87 #define MDDI_STAT_REV_OVERFLOW_RESET         (1 << 14)
     88 #define MDDI_STAT_FORCE_NEW_REV_PTR          (1 << 15)
     89 #define MDDI_STAT_CRC_ERRORS                 (1 << 16)
     90 
     91 #define MDDI_REV_RATE_DIV      MDDI_REG(0x002C)
     92 #define MDDI_REV_CRC_ERR       MDDI_REG(0x0030)
     93 #define MDDI_TA1_LEN           MDDI_REG(0x0034)
     94 #define MDDI_TA2_LEN           MDDI_REG(0x0038)
     95 #define MDDI_TEST_BUS          MDDI_REG(0x003C)
     96 #define MDDI_TEST              MDDI_REG(0x0040)
     97 #define MDDI_REV_PKT_CNT       MDDI_REG(0x0044)
     98 #define MDDI_DRIVE_HI          MDDI_REG(0x0048)
     99 #define MDDI_DRIVE_LO          MDDI_REG(0x004C)
    100 #define MDDI_DISP_WAKE         MDDI_REG(0x0050)
    101 #define MDDI_REV_ENCAP_SZ      MDDI_REG(0x0054)
    102 #define MDDI_RTD_VAL           MDDI_REG(0x0058)
    103 #define MDDI_MDP_VID_FMT_DES   MDDI_REG(0x005C)
    104 #define MDDI_MDP_VID_PIX_ATTR  MDDI_REG(0x0060)
    105 #define MDDI_MDP_VID_CLIENTID  MDDI_REG(0x0064)
    106 #define MDDI_PAD_CTL           MDDI_REG(0x0068)
    107 #define MDDI_DRIVER_START_CNT  MDDI_REG(0x006C)
    108 #define MDDI_NEXT_PRI_PTR      MDDI_REG(0x0070)
    109 #define MDDI_NEXT_SEC_PTR      MDDI_REG(0x0074)
    110 #define MDDI_MISR_CTL          MDDI_REG(0x0078)
    111 #define MDDI_MISR_DATA         MDDI_REG(0x007C)
    112 #define MDDI_SF_CNT            MDDI_REG(0x0080)
    113 #define MDDI_MF_CNT            MDDI_REG(0x0084)
    114 #define MDDI_CURR_REV_PTR      MDDI_REG(0x0088)
    115 #define MDDI_CORE_VER          MDDI_REG(0x008C)
    116 
    117 #define CMD_POWER_DOWN         0x0100
    118 #define CMD_POWER_UP           0x0200
    119 #define CMD_HIBERNATE          0x0300
    120 #define CMD_RESET              0x0400
    121 #define CMD_IGNORE             0x0500
    122 #define CMD_REV_ENC_REQ        0x0600
    123 #define CMD_RTD_MEASURE        0x0700
    124 #define CMD_LINK_ACTIVE        0x0900
    125 #define CMD_PERIODIC_REV_ENC   0x0A00
    126 #define CMD_FORCE_NEW_REV_PTR  0x0C00
    127 
    128 #define CMD_GET_CLIENT_CAP     0x0601
    129 #define CMD_GET_CLIENT_STATUS  0x0602
    130 
    131 #if 1
    132 #define FORMAT_18BPP           0x5666
    133 #define FORMAT_24BPP           0x5888
    134 #define FORMAT_16BPP           0x5565
    135 #else
    136 #define FORMAT_MONOCHROME      (0 << 13)
    137 #define FORMAT_PALETTE         (1 << 13)
    138 #define FORMAT_RGB             (2 << 13)
    139 #define FORMAT_YCBCR422        (3 << 13)
    140 #define FORMAT_BAYER           (4 << 13)
    141 #endif
    142 
    143 #define PIXATTR_BOTH_EYES      3
    144 #define PIXATTR_LEFT_EYE       2
    145 #define PIXATTR_RIGHT_EYE      1
    146 #define PIXATTR_ALT_DISPLAY    0
    147 
    148 #define PIXATTR_PROGRESSIVE    0
    149 #define PIXATTR_INTERLACED     (1 << 2)
    150 #define PIXATTR_ALTERNATE      (1 << 3)
    151 
    152 #define PIXATTR_IGNORE_LRTB    (1 << 5)
    153 
    154 #define PIXATTR_TO_REFRESH     (0 << 6)
    155 #define PIXATTR_TO_OFFLINE     (1 << 6)
    156 #define PIXATTR_TO_ALL         (3 << 6)
    157 
    158 #define PIXATTR_LAST_ROW       (1 << 15)
    159 
    160 #define TYPE_VIDEO_STREAM      16
    161 #define TYPE_CLIENT_CAPS       66
    162 #define TYPE_REGISTER_ACCESS   146
    163 #define TYPE_CLIENT_STATUS     70
    164 
    165 typedef struct mddi_video_stream mddi_video_stream;
    166 typedef struct mddi_register_access mddi_register_access;
    167 typedef struct mddi_client_caps mddi_client_caps;
    168 
    169 typedef struct mddi_llentry mddi_llentry;
    170 
    171 struct __attribute__((packed)) mddi_video_stream
    172 {
    173     unsigned short length;      /* length in bytes excluding this field */
    174     unsigned short type;        /* MDDI_TYPE_VIDEO_STREAM */
    175     unsigned short client_id;   /* set to zero */
    176 
    177     unsigned short format;
    178     unsigned short pixattr;
    179 
    180     unsigned short left;
    181     unsigned short top;
    182     unsigned short right;
    183     unsigned short bottom;
    184 
    185     unsigned short start_x;
    186     unsigned short start_y;
    187 
    188     unsigned short pixels;
    189 
    190     unsigned short crc;
    191     unsigned short reserved;
    192 };
    193 
    194 struct __attribute__((packed)) mddi_register_access
    195 {
    196     unsigned short length;
    197     unsigned short type;
    198     unsigned short client_id;
    199 
    200     unsigned short rw_info;    /* flag below | count of reg_data */
    201 #define MDDI_WRITE     (0 << 14)
    202 #define MDDI_READ      (2 << 14)
    203 #define MDDI_READ_RESP (3 << 14)
    204 
    205     unsigned reg_addr;
    206     unsigned short crc;        /* 16 bit crc of the above */
    207 
    208     unsigned reg_data;         /* "list" of 3byte data values */
    209 };
    210 
    211 struct __attribute__((packed)) mddi_llentry {
    212     unsigned short flags;
    213     unsigned short header_count;
    214     unsigned short data_count;
    215     void *data;
    216     mddi_llentry *next;
    217     unsigned short reserved;
    218     union {
    219         mddi_video_stream v;
    220         mddi_register_access r;
    221         unsigned _[12];
    222     } u;
    223 };
    224 
    225 struct __attribute__((packed)) mddi_client_caps
    226 {
    227     unsigned short length;
    228     unsigned short type;
    229     unsigned short client_id;
    230 
    231     unsigned short protocol_ver;
    232     unsigned short min_protocol_ver;
    233     unsigned short data_rate_cap;
    234     unsigned char interface_type_cap;
    235     unsigned char num_alt_displays;
    236     unsigned short postcal_data_rate;
    237     unsigned short bitmap_width;
    238     unsigned short bitmap_height;
    239     unsigned short display_window_width;
    240     unsigned short display_window_height;
    241     unsigned cmap_size;
    242     unsigned short cmap_rgb_width;
    243     unsigned short rgb_cap;
    244     unsigned char mono_cap;
    245     unsigned char reserved1;
    246     unsigned short ycbcr_cap;
    247     unsigned short bayer_cap;
    248     unsigned short alpha_cursor_planes;
    249     unsigned client_feature_cap;
    250     unsigned char max_video_frame_rate_cap;
    251     unsigned char min_video_frame_rate_cap;
    252     unsigned short min_sub_frame_rate;
    253     unsigned short audio_buf_depth;
    254     unsigned short audio_channel_cap;
    255     unsigned short audio_sampe_rate_rap;
    256     unsigned char audio_sample_res;
    257     unsigned char mic_audio_sample_res;
    258     unsigned short mic_sample_rate_cap;
    259     unsigned char keyboard_data_fmt;
    260     unsigned char pointing_device_data_fmt;
    261     unsigned short content_protection_type;
    262     unsigned short manufacturer_name;
    263     unsigned short product_code;
    264     unsigned short reserved3;
    265     unsigned serial_no;
    266     unsigned char week_of_manufacture;
    267     unsigned char year_of_manufacture;
    268 
    269     unsigned short crc;
    270 };
    271 
    272 #endif
    273