Loading drivers/media/platform/msm/camera_v2/fd/msm_fd_dev.c +10 −12 Original line number Diff line number Diff line Loading @@ -237,10 +237,17 @@ static int msm_fd_start_streaming(struct vb2_queue *q, unsigned int count) return -EINVAL; } ret = msm_fd_hw_get(ctx->fd_device, ctx->settings.speed); if (ret < 0) { dev_err(ctx->fd_device->dev, "Can not acquire fd hw\n"); goto out; } ret = msm_fd_hw_schedule_and_start(ctx->fd_device); if (ret < 0) dev_err(ctx->fd_device->dev, "Can not start fd hw\n"); out: return ret; } Loading @@ -253,6 +260,7 @@ static int msm_fd_stop_streaming(struct vb2_queue *q) struct fd_ctx *ctx = vb2_get_drv_priv(q); msm_fd_hw_remove_buffers_from_queue(ctx->fd_device, q); msm_fd_hw_put(ctx->fd_device); return 0; } Loading Loading @@ -717,16 +725,10 @@ static int msm_fd_streamon(struct file *file, struct fd_ctx *ctx = msm_fd_ctx_from_fh(fh); int ret; ret = msm_fd_hw_get(ctx->fd_device, ctx->settings.speed); if (ret < 0) { dev_err(ctx->fd_device->dev, "Can not acquire fd hw\n"); goto out; } ret = vb2_streamon(&ctx->vb2_q, buf_type); if (ret < 0) dev_err(ctx->fd_device->dev, "Stream on fails\n"); out: return ret; } Loading @@ -743,13 +745,9 @@ static int msm_fd_streamoff(struct file *file, int ret; ret = vb2_streamoff(&ctx->vb2_q, buf_type); if (ret < 0) { if (ret < 0) dev_err(ctx->fd_device->dev, "Stream off fails\n"); goto out; } msm_fd_hw_put(ctx->fd_device); out: return ret; } Loading drivers/media/platform/msm/camera_v2/fd/msm_fd_hw.c +33 −9 Original line number Diff line number Diff line Loading @@ -25,8 +25,12 @@ #include <media/videobuf2-core.h> #include "msm_fd_dev.h" #include "msm_fd_hw.h" #include "msm_fd_regs.h" /* Face detection processing timeout in ms */ #define MSM_FD_PROCESSING_TIMEOUT_MS 500 /* Fd iommu partition definition */ static struct msm_iova_partition msm_fd_fw_partition = { .start = SZ_128K, Loading Loading @@ -191,13 +195,18 @@ static inline void msm_fd_hw_set_direction_angle(struct msm_fd_device *fd, u32 direction, u32 angle) { u32 reg; u32 value; value = direction | (angle ? 1 << (angle + 1) : 0); if (value > MSM_FD_CONDT_DIR_MAX) value = MSM_FD_CONDT_DIR_MAX; reg = msm_fd_hw_read_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT); reg = direction | (angle ? 1 << (angle + 1) : 0); if (reg > MSM_FD_CONDT_DIR_MAX) reg = MSM_FD_CONDT_DIR_MAX; reg &= ~MSM_FD_CONDT_DIR_MASK; reg |= (value << MSM_FD_CONDT_DIR_SHIFT); msm_fd_hw_reg_set(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, (reg << MSM_FD_CONDT_DIR_SHIFT)); msm_fd_hw_write_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, reg); } /* Loading @@ -207,8 +216,14 @@ static inline void msm_fd_hw_set_direction_angle(struct msm_fd_device *fd, */ static inline void msm_fd_hw_set_min_face(struct msm_fd_device *fd, u32 size) { msm_fd_hw_reg_set(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, (size & MSM_FD_CONDT_MIN_MASK) << MSM_FD_CONDT_MIN_SHIFT); u32 reg; reg = msm_fd_hw_read_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT); reg &= ~MSM_FD_CONDT_MIN_MASK; reg |= (size << MSM_FD_CONDT_MIN_SHIFT); msm_fd_hw_write_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, reg); } /* Loading Loading @@ -946,6 +961,7 @@ void msm_fd_hw_remove_buffers_from_queue(struct msm_fd_device *fd, struct msm_fd_buffer *curr_buff; struct msm_fd_buffer *temp; struct msm_fd_buffer *active_buffer; unsigned long time; spin_lock(&fd->slock); Loading @@ -963,8 +979,16 @@ void msm_fd_hw_remove_buffers_from_queue(struct msm_fd_device *fd, spin_unlock(&fd->slock); /* We need to wait active buffer to finish */ if (active_buffer) wait_for_completion(&active_buffer->completion); if (active_buffer) { time = wait_for_completion_timeout(&active_buffer->completion, msecs_to_jiffies(MSM_FD_PROCESSING_TIMEOUT_MS)); if (!time) { /* Remove active buffer */ msm_fd_hw_get_active_buffer(fd); /* Schedule if other buffers are present in device */ msm_fd_hw_schedule_next_buffer(fd); } } return; } Loading drivers/media/platform/msm/camera_v2/fd/msm_fd_regs.h +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define MSM_FD_CONDT_MIN_MASK (0x03) #define MSM_FD_CONDT_MIN_SHIFT (0x00) #define MSM_FD_CONDT_DIR_MAX (0x08) #define MSM_FD_CONDT_DIR_MASK (0x3C) #define MSM_FD_CONDT_DIR_SHIFT (0x02) #define MSM_FD_START_X (0x0C) Loading Loading
drivers/media/platform/msm/camera_v2/fd/msm_fd_dev.c +10 −12 Original line number Diff line number Diff line Loading @@ -237,10 +237,17 @@ static int msm_fd_start_streaming(struct vb2_queue *q, unsigned int count) return -EINVAL; } ret = msm_fd_hw_get(ctx->fd_device, ctx->settings.speed); if (ret < 0) { dev_err(ctx->fd_device->dev, "Can not acquire fd hw\n"); goto out; } ret = msm_fd_hw_schedule_and_start(ctx->fd_device); if (ret < 0) dev_err(ctx->fd_device->dev, "Can not start fd hw\n"); out: return ret; } Loading @@ -253,6 +260,7 @@ static int msm_fd_stop_streaming(struct vb2_queue *q) struct fd_ctx *ctx = vb2_get_drv_priv(q); msm_fd_hw_remove_buffers_from_queue(ctx->fd_device, q); msm_fd_hw_put(ctx->fd_device); return 0; } Loading Loading @@ -717,16 +725,10 @@ static int msm_fd_streamon(struct file *file, struct fd_ctx *ctx = msm_fd_ctx_from_fh(fh); int ret; ret = msm_fd_hw_get(ctx->fd_device, ctx->settings.speed); if (ret < 0) { dev_err(ctx->fd_device->dev, "Can not acquire fd hw\n"); goto out; } ret = vb2_streamon(&ctx->vb2_q, buf_type); if (ret < 0) dev_err(ctx->fd_device->dev, "Stream on fails\n"); out: return ret; } Loading @@ -743,13 +745,9 @@ static int msm_fd_streamoff(struct file *file, int ret; ret = vb2_streamoff(&ctx->vb2_q, buf_type); if (ret < 0) { if (ret < 0) dev_err(ctx->fd_device->dev, "Stream off fails\n"); goto out; } msm_fd_hw_put(ctx->fd_device); out: return ret; } Loading
drivers/media/platform/msm/camera_v2/fd/msm_fd_hw.c +33 −9 Original line number Diff line number Diff line Loading @@ -25,8 +25,12 @@ #include <media/videobuf2-core.h> #include "msm_fd_dev.h" #include "msm_fd_hw.h" #include "msm_fd_regs.h" /* Face detection processing timeout in ms */ #define MSM_FD_PROCESSING_TIMEOUT_MS 500 /* Fd iommu partition definition */ static struct msm_iova_partition msm_fd_fw_partition = { .start = SZ_128K, Loading Loading @@ -191,13 +195,18 @@ static inline void msm_fd_hw_set_direction_angle(struct msm_fd_device *fd, u32 direction, u32 angle) { u32 reg; u32 value; value = direction | (angle ? 1 << (angle + 1) : 0); if (value > MSM_FD_CONDT_DIR_MAX) value = MSM_FD_CONDT_DIR_MAX; reg = msm_fd_hw_read_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT); reg = direction | (angle ? 1 << (angle + 1) : 0); if (reg > MSM_FD_CONDT_DIR_MAX) reg = MSM_FD_CONDT_DIR_MAX; reg &= ~MSM_FD_CONDT_DIR_MASK; reg |= (value << MSM_FD_CONDT_DIR_SHIFT); msm_fd_hw_reg_set(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, (reg << MSM_FD_CONDT_DIR_SHIFT)); msm_fd_hw_write_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, reg); } /* Loading @@ -207,8 +216,14 @@ static inline void msm_fd_hw_set_direction_angle(struct msm_fd_device *fd, */ static inline void msm_fd_hw_set_min_face(struct msm_fd_device *fd, u32 size) { msm_fd_hw_reg_set(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, (size & MSM_FD_CONDT_MIN_MASK) << MSM_FD_CONDT_MIN_SHIFT); u32 reg; reg = msm_fd_hw_read_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT); reg &= ~MSM_FD_CONDT_MIN_MASK; reg |= (size << MSM_FD_CONDT_MIN_SHIFT); msm_fd_hw_write_reg(fd, MSM_FD_IOMEM_CORE, MSM_FD_CONDT, reg); } /* Loading Loading @@ -946,6 +961,7 @@ void msm_fd_hw_remove_buffers_from_queue(struct msm_fd_device *fd, struct msm_fd_buffer *curr_buff; struct msm_fd_buffer *temp; struct msm_fd_buffer *active_buffer; unsigned long time; spin_lock(&fd->slock); Loading @@ -963,8 +979,16 @@ void msm_fd_hw_remove_buffers_from_queue(struct msm_fd_device *fd, spin_unlock(&fd->slock); /* We need to wait active buffer to finish */ if (active_buffer) wait_for_completion(&active_buffer->completion); if (active_buffer) { time = wait_for_completion_timeout(&active_buffer->completion, msecs_to_jiffies(MSM_FD_PROCESSING_TIMEOUT_MS)); if (!time) { /* Remove active buffer */ msm_fd_hw_get_active_buffer(fd); /* Schedule if other buffers are present in device */ msm_fd_hw_schedule_next_buffer(fd); } } return; } Loading
drivers/media/platform/msm/camera_v2/fd/msm_fd_regs.h +1 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ #define MSM_FD_CONDT_MIN_MASK (0x03) #define MSM_FD_CONDT_MIN_SHIFT (0x00) #define MSM_FD_CONDT_DIR_MAX (0x08) #define MSM_FD_CONDT_DIR_MASK (0x3C) #define MSM_FD_CONDT_DIR_SHIFT (0x02) #define MSM_FD_START_X (0x0C) Loading