Example #1
0
bool_t clk_mux_register(struct clk_mux_t * mclk)
{
	struct clk_t * clk;

	if(!mclk || !mclk->name)
		return FALSE;

	if(clk_search(mclk->name))
		return FALSE;

	clk = malloc(sizeof(struct clk_t));
	if(!clk)
		return FALSE;

	clk->name = mclk->name;
	clk->type = CLK_TYPE_MUX;
	clk->count = 0;
	clk->set_parent = clk_mux_set_parent;
	clk->get_parent = clk_mux_get_parent;
	clk->set_enable = clk_mux_set_enable;
	clk->get_enable = clk_mux_get_enable;
	clk->set_rate = clk_mux_set_rate;
	clk->get_rate = clk_mux_get_rate;
	clk->priv = mclk;

	if(!clk_register(clk))
	{
		free(clk);
		return FALSE;
	}

	return TRUE;
}
Example #2
0
bool_t clk_gate_register(struct clk_gate_t * gclk)
{
	struct clk_t * clk;

	if(!gclk || !gclk->name)
		return FALSE;

	if(clk_search(gclk->name))
		return FALSE;

	clk = malloc(sizeof(struct clk_t));
	if(!clk)
		return FALSE;

	gclk->virt = phys_to_virt(gclk->phys);
	clk->name = gclk->name;
	clk->type = CLK_TYPE_GATE;
	clk->count = 0;
	clk->set_parent = clk_gate_set_parent;
	clk->get_parent = clk_gate_get_parent;
	clk->set_enable = clk_gate_set_enable;
	clk->get_enable = clk_gate_get_enable;
	clk->set_rate = clk_gate_set_rate;
	clk->get_rate = clk_gate_get_rate;
	clk->priv = gclk;

	if(!clk_register(clk))
	{
		free(clk);
		return FALSE;
	}

	return TRUE;
}
Example #3
0
bool_t clk_pll_register(struct clk_pll_t * pclk)
{
	struct clk_t * clk;

	if(!pclk || !pclk->name)
		return FALSE;

	if(clk_search(pclk->name))
		return FALSE;

	clk = malloc(sizeof(struct clk_t));
	if(!clk)
		return FALSE;

	clk->name = pclk->name;
	clk->type = CLK_TYPE_PLL;
	clk->count = 0;
	clk->set_parent = clk_pll_set_parent;
	clk->get_parent = clk_pll_get_parent;
	clk->set_enable = clk_pll_set_enable;
	clk->get_enable = clk_pll_get_enable;
	clk->set_rate = clk_pll_set_rate;
	clk->get_rate = clk_pll_get_rate;
	clk->priv = pclk;

	if(!clk_register(clk))
	{
		free(clk);
		return FALSE;
	}

	return TRUE;
}
Example #4
0
bool_t clk_fixed_register(struct clk_fixed_t * fclk)
{
	struct clk_t * clk;

	if(!fclk || !fclk->name)
		return FALSE;

	if(clk_search(fclk->name))
		return FALSE;

	clk = malloc(sizeof(struct clk_t));
	if(!clk)
		return FALSE;

	clk->name = fclk->name;
	clk->type = CLK_TYPE_FIXED;
	clk->count = 0;
	clk->set_parent = clk_fixed_set_parent;
	clk->get_parent = clk_fixed_get_parent;
	clk->set_enable = clk_fixed_set_enable;
	clk->get_enable = clk_fixed_get_enable;
	clk->set_rate = clk_fixed_set_rate;
	clk->get_rate = clk_fixed_get_rate;
	clk->priv = fclk;

	if(!clk_register(clk))
	{
		free(clk);
		return FALSE;
	}

	return TRUE;
}
Example #5
0
bool_t clk_mux_unregister(struct clk_mux_t * mclk)
{
	struct clk_t * clk;

	if(!mclk || !mclk->name)
		return FALSE;

	clk = clk_search(mclk->name);
	if(!clk)
		return FALSE;

	if(clk_unregister(clk))
	{
		free(clk);
		return TRUE;
	}

	return FALSE;
}
Example #6
0
bool_t clk_gate_unregister(struct clk_gate_t * gclk)
{
	struct clk_t * clk;

	if(!gclk || !gclk->name)
		return FALSE;

	clk = clk_search(gclk->name);
	if(!clk)
		return FALSE;

	if(clk_unregister(clk))
	{
		free(clk);
		return TRUE;
	}

	return FALSE;
}
Example #7
0
bool_t clk_fixed_factor_unregister(struct clk_fixed_factor_t * fclk)
{
	struct clk_t * clk;

	if(!fclk || !fclk->name)
		return FALSE;

	clk = clk_search(fclk->name);
	if(!clk)
		return FALSE;

	if(clk_unregister(clk))
	{
		free(clk);
		return TRUE;
	}

	return FALSE;
}
Example #8
0
bool_t clk_pll_unregister(struct clk_pll_t * pclk)
{
	struct clk_t * clk;

	if(!pclk || !pclk->name)
		return FALSE;

	clk = clk_search(pclk->name);
	if(!clk)
		return FALSE;

	if(clk_unregister(clk))
	{
		free(clk);
		return TRUE;
	}

	return FALSE;
}