本文整理汇总了C++中CDBG函数的典型用法代码示例。如果您正苦于以下问题:C++ CDBG函数的具体用法?C++ CDBG怎么用?C++ CDBG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CDBG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msm_pmem_table_add
static int msm_pmem_table_add(struct hlist_head *ptype,
struct msm_pmem_info *info, struct ion_client *client)
{
unsigned long paddr;
#ifndef CONFIG_MSM_MULTIMEDIA_USE_ION
unsigned long kvstart;
struct file *file;
#endif
int rc = -ENOMEM;
unsigned long len;
struct msm_pmem_region *region;
region = kmalloc(sizeof(struct msm_pmem_region), GFP_KERNEL);
if (!region)
goto out;
#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
region->handle = ion_import_dma_buf(client, info->fd);
if (IS_ERR_OR_NULL(region->handle))
goto out1;
if (ion_map_iommu(client, region->handle, CAMERA_DOMAIN, GEN_POOL,
SZ_4K, 0, &paddr, &len, 0, 0) < 0)
goto out2;
#else
paddr = 0;
file = NULL;
kvstart = 0;
#endif
if (!info->len)
info->len = len;
paddr += info->offset;
len = info->len;
if (check_overlap(ptype, paddr, len) < 0) {
rc = -EINVAL;
goto out3;
}
CDBG("%s: type %d, active flag %d, paddr 0x%lx, vaddr 0x%lx\n",
__func__, info->type, info->active, paddr,
(unsigned long)info->vaddr);
INIT_HLIST_NODE(®ion->list);
region->paddr = paddr;
region->len = len;
memcpy(®ion->info, info, sizeof(region->info));
D("%s Adding region to list with type %d\n", __func__,
region->info.type);
D("%s pmem_stats address is 0x%p\n", __func__, ptype);
hlist_add_head(&(region->list), ptype);
return 0;
out3:
#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
ion_unmap_iommu(client, region->handle, CAMERA_DOMAIN, GEN_POOL);
#endif
#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
out2:
ion_free(client, region->handle);
#endif
out1:
kfree(region);
out:
return rc;
}
示例2: msm_io_w
void msm_io_w(u32 data, void __iomem *addr)
{
CDBG("%s: %08x %08x\n", __func__, (int) (addr), (data));
writel_relaxed((data), (addr));
}
示例3: msm_io_memcpy
void msm_io_memcpy(void __iomem *dest_addr, void __iomem *src_addr, u32 len)
{
CDBG("%s: %p %p %d\n", __func__, dest_addr, src_addr, len);
msm_io_memcpy_toio(dest_addr, src_addr, len / 4);
msm_io_dump(dest_addr, len);
}
示例4: msm_sensor_get_dt_data
static int32_t msm_sensor_get_dt_data(struct device_node *of_node,
struct msm_sensor_ctrl_t *s_ctrl)
{
int32_t rc = 0, i = 0, ret = 0;
struct msm_camera_gpio_conf *gconf = NULL;
struct msm_camera_sensor_board_info *sensordata = NULL;
uint16_t *gpio_array = NULL;
uint16_t gpio_array_size = 0;
uint32_t id_info[3];
s_ctrl->sensordata = kzalloc(sizeof(
struct msm_camera_sensor_board_info),
GFP_KERNEL);
if (!s_ctrl->sensordata) {
pr_err("%s failed %d\n", __func__, __LINE__);
return -ENOMEM;
}
sensordata = s_ctrl->sensordata;
rc = of_property_read_string(of_node, "qcom,sensor-name",
&sensordata->sensor_name);
CDBG("%s qcom,sensor-name %s, rc %d\n", __func__,
sensordata->sensor_name, rc);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto FREE_SENSORDATA;
}
rc = of_property_read_u32(of_node, "qcom,cci-master",
&s_ctrl->cci_i2c_master);
CDBG("%s qcom,cci-master %d, rc %d\n", __func__, s_ctrl->cci_i2c_master,
rc);
if (rc < 0) {
/* Set default master 0 */
s_ctrl->cci_i2c_master = MASTER_0;
rc = 0;
}
rc = msm_sensor_get_sub_module_index(of_node, &sensordata->sensor_info);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto FREE_SENSORDATA;
}
/* Get sensor mount angle */
rc = of_property_read_u32(of_node, "qcom,mount-angle",
&sensordata->sensor_info->sensor_mount_angle);
CDBG("%s qcom,mount-angle %d, rc %d\n", __func__,
sensordata->sensor_info->sensor_mount_angle, rc);
if (rc < 0) {
/* Invalidate mount angle flag */
pr_err("%s Default sensor mount angle %d\n",
__func__, __LINE__);
sensordata->sensor_info->is_mount_angle_valid = 0;
sensordata->sensor_info->sensor_mount_angle = 0;
rc = 0;
} else {
sensordata->sensor_info->is_mount_angle_valid = 1;
}
rc = of_property_read_u32(of_node, "qcom,sensor-position",
&sensordata->sensor_info->position);
CDBG("%s qcom,sensor-position %d, rc %d\n", __func__,
sensordata->sensor_info->position, rc);
if (rc < 0) {
pr_err("%s Default sensor position %d\n", __func__, __LINE__);
sensordata->sensor_info->position = 0;
rc = 0;
}
rc = of_property_read_u32(of_node, "qcom,sensor-mode",
&sensordata->sensor_info->modes_supported);
CDBG("%s qcom,sensor-mode %d, rc %d\n", __func__,
sensordata->sensor_info->modes_supported, rc);
if (rc < 0) {
pr_err("%s Default sensor mode %d\n", __func__, __LINE__);
sensordata->sensor_info->modes_supported = 0;
rc = 0;
}
rc = msm_sensor_get_dt_csi_data(of_node, &sensordata->csi_lane_params);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto FREE_SENSOR_INFO;
}
rc = msm_camera_get_dt_vreg_data(of_node,
&sensordata->power_info.cam_vreg,
&sensordata->power_info.num_vreg);
if (rc < 0)
goto FREE_CSI;
rc = msm_camera_get_dt_power_setting_data(of_node,
sensordata->power_info.cam_vreg,
sensordata->power_info.num_vreg,
&sensordata->power_info);
if (rc < 0) {
//.........这里部分代码省略.........
示例5: mm_camera_stream_util_reg_buf
static int mm_camera_stream_util_reg_buf(mm_camera_obj_t * my_obj,
mm_camera_stream_t *stream,
mm_camera_buf_def_t *vbuf)
{
int32_t i, rc = MM_CAMERA_OK, j;
int *ret;
struct v4l2_requestbuffers bufreq;
int image_type;
uint8_t num_planes;
uint32_t planes[VIDEO_MAX_PLANES];
if(vbuf->num > MM_CAMERA_MAX_NUM_FRAMES) {
rc = -MM_CAMERA_E_GENERAL;
CDBG_ERROR("%s: buf num %d > max limit %d\n",
__func__, vbuf->num, MM_CAMERA_MAX_NUM_FRAMES);
goto end;
}
switch(stream->stream_type) {
case MM_CAMERA_STREAM_PREVIEW:
image_type = OUTPUT_TYPE_P;
break;
case MM_CAMERA_STREAM_SNAPSHOT:
case MM_CAMERA_STREAM_RAW:
image_type = OUTPUT_TYPE_S;
break;
case MM_CAMERA_STREAM_THUMBNAIL:
image_type = OUTPUT_TYPE_T;
break;
case MM_CAMERA_STREAM_VIDEO:
default:
image_type = OUTPUT_TYPE_V;
break;
}
stream->frame.frame_len = mm_camera_get_msm_frame_len(stream->cam_fmt,
my_obj->current_mode,
stream->fmt.fmt.pix.width,
stream->fmt.fmt.pix.height,
image_type, &num_planes, planes);
if(stream->frame.frame_len == 0) {
CDBG_ERROR("%s:incorrect frame size = %d\n", __func__, stream->frame.frame_len);
rc = -1;
goto end;
}
stream->frame.num_frame = vbuf->num;
bufreq.count = stream->frame.num_frame;
bufreq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
bufreq.memory = V4L2_MEMORY_USERPTR;
CDBG("%s: calling VIDIOC_REQBUFS - fd=%d, num_buf=%d, type=%d, memory=%d\n",
__func__,stream->fd, bufreq.count, bufreq.type, bufreq.memory);
rc = ioctl(stream->fd, VIDIOC_REQBUFS, &bufreq);
if (rc < 0) {
CDBG_ERROR("%s: fd=%d, ioctl VIDIOC_REQBUFS failed: rc=%d\n",
__func__, stream->fd, rc);
goto end;
}
CDBG("%s: stream fd=%d, ioctl VIDIOC_REQBUFS: memtype = %d,"
"num_frames = %d, rc=%d\n", __func__, stream->fd, bufreq.memory,
bufreq.count, rc);
for(i = 0; i < vbuf->num; i++){
vbuf->buf.mp[i].idx = i; /* remember the index to stream frame if first time qbuf */
memcpy(&stream->frame.frame[i].frame, &(vbuf->buf.mp[i].frame),
sizeof(vbuf->buf.mp[i].frame));
stream->frame.frame[i].idx = i;
stream->frame.frame[i].num_planes = vbuf->buf.mp[i].num_planes;
for(j = 0; j < vbuf->buf.mp[i].num_planes; j++) {
stream->frame.frame[i].planes[j] = vbuf->buf.mp[i].planes[j];
}
if(vbuf->buf.mp[i].frame_offset) {
stream->frame.frame_offset[i] = vbuf->buf.mp[i].frame_offset;
} else {
stream->frame.frame_offset[i] = 0;
}
rc = mm_camera_stream_qbuf(my_obj, stream, stream->frame.frame[i].idx);
if (rc < 0) {
CDBG_ERROR("%s: VIDIOC_QBUF rc = %d\n", __func__, rc);
goto end;
}
stream->frame.ref_count[i] = 0;
CDBG("%s: stream_fd = %d, frame_fd = %d, frame ID = %d, offset = %d\n",
__func__, stream->fd, stream->frame.frame[i].frame.fd,
i, stream->frame.frame_offset[i]);
}
stream->frame.qbuf = 1;
end:
return rc;
}
示例6: msm_sensor_power_up
int32_t msm_sensor_power_up(struct msm_sensor_ctrl_t *s_ctrl)
{
int32_t rc = 0;
struct msm_camera_sensor_info *data = s_ctrl->sensordata;
CDBG("%s: %d\n", __func__, __LINE__);
s_ctrl->reg_ptr = kzalloc(sizeof(struct regulator *)
* data->sensor_platform_info->num_vreg, GFP_KERNEL);
if (!s_ctrl->reg_ptr) {
pr_err("%s: could not allocate mem for regulators\n",
__func__);
return -ENOMEM;
}
rc = msm_camera_request_gpio_table(data, 1);
if (rc < 0) {
pr_err("%s: request gpio failed\n", __func__);
goto request_gpio_failed;
}
rc = msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev,
s_ctrl->sensordata->sensor_platform_info->cam_vreg,
s_ctrl->sensordata->sensor_platform_info->num_vreg,
s_ctrl->reg_ptr, 1);
if (rc < 0) {
pr_err("%s: regulator on failed\n", __func__);
goto config_vreg_failed;
}
rc = msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev,
s_ctrl->sensordata->sensor_platform_info->cam_vreg,
s_ctrl->sensordata->sensor_platform_info->num_vreg,
s_ctrl->reg_ptr, 1);
if (rc < 0) {
pr_err("%s: enable regulator failed\n", __func__);
goto enable_vreg_failed;
}
rc = msm_camera_config_gpio_table(data, 1);
if (rc < 0) {
pr_err("%s: config gpio failed\n", __func__);
goto config_gpio_failed;
}
if (s_ctrl->clk_rate != 0)
cam_clk_info->clk_rate = s_ctrl->clk_rate;
rc = msm_cam_clk_enable(&s_ctrl->sensor_i2c_client->client->dev,
cam_clk_info, &s_ctrl->cam_clk, ARRAY_SIZE(cam_clk_info), 1);
if (rc < 0) {
pr_err("%s: clk enable failed\n", __func__);
goto enable_clk_failed;
}
usleep_range(1000, 2000);
if (data->sensor_platform_info->ext_power_ctrl != NULL)
data->sensor_platform_info->ext_power_ctrl(1);
if (data->sensor_platform_info->i2c_conf &&
data->sensor_platform_info->i2c_conf->use_i2c_mux)
msm_sensor_enable_i2c_mux(data->sensor_platform_info->i2c_conf);
return rc;
enable_clk_failed:
msm_camera_config_gpio_table(data, 0);
config_gpio_failed:
msm_camera_enable_vreg(&s_ctrl->sensor_i2c_client->client->dev,
s_ctrl->sensordata->sensor_platform_info->cam_vreg,
s_ctrl->sensordata->sensor_platform_info->num_vreg,
s_ctrl->reg_ptr, 0);
enable_vreg_failed:
msm_camera_config_vreg(&s_ctrl->sensor_i2c_client->client->dev,
s_ctrl->sensordata->sensor_platform_info->cam_vreg,
s_ctrl->sensordata->sensor_platform_info->num_vreg,
s_ctrl->reg_ptr, 0);
config_vreg_failed:
msm_camera_request_gpio_table(data, 0);
request_gpio_failed:
kfree(s_ctrl->reg_ptr);
return rc;
}
示例7: msm_cci_data_queue
static int32_t msm_cci_data_queue(struct cci_device *cci_dev,
struct msm_camera_cci_ctrl *c_ctrl, enum cci_i2c_queue_t queue)
{
uint16_t i = 0, j = 0, k = 0, h = 0, len = 0;
int32_t rc = 0;
uint32_t cmd = 0, delay = 0;
uint8_t data[11];
uint16_t reg_addr = 0;
struct msm_camera_i2c_reg_setting *i2c_msg =
&c_ctrl->cfg.cci_i2c_write_cfg;
uint16_t cmd_size = i2c_msg->size;
struct msm_camera_i2c_reg_array *i2c_cmd = i2c_msg->reg_setting;
enum cci_i2c_master_t master = c_ctrl->cci_info->cci_i2c_master;
if (i2c_cmd == NULL) {
pr_err("%s:%d Failed line\n", __func__,
__LINE__);
return -EINVAL;
}
if ((!cmd_size) || (cmd_size > CCI_I2C_MAX_WRITE)) {
pr_err("%s:%d Failed line\n", __func__, __LINE__);
return -EINVAL;
}
CDBG("%s addr type %d data type %d\n", __func__,
i2c_msg->addr_type, i2c_msg->data_type);
if (i2c_msg->addr_type >= MSM_CAMERA_I2C_ADDR_TYPE_MAX) {
pr_err("%s failed line %d\n", __func__, __LINE__);
return -EINVAL;
}
if (i2c_msg->data_type >= MSM_CAMERA_I2C_DATA_TYPE_MAX) {
pr_err("%s failed line %d\n", __func__, __LINE__);
return -EINVAL;
}
reg_addr = i2c_cmd->reg_addr;
while (cmd_size) {
CDBG("%s cmd_size %d addr 0x%x data 0x%x\n", __func__,
cmd_size, i2c_cmd->reg_addr, i2c_cmd->reg_data);
delay = i2c_cmd->delay;
data[i++] = CCI_I2C_WRITE_CMD;
/* in case of multiple command
* MSM_CCI_I2C_WRITE : address is not continuous, so update
* address for a new packet.
* MSM_CCI_I2C_WRITE_SEQ : address is continuous, need to keep
* the incremented address for a
* new packet */
if (c_ctrl->cmd == MSM_CCI_I2C_WRITE)
reg_addr = i2c_cmd->reg_addr;
/* either byte or word addr */
if (i2c_msg->addr_type == MSM_CAMERA_I2C_BYTE_ADDR)
data[i++] = reg_addr;
else {
data[i++] = (reg_addr & 0xFF00) >> 8;
data[i++] = reg_addr & 0x00FF;
}
/* max of 10 data bytes */
do {
if (i2c_msg->data_type == MSM_CAMERA_I2C_BYTE_DATA) {
data[i++] = i2c_cmd->reg_data;
reg_addr++;
} else {
if ((i + 1) <= 10) {
data[i++] = (i2c_cmd->reg_data &
0xFF00) >> 8; /* MSB */
data[i++] = i2c_cmd->reg_data &
0x00FF; /* LSB */
reg_addr += 2;
} else
break;
}
i2c_cmd++;
--cmd_size;
} while ((c_ctrl->cmd == MSM_CCI_I2C_WRITE_SEQ) &&
示例8: msm_camera_init_gpio_pin_tbl
int msm_camera_init_gpio_pin_tbl(struct device_node *of_node,
struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
uint16_t gpio_array_size)
{
int rc = 0, val = 0;
gconf->gpio_num_info = kzalloc(sizeof(struct msm_camera_gpio_num_info),
GFP_KERNEL);
if (!gconf->gpio_num_info) {
pr_err("%s failed %d\n", __func__, __LINE__);
rc = -ENOMEM;
return rc;
}
if (of_property_read_bool(of_node, "qcom,gpio-vdig") == true) {
rc = of_property_read_u32(of_node, "qcom,gpio-vdig", &val);
if (rc < 0) {
pr_err("%s:%d read qcom,gpio-reset failed rc %d\n",
__func__, __LINE__, rc);
goto ERROR;
} else if (val >= gpio_array_size) {
pr_err("%s:%d qcom,gpio-reset invalid %d\n",
__func__, __LINE__, val);
goto ERROR;
}
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_VDIG] =
gpio_array[val];
gconf->gpio_num_info->valid[SENSOR_GPIO_VDIG] = 1;
CDBG("%s qcom,gpio-reset %d\n", __func__,
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_VDIG]);
}
if (of_property_read_bool(of_node, "qcom,gpio-reset") == true) {
rc = of_property_read_u32(of_node, "qcom,gpio-reset", &val);
if (rc < 0) {
pr_err("%s:%d read qcom,gpio-reset failed rc %d\n",
__func__, __LINE__, rc);
goto ERROR;
} else if (val >= gpio_array_size) {
pr_err("%s:%d qcom,gpio-reset invalid %d\n",
__func__, __LINE__, val);
goto ERROR;
}
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_RESET] =
gpio_array[val];
gconf->gpio_num_info->valid[SENSOR_GPIO_RESET] = 1;
CDBG("%s qcom,gpio-reset %d\n", __func__,
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_RESET]);
}
if (of_property_read_bool(of_node, "qcom,gpio-standby") == true) {
rc = of_property_read_u32(of_node, "qcom,gpio-standby", &val);
if (rc < 0) {
pr_err("%s:%d read qcom,gpio-standby failed rc %d\n",
__func__, __LINE__, rc);
goto ERROR;
} else if (val >= gpio_array_size) {
pr_err("%s:%d qcom,gpio-standby invalid %d\n",
__func__, __LINE__, val);
goto ERROR;
}
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_STANDBY] =
gpio_array[val];
gconf->gpio_num_info->valid[SENSOR_GPIO_STANDBY] = 1;
CDBG("%s qcom,gpio-reset %d\n", __func__,
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_STANDBY]);
}
if (of_property_read_bool(of_node, "qcom,gpio-flash-en") == true) {
rc = of_property_read_u32(of_node, "qcom,gpio-flash-en", &val);
if (rc < 0) {
pr_err("%s:%d read qcom,gpio-flash-en failed rc %d\n",
__func__, __LINE__, rc);
goto ERROR;
} else if (val >= gpio_array_size) {
pr_err("%s:%d qcom,gpio-flash-en invalid %d\n",
__func__, __LINE__, val);
goto ERROR;
}
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_FL_EN] =
gpio_array[val];
gconf->gpio_num_info->valid[SENSOR_GPIO_FL_EN] = 1;
CDBG("%s qcom,gpio-flash-en %d\n", __func__,
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_FL_EN]);
}
if (of_property_read_bool(of_node, "qcom,gpio-flash-now") == true) {
rc = of_property_read_u32(of_node, "qcom,gpio-flash-now", &val);
if (rc < 0) {
pr_err("%s:%d read qcom,gpio-flash-now failed rc %d\n",
__func__, __LINE__, rc);
goto ERROR;
} else if (val >= gpio_array_size) {
pr_err("%s:%d qcom,gpio-flash-now invalid %d\n",
__func__, __LINE__, val);
goto ERROR;
}
gconf->gpio_num_info->gpio_num[SENSOR_GPIO_FL_NOW] =
gpio_array[val];
gconf->gpio_num_info->valid[SENSOR_GPIO_FL_NOW] = 1;
//.........这里部分代码省略.........
示例9: msm_camera_get_dt_vreg_data
int msm_camera_get_dt_vreg_data(struct device_node *of_node,
struct camera_vreg_t **cam_vreg, int *num_vreg)
{
int rc = 0, i = 0;
uint32_t count = 0;
uint32_t *vreg_array = NULL;
struct camera_vreg_t *vreg = NULL;
count = of_property_count_strings(of_node, "qcom,cam-vreg-name");
CDBG("%s qcom,cam-vreg-name count %d\n", __func__, count);
if (!count)
return 0;
vreg = kzalloc(sizeof(*vreg) * count, GFP_KERNEL);
if (!vreg) {
pr_err("%s failed %d\n", __func__, __LINE__);
return -ENOMEM;
}
*cam_vreg = vreg;
*num_vreg = count;
for (i = 0; i < count; i++) {
rc = of_property_read_string_index(of_node,
"qcom,cam-vreg-name", i,
&vreg[i].reg_name);
CDBG("%s reg_name[%d] = %s\n", __func__, i,
vreg[i].reg_name);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR1;
}
}
vreg_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
if (!vreg_array) {
pr_err("%s failed %d\n", __func__, __LINE__);
rc = -ENOMEM;
goto ERROR1;
}
rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-type",
vreg_array, count);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR2;
}
for (i = 0; i < count; i++) {
vreg[i].type = vreg_array[i];
CDBG("%s cam_vreg[%d].type = %d\n", __func__, i,
vreg[i].type);
}
rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-min-voltage",
vreg_array, count);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR2;
}
for (i = 0; i < count; i++) {
vreg[i].min_voltage = vreg_array[i];
CDBG("%s cam_vreg[%d].min_voltage = %d\n", __func__,
i, vreg[i].min_voltage);
}
rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-max-voltage",
vreg_array, count);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR2;
}
for (i = 0; i < count; i++) {
vreg[i].max_voltage = vreg_array[i];
CDBG("%s cam_vreg[%d].max_voltage = %d\n", __func__,
i, vreg[i].max_voltage);
}
rc = of_property_read_u32_array(of_node, "qcom,cam-vreg-op-mode",
vreg_array, count);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR2;
}
for (i = 0; i < count; i++) {
vreg[i].op_mode = vreg_array[i];
CDBG("%s cam_vreg[%d].op_mode = %d\n", __func__, i,
vreg[i].op_mode);
}
kfree(vreg_array);
return rc;
ERROR2:
kfree(vreg_array);
ERROR1:
kfree(vreg);
*num_vreg = 0;
return rc;
}
示例10: msm_camera_get_dt_power_setting_data
int msm_camera_get_dt_power_setting_data(struct device_node *of_node,
struct camera_vreg_t *cam_vreg, int num_vreg,
struct msm_camera_power_ctrl_t *power_info)
{
int rc = 0, i, j;
int count = 0;
const char *seq_name = NULL;
uint32_t *array = NULL;
struct msm_sensor_power_setting *ps;
struct msm_sensor_power_setting *power_setting;
uint16_t *power_setting_size, size = 0;
bool need_reverse = 0;
if (!power_info)
return -EINVAL;
power_setting = power_info->power_setting;
power_setting_size = &power_info->power_setting_size;
count = of_property_count_strings(of_node, "qcom,cam-power-seq-type");
*power_setting_size = count;
CDBG("%s qcom,cam-power-seq-type count %d\n", __func__, count);
if (count <= 0)
return 0;
ps = kzalloc(sizeof(*ps) * count, GFP_KERNEL);
if (!ps) {
pr_err("%s failed %d\n", __func__, __LINE__);
return -ENOMEM;
}
power_setting = ps;
power_info->power_setting = ps;
for (i = 0; i < count; i++) {
rc = of_property_read_string_index(of_node,
"qcom,cam-power-seq-type", i,
&seq_name);
CDBG("%s seq_name[%d] = %s\n", __func__, i,
seq_name);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR1;
}
if (!strcmp(seq_name, "sensor_vreg")) {
ps[i].seq_type = SENSOR_VREG;
CDBG("%s:%d seq_type[%d] %d\n", __func__, __LINE__,
i, ps[i].seq_type);
} else if (!strcmp(seq_name, "sensor_gpio")) {
ps[i].seq_type = SENSOR_GPIO;
CDBG("%s:%d seq_type[%d] %d\n", __func__, __LINE__,
i, ps[i].seq_type);
} else if (!strcmp(seq_name, "sensor_clk")) {
ps[i].seq_type = SENSOR_CLK;
CDBG("%s:%d seq_type[%d] %d\n", __func__, __LINE__,
i, ps[i].seq_type);
} else if (!strcmp(seq_name, "sensor_i2c_mux")) {
ps[i].seq_type = SENSOR_I2C_MUX;
CDBG("%s:%d seq_type[%d] %d\n", __func__, __LINE__,
i, ps[i].seq_type);
} else {
CDBG("%s: unrecognized seq-type\n", __func__);
rc = -EILSEQ;
goto ERROR1;
}
}
for (i = 0; i < count; i++) {
rc = of_property_read_string_index(of_node,
"qcom,cam-power-seq-val", i,
&seq_name);
CDBG("%s seq_name[%d] = %s\n", __func__, i,
seq_name);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR1;
}
switch (ps[i].seq_type) {
case SENSOR_VREG:
for (j = 0; j < num_vreg; j++) {
if (!strcmp(seq_name, cam_vreg[j].reg_name))
break;
}
if (j < num_vreg)
ps[i].seq_val = j;
else
rc = -EILSEQ;
break;
case SENSOR_GPIO:
if (!strcmp(seq_name, "sensor_gpio_reset"))
ps[i].seq_val = SENSOR_GPIO_RESET;
else if (!strcmp(seq_name, "sensor_gpio_standby"))
ps[i].seq_val = SENSOR_GPIO_STANDBY;
else if (!strcmp(seq_name, "sensor_gpio_vdig"))
ps[i].seq_val = SENSOR_GPIO_VDIG;
else if (!strcmp(seq_name, "sensor_gpio_vio"))
ps[i].seq_val = SENSOR_GPIO_VIO;
//.........这里部分代码省略.........
示例11: msm_camera_get_dt_gpio_set_tbl
int msm_camera_get_dt_gpio_set_tbl(struct device_node *of_node,
struct msm_camera_gpio_conf *gconf, uint16_t *gpio_array,
uint16_t gpio_array_size)
{
int rc = 0, i = 0;
uint32_t count = 0;
uint32_t *val_array = NULL;
if (!of_get_property(of_node, "qcom,gpio-set-tbl-num", &count))
return 0;
count /= sizeof(uint32_t);
if (!count) {
pr_err("%s qcom,gpio-set-tbl-num 0\n", __func__);
return 0;
}
val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
if (!val_array) {
pr_err("%s failed %d\n", __func__, __LINE__);
return -ENOMEM;
}
gconf->cam_gpio_set_tbl = kzalloc(sizeof(struct msm_gpio_set_tbl) *
count, GFP_KERNEL);
if (!gconf->cam_gpio_set_tbl) {
pr_err("%s failed %d\n", __func__, __LINE__);
rc = -ENOMEM;
goto ERROR1;
}
gconf->cam_gpio_set_tbl_size = count;
rc = of_property_read_u32_array(of_node, "qcom,gpio-set-tbl-num",
val_array, count);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR2;
}
for (i = 0; i < count; i++) {
if (val_array[i] >= gpio_array_size) {
pr_err("%s gpio set tbl index %d invalid\n",
__func__, val_array[i]);
return -EINVAL;
}
gconf->cam_gpio_set_tbl[i].gpio = gpio_array[val_array[i]];
CDBG("%s cam_gpio_set_tbl[%d].gpio = %d\n", __func__, i,
gconf->cam_gpio_set_tbl[i].gpio);
}
rc = of_property_read_u32_array(of_node, "qcom,gpio-set-tbl-flags",
val_array, count);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR2;
}
for (i = 0; i < count; i++) {
gconf->cam_gpio_set_tbl[i].flags = val_array[i];
CDBG("%s cam_gpio_set_tbl[%d].flags = %ld\n", __func__, i,
gconf->cam_gpio_set_tbl[i].flags);
}
rc = of_property_read_u32_array(of_node, "qcom,gpio-set-tbl-delay",
val_array, count);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR2;
}
for (i = 0; i < count; i++) {
gconf->cam_gpio_set_tbl[i].delay = val_array[i];
CDBG("%s cam_gpio_set_tbl[%d].delay = %d\n", __func__, i,
gconf->cam_gpio_set_tbl[i].delay);
}
kfree(val_array);
return rc;
ERROR2:
kfree(gconf->cam_gpio_set_tbl);
ERROR1:
kfree(val_array);
gconf->cam_gpio_set_tbl_size = 0;
return rc;
}
示例12: msm_camera_power_down
int msm_camera_power_down(struct msm_camera_power_ctrl_t *ctrl,
enum msm_camera_device_type_t device_type,
struct msm_camera_i2c_client *sensor_i2c_client)
{
int index = 0;
struct msm_sensor_power_setting *pd = NULL;
struct msm_sensor_power_setting *ps;
CDBG("%s:%d\n", __func__, __LINE__);
if (!ctrl || !sensor_i2c_client) {
pr_err("failed ctrl %p sensor_i2c_client %p\n", ctrl,
sensor_i2c_client);
return -EINVAL;
}
if (device_type == MSM_CAMERA_PLATFORM_DEVICE)
sensor_i2c_client->i2c_func_tbl->i2c_util(
sensor_i2c_client, MSM_CCI_RELEASE);
for (index = 0; index < ctrl->power_down_setting_size; index++) {
CDBG("%s index %d\n", __func__, index);
pd = &ctrl->power_down_setting[index];
ps = NULL;
CDBG("%s type %d\n", __func__, pd->seq_type);
switch (pd->seq_type) {
case SENSOR_CLK:
ps = msm_camera_get_power_settings(ctrl,
pd->seq_type,
pd->seq_val);
if (ps)
msm_cam_clk_enable(ctrl->dev,
&ctrl->clk_info[0],
(struct clk **)&ps->data[0],
ctrl->clk_info_size,
0);
else
pr_err("%s error in power up/down seq data\n",
__func__);
break;
case SENSOR_GPIO:
if (pd->seq_val >= SENSOR_GPIO_MAX ||
!ctrl->gpio_conf->gpio_num_info) {
pr_err("%s gpio index %d >= max %d\n", __func__,
pd->seq_val,
SENSOR_GPIO_MAX);
continue;
}
#if defined(CONFIG_MACH_LGE)
if((pd->seq_val == SENSOR_GPIO_RESET ||
pd->seq_val == SENSOR_GPIO_OIS_RESET) &&
ctrl->gpio_conf->gpio_num_info->gpio_num[pd->config_val] !=
GPIO_OUT_LOW) {
pr_err("%s skip seq_val = %d, value = %d\n", __func__, pd->seq_val,
ctrl->gpio_conf->gpio_num_info->gpio_num[pd->config_val]);
continue;
}
#endif
if (!ctrl->gpio_conf->gpio_num_info->valid
[pd->seq_val])
continue;
gpio_set_value_cansleep(
ctrl->gpio_conf->gpio_num_info->gpio_num
[pd->seq_val],
ctrl->gpio_conf->gpio_num_info->gpio_num
[pd->config_val]);
break;
case SENSOR_VREG:
if (pd->seq_val >= CAM_VREG_MAX) {
pr_err("%s vreg index %d >= max %d\n", __func__,
pd->seq_val,
SENSOR_GPIO_MAX);
continue;
}
ps = msm_camera_get_power_settings(ctrl,
pd->seq_type,
pd->seq_val);
if (ps)
msm_camera_config_single_vreg(ctrl->dev,
&ctrl->cam_vreg[pd->seq_val],
(struct regulator **)&ps->data[0],
0);
else
pr_err("%s error in power up/down seq data\n",
__func__);
break;
case SENSOR_I2C_MUX:
if (ctrl->i2c_conf && ctrl->i2c_conf->use_i2c_mux)
msm_camera_disable_i2c_mux(ctrl->i2c_conf);
break;
default:
pr_err("%s error power seq type %d\n", __func__,
pd->seq_type);
break;
}
//.........这里部分代码省略.........
示例13: msm_camera_power_up
int msm_camera_power_up(struct msm_camera_power_ctrl_t *ctrl,
enum msm_camera_device_type_t device_type,
struct msm_camera_i2c_client *sensor_i2c_client)
{
int rc = 0, index = 0, no_gpio = 0;
struct msm_sensor_power_setting *power_setting = NULL;
CDBG("%s:%d\n", __func__, __LINE__);
if (!ctrl || !sensor_i2c_client) {
pr_err("failed ctrl %p sensor_i2c_client %p\n", ctrl,
sensor_i2c_client);
return -EINVAL;
}
if (ctrl->gpio_conf->cam_gpiomux_conf_tbl != NULL) {
pr_err("%s:%d mux install\n", __func__, __LINE__);
msm_gpiomux_install(
(struct msm_gpiomux_config *)
ctrl->gpio_conf->cam_gpiomux_conf_tbl,
ctrl->gpio_conf->cam_gpiomux_conf_tbl_size);
}
rc = msm_camera_request_gpio_table(
ctrl->gpio_conf->cam_gpio_req_tbl,
ctrl->gpio_conf->cam_gpio_req_tbl_size, 1);
if (rc < 0)
no_gpio = rc;
for (index = 0; index < ctrl->power_setting_size; index++) {
CDBG("%s index %d\n", __func__, index);
power_setting = &ctrl->power_setting[index];
CDBG("%s type %d\n", __func__, power_setting->seq_type);
if(!power_setting) {
CDBG("power_setting is null\n");
continue;
}
switch (power_setting->seq_type) {
case SENSOR_CLK:
if (power_setting->seq_val >= ctrl->clk_info_size) {
pr_err("%s clk index %d >= max %d\n", __func__,
power_setting->seq_val,
ctrl->clk_info_size);
goto power_up_failed;
}
if (power_setting->config_val)
ctrl->clk_info[power_setting->seq_val].
clk_rate = power_setting->config_val;
rc = msm_cam_clk_enable(ctrl->dev,
&ctrl->clk_info[0],
(struct clk **)&power_setting->data[0],
ctrl->clk_info_size,
1);
if (rc < 0) {
pr_err("%s: clk enable failed\n",
__func__);
goto power_up_failed;
}
break;
case SENSOR_GPIO:
if (no_gpio) {
pr_err("%s: request gpio failed\n", __func__);
return no_gpio;
}
if (power_setting->seq_val >= SENSOR_GPIO_MAX ||
!ctrl->gpio_conf->gpio_num_info) {
pr_err("%s gpio index %d >= max %d\n", __func__,
power_setting->seq_val,
SENSOR_GPIO_MAX);
goto power_up_failed;
}
if (!ctrl->gpio_conf->gpio_num_info->valid
[power_setting->seq_val])
continue;
CDBG("%s:%d gpio set val %d\n", __func__, __LINE__,
ctrl->gpio_conf->gpio_num_info->gpio_num
[power_setting->seq_val]);
gpio_set_value_cansleep(
ctrl->gpio_conf->gpio_num_info->gpio_num
[power_setting->seq_val],
power_setting->config_val);
break;
case SENSOR_VREG:
if (power_setting->seq_val >= CAM_VREG_MAX) {
pr_err("%s vreg index %d >= max %d\n", __func__,
power_setting->seq_val,
SENSOR_GPIO_MAX);
goto power_up_failed;
}
msm_camera_config_single_vreg(ctrl->dev,
&ctrl->cam_vreg[power_setting->seq_val],
(struct regulator **)&power_setting->data[0],
1);
break;
case SENSOR_I2C_MUX:
if (ctrl->i2c_conf && ctrl->i2c_conf->use_i2c_mux)
msm_camera_enable_i2c_mux(ctrl->i2c_conf);
break;
default:
pr_err("%s error power seq type %d\n", __func__,
power_setting->seq_type);
//.........这里部分代码省略.........
示例14: msm_sensor_get_sub_module_index
int msm_sensor_get_sub_module_index(struct device_node *of_node,
struct msm_sensor_info_t **s_info)
{
int rc = 0, i = 0;
uint32_t val = 0, count = 0;
uint32_t *val_array = NULL;
struct device_node *src_node = NULL;
struct msm_sensor_info_t *sensor_info;
sensor_info = kzalloc(sizeof(*sensor_info), GFP_KERNEL);
if (!sensor_info) {
pr_err("%s:%d failed\n", __func__, __LINE__);
return -ENOMEM;
}
for (i = 0; i < SUB_MODULE_MAX; i++)
sensor_info->subdev_id[i] = -1;
src_node = of_parse_phandle(of_node, "qcom,actuator-src", 0);
if (!src_node) {
CDBG("%s:%d src_node NULL\n", __func__, __LINE__);
} else {
rc = of_property_read_u32(src_node, "cell-index", &val);
CDBG("%s qcom,actuator cell index %d, rc %d\n", __func__,
val, rc);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR;
}
sensor_info->subdev_id[SUB_MODULE_ACTUATOR] = val;
of_node_put(src_node);
src_node = NULL;
}
src_node = of_parse_phandle(of_node, "qcom,eeprom-src", 0);
if (!src_node) {
CDBG("%s:%d eeprom src_node NULL\n", __func__, __LINE__);
} else {
rc = of_property_read_u32(src_node, "cell-index", &val);
CDBG("%s qcom,eeprom cell index %d, rc %d\n", __func__,
val, rc);
if (rc < 0) {
pr_err("%s failed %d\n", __func__, __LINE__);
goto ERROR;
}
sensor_info->subdev_id[SUB_MODULE_EEPROM] = val;
of_node_put(src_node);
src_node = NULL;
}
if (of_property_read_bool(of_node, "qcom,eeprom-sd-index") ==
true) {
rc = of_property_read_u32(of_node, "qcom,eeprom-sd-index",
&val);
CDBG("%s qcom,eeprom-sd-index %d, rc %d\n", __func__, val, rc);
if (rc < 0) {
pr_err("%s:%d failed rc %d\n", __func__, __LINE__, rc);
goto ERROR;
}
sensor_info->subdev_id[SUB_MODULE_EEPROM] = val;
}
src_node = of_parse_phandle(of_node, "qcom,led-flash-src", 0);
if (!src_node) {
CDBG("%s:%d src_node NULL\n", __func__, __LINE__);
} else {
rc = of_property_read_u32(src_node, "cell-index", &val);
CDBG("%s qcom,led flash cell index %d, rc %d\n", __func__,
val, rc);
if (rc < 0) {
pr_err("%s:%d failed %d\n", __func__, __LINE__, rc);
goto ERROR;
}
sensor_info->subdev_id[SUB_MODULE_LED_FLASH] = val;
of_node_put(src_node);
src_node = NULL;
}
if (of_property_read_bool(of_node, "qcom,strobe-flash-sd-index") ==
true) {
rc = of_property_read_u32(of_node, "qcom,strobe-flash-sd-index",
&val);
CDBG("%s qcom,strobe-flash-sd-index %d, rc %d\n", __func__,
val, rc);
if (rc < 0) {
pr_err("%s:%d failed rc %d\n", __func__, __LINE__, rc);
goto ERROR;
}
sensor_info->subdev_id[SUB_MODULE_STROBE_FLASH] = val;
}
if (of_get_property(of_node, "qcom,csiphy-sd-index", &count)) {
count /= sizeof(uint32_t);
if (count > 2) {
pr_err("%s qcom,csiphy-sd-index count %d > 2\n",
__func__, count);
goto ERROR;
}
val_array = kzalloc(sizeof(uint32_t) * count, GFP_KERNEL);
if (!val_array) {
pr_err("%s failed %d\n", __func__, __LINE__);
//.........这里部分代码省略.........
示例15: vfe_config
static int vfe_config(struct msm_vfe_cfg_cmd_t *cmd, void *data)
{
struct msm_pmem_region *regptr;
struct msm_vfe_command_8k vfecmd;
uint32_t i;
void *cmd_data = NULL;
long rc = 0;
struct vfe_cmd_axi_output_config *axio = NULL;
struct vfe_cmd_stats_setting *scfg_t = NULL;
if (cmd->cmd_type != CMD_FRAME_BUF_RELEASE &&
cmd->cmd_type != CMD_STATS_BUF_RELEASE &&
cmd->cmd_type != CMD_STATS_AF_BUF_RELEASE) {
if (copy_from_user(&vfecmd,
(void __user *)(cmd->value),
sizeof(struct msm_vfe_command_8k)))
return -EFAULT;
}
CDBG("vfe_config: cmdType = %d\n", cmd->cmd_type);
switch (cmd->cmd_type) {
case CMD_GENERAL:
rc = vfe_proc_general(&vfecmd);
break;
case CMD_STATS_ENABLE:
case CMD_STATS_AXI_CFG: {
struct axidata_t *axid;
axid = data;
if (!axid)
return -EFAULT;
scfg_t =
kmalloc(sizeof(struct vfe_cmd_stats_setting),
GFP_ATOMIC);
if (!scfg_t)
return -ENOMEM;
if (copy_from_user(scfg_t,
(void __user *)(vfecmd.value),
vfecmd.length)) {
kfree(scfg_t);
return -EFAULT;
}
regptr = axid->region;
if (axid->bufnum1 > 0) {
for (i = 0; i < axid->bufnum1; i++) {
scfg_t->awbBuffer[i] =
(uint32_t)(regptr->paddr);
regptr++;
}
}
if (axid->bufnum2 > 0) {
for (i = 0; i < axid->bufnum2; i++) {
scfg_t->afBuffer[i] =
(uint32_t)(regptr->paddr);
regptr++;
}
}
vfe_stats_setting(scfg_t);
}
break;
case CMD_FRAME_BUF_RELEASE: {
/* preview buffer release */
struct msm_frame_t *b;
unsigned long p;
struct vfe_cmd_output_ack fack;
if (!data)
return -EFAULT;
b = (struct msm_frame_t *)(cmd->value);
p = *(unsigned long *)data;
b->path = MSM_FRAME_ENC;
fack.ybufaddr[0] =
(uint32_t)(p + b->y_off);
fack.chromabufaddr[0] =
(uint32_t)(p + b->cbcr_off);
if (b->path == MSM_FRAME_PREV_1)
vfe_output1_ack(&fack);
if (b->path == MSM_FRAME_ENC ||
b->path == MSM_FRAME_PREV_2)
vfe_output2_ack(&fack);
}
//.........这里部分代码省略.........