2 * Legacy platform_data quirks
4 * Copyright (C) 2016 BayLibre, Inc
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.
10 #include <linux/kernel.h>
11 #include <linux/of_platform.h>
13 #include <media/i2c/tvp514x.h>
14 #include <media/i2c/adv7343.h>
16 #include <mach/common.h>
17 #include <mach/da8xx.h>
20 const char *compatible;
24 #define TVP5147_CH0 "tvp514x-0"
25 #define TVP5147_CH1 "tvp514x-1"
27 /* VPIF capture configuration */
28 static struct tvp514x_platform_data tvp5146_pdata = {
34 #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
36 static struct vpif_input da850_ch0_inputs[] = {
41 .type = V4L2_INPUT_TYPE_CAMERA,
42 .capabilities = V4L2_IN_CAP_STD,
43 .std = TVP514X_STD_ALL,
45 .input_route = INPUT_CVBS_VI2B,
46 .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
47 .subdev_name = TVP5147_CH0,
51 static struct vpif_input da850_ch1_inputs[] = {
56 .type = V4L2_INPUT_TYPE_CAMERA,
57 .capabilities = V4L2_IN_CAP_STD,
58 .std = TVP514X_STD_ALL,
60 .input_route = INPUT_SVIDEO_VI2C_VI1C,
61 .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
62 .subdev_name = TVP5147_CH1,
66 static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
70 I2C_BOARD_INFO("tvp5146", 0x5d),
71 .platform_data = &tvp5146_pdata,
77 I2C_BOARD_INFO("tvp5146", 0x5c),
78 .platform_data = &tvp5146_pdata,
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),
87 .inputs = da850_ch0_inputs,
88 .input_count = ARRAY_SIZE(da850_ch0_inputs),
90 .if_type = VPIF_IF_BT656,
97 .inputs = da850_ch1_inputs,
98 .input_count = ARRAY_SIZE(da850_ch1_inputs),
100 .if_type = VPIF_IF_BT656,
106 .card_name = "DA850/OMAP-L138 Video Capture",
109 static void __init da850_vpif_legacy_register_capture(void)
113 ret = da850_register_vpif_capture(&da850_vpif_capture_config);
115 pr_warn("%s: VPIF capture setup failed: %d\n",
119 static void __init da850_vpif_capture_legacy_init_lcdk(void)
121 da850_vpif_capture_config.subdev_count = 1;
122 da850_vpif_legacy_register_capture();
125 static void __init da850_vpif_capture_legacy_init_evm(void)
127 da850_vpif_legacy_register_capture();
130 static struct adv7343_platform_data adv7343_pdata = {
139 static struct vpif_subdev_info da850_vpif_subdev[] = {
143 I2C_BOARD_INFO("adv7343", 0x2a),
144 .platform_data = &adv7343_pdata,
149 static const struct vpif_output da850_ch0_outputs[] = {
154 .type = V4L2_OUTPUT_TYPE_ANALOG,
155 .capabilities = V4L2_OUT_CAP_STD,
158 .subdev_name = "adv7343",
159 .output_route = ADV7343_COMPOSITE_ID,
165 .type = V4L2_OUTPUT_TYPE_ANALOG,
166 .capabilities = V4L2_OUT_CAP_STD,
169 .subdev_name = "adv7343",
170 .output_route = ADV7343_SVIDEO_ID,
174 static struct vpif_display_config da850_vpif_display_config = {
175 .subdevinfo = da850_vpif_subdev,
176 .subdev_count = ARRAY_SIZE(da850_vpif_subdev),
178 .outputs = da850_ch0_outputs,
179 .output_count = ARRAY_SIZE(da850_ch0_outputs),
181 .card_name = "DA850/OMAP-L138 Video Display",
184 static void __init da850_vpif_display_legacy_init_evm(void)
188 ret = da850_register_vpif_display(&da850_vpif_display_config);
190 pr_warn("%s: VPIF display setup failed: %d\n",
194 static void pdata_quirks_check(struct pdata_init *quirks)
196 while (quirks->compatible) {
197 if (of_machine_is_compatible(quirks->compatible)) {
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, },
212 void __init pdata_quirks_init(void)
214 pdata_quirks_check(pdata_quirks);