static struct clk *osc;
static struct delayed_work low_bus_freq_handler;
-extern void update_usecount(struct clk *clk, bool flag);
-static inline void update_periph_clk_parent(struct clk *new_parent)
-{
- update_usecount(periph_clk->parent, false);
-
- periph_clk->parent = new_parent;
-
- update_usecount(periph_clk->parent, true);
-}
static void reduce_bus_freq_handler(struct work_struct *work)
{
unsigned long reg;
clk_enable(pll2_400);
update_ddr_freq(50000000);
/* Make sure periph clk's parent also got updated */
- update_periph_clk_parent(pll2_200);
-
+ clk_set_parent(periph_clk, pll2_200);
audio_bus_freq_mode = 1;
low_bus_freq_mode = 0;
} else {
update_ddr_freq(24000000);
/* Make sure periph clk's parent also got updated */
- update_periph_clk_parent(osc);
+ clk_set_parent(periph_clk, osc);
if (audio_bus_freq_mode)
clk_disable(pll2_400);
low_bus_freq_mode = 1;
if (high_bus_freq) {
update_ddr_freq(ddr_normal_rate);
/* Make sure periph clk's parent also got updated */
- update_periph_clk_parent(pll2);
+ clk_set_parent(periph_clk, pll2);
if (med_bus_freq_mode)
clk_disable(pll2_400);
high_bus_freq_mode = 1;
clk_enable(pll2_400);
update_ddr_freq(ddr_med_rate);
/* Make sure periph clk's parent also got updated */
- update_periph_clk_parent(pll2_400);
+ clk_set_parent(periph_clk, pll2_400);
high_bus_freq_mode = 0;
med_bus_freq_mode = 1;
}
EXPORT_SYMBOL(clk_get_usecount);
-/*!
- * @brief Function to update the usage count for the requested clock.
- *
- * This function returns none.
- *
- * @param clk clk we want to update.
- * @param flag Increase or decrease usecount.
- *
- * @return Returns none.
- */
-void update_usecount(struct clk *clk, bool flag)
-{
- if (!flag) {
- if (clk_get_usecount(clk) > 1) {
- mutex_lock(&clocks_mutex);
- clk->usecount--;
- mutex_unlock(&clocks_mutex);
- } else
- clk_disable(clk);
- } else {
- if (clk_get_usecount(clk) < 1)
- clk_enable(clk);
- else {
- mutex_lock(&clocks_mutex);
- clk->usecount++;
- mutex_unlock(&clocks_mutex);
- }
- }
-}
-EXPORT_SYMBOL(update_usecount);
-
/* Retrieve the *current* clock rate. If the clock itself
* does not provide a special calculation routine, ask
* its parent and so on, until one is able to return