1 /* Copyright (c) 2008-2009, Code Aurora Forum. All rights reserved.
2  *
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.
6  *
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.
11  */
12 
13 #ifndef TVENC_H
14 #define TVENC_H
15 
16 #include <linux/kernel.h>
17 #include <linux/sched.h>
18 #include <linux/time.h>
19 #include <linux/init.h>
20 #include <linux/interrupt.h>
21 #include <linux/fb.h>
22 
23 #include <mach/hardware.h>
24 #include <linux/io.h>
25 
26 #include <asm/system.h>
27 #include <asm/mach-types.h>
28 
29 #include "msm_fb_panel.h"
30 
31 #define NTSC_M		0 /* North America, Korea */
32 #define NTSC_J		1 /* Japan */
33 #define PAL_BDGHIN	2 /* Non-argentina PAL-N */
34 #define PAL_M		3 /* PAL-M */
35 #define PAL_N		4 /* Argentina PAL-N */
36 
37 /* 3.57954545 Mhz */
38 #define TVENC_CTL_TV_MODE_NTSC_M_PAL60  0
39 /* 3.57961149 Mhz */
40 #define TVENC_CTL_TV_MODE_PAL_M             BIT(0)
41 /*non-Argintina = 4.3361875 Mhz */
42 #define TVENC_CTL_TV_MODE_PAL_BDGHIN        BIT(1)
43 /*Argentina = 3.582055625 Mhz */
44 #define TVENC_CTL_TV_MODE_PAL_N             (BIT(1)|BIT(0))
45 
46 #define TVENC_CTL_ENC_EN                    BIT(2)
47 #define TVENC_CTL_CC_EN                     BIT(3)
48 #define TVENC_CTL_CGMS_EN                   BIT(4)
49 #define TVENC_CTL_MACRO_EN                  BIT(5)
50 #define TVENC_CTL_Y_FILTER_W_NOTCH          BIT(6)
51 #define TVENC_CTL_Y_FILTER_WO_NOTCH         0
52 #define TVENC_CTL_Y_FILTER_EN               BIT(7)
53 #define TVENC_CTL_CR_FILTER_EN              BIT(8)
54 #define TVENC_CTL_CB_FILTER_EN              BIT(9)
55 #define TVENC_CTL_SINX_FILTER_EN            BIT(10)
56 #define TVENC_CTL_TEST_PATT_EN              BIT(11)
57 #define TVENC_CTL_OUTPUT_INV                BIT(12)
58 #define TVENC_CTL_PAL60_MODE                BIT(13)
59 #define TVENC_CTL_NTSCJ_MODE                BIT(14)
60 #define TVENC_CTL_TPG_CLRBAR                0
61 #define TVENC_CTL_TPG_MODRAMP               BIT(15)
62 #define TVENC_CTL_TPG_REDCLR                BIT(16)
63 #define TVENC_CTL_S_VIDEO_EN                BIT(19)
64 
65 #ifdef TVENC_C
66 void *tvenc_base;
67 #else
68 extern void *tvenc_base;
69 #endif
70 
71 #define TV_OUT(reg, v)  writel(v, tvenc_base + MSM_##reg)
72 
73 #define MSM_TV_ENC_CTL			0x00
74 #define MSM_TV_LEVEL			0x04
75 #define MSM_TV_GAIN			0x08
76 #define MSM_TV_OFFSET			0x0c
77 #define MSM_TV_CGMS			0x10
78 #define MSM_TV_SYNC_1			0x14
79 #define MSM_TV_SYNC_2			0x18
80 #define MSM_TV_SYNC_3			0x1c
81 #define MSM_TV_SYNC_4			0x20
82 #define MSM_TV_SYNC_5			0x24
83 #define MSM_TV_SYNC_6			0x28
84 #define MSM_TV_SYNC_7			0x2c
85 #define MSM_TV_BURST_V1			0x30
86 #define MSM_TV_BURST_V2			0x34
87 #define MSM_TV_BURST_V3			0x38
88 #define MSM_TV_BURST_V4			0x3c
89 #define MSM_TV_BURST_H			0x40
90 #define MSM_TV_SOL_REQ_ODD		0x44
91 #define MSM_TV_SOL_REQ_EVEN		0x48
92 #define MSM_TV_DAC_CTL			0x4c
93 #define MSM_TV_TEST_MUX			0x50
94 #define MSM_TV_TEST_MODE		0x54
95 #define MSM_TV_TEST_MISR_RESET		0x58
96 #define MSM_TV_TEST_EXPORT_MISR		0x5c
97 #define MSM_TV_TEST_MISR_CURR_VAL	0x60
98 #define MSM_TV_TEST_SOF_CFG		0x64
99 #define MSM_TV_DAC_INTF			0x100
100 
101 #endif /* TVENC_H */
102