dvfs: add dvfs_get_regulator() function
author陈亮 <cl@rock-chips.com>
Tue, 25 Mar 2014 13:42:44 +0000 (06:42 -0700)
committer陈亮 <cl@rock-chips.com>
Tue, 25 Mar 2014 13:42:44 +0000 (06:42 -0700)
arch/arm/mach-rockchip/dvfs.c
include/linux/rockchip/dvfs.h

index f575f65113dbff62feaef84f5aead280b6cf3216..2ca962095ecbc660466206b8bc9fed095837e646 100644 (file)
@@ -282,18 +282,22 @@ static void dvfs_vd_get_regulator_mode_info(struct vd_node *vd)
                }
        }
 }
+#endif
 
-struct regulator *dvfs_get_regulator1(char *regulator_name) 
+struct regulator *dvfs_get_regulator(char *regulator_name) 
 {
        struct vd_node *vd;
+
+       mutex_lock(&rk_dvfs_mutex);
        list_for_each_entry(vd, &rk_dvfs_tree, node) {
                if (strcmp(regulator_name, vd->regulator_name) == 0) {
+                       mutex_unlock(&rk_dvfs_mutex);
                        return vd->regulator;
                }
        }
+       mutex_unlock(&rk_dvfs_mutex);
        return NULL;
 }
-#endif
 
 static int dvfs_get_rate_range(struct dvfs_node *clk_dvfs_node)
 {
index 9155786f572d429164acadf05d0c6882d02adcbc..71a248f0be64a958452e3257cec3c8614b035be4 100644 (file)
@@ -167,6 +167,7 @@ struct cpufreq_frequency_table *dvfs_get_freq_volt_table(struct dvfs_node *clk_d
 int rk_regist_vd(struct vd_node *vd);
 int rk_regist_pd(struct pd_node *pd);
 int rk_regist_clk(struct dvfs_node *clk_dvfs_node);
+struct regulator *dvfs_get_regulator(char *regulator_name);
 int of_dvfs_init(void);
 
 #else
@@ -189,6 +190,7 @@ static inline struct cpufreq_frequency_table *dvfs_get_freq_volt_table(struct dv
 static inline int rk_regist_vd(struct vd_node *vd){ return 0; };
 static inline int rk_regist_pd(struct pd_node *pd){ return 0; };
 static inline int rk_regist_clk(struct dvfs_node *clk_dvfs_node){ return 0; };
+struct regulator *dvfs_get_regulator(char *regulator_name){ return NULL; };
 static inline int of_dvfs_init(void){ return 0; };
 #endif