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

Commit 7e7607b5 authored by Pavan Kumar Chilamkurthi's avatar Pavan Kumar Chilamkurthi
Browse files

msm: camera: Add support for multiple clock rate levels



Add support to parse multiple levels of clock rates from
camera DT nodes so that drivers can select the required
clock rate level while setting and enabling clocks.
Update all camera DT nodes to define the clock control
strings and pass the default clock level while enabling soc
resources. Update cpas driver to select the required
AHB source clock level and set rate accordingly based on
clients requests.

Change-Id: I2ed421def355aa46692159f903155c421110f8f2
Signed-off-by: default avatarAlok Pandey <akumarpa@codeaurora.org>
Signed-off-by: default avatarPavan Kumar Chilamkurthi <pchilamk@codeaurora.org>
Signed-off-by: default avatarSoundrapandian Jeyaprakash <jsoundra@codeaurora.org>
parent 33362ba8
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -118,6 +118,12 @@ to CDM interface node.
  Value type: <string>
  Definition: List of Clients supported by CDM HW node.

- clock-cntl-level
  Usage: required
  Value type: <string>
  Definition: List of strings corresponds clock-rates levels.
  Supported strings: minsvs, lowsvs, svs, svs_l1, nominal, turbo.

Example:
	qcom,cpas-cdm0@ac48000 {
		cell-index = <0>;
@@ -143,5 +149,6 @@ Example:
			<&clock_camcc CAM_CC_CAMNOC_AXI_CLK>;
		qcom,clock-rates = <0 80000000 80000000 80000000 80000000 80000000>;
		cdm-client-names = "ife";
		clock-cntl-level = "turbo";
		status = "ok";
	};
+7 −0
Original line number Diff line number Diff line
@@ -97,6 +97,12 @@ First Level Node - CAM CPAS device
  Value type: <u32>
  Definition: List of clocks rates.

- clock-cntl-level
  Usage: required
  Value type: <string>
  Definition: List of strings corresponds clock-rates levels.
  Supported strings: minsvs, lowsvs, svs, svs_l1, nominal, turbo.

- qcom,msm-bus,name
- qcom,msm-bus,num-cases
- qcom,msm-bus,num-paths
@@ -191,6 +197,7 @@ Example:
			<&clock_camcc CAM_CC_CAMNOC_AXI_CLK>;
		src-clock-name = "slow_ahb_clk_src";
		clock-rates = <0 0 0 0 80000000 0>;
		clock-cntl-level = "turbo";
		qcom,msm-bus,name = "cam_ahb";
		qcom,msm-bus,num-cases = <4>;
		qcom,msm-bus,num-paths = <1>;
+11 −1
Original line number Diff line number Diff line
@@ -111,6 +111,12 @@ and name of firmware image.
  Value type: <phandle>
  Definition: List of clocks used for CDM HW.

- clock-cntl-level
  Usage: required
  Value type: <string>
  Definition: List of strings corresponds clock-rates levels.
  Supported strings: minsvs, lowsvs, svs, svs_l1, nominal, turbo.

- clock-rates
  Usage: required
  Value type: <u32>
@@ -157,6 +163,7 @@ a5: qcom,a5@a10000 {
			<&clock_camcc CAM_CC_ICP_TS_CLK>;

	clock-rates = <0 0 0 80000000 0 0 0 0 600000000 0 0>;
	clock-cntl-level = "turbo";
	fw_name = "CAMERA_ICP.elf";
};

@@ -177,6 +184,7 @@ qcom,ipe0 {
			<&clock_camcc CAM_CC_IPE_0_CLK_SRC>;

	clock-rates = <80000000 400000000 0 0 600000000>;
	clock-cntl-level = "turbo";
};

qcom,ipe1 {
@@ -196,6 +204,7 @@ qcom,ipe1 {
			<&clock_camcc CAM_CC_IPE_1_CLK_SRC>;

	clock-rates = <80000000 400000000 0 0 600000000>;
	clock-cntl-level = "turbo";
};

bps: qcom,bps {
@@ -215,5 +224,6 @@ bps: qcom,bps {
			<&clock_camcc CAM_CC_BPS_CLK_SRC>;

	clock-rates = <80000000 400000000 0 0 600000000>;
	clock-cntl-level = "turbo";
};
+2 −1
Original line number Diff line number Diff line
@@ -669,7 +669,8 @@ int cam_hw_cdm_init(void *hw_priv,
	soc_info = &cdm_hw->soc_info;
	cdm_core = (struct cam_cdm *)cdm_hw->core_info;

	rc = cam_soc_util_enable_platform_resource(soc_info, true, true);
	rc = cam_soc_util_enable_platform_resource(soc_info, true,
		CAM_SVS_VOTE, true);
	if (rc) {
		pr_err("Enable platform failed\n");
		goto end;
+22 −7
Original line number Diff line number Diff line
@@ -665,7 +665,8 @@ static int cam_cpas_util_get_ahb_level(struct cam_hw_info *cpas_hw,
}

static int cam_cpas_util_apply_client_ahb_vote(struct cam_hw_info *cpas_hw,
	struct cam_cpas_client *cpas_client, struct cam_ahb_vote *ahb_vote)
	struct cam_cpas_client *cpas_client, struct cam_ahb_vote *ahb_vote,
	enum cam_vote_level *applied_level)
{
	struct cam_cpas *cpas_core = (struct cam_cpas *) cpas_hw->core_info;
	struct cam_cpas_bus_client *ahb_bus_client = &cpas_core->ahb_bus_client;
@@ -710,9 +711,21 @@ static int cam_cpas_util_apply_client_ahb_vote(struct cam_hw_info *cpas_hw,

	rc = cam_cpas_util_vote_bus_client_level(ahb_bus_client,
		highest_level);
	if (rc)
	if (rc) {
		pr_err("Failed in ahb vote, level=%d, rc=%d\n",
			highest_level, rc);
		goto unlock_bus_client;
	}

	rc = cam_soc_util_set_clk_rate_level(&cpas_hw->soc_info, highest_level);
	if (rc) {
		pr_err("Failed in scaling clock rate level %d for AHB\n",
			highest_level);
		goto unlock_bus_client;
	}

	if (applied_level)
		*applied_level = highest_level;

unlock_bus_client:
	mutex_unlock(&ahb_bus_client->lock);
@@ -748,7 +761,7 @@ static int cam_cpas_hw_update_ahb_vote(struct cam_hw_info *cpas_hw,
		cpas_core->cpas_client[client_indx]->ahb_level);

	rc = cam_cpas_util_apply_client_ahb_vote(cpas_hw,
		cpas_core->cpas_client[client_indx], ahb_vote);
		cpas_core->cpas_client[client_indx], ahb_vote, NULL);

unlock_client:
	mutex_unlock(&cpas_core->client_mutex[client_indx]);
@@ -765,6 +778,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
	struct cam_cpas_client *cpas_client;
	struct cam_ahb_vote *ahb_vote;
	struct cam_axi_vote *axi_vote;
	enum cam_vote_level applied_level = CAM_SVS_VOTE;
	int rc;

	if (!hw_priv || !start_args) {
@@ -820,7 +834,7 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
		client_indx, ahb_vote->type, ahb_vote->vote.level,
		cpas_client->ahb_level);
	rc = cam_cpas_util_apply_client_ahb_vote(cpas_hw, cpas_client,
		ahb_vote);
		ahb_vote, &applied_level);
	if (rc)
		goto done;

@@ -833,7 +847,8 @@ static int cam_cpas_hw_start(void *hw_priv, void *start_args,
		goto done;

	if (cpas_core->streamon_clients == 0) {
		rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info);
		rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info,
			applied_level);
		if (rc) {
			pr_err("enable_resorce failed, rc=%d\n", rc);
			goto done;
@@ -932,7 +947,7 @@ static int cam_cpas_hw_stop(void *hw_priv, void *stop_args,
	ahb_vote.type = CAM_VOTE_ABSOLUTE;
	ahb_vote.vote.level = CAM_SUSPEND_VOTE;
	rc = cam_cpas_util_apply_client_ahb_vote(cpas_hw, cpas_client,
		&ahb_vote);
		&ahb_vote, NULL);
	if (rc)
		goto done;

@@ -1383,7 +1398,7 @@ int cam_cpas_hw_probe(struct platform_device *pdev,
	if (rc)
		goto axi_cleanup;

	rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info);
	rc = cam_cpas_soc_enable_resources(&cpas_hw->soc_info, CAM_SVS_VOTE);
	if (rc) {
		pr_err("failed in soc_enable_resources, rc=%d\n", rc);
		goto remove_default_vote;
Loading