Linux 5.7.6
[linux/fpc-iii.git] / arch / arm / mach-davinci / pdata-quirks.c
blob67f1c853735460d12cd3a921121c9f07de410eb7
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Legacy platform_data quirks
5 * Copyright (C) 2016 BayLibre, Inc
6 */
7 #include <linux/kernel.h>
8 #include <linux/of_platform.h>
10 #include <media/i2c/tvp514x.h>
11 #include <media/i2c/adv7343.h>
13 #include <mach/common.h>
14 #include <mach/da8xx.h>
16 struct pdata_init {
17 const char *compatible;
18 void (*fn)(void);
21 #define TVP5147_CH0 "tvp514x-0"
22 #define TVP5147_CH1 "tvp514x-1"
24 /* VPIF capture configuration */
25 static struct tvp514x_platform_data tvp5146_pdata = {
26 .clk_polarity = 0,
27 .hs_polarity = 1,
28 .vs_polarity = 1,
31 #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
33 static struct vpif_input da850_ch0_inputs[] = {
35 .input = {
36 .index = 0,
37 .name = "Composite",
38 .type = V4L2_INPUT_TYPE_CAMERA,
39 .capabilities = V4L2_IN_CAP_STD,
40 .std = TVP514X_STD_ALL,
42 .input_route = INPUT_CVBS_VI2B,
43 .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
44 .subdev_name = TVP5147_CH0,
48 static struct vpif_input da850_ch1_inputs[] = {
50 .input = {
51 .index = 0,
52 .name = "S-Video",
53 .type = V4L2_INPUT_TYPE_CAMERA,
54 .capabilities = V4L2_IN_CAP_STD,
55 .std = TVP514X_STD_ALL,
57 .input_route = INPUT_SVIDEO_VI2C_VI1C,
58 .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
59 .subdev_name = TVP5147_CH1,
63 static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
65 .name = TVP5147_CH0,
66 .board_info = {
67 I2C_BOARD_INFO("tvp5146", 0x5d),
68 .platform_data = &tvp5146_pdata,
72 .name = TVP5147_CH1,
73 .board_info = {
74 I2C_BOARD_INFO("tvp5146", 0x5c),
75 .platform_data = &tvp5146_pdata,
80 static struct vpif_capture_config da850_vpif_capture_config = {
81 .subdev_info = da850_vpif_capture_sdev_info,
82 .subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info),
83 .chan_config[0] = {
84 .inputs = da850_ch0_inputs,
85 .input_count = ARRAY_SIZE(da850_ch0_inputs),
86 .vpif_if = {
87 .if_type = VPIF_IF_BT656,
88 .hd_pol = 1,
89 .vd_pol = 1,
90 .fid_pol = 0,
93 .chan_config[1] = {
94 .inputs = da850_ch1_inputs,
95 .input_count = ARRAY_SIZE(da850_ch1_inputs),
96 .vpif_if = {
97 .if_type = VPIF_IF_BT656,
98 .hd_pol = 1,
99 .vd_pol = 1,
100 .fid_pol = 0,
103 .card_name = "DA850/OMAP-L138 Video Capture",
106 static void __init da850_vpif_legacy_register_capture(void)
108 int ret;
110 ret = da850_register_vpif_capture(&da850_vpif_capture_config);
111 if (ret)
112 pr_warn("%s: VPIF capture setup failed: %d\n",
113 __func__, ret);
116 static void __init da850_vpif_capture_legacy_init_lcdk(void)
118 da850_vpif_capture_config.subdev_count = 1;
119 da850_vpif_legacy_register_capture();
122 static void __init da850_vpif_capture_legacy_init_evm(void)
124 da850_vpif_legacy_register_capture();
127 static struct adv7343_platform_data adv7343_pdata = {
128 .mode_config = {
129 .dac = { 1, 1, 1 },
131 .sd_config = {
132 .sd_dac_out = { 1 },
136 static struct vpif_subdev_info da850_vpif_subdev[] = {
138 .name = "adv7343",
139 .board_info = {
140 I2C_BOARD_INFO("adv7343", 0x2a),
141 .platform_data = &adv7343_pdata,
146 static const struct vpif_output da850_ch0_outputs[] = {
148 .output = {
149 .index = 0,
150 .name = "Composite",
151 .type = V4L2_OUTPUT_TYPE_ANALOG,
152 .capabilities = V4L2_OUT_CAP_STD,
153 .std = V4L2_STD_ALL,
155 .subdev_name = "adv7343",
156 .output_route = ADV7343_COMPOSITE_ID,
159 .output = {
160 .index = 1,
161 .name = "S-Video",
162 .type = V4L2_OUTPUT_TYPE_ANALOG,
163 .capabilities = V4L2_OUT_CAP_STD,
164 .std = V4L2_STD_ALL,
166 .subdev_name = "adv7343",
167 .output_route = ADV7343_SVIDEO_ID,
171 static struct vpif_display_config da850_vpif_display_config = {
172 .subdevinfo = da850_vpif_subdev,
173 .subdev_count = ARRAY_SIZE(da850_vpif_subdev),
174 .chan_config[0] = {
175 .outputs = da850_ch0_outputs,
176 .output_count = ARRAY_SIZE(da850_ch0_outputs),
178 .card_name = "DA850/OMAP-L138 Video Display",
181 static void __init da850_vpif_display_legacy_init_evm(void)
183 int ret;
185 ret = da850_register_vpif_display(&da850_vpif_display_config);
186 if (ret)
187 pr_warn("%s: VPIF display setup failed: %d\n",
188 __func__, ret);
191 static void pdata_quirks_check(struct pdata_init *quirks)
193 while (quirks->compatible) {
194 if (of_machine_is_compatible(quirks->compatible)) {
195 if (quirks->fn)
196 quirks->fn();
198 quirks++;
202 static struct pdata_init pdata_quirks[] __initdata = {
203 { "ti,da850-lcdk", da850_vpif_capture_legacy_init_lcdk, },
204 { "ti,da850-evm", da850_vpif_display_legacy_init_evm, },
205 { "ti,da850-evm", da850_vpif_capture_legacy_init_evm, },
206 { /* sentinel */ },
209 void __init pdata_quirks_init(void)
211 pdata_quirks_check(pdata_quirks);