@@ -1042,7 +1042,7 @@ static unsigned long omap3_clkoutx2_recalc(struct clk *clk)
#if defined(CONFIG_ARCH_OMAP3)
#ifdef CONFIG_CPU_FREQ
-static struct cpufreq_frequency_table freq_table[MAX_VDD1_OPP+1];
+static struct cpufreq_frequency_table freq_table[MAX_VDD1_OPPS+1];
void omap2_clk_init_cpufreq_table(struct cpufreq_frequency_table **table)
{
@@ -14,6 +14,7 @@
#include <plat/resource.h>
#include <plat/omap34xx.h>
+#include <plat/omap-pm.h>
#include "pm.h"
@@ -92,13 +93,13 @@ static ssize_t vdd_opp_store(struct kobject *kobj, struct kobj_attribute *attr,
}
if (attr == &vdd1_opp_attr) {
- if (value < 1 || value > 5) {
+ if (value < MIN_VDD1_OPP || value > MAX_VDD1_OPP) {
printk(KERN_ERR "vdd_opp_store: Invalid value\n");
return -EINVAL;
}
resource_set_opp_level(VDD1_OPP, value, flags);
} else if (attr == &vdd2_opp_attr) {
- if (value < 2 || value > 3) {
+ if (value < MIN_VDD2_OPP || value > 3) {
printk(KERN_ERR "vdd_opp_store: Invalid value\n");
return -EINVAL;
}
@@ -1059,6 +1059,45 @@ void omap3_pm_init_vc(struct prm_setup_vc *setup_vc)
prm_setup.vdd1_off = setup_vc->vdd1_off;
}
+int omap3_get_max_vdd1_opp(void)
+{
+ if (cpu_is_omap3630())
+ return VDD1_OPP4;
+ else /* Place holder for other 34xx (3430/3440) */
+ return VDD1_OPP5;
+}
+EXPORT_SYMBOL(omap3_get_max_vdd1_opp);
+
+int omap3_get_min_vdd1_opp(void)
+{
+ if (cpu_is_omap3630())
+ return VDD1_OPP1;
+ else /* Place holder for other 34xx (3430/3440) */
+ return VDD1_OPP1;
+}
+EXPORT_SYMBOL(omap3_get_min_vdd1_opp);
+
+int omap3_get_max_vdd2_opp(void)
+{
+ if (cpu_is_omap3630())
+ return VDD2_OPP3;
+ else /* Place holder for other 34xx (3430/3440) */
+ return VDD2_OPP3;
+
+}
+EXPORT_SYMBOL(omap3_get_max_vdd2_opp);
+
+int omap3_get_min_vdd2_opp(void)
+{
+ if (cpu_is_omap3630())
+ return VDD2_OPP2;
+ else /* Place holder for other 34xx (3430/3440) */
+ return VDD2_OPP1;
+
+}
+EXPORT_SYMBOL(omap3_get_min_vdd2_opp);
+
+
static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
{
struct power_state *pwrst;
@@ -382,7 +382,8 @@ int set_opp(struct shared_resource *resp, u32 target_level)
* throughput in KiB/s for 100 Mhz = 100 * 1000 * 4.
*/
if (target_level >= 3)
- resource_request("vdd2_opp", &vdd2_dev, 400000);
+ resource_request("vdd2_opp", &vdd2_dev,
+ (4 * (l3_opps + MAX_VDD2_OPP)->rate / 1000));
} else if (resp == vdd2_resp) {
tput = target_level;
@@ -322,5 +322,32 @@ unsigned long omap_pm_cpu_get_freq(void);
*/
int omap_pm_get_dev_context_loss_count(struct device *dev);
+/**
+ * omap3_get_max_opp - report Max OPP entries available for supplied VDD1 resource
+ *
+ * Returns the Max OPP entries available for supplied VDD resource.
+ */
+int omap3_get_max_vdd1_opp(void);
+
+/**
+ * omap3_get_min_opp - report Min OPP entries available for supplied VDD1 resource
+ *
+ * Returns the Min OPP entries available for supplied VDD resource.
+ */
+int omap3_get_min_vdd1_opp(void);
+
+/**
+ * omap3_get_max_opp - report Max OPP entries available for supplied VDD2 resource
+ *
+ * Returns the Max OPP entries available for supplied VDD resource.
+ */
+int omap3_get_max_vdd2_opp(void);
+
+/**
+ * omap3_get_min_opp - report Min OPP entries available for supplied VDD2 resource
+ *
+ * Returns the Min OPP entries available for supplied VDD resource.
+ */
+int omap3_get_min_vdd2_opp(void);
#endif
@@ -98,10 +98,13 @@
#define VDD2_OPP2 0x2
#define VDD2_OPP3 0x3
-#define MIN_VDD1_OPP VDD1_OPP1
-#define MAX_VDD1_OPP VDD1_OPP5
-#define MIN_VDD2_OPP VDD2_OPP1
-#define MAX_VDD2_OPP VDD2_OPP3
+#define MIN_VDD1_OPP omap3_get_min_vdd1_opp()
+#define MAX_VDD1_OPP omap3_get_max_vdd1_opp()
+#define MIN_VDD2_OPP omap3_get_min_vdd2_opp()
+#define MAX_VDD2_OPP omap3_get_max_vdd2_opp()
+
+/* Max OPP's Available among chips that comes under OMAP34xx configuration */
+#define MAX_VDD1_OPPS VDD1_OPP5
#endif /* __ASM_ARCH_OMAP34XX_H */