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

Commit 08d7924e authored by Taniya Das's avatar Taniya Das
Browse files

clk: Add support to enumerate frequencies



The new clock api which would enumerate the frequency for a given index.

Change-Id: I01a4ea766a5f9d0a965fcc621aa98df4de206570
Signed-off-by: default avatarTaniya Das <tdas@codeaurora.org>
parent 492b05c7
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -2329,6 +2329,21 @@ int clk_set_flags(struct clk *clk, unsigned long flags)
}
EXPORT_SYMBOL_GPL(clk_set_flags);

unsigned long clk_list_frequency(struct clk *clk, unsigned int index)
{
	int ret = 0;

	if (!clk || !clk->core->ops->list_rate)
		return -EINVAL;

	clk_prepare_lock();
	ret = clk->core->ops->list_rate(clk->core->hw, index, ULONG_MAX);
	clk_prepare_unlock();

	return ret;
}
EXPORT_SYMBOL_GPL(clk_list_frequency);

/***        debugfs support        ***/

#ifdef CONFIG_DEBUG_FS
+10 −0
Original line number Diff line number Diff line
@@ -430,6 +430,16 @@ struct clk *clk_get_sys(const char *dev_id, const char *con_id);
 */
int clk_set_flags(struct clk *clk, unsigned long flags);

/**
 * clk_list_frequnecy - enumerate supported frequencies
 * @clk: clock source
 * @index: identify frequency to list
 *
 * Returns a non-negative integer frequency for success
 * or negative errno in case of failure.
 */
unsigned long clk_list_frequency(struct clk *clk, unsigned int index);

#else /* !CONFIG_HAVE_CLK */

static inline struct clk *clk_get(struct device *dev, const char *id)