int vpe_enable(uint32_t clk_rate) { int rc = 0; unsigned long flags = 0; /* don't change the order of clock and irq.*/ CDBG("%s: enable_clock rate %u\n", __func__, clk_rate); spin_lock_irqsave(&vpe_ctrl->ops_lock, flags); if (vpe_ctrl->state != VPE_STATE_IDLE) { CDBG("%s: VPE already enabled", __func__); spin_unlock_irqrestore(&vpe_ctrl->ops_lock, flags); return 0; } vpe_ctrl->state = VPE_STATE_INIT; spin_unlock_irqrestore(&vpe_ctrl->ops_lock, flags); rc = msm_camio_vpe_clk_enable(clk_rate); if (rc < 0) { pr_err("%s: msm_camio_vpe_clk_enable failed", __func__); vpe_ctrl->state = VPE_STATE_IDLE; return rc; } CDBG("%s: enable_irq\n", __func__); vpe_enable_irq(); /* initialize the data structure - lock, queue etc. */ spin_lock_init(&vpe_ctrl->tasklet_lock); INIT_LIST_HEAD(&vpe_ctrl->tasklet_q); return rc; }
int msm_vpe_open(void) { int rc = 0; CDBG("[CAM] %s: In \n", __func__); vpe_ctrl = kzalloc(sizeof(struct vpe_ctrl_type), GFP_KERNEL); if (!vpe_ctrl) { pr_err("[CAM] %s: no memory!\n", __func__); return -ENOMEM; } /* don't change the order of clock and irq.*/ CDBG("[CAM] %s: enable_clock \n", __func__); rc = msm_camio_vpe_clk_enable(); CDBG("[CAM] %s: enable_irq \n", __func__); vpe_enable_irq(); /* initialize the data structure - lock, queue etc. */ spin_lock_init(&vpe_ctrl->tasklet_lock); INIT_LIST_HEAD(&vpe_ctrl->tasklet_q); CDBG("[CAM] %s: Out \n", __func__); return rc; }