blob: aa1c4477722d249a80658ab88f18b6a7713b60e0 [file] [log] [blame]
Hans Verkuil54450f52012-07-18 05:45:16 -03001/*
2 * adv7604 - Analog Devices ADV7604 video decoder driver
3 *
4 * Copyright 2012 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
5 *
6 * This program is free software; you may redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
11 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
12 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
13 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
14 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
15 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
16 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17 * SOFTWARE.
18 *
19 */
20
21#ifndef _ADV7604_
22#define _ADV7604_
23
Lars-Peter Clausene5e749d2013-11-21 11:23:45 -030024#include <linux/types.h>
25
Hans Verkuil54450f52012-07-18 05:45:16 -030026/* Analog input muxing modes (AFE register 0x02, [2:0]) */
27enum adv7604_ain_sel {
28 ADV7604_AIN1_2_3_NC_SYNC_1_2 = 0,
29 ADV7604_AIN4_5_6_NC_SYNC_2_1 = 1,
30 ADV7604_AIN7_8_9_NC_SYNC_3_1 = 2,
31 ADV7604_AIN10_11_12_NC_SYNC_4_1 = 3,
32 ADV7604_AIN9_4_5_6_SYNC_2_1 = 4,
33};
34
Laurent Pinchart539b33b2014-01-26 18:42:37 -030035/*
36 * Bus rotation and reordering. This is used to specify component reordering on
37 * the board and describes the components order on the bus when the ADV7604
38 * outputs RGB.
39 */
40enum adv7604_bus_order {
41 ADV7604_BUS_ORDER_RGB, /* No operation */
42 ADV7604_BUS_ORDER_GRB, /* Swap 1-2 */
43 ADV7604_BUS_ORDER_RBG, /* Swap 2-3 */
44 ADV7604_BUS_ORDER_BGR, /* Swap 1-3 */
45 ADV7604_BUS_ORDER_BRG, /* Rotate right */
46 ADV7604_BUS_ORDER_GBR, /* Rotate left */
Hans Verkuil54450f52012-07-18 05:45:16 -030047};
48
Hans Verkuil54450f52012-07-18 05:45:16 -030049/* Input Color Space (IO register 0x02, [7:4]) */
50enum adv7604_inp_color_space {
51 ADV7604_INP_COLOR_SPACE_LIM_RGB = 0,
52 ADV7604_INP_COLOR_SPACE_FULL_RGB = 1,
53 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_601 = 2,
54 ADV7604_INP_COLOR_SPACE_LIM_YCbCr_709 = 3,
55 ADV7604_INP_COLOR_SPACE_XVYCC_601 = 4,
56 ADV7604_INP_COLOR_SPACE_XVYCC_709 = 5,
57 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_601 = 6,
58 ADV7604_INP_COLOR_SPACE_FULL_YCbCr_709 = 7,
59 ADV7604_INP_COLOR_SPACE_AUTO = 0xf,
60};
61
Laurent Pinchart539b33b2014-01-26 18:42:37 -030062/* Select output format (IO register 0x03, [4:2]) */
63enum adv7604_op_format_mode_sel {
64 ADV7604_OP_FORMAT_MODE0 = 0x00,
65 ADV7604_OP_FORMAT_MODE1 = 0x04,
66 ADV7604_OP_FORMAT_MODE2 = 0x08,
Hans Verkuil54450f52012-07-18 05:45:16 -030067};
68
Mikhail Khelikf31b62e2013-12-20 05:12:00 -030069enum adv7604_drive_strength {
70 ADV7604_DR_STR_MEDIUM_LOW = 1,
71 ADV7604_DR_STR_MEDIUM_HIGH = 2,
72 ADV7604_DR_STR_HIGH = 3,
73};
74
Lars-Peter Clausend42010a2013-11-25 15:45:07 -030075enum adv7604_int1_config {
76 ADV7604_INT1_CONFIG_OPEN_DRAIN,
77 ADV7604_INT1_CONFIG_ACTIVE_LOW,
78 ADV7604_INT1_CONFIG_ACTIVE_HIGH,
79 ADV7604_INT1_CONFIG_DISABLED,
80};
81
Laurent Pinchart05cacb12014-01-30 16:32:21 -030082enum adv7604_page {
83 ADV7604_PAGE_IO,
84 ADV7604_PAGE_AVLINK,
85 ADV7604_PAGE_CEC,
86 ADV7604_PAGE_INFOFRAME,
87 ADV7604_PAGE_ESDP,
88 ADV7604_PAGE_DPP,
89 ADV7604_PAGE_AFE,
90 ADV7604_PAGE_REP,
91 ADV7604_PAGE_EDID,
92 ADV7604_PAGE_HDMI,
93 ADV7604_PAGE_TEST,
94 ADV7604_PAGE_CP,
95 ADV7604_PAGE_VDP,
96 ADV7604_PAGE_MAX,
97};
98
Hans Verkuil54450f52012-07-18 05:45:16 -030099/* Platform dependent definition */
100struct adv7604_platform_data {
Hans Verkuil54450f52012-07-18 05:45:16 -0300101 /* DIS_PWRDNB: 1 if the PWRDNB pin is unused and unconnected */
102 unsigned disable_pwrdnb:1;
103
104 /* DIS_CABLE_DET_RST: 1 if the 5V pins are unused and unconnected */
105 unsigned disable_cable_det_rst:1;
106
Laurent Pinchart5ef54b52014-01-31 10:57:27 -0300107 int default_input;
108
Hans Verkuil54450f52012-07-18 05:45:16 -0300109 /* Analog input muxing mode */
110 enum adv7604_ain_sel ain_sel;
111
112 /* Bus rotation and reordering */
Laurent Pinchart539b33b2014-01-26 18:42:37 -0300113 enum adv7604_bus_order bus_order;
Hans Verkuil54450f52012-07-18 05:45:16 -0300114
Laurent Pinchart539b33b2014-01-26 18:42:37 -0300115 /* Select output format mode */
116 enum adv7604_op_format_mode_sel op_format_mode_sel;
Hans Verkuil54450f52012-07-18 05:45:16 -0300117
Lars-Peter Clausend42010a2013-11-25 15:45:07 -0300118 /* Configuration of the INT1 pin */
119 enum adv7604_int1_config int1_config;
120
Hans Verkuil54450f52012-07-18 05:45:16 -0300121 /* IO register 0x02 */
122 unsigned alt_gamma:1;
123 unsigned op_656_range:1;
Hans Verkuil54450f52012-07-18 05:45:16 -0300124 unsigned alt_data_sat:1;
125
126 /* IO register 0x05 */
127 unsigned blank_data:1;
128 unsigned insert_av_codes:1;
129 unsigned replicate_av_codes:1;
Hans Verkuil54450f52012-07-18 05:45:16 -0300130
Martin Bugge98908692013-12-20 05:14:57 -0300131 /* IO register 0x06 */
132 unsigned inv_vs_pol:1;
133 unsigned inv_hs_pol:1;
Laurent Pinchart1b5ab872014-02-04 19:57:56 -0300134 unsigned inv_llc_pol:1;
Martin Bugge98908692013-12-20 05:14:57 -0300135
Mikhail Khelikf31b62e2013-12-20 05:12:00 -0300136 /* IO register 0x14 */
137 enum adv7604_drive_strength dr_str_data;
138 enum adv7604_drive_strength dr_str_clk;
139 enum adv7604_drive_strength dr_str_sync;
140
Hans Verkuil54450f52012-07-18 05:45:16 -0300141 /* IO register 0x30 */
142 unsigned output_bus_lsb_to_msb:1;
143
144 /* Free run */
145 unsigned hdmi_free_run_mode;
146
147 /* i2c addresses: 0 == use default */
Laurent Pinchart05cacb12014-01-30 16:32:21 -0300148 u8 i2c_addresses[ADV7604_PAGE_MAX];
Hans Verkuil54450f52012-07-18 05:45:16 -0300149};
150
Laurent Pinchartc784b1e2014-01-29 10:08:58 -0300151enum adv7604_pad {
152 ADV7604_PAD_HDMI_PORT_A = 0,
153 ADV7604_PAD_HDMI_PORT_B = 1,
154 ADV7604_PAD_HDMI_PORT_C = 2,
155 ADV7604_PAD_HDMI_PORT_D = 3,
156 ADV7604_PAD_VGA_RGB = 4,
157 ADV7604_PAD_VGA_COMP = 5,
158 /* The source pad is either 1 (ADV7611) or 6 (ADV7604) */
159 ADV7604_PAD_SOURCE = 6,
160 ADV7611_PAD_SOURCE = 1,
161 ADV7604_PAD_MAX = 7,
Hans Verkuil6b0d5d32012-10-16 06:40:45 -0300162};
163
Hans Verkuil54450f52012-07-18 05:45:16 -0300164#define V4L2_CID_ADV_RX_ANALOG_SAMPLING_PHASE (V4L2_CID_DV_CLASS_BASE + 0x1000)
165#define V4L2_CID_ADV_RX_FREE_RUN_COLOR_MANUAL (V4L2_CID_DV_CLASS_BASE + 0x1001)
166#define V4L2_CID_ADV_RX_FREE_RUN_COLOR (V4L2_CID_DV_CLASS_BASE + 0x1002)
167
168/* notify events */
169#define ADV7604_HOTPLUG 1
170#define ADV7604_FMT_CHANGE 2
171
172#endif