]>
Commit | Line | Data |
---|---|---|
9c9b1bc2 KH |
1 | /* |
2 | * Legacy platform_data quirks | |
3 | * | |
4 | * Copyright (C) 2016 BayLibre, Inc | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | */ | |
10 | #include <linux/kernel.h> | |
11 | #include <linux/of_platform.h> | |
12 | ||
7ee77194 | 13 | #include <media/i2c/tvp514x.h> |
99228481 | 14 | #include <media/i2c/adv7343.h> |
7ee77194 | 15 | |
9c9b1bc2 | 16 | #include <mach/common.h> |
7ee77194 | 17 | #include <mach/da8xx.h> |
9c9b1bc2 KH |
18 | |
19 | struct pdata_init { | |
20 | const char *compatible; | |
21 | void (*fn)(void); | |
22 | }; | |
23 | ||
7ee77194 KH |
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 | ||
231ce279 | 36 | static struct vpif_input da850_ch0_inputs[] = { |
7ee77194 KH |
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 | ||
231ce279 | 51 | static struct vpif_input da850_ch1_inputs[] = { |
7ee77194 KH |
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 | ||
99228481 BG |
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 | ||
9c9b1bc2 KH |
194 | static void pdata_quirks_check(struct pdata_init *quirks) |
195 | { | |
196 | while (quirks->compatible) { | |
197 | if (of_machine_is_compatible(quirks->compatible)) { | |
198 | if (quirks->fn) | |
199 | quirks->fn(); | |
9c9b1bc2 KH |
200 | } |
201 | quirks++; | |
202 | } | |
203 | } | |
204 | ||
205 | static struct pdata_init pdata_quirks[] __initdata = { | |
7ee77194 | 206 | { "ti,da850-lcdk", da850_vpif_capture_legacy_init_lcdk, }, |
99228481 | 207 | { "ti,da850-evm", da850_vpif_display_legacy_init_evm, }, |
7ee77194 | 208 | { "ti,da850-evm", da850_vpif_capture_legacy_init_evm, }, |
9c9b1bc2 KH |
209 | { /* sentinel */ }, |
210 | }; | |
211 | ||
212 | void __init pdata_quirks_init(void) | |
213 | { | |
214 | pdata_quirks_check(pdata_quirks); | |
215 | } |