blob: 7ff9a66c96bf96dd3923e7658b2a3f20a8058ec9 [file] [log] [blame]
Wentao Xu97df7fd2011-01-19 15:01:17 -05001/*
Duy Truongf3ac7b32013-02-13 01:07:28 -08002 * Copyright (c) 2011, The Linux Foundation. All rights reserved.
Wentao Xu97df7fd2011-01-19 15:01:17 -05003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in
11 * the documentation and/or other materials provided with the
12 * distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
17 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
18 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
20 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
21 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
22 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
24 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
26 */
27
28#ifndef __DEV_LCDC_H
29#define __DEV_LCDC_H
30
Channagoud Kadabi43000a62012-06-28 18:23:24 +053031#include <platform/iomap.h>
32#include <msm_panel.h>
33
Wentao Xu97df7fd2011-01-19 15:01:17 -050034#define DEFAULT_LCD_TIMING 0
35
Channagoud Kadabi43000a62012-06-28 18:23:24 +053036#define MDP_DMA_P_CONFIG REG_MDP(0x90000)
37#define MDP_DMA_P_OUT_XY REG_MDP(0x90010)
38#define MDP_DMA_P_SIZE REG_MDP(0x90004)
39#define MDP_DMA_P_BUF_ADDR REG_MDP(0x90008)
40#define MDP_DMA_P_BUF_Y_STRIDE REG_MDP(0x9000C)
41#define MDP_DMA_P_OP_MODE REG_MDP(0x90070)
42
43#define MDP_LCDC_EN REG_MDP(LCDC_BASE + 0x00)
44#define MDP_LCDC_HSYNC_CTL REG_MDP(LCDC_BASE + 0x04)
45#define MDP_LCDC_VSYNC_PERIOD REG_MDP(LCDC_BASE + 0x08)
46#define MDP_LCDC_VSYNC_PULSE_WIDTH REG_MDP(LCDC_BASE + 0x0C)
47#define MDP_LCDC_DISPLAY_HCTL REG_MDP(LCDC_BASE + 0x10)
48#define MDP_LCDC_DISPLAY_V_START REG_MDP(LCDC_BASE + 0x14)
49#define MDP_LCDC_DISPLAY_V_END REG_MDP(LCDC_BASE + 0x18)
50#define MDP_LCDC_ACTIVE_HCTL REG_MDP(LCDC_BASE + 0x1C)
51#define MDP_LCDC_ACTIVE_V_START REG_MDP(LCDC_BASE + 0x20)
52#define MDP_LCDC_ACTIVE_V_END REG_MDP(LCDC_BASE + 0x24)
53#define MDP_LCDC_BORDER_CLR REG_MDP(LCDC_BASE + 0x28)
54#define MDP_LCDC_UNDERFLOW_CTL REG_MDP(LCDC_BASE + 0x2C)
55#define MDP_LCDC_HSYNC_SKEW REG_MDP(LCDC_BASE + 0x30)
56#define MDP_LCDC_TEST_CTL REG_MDP(LCDC_BASE + 0x34)
57#define MDP_LCDC_CTL_POLARITY REG_MDP(LCDC_BASE + 0x38)
58#define MDP_LCDC_TEST_COL_VAR1 REG_MDP(LCDC_BASE + 0x3C)
59#define MDP_LCDC_UNDERFLOW_HIDING_CTL REG_MDP(LCDC_BASE + 0x44)
60#define MDP_LCDC_LOST_PIXEL_CNT_VALUE REG_MDP(LCDC_BASE + 0x48)
61
62#define DMA_DSTC0G_8BITS (BIT(1)|BIT(0))
63#define DMA_DSTC1B_8BITS (BIT(3)|BIT(2))
64#define DMA_DSTC2R_8BITS (BIT(5)|BIT(4))
65#define DMA_DSTC0G_6BITS (BIT(1))
66#define DMA_DSTC1B_6BITS (BIT(3))
67#define DMA_DSTC2R_6BITS (BIT(5))
68#define DMA_DITHER_EN BIT(24)
69#define DMA_OUT_SEL_LCDC BIT(20)
70#define DMA_IBUF_FORMAT_RGB888 (0 << 25)
71#define DMA_IBUF_FORMAT_RGB565 (1 << 25)
72#define CLR_G 0x0
73#define CLR_B 0x1
74#define CLR_R 0x2
75#define DMA_PACK_ALIGN_LSB 0
76
77#define MDP_GET_PACK_PATTERN(a,x,y,z,bit) \
78 (((a)<<(bit*3))|((x)<<(bit*2))|((y)<<bit)|(z))
79#define MDP_GET_PACK_PATTERN(a, x, y, z, bit) \
80 (((a)<<(bit*3))|((x)<<(bit*2))|((y)<<bit)|(z))
81#define DMA_PACK_PATTERN_RGB \
82 (MDP_GET_PACK_PATTERN(0, CLR_R, CLR_G, CLR_B, 2)<<8)
83#define MDP_RGB_888_FORMAT \
84 (BIT(17) | (1<<14) | (2<<9) | \
85 (0<<8) | (0<<6) | (3<<4) | \
86 (3<<2) | (3<<0))
87#define MDP_RGB_565_FORMAT \
88 (BIT(17) | (1<<14) | (1<<9) | \
89 (0<<8) | (0<<6) | (1<<4) | \
90 (1<<2) | (2<<0))
91
92
Wentao Xu97df7fd2011-01-19 15:01:17 -050093/* used for setting custom timing parameters for different panels */
94struct lcdc_timing_parameters
95{
96 unsigned lcdc_fb_width;
97 unsigned lcdc_fb_height;
98
99 unsigned lcdc_hsync_pulse_width_dclk;
100 unsigned lcdc_hsync_back_porch_dclk;
101 unsigned lcdc_hsync_front_porch_dclk;
102 unsigned lcdc_hsync_skew_dclk;
103
104 unsigned lcdc_vsync_pulse_width_lines;
105 unsigned lcdc_vsync_back_porch_lines;
106 unsigned lcdc_vsync_front_porch_lines;
107};
108
109#endif /* __DEV_LCDC_H */