Main branch on MSM897x

Camera main() function is in server.c, which will be compiled as mm-qcamera-daemon and locate in “/system/bin/” directory.

  /* 2. after open node, initialize modules */

  if(server_process_module_init() == FALSE)

goto module_init_fail;

“server_process_module_init” which is defined in server_process.c, will call init_mod,

temp = modules_list[i].init_mod(modules_list[i].name);

“modules_list[]” definition,

static mct_module_init_name_t modules_list[] = {

  {"sensor", module_sensor_init,   module_sensor_deinit},

Then jump to module_sensor.c, “module_sensor_init” call “sensor_init_probe” as below,

  /* module_sensor_probe_sensors */

  ret = sensor_init_probe(module_ctrl);

I’ve mentioned “sensor_init_probe” previously and it will construct one of the two sensors which is called “imx214”. But what about another “imx214_R”? the function will call “module_sensor_find_sensor_subdev” and find it with difference style.

  /* Fill all detected sensors */

  module_sensor_find_sensor_subdev(module_ctrl);

In “module_sensor_find_sensor_subdev” function, we can see such code,

        cfg.cfgtype = CFG_GET_SENSOR_INFO;

        rc = ioctl(sd_fd, VIDIOC_MSM_SENSOR_CFG, &cfg);

jump to msm_sensor.c through ioctl system call, we find the destination, “msm_sensor_config” function.

         switch (cdata->cfgtype) {

         case CFG_GET_SENSOR_INFO:

                   memcpy(cdata->cfg.sensor_info.sensor_name,

                            s_ctrl->sensordata->sensor_name,

                            sizeof(cdata->cfg.sensor_info.sensor_name));

It is very important because the other camera’s name will return to user space which name is “imx214_R”, we must remember this name so that we can know how and why imx214_R library still be loaded in somewhere.

Come back to “module_sensor_init” function, after call “module_sensor_find_sensor_subdev”, it will continuously call “port_sensor_create” function,

/* Create ports based on CID info */

  ret = mct_list_traverse(module_ctrl->sensor_bundle, port_sensor_create,

s_module);

jump to port_sensor.c, we can find that “port_sensor_create” will load given library by sensor’s name,

  sensor_lib_params = s_bundle->sensor_lib_params;

  rc = sensor_load_library(s_bundle->sensor_info->sensor_name,

Two back cameras are loaded by two difference method, it is funny, isn’t it?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值