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

Commit 00638d38 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "qcom: clk: Dynamically retrieve parent for ext clocks"

parents 3f12e2dc b51de780
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -515,6 +515,15 @@ static int ext_set_parent(struct clk *c, struct clk *p)
	return clk_set_parent(c->parent, p);
}

static struct clk *ext_get_parent(struct clk *c)
{
	struct ext_clk *ext = to_ext_clk(c);

	if (!IS_ERR_OR_NULL(c->parent))
		return c->parent;
	return clk_get(ext->dev, ext->clk_id);
}

static enum handoff ext_handoff(struct clk *c)
{
	c->rate = clk_get_rate(c->parent);
@@ -528,6 +537,7 @@ struct clk_ops clk_ops_ext = {
	.set_rate = ext_set_rate,
	.get_rate = parent_get_rate,
	.set_parent = ext_set_parent,
	.get_parent = ext_get_parent,
};


+9 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#define __MSM_CLOCK_GENERIC_H

#include <linux/clk/msm-clk-provider.h>
#include <linux/of.h>

/**
 * struct fixed_clk - fixed rate clock
@@ -138,10 +139,18 @@ extern struct clk_ops clk_ops_slave_div;

struct ext_clk {
	struct clk c;
	struct device *dev;
	char *clk_id;
};

long parent_round_rate(struct clk *c, unsigned long rate);
unsigned long parent_get_rate(struct clk *c);

static inline struct ext_clk *to_ext_clk(struct clk *c)
{
	return container_of(c, struct ext_clk, c);
}

extern struct clk_ops clk_ops_ext;

#define DEFINE_FIXED_DIV_CLK(clk_name, _div, _parent) \