Exemplo n.º 1
0
static ssize_t clk_prcmu_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
{
	unsigned long clk_tmpbuf;
	unsigned char clkreg_buf;

	sscanf(buf, "%x %ld", &clk_regs, &clk_tmpbuf);

	clkreg_buf = clk_regs;

	pr_info("clock-con: 0x%x %ldHz\n", clkreg_buf, clk_tmpbuf);

	prcmu_set_clock_rate(clkreg_buf, (unsigned long) clk_tmpbuf);
	
	return count;
}
Exemplo n.º 2
0
static struct clk *clk_reg_prcmu(const char *name,
				 const char *parent_name,
				 u8 cg_sel,
				 unsigned long rate,
				 unsigned long flags,
				 struct clk_ops *clk_prcmu_ops)
{
	struct clk_prcmu *clk;
	struct clk_init_data clk_prcmu_init;
	struct clk *clk_reg;

	if (!name) {
		pr_err("clk_prcmu: %s invalid arguments passed\n", __func__);
		return ERR_PTR(-EINVAL);
	}

	clk = kzalloc(sizeof(struct clk_prcmu), GFP_KERNEL);
	if (!clk) {
		pr_err("clk_prcmu: %s could not allocate clk\n", __func__);
		return ERR_PTR(-ENOMEM);
	}

	clk->cg_sel = cg_sel;
	clk->is_prepared = 1;
	clk->is_enabled = 1;
	clk->opp_requested = 0;
	/* "rate" can be used for changing the initial frequency */
	if (rate)
		prcmu_set_clock_rate(cg_sel, rate);

	clk_prcmu_init.name = name;
	clk_prcmu_init.ops = clk_prcmu_ops;
	clk_prcmu_init.flags = flags;
	clk_prcmu_init.parent_names = (parent_name ? &parent_name : NULL);
	clk_prcmu_init.num_parents = (parent_name ? 1 : 0);
	clk->hw.init = &clk_prcmu_init;

	clk_reg = clk_register(NULL, &clk->hw);
	if (IS_ERR_OR_NULL(clk_reg))
		goto free_clk;

	return clk_reg;

free_clk:
	kfree(clk);
	pr_err("clk_prcmu: %s failed to register clk\n", __func__);
	return ERR_PTR(-ENOMEM);
}
Exemplo n.º 3
0
static int clk_prcmu_set_rate(struct clk_hw *hw, unsigned long rate,
			      unsigned long parent_rate)
{
	struct clk_prcmu *clk = to_clk_prcmu(hw);
	return prcmu_set_clock_rate(clk->cg_sel, rate);
}
Exemplo n.º 4
0
static int prcmu_clk_set_rate(struct clk *clk, unsigned long rate)
{
	return prcmu_set_clock_rate(clk->cg_sel, rate);
}