1
2 /*
3 * config.c for device tree and sensor list parser.
4 *
5 * Copyright (c) 2017 by Allwinnertech Co., Ltd. http://www.allwinnertech.com
6 *
7 * Authors: Zhao Wei <zhaowei@allwinnertech.com>
8 * Yang Feng <yangfeng@allwinnertech.com>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15 #include "config.h"
16 #include "../platform/platform_cfg.h"
17 #include "../modules/sensor-list/sensor_list.h"
18
get_value_int(struct device_node * np,const char * name,u32 * value)19 static int get_value_int(struct device_node *np, const char *name,
20 u32 *value)
21 {
22 int ret;
23
24 ret = of_property_read_u32(np, name, value);
25 if (ret) {
26 *value = 0;
27 vin_log(VIN_LOG_CONFIG, "fetch %s from device_tree failed\n", name);
28 return -EINVAL;
29 }
30 vin_log(VIN_LOG_CONFIG, "%s = %x\n", name, *value);
31 return 0;
32 }
get_value_string(struct device_node * np,const char * name,char * string)33 static int get_value_string(struct device_node *np, const char *name,
34 char *string)
35 {
36 int ret;
37 const char *const_str;
38
39 ret = of_property_read_string(np, name, &const_str);
40 if (ret) {
41 strcpy(string, "");
42 vin_log(VIN_LOG_CONFIG, "fetch %s from device_tree failed\n", name);
43 return -EINVAL;
44 }
45 strcpy(string, const_str);
46 vin_log(VIN_LOG_CONFIG, "%s = %s\n", name, string);
47 return 0;
48 }
49
get_gpio_info(struct device_node * np,const char * name,int * gpio)50 static int get_gpio_info(struct device_node *np, const char *name,
51 int *gpio)
52 {
53 int gnum;
54 enum of_gpio_flags gc;
55
56 gnum = of_get_named_gpio_flags(np, name, 0, &gc);
57 if (!gpio_is_valid(gnum)) {
58 vin_log(VIN_LOG_CONFIG, "fetch %s from device_tree failed\n", name);
59 return -ENODEV;
60 }
61 *gpio = gnum;
62 vin_log(VIN_LOG_CONFIG, "fetch %s gpio = %d\n", name, *gpio);
63
64 return 0;
65 }
66
get_mname(struct device_node * np,const char * name,struct sensor_list * sc)67 static int get_mname(struct device_node *np, const char *name,
68 struct sensor_list *sc)
69 {
70 return get_value_string(np, name, sc->inst[0].cam_name);
71 }
get_twi_addr(struct device_node * np,const char * name,struct sensor_list * sc)72 static int get_twi_addr(struct device_node *np, const char *name,
73 struct sensor_list *sc)
74 {
75 return get_value_int(np, name, &sc->inst[0].cam_addr);
76 }
77
get_twi_cci_spi(struct device_node * np,const char * name,struct sensor_list * sc)78 static int get_twi_cci_spi(struct device_node *np, const char *name,
79 struct sensor_list *sc)
80 {
81 return get_value_int(np, name, &sc->sensor_bus_type);
82 }
83
get_twi_id(struct device_node * np,const char * name,struct sensor_list * sc)84 static int get_twi_id(struct device_node *np, const char *name,
85 struct sensor_list *sc)
86 {
87 return get_value_int(np, name, &sc->sensor_bus_sel);
88 }
get_mclk_id(struct device_node * np,const char * name,struct sensor_list * sc)89 static int get_mclk_id(struct device_node *np, const char *name,
90 struct sensor_list *sc)
91 {
92 if (get_value_int(np, name, &sc->mclk_id))
93 sc->mclk_id = -1;
94 return 0;
95 }
get_pos(struct device_node * np,const char * name,struct sensor_list * sc)96 static int get_pos(struct device_node *np, const char *name,
97 struct sensor_list *sc)
98 {
99 return get_value_string(np, name, sc->sensor_pos);
100 }
get_isp_used(struct device_node * np,const char * name,struct sensor_list * sc)101 static int get_isp_used(struct device_node *np, const char *name,
102 struct sensor_list *sc)
103 {
104 return get_value_int(np, name, &sc->inst[0].is_isp_used);
105 }
get_fmt(struct device_node * np,const char * name,struct sensor_list * sc)106 static int get_fmt(struct device_node *np, const char *name,
107 struct sensor_list *sc)
108 {
109 return get_value_int(np, name, &sc->inst[0].is_bayer_raw);
110 }
get_vflip(struct device_node * np,const char * name,struct sensor_list * sc)111 static int get_vflip(struct device_node *np, const char *name,
112 struct sensor_list *sc)
113 {
114 return get_value_int(np, name, &sc->inst[0].vflip);
115 }
get_hflip(struct device_node * np,const char * name,struct sensor_list * sc)116 static int get_hflip(struct device_node *np, const char *name,
117 struct sensor_list *sc)
118 {
119 return get_value_int(np, name, &sc->inst[0].hflip);
120 }
get_cameravdd(struct device_node * np,const char * name,struct sensor_list * sc)121 static int get_cameravdd(struct device_node *np, const char *name,
122 struct sensor_list *sc)
123 {
124 return get_value_string(np, name, sc->power[CAMERAVDD].power_str);
125 }
get_cameravdd_vol(struct device_node * np,const char * name,struct sensor_list * sc)126 static int get_cameravdd_vol(struct device_node *np, const char *name,
127 struct sensor_list *sc)
128 {
129 return get_value_int(np, name, &sc->power[CAMERAVDD].power_vol);
130 }
get_iovdd(struct device_node * np,const char * name,struct sensor_list * sc)131 static int get_iovdd(struct device_node *np, const char *name,
132 struct sensor_list *sc)
133 {
134 return get_value_string(np, name, sc->power[IOVDD].power_str);
135 }
get_iovdd_vol(struct device_node * np,const char * name,struct sensor_list * sc)136 static int get_iovdd_vol(struct device_node *np, const char *name,
137 struct sensor_list *sc)
138 {
139 return get_value_int(np, name, &sc->power[IOVDD].power_vol);
140 }
get_avdd(struct device_node * np,const char * name,struct sensor_list * sc)141 static int get_avdd(struct device_node *np, const char *name,
142 struct sensor_list *sc)
143 {
144 return get_value_string(np, name, sc->power[AVDD].power_str);
145 }
get_avdd_vol(struct device_node * np,const char * name,struct sensor_list * sc)146 static int get_avdd_vol(struct device_node *np, const char *name,
147 struct sensor_list *sc)
148 {
149 return get_value_int(np, name, &sc->power[AVDD].power_vol);
150 }
get_dvdd(struct device_node * np,const char * name,struct sensor_list * sc)151 static int get_dvdd(struct device_node *np, const char *name,
152 struct sensor_list *sc)
153 {
154 return get_value_string(np, name, sc->power[DVDD].power_str);
155 }
get_dvdd_vol(struct device_node * np,const char * name,struct sensor_list * sc)156 static int get_dvdd_vol(struct device_node *np, const char *name,
157 struct sensor_list *sc)
158 {
159 return get_value_int(np, name, &sc->power[DVDD].power_vol);
160 }
161
162 #ifdef CONFIG_ACTUATOR_MODULE
get_afvdd(struct device_node * np,const char * name,struct sensor_list * sc)163 static int get_afvdd(struct device_node *np, const char *name,
164 struct sensor_list *sc)
165 {
166 return get_value_string(np, name, sc->power[AFVDD].power_str);
167 }
get_afvdd_vol(struct device_node * np,const char * name,struct sensor_list * sc)168 static int get_afvdd_vol(struct device_node *np, const char *name,
169 struct sensor_list *sc)
170 {
171 return get_value_int(np, name, &sc->power[AFVDD].power_vol);
172 }
173 #endif
174
get_power_en(struct device_node * np,const char * name,struct sensor_list * sc)175 static int get_power_en(struct device_node *np, const char *name,
176 struct sensor_list *sc)
177 {
178 return get_gpio_info(np, name, &sc->gpio[POWER_EN]);
179 }
get_reset(struct device_node * np,const char * name,struct sensor_list * sc)180 static int get_reset(struct device_node *np, const char *name,
181 struct sensor_list *sc)
182 {
183 return get_gpio_info(np, name, &sc->gpio[RESET]);
184 }
get_pwdn(struct device_node * np,const char * name,struct sensor_list * sc)185 static int get_pwdn(struct device_node *np, const char *name,
186 struct sensor_list *sc)
187 {
188 return get_gpio_info(np, name, &sc->gpio[PWDN]);
189 }
get_sm_hs(struct device_node * np,const char * name,struct sensor_list * sc)190 static int get_sm_hs(struct device_node *np, const char *name,
191 struct sensor_list *sc)
192 {
193 return get_gpio_info(np, name, &sc->gpio[SM_HS]);
194 }
get_sm_vs(struct device_node * np,const char * name,struct sensor_list * sc)195 static int get_sm_vs(struct device_node *np, const char *name,
196 struct sensor_list *sc)
197 {
198 return get_gpio_info(np, name, &sc->gpio[SM_VS]);
199 }
200
201 #ifdef CONFIG_FLASH_MODULE
get_flash_en(struct device_node * np,const char * name,struct sensor_list * sc)202 static int get_flash_en(struct device_node *np, const char *name,
203 struct sensor_list *sc)
204 {
205 return get_gpio_info(np, name, &sc->gpio[FLASH_EN]);
206 }
get_flash_mode(struct device_node * np,const char * name,struct sensor_list * sc)207 static int get_flash_mode(struct device_node *np, const char *name,
208 struct sensor_list *sc)
209 {
210 return get_gpio_info(np, name, &sc->gpio[FLASH_MODE]);
211 }
get_flvdd(struct device_node * np,const char * name,struct sensor_list * sc)212 static int get_flvdd(struct device_node *np, const char *name,
213 struct sensor_list *sc)
214 {
215 return get_value_string(np, name, sc->power[FLVDD].power_str);
216 }
get_flvdd_vol(struct device_node * np,const char * name,struct sensor_list * sc)217 static int get_flvdd_vol(struct device_node *np, const char *name,
218 struct sensor_list *sc)
219 {
220 return get_value_int(np, name, &sc->power[FLVDD].power_vol);
221 }
222 #endif
223
224 #ifdef CONFIG_ACTUATOR_MODULE
get_act_bus_type(struct device_node * np,const char * name,struct sensor_list * sc)225 static int get_act_bus_type(struct device_node *np, const char *name,
226 struct sensor_list *sc)
227 {
228 return get_value_int(np, name, &sc->act_bus_type);
229 }
230
get_act_bus_sel(struct device_node * np,const char * name,struct sensor_list * sc)231 static int get_act_bus_sel(struct device_node *np, const char *name,
232 struct sensor_list *sc)
233 {
234 return get_value_int(np, name, &sc->act_bus_sel);
235 }
236
get_act_separate(struct device_node * np,const char * name,struct sensor_list * sc)237 static int get_act_separate(struct device_node *np, const char *name,
238 struct sensor_list *sc)
239 {
240 return get_value_int(np, name, &sc->act_separate);
241 }
242
get_af_pwdn(struct device_node * np,const char * name,struct sensor_list * sc)243 static int get_af_pwdn(struct device_node *np, const char *name,
244 struct sensor_list *sc)
245 {
246 return get_gpio_info(np, name, &sc->gpio[AF_PWDN]);
247 }
get_act_name(struct device_node * np,const char * name,struct sensor_list * sc)248 static int get_act_name(struct device_node *np, const char *name,
249 struct sensor_list *sc)
250 {
251 return get_value_string(np, name, sc->inst[0].act_name);
252 }
get_act_slave(struct device_node * np,const char * name,struct sensor_list * sc)253 static int get_act_slave(struct device_node *np, const char *name,
254 struct sensor_list *sc)
255 {
256 return get_value_int(np, name, &sc->inst[0].act_addr);
257 }
258 #endif
259
260 struct FetchFunArr {
261 char *sub;
262 int flag;
263 int (*fun)(struct device_node *, const char *,
264 struct sensor_list *);
265 };
266
267 static struct FetchFunArr fetch_camera[] = {
268 {"mname", 0, get_mname,},
269 {"twi_addr", 0, get_twi_addr,},
270 {"twi_cci_spi", 1, get_twi_cci_spi,},
271 {"twi_cci_id", 1, get_twi_id,},
272 {"mclk_id", 1, get_mclk_id,},
273 {"pos", 1, get_pos,},
274 {"isp_used", 1, get_isp_used,},
275 {"fmt", 1, get_fmt,},
276 {"vflip", 1, get_vflip,},
277 {"hflip", 1, get_hflip,},
278 {"cameravdd", 1, get_cameravdd,},
279 {"cameravdd_vol", 1, get_cameravdd_vol},
280 {"iovdd", 1, get_iovdd,},
281 {"iovdd_vol", 1, get_iovdd_vol},
282 {"avdd", 1, get_avdd,},
283 {"avdd_vol", 1, get_avdd_vol,},
284 {"dvdd", 1, get_dvdd,},
285 {"dvdd_vol", 1, get_dvdd_vol,},
286 {"power_en", 1, get_power_en,},
287 {"reset", 1, get_reset,},
288 {"pwdn", 1, get_pwdn,},
289 {"sm_hs", 1, get_sm_hs,},
290 {"sm_vs", 1, get_sm_vs,},
291 };
292
293 #ifdef CONFIG_FLASH_MODULE
294 static struct FetchFunArr fetch_flash[] = {
295 {"en", 1, get_flash_en,},
296 {"mode", 1, get_flash_mode,},
297 {"flvdd", 1, get_flvdd,},
298 {"flvdd_vol", 1, get_flvdd_vol,},
299 };
300 #endif
301
302 #ifdef CONFIG_ACTUATOR_MODULE
303 static struct FetchFunArr fetch_actuator[] = {
304 {"name", 0, get_act_name,},
305 {"slave", 0, get_act_slave,},
306 {"separate", 1, get_act_separate,},
307 {"twi_cci_spi", 1, get_act_bus_type,},
308 {"twi_cci_id", 1, get_act_bus_sel,},
309 {"af_pwdn", 1, get_af_pwdn,},
310 {"afvdd", 1, get_afvdd,},
311 {"afvdd_vol", 1, get_afvdd_vol,},
312 };
313 #endif
314
parse_modules_from_device_tree(struct vin_md * vind)315 int parse_modules_from_device_tree(struct vin_md *vind)
316 {
317 #ifdef FPGA_VER
318 unsigned int i, j;
319 struct modules_config *module;
320 struct sensor_list *sensors;
321 struct sensor_instance *inst;
322 unsigned int sensor_uses = 1; /*1/2 mean use one/two sensor*/
323 struct sensor_list sensors_def[2] = {
324 {
325 .used = 1,
326 .csi_sel = 0,
327 .device_sel = 0,
328 .sensor_bus_sel = 0,
329 .power_set = 1,
330 .detect_num = 1,
331 .sensor_pos = "rear",
332 .power = {
333 [IOVDD] = {NULL, 2800000, ""},
334 [AVDD] = {NULL, 2800000, ""},
335 [DVDD] = {NULL, 1500000, ""},
336 [AFVDD] = {NULL, 2800000, ""},
337 [FLVDD] = {NULL, 3300000, ""},
338 },
339 .gpio = {
340 [RESET] = {GPIOE(14), 1, 0, 1, 0,},
341 [PWDN] = {GPIOE(15), 1, 0, 1, 0,},
342 [POWER_EN] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
343 [FLASH_EN] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
344 [FLASH_MODE] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
345 [AF_PWDN] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
346 },
347 .inst = {
348 [0] = {
349 .cam_name = "ar0238",
350 .cam_addr = 0x20,
351 .cam_type = 0,
352 .is_isp_used = 1,
353 .is_bayer_raw = 1,
354 .vflip = 0,
355 .hflip = 0,
356 .act_name = "ad5820_act",
357 .act_addr = 0x18,
358 .isp_cfg_name = "",
359 },
360 },
361 }, {
362 .used = 1,
363 .csi_sel = 1,
364 .device_sel = 1,
365 .sensor_bus_sel = 1,
366 .power_set = 1,
367 .detect_num = 1,
368 .sensor_pos = "front",
369 .power = {
370 [IOVDD] = {NULL, 2800000, ""},
371 [AVDD] = {NULL, 2800000, ""},
372 [DVDD] = {NULL, 1500000, ""},
373 [AFVDD] = {NULL, 2800000, ""},
374 [FLVDD] = {NULL, 3300000, ""},
375 },
376 .gpio = {
377 [RESET] = {GPIOE(14), 1, 0, 1, 0,},
378 [PWDN] = {GPIOE(15), 1, 0, 1, 0,},
379 [POWER_EN] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
380 [FLASH_EN] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
381 [FLASH_MODE] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
382 [AF_PWDN] = {GPIO_INDEX_INVALID, 0, 0, 0, 0,},
383 },
384 .inst = {
385 [0] = {
386 .cam_name = "ar0238_2",
387 .cam_addr = 0x20,
388 .cam_type = 0,
389 .is_isp_used = 1,
390 .is_bayer_raw = 1,
391 .vflip = 0,
392 .hflip = 0,
393 .act_name = "ad5820_act",
394 .act_addr = 0x18,
395 .isp_cfg_name = "",
396 },
397 },
398 }
399 };
400
401 for (i = 0; i < sensor_uses; i++) {
402 module = &vind->modules[i];
403 sensors = &module->sensors;
404 inst = &sensors->inst[0];
405
406 sensors->use_sensor_list = 0;
407 sensors->sensor_bus_sel = sensors_def[i].sensor_bus_sel;
408 /*when insmod without parm*/
409 if (inst->cam_addr == 0xff) {
410 strcpy(inst->cam_name, sensors_def[i].inst[0].cam_name);
411 strcpy(inst->isp_cfg_name, sensors_def[i].inst[0].cam_name);
412 inst->cam_addr = sensors_def[i].inst[0].cam_addr;
413 }
414 inst->is_isp_used = sensors_def[i].inst[0].is_isp_used;
415 inst->is_bayer_raw = sensors_def[i].inst[0].is_bayer_raw;
416 inst->vflip = sensors_def[i].inst[0].vflip;
417 inst->hflip = sensors_def[i].inst[0].hflip;
418 for (j = 0; j < MAX_POW_NUM; j++) {
419 strcpy(sensors->power[j].power_str,
420 sensors_def[i].power[j].power_str);
421 sensors->power[j].power_vol = sensors_def[i].power[j].power_vol;
422 }
423 module->flash_used = 0;
424 module->act_used = 0;
425 /*when insmod without parm*/
426 if (inst->act_addr == 0xff) {
427 strcpy(inst->act_name, sensors_def[i].inst[0].act_name);
428 inst->act_addr = sensors_def[i].inst[0].act_addr;
429 }
430 /*
431 for (j = 0; j < MAX_GPIO_NUM; j++) {
432 sensors->gpio[j].gpio = sensors_def[i].gpio[j].gpio;
433 sensors->gpio[j].mul_sel = sensors_def[i].gpio[j].mul_sel;
434 sensors->gpio[j].pull = sensors_def[i].gpio[j].pull;
435 sensors->gpio[j].drv_level = sensors_def[i].gpio[j].drv_level;
436 sensors->gpio[j].data = sensors_def[i].gpio[j].data;
437 }
438 */
439 sensors->detect_num = sensors_def[i].detect_num;
440 vin_log(VIN_LOG_CONFIG, "vin cci_sel is %d\n", sensors->sensor_bus_sel);
441 }
442 #else
443 int i = 0, j = 0, idx;
444 struct device_node *parent = vind->pdev->dev.of_node;
445 struct device_node *cam = NULL, *child;
446 char property[32] = { 0 };
447 struct modules_config *module = NULL;
448 struct sensor_list *sensors = NULL;
449 const char *device_type;
450 int ret;
451 __maybe_unused int size = 0;
452 __maybe_unused const __be32 *list;
453
454 for_each_available_child_of_node(parent, child) {
455 if (!strcmp(child->name, "sensor")) {
456 cam = child;
457
458 ret = of_property_read_string(cam, "device_type", &device_type);
459 if (ret) {
460 vin_err("%s get sensor device_type failed!\n", __func__);
461 continue;
462 }
463
464 sscanf(device_type, "sensor%d", &i);
465 module = &vind->modules[i];
466 sensors = &module->sensors;
467 } else
468 continue;
469
470 /*when insmod without parm*/
471 if (!strcmp(sensors->inst[0].cam_name, "")) {
472 fetch_camera[0].flag = 1;
473 fetch_camera[1].flag = 1;
474 }
475 for (j = 0; j < ARRAY_SIZE(fetch_camera); j++) {
476 if (!fetch_camera[j].flag)
477 continue;
478
479 sprintf(property, "%s%d_%s",
480 cam->name, i, fetch_camera[j].sub);
481 fetch_camera[j].fun(cam,
482 property, sensors);
483 }
484
485 #ifdef CONFIG_ACTUATOR_MODULE
486 /*get actuator node */
487 sprintf(property, "%s", "act_handle");
488 list = of_get_property(cam, property, &size);
489 if ((!list) || (size == 0)) {
490 vin_log(VIN_LOG_CONFIG, "missing %s property in node %s\n",
491 property, cam->name);
492 module->act_used = 0;
493 } else {
494 struct device_node *act = of_find_node_by_phandle(be32_to_cpup(list));
495 if (!act) {
496 vin_warn("%s invalid phandle\n", property);
497 } else if (of_device_is_available(act)) {
498 module->act_used = 1;
499 /*when insmod without parm*/
500 if (!strcmp(sensors->inst[0].act_name, "")) {
501 fetch_actuator[0].flag = 1;
502 fetch_actuator[1].flag = 1;
503 }
504 for (j = 0; j < ARRAY_SIZE(fetch_actuator); j++) {
505 if (!fetch_actuator[j].flag)
506 continue;
507 sprintf(property, "%s%d_%s", act->name,
508 i, fetch_actuator[j].sub);
509 fetch_actuator[j].fun(act,
510 property, sensors);
511 }
512 }
513 }
514
515 if (!sensors->act_separate) {
516 sensors->act_bus_sel = sensors->sensor_bus_sel;
517 sensors->act_bus_type = sensors->sensor_bus_type;
518 }
519 #else
520 module->act_used = 0;
521 #endif
522
523 #ifdef CONFIG_FLASH_MODULE
524 /*get flash node */
525 sprintf(property, "%s", "flash_handle");
526 list = of_get_property(cam, property, &size);
527 if ((!list) || (size == 0)) {
528 vin_log(VIN_LOG_CONFIG, "missing %s property in node %s\n",
529 property, cam->name);
530 module->flash_used = 0;
531 } else {
532 struct device_node *flash = of_find_node_by_phandle(be32_to_cpup(list));
533 if (!flash) {
534 vin_warn("%s invalid phandle\n", property);
535 } else if (of_device_is_available(flash)) {
536 module->flash_used = 1;
537 for (j = 0; j < ARRAY_SIZE(fetch_flash); j++) {
538 if (!fetch_flash[j].flag)
539 continue;
540
541 sprintf(property, "%s%d_%s", flash->name,
542 i, fetch_flash[j].sub);
543 fetch_flash[j].fun(flash,
544 property, sensors);
545 }
546 get_value_int(flash, "device_id",
547 &module->modules.flash.id);
548 }
549 }
550 #else
551 module->flash_used = 0;
552 #endif
553 sensors->detect_num = 1;
554 }
555
556 for_each_available_child_of_node(parent, child) {
557 if (strcmp(child->name, "vinc"))
558 continue;
559 ret = of_property_read_string(child, "device_type", &device_type);
560 if (ret) {
561 vin_err("%s get sensor device_type failed!\n", __func__);
562 continue;
563 }
564 sscanf(device_type, "vinc%d", &idx);
565 sprintf(property, "%s%d_rear_sensor_sel", child->name, idx);
566 if (get_value_int(child, property, &i))
567 i = 0;
568 module = &vind->modules[i];
569 sensors = &module->sensors;
570 sprintf(property, "%s%d_csi_sel", child->name, idx);
571 get_value_int(child, property, &sensors->csi_sel);
572
573 if (sensors->use_sensor_list == 0xff) {
574 sprintf(property, "%s%d_sensor_list", child->name, idx);
575 get_value_int(child, property, &sensors->use_sensor_list);
576 #ifndef CONFIG_SENSOR_LIST_MODULE
577 sensors->use_sensor_list = 0;
578 #endif
579 }
580 if (sensors->use_sensor_list == 1) {
581 if (!strcmp(sensors->sensor_pos, ""))
582 strcpy(sensors->sensor_pos, "rear");
583 sensor_list_get_parms(sensors, sensors->sensor_pos);
584 }
585
586 sprintf(property, "%s%d_front_sensor_sel", child->name, idx);
587 if (get_value_int(child, property, &i))
588 i = 1;
589 module = &vind->modules[i];
590 sensors = &module->sensors;
591 sprintf(property, "%s%d_csi_sel", child->name, idx);
592 get_value_int(child, property, &sensors->csi_sel);
593
594 if (sensors->use_sensor_list == 0xff) {
595 sprintf(property, "%s%d_sensor_list", child->name, idx);
596 get_value_int(child, property, &sensors->use_sensor_list);
597 #ifndef CONFIG_SENSOR_LIST_MODULE
598 sensors->use_sensor_list = 0;
599 #endif
600 }
601 if (sensors->use_sensor_list == 1) {
602 if (!strcmp(sensors->sensor_pos, ""))
603 strcpy(sensors->sensor_pos, "front");
604 sensor_list_get_parms(sensors, sensors->sensor_pos);
605 }
606 }
607 #endif
608 return 0;
609 }
610
611