您尚未登录。

楼主 #1 2019-10-30 17:04:11

augyy
会员
注册时间: 2019-01-29
已发帖子: 46
积分: 46

請問大家!!全志A33 切換其他摄像头問題.

本人想切換 gc2145 摄像头,同時做以下步驟.但是不成!!

1. 把 gc2145.c 文件放起 \linux-3.4\drivers\media\video\sunxi-vfe\device\
    加 “obj – m += gc2145.o” 起 makefile 檔案

2. 改 sys_config.fex 檔案
FluxBB bbcode

3. 加以下語句起 \linux-3.4\drivers\media\video\sunxi-vfe\sensor_info.c
    Struct sensor_item sensor_list_t [] =
    {"gc2145",0x78,SENSOR_YUV, PIXEL_NUM_2M, CORE_CLK_RATE_FOR_2M},

4. 加以下function 起 \linux-3.4\drivers\media\video\sunxi-vfe\ camera_detector\camera_list.c
#define __GC2145__

static void camera_pwr_on_gc2145(__u32 list_index, __camera_info_t *camera_info)
{
camera_gpio_set_status(camera_info->stby_pin, 1);
camera_gpio_set_status(camera_info->reset_pin, 1);

//power supply
camera_gpio_write(camera_info->stby_pin, camera_list[list_index].CSI_STBY_ON);
camera_gpio_write(camera_info->reset_pin, camera_list[list_index].CSI_RST_ON);
msleep(1);
clk_enable(camera_info->module_clk);
msleep(10);

camera_gpio_write(camera_info->pwr_pin, camera_list[list_index].CSI_PWR_ON);
msleep(10);
if(camera_info->dvdd)
{
  if(camera_info->dvdd_vol > 0)
  {
   regulator_set_voltage(camera_info->dvdd,camera_info->dvdd_vol,camera_info->dvdd_vol);
  }
  else
  {
   list_print("dvdd_vol is NULL!! \n");
  }
  regulator_enable(camera_info->dvdd);
  msleep(10);
}
if(camera_info->avdd)
{
  if(camera_info->dvdd_vol > 0)
  {
   regulator_set_voltage(camera_info->avdd,camera_info->avdd_vol,camera_info->avdd_vol);
  }
  else
  {
   list_print("dvdd_vol is NULL!! \n");
  }
  regulator_enable(camera_info->avdd);
  msleep(10);
}
if(camera_info->iovdd)
{
  if(camera_info->dvdd_vol > 0)
  {
   regulator_set_voltage(camera_info->iovdd,camera_info->iovdd_vol,camera_info->iovdd_vol);
  }
  else
  {
   list_print("dvdd_vol is NULL!! \n");
  }
  regulator_enable(camera_info->iovdd);
  msleep(10);
}
//standby off io
camera_gpio_write(camera_info->stby_pin, camera_list[list_index].CSI_STBY_OFF);
msleep(10);
camera_gpio_write(camera_info->reset_pin, camera_list[list_index].CSI_RST_OFF);
msleep(10);
camera_gpio_write(camera_info->reset_pin, camera_list[list_index].CSI_RST_ON);
msleep(10);
camera_gpio_write(camera_info->reset_pin, camera_list[list_index].CSI_RST_OFF);
msleep(10);
}

static void camera_pwr_off_gc2145(__u32 list_index, __camera_info_t *camera_info)
{
camera_gpio_write(camera_info->stby_pin, camera_list[list_index].CSI_STBY_ON);
    msleep(10);
//reset on io
    camera_gpio_write(camera_info->reset_pin, camera_list[list_index].CSI_RST_ON);
    msleep(10);
    //inactive mclk after power off
    //power supply off
    if(camera_info->iovdd) {
     regulator_disable(camera_info->iovdd);
    }
    if(camera_info->avdd) {
     regulator_disable(camera_info->avdd);
    }
    if(camera_info->dvdd) {
     regulator_disable(camera_info->dvdd);
    }
    camera_gpio_write(camera_info->pwr_pin, camera_list[list_index].CSI_PWR_OFF);
    msleep(10);
    //standby of io
clk_disable(camera_info->module_clk);
    //set the io to hi-z
    camera_gpio_set_status(camera_info->reset_pin, 0);//set the gpio to input
   // camera_gpio_set_status(camera_info->stby_pin, 0);//set the gpio to input
}

static __s32 camera_detect_gc2145(__u32 list_index, struct i2c_adapter *i2c_adap)
{
    char reg_num[1], value[1];
    __s32 ret = 0;
    __u32 i2c_addr = camera_list[list_index].i2c_addr;
    __u32 addr_step = camera_list[list_index].REG_ADDR_STEP;
    __u32 data_step = camera_list[list_index].REG_DATA_STEP;
    list_print("try to detect gc2145 ... \n");
    reg_num[0] = 0xf0;
ret = camera_i2c_read(i2c_adap, reg_num, value, i2c_addr, addr_step, data_step);
if (ret < 0) {
  return ret;
}
if(value[0] !=0x21)
  return -ENODEV;
reg_num[0] = 0xf1;
ret = camera_i2c_read(i2c_adap, reg_num, value, i2c_addr, addr_step, data_step);
if (ret < 0) {
  return ret;
}
  if(value[0] !=0x55)
  return -ENODEV;
list_print("detect gc2145 success!!\n");
  return 0;
}
__camera_list_t camera_list[MAX_CAMERA_LIST_ITEM] = {
   ... ...
    CAMERA_LIST_ITEM_INIT(gc2145, 1, 1, 0x78, 1, 0, 0, 1, 1, 0),
};

5. 改了 linux-3.4\drivers\media\video\sunxi-vfe\ camera_detector\camera_list.h
    #define MAX_CAMERA_LIST_ITEM 26     //在原来的基础上加一

出現以下問題.
VFE_ERR Error registering v4l2 subdevice No such device
VFE_ERR vfe sensor register check error at input_num = 0

FluxBB bbcode

最近编辑记录 augyy (2019-10-30 17:08:28)

离线

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn