Zohaib Alam | b7b677f | 2014-10-24 15:54:42 -0400 | [diff] [blame] | 1 | /* Copyright (c) 2014, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * Redistribution and use in source and binary forms, with or without |
| 4 | * modification, are permitted provided that the following conditions |
| 5 | * are met: |
| 6 | * * Redistributions of source code must retain the above copyright |
| 7 | * notice, this list of conditions and the following disclaimer. |
| 8 | * * Redistributions in binary form must reproduce the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer in |
| 10 | * the documentation and/or other materials provided with the |
| 11 | * distribution. |
| 12 | * * Neither the name of The Linux Foundation nor the names of its |
| 13 | * contributors may be used to endorse or promote products derived |
| 14 | * from this software without specific prior written permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 19 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 20 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 22 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 23 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 24 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 26 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | * SUCH DAMAGE. |
| 28 | */ |
| 29 | |
| 30 | #ifndef MDSS_QPIC_PANEL_H |
| 31 | #define MDSS_QPIC_PANEL_H |
| 32 | |
| 33 | #define LCDC_INTERNAL_BUFFER_SIZE 30 |
| 34 | |
| 35 | /* Macros for coding MIPI commands */ |
| 36 | #define INV_SIZE 0xFFFF |
| 37 | /* Size of argument to MIPI command is variable */ |
| 38 | #define OP_SIZE_PAIR(op, size) ((op << 16) | size) |
| 39 | /* MIPI {command, argument size} tuple */ |
| 40 | #define LCDC_EXTRACT_OP_SIZE(op_identifier) ((op_identifier & 0xFFFF)) |
| 41 | /* extract size from command identifier */ |
| 42 | #define LCDC_EXTRACT_OP_CMD(op_identifier) (((op_identifier >> 16) & 0xFFFF)) |
| 43 | /* extract command id from command identifier */ |
| 44 | |
| 45 | /* MIPI standard efinitions */ |
| 46 | #define LCDC_ADDRESS_MODE_ORDER_BOTTOM_TO_TOP 0x80 |
| 47 | #define LCDC_ADDRESS_MODE_ORDER_RIGHT_TO_LEFT 0x40 |
| 48 | #define LCDC_ADDRESS_MODE_ORDER_REVERSE 0x20 |
| 49 | #define LCDC_ADDRESS_MODE_ORDER_REFRESH_BOTTOM_TO_TOP 0x10 |
| 50 | #define LCDC_ADDRESS_MODE_ORDER_BGER_RGB 0x08 |
| 51 | #define LCDC_ADDRESS_MODE_ORDER_REFERESH_RIGHT_TO_LEFT 0x04 |
| 52 | #define LCDC_ADDRESS_MODE_FLIP_HORIZONTAL 0x02 |
| 53 | #define LCDC_ADDRESS_MODE_FLIP_VERTICAL 0x01 |
| 54 | |
| 55 | #define LCDC_PIXEL_FORMAT_3_BITS_PER_PIXEL 0x1 |
| 56 | #define LCDC_PIXEL_FORMAT_8_BITS_PER_PIXEL 0x2 |
| 57 | #define LCDC_PIXEL_FORMAT_12_BITS_PER_PIXEL 0x3 |
| 58 | #define LCDC_PIXEL_FORMAT_16_BITS_PER_PIXEL 0x5 |
| 59 | #define LCDC_PIXEL_FORMAT_18_BITS_PER_PIXEL 0x6 |
| 60 | #define LCDC_PIXEL_FORMAT_24_BITS_PER_PIXEL 0x7 |
| 61 | |
| 62 | #define LCDC_CREATE_PIXEL_FORMAT(dpi_format, dbi_format) \ |
| 63 | (dpi_format | (dpi_format << 4)) |
| 64 | |
| 65 | #define POWER_MODE_IDLE_ON 0x40 |
| 66 | #define POWER_MODE_PARTIAL_ON 0x20 |
| 67 | #define POWER_MODE_SLEEP_ON 0x10 |
| 68 | #define POWER_MODE_NORMAL_ON 0x08 |
| 69 | #define POWER_MODE_DISPLAY_ON 0x04 |
| 70 | |
| 71 | #define LCDC_DISPLAY_MODE_SCROLLING_ON 0x80 |
| 72 | #define LCDC_DISPLAY_MODE_INVERSION_ON 0x20 |
| 73 | #define LCDC_DISPLAY_MODE_GAMMA_MASK 0x07 |
| 74 | |
| 75 | /* LDCc MIPI Type B supported commands */ |
| 76 | #define OP_ENTER_IDLE_MODE 0x39 |
| 77 | #define OP_ENTER_INVERT_MODE 0x21 |
| 78 | #define OP_ENTER_NORMAL_MODE 0x13 |
| 79 | #define OP_ENTER_PARTIAL_MODE 0x12 |
| 80 | #define OP_ENTER_SLEEP_MODE 0x10 |
| 81 | #define OP_EXIT_INVERT_MODE 0x20 |
| 82 | #define OP_EXIT_SLEEP_MODE 0x11 |
| 83 | #define OP_EXIT_IDLE_MODE 0x38 |
| 84 | #define OP_GET_ADDRESS_MODE 0x0B /* size 1 */ |
| 85 | #define OP_GET_BLUE_CHANNEL 0x08 /* size 1 */ |
| 86 | #define OP_GET_DIAGNOSTIC 0x0F /* size 2 */ |
| 87 | #define OP_GET_DISPLAY_MODE 0x0D /* size 1 */ |
| 88 | #define OP_GET_GREEN_CHANNEL 0x07 /* size 1 */ |
| 89 | #define OP_GET_PIXEL_FORMAT 0x0C /* size 1 */ |
| 90 | #define OP_GET_POWER_MODE 0x0A /* size 1 */ |
| 91 | #define OP_GET_RED_CHANNEL 0x06 /* size 1 */ |
| 92 | #define OP_GET_SCANLINE 0x45 /* size 1 */ |
| 93 | #define OP_GET_SIGNAL_MODE 0x0E /* size 1 */ |
| 94 | #define OP_NOP 0x00 |
| 95 | #define OP_READ_DDB_CONTINUE 0xA8 /* size not fixed */ |
| 96 | #define OP_READ_DDB_START 0xA1 /* size not fixed */ |
| 97 | #define OP_READ_MEMORY_CONTINUE 0x3E /* size not fixed */ |
| 98 | #define OP_READ_MEMORY_START 0x2E /* size not fixed */ |
| 99 | #define OP_SET_ADDRESS_MODE 0x36 /* size 1 */ |
| 100 | #define OP_SET_COLUMN_ADDRESS 0x2A /* size 4 */ |
| 101 | #define OP_SET_DISPLAY_OFF 0x28 |
| 102 | #define OP_SET_DISPLAY_ON 0x29 |
| 103 | #define OP_SET_GAMMA_CURVE 0x26 /* size 1 */ |
| 104 | #define OP_SET_PAGE_ADDRESS 0x2B /* size 4 */ |
| 105 | #define OP_SET_PARTIAL_COLUMNS 0x31 /* size 4 */ |
| 106 | #define OP_SET_PARTIAL_ROWS 0x30 /* size 4 */ |
| 107 | #define OP_SET_PIXEL_FORMAT 0x3A /* size 1 */ |
| 108 | #define OP_SOFT_RESET 0x01 |
| 109 | #define OP_WRITE_MEMORY_CONTINUE 0x3C /* size not fixed */ |
| 110 | #define OP_WRITE_MEMORY_START 0x2C /* size not fixed */ |
| 111 | |
Zohaib Alam | f5f1779 | 2014-10-24 15:58:22 -0400 | [diff] [blame] | 112 | /* ILI9341 commands */ |
| 113 | #define OP_ILI9341_INTERFACE_CONTROL 0xf6 |
| 114 | #define OP_ILI9341_TEARING_EFFECT_LINE_ON 0x35 |
| 115 | |
Zohaib Alam | b7b677f | 2014-10-24 15:54:42 -0400 | [diff] [blame] | 116 | struct qpic_panel_io_desc { |
| 117 | int rst_gpio; |
| 118 | int cs_gpio; |
| 119 | int ad8_gpio; |
| 120 | int te_gpio; |
| 121 | int bl_gpio; |
| 122 | int vdd_vreg; |
| 123 | int avdd_vreg; |
| 124 | uint32_t init; |
| 125 | }; |
| 126 | |
| 127 | int mdss_qpic_panel_io_init(struct qpic_panel_io_desc *qpic_panel_io); |
| 128 | uint32_t qpic_panel_get_cmd(uint32_t command, uint32_t size); |
Zohaib Alam | f5f1779 | 2014-10-24 15:58:22 -0400 | [diff] [blame] | 129 | int ili9341_on(struct qpic_panel_io_desc *qpic_panel_io); |
| 130 | void ili9341_off(struct qpic_panel_io_desc *qpic_panel_io); |
Zohaib Alam | b7b677f | 2014-10-24 15:54:42 -0400 | [diff] [blame] | 131 | |
| 132 | #endif /* MDSS_QPIC_PANEL_H */ |