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

Commit 8fcd89c7 authored by Rajakumar Govindaram's avatar Rajakumar Govindaram
Browse files

msm: camera2: cpp: Change bus scale vector call sequence



The cpp driver can set the bus scale vector when cpp module is
actually included. This will avoid unnecessary power consumption
due to setting the bus scale vector.

Change-Id: I898bb33f4433d8b70f63c07facd6e22d58196211
Signed-off-by: default avatarRajakumar Govindaram <rajakuma@codeaurora.org>
parent 0dcf4ed8
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -111,7 +111,9 @@ int msm_isp_update_bandwidth(enum msm_isp_hw_client client,
	mutex_lock(&bandwidth_mgr_mutex);
	if (!isp_bandwidth_mgr.use_count ||
		!isp_bandwidth_mgr.bus_client) {
		pr_err("%s: bandwidth manager inactive\n", __func__);
		pr_err("%s:error bandwidth manager inactive use_cnt:%d bus_clnt:%d\n",
			__func__, isp_bandwidth_mgr.use_count,
			isp_bandwidth_mgr.bus_client);
		return -EINVAL;
	}

@@ -147,8 +149,11 @@ void msm_isp_deinit_bandwidth_mgr(enum msm_isp_hw_client client)
		return;
	}

	if (!isp_bandwidth_mgr.bus_client)
	if (!isp_bandwidth_mgr.bus_client) {
		pr_err("%s:%d error: bus client invalid\n", __func__, __LINE__);
		mutex_unlock(&bandwidth_mgr_mutex);
		return;
	}

	msm_bus_scale_client_update_request(
	   isp_bandwidth_mgr.bus_client, 0);
+31 −3
Original line number Diff line number Diff line
@@ -639,7 +639,6 @@ static int cpp_init_hardware(struct cpp_device *cpp_dev)
		pr_err("%s: Bandwidth registration Failed!\n", __func__);
		goto bus_scale_register_failed;
	}
	msm_isp_update_bandwidth(ISP_CPP, 981345600, 1066680000);

	if (cpp_dev->fs_cpp == NULL) {
		cpp_dev->fs_cpp =
@@ -740,6 +739,8 @@ static int cpp_init_hardware(struct cpp_device *cpp_dev)
	cpp_dev->taskletq_idx = 0;
	atomic_set(&cpp_dev->irq_cnt, 0);
	msm_cpp_create_buff_queue(cpp_dev, MSM_CPP_MAX_BUFF_QUEUE);
	pr_err("stream_cnt:%d\n", cpp_dev->stream_cnt);
	cpp_dev->stream_cnt = 0;
	if (cpp_dev->is_firmware_loaded == 1) {
		disable_irq(cpp_dev->irq->start);
		cpp_load_fw(cpp_dev, cpp_dev->fw_name_bin);
@@ -763,7 +764,6 @@ clk_failed:
	regulator_disable(cpp_dev->fs_cpp);
	regulator_put(cpp_dev->fs_cpp);
fs_failed:
	msm_isp_update_bandwidth(ISP_CPP, 0, 0);
	msm_isp_deinit_bandwidth_mgr(ISP_CPP);
bus_scale_register_failed:
	return rc;
@@ -785,7 +785,11 @@ static void cpp_release_hardware(struct cpp_device *cpp_dev)
	regulator_disable(cpp_dev->fs_cpp);
	regulator_put(cpp_dev->fs_cpp);
	cpp_dev->fs_cpp = NULL;
	if (cpp_dev->stream_cnt > 0) {
		pr_err("error: stream count active\n");
		msm_isp_update_bandwidth(ISP_CPP, 0, 0);
	}
	cpp_dev->stream_cnt = 0;
	msm_isp_deinit_bandwidth_mgr(ISP_CPP);
}

@@ -1569,6 +1573,18 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,

		kfree(k_stream_buff_info.buffer_info);
		kfree(u_stream_buff_info);
		if (cpp_dev->stream_cnt == 0) {
			rc = msm_isp_update_bandwidth(ISP_CPP, 981345600,
				1066680000);
			if (rc < 0) {
				pr_err("Bandwidth Set Failed!\n");
				msm_isp_update_bandwidth(ISP_CPP, 0, 0);
				mutex_unlock(&cpp_dev->mutex);
				return -EINVAL;
			}
		}
		cpp_dev->stream_cnt++;
		pr_err("stream_cnt:%d\n", cpp_dev->stream_cnt);
		break;
	}
	case VIDIOC_MSM_CPP_DEQUEUE_STREAM_BUFF_INFO: {
@@ -1602,6 +1618,18 @@ long msm_cpp_subdev_ioctl(struct v4l2_subdev *sd,
		rc = msm_cpp_free_buff_queue_entry(cpp_dev,
			buff_queue_info->session_id,
			buff_queue_info->stream_id);
		if (cpp_dev->stream_cnt > 0) {
			cpp_dev->stream_cnt--;
			pr_err("stream_cnt:%d\n", cpp_dev->stream_cnt);
			if (cpp_dev->stream_cnt == 0) {
				rc = msm_isp_update_bandwidth(ISP_CPP, 0, 0);
				if (rc < 0)
					pr_err("Bandwidth Reset Failed!\n");
			}
		} else {
			pr_err("error: stream count underflow %d\n",
				cpp_dev->stream_cnt);
		}
		break;
	}
	case VIDIOC_MSM_CPP_GET_EVENTPAYLOAD: {
+1 −0
Original line number Diff line number Diff line
@@ -183,6 +183,7 @@ struct cpp_device {
	struct workqueue_struct *timer_wq;
	struct msm_cpp_work_t *work;
	uint32_t fw_version;
	uint8_t stream_cnt;

	int domain_num;
	struct iommu_domain *domain;