1 // SPDX-License-Identifier: GPL-2.0-only
3 * Legacy platform_data quirks
5 * Copyright (C) 2016 BayLibre, Inc
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>
17 const char *compatible
;
21 #define TVP5147_CH0 "tvp514x-0"
22 #define TVP5147_CH1 "tvp514x-1"
24 /* VPIF capture configuration */
25 static struct tvp514x_platform_data tvp5146_pdata
= {
31 #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
33 static struct vpif_input da850_ch0_inputs
[] = {
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
[] = {
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
[] = {
67 I2C_BOARD_INFO("tvp5146", 0x5d),
68 .platform_data
= &tvp5146_pdata
,
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
),
84 .inputs
= da850_ch0_inputs
,
85 .input_count
= ARRAY_SIZE(da850_ch0_inputs
),
87 .if_type
= VPIF_IF_BT656
,
94 .inputs
= da850_ch1_inputs
,
95 .input_count
= ARRAY_SIZE(da850_ch1_inputs
),
97 .if_type
= VPIF_IF_BT656
,
103 .card_name
= "DA850/OMAP-L138 Video Capture",
106 static void __init
da850_vpif_legacy_register_capture(void)
110 ret
= da850_register_vpif_capture(&da850_vpif_capture_config
);
112 pr_warn("%s: VPIF capture setup failed: %d\n",
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
= {
136 static struct vpif_subdev_info da850_vpif_subdev
[] = {
140 I2C_BOARD_INFO("adv7343", 0x2a),
141 .platform_data
= &adv7343_pdata
,
146 static const struct vpif_output da850_ch0_outputs
[] = {
151 .type
= V4L2_OUTPUT_TYPE_ANALOG
,
152 .capabilities
= V4L2_OUT_CAP_STD
,
155 .subdev_name
= "adv7343",
156 .output_route
= ADV7343_COMPOSITE_ID
,
162 .type
= V4L2_OUTPUT_TYPE_ANALOG
,
163 .capabilities
= V4L2_OUT_CAP_STD
,
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
),
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)
185 ret
= da850_register_vpif_display(&da850_vpif_display_config
);
187 pr_warn("%s: VPIF display setup failed: %d\n",
191 static void pdata_quirks_check(struct pdata_init
*quirks
)
193 while (quirks
->compatible
) {
194 if (of_machine_is_compatible(quirks
->compatible
)) {
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
, },
209 void __init
pdata_quirks_init(void)
211 pdata_quirks_check(pdata_quirks
);