1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17 #include <linux/module.h>
18 #include <linux/kernel.h>
19 #include <linux/sched.h>
20 #include <linux/time.h>
21 #include <linux/init.h>
22 #include <linux/interrupt.h>
23 #include <linux/spinlock.h>
24 #include <linux/delay.h>
25 #include <mach/hardware.h>
28 #include <asm/system.h>
29 #include <asm/mach-types.h>
30 #include <linux/semaphore.h>
31 #include <linux/uaccess.h>
32 #include <linux/clk.h>
37 #ifdef CONFIG_FB_MSM_TVOUT_PAL_M
38 #define PAL_TV_DIMENSION_WIDTH 720
39 #define PAL_TV_DIMENSION_HEIGHT 480
41 #define PAL_TV_DIMENSION_WIDTH 720
42 #define PAL_TV_DIMENSION_HEIGHT 576
45 static int pal_on(struct platform_device
*pdev
)
49 struct msm_fb_data_type
*mfd
;
51 mfd
= platform_get_drvdata(pdev
);
56 if (mfd
->key
!= MFD_KEY
)
59 TV_OUT(TV_ENC_CTL
, 0); /* disable TV encoder */
61 switch (mfd
->panel
.id
) {
63 /* Cr gain 11, Cb gain C6, y_gain 97 */
64 TV_OUT(TV_GAIN
, 0x0088c1a0);
65 TV_OUT(TV_CGMS
, 0x00012345);
66 TV_OUT(TV_TEST_MUX
, 0x0);
68 TV_OUT(TV_SYNC_1
, 0x00180097);
69 TV_OUT(TV_SYNC_2
, 0x011f06c0);
70 TV_OUT(TV_SYNC_3
, 0x0005000a);
71 TV_OUT(TV_SYNC_4
, 0x00320271);
72 TV_OUT(TV_SYNC_5
, 0x005602f9);
73 TV_OUT(TV_SYNC_6
, 0x0005000a);
74 TV_OUT(TV_SYNC_7
, 0x0000000f);
75 TV_OUT(TV_BURST_V1
, 0x0012026e);
76 TV_OUT(TV_BURST_V2
, 0x0011026d);
77 TV_OUT(TV_BURST_V3
, 0x00100270);
78 TV_OUT(TV_BURST_V4
, 0x0013026f);
79 TV_OUT(TV_BURST_H
, 0x00af00ea);
80 TV_OUT(TV_SOL_REQ_ODD
, 0x0030026e);
81 TV_OUT(TV_SOL_REQ_EVEN
, 0x0031026f);
83 reg
|= TVENC_CTL_TV_MODE_PAL_BDGHIN
;
86 /* Cr gain 11, Cb gain C6, y_gain 97 */
87 TV_OUT(TV_GAIN
, 0x0081b697);
88 TV_OUT(TV_CGMS
, 0x000af317);
89 TV_OUT(TV_TEST_MUX
, 0x000001c3);
90 TV_OUT(TV_TEST_MODE
, 0x00000002);
92 TV_OUT(TV_SYNC_1
, 0x0020009e);
93 TV_OUT(TV_SYNC_2
, 0x011306b4);
94 TV_OUT(TV_SYNC_3
, 0x0006000c);
95 TV_OUT(TV_SYNC_4
, 0x0028020D);
96 TV_OUT(TV_SYNC_5
, 0x005e02fb);
97 TV_OUT(TV_SYNC_6
, 0x0006000c);
98 TV_OUT(TV_SYNC_7
, 0x00000012);
99 TV_OUT(TV_BURST_V1
, 0x0012020b);
100 TV_OUT(TV_BURST_V2
, 0x0016020c);
101 TV_OUT(TV_BURST_V3
, 0x00150209);
102 TV_OUT(TV_BURST_V4
, 0x0013020c);
103 TV_OUT(TV_BURST_H
, 0x00bf010b);
104 TV_OUT(TV_SOL_REQ_ODD
, 0x00280208);
105 TV_OUT(TV_SOL_REQ_EVEN
, 0x00290209);
107 reg
|= TVENC_CTL_TV_MODE_PAL_M
;
110 /* Cr gain 11, Cb gain C6, y_gain 97 */
111 TV_OUT(TV_GAIN
, 0x0081b697);
112 TV_OUT(TV_CGMS
, 0x000af317);
113 TV_OUT(TV_TEST_MUX
, 0x000001c3);
114 TV_OUT(TV_TEST_MODE
, 0x00000002);
116 TV_OUT(TV_SYNC_1
, 0x00180097);
117 TV_OUT(TV_SYNC_2
, 0x12006c0);
118 TV_OUT(TV_SYNC_3
, 0x0005000a);
119 TV_OUT(TV_SYNC_4
, 0x00320271);
120 TV_OUT(TV_SYNC_5
, 0x005602f9);
121 TV_OUT(TV_SYNC_6
, 0x0005000a);
122 TV_OUT(TV_SYNC_7
, 0x0000000f);
123 TV_OUT(TV_BURST_V1
, 0x0012026e);
124 TV_OUT(TV_BURST_V2
, 0x0011026d);
125 TV_OUT(TV_BURST_V3
, 0x00100270);
126 TV_OUT(TV_BURST_V4
, 0x0013026f);
127 TV_OUT(TV_BURST_H
, 0x00af00fa);
128 TV_OUT(TV_SOL_REQ_ODD
, 0x0030026e);
129 TV_OUT(TV_SOL_REQ_EVEN
, 0x0031026f);
131 reg
|= TVENC_CTL_TV_MODE_PAL_N
;
138 reg
|= TVENC_CTL_Y_FILTER_EN
|
139 TVENC_CTL_CR_FILTER_EN
|
140 TVENC_CTL_CB_FILTER_EN
| TVENC_CTL_SINX_FILTER_EN
;
141 #ifdef CONFIG_FB_MSM_TVOUT_SVIDEO
142 reg
|= TVENC_CTL_S_VIDEO_EN
;
145 TV_OUT(TV_LEVEL
, 0x00000000); /* DC offset to 0. */
146 TV_OUT(TV_OFFSET
, 0x008080f0);
148 #ifdef CONFIG_FB_MSM_MDP31
149 TV_OUT(TV_DAC_INTF
, 0x29);
151 TV_OUT(TV_ENC_CTL
, reg
);
153 reg
|= TVENC_CTL_ENC_EN
;
154 TV_OUT(TV_ENC_CTL
, reg
);
159 static int pal_off(struct platform_device
*pdev
)
161 TV_OUT(TV_ENC_CTL
, 0); /* disable TV encoder */
165 static int __init
pal_probe(struct platform_device
*pdev
)
167 msm_fb_add_device(pdev
);
172 static struct platform_driver this_driver
= {
179 static struct msm_fb_panel_data pal_panel_data
= {
180 .panel_info
.xres
= PAL_TV_DIMENSION_WIDTH
,
181 .panel_info
.yres
= PAL_TV_DIMENSION_HEIGHT
,
182 .panel_info
.type
= TV_PANEL
,
183 .panel_info
.pdest
= DISPLAY_1
,
184 .panel_info
.wait_cycle
= 0,
185 .panel_info
.bpp
= 16,
186 .panel_info
.fb_num
= 2,
191 static struct platform_device this_device
= {
195 .platform_data
= &pal_panel_data
,
199 static int __init
pal_init(void)
203 ret
= platform_driver_register(&this_driver
);
205 ret
= platform_device_register(&this_device
);
207 platform_driver_unregister(&this_driver
);
213 module_init(pal_init
);