diff options
Diffstat (limited to 'arch/arm/mach-davinci/pdata-quirks.c')
-rw-r--r-- | arch/arm/mach-davinci/pdata-quirks.c | 178 |
1 files changed, 177 insertions, 1 deletions
diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c index 5b57da475065..329f5402ad1d 100644 --- a/arch/arm/mach-davinci/pdata-quirks.c +++ b/arch/arm/mach-davinci/pdata-quirks.c | |||
@@ -10,26 +10,202 @@ | |||
10 | #include <linux/kernel.h> | 10 | #include <linux/kernel.h> |
11 | #include <linux/of_platform.h> | 11 | #include <linux/of_platform.h> |
12 | 12 | ||
13 | #include <media/i2c/tvp514x.h> | ||
14 | #include <media/i2c/adv7343.h> | ||
15 | |||
13 | #include <mach/common.h> | 16 | #include <mach/common.h> |
17 | #include <mach/da8xx.h> | ||
14 | 18 | ||
15 | struct pdata_init { | 19 | struct pdata_init { |
16 | const char *compatible; | 20 | const char *compatible; |
17 | void (*fn)(void); | 21 | void (*fn)(void); |
18 | }; | 22 | }; |
19 | 23 | ||
24 | #define TVP5147_CH0 "tvp514x-0" | ||
25 | #define TVP5147_CH1 "tvp514x-1" | ||
26 | |||
27 | /* VPIF capture configuration */ | ||
28 | static struct tvp514x_platform_data tvp5146_pdata = { | ||
29 | .clk_polarity = 0, | ||
30 | .hs_polarity = 1, | ||
31 | .vs_polarity = 1, | ||
32 | }; | ||
33 | |||
34 | #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL) | ||
35 | |||
36 | static const struct vpif_input da850_ch0_inputs[] = { | ||
37 | { | ||
38 | .input = { | ||
39 | .index = 0, | ||
40 | .name = "Composite", | ||
41 | .type = V4L2_INPUT_TYPE_CAMERA, | ||
42 | .capabilities = V4L2_IN_CAP_STD, | ||
43 | .std = TVP514X_STD_ALL, | ||
44 | }, | ||
45 | .input_route = INPUT_CVBS_VI2B, | ||
46 | .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, | ||
47 | .subdev_name = TVP5147_CH0, | ||
48 | }, | ||
49 | }; | ||
50 | |||
51 | static const struct vpif_input da850_ch1_inputs[] = { | ||
52 | { | ||
53 | .input = { | ||
54 | .index = 0, | ||
55 | .name = "S-Video", | ||
56 | .type = V4L2_INPUT_TYPE_CAMERA, | ||
57 | .capabilities = V4L2_IN_CAP_STD, | ||
58 | .std = TVP514X_STD_ALL, | ||
59 | }, | ||
60 | .input_route = INPUT_SVIDEO_VI2C_VI1C, | ||
61 | .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC, | ||
62 | .subdev_name = TVP5147_CH1, | ||
63 | }, | ||
64 | }; | ||
65 | |||
66 | static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = { | ||
67 | { | ||
68 | .name = TVP5147_CH0, | ||
69 | .board_info = { | ||
70 | I2C_BOARD_INFO("tvp5146", 0x5d), | ||
71 | .platform_data = &tvp5146_pdata, | ||
72 | }, | ||
73 | }, | ||
74 | { | ||
75 | .name = TVP5147_CH1, | ||
76 | .board_info = { | ||
77 | I2C_BOARD_INFO("tvp5146", 0x5c), | ||
78 | .platform_data = &tvp5146_pdata, | ||
79 | }, | ||
80 | }, | ||
81 | }; | ||
82 | |||
83 | static struct vpif_capture_config da850_vpif_capture_config = { | ||
84 | .subdev_info = da850_vpif_capture_sdev_info, | ||
85 | .subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info), | ||
86 | .chan_config[0] = { | ||
87 | .inputs = da850_ch0_inputs, | ||
88 | .input_count = ARRAY_SIZE(da850_ch0_inputs), | ||
89 | .vpif_if = { | ||
90 | .if_type = VPIF_IF_BT656, | ||
91 | .hd_pol = 1, | ||
92 | .vd_pol = 1, | ||
93 | .fid_pol = 0, | ||
94 | }, | ||
95 | }, | ||
96 | .chan_config[1] = { | ||
97 | .inputs = da850_ch1_inputs, | ||
98 | .input_count = ARRAY_SIZE(da850_ch1_inputs), | ||
99 | .vpif_if = { | ||
100 | .if_type = VPIF_IF_BT656, | ||
101 | .hd_pol = 1, | ||
102 | .vd_pol = 1, | ||
103 | .fid_pol = 0, | ||
104 | }, | ||
105 | }, | ||
106 | .card_name = "DA850/OMAP-L138 Video Capture", | ||
107 | }; | ||
108 | |||
109 | static void __init da850_vpif_legacy_register_capture(void) | ||
110 | { | ||
111 | int ret; | ||
112 | |||
113 | ret = da850_register_vpif_capture(&da850_vpif_capture_config); | ||
114 | if (ret) | ||
115 | pr_warn("%s: VPIF capture setup failed: %d\n", | ||
116 | __func__, ret); | ||
117 | } | ||
118 | |||
119 | static void __init da850_vpif_capture_legacy_init_lcdk(void) | ||
120 | { | ||
121 | da850_vpif_capture_config.subdev_count = 1; | ||
122 | da850_vpif_legacy_register_capture(); | ||
123 | } | ||
124 | |||
125 | static void __init da850_vpif_capture_legacy_init_evm(void) | ||
126 | { | ||
127 | da850_vpif_legacy_register_capture(); | ||
128 | } | ||
129 | |||
130 | static struct adv7343_platform_data adv7343_pdata = { | ||
131 | .mode_config = { | ||
132 | .dac = { 1, 1, 1 }, | ||
133 | }, | ||
134 | .sd_config = { | ||
135 | .sd_dac_out = { 1 }, | ||
136 | }, | ||
137 | }; | ||
138 | |||
139 | static struct vpif_subdev_info da850_vpif_subdev[] = { | ||
140 | { | ||
141 | .name = "adv7343", | ||
142 | .board_info = { | ||
143 | I2C_BOARD_INFO("adv7343", 0x2a), | ||
144 | .platform_data = &adv7343_pdata, | ||
145 | }, | ||
146 | }, | ||
147 | }; | ||
148 | |||
149 | static const struct vpif_output da850_ch0_outputs[] = { | ||
150 | { | ||
151 | .output = { | ||
152 | .index = 0, | ||
153 | .name = "Composite", | ||
154 | .type = V4L2_OUTPUT_TYPE_ANALOG, | ||
155 | .capabilities = V4L2_OUT_CAP_STD, | ||
156 | .std = V4L2_STD_ALL, | ||
157 | }, | ||
158 | .subdev_name = "adv7343", | ||
159 | .output_route = ADV7343_COMPOSITE_ID, | ||
160 | }, | ||
161 | { | ||
162 | .output = { | ||
163 | .index = 1, | ||
164 | .name = "S-Video", | ||
165 | .type = V4L2_OUTPUT_TYPE_ANALOG, | ||
166 | .capabilities = V4L2_OUT_CAP_STD, | ||
167 | .std = V4L2_STD_ALL, | ||
168 | }, | ||
169 | .subdev_name = "adv7343", | ||
170 | .output_route = ADV7343_SVIDEO_ID, | ||
171 | }, | ||
172 | }; | ||
173 | |||
174 | static struct vpif_display_config da850_vpif_display_config = { | ||
175 | .subdevinfo = da850_vpif_subdev, | ||
176 | .subdev_count = ARRAY_SIZE(da850_vpif_subdev), | ||
177 | .chan_config[0] = { | ||
178 | .outputs = da850_ch0_outputs, | ||
179 | .output_count = ARRAY_SIZE(da850_ch0_outputs), | ||
180 | }, | ||
181 | .card_name = "DA850/OMAP-L138 Video Display", | ||
182 | }; | ||
183 | |||
184 | static void __init da850_vpif_display_legacy_init_evm(void) | ||
185 | { | ||
186 | int ret; | ||
187 | |||
188 | ret = da850_register_vpif_display(&da850_vpif_display_config); | ||
189 | if (ret) | ||
190 | pr_warn("%s: VPIF display setup failed: %d\n", | ||
191 | __func__, ret); | ||
192 | } | ||
193 | |||
20 | static void pdata_quirks_check(struct pdata_init *quirks) | 194 | static void pdata_quirks_check(struct pdata_init *quirks) |
21 | { | 195 | { |
22 | while (quirks->compatible) { | 196 | while (quirks->compatible) { |
23 | if (of_machine_is_compatible(quirks->compatible)) { | 197 | if (of_machine_is_compatible(quirks->compatible)) { |
24 | if (quirks->fn) | 198 | if (quirks->fn) |
25 | quirks->fn(); | 199 | quirks->fn(); |
26 | break; | ||
27 | } | 200 | } |
28 | quirks++; | 201 | quirks++; |
29 | } | 202 | } |
30 | } | 203 | } |
31 | 204 | ||
32 | static struct pdata_init pdata_quirks[] __initdata = { | 205 | static struct pdata_init pdata_quirks[] __initdata = { |
206 | { "ti,da850-lcdk", da850_vpif_capture_legacy_init_lcdk, }, | ||
207 | { "ti,da850-evm", da850_vpif_display_legacy_init_evm, }, | ||
208 | { "ti,da850-evm", da850_vpif_capture_legacy_init_evm, }, | ||
33 | { /* sentinel */ }, | 209 | { /* sentinel */ }, |
34 | }; | 210 | }; |
35 | 211 | ||