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

Commit 2d8536a6 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "clk: add bus voting to rate_get, rate_set, enable_set debug functions"

parents fd44ff15 0d8060cd
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -3404,11 +3404,19 @@ static int clock_debug_rate_set(void *data, u64 val)
	struct clk_core *core = data;
	int ret;

	clk_prepare_lock();
	if (core->ops->bus_vote)
		core->ops->bus_vote(core->hw, true);

	ret = clk_set_rate(core->hw->clk, val);
	if (ret)
		pr_err("clk_set_rate(%lu) failed (%d)\n",
				(unsigned long)val, ret);

	if (core->ops->bus_vote)
		core->ops->bus_vote(core->hw, false);
	clk_prepare_unlock();

	return ret;
}

@@ -3416,8 +3424,16 @@ static int clock_debug_rate_get(void *data, u64 *val)
{
	struct clk_core *core = data;

	clk_prepare_lock();
	if (core->ops->bus_vote)
		core->ops->bus_vote(core->hw, true);

	*val = clk_get_rate(core->hw->clk);

	if (core->ops->bus_vote)
		core->ops->bus_vote(core->hw, false);
	clk_prepare_unlock();

	return 0;
}

@@ -3446,11 +3462,19 @@ static int clock_debug_enable_set(void *data, u64 val)
	struct clk_core *core = data;
	int rc = 0;

	clk_prepare_lock();
	if (core->ops->bus_vote)
		core->ops->bus_vote(core->hw, true);

	if (val)
		rc = clk_prepare_enable(core->hw->clk);
	else
		clk_disable_unprepare(core->hw->clk);

	if (core->ops->bus_vote)
		core->ops->bus_vote(core->hw, false);
	clk_prepare_unlock();

	return rc;
}

+48 −1
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/msm-bus.h>
#include <linux/of_device.h>
#include <linux/of.h>
#include <linux/platform_device.h>
@@ -16,6 +17,7 @@
#include <linux/reset-controller.h>

#include <dt-bindings/clock/qcom,camcc-kona.h>
#include <dt-bindings/msm/msm-bus-ids.h>

#include "clk-alpha-pll.h"
#include "clk-branch.h"
@@ -27,9 +29,41 @@
#include "reset.h"
#include "vdd-level.h"

#define MSM_BUS_VECTOR(_src, _dst, _ab, _ib)	\
{						\
	.src = _src,				\
	.dst = _dst,				\
	.ab = _ab,				\
	.ib = _ib,				\
}

static DEFINE_VDD_REGULATORS(vdd_mm, VDD_NUM, 1, vdd_corner);
static DEFINE_VDD_REGULATORS(vdd_mx, VDD_NUM, 1, vdd_corner);

static struct msm_bus_vectors clk_debugfs_vectors[] = {
	MSM_BUS_VECTOR(MSM_BUS_MASTER_AMPSS_M0,
			MSM_BUS_SLAVE_CAMERA_CFG, 0, 0),
	MSM_BUS_VECTOR(MSM_BUS_MASTER_AMPSS_M0,
			MSM_BUS_SLAVE_CAMERA_CFG, 0, 1),
};

static struct msm_bus_paths clk_debugfs_usecases[] = {
	{
		.num_paths = 1,
		.vectors = &clk_debugfs_vectors[0],
	},
	{
		.num_paths = 1,
		.vectors = &clk_debugfs_vectors[1],
	}
};

static struct msm_bus_scale_pdata clk_debugfs_scale_table = {
	.usecase = clk_debugfs_usecases,
	.num_usecases = ARRAY_SIZE(clk_debugfs_usecases),
	.name = "clk_camcc_debugfs",
};

enum {
	P_BI_TCXO,
	P_BI_TCXO_MX,
@@ -2567,7 +2601,8 @@ static int cam_cc_kona_probe(struct platform_device *pdev)
{
	struct regmap *regmap;
	struct clk *clk;
	int ret;
	int ret, i;
	unsigned int camcc_bus_id;

	regmap = qcom_cc_map(pdev, &cam_cc_kona_desc);
	if (IS_ERR(regmap)) {
@@ -2599,6 +2634,18 @@ static int cam_cc_kona_probe(struct platform_device *pdev)
		return PTR_ERR(vdd_mm.regulator[0]);
	}

	camcc_bus_id = msm_bus_scale_register_client(&clk_debugfs_scale_table);
	if (!camcc_bus_id) {
		dev_err(&pdev->dev, "Unable to register for bw voting\n");
		return -EPROBE_DEFER;
	}

	for (i = 0; i < ARRAY_SIZE(cam_cc_kona_clocks); i++)
		if (cam_cc_kona_clocks[i])
			*(unsigned int *)(void *)
			&cam_cc_kona_clocks[i]->hw.init->bus_cl_id =
			camcc_bus_id;

	clk_lucid_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config);
	clk_lucid_pll_configure(&cam_cc_pll1, regmap, &cam_cc_pll1_config);
	clk_zonda_pll_configure(&cam_cc_pll2, regmap, &cam_cc_pll2_config);
+14 −0
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@

#include "clk-alpha-pll.h"
#include "common.h"
#include "clk-debug.h"

#define PLL_MODE(p)		((p)->offset + 0x0)
# define PLL_OUTCTRL		BIT(0)
@@ -1109,6 +1110,7 @@ const struct clk_ops clk_alpha_pll_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_alpha_pll_set_rate,
	.list_registers = clk_alpha_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_ops);

@@ -1119,6 +1121,7 @@ const struct clk_ops clk_alpha_pll_huayra_ops = {
	.recalc_rate = alpha_pll_huayra_recalc_rate,
	.round_rate = alpha_pll_huayra_round_rate,
	.set_rate = alpha_pll_huayra_set_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_huayra_ops);

@@ -1130,6 +1133,7 @@ const struct clk_ops clk_alpha_pll_hwfsm_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_alpha_pll_hwfsm_set_rate,
	.list_registers = clk_alpha_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_hwfsm_ops);

@@ -1141,6 +1145,7 @@ const struct clk_ops clk_alpha_pll_zonda_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_zonda_pll_set_rate,
	.list_registers = clk_zonda_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_alpha_pll_zonda_ops);

@@ -1233,12 +1238,14 @@ const struct clk_ops clk_alpha_pll_postdiv_ops = {
	.recalc_rate = clk_alpha_pll_postdiv_recalc_rate,
	.round_rate = clk_alpha_pll_postdiv_round_rate,
	.set_rate = clk_alpha_pll_postdiv_set_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_ops);

const struct clk_ops clk_alpha_pll_postdiv_ro_ops = {
	.round_rate = clk_alpha_pll_postdiv_round_ro_rate,
	.recalc_rate = clk_alpha_pll_postdiv_recalc_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_ro_ops);

@@ -1407,6 +1414,7 @@ const struct clk_ops clk_alpha_pll_fabia_ops = {
	.set_rate = alpha_pll_fabia_set_rate,
	.recalc_rate = alpha_pll_fabia_recalc_rate,
	.round_rate = clk_alpha_pll_round_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_fabia_ops);

@@ -1416,6 +1424,7 @@ const struct clk_ops clk_alpha_pll_fixed_fabia_ops = {
	.is_enabled = clk_alpha_pll_is_enabled,
	.recalc_rate = alpha_pll_fabia_recalc_rate,
	.round_rate = clk_alpha_pll_round_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_fixed_fabia_ops);

@@ -1501,6 +1510,7 @@ const struct clk_ops clk_alpha_pll_postdiv_fabia_ops = {
	.recalc_rate = clk_alpha_pll_postdiv_fabia_recalc_rate,
	.round_rate = clk_alpha_pll_postdiv_fabia_round_rate,
	.set_rate = clk_alpha_pll_postdiv_fabia_set_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_fabia_ops);

@@ -1508,6 +1518,7 @@ const struct clk_ops clk_alpha_pll_postdiv_zonda_ops = {
	.recalc_rate = clk_alpha_pll_postdiv_fabia_recalc_rate,
	.round_rate = clk_alpha_pll_postdiv_fabia_round_rate,
	.set_rate = clk_alpha_pll_postdiv_fabia_set_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_alpha_pll_postdiv_zonda_ops);

@@ -1869,6 +1880,7 @@ const struct clk_ops clk_alpha_pll_lucid_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = alpha_pll_lucid_set_rate,
	.list_registers = clk_alpha_pll_lucid_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_lucid_ops);

@@ -1879,6 +1891,7 @@ const struct clk_ops clk_alpha_pll_fixed_lucid_ops = {
	.recalc_rate = alpha_pll_lucid_recalc_rate,
	.round_rate = clk_alpha_pll_round_rate,
	.list_registers = clk_alpha_pll_lucid_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_fixed_lucid_ops);

@@ -1886,5 +1899,6 @@ const struct clk_ops clk_alpha_pll_postdiv_lucid_ops = {
	.recalc_rate = clk_alpha_pll_postdiv_fabia_recalc_rate,
	.round_rate = clk_alpha_pll_postdiv_fabia_round_rate,
	.set_rate = clk_alpha_pll_postdiv_fabia_set_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_alpha_pll_postdiv_lucid_ops);
+5 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2013, 2017-2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013, 2017-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/kernel.h>
@@ -179,6 +179,7 @@ const struct clk_ops clk_branch_ops = {
	.disable = clk_branch_disable,
	.is_enabled = clk_is_enabled_regmap,
	.set_flags = clk_branch_set_flags,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_branch_ops);

@@ -368,6 +369,7 @@ const struct clk_ops clk_branch2_ops = {
	.set_flags = clk_branch_set_flags,
	.list_registers = clk_branch2_list_registers,
	.debug_init = clk_debug_measure_add,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_branch2_ops);

@@ -433,6 +435,7 @@ const struct clk_ops clk_branch2_hw_ctl_ops = {
	.recalc_rate = clk_branch2_hw_ctl_recalc_rate,
	.determine_rate = clk_branch2_hw_ctl_determine_rate,
	.set_flags = clk_branch_set_flags,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_branch2_hw_ctl_ops);

@@ -440,5 +443,6 @@ const struct clk_ops clk_branch_simple_ops = {
	.enable = clk_enable_regmap,
	.disable = clk_disable_regmap,
	.is_enabled = clk_is_enabled_regmap,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_branch_simple_ops);
+6 −0
Original line number Diff line number Diff line
@@ -381,3 +381,9 @@ int clk_debug_measure_register(struct clk_hw *hw)
}
EXPORT_SYMBOL(clk_debug_measure_register);

void clk_debug_bus_vote(struct clk_hw *hw, bool enable)
{
	if (hw->init->bus_cl_id)
		msm_bus_scale_client_update_request(hw->init->bus_cl_id,
								enable);
}
Loading