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

Commit 1f078aa3 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "clk: qcom: Register as bus clients to vote for bandwidth"

parents 487f020c 4b878495
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -24,8 +24,10 @@
#include <linux/clk-provider.h>
#include <linux/regmap.h>
#include <linux/reset-controller.h>
#include <linux/msm-bus.h>

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

#include "common.h"
#include "clk-regmap.h"
@@ -38,9 +40,41 @@

#define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }

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

static DEFINE_VDD_REGULATORS(vdd_mm, VDD_MM_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,
@@ -2434,6 +2468,8 @@ static int cam_cc_sm8150_probe(struct platform_device *pdev)
	struct regmap *regmap;
	struct clk *clk;
	int ret = 0;
	int i;
	unsigned int camcc_bus_id;

	regmap = qcom_cc_map(pdev, &cam_cc_sm8150_desc);
	if (IS_ERR(regmap)) {
@@ -2466,6 +2502,18 @@ static int cam_cc_sm8150_probe(struct platform_device *pdev)
	}
	vdd_mm.use_max_uV = true;

	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_sm8150_clocks); i++)
		if (cam_cc_sm8150_clocks[i])
			*(unsigned int *)(void *)
			&cam_cc_sm8150_clocks[i]->hw.init->bus_cl_id =
			camcc_bus_id;

	ret = cam_cc_sm8150_fixup(pdev, regmap);
	if (ret)
		return ret;
+14 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@

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

#define PLL_MODE		0x00
#define PLL_OUTCTRL		BIT(0)
@@ -1297,6 +1298,7 @@ const struct clk_ops clk_pll_sleep_vote_ops = {
	.enable = clk_enable_regmap,
	.disable = clk_disable_regmap,
	.list_registers = clk_alpha_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_pll_sleep_vote_ops);

@@ -1308,6 +1310,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);

@@ -1319,6 +1322,7 @@ const struct clk_ops clk_alpha_pll_hwfsm_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_hwfsm_ops);

@@ -1331,6 +1335,7 @@ const struct clk_ops clk_trion_pll_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_trion_pll_set_rate,
	.list_registers = clk_trion_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_trion_pll_ops);

@@ -1341,6 +1346,7 @@ const struct clk_ops clk_trion_fixed_pll_ops = {
	.recalc_rate = clk_trion_pll_recalc_rate,
	.round_rate = clk_alpha_pll_round_rate,
	.list_registers = clk_trion_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_trion_fixed_pll_ops);

@@ -1352,6 +1358,7 @@ const struct clk_ops clk_regera_pll_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_regera_pll_set_rate,
	.list_registers = clk_regera_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_regera_pll_ops);

@@ -1417,6 +1424,7 @@ 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);

@@ -1498,6 +1506,7 @@ const struct clk_ops clk_trion_pll_postdiv_ops = {
	.recalc_rate = clk_trion_pll_postdiv_recalc_rate,
	.round_rate = clk_trion_pll_postdiv_round_rate,
	.set_rate = clk_trion_pll_postdiv_set_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_trion_pll_postdiv_ops);

@@ -1704,6 +1713,7 @@ const struct clk_ops clk_alpha_pll_slew_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_alpha_pll_slew_set_rate,
	.list_registers = clk_alpha_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_alpha_pll_slew_ops);

@@ -2047,6 +2057,7 @@ const struct clk_ops clk_fabia_pll_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_fabia_pll_set_rate,
	.list_registers = clk_fabia_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_fabia_pll_ops);

@@ -2056,6 +2067,7 @@ const struct clk_ops clk_fabia_fixed_pll_ops = {
	.recalc_rate = clk_fabia_pll_recalc_rate,
	.round_rate = clk_alpha_pll_round_rate,
	.list_registers = clk_fabia_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_fabia_fixed_pll_ops);

@@ -2137,6 +2149,7 @@ const struct clk_ops clk_generic_pll_postdiv_ops = {
	.recalc_rate = clk_generic_pll_postdiv_recalc_rate,
	.round_rate = clk_generic_pll_postdiv_round_rate,
	.set_rate = clk_generic_pll_postdiv_set_rate,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_generic_pll_postdiv_ops);

@@ -2274,5 +2287,6 @@ const struct clk_ops clk_agera_pll_ops = {
	.round_rate = clk_alpha_pll_round_rate,
	.set_rate = clk_agera_pll_set_rate,
	.list_registers = clk_agera_pll_list_registers,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL(clk_agera_pll_ops);
+6 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013, 2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013, 2017-2018 The Linux Foundation. All rights reserved.
 *
 * This software is licensed under the terms of the GNU General Public
 * License version 2, as published by the Free Software Foundation, and
@@ -189,6 +189,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);

@@ -378,6 +379,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);

@@ -443,6 +445,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);

@@ -500,6 +503,7 @@ const struct clk_ops clk_gate2_ops = {
	.is_enabled = clk_is_enabled_regmap,
	.list_registers = clk_gate2_list_registers,
	.debug_init = clk_debug_measure_add,
	.bus_vote = clk_debug_bus_vote,
};
EXPORT_SYMBOL_GPL(clk_gate2_ops);

@@ -507,5 +511,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
@@ -392,3 +392,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);
}
+1 −0
Original line number Diff line number Diff line
@@ -140,5 +140,6 @@ extern const struct clk_ops clk_debug_mux_ops;

int clk_debug_measure_register(struct clk_hw *hw);
int clk_debug_measure_add(struct clk_hw *hw, struct dentry *dentry);
void clk_debug_bus_vote(struct clk_hw *hw, bool enable);

#endif
Loading