aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@baylibre.com>2017-02-28 11:01:58 -0500
committerSekhar Nori <nsekhar@ti.com>2017-03-07 06:13:17 -0500
commit7ee77194143ba7cee8d55956adc85914ce49a277 (patch)
tree72ccfd981fc8043c560487b467cf0584c92d7157
parent79617a528b8d6486bcb9f0ca3bdbcf8852f8feee (diff)
ARM: davinci: da8xx: add pdata-quirks for VPIF capture
For da8xx DT platforms, use pdata-quirks to add legacy platform data for vpif_capture driver. Passing legacy platform_data is required until the V4L2 framework, and subdevice drivers (such as the tvp514x) grow a way of selecting input and output routing (c.f. V4L2 s_routing API) Signed-off-by: Kevin Hilman <khilman@baylibre.com> [Bartosz: - removed unnecessary #ifdefs - split the init function into two separate routines for the lcdk and evm boards] Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r--arch/arm/mach-davinci/pdata-quirks.c111
1 files changed, 111 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/pdata-quirks.c b/arch/arm/mach-davinci/pdata-quirks.c
index 36fb2179b910..4a9603d5e083 100644
--- a/arch/arm/mach-davinci/pdata-quirks.c
+++ b/arch/arm/mach-davinci/pdata-quirks.c
@@ -10,13 +10,122 @@
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
13#include <mach/common.h> 15#include <mach/common.h>
16#include <mach/da8xx.h>
14 17
15struct pdata_init { 18struct pdata_init {
16 const char *compatible; 19 const char *compatible;
17 void (*fn)(void); 20 void (*fn)(void);
18}; 21};
19 22
23#define TVP5147_CH0 "tvp514x-0"
24#define TVP5147_CH1 "tvp514x-1"
25
26/* VPIF capture configuration */
27static struct tvp514x_platform_data tvp5146_pdata = {
28 .clk_polarity = 0,
29 .hs_polarity = 1,
30 .vs_polarity = 1,
31};
32
33#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
34
35static const struct vpif_input da850_ch0_inputs[] = {
36 {
37 .input = {
38 .index = 0,
39 .name = "Composite",
40 .type = V4L2_INPUT_TYPE_CAMERA,
41 .capabilities = V4L2_IN_CAP_STD,
42 .std = TVP514X_STD_ALL,
43 },
44 .input_route = INPUT_CVBS_VI2B,
45 .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
46 .subdev_name = TVP5147_CH0,
47 },
48};
49
50static const struct vpif_input da850_ch1_inputs[] = {
51 {
52 .input = {
53 .index = 0,
54 .name = "S-Video",
55 .type = V4L2_INPUT_TYPE_CAMERA,
56 .capabilities = V4L2_IN_CAP_STD,
57 .std = TVP514X_STD_ALL,
58 },
59 .input_route = INPUT_SVIDEO_VI2C_VI1C,
60 .output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
61 .subdev_name = TVP5147_CH1,
62 },
63};
64
65static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
66 {
67 .name = TVP5147_CH0,
68 .board_info = {
69 I2C_BOARD_INFO("tvp5146", 0x5d),
70 .platform_data = &tvp5146_pdata,
71 },
72 },
73 {
74 .name = TVP5147_CH1,
75 .board_info = {
76 I2C_BOARD_INFO("tvp5146", 0x5c),
77 .platform_data = &tvp5146_pdata,
78 },
79 },
80};
81
82static struct vpif_capture_config da850_vpif_capture_config = {
83 .subdev_info = da850_vpif_capture_sdev_info,
84 .subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info),
85 .chan_config[0] = {
86 .inputs = da850_ch0_inputs,
87 .input_count = ARRAY_SIZE(da850_ch0_inputs),
88 .vpif_if = {
89 .if_type = VPIF_IF_BT656,
90 .hd_pol = 1,
91 .vd_pol = 1,
92 .fid_pol = 0,
93 },
94 },
95 .chan_config[1] = {
96 .inputs = da850_ch1_inputs,
97 .input_count = ARRAY_SIZE(da850_ch1_inputs),
98 .vpif_if = {
99 .if_type = VPIF_IF_BT656,
100 .hd_pol = 1,
101 .vd_pol = 1,
102 .fid_pol = 0,
103 },
104 },
105 .card_name = "DA850/OMAP-L138 Video Capture",
106};
107
108static void __init da850_vpif_legacy_register_capture(void)
109{
110 int ret;
111
112 ret = da850_register_vpif_capture(&da850_vpif_capture_config);
113 if (ret)
114 pr_warn("%s: VPIF capture setup failed: %d\n",
115 __func__, ret);
116}
117
118static void __init da850_vpif_capture_legacy_init_lcdk(void)
119{
120 da850_vpif_capture_config.subdev_count = 1;
121 da850_vpif_legacy_register_capture();
122}
123
124static void __init da850_vpif_capture_legacy_init_evm(void)
125{
126 da850_vpif_legacy_register_capture();
127}
128
20static void pdata_quirks_check(struct pdata_init *quirks) 129static void pdata_quirks_check(struct pdata_init *quirks)
21{ 130{
22 while (quirks->compatible) { 131 while (quirks->compatible) {
@@ -29,6 +138,8 @@ static void pdata_quirks_check(struct pdata_init *quirks)
29} 138}
30 139
31static struct pdata_init pdata_quirks[] __initdata = { 140static struct pdata_init pdata_quirks[] __initdata = {
141 { "ti,da850-lcdk", da850_vpif_capture_legacy_init_lcdk, },
142 { "ti,da850-evm", da850_vpif_capture_legacy_init_evm, },
32 { /* sentinel */ }, 143 { /* sentinel */ },
33}; 144};
34 145