1 // SPDX-License-Identifier: GPL-2.0-only 1 2 /* 3 * Legacy platform_data quirks 4 * 5 * Copyright (C) 2016 BayLibre, Inc 6 */ 7 #include <linux/kernel.h> 8 #include <linux/of.h> 9 10 #include <media/i2c/tvp514x.h> 11 #include <media/i2c/adv7343.h> 12 13 #include "common.h" 14 #include "da8xx.h" 15 16 struct pdata_init { 17 const char *compatible; 18 void (*fn)(void); 19 }; 20 21 #define TVP5147_CH0 "tvp514x-0" 22 #define TVP5147_CH1 "tvp514x-1" 23 24 /* VPIF capture configuration */ 25 static struct tvp514x_platform_data tvp5146_pd 26 .clk_polarity = 0, 27 .hs_polarity = 1, 28 .vs_polarity = 1, 29 }; 30 31 #define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_ 32 33 static struct vpif_input da850_ch0_inputs[] = 34 { 35 .input = { 36 .index = 0, 37 .name = "Composite", 38 .type = V4L2_INPUT_TY 39 .capabilities = V4L2_I 40 .std = TVP514X_STD_A 41 }, 42 .input_route = INPUT_CVBS_VI2B 43 .output_route = OUTPUT_10BIT_4 44 .subdev_name = TVP5147_CH0, 45 }, 46 }; 47 48 static struct vpif_input da850_ch1_inputs[] = 49 { 50 .input = { 51 .index = 0, 52 .name = "S-Video", 53 .type = V4L2_INPUT_TY 54 .capabilities = V4L2_I 55 .std = TVP514X_STD_A 56 }, 57 .input_route = INPUT_SVIDEO_VI 58 .output_route = OUTPUT_10BIT_4 59 .subdev_name = TVP5147_CH1, 60 }, 61 }; 62 63 static struct vpif_subdev_info da850_vpif_capt 64 { 65 .name = TVP5147_CH0, 66 .board_info = { 67 I2C_BOARD_INFO("tvp514 68 .platform_data = &tvp5 69 }, 70 }, 71 { 72 .name = TVP5147_CH1, 73 .board_info = { 74 I2C_BOARD_INFO("tvp514 75 .platform_data = &tvp5 76 }, 77 }, 78 }; 79 80 static struct vpif_capture_config da850_vpif_c 81 .subdev_info = da850_vpif_capture_sdev 82 .subdev_count = ARRAY_SIZE(da850_vpif_ 83 .chan_config[0] = { 84 .inputs = da850_ch0_inputs, 85 .input_count = ARRAY_SIZE(da85 86 .vpif_if = { 87 .if_type = VPIF_IF_BT6 88 .hd_pol = 1, 89 .vd_pol = 1, 90 .fid_pol = 0, 91 }, 92 }, 93 .chan_config[1] = { 94 .inputs = da850_ch1_inputs, 95 .input_count = ARRAY_SIZE(da85 96 .vpif_if = { 97 .if_type = VPIF_IF_BT6 98 .hd_pol = 1, 99 .vd_pol = 1, 100 .fid_pol = 0, 101 }, 102 }, 103 .card_name = "DA850/OMAP-L138 Video Ca 104 }; 105 106 static void __init da850_vpif_legacy_register_ 107 { 108 int ret; 109 110 ret = da850_register_vpif_capture(&da8 111 if (ret) 112 pr_warn("%s: VPIF capture setu 113 __func__, ret); 114 } 115 116 static void __init da850_vpif_capture_legacy_i 117 { 118 da850_vpif_capture_config.subdev_count 119 da850_vpif_legacy_register_capture(); 120 } 121 122 static void __init da850_vpif_capture_legacy_i 123 { 124 da850_vpif_legacy_register_capture(); 125 } 126 127 static struct adv7343_platform_data adv7343_pd 128 .mode_config = { 129 .dac = { 1, 1, 1 }, 130 }, 131 .sd_config = { 132 .sd_dac_out = { 1 }, 133 }, 134 }; 135 136 static struct vpif_subdev_info da850_vpif_subd 137 { 138 .name = "adv7343", 139 .board_info = { 140 I2C_BOARD_INFO("adv734 141 .platform_data = &adv7 142 }, 143 }, 144 }; 145 146 static const struct vpif_output da850_ch0_outp 147 { 148 .output = { 149 .index = 0, 150 .name = "Composite", 151 .type = V4L2_OUTPUT_TY 152 .capabilities = V4L2_O 153 .std = V4L2_STD_ALL, 154 }, 155 .subdev_name = "adv7343", 156 .output_route = ADV7343_COMPOS 157 }, 158 { 159 .output = { 160 .index = 1, 161 .name = "S-Video", 162 .type = V4L2_OUTPUT_TY 163 .capabilities = V4L2_O 164 .std = V4L2_STD_ALL, 165 }, 166 .subdev_name = "adv7343", 167 .output_route = ADV7343_SVIDEO 168 }, 169 }; 170 171 static struct vpif_display_config da850_vpif_d 172 .subdevinfo = da850_vpif_subdev, 173 .subdev_count = ARRAY_SIZE(da850_vpif_ 174 .chan_config[0] = { 175 .outputs = da850_ch0_outputs, 176 .output_count = ARRAY_SIZE(da8 177 }, 178 .card_name = "DA850/OMAP-L138 Video 179 }; 180 181 static void __init da850_vpif_display_legacy_i 182 { 183 int ret; 184 185 ret = da850_register_vpif_display(&da8 186 if (ret) 187 pr_warn("%s: VPIF display setu 188 __func__, ret); 189 } 190 191 static void pdata_quirks_check(struct pdata_in 192 { 193 while (quirks->compatible) { 194 if (of_machine_is_compatible(q 195 if (quirks->fn) 196 quirks->fn(); 197 } 198 quirks++; 199 } 200 } 201 202 static struct pdata_init pdata_quirks[] __init 203 { "ti,da850-lcdk", da850_vpif_capture_ 204 { "ti,da850-evm", da850_vpif_display_l 205 { "ti,da850-evm", da850_vpif_capture_l 206 { /* sentinel */ }, 207 }; 208 209 void __init pdata_quirks_init(void) 210 { 211 pdata_quirks_check(pdata_quirks); 212 } 213
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.