Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4e302b21 authored by Rajakumar Govindaram's avatar Rajakumar Govindaram
Browse files

msm: camera2: cpp: Add support to enable turbo mode dynamically



The input stream can have varying properties. Based on the input
the clock can be set to turbo mode. This change adds support
for necessary IOCTL.

Change-Id: Iafb3c6bd94f6bee4993d6bc679d693c71b37d3bd
Signed-off-by: default avatarRajakumar Govindaram <rajakuma@codeaurora.org>
parent 3a5255f7
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
@@ -49,6 +49,9 @@

#define CPP_CMD_TIMEOUT_MS 300

#define MSM_CPP_NOMINAL_CLOCK 266670000
#define MSM_CPP_TURBO_CLOCK 320000000

struct msm_cpp_timer_data_t {
	struct cpp_device *cpp_dev;
	struct msm_cpp_frame_info_t *processed_frame;
@@ -1587,6 +1590,37 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
		kfree(event_qcmd);
		break;
	}
	case VIDIOC_MSM_CPP_SET_CLOCK: {
		long clock_rate = 0;
		if (ioctl_ptr->len == 0) {
			pr_err("ioctl_ptr->len is 0\n");
			mutex_unlock(&cpp_dev->mutex);
			return -EINVAL;
		}

		if (ioctl_ptr->ioctl_ptr == NULL) {
			pr_err("ioctl_ptr->ioctl_ptr is NULL\n");
			mutex_unlock(&cpp_dev->mutex);
			return -EINVAL;
		}

		rc = (copy_from_user(&clock_rate,
			(void __user *)ioctl_ptr->ioctl_ptr,
			ioctl_ptr->len) ? -EFAULT : 0);
		if (rc) {
			ERR_COPY_FROM_USER();
			mutex_unlock(&cpp_dev->mutex);
			return -EINVAL;
		}

		if ((clock_rate == MSM_CPP_NOMINAL_CLOCK) ||
			(clock_rate == MSM_CPP_TURBO_CLOCK)) {
			CPP_DBG("clk:%ld\n", clock_rate);
			clk_set_rate(cpp_dev->cpp_clk[4], clock_rate);
		}

		break;
	}
	case MSM_SD_SHUTDOWN: {
		mutex_unlock(&cpp_dev->mutex);
		while (cpp_dev->cpp_open_cnt != 0)
+3 −0
Original line number Diff line number Diff line
@@ -228,6 +228,9 @@ struct msm_pproc_queue_buf_info {
#define VIDIOC_MSM_CPP_QUEUE_BUF \
	_IOWR('V', BASE_VIDIOC_PRIVATE + 14, struct msm_camera_v4l2_ioctl_t)

#define VIDIOC_MSM_CPP_SET_CLOCK \
	_IOWR('V', BASE_VIDIOC_PRIVATE + 16, struct msm_camera_v4l2_ioctl_t)

#define V4L2_EVENT_CPP_FRAME_DONE  (V4L2_EVENT_PRIVATE_START + 0)
#define V4L2_EVENT_VPE_FRAME_DONE  (V4L2_EVENT_PRIVATE_START + 1)