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_H |
| 31 | #define MDSS_QPIC_H |
| 32 | |
Sridhar Parasuram | c9abcdd | 2014-12-29 13:43:28 -0800 | [diff] [blame] | 33 | #include <msm_panel.h> |
Zohaib Alam | b7b677f | 2014-10-24 15:54:42 -0400 | [diff] [blame] | 34 | #include "qpic_panel.h" |
| 35 | |
| 36 | #define QPIC_REG_QPIC_LCDC_CTRL 0x22000 |
| 37 | #define QPIC_REG_LCDC_VERSION 0x22004 |
| 38 | #define QPIC_REG_QPIC_LCDC_IRQ_EN 0x22008 |
| 39 | #define QPIC_REG_QPIC_LCDC_IRQ_STTS 0x2200C |
| 40 | #define QPIC_REG_QPIC_LCDC_IRQ_CLR 0x22010 |
| 41 | #define QPIC_REG_QPIC_LCDC_STTS 0x22014 |
| 42 | #define QPIC_REG_QPIC_LCDC_CMD_DATA_CYCLE_CNT 0x22018 |
| 43 | #define QPIC_REG_QPIC_LCDC_CFG0 0x22020 |
| 44 | #define QPIC_REG_QPIC_LCDC_CFG1 0x22024 |
| 45 | #define QPIC_REG_QPIC_LCDC_CFG2 0x22028 |
| 46 | #define QPIC_REG_QPIC_LCDC_RESET 0x2202C |
| 47 | #define QPIC_REG_QPIC_LCDC_FIFO_SOF 0x22100 |
| 48 | #define QPIC_REG_LCD_DEVICE_CMD0 0x23000 |
| 49 | #define QPIC_REG_QPIC_LCDC_FIFO_DATA_PORT0 0x22140 |
| 50 | #define QPIC_REG_QPIC_LCDC_FIFO_EOF 0x22180 |
| 51 | |
| 52 | #define QPIC_OUTP(off, data) \ |
| 53 | writel((data), qpic_res->qpic_base + (off)) |
| 54 | #define QPIC_OUTPW(off, data) \ |
| 55 | writehw((data), qpic_res->qpic_base + (off)) |
| 56 | #define QPIC_INP(off) \ |
| 57 | readl(qpic_res->qpic_base + (off)) |
| 58 | |
| 59 | #define QPIC_MAX_VSYNC_WAIT_TIME 500 |
| 60 | #define QPIC_MAX_WAIT_CNT 1000 |
| 61 | #define QPIC_MAX_CMD_BUF_SIZE 512 |
| 62 | |
| 63 | int mdss_qpic_init(void); |
| 64 | int qpic_send_pkt(uint32_t cmd, uint8_t *param, uint32_t len); |
| 65 | uint32_t qpic_read_data(uint32_t cmd_index, uint32_t size); |
| 66 | int mdss_qpic_panel_on(struct qpic_panel_io_desc *panel_io); |
| 67 | int mdss_qpic_panel_off(struct qpic_panel_io_desc *panel_io); |
Sridhar Parasuram | c9abcdd | 2014-12-29 13:43:28 -0800 | [diff] [blame] | 68 | void qpic_init(struct msm_panel_info *pinfo, int base); |
| 69 | int qpic_on(void); |
| 70 | int qpic_off(void); |
| 71 | void qpic_update(void); |
Zohaib Alam | b7b677f | 2014-10-24 15:54:42 -0400 | [diff] [blame] | 72 | |
| 73 | struct qpic_data_type { |
| 74 | uint32_t rev; |
| 75 | size_t qpic_reg_size; |
| 76 | uint32_t qpic_phys; |
| 77 | uint32_t qpic_base; |
| 78 | uint32_t irq; |
| 79 | uint32_t irq_ena; |
| 80 | uint32_t res_init; |
| 81 | void *fb_virt; |
| 82 | uint32_t fb_phys; |
| 83 | void *cmd_buf_virt; |
| 84 | uint32_t cmd_buf_phys; |
| 85 | int qpic_endpt; |
| 86 | uint32_t sps_init; |
| 87 | uint32_t irq_requested; |
| 88 | struct qpic_panel_io_desc panel_io; |
| 89 | uint32_t bus_handle; |
| 90 | int fifo_eof_comp; |
| 91 | int fb_xres; |
| 92 | int fb_yres; |
| 93 | int fb_bpp; |
| 94 | int base; |
| 95 | }; |
| 96 | |
| 97 | uint32_t qpic_send_frame( |
| 98 | uint32_t x_start, |
| 99 | uint32_t y_start, |
| 100 | uint32_t x_end, |
| 101 | uint32_t y_end, |
| 102 | uint32_t *data, |
| 103 | uint32_t total_bytes); |
| 104 | |
| 105 | #endif /* MDSS_QPIC_H */ |