1. Camera
Reference Documentation:
1) 80-na157-22_presentation-msm8974-apq8074-msm8x26-apq8084 LINUX CAMERA overview.pdf
2) 80-ne717-1_msm8974-apq8074-msm8x26 LINUX CAMERA software DESIGN document.pdf
3) 80-nu323-2_multimedia Driver development and Bringup Guide-camera.pdf
4) 80-nl239-33_linux CAMERA debugging Guide.pdf
Kernel Drive
1) Add DTS Configuration \8x16\kernel\arch\arm64\boot\dts\qcom .....
qcom,camera@5a {//back camera
compatible = "samsung,s5k3m2";
Reg = <0x5a>;
Qcom,slave-id = <0x5a 0x0000 0x30d2>;
Qcom,csiphy-sd-index = <0>;
Qcom,csid-sd-index = <0>;
Qcom,mount-angle = <90>;
Qcom,sensor-name = "s5k3m2_f13s01k";
QCOM,ACTUATOR-SRC = <&actuator0>;
QCOM,LED-FLASH-SRC = <&led_flash0>;
Cam_vdig-supply = <&pm8941_l3>;
Cam_vana-supply = <&pm8941_l17>;
Cam_vio-supply = <&pm8941_lvs2>;
Cam_vaf-supply = <&pm8941_l23>;
Qcom,cam-vreg-name = "Cam_vdig", "Cam_vio", "Cam_vana",
"CAM_VAF";
Qcom,cam-vreg-type = <0 1 0 0>;
Qcom,cam-vreg-min-voltage = <1225000 0 2850000 3000000>;
Qcom,cam-vreg-max-voltage = <1225000 0 2850000 3000000>;
Qcom,cam-vreg-op-mode = <105000 0 80000 100000>;
Qcom,gpio-no-mux = <0>;
Gpios = <&msmgpio-0>
<&msmgpio 0>;
Qcom,gpio-reset = <1>;
Qcom,gpio-req-tbl-num = <0 1>;
Qcom,gpio-req-tbl-flags = <1 0>;
Qcom,gpio-req-tbl-label = "CAMIF_MCLK",
"Cam_reset1";
Qcom,gpio-set-tbl-num = <1 1>;
Qcom,gpio-set-tbl-flags = <0 2>;
Qcom,gpio-set-tbl-delay = <1 1000>;
Qcom,csi-lane-assign = <0x4320>;
Qcom,csi-lane-mask = <0x1F>;
Qcom,sensor-position = <0>;
Qcom,sensor-mode = <0>;
Qcom,cci-master = <0>;
};
2) Add driver files
Kernel/drivers/media/platform/msm/camera_v2/sensor
Copy the driver file of an original camera and rename it, for example ov8865.c to s5k3l2.c. Open s5k3l2.c, the inside of the ov8865 changed to S5k3l2, OV8865 changed to S5K3L2.
Add obj-$ (CONFIG_S5K3L2) + + S5K3L2.O in makefile
What needs to be changed in the s5k3l2.c is the power-up sequence, which needs to be configured according to the schematic diagram
static struct msm_sensor_power_setting s5k3l2_power_setting[] = {
{
. Seq_type = Sensor_vreg,
. Seq_val = Cam_vio,
. Config_val = 0,
. Delay = 1,
},
{
. Seq_type = Sensor_vreg,
. Seq_val = Cam_vana,
. Config_val = 0,
. Delay = 1,
},
{
. Seq_type = Sensor_vreg,
. Seq_val = Cam_vdig,
. Config_val = 0,
. Delay = 1,
},
{
. Seq_type = Sensor_vreg,
. Seq_val = CAM_VAF,
. Config_val = 0,
. Delay = 5,
},
{
. Seq_type = Sensor_gpio,
. Seq_val = Sensor_gpio_standby,
. Config_val = Gpio_out_low,
. Delay = 1,
},
{
. Seq_type = Sensor_gpio,
. Seq_val = Sensor_gpio_reset,
. Config_val = Gpio_out_low,
. Delay = 5,
},
{
. Seq_type = Sensor_gpio,
. Seq_val = SENSOR_GPIO_AF_PWDM,
. Config_val = Gpio_out_low,
. Delay = 5,
},
{
. Seq_type = Sensor_gpio,
. Seq_val = Sensor_gpio_standby,
. Config_val = Gpio_out_high,
. Delay = 5,
},
{
. Seq_type = Sensor_gpio,
. Seq_val = Sensor_gpio_reset,
. Config_val = Gpio_out_high,
. Delay = 10,
},
{
. Seq_type = Sensor_gpio,
. Seq_val = SENSOR_GPIO_AF_PWDM,
. Config_val = Gpio_out_high,
. Delay = 5,
},
{
. Seq_type = SENSOR_CLK,
. Seq_val = SENSOR_CAM_MCLK,
. Config_val = 24000000,
. Delay = 10,
},
{
. Seq_type = Sensor_i2c_mux,
. Seq_val = 0,
. Config_val = 0,
. Delay = 0,
},
};
3) Commissioning
In file: kernel/drivers/media/platform/msm/camera_v2/sensor/msm_sensor.c
Open this macro: #define Config_msmb_camera_debug
Check kernel log at boot time
CDBG ("%s:read ID:%x expected ID%x:\n",func, Chipid,
SLAVE_INFO->SENSOR_ID);
See if the I²C communication with the camera is successful.
4.3.3. User space Driver
1) Add code
vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/sensor_libs/Add a drive folder S5k3l2, There are two files in it: Android.mk and S5K3L2_LIB.C
In general Qualcomm will provide the driver, the module factory will also provide the corresponding driver.
Add the driver, compile it into so, and push it into the phone. or the entire compilation into a system.img, swipe into the phone.
Sometimes, we find that the camera app's icon is not found in the system. This is due to the first boot of the system when the rear-kernel driver is not ready.
How to resolve:
After the ➢kernel drive is debugged, re-brush the userdata.img. Let the system reinitialize.
The name of the ➢ADB Shell am start-n Com.android.camera/com.android.camera.camera Package and activity needs to match the app on the phone, not necessarily the name above.
Install other camera applications.
2) Commissioning
Open the camera app and see if the image Preview is successful. If unsuccessful, debugging is required.
Open the debug switch in the code.
Vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/sensors/sensor.c
#define SLOW SERR
SLOW ("Lib_name%s", lib_name); You can see if the correct library is being called.
➢lane Configuration
Qcom,csi-lane-assign = <0x4320>; This is the value of platform 8974, other platforms are not the same
Qcom,csi-lane-mask = <0x1F>; 0x1F for 4lane, 0x7 for 2 Lane, 0x3 for 1 lane
This configuration is different for each platform.
In most cases, the basic is tuned in here, you can preview it. If it is not adjustable, there may be a problem with the module hardware, need to and module factory a jump.
3) Create a LIB.C file from scratch
In some cases, if the driver file is not available, you need to write your own LIB.C based on the chip manufacturer's data sheet and Qualcomm documentation.
4.3.4. Flash
This is the system diagram comes with a flash configuration
qcom,leds@d300 {
Status = "Okay";
Pm8941_flash0:qcom,flash_0 {
Qcom,max-current = <1000>;
Qcom,default-state = "Off";
Qcom,headroom = <3>;
Qcom,duration = <1280>;
Qcom,clamp-curr = <200>;
qcom,startup-dly = <3>;
Qcom,safety-timer;
label = "Flash";
Linux,default-trigger =
"Flash0_trigger";
Qcom,id = <1>;
Linux,name = "Led:flash_0";
Qcom,current = <625>;
};
Use the camera when the configuration file is added to the line.
QCOM,LED-FLASH-SRC = <&led_flash0>;
To autofocus motor
Kernel inside the driver is the same, the main changes in the user space
Vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/actuator_libs
Vendor/qcom/proprietary/mm-camera/mm-camera2/media-controller/modules/sensors/actuators
Tuning
Motor, flash, photo effects are to be tuning. But it needs a lab environment to do it.
Note: Adding too much log to the motor's core drive may cause the motor to fail to focus properly.