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

Commit b7e3a836 authored by Jigarkumar Zala's avatar Jigarkumar Zala
Browse files

msm: camera: cpas: Use device tree entry to set camnoc-min-bw



Set the camnoc min axi bw vote to the bus driver by reading
this entry from the device tree. If this entry from the device tree
is not listed then the pre-defined default value will be used.

Change-Id: I7d5f47120d58ecaa5c77a9d982cf639dd963dbb7
Signed-off-by: default avatarJigarkumar Zala <jzala@codeaurora.org>
parent ccc7d2cd
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -71,6 +71,11 @@ First Level Node - CAM CPAS device
  Value type: <u32>
  Definition: CAM HW Version information.

- camnoc-axi-min-ib-bw
  Usage: optional
  Value type: <u64>
  Definition: Min camnoc axi bw for the given target.

- regulator-names
  Usage: required
  Value type: <string>
+3 −7
Original line number Diff line number Diff line
@@ -22,11 +22,6 @@
#include "cam_cpas_hw_intf.h"
#include "cam_cpas_soc.h"

#define CAM_CPAS_AXI_MIN_MNOC_AB_BW   (2048 * 1024)
#define CAM_CPAS_AXI_MIN_MNOC_IB_BW   (2048 * 1024)
#define CAM_CPAS_AXI_MIN_CAMNOC_AB_BW (2048 * 1024)
#define CAM_CPAS_AXI_MIN_CAMNOC_IB_BW (3000000000L)

static uint cam_min_camnoc_ib_bw;
module_param(cam_min_camnoc_ib_bw, uint, 0644);

@@ -584,8 +579,9 @@ static int cam_cpas_util_set_camnoc_axi_clk_rate(
			soc_private->camnoc_axi_clk_bw_margin) / 100;

		if ((required_camnoc_bw > 0) &&
			(required_camnoc_bw < CAM_CPAS_AXI_MIN_CAMNOC_IB_BW))
			required_camnoc_bw = CAM_CPAS_AXI_MIN_CAMNOC_IB_BW;
			(required_camnoc_bw <
			soc_private->camnoc_axi_min_ib_bw))
			required_camnoc_bw = soc_private->camnoc_axi_min_ib_bw;

		clk_rate = required_camnoc_bw / soc_private->camnoc_bus_width;

+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,11 @@
#define CAM_CPAS_MAX_CLIENTS 30
#define CAM_CPAS_INFLIGHT_WORKS 5

#define CAM_CPAS_AXI_MIN_MNOC_AB_BW   (2048 * 1024)
#define CAM_CPAS_AXI_MIN_MNOC_IB_BW   (2048 * 1024)
#define CAM_CPAS_AXI_MIN_CAMNOC_AB_BW (2048 * 1024)
#define CAM_CPAS_AXI_MIN_CAMNOC_IB_BW (3000000000L)

#define CAM_CPAS_GET_CLIENT_IDX(handle) (handle)
#define CAM_CPAS_GET_CLIENT_HANDLE(indx) (indx)

+21 −0
Original line number Diff line number Diff line
@@ -68,6 +68,27 @@ int cam_cpas_get_custom_dt_info(struct platform_device *pdev,

	CAM_DBG(CAM_CPAS, "CPAS HW VERSION %x", soc_private->hw_version);

	soc_private->camnoc_axi_min_ib_bw = 0;
	rc = of_property_read_u64(of_node,
		"camnoc-axi-min-ib-bw",
		&soc_private->camnoc_axi_min_ib_bw);
	if (rc == -EOVERFLOW) {
		soc_private->camnoc_axi_min_ib_bw = 0;
		rc = of_property_read_u32(of_node,
			"camnoc-axi-min-ib-bw",
			(u32 *)&soc_private->camnoc_axi_min_ib_bw);
	}

	if (rc) {
		CAM_DBG(CAM_CPAS,
			"failed to read camnoc-axi-min-ib-bw rc:%d", rc);
		soc_private->camnoc_axi_min_ib_bw =
			CAM_CPAS_AXI_MIN_CAMNOC_IB_BW;
	}

	CAM_DBG(CAM_CPAS, "camnoc-axi-min-ib-bw = %llu",
		soc_private->camnoc_axi_min_ib_bw);

	soc_private->client_id_based = of_property_read_bool(of_node,
		"client-id-based");

+2 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ struct cam_cpas_vdd_ahb_mapping {
 * @camnoc_bus_width : CAMNOC Bus width
 * @camnoc_axi_clk_bw_margin : BW Margin in percentage to add while calculating
 *      camnoc axi clock
 * @camnoc_axi_min_ib_bw: Min camnoc BW which varies based on target
 *
 */
struct cam_cpas_private_soc {
@@ -63,6 +64,7 @@ struct cam_cpas_private_soc {
	bool control_camnoc_axi_clk;
	uint32_t camnoc_bus_width;
	uint32_t camnoc_axi_clk_bw_margin;
	uint64_t camnoc_axi_min_ib_bw;
};

int cam_cpas_soc_init_resources(struct cam_hw_soc_info *soc_info,