1. Home
  2. Software Development for MediaTek X20
  3. Camera Porting Guide
  4. 6.ADD A NEW CAMERA FLOW

6.ADD A NEW CAMERA FLOW

6.1 Configure camera sensor hal driver in ProjectConfig.mk

file path device\mediatek\$project\ProjectConfig.mk

example:

CUSTOM_HAL_IMGSENSOR = ov23850_mipi_raw

CUSTOM_HAL_MAIN_IMGSENSOR = ov23850_mipi_raw

6.2 Add camera sensor kernel driver project config (<project>_defconfig)

file path : alps\<kernel>\arch\arm64\configs\<project>_debug_defconfig

example:

–CONFIG_CUSTOM_KERNEL_IMGSENSOR=” ov23850_mipi_raw s5k3m2_mipi_raw s5k5e2ya_mipi_raw imx258_mipi_raw imx377_mipi_raw s5k2x8_mipi_raw CUSTOM_HAL_MAIN_IMGSENSOR = ov23850_mipi“

use menuconfig with console to modify xxx_defconfig

6.3. Add camera sensor kernel driver code to the corresponding path

[By project]

kernel-3.18/drivers/misc/mediatek/mach/mt6755/<project>/ imgsensor/

[By Platform]

kernel-3.18/drivers/misc/mediatek/imgsensor/src/<platform>/

Must modify the corresponding makefile

6.3.1  Add image sensor kernel driver folder

[By project]

kernel-3.18/drivers/misc/mediatek/mach/mt6797/<project>/ imgsensor/Makefile (if it exsit)

Example:

 Add the following items

obj-y += imgsensor/ov23850_mipi_raw/

[By platform]

If the image sensor driver doesn’t exist in the ,Project- directory , build system will proceed to search the driver in {platform} directory. Do not need to modify the makefile.

kernel-3.18\drivers\misc\mediatek\imgsensor\src\<platform>\Makefile .

6.3.2 Add camera sensor kernel driver code to the corresponding path

[By project]

kernel-3.18/drivers/misc/mediatek/mach/mt6797/<project>/ imgsensor/

[By Platform]

kernel-3.18/drivers/misc/mediatek/imgsensor/src/<platform>/

Must modify the corresponding makefile

link you image sensor compiled object

Example: obj-y += ov23850_mipi_raw.o

[By project]

alps/kernel-3.18/drivers/misc/mediatek/mach/mt6755/<project>/ imgsensor/xxxx/Makefile (if it exsit)

[By platform]

alps\<kernel>\drivers\misc\mediatek\imgsensor\src\<platform>\Makefile

6.3.3 Modify other related files

1 .Makefile

– ProjectConfig.mk xxx_defconfig

– Kernel xxx_defconfig

2 .imgsensor

– CUSTOM_HAL_IMGSENSOR = xxxxxx_xxx

– CUSTOM_KERNEL_IMGSENSOR = xxxxxx_xxx

– CUSTOM_HAL_SUB_IMGSENSOR = xxxxxx_xxx

– CUSTOM_HAL_MAIN_IMGSENSOR = xxxxxx_xxx

– CUSTOM_KERNEL_MAIN_IMGSENSOR = xxxxxx_xxx=

– CUSTOM_KERNEL_SUB_IMGSENSOR = xxxxxx_xxx

CUSTOM_HAL_IMGSENSOR& CUSTOM_KERNEL_IMGSENSOR mainsub sensor

CUSTOM_HAL_MAIN_IMGSENSOR& CUSTOM_KERNEL_MAIN_IMGSENSOR main sensor

CUSTOM_HAL_SUB_IMGSENSOR& CUSTOM_KERNEL_SUB_IMGSENSOR sub sensor

3 .camera

– # lens port sensor dummy AF sensormain or sub module AF IC

– CUSTOM_HAL_LENS = dummy_lens

– CUSTOM_KERNEL_LENS = dummy_lens

– CUSTOM_HAL_MAIN_LENS = dummy_lens

– CUSTOM_HAL_SUB_LENS =

– CUSTOM_KERNEL_MAIN_LENS = dummy_lens

– CUSTOM_KERNEL_SUB_LENS =

– #Flashlight port sensor dummy constant_flashlight

– CUSTOM_KERNEL_FLASHLIGHT=dummy_flashlight

– CUSTOM_HAL_FLASHLIGHT=dummy_flashlight

– #OTPRAW sensorport sensor dummy, OTP driver

– CUSTOM_KERNEL_CAM_CAL=dummy_eeprom

– CUSTOM_HAL_CAM_CAL=dummy_eeprom

– CUSTOM_KERNEL_EEPROM=dummy_eeprom

– CUSTOM_HAL_EEPROM=dummy_eeprom

4.Image Sensor

– kd_imgsensor.h

  • #define XXXXXX_SENSOR_ID 0xFFFF

– sensor ID

  • #define SENSOR_DRVNAME_XXXXXX_YUV “xxxxxxxxx“ //YUV sensor
  • #define SENSOR_DRVNAME_XXXXXX_RAW “xxxxxxxxx“ //RAW sensor

– sensor part no YUV or raw

» xxxxxxmipiraw

– kd_sensorlist.h

  • RAW sensor
  • UINT32 XXXXXX_RAW_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);
  • kdSensorList[]

– #if defined(XXXXXX_RAW)

– {XXXXXX_SENSOR_ID, SENSOR_DRVNAME_XXXXXX_RAW, XXXXXX_RAW_SensorInit},

– #endif

  • YUV sensor
  • UINT32 XXXXXX_YUV_SensorInit(PSENSOR_FUNCTION_STRUCT *pfFunc);
  • kdSensorList[]

– #if defined(XXXXXX_YUV)

– {XXXXXX_SENSOR_ID, SENSOR_DRVNAME_XXXXXX_YUV, XXXXXX_YUV_SensorInit},

– #endif

– sensorlist.cpp

  • SensorList[]

– #if defined(XXXXXX_RAW)

– RAW_INFO(XXXXXX_SENSOR_ID, SENSOR_DRVNAME_XXXXXX_RAW, NULL),

– #endif

– #if defined(XXXXXX_YUV)

– YUV_INFO(XXXXXX_SENSOR_ID, SENSOR_DRVNAME_XXXXXX_YUV, NULL),

– #endif

– sensorkdSensorList[]SensorList[]resolution

Was this article helpful to you? Yes No

How can we help?