arm: mach-tegra: Export dvfs frequencies
Arto Merilainen [Thu, 1 Aug 2013 10:58:51 +0000 (13:58 +0300)]
This patch adds a function tegra_dvfs_get_freqs() that allows reading
the possible clock frequencies from dvfs table.

Bug 1330780

Change-Id: I7c1cdc054b0898495c22c2d7dde9cf20ed66d8f5
Signed-off-by: Arto Merilainen <amerilainen@nvidia.com>
Reviewed-on: http://git-master/r/256863
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>

arch/arm/mach-tegra/dvfs.c
include/linux/clk/tegra.h

index 03d362a..6f1f4c9 100644 (file)
@@ -677,6 +677,21 @@ int tegra_dvfs_set_rate(struct clk *c, unsigned long rate)
 }
 EXPORT_SYMBOL(tegra_dvfs_set_rate);
 
+int tegra_dvfs_get_freqs(struct clk *c, unsigned long **freqs, int *num_freqs)
+{
+       if (!c->dvfs)
+               return -ENOSYS;
+
+       if (c->dvfs->alt_freqs)
+               return -ENOSYS;
+
+       *num_freqs = c->dvfs->num_freqs;
+       *freqs = c->dvfs->freqs;
+
+       return 0;
+}
+EXPORT_SYMBOL(tegra_dvfs_get_freqs);
+
 #ifdef CONFIG_TEGRA_VDD_CORE_OVERRIDE
 static DEFINE_MUTEX(rail_override_lock);
 
index c92fb80..714dfd8 100644 (file)
@@ -152,6 +152,7 @@ static inline void tegra_clocks_apply_init_table(void)
 struct dvfs;
 struct notifier_block;
 
+int tegra_dvfs_get_freqs(struct clk *c, unsigned long **freqs, int *num_freqs);
 int tegra_dvfs_set_rate(struct clk *c, unsigned long rate);
 int tegra_dvfs_override_core_voltage(int override_mv);
 unsigned long clk_get_rate_all_locked(struct clk *c);