blob: c64c16067d9ecd508360861d611b1d804ad54bfc [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2008-2010, 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
14#ifndef TVENC_H
15#define TVENC_H
16
17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/time.h>
20#include <linux/init.h>
21#include <linux/interrupt.h>
22#include <linux/fb.h>
23
24#include <mach/hardware.h>
25#include <linux/io.h>
26
27#include <asm/system.h>
28#include <asm/mach-types.h>
29
30#include "msm_fb_panel.h"
31
32#define NTSC_M 0 /* North America, Korea */
33#define NTSC_J 1 /* Japan */
34#define PAL_BDGHIN 2 /* Non-argentina PAL-N */
35#define PAL_M 3 /* PAL-M */
36#define PAL_N 4 /* Argentina PAL-N */
37
38#define CLOCK_OFF 0
39#define CLOCK_ON 1
40
41/* 3.57954545 Mhz */
42#define TVENC_CTL_TV_MODE_NTSC_M_PAL60 0
43/* 3.57961149 Mhz */
44#define TVENC_CTL_TV_MODE_PAL_M BIT(0)
45/*non-Argintina = 4.3361875 Mhz */
46#define TVENC_CTL_TV_MODE_PAL_BDGHIN BIT(1)
47/*Argentina = 3.582055625 Mhz */
48#define TVENC_CTL_TV_MODE_PAL_N (BIT(1)|BIT(0))
49
50#define TVENC_CTL_ENC_EN BIT(2)
51#define TVENC_CTL_CC_EN BIT(3)
52#define TVENC_CTL_CGMS_EN BIT(4)
53#define TVENC_CTL_MACRO_EN BIT(5)
54#define TVENC_CTL_Y_FILTER_W_NOTCH BIT(6)
55#define TVENC_CTL_Y_FILTER_WO_NOTCH 0
56#define TVENC_CTL_Y_FILTER_EN BIT(7)
57#define TVENC_CTL_CR_FILTER_EN BIT(8)
58#define TVENC_CTL_CB_FILTER_EN BIT(9)
59#define TVENC_CTL_SINX_FILTER_EN BIT(10)
60#define TVENC_CTL_TEST_PATT_EN BIT(11)
61#define TVENC_CTL_OUTPUT_INV BIT(12)
62#define TVENC_CTL_PAL60_MODE BIT(13)
63#define TVENC_CTL_NTSCJ_MODE BIT(14)
64#define TVENC_CTL_S_VIDEO_EN BIT(19)
65
66
67#define TVENC_CTL_TPG_CLRBAR 0
68#define TVENC_CTL_TPG_MODRAMP BIT(15)
69#define TVENC_CTL_TPG_REDCLR BIT(16)
70#define TVENC_CTL_TPG_NTSC_CBAR (BIT(16)|BIT(15))
71#define TVENC_CTL_TPG_BLACK BIT(17)
72#define TVENC_CTL_TPG_WHITE100 (BIT(17)|BIT(15))
73#define TVENC_CTL_TPG_YELLOW75 (BIT(17)|BIT(16))
74#define TVENC_CTL_TPG_CYAN75 (BIT(17)|BIT(16)|BIT(15))
75#define TVENC_CTL_TPG_GREEN75 BIT(18)
76#define TVENC_CTL_TPG_MAGENTA75 (BIT(18)|BIT(15))
77#define TVENC_CTL_TPG_RED75 (BIT(18)|BIT(16))
78#define TVENC_CTL_TPG_BLUE75 (BIT(18)|BIT(16)|BIT(15))
79#define TVENC_CTL_TPG_WHITE75 (BIT(18)|BIT(17))
80#define TVENC_CTL_TPG_WHITE_TRSTN (BIT(18)|BIT(17)|BIT(15))
81
82#define TVENC_LOAD_DETECT_EN BIT(8)
83
84#ifdef TVENC_C
85void *tvenc_base;
86struct tvenc_platform_data *tvenc_pdata;
87#else
88extern void *tvenc_base;
89extern struct tvenc_platform_data *tvenc_pdata;
90#endif
91
92#define TV_OUT(reg, v) writel(v, tvenc_base + MSM_##reg)
93#define TV_IN(reg) readl(tvenc_base + MSM_##reg)
94
95#define MSM_TV_ENC_CTL 0x00
96#define MSM_TV_LEVEL 0x04
97#define MSM_TV_GAIN 0x08
98#define MSM_TV_OFFSET 0x0c
99#define MSM_TV_CGMS 0x10
100#define MSM_TV_SYNC_1 0x14
101#define MSM_TV_SYNC_2 0x18
102#define MSM_TV_SYNC_3 0x1c
103#define MSM_TV_SYNC_4 0x20
104#define MSM_TV_SYNC_5 0x24
105#define MSM_TV_SYNC_6 0x28
106#define MSM_TV_SYNC_7 0x2c
107#define MSM_TV_BURST_V1 0x30
108#define MSM_TV_BURST_V2 0x34
109#define MSM_TV_BURST_V3 0x38
110#define MSM_TV_BURST_V4 0x3c
111#define MSM_TV_BURST_H 0x40
112#define MSM_TV_SOL_REQ_ODD 0x44
113#define MSM_TV_SOL_REQ_EVEN 0x48
114#define MSM_TV_DAC_CTL 0x4c
115#define MSM_TV_TEST_MUX 0x50
116#define MSM_TV_TEST_MODE 0x54
117#define MSM_TV_TEST_MISR_RESET 0x58
118#define MSM_TV_TEST_EXPORT_MISR 0x5c
119#define MSM_TV_TEST_MISR_CURR_VAL 0x60
120#define MSM_TV_TEST_SOF_CFG 0x64
121#define MSM_TV_DAC_INTF 0x100
122
123#define MSM_TV_INTR_ENABLE 0x200
124#define MSM_TV_INTR_STATUS 0x204
125#define MSM_TV_INTR_CLEAR 0x208
126
127int tvenc_set_encoder_clock(boolean clock_on);
128int tvenc_set_clock(boolean clock_on);
129#endif /* TVENC_H */