>>-----Original Message-----
>>From: Kevin Hilman [mailto:[email protected]]
>>Sent: Friday, November 12, 2010 5:04 AM
>>To: Gopinath, Thara
>>Cc: [email protected]; [email protected]; Cousson, Benoit; Sripathy,
>>Vishwanath; Sawant, Anand
>>Subject: Re: [PATCH v2 06/14] OMAP: Voltage layer changes to support DVFS.
>>
>>Thara Gopinath <[email protected]> writes:
>>
>>> This patch introduces an API to take in the voltage domain and the
>>> new voltage as parameter and to scale all the scalable devices
>>> associated with the the voltage domain to the rate corresponding to the
>>> new voltage and scale the voltage domain to the new voltage.
>>>
>>> Signed-off-by: Thara Gopinath <[email protected]>
>>> ---
>>>  arch/arm/mach-omap2/voltage.c             |   72
>>+++++++++++++++++++++++++++++
>>>  arch/arm/plat-omap/include/plat/voltage.h |    7 +++
>>>  2 files changed, 79 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-omap2/voltage.c b/arch/arm/mach-omap2/voltage.c
>>> index 6c2e4ef..458f8c1 100644
>>> --- a/arch/arm/mach-omap2/voltage.c
>>> +++ b/arch/arm/mach-omap2/voltage.c
>>> @@ -27,9 +27,11 @@
>>>  #include <linux/spinlock.h>
>>>  #include <linux/plist.h>
>>>  #include <linux/slab.h>
>>> +#include <linux/opp.h>
>>>
>>>  #include <plat/common.h>
>>>  #include <plat/voltage.h>
>>> +#include <plat/omap_device.h>
>>>
>>>  #include "prm-regbits-34xx.h"
>>>  #include "prm44xx.h"
>>> @@ -1678,6 +1680,76 @@ struct voltagedomain
>>*omap_voltage_domain_lookup(char *name)
>>>  }
>>>
>>>  /**
>>> + * omap_voltage_scale : API to scale the devices associated with a
>>> + *                 voltage domain vdd voltage.
>>> + * @volt_domain : the voltage domain to be scaled
>>> + * @volt : the new voltage for the voltage domain
>>> + *
>>> + * This API runs through the list of devices associated with the
>>> + * voltage domain and scales the device rates to those corresponding
>>> + * to the new voltage of the voltage domain. This API also scales
>>> + * the voltage domain voltage to the new value. Returns 0 on success
>>> + * else the error value.
>>> + */
>>> +int omap_voltage_scale(struct voltagedomain *voltdm, unsigned long volt)
>>> +{
>>> +   unsigned long curr_volt;
>>> +   int is_volt_scaled = 0;
>>> +   struct omap_vdd_info *vdd;
>>> +   struct omap_vdd_dev_list *temp_dev;
>>> +
>>> +   if (!voltdm || IS_ERR(voltdm)) {
>>> +           pr_warning("%s: VDD specified does not exist!\n", __func__);
>>> +           return -EINVAL;
>>> +   }
>>> +
>>> +   vdd = container_of(voltdm, struct omap_vdd_info, voltdm);
>>> +
>>> +   mutex_lock(&vdd->scaling_mutex);
>>> +
>>> +   curr_volt = omap_voltage_get_nom_volt(voltdm);
>>> +
>>> +   if (curr_volt == volt) {
>>> +           is_volt_scaled = 1;
>>> +   } else if (curr_volt < volt) {
>>> +           omap_voltage_scale_vdd(voltdm, volt);
>>> +           is_volt_scaled = 1;
>>> +   }
>>> +
>>> +   list_for_each_entry(temp_dev, &vdd->dev_list, node) {
>>> +           struct device *dev;
>>> +           struct opp *opp;
>>> +           unsigned long freq;
>>> +
>>> +           dev = temp_dev->dev;
>>> +
>>> +           opp = opp_find_voltage(dev, volt);
>>> +           if (IS_ERR(opp)) {
>>> +                   dev_err(dev, "%s: Unable to find OPP for"
>>> +                           "volt%ld\n", __func__, volt);
>>> +                   continue;
>>> +           }
>>> +
>>> +           freq = opp_get_freq(opp);
>>> +
>>> +           if (freq == omap_device_get_rate(dev)) {
>>> +                   dev_warn(dev, "%s: Already at the requested"
>>> +                           "rate %ld\n", __func__, freq);
>>
>>Does this need to be a warning?  This happens relatively often and is normal.
>>This should probably just be removed in favor of
>>
>>              if (freq != omap_device_get_rate(dev))
>>                        omap_device_set_rate(dev, freq);

Yes. There are other warnings also in the dvfs code
which could be removed. Will remove them all in the next
version

Regards
Thara
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to