different clients would result in setting of the resource level as requested by
the last caller. Fixes this by introducing a struct device * to the parameter
list for these functions.
Signed-off-by: Romit Dasgupta <romit@ti.com>
---
@@ -47,6 +47,7 @@ static struct cpufreq_frequency_table *freq_table;
#define MPU_CLK "virt_prcm_set"
#endif
+DEFINE_PER_CPU(struct device , cpu_freq_dev);
static struct clk *mpu_clk;
/* TODO: Add support for SDRAM timing changes */
@@ -115,8 +116,9 @@ static int omap_target(struct cpufreq_policy *policy,
int ind;
for (ind = 1; ind <= MAX_VDD1_OPP; ind++) {
if (mpu_opps[ind].rate/1000 >= target_freq) {
- omap_pm_cpu_set_freq
- (mpu_opps[ind].rate);
+ omap_pm_cpu_set_freq(
+ &__get_cpu_var(cpu_freq_dev),
+ mpu_opps[ind].rate);
break;
}
}
@@ -226,6 +226,7 @@ const struct omap_opp *omap_pm_dsp_get_opp_table(void);
/**
* omap_pm_dsp_set_min_opp - receive desired OPP target ID from DSP Bridge
+ * @dev: Identifies the client that wants to set the VDD1 OPP.
* @opp_id: target DSP OPP ID
*
* Set a minimum OPP ID for the DSP. This is intended to be called
@@ -233,7 +234,7 @@ const struct omap_opp *omap_pm_dsp_get_opp_table(void);
* information that code receives from the DSP/BIOS load estimator is the
* target OPP ID; hence, this interface. No return value.
*/
-void omap_pm_dsp_set_min_opp(u8 opp_id);
+void omap_pm_dsp_set_min_opp(struct device *dev, u8 opp_id);
/**
* omap_pm_dsp_get_opp - report the current DSP OPP ID
@@ -283,6 +284,7 @@ struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table(void);
/**
* omap_pm_cpu_set_freq - set the current minimum MPU frequency
+ * @dev: Identifies the client that wants to set the frequency.
* @f: MPU frequency in Hz
*
* Set the current minimum CPU frequency. The actual CPU frequency
@@ -290,7 +292,7 @@ struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table(void);
* Intended to be called by plat-omap/cpu_omap.c:omap_target(). No
* return value.
*/
-void omap_pm_cpu_set_freq(unsigned long f);
+void omap_pm_cpu_set_freq(struct device *dev, unsigned long f);
/**
* omap_pm_cpu_get_freq - report the current CPU frequency
@@ -159,7 +159,7 @@ const struct omap_opp *omap_pm_dsp_get_opp_table(void)
}
EXPORT_SYMBOL(omap_pm_dsp_get_opp_table);
-void omap_pm_dsp_set_min_opp(u8 opp_id)
+void omap_pm_dsp_set_min_opp(struct device *dev, u8 opp_id)
{
if (opp_id == 0) {
WARN_ON(1);
@@ -244,7 +244,7 @@ struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table(void)
return NULL;
}
-void omap_pm_cpu_set_freq(unsigned long f)
+void omap_pm_cpu_set_freq(struct device *dev, unsigned long f)
{
if (f == 0) {
WARN_ON(1);
@@ -169,8 +169,6 @@ void omap_pm_set_max_sdma_lat(struct device *dev, long t)
}
}
-static struct device dummy_dsp_dev;
-
/*
* DSP Bridge-specific constraints
*/
@@ -187,20 +185,15 @@ const struct omap_opp *omap_pm_dsp_get_opp_table(void)
}
EXPORT_SYMBOL(omap_pm_dsp_get_opp_table);
-void omap_pm_dsp_set_min_opp(u8 opp_id)
+void omap_pm_dsp_set_min_opp(struct device *dev, u8 opp_id)
{
- if (opp_id == 0) {
+ if (dev == NULL || opp_id == 0) {
WARN_ON(1);
return;
}
pr_debug("OMAP PM: DSP requests minimum VDD1 OPP to be %d\n", opp_id);
-
- /*
- * For now pass a dummy_dev struct for SRF to identify the caller.
- * Maybe its good to have DSP pass this as an argument
- */
- resource_request("vdd1_opp", &dummy_dsp_dev, opp_id);
+ resource_request("vdd1_opp", dev, opp_id);
return;
}
EXPORT_SYMBOL(omap_pm_dsp_set_min_opp);
@@ -246,19 +239,16 @@ struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table(void)
return NULL;
}
-static struct device dummy_cpufreq_dev;
-
-void omap_pm_cpu_set_freq(unsigned long f)
+void omap_pm_cpu_set_freq(struct device *dev, unsigned long f)
{
- if (f == 0) {
+ if (dev == NULL || f == 0) {
WARN_ON(1);
return;
}
pr_debug("OMAP PM: CPUFreq requests CPU frequency to be set to %lu\n",
f);
-
- resource_request("mpu_freq", &dummy_cpufreq_dev, f);
+ resource_request("mpu_freq", dev, f);
return;
}
EXPORT_SYMBOL(omap_pm_cpu_set_freq);