linux/drivers/clk/qcom/clk-rpmh.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
 */

#include <linux/clk-provider.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <soc/qcom/cmd-db.h>
#include <soc/qcom/rpmh.h>
#include <soc/qcom/tcs.h>

#include <dt-bindings/clock/qcom,rpmh.h>

#define CLK_RPMH_ARC_EN_OFFSET
#define CLK_RPMH_VRM_EN_OFFSET

/**
 * struct bcm_db - Auxiliary data pertaining to each Bus Clock Manager(BCM)
 * @unit: divisor used to convert Hz value to an RPMh msg
 * @width: multiplier used to convert Hz value to an RPMh msg
 * @vcd: virtual clock domain that this bcm belongs to
 * @reserved: reserved to pad the struct
 */
struct bcm_db {};

/**
 * struct clk_rpmh - individual rpmh clock data structure
 * @hw:			handle between common and hardware-specific interfaces
 * @res_name:		resource name for the rpmh clock
 * @div:		clock divider to compute the clock rate
 * @res_addr:		base address of the rpmh resource within the RPMh
 * @res_on_val:		rpmh clock enable value
 * @state:		rpmh clock requested state
 * @aggr_state:		rpmh clock aggregated state
 * @last_sent_aggr_state: rpmh clock last aggr state sent to RPMh
 * @valid_state_mask:	mask to determine the state of the rpmh clock
 * @unit:		divisor to convert rate to rpmh msg in magnitudes of Khz
 * @dev:		device to which it is attached
 * @peer:		pointer to the clock rpmh sibling
 */
struct clk_rpmh {};

struct clk_rpmh_desc {};

static DEFINE_MUTEX(rpmh_clk_lock);

#define __DEFINE_CLK_RPMH(_name, _clk_name, _res_name,			\
			  _res_en_offset, _res_on, _div)

#define DEFINE_CLK_RPMH_ARC(_name, _res_name, _res_on, _div)

#define DEFINE_CLK_RPMH_VRM(_name, _suffix, _res_name, _div)

#define DEFINE_CLK_RPMH_BCM(_name, _res_name)

static inline struct clk_rpmh *to_clk_rpmh(struct clk_hw *_hw)
{}

static inline bool has_state_changed(struct clk_rpmh *c, u32 state)
{}

static int clk_rpmh_send(struct clk_rpmh *c, enum rpmh_state state,
			 struct tcs_cmd *cmd, bool wait)
{}

static int clk_rpmh_send_aggregate_command(struct clk_rpmh *c)
{}

/*
 * Update state and aggregate state values based on enable value.
 */
static int clk_rpmh_aggregate_state_send_command(struct clk_rpmh *c,
						bool enable)
{}

static int clk_rpmh_prepare(struct clk_hw *hw)
{}

static void clk_rpmh_unprepare(struct clk_hw *hw)
{
	struct clk_rpmh *c = to_clk_rpmh(hw);

	mutex_lock(&rpmh_clk_lock);
	clk_rpmh_aggregate_state_send_command(c, false);
	mutex_unlock(&rpmh_clk_lock);
};

static unsigned long clk_rpmh_recalc_rate(struct clk_hw *hw,
					unsigned long prate)
{}

static const struct clk_ops clk_rpmh_ops =;

static int clk_rpmh_bcm_send_cmd(struct clk_rpmh *c, bool enable)
{}

static int clk_rpmh_bcm_prepare(struct clk_hw *hw)
{}

static void clk_rpmh_bcm_unprepare(struct clk_hw *hw)
{}

static int clk_rpmh_bcm_set_rate(struct clk_hw *hw, unsigned long rate,
				 unsigned long parent_rate)
{}

static long clk_rpmh_round_rate(struct clk_hw *hw, unsigned long rate,
				unsigned long *parent_rate)
{}

static unsigned long clk_rpmh_bcm_recalc_rate(struct clk_hw *hw,
					unsigned long prate)
{}

static const struct clk_ops clk_rpmh_bcm_ops =;

/* Resource name must match resource id present in cmd-db */
DEFINE_CLK_RPMH_ARC();
DEFINE_CLK_RPMH_ARC();
DEFINE_CLK_RPMH_ARC();
DEFINE_CLK_RPMH_ARC();

DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();
DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_VRM();

DEFINE_CLK_RPMH_BCM(ce, "CE0");
DEFINE_CLK_RPMH_BCM(hwkm, "HK0");
DEFINE_CLK_RPMH_BCM(ipa, "IP0");
DEFINE_CLK_RPMH_BCM(pka, "PKA0");
DEFINE_CLK_RPMH_BCM(qpic_clk, "QP0");

static struct clk_hw *sdm845_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sdm845 =;

static struct clk_hw *sa8775p_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sa8775p =;

static struct clk_hw *sdm670_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sdm670 =;

static struct clk_hw *sdx55_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sdx55 =;

static struct clk_hw *sm8150_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm8150 =;

static struct clk_hw *sc7180_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sc7180 =;

static struct clk_hw *sc8180x_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sc8180x =;

static struct clk_hw *sm8250_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm8250 =;

static struct clk_hw *sm8350_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm8350 =;

static struct clk_hw *sc8280xp_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sc8280xp =;

static struct clk_hw *sm8450_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm8450 =;

static struct clk_hw *sm8550_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm8550 =;

static struct clk_hw *sm8650_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm8650 =;

static struct clk_hw *sc7280_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sc7280 =;

static struct clk_hw *sm6350_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm6350 =;

static struct clk_hw *sdx65_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sdx65 =;

static struct clk_hw *qdu1000_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_qdu1000 =;

static struct clk_hw *sdx75_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sdx75 =;

static struct clk_hw *sm4450_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_sm4450 =;

static struct clk_hw *x1e80100_rpmh_clocks[] =;

static const struct clk_rpmh_desc clk_rpmh_x1e80100 =;

static struct clk_hw *of_clk_rpmh_hw_get(struct of_phandle_args *clkspec,
					 void *data)
{}

static int clk_rpmh_probe(struct platform_device *pdev)
{}

static const struct of_device_id clk_rpmh_match_table[] =;
MODULE_DEVICE_TABLE(of, clk_rpmh_match_table);

static struct platform_driver clk_rpmh_driver =;

static int __init clk_rpmh_init(void)
{}
core_initcall(clk_rpmh_init);

static void __exit clk_rpmh_exit(void)
{}
module_exit(clk_rpmh_exit);

MODULE_DESCRIPTION();
MODULE_LICENSE();