Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /* include/video/ili9320.c
0003  *
0004  * ILI9320 LCD controller configuration control.
0005  *
0006  * Copyright 2007 Simtec Electronics
0007  *  Ben Dooks <ben@simtec.co.uk>
0008  *
0009  * http://armlinux.simtec.co.uk/
0010 */
0011 
0012 #define ILI9320_REG(x)  (x)
0013 
0014 #define ILI9320_INDEX           ILI9320_REG(0x00)
0015 
0016 #define ILI9320_OSCILATION      ILI9320_REG(0x00)
0017 #define ILI9320_DRIVER          ILI9320_REG(0x01)
0018 #define ILI9320_DRIVEWAVE       ILI9320_REG(0x02)
0019 #define ILI9320_ENTRYMODE       ILI9320_REG(0x03)
0020 #define ILI9320_RESIZING        ILI9320_REG(0x04)
0021 #define ILI9320_DISPLAY1        ILI9320_REG(0x07)
0022 #define ILI9320_DISPLAY2        ILI9320_REG(0x08)
0023 #define ILI9320_DISPLAY3        ILI9320_REG(0x09)
0024 #define ILI9320_DISPLAY4        ILI9320_REG(0x0A)
0025 #define ILI9320_RGB_IF1         ILI9320_REG(0x0C)
0026 #define ILI9320_FRAMEMAKER      ILI9320_REG(0x0D)
0027 #define ILI9320_RGB_IF2         ILI9320_REG(0x0F)
0028 
0029 #define ILI9320_POWER1          ILI9320_REG(0x10)
0030 #define ILI9320_POWER2          ILI9320_REG(0x11)
0031 #define ILI9320_POWER3          ILI9320_REG(0x12)
0032 #define ILI9320_POWER4          ILI9320_REG(0x13)
0033 #define ILI9320_GRAM_HORIZ_ADDR     ILI9320_REG(0x20)
0034 #define ILI9320_GRAM_VERT_ADD       ILI9320_REG(0x21)
0035 #define ILI9320_POWER7          ILI9320_REG(0x29)
0036 #define ILI9320_FRAME_RATE_COLOUR   ILI9320_REG(0x2B)
0037 
0038 #define ILI9320_GAMMA1          ILI9320_REG(0x30)
0039 #define ILI9320_GAMMA2          ILI9320_REG(0x31)
0040 #define ILI9320_GAMMA3          ILI9320_REG(0x32)
0041 #define ILI9320_GAMMA4          ILI9320_REG(0x35)
0042 #define ILI9320_GAMMA5          ILI9320_REG(0x36)
0043 #define ILI9320_GAMMA6          ILI9320_REG(0x37)
0044 #define ILI9320_GAMMA7          ILI9320_REG(0x38)
0045 #define ILI9320_GAMMA8          ILI9320_REG(0x39)
0046 #define ILI9320_GAMMA9          ILI9320_REG(0x3C)
0047 #define ILI9320_GAMMA10         ILI9320_REG(0x3D)
0048 
0049 #define ILI9320_HORIZ_START     ILI9320_REG(0x50)
0050 #define ILI9320_HORIZ_END       ILI9320_REG(0x51)
0051 #define ILI9320_VERT_START      ILI9320_REG(0x52)
0052 #define ILI9320_VERT_END        ILI9320_REG(0x53)
0053 
0054 #define ILI9320_DRIVER2         ILI9320_REG(0x60)
0055 #define ILI9320_BASE_IMAGE      ILI9320_REG(0x61)
0056 #define ILI9320_VERT_SCROLL     ILI9320_REG(0x6a)
0057 
0058 #define ILI9320_PARTIAL1_POSITION   ILI9320_REG(0x80)
0059 #define ILI9320_PARTIAL1_START      ILI9320_REG(0x81)
0060 #define ILI9320_PARTIAL1_END        ILI9320_REG(0x82)
0061 #define ILI9320_PARTIAL2_POSITION   ILI9320_REG(0x83)
0062 #define ILI9320_PARTIAL2_START      ILI9320_REG(0x84)
0063 #define ILI9320_PARTIAL2_END        ILI9320_REG(0x85)
0064 
0065 #define ILI9320_INTERFACE1      ILI9320_REG(0x90)
0066 #define ILI9320_INTERFACE2      ILI9320_REG(0x92)
0067 #define ILI9320_INTERFACE3      ILI9320_REG(0x93)
0068 #define ILI9320_INTERFACE4      ILI9320_REG(0x95)
0069 #define ILI9320_INTERFACE5      ILI9320_REG(0x97)
0070 #define ILI9320_INTERFACE6      ILI9320_REG(0x98)
0071 
0072 /* Register contents definitions. */
0073 
0074 #define ILI9320_OSCILATION_OSC      (1 << 0)
0075 
0076 #define ILI9320_DRIVER_SS       (1 << 8)
0077 #define ILI9320_DRIVER_SM       (1 << 10)
0078 
0079 #define ILI9320_DRIVEWAVE_EOR       (1 << 8)
0080 #define ILI9320_DRIVEWAVE_BC        (1 << 9)
0081 #define ILI9320_DRIVEWAVE_MUSTSET   (1 << 10)
0082 
0083 #define ILI9320_ENTRYMODE_AM        (1 << 3)
0084 #define ILI9320_ENTRYMODE_ID(x)     ((x) << 4)
0085 #define ILI9320_ENTRYMODE_ORG       (1 << 7)
0086 #define ILI9320_ENTRYMODE_HWM       (1 << 8)
0087 #define ILI9320_ENTRYMODE_BGR       (1 << 12)
0088 #define ILI9320_ENTRYMODE_DFM       (1 << 14)
0089 #define ILI9320_ENTRYMODE_TRI       (1 << 15)
0090 
0091 
0092 #define ILI9320_RESIZING_RSZ(x)     ((x) << 0)
0093 #define ILI9320_RESIZING_RCH(x)     ((x) << 4)
0094 #define ILI9320_RESIZING_RCV(x)     ((x) << 8)
0095 
0096 
0097 #define ILI9320_DISPLAY1_D(x)       ((x) << 0)
0098 #define ILI9320_DISPLAY1_CL     (1 << 3)
0099 #define ILI9320_DISPLAY1_DTE        (1 << 4)
0100 #define ILI9320_DISPLAY1_GON        (1 << 5)
0101 #define ILI9320_DISPLAY1_BASEE      (1 << 8)
0102 #define ILI9320_DISPLAY1_PTDE(x)    ((x) << 12)
0103 
0104 
0105 #define ILI9320_DISPLAY2_BP(x)      ((x) << 0)
0106 #define ILI9320_DISPLAY2_FP(x)      ((x) << 8)
0107 
0108 
0109 #define ILI9320_RGBIF1_RIM_RGB18    (0 << 0)
0110 #define ILI9320_RGBIF1_RIM_RGB16    (1 << 0)
0111 #define ILI9320_RGBIF1_RIM_RGB6     (2 << 0)
0112 
0113 #define ILI9320_RGBIF1_CLK_INT      (0 << 4)
0114 #define ILI9320_RGBIF1_CLK_RGBIF    (1 << 4)
0115 #define ILI9320_RGBIF1_CLK_VSYNC    (2 << 4)
0116 
0117 #define ILI9320_RGBIF1_RM       (1 << 8)
0118 
0119 #define ILI9320_RGBIF1_ENC_FRAMES(x)    (((x) - 1)<< 13)
0120 
0121 #define ILI9320_RGBIF2_DPL      (1 << 0)
0122 #define ILI9320_RGBIF2_EPL      (1 << 1)
0123 #define ILI9320_RGBIF2_HSPL     (1 << 3)
0124 #define ILI9320_RGBIF2_VSPL     (1 << 4)
0125 
0126 
0127 #define ILI9320_POWER1_SLP      (1 << 1)
0128 #define ILI9320_POWER1_DSTB     (1 << 2)
0129 #define ILI9320_POWER1_AP(x)        ((x) << 4)
0130 #define ILI9320_POWER1_APE      (1 << 7)
0131 #define ILI9320_POWER1_BT(x)        ((x) << 8)
0132 #define ILI9320_POWER1_SAP      (1 << 12)
0133 
0134 
0135 #define ILI9320_POWER2_VC(x)        ((x) << 0)
0136 #define ILI9320_POWER2_DC0(x)       ((x) << 4)
0137 #define ILI9320_POWER2_DC1(x)       ((x) << 8)
0138 
0139 
0140 #define ILI9320_POWER3_VRH(x)       ((x) << 0)
0141 #define ILI9320_POWER3_PON      (1 << 4)
0142 #define ILI9320_POWER3_VCMR     (1 << 8)
0143 
0144 
0145 #define ILI9320_POWER4_VREOUT(x)    ((x) << 8)
0146 
0147 
0148 #define ILI9320_DRIVER2_SCNL(x)     ((x) << 0)
0149 #define ILI9320_DRIVER2_NL(x)       ((x) << 8)
0150 #define ILI9320_DRIVER2_GS      (1 << 15)
0151 
0152 
0153 #define ILI9320_BASEIMAGE_REV       (1 << 0)
0154 #define ILI9320_BASEIMAGE_VLE       (1 << 1)
0155 #define ILI9320_BASEIMAGE_NDL       (1 << 2)
0156 
0157 
0158 #define ILI9320_INTERFACE4_RTNE(x)  (x)
0159 #define ILI9320_INTERFACE4_DIVE(x)  ((x) << 8)
0160 
0161 /* SPI interface definitions */
0162 
0163 #define ILI9320_SPI_IDCODE      (0x70)
0164 #define ILI9320_SPI_ID(x)       ((x) << 2)
0165 #define ILI9320_SPI_READ        (0x01)
0166 #define ILI9320_SPI_WRITE       (0x00)
0167 #define ILI9320_SPI_DATA        (0x02)
0168 #define ILI9320_SPI_INDEX       (0x00)
0169 
0170 /* platform data to pass configuration from lcd */
0171 
0172 enum ili9320_suspend {
0173     ILI9320_SUSPEND_OFF,
0174     ILI9320_SUSPEND_DEEP,
0175 };
0176 
0177 struct ili9320_platdata {
0178     unsigned short  hsize;
0179     unsigned short  vsize;
0180 
0181     enum ili9320_suspend suspend;
0182 
0183     /* set the reset line, 0 = reset asserted, 1 = normal */
0184     void        (*reset)(unsigned int val);
0185 
0186     unsigned short  entry_mode;
0187     unsigned short  display2;
0188     unsigned short  display3;
0189     unsigned short  display4;
0190     unsigned short  rgb_if1;
0191     unsigned short  rgb_if2;
0192     unsigned short  interface2;
0193     unsigned short  interface3;
0194     unsigned short  interface4;
0195     unsigned short  interface5;
0196     unsigned short  interface6;
0197 };
0198