1/* include/video/ili9320.c 2 * 3 * ILI9320 LCD controller configuration control. 4 * 5 * Copyright 2007 Simtec Electronics 6 * Ben Dooks <ben@simtec.co.uk> 7 * 8 * http://armlinux.simtec.co.uk/ 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License version 2 as 12 * published by the Free Software Foundation. 13*/ 14 15#define ILI9320_REG(x) (x) 16 17#define ILI9320_INDEX ILI9320_REG(0x00) 18 19#define ILI9320_OSCILATION ILI9320_REG(0x00) 20#define ILI9320_DRIVER ILI9320_REG(0x01) 21#define ILI9320_DRIVEWAVE ILI9320_REG(0x02) 22#define ILI9320_ENTRYMODE ILI9320_REG(0x03) 23#define ILI9320_RESIZING ILI9320_REG(0x04) 24#define ILI9320_DISPLAY1 ILI9320_REG(0x07) 25#define ILI9320_DISPLAY2 ILI9320_REG(0x08) 26#define ILI9320_DISPLAY3 ILI9320_REG(0x09) 27#define ILI9320_DISPLAY4 ILI9320_REG(0x0A) 28#define ILI9320_RGB_IF1 ILI9320_REG(0x0C) 29#define ILI9320_FRAMEMAKER ILI9320_REG(0x0D) 30#define ILI9320_RGB_IF2 ILI9320_REG(0x0F) 31 32#define ILI9320_POWER1 ILI9320_REG(0x10) 33#define ILI9320_POWER2 ILI9320_REG(0x11) 34#define ILI9320_POWER3 ILI9320_REG(0x12) 35#define ILI9320_POWER4 ILI9320_REG(0x13) 36#define ILI9320_GRAM_HORIZ_ADDR ILI9320_REG(0x20) 37#define ILI9320_GRAM_VERT_ADD ILI9320_REG(0x21) 38#define ILI9320_POWER7 ILI9320_REG(0x29) 39#define ILI9320_FRAME_RATE_COLOUR ILI9320_REG(0x2B) 40 41#define ILI9320_GAMMA1 ILI9320_REG(0x30) 42#define ILI9320_GAMMA2 ILI9320_REG(0x31) 43#define ILI9320_GAMMA3 ILI9320_REG(0x32) 44#define ILI9320_GAMMA4 ILI9320_REG(0x35) 45#define ILI9320_GAMMA5 ILI9320_REG(0x36) 46#define ILI9320_GAMMA6 ILI9320_REG(0x37) 47#define ILI9320_GAMMA7 ILI9320_REG(0x38) 48#define ILI9320_GAMMA8 ILI9320_REG(0x39) 49#define ILI9320_GAMMA9 ILI9320_REG(0x3C) 50#define ILI9320_GAMMA10 ILI9320_REG(0x3D) 51 52#define ILI9320_HORIZ_START ILI9320_REG(0x50) 53#define ILI9320_HORIZ_END ILI9320_REG(0x51) 54#define ILI9320_VERT_START ILI9320_REG(0x52) 55#define ILI9320_VERT_END ILI9320_REG(0x53) 56 57#define ILI9320_DRIVER2 ILI9320_REG(0x60) 58#define ILI9320_BASE_IMAGE ILI9320_REG(0x61) 59#define ILI9320_VERT_SCROLL ILI9320_REG(0x6a) 60 61#define ILI9320_PARTIAL1_POSITION ILI9320_REG(0x80) 62#define ILI9320_PARTIAL1_START ILI9320_REG(0x81) 63#define ILI9320_PARTIAL1_END ILI9320_REG(0x82) 64#define ILI9320_PARTIAL2_POSITION ILI9320_REG(0x83) 65#define ILI9320_PARTIAL2_START ILI9320_REG(0x84) 66#define ILI9320_PARTIAL2_END ILI9320_REG(0x85) 67 68#define ILI9320_INTERFACE1 ILI9320_REG(0x90) 69#define ILI9320_INTERFACE2 ILI9320_REG(0x92) 70#define ILI9320_INTERFACE3 ILI9320_REG(0x93) 71#define ILI9320_INTERFACE4 ILI9320_REG(0x95) 72#define ILI9320_INTERFACE5 ILI9320_REG(0x97) 73#define ILI9320_INTERFACE6 ILI9320_REG(0x98) 74 75/* Register contents definitions. */ 76 77#define ILI9320_OSCILATION_OSC (1 << 0) 78 79#define ILI9320_DRIVER_SS (1 << 8) 80#define ILI9320_DRIVER_SM (1 << 10) 81 82#define ILI9320_DRIVEWAVE_EOR (1 << 8) 83#define ILI9320_DRIVEWAVE_BC (1 << 9) 84#define ILI9320_DRIVEWAVE_MUSTSET (1 << 10) 85 86#define ILI9320_ENTRYMODE_AM (1 << 3) 87#define ILI9320_ENTRYMODE_ID(x) ((x) << 4) 88#define ILI9320_ENTRYMODE_ORG (1 << 7) 89#define ILI9320_ENTRYMODE_HWM (1 << 8) 90#define ILI9320_ENTRYMODE_BGR (1 << 12) 91#define ILI9320_ENTRYMODE_DFM (1 << 14) 92#define ILI9320_ENTRYMODE_TRI (1 << 15) 93 94 95#define ILI9320_RESIZING_RSZ(x) ((x) << 0) 96#define ILI9320_RESIZING_RCH(x) ((x) << 4) 97#define ILI9320_RESIZING_RCV(x) ((x) << 8) 98 99 100#define ILI9320_DISPLAY1_D(x) ((x) << 0) 101#define ILI9320_DISPLAY1_CL (1 << 3) 102#define ILI9320_DISPLAY1_DTE (1 << 4) 103#define ILI9320_DISPLAY1_GON (1 << 5) 104#define ILI9320_DISPLAY1_BASEE (1 << 8) 105#define ILI9320_DISPLAY1_PTDE(x) ((x) << 12) 106 107 108#define ILI9320_DISPLAY2_BP(x) ((x) << 0) 109#define ILI9320_DISPLAY2_FP(x) ((x) << 8) 110 111 112#define ILI9320_RGBIF1_RIM_RGB18 (0 << 0) 113#define ILI9320_RGBIF1_RIM_RGB16 (1 << 0) 114#define ILI9320_RGBIF1_RIM_RGB6 (2 << 0) 115 116#define ILI9320_RGBIF1_CLK_INT (0 << 4) 117#define ILI9320_RGBIF1_CLK_RGBIF (1 << 4) 118#define ILI9320_RGBIF1_CLK_VSYNC (2 << 4) 119 120#define ILI9320_RGBIF1_RM (1 << 8) 121 122#define ILI9320_RGBIF1_ENC_FRAMES(x) (((x) - 1)<< 13) 123 124#define ILI9320_RGBIF2_DPL (1 << 0) 125#define ILI9320_RGBIF2_EPL (1 << 1) 126#define ILI9320_RGBIF2_HSPL (1 << 3) 127#define ILI9320_RGBIF2_VSPL (1 << 4) 128 129 130#define ILI9320_POWER1_SLP (1 << 1) 131#define ILI9320_POWER1_DSTB (1 << 2) 132#define ILI9320_POWER1_AP(x) ((x) << 4) 133#define ILI9320_POWER1_APE (1 << 7) 134#define ILI9320_POWER1_BT(x) ((x) << 8) 135#define ILI9320_POWER1_SAP (1 << 12) 136 137 138#define ILI9320_POWER2_VC(x) ((x) << 0) 139#define ILI9320_POWER2_DC0(x) ((x) << 4) 140#define ILI9320_POWER2_DC1(x) ((x) << 8) 141 142 143#define ILI9320_POWER3_VRH(x) ((x) << 0) 144#define ILI9320_POWER3_PON (1 << 4) 145#define ILI9320_POWER3_VCMR (1 << 8) 146 147 148#define ILI9320_POWER4_VREOUT(x) ((x) << 8) 149 150 151#define ILI9320_DRIVER2_SCNL(x) ((x) << 0) 152#define ILI9320_DRIVER2_NL(x) ((x) << 8) 153#define ILI9320_DRIVER2_GS (1 << 15) 154 155 156#define ILI9320_BASEIMAGE_REV (1 << 0) 157#define ILI9320_BASEIMAGE_VLE (1 << 1) 158#define ILI9320_BASEIMAGE_NDL (1 << 2) 159 160 161#define ILI9320_INTERFACE4_RTNE(x) (x) 162#define ILI9320_INTERFACE4_DIVE(x) ((x) << 8) 163 164/* SPI interface definitions */ 165 166#define ILI9320_SPI_IDCODE (0x70) 167#define ILI9320_SPI_ID(x) ((x) << 2) 168#define ILI9320_SPI_READ (0x01) 169#define ILI9320_SPI_WRITE (0x00) 170#define ILI9320_SPI_DATA (0x02) 171#define ILI9320_SPI_INDEX (0x00) 172 173/* platform data to pass configuration from lcd */ 174 175enum ili9320_suspend { 176 ILI9320_SUSPEND_OFF, 177 ILI9320_SUSPEND_DEEP, 178}; 179 180struct ili9320_platdata { 181 unsigned short hsize; 182 unsigned short vsize; 183 184 enum ili9320_suspend suspend; 185 186 /* set the reset line, 0 = reset asserted, 1 = normal */ 187 void (*reset)(unsigned int val); 188 189 unsigned short entry_mode; 190 unsigned short display2; 191 unsigned short display3; 192 unsigned short display4; 193 unsigned short rgb_if1; 194 unsigned short rgb_if2; 195 unsigned short interface2; 196 unsigned short interface3; 197 unsigned short interface4; 198 unsigned short interface5; 199 unsigned short interface6; 200}; 201 202