|
发表于 2020-6-15 11:54:41
7080 浏览 0 回复
MTk android9.0 camera 前后摄使用相同摄像头
mtk android 9.0 camera kernel4.9和以前做了较大改动 特别是上电这一块做了高度集成, 在我们使用前后摄像头相同的情况话有可能会出现前摄像头识别成了后摄像头的情况,导致前摄的lens也误判为后摄的,但是在代码中有集成这块代码,通过宏来做区分具体代码如下:
在imgsensor_hw.c中
#if defined(CONFIG_IMGSENSOR_MAIN) || \
defined(CONFIG_IMGSENSOR_SUB) || \
defined(CONFIG_IMGSENSOR_MAIN2) || \
defined(CONFIG_IMGSENSOR_SUB2) || \
defined(CONFIG_IMGSENSOR_MAIN3)
char *pcustomize_sensor = NULL;
#endif
#if defined(CONFIG_IMGSENSOR_MAIN) || \
defined(CONFIG_IMGSENSOR_SUB) || \
defined(CONFIG_IMGSENSOR_MAIN2) || \
defined(CONFIG_IMGSENSOR_SUB2) || \
defined(CONFIG_IMGSENSOR_MAIN3)
if (curr_sensor_name == NULL)
return IMGSENSOR_RETURN_ERROR;
switch (sensor_idx) {
#ifdef CONFIG_IMGSENSOR_MAIN
case IMGSENSOR_SENSOR_IDX_MAIN:
pcustomize_sensor = IMGSENSOR_STRINGIZE(CONFIG_IMGSENSOR_MAIN);
printk("CONFIG_IMGSENSOR_MAIN pcustomize_sensor=%s\n",pcustomize_sensor);
break;
#endif
#ifdef CONFIG_IMGSENSOR_SUB
case IMGSENSOR_SENSOR_IDX_SUB:
pcustomize_sensor = IMGSENSOR_STRINGIZE(CONFIG_IMGSENSOR_SUB);
printk("CONFIG_IMGSENSOR_SUB pcustomize_sensor=%s\n",pcustomize_sensor);
break;
#endif
#ifdef CONFIG_IMGSENSOR_MAIN2
case IMGSENSOR_SENSOR_IDX_MAIN2:
pcustomize_sensor = IMGSENSOR_STRINGIZE(CONFIG_IMGSENSOR_MAIN2);
break;
#endif
#ifdef CONFIG_IMGSENSOR_SUB2
case IMGSENSOR_SENSOR_IDX_SUB2:
pcustomize_sensor = IMGSENSOR_STRINGIZE(CONFIG_IMGSENSOR_SUB2);
break;
#endif
#ifdef CONFIG_IMGSENSOR_MAIN3
case IMGSENSOR_SENSOR_IDX_MAIN3:
pcustomize_sensor = IMGSENSOR_STRINGIZE(CONFIG_IMGSENSOR_MAIN3);
break;
#endif
default:
break;
}
if (pcustomize_sensor != NULL &&
strlen(pcustomize_sensor) > 2 &&
!strstr(pcustomize_sensor, curr_sensor_name))
return IMGSENSOR_RETURN_ERROR;
#else
if (curr_sensor_name == NULL)
return IMGSENSOR_RETURN_ERROR;
#endif
该宏的配置在kernel-4.9\drivers\misc\mediatek\imgsensor\src\kconfig中我们只需要在kernel-4.9\arch\arm\configs或者 kernel-4.9\arch64\arm\configs
中对应的平台配置
#CONFIG_SPECIFY_IMGSENSOR=y
#CONFIG_IMGSENSOR_MAIN="imx214_mipi_raw"
#CONFIG_IMGSENSOR_SUB="imx214sub_mipi_raw"
指定前后摄类型
这样修改存在一个问题 ,就是无法兼容多个摄像头。
|
|
|
|
|
|
|
登录或注册
|