The following sections will explain the steps to integrate the new Camera Sensor.
Build Config
In the following sections <Sensor_Name> and <Vendor_Name> should be replaced of actual value.
1.1.1 Build Platform-specific files
1> Build platform_<Sensor_Name>.h and platform_<Sensor_Name>.c under directory of
kernel/arch/x86/platform/intel-mid/device_libs/ |
Note: You can reference existing sensor files in the same directory to code the two files if do not know how to code.
2> Modify kernel/arch/x86/platform/intel-mid/device_libs/Makefile, and add below red content:
…… ifdef CONFIG_VIDEO_ATOMISP obj-$(subst m,y,$(CONFIG_VIDEO_<Sensor_Name>)) += platform_<Sensor_Name>.o …… Endif …… |
3> Modify kernel/arch/x86/configs/i386_ctp_defconfig as below:
CONFIG_VIDEO_<Sensor_Name>=m |
4> Modify kernel/arch/x86/platform/intel-mid/device_libs/platform_camera.c
…… …… i2c_info.irq = ((pentry->irq == (u8)0xff) ? 0 : pentry->irq); if (!strcmp(i2c_info.type, “<Sensor_Name>”)){ i2c_info.addr = 0x53; } pr_info(“I2C bus = %d, name = %16.16s, “ …… …... |
Note:0x53 should be replaced of actual value.
5> Modify kernel/arch/x86/platform/intel-mid/device_libs/platform_clv_regulator.c
static struct regulator_consumer_supply vprog1_consumer[] = { REGULATOR_SUPPLY(“vprog1”, “4-0048”), … REGULATOR_SUPPLY(“vprog1”, “4-0010”), } |
Note:
There are two regulator_consumer_supply variables (vprog1_consume & vprog2_consume).
The 1st parameter value(vprog1 or vprog2) is depend on which regulator_consumer_supply variable you choose.( vprog1_consume recommend)
The 2nd parameter( VCC, Volt Current Condenser) value is depend on the camera and limit on Intel platform.
1.1.2 Build Sensor driver files
1> Build the vendor sensor driver files <Sensor_Name>.h & <Sensor_Name>.c
under kernel/drivers/media/video/ and code for the sensor driver by yourself.
Note: You can reference existing sensor files to code the two files if do not know how to code.
2> Modify Kconfig and Makefile under the kernel/drivers/media/video/ . Add your sensor info to the configuration:
file Kconfig: config VIDEO_<Sensor_Name> tristate “<Vendor_Name> <Sensor_Name> sensor support” depends on I2C && VIDEO_V4L2 ---help--- This is a Video4Linux2 sensor-level driver for the Micron <Sensor_Name> 0.3 Mpixel camera. <Sensor_Name> is video camera sensor. It currently only works with the atomisp driver. |
Note: 0.3 should be replaced of actual value.
File Makefile: … … # All i2c modules must come first: … … obj-$(CONFIG_VIDEO_<Sensor_Name>) += <Sensor_Name>.o CFFLAGS_<Sensor_Name>.o = -Werror … … |
Enable Config
1.1.3 Config board
1> Modify kernel/arch/x86/platform/intel-mid/board.c, and add below content:
#include "device_libs/platform_<Sensor_Name>.h" |
… static void __init *no_platform_data(void *info) { return NULL; } const struct intel_v4l2_subdev_id v4l2_ids[] = { {"<Sensor_Name>", RAW_CAMERA, ATOMISP_CAMERA_PORT_PRIMARY}, {}, }; struct devs_id __initconst device_ids[] = { … |
Note:There are alternative RAW_CAMERA/SOC_CAMERA for 2nd parameter
and ATOMISP_CAMERA_PORT_PRIMARY/ATOMISP_CAMERA_PORT_SECONDARY for 3rd parameter.
ATOMISP_CAMERA_PORT_PRIMARY/SECONDARY indicate that the camera is main camera(rear camera) or secondary camera(front camera).
RAW_CAMERA means that the camera chip would directly output raw data and intel cpu process the raw data.
SOC_CAMERA means that the camera chip would process raw data by itself and output YUV format data.
struct devs_id __initconst device_ids[] = { ... {"<Sensor_Name>", SFI_DEV_TYPE_I2C, 0, &<Sensor_Name>_platform_data, &intel_ignore_i2c_device_register}, ... |
1.1.4 Config Sensor in firmware SFI
You need to tell Intel firmware engineer of the camera sensor name (must be lower case) and i2c address 0x53(7 bit address, the additional R/W bit is not count into that.), camera located i2c bus number (here is 4, it could be other number like 5 or 3 depends on hardware connection.)
1> Intel firmware engineer will release a new firmware with the camera setting of customer platform, like below:
19: I2C 4 0036 FF 400000 <Sensor_Name>
Some camera GPIO configuration will also be reflected in the firmware SFI table, like below:
24: penwell_gpio_0 0024 camera_half
25: penwell_gpio_0 0025 camera_full
26: penwell_gpio_0 0026 Cam0_vcm_2p8
46: penwell_gpio_1 00B1 camera_0_reset
47: penwell_gpio_1 00B0 camera_1_power
48: penwell_gpio_1 00B2 camera_1_reset