高通camera学习笔记概述(一二三四五) http://www.cnblogs.com/potato-coffee/p/4172009.html
android camera 预览 app到hal http://blog.csdn.net/tankai19880619/article/details/22795217
电路图,时序图,移植,介绍参数 移植时用 http://www.cnblogs.com/thjfk/p/4086001.html
简单的移植 http://blog.csdn.net/u013531497/article/details/18737111
从上到下,特别全 代码注释很全 http://www.cnblogs.com/joseph-linux/p/3515151.html
音圈马达VCM(Voice Coil Motor)、陶瓷马达(Piezo Motor)、步进马达(Stepper Motor)。
高通自带camera app 相关功能开关
exif相关 getExifData
hardware/qcom/camera/QCamera2/stack/mm-jpeg-interface/src$ vi mm_jpeg_exif.cpackages/apps/Camera2$ vi AndroidManifest.xml
fh file handle
vb video buff
sd sub dev
digital video port (DVP)
AEC,即Automatic Exposure Control
ds_fd: domain socket file descriptor
manual exposure
OIS,它的全称是Optical Image Stabilization,从字面理解就是稳定的光学图象
OIS是松下公司数码相机中光学防抖的标志,佳能称为IS,尼康称为VR,适马称为OS,腾龙称为VC
MSM:Mobile Station Modem 的简写,包含基带的智能机处理器。
APQ:Application Processor Qualcomm 的简写,不集成基带的处理器。
LSC Lens Shading Correction
msm_sensor_init_subdev_ioctl
msm_sensor_driver_cmd
msm_sensor_driver_probe
rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
server.c
main()
module_sensor_init
module_sensor_find_sensor_subdev
cfg.cfgtype = CFG_GET_SENSOR_INFO;
rc = ioctl(sd_fd, VIDIOC_MSM_SENSOR_CFG, &cfg);
msm_sensor_config(CFG_GET_SENSOR_INFO)
module_sensor_find_other_subdev
rc = ioctl(sd_fd, VIDIOC_MSM_SENSOR_GET_SUBDEV_ID, &subdev_id);
msm_csiphy_subdev_ioctl(VIDIOC_MSM_SENSOR_GET_SUBDEV_ID)
rc = ioctl(sd_fd, VIDIOC_MSM_SENSOR_GET_SUBDEV_ID, &subdev_id);
msm_csid_subdev_ioctl(VIDIOC_MSM_SENSOR_GET_SUBDEV_ID)
rc = ioctl(sd_fd, VIDIOC_MSM_SENSOR_GET_SUBDEV_ID, &subdev_id);
msm_led_flash_subdev_ioctl()
msm_csid_subdev_ioctl(VIDIOC_MSM_CSID_IO_CFG)
msm_csid_cmd(CSID_INIT)
msm_csid_cmd(CSID_RELEASE)
msm.c
probe 创建dev/videoX
drivers/media/platform/msm/camera_v2/sensor/msm_sensor_driver.c
/*
* Create /dev/videoX node, comment for now until dummy /dev/videoX
* node is created and used by HAL
*/
if (s_ctrl->sensor_device_type == MSM_CAMERA_PLATFORM_DEVICE)
rc = msm_sensor_driver_create_v4l_subdev(s_ctrl);
else
rc = msm_sensor_driver_create_i2c_v4l_subdev(s_ctrl);
if (rc < 0) {
pr_err("failed: camera creat v4l2 rc %d", rc);
goto camera_power_down;
}
msm_sd_register
__msm_sd_register_subdev
__video_register_device
mm-camera/apps/v4l2-qcamera-app/v4l2-qcamera-app.c
main
snprintf(camera_dev_node, BUFF_SIZE_64, "/dev/video%d", camera_id);
eventfd = open(camera_dev_node,O_RDWR | O_NONBLOCK);
camera_v4l2_open
msm_create_session
camera_pack_event(filep, MSM_CAMERA_NEW_SESSION, 0, -1, &event);
rc = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
server.c
main
if (event.id == MSM_CAMERA_NEW_SESSION) {
proc_ret = server_process_hal_event(&event);
server_process_hal_event
switch (proc_ret.result) {
case RESULT_NEW_SESSION: {
case SERV_RET_TO_HAL_CMDACK:
ioctl(hal_fd->fd[0], MSM_CAM_V4L2_IOCTL_CMD_ACK,
msm_private_ioctl
case MSM_CAM_V4L2_IOCTL_CMD_ACK: {
rc = camera_check_event_status(&event);
回到eventfd = open(camera_dev_node,O_RDWR | O_NONBLOCK);
0413:
1.理解dtsi,sensor和sensorlib中参数的意义
dtsi 参考Documentation/devicetree/bindings/media/video/msm-cci.txt
ov7695.c 结构体 struct msm_sensor_ctrl_t
ov7695_lib.c 结构体 sensor_lib_t
2.找到上电初始化code,学会修改
上电2条线:
1. camera drvier
ov7695.c ov7695_platform_probe--->msm_sensor_platform_probe-->rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
msm_ov7695_i2c_probe-->msm_sensor_i2c_probe-->rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
2.ioctl
msm_sensor_init_subdev_ioctl->msm_sensor_driver_cmd-->msm_sensor_driver_probe-->rc = s_ctrl->func_tbl->sensor_power_up(s_ctrl);
hardware:mm_camera_interface.c
get_num_of_cameras()
if (ioctl(sd_fd, VIDIOC_MSM_SENSOR_INIT_CFG, &cfg) < 0)
vendor sensor.c main()
server_process_module_init-->module_sensor_init-->sensor_init_probe->sensor_probe-->CFG_SINIT_PROBE if (LOG_IOCTL(fd, VIDIOC_MSM_SENSOR_INIT_CFG, &cfg) < 0) {
msm_sensor_ctrl_t中包含msm_sensor_power_setting(power_setting)的地方:
struct msm_sensor_power_setting {
enum msm_sensor_power_seq_type_t seq_type;
uint16_t seq_val;
long config_val;
uint16_t delay;
void *data[10];
};
3.msm_sensor_config
msm_camera_sensor_board_info(sensordata)-->msm_camera_power_ctrl_t(power_info)-->msm_sensor_power_setting(power_setting)
-->msm_camera_sensor_slave_info(cam_slave_info)-->msm_sensor_power_setting_array(power_setting_array)-->msm_sensor_power_setting (power_setting)
msm_sensor_power_setting_array(power_setting_array)-->msm_sensor_power_setting(power_setting)
上电时序就是:
qcom,cam-power-seq-type
open 流程:-=========================================
http://blog.csdn.net/discovery_by_joseph/article/details/40434127?utm_source=tuicool&utm_medium=referral
=============================framework==================================
Camera.java public static Camera open(int cameraId) --> Camera --> cameraInitNormal --> cameraInitVersion -->native_setup
通过android_hardware_Camera.cpp JNINativeMethod camMethods --> android_hardware_Camera_native_setup -->Camera::connect
怎么映射过来的?
Camera.cpp sp<Camera> Camera::connect
CameraManager.java openCamera --> openCameraDeviceUserAsync
connectDevice
CameraService.cpp connectFinishUnsafe
CameraHardwareInterface.h initialize rc = CameraService::filterOpenErrorCode(module->methods->open()
========================hardware=================================log
QCamera2HWI.cpp QCamera2HardwareInterface::openCamera(struct hw_device_t **hw_device)
=========================kernel=========================open()
v4l2_open
vdev->fops->open(filp);
camera_v4l2_open
camera_pack_event(filep, MSM_CAMERA_NEW_SESSION, 0, -1, &event);
rc = msm_post_event(&event, MSM_POST_EVT_TIMEOUT);
=========================server=========================main()
server_process_hal_event(MSM_CAMERA_NEW_SESSION)
=========================MCT=========================
mct_controller_new
mct_pipeline_start_session
mct_pipeline_modules_start
mct_pipeline_start_session_thread
if (module->start_session) {
rc = module->start_session(module, session_id);
=========================vendor driver=========================
module_sensor_start_session
module_sensor_init_session
rc = module_sensor_params->func_tbl.process(module_sensor_params->sub_module_private,SENSOR_INIT, NULL);
sensor_process(SENSOR_INIT)
rc = sensor_init(sctrl);
sensor_power_up
cfg.cfgtype = CFG_POWER_UP;
if (LOG_IOCTL(ctrl->s_data->fd, VIDIOC_MSM_SENSOR_CFG, &cfg) < 0) {
=========================kernel=========================open()
msm_sensor_subdev_ioctl(VIDIOC_MSM_SENSOR_CFG,CFG_POWER_UP)
ov7695_sensor_config
msm_sensor_power_up
end
system/lib/hw/camera.msm8974.so
0414:
熟悉几种工作模式:
1.预览
2.自动对焦
3.拍照
video_register_device 创建dev/videoX
0415:
数据流:从camera获取数据上传
打开camera QCamera2HWI.cpp QCamera2HardwareInterface::openCamera(struct hw_device_t **hw_device)
0418:
参照下面的文章学习camera打开流程
http://wenku.baidu.com/link?url=1kju8IrcWahLI92LhNDwKRtJvPWJ8v9WW2GWbbrwmqII_YCR0hpb9m4fwu3ZUsH6rhPK_CqSxjoAHnChfiTr_hj1oLMfu9Ot5vqVwqeF1MC
preview http://blog.csdn.net/dnfchan/article/details/7602213
19:45
来源:oschina
链接:https://my.oschina.net/u/920274/blog/3079277