[Q] HTC EVO 4G LTE pmem memory allocation failed -- reqbufs failed -12

Search This thread

lukethor

New member
Jul 8, 2012
1
0
I am trying to connect an USB camera over the USB port in the following device :

The android device is an HTC EVO 4G LTE
AndroidVersion = 4.3.1
Kernel Version = 3.4.11-gf8fed45
build02@cynogenmod #1
Mon Nov 11 6:05:44 PST 2013
CPU : ARMv7 Processor rev 0(v7I)
CynogenMod Version: 10.2.-20131111-NIGHTLY-jewel


The android phone is OTG enabled and reads the CAM in the USB port as shown in the logs. The problem I am facing is in the lines I described in the heading, the device is not able to to allocate the pmem memory. I am wondering is this is a bug in Cynogen in the videobuf2-msm-mem.c.


<6>[ 2850.902853] [CAM] s5k3h2yx: fuse->fuse_id_word1:0
<6>[ 2850.907522] [CAM] s5k3h2yx: fuse->fuse_id_word2:0
<6>[ 2850.912253] [CAM] s5k3h2yx: fuse->fuse_id_word3:0x00000004
<6>[ 2850.917686] [CAM] s5k3h2yx: fuse->fuse_id_word4:0x00430514
<6>[ 2850.923240] [CAM] msm_get_sensor_info,sdata->htc_image=0,sdata->use_rawchip=1,sdata->hdr_mode=0,sdata->video_hdr_capability=0
<6>[ 2850.945612] [CAM] msm_sensor_mode_init called
<6>[ 2850.950251] [CAM] msm_sensor_setting: update_type=0, res=0
<6>[ 2851.008545] [CAM] msm_get_sensor_info,sdata->htc_image=0,sdata->use_rawchip=1,sdata->hdr_mode=0,sdata->video_hdr_capability=0
<6>[ 2851.022676] [CAM] msm_enqueue: queue control new max is 1
<3>[ 2851.181351] [CAM][ERR] msm_camera_v4l2_reqbufs reqbufs failed -12
<6>[ 2855.596856] [CAM] msm_close Inst d895e400 freeing buffer offsets array
<6>[ 2855.602471] [CAM] msm_close Closing down instance d895e400, [0, 1]
<6>[ 2855.608820] [CAM] msm_send_close_server qid 0
<6>[ 2855.614405] [CAM] vpe_reset: VPE already disabled.
<6>[ 2855.618098] [CAM] vpe_disable, vpe_ctrl->state 0
<6>[ 2855.622767] [CAM] vpe_disable: VPE already disabled


snipset of the Kernel code

static void *msm_vb2_mem_ops_alloc(void *alloc_ctx, unsigned long size)
{
struct videobuf2_contig_pmem *mem;
unsigned int flags = 0;
long rc;
mem = kzalloc(sizeof(*mem), GFP_KERNEL);
if (!mem)
return ERR_PTR(-ENOMEM);

mem->magic = MAGIC_PMEM;
mem->size = PAGE_ALIGN(size);
mem->alloc_ctx = alloc_ctx;
mem->is_userptr = 0;
mem->phyaddr = msm_mem_allocate(mem);
if (!mem->phyaddr) {
pr_err("%s : pmem memory allocation failed\n", __func__);
kfree(mem);
return ERR_PTR(-ENOMEM);
}
flags = MSM_SUBSYSTEM_MAP_IOVA;
mem->subsys_id = MSM_SUBSYSTEM_CAMERA;
mem->msm_buffer = msm_subsystem_map_buffer(mem->phyaddr, mem->size,
flags, &(mem->subsys_id), 1);
if (IS_ERR((void *)mem->msm_buffer)) {
pr_err("%s: msm_subsystem_map_buffer failed\n", __func__);
rc = PTR_ERR((void *)mem->msm_buffer);
msm_mem_free(mem);
kfree(mem);
return ERR_PTR(-ENOMEM);
}
mem->mapped_phyaddr = mem->msm_buffer->iova[0];
return mem;
}
static void msm_vb2_mem_ops_put(void *buf_priv)
{
struct videobuf2_contig_pmem *mem = buf_priv;
if (!mem->is_userptr) {
D("%s Freeing memory ", __func__);
if (msm_subsystem_unmap_buffer(mem->msm_buffer) < 0)
D("%s unmapped memory\n", __func__);
msm_mem_free(mem);
}
kfree(mem);

Any help will be appreciated