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

Commit 4b48402c authored by Gjorgji Rosikopulos's avatar Gjorgji Rosikopulos
Browse files

msm: fd: Add face detect engine speed support



Face detection engine can operate on different clock
rates based on requested usecase.
Driver have support for speed control but device tree
support was missing.
If we want to support different speed levels we need to define
them in device tree. Rate levels should be
defined in incremental manner starting from lower clock rate.

Change-Id: Ie17f8d43728b75a9313ca2947b6f42f6687d4667
Signed-off-by: default avatarGjorgji Rosikopulos <grosik@codeaurora.org>
parent 2f0184f7
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -30,6 +30,8 @@ Optional properties:

- clock-rates: should specify clock rates in Hz to each clocks
  property defined.
  If we want to have different operating clock frequencies we can define
  rate levels. They should be defined in incremental order.

Example:

@@ -48,5 +50,7 @@ Example:
                 <&clock_mmss clk_fd_ahb_clk>;
        clock-names = "fd_core_clk", "fd_core_uar_clk",
                      "fd_axi_clk", "fd_ahb_clk";
        clock-rates = <400000000 400000000 333000000 80000000>;
        clock-rates = <60000000 60000000 75000000 40000000>,
			<200000000 200000000 150000000 40000000>,
			<400000000 400000000 333000000 80000000>;
    };
+20 −4
Original line number Diff line number Diff line
@@ -565,6 +565,7 @@ int msm_fd_hw_get_clocks(struct msm_fd_device *fd)
{
	const char *clk_name;
	size_t cnt;
	int clk_rates;
	int i;
	int ret;

@@ -574,6 +575,7 @@ int msm_fd_hw_get_clocks(struct msm_fd_device *fd)
		return -EINVAL;
	}

	clk_rates = 0;
	for (i = 0; i < cnt; i++) {
		ret = of_property_read_string_index(fd->dev->of_node,
			"clock-names", i, &clk_name);
@@ -592,13 +594,27 @@ int msm_fd_hw_get_clocks(struct msm_fd_device *fd)
	}
	fd->clk_num = cnt;

	ret = of_property_read_u32_array(fd->dev->of_node, "clock-rates",
		fd->clk_rates[0], fd->clk_num);
	if (ret < 0) {
	cnt = 0;
	for (clk_rates = 0; clk_rates < MSM_FD_MAX_CLK_RATES; clk_rates++) {
		for (i = 0; i < fd->clk_num; i++) {
			ret = of_property_read_u32_index(fd->dev->of_node,
				"clock-rates", cnt++,
				&fd->clk_rates[clk_rates][i]);
			if (ret < 0)
				break;
			dev_dbg(fd->dev, "Clock rate idx %d idx %d value %d\n",
				clk_rates, i, fd->clk_rates[clk_rates][i]);

		}
		if (ret < 0)
			break;
	}
	fd->clk_rates_num = clk_rates;
	if (fd->clk_rates_num == 0) {
		ret = -ENOENT;
		dev_err(fd->dev, "Can not get clock rates\n");
		goto error;
	}
	fd->clk_rates_num = 1;

	return 0;
error: