[PATCH 1/6] cpufreq: cpufreq-cpu0: allow optional safe voltage during frequency transitions

Thomas Abraham ta.omasab at gmail.com
Mon Jan 13 09:21:25 EST 2014


Hi Shawn,

On Mon, Jan 13, 2014 at 8:44 AM, Shawn Guo <shawn.guo at linaro.org> wrote:
> Hi Thomas,
>
> On Thu, Jan 09, 2014 at 09:29:20PM +0530, Thomas Abraham wrote:
>> @@ -19,6 +19,10 @@ Optional properties:
>>  - cooling-min-level:
>>  - cooling-max-level:
>>       Please refer to Documentation/devicetree/bindings/thermal/thermal.txt.
>> +- safe-opp-index: Certain platforms require that during a opp transition,
>> +  a system should not go below a particular opp level. For such systems,
>> +  this property specifies the minimum opp to be maintained during the
>> +  opp transitions.
>
> <snip>
>
>> @@ -165,13 +196,27 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
>>               goto out_put_node;
>>       }
>>
>> +     if (!of_property_read_u32(np, "safe-opp-index", &safe_opp_index)) {
>> +             rcu_read_lock();
>> +             opp = dev_pm_opp_find_freq_exact(cpu_dev,
>> +                     freq_table[safe_opp_index].frequency * 1000, true);
>
> The property safe_opp_index is directly used to index freq_table here.
> It only works when the opp table in device tree is defined in increasing
> order.  But we have nothing in opp binding bindings/power/opp.txt to
> enforce it.  That said, opp table in device tree could be in arbitrary
> order, and thus safe_opp_index gives you nothing reliable.

Yes, true. Thanks for pointing out. Instead of using index, will using
a tuple of for safe frequency and safe voltage be fine ?

Thanks,
Thomas.

>
> Shawn
>
>> +             if (IS_ERR(opp)) {
>> +                     rcu_read_unlock();
>> +                     pr_err("safe opp index %d is invalid\n",
>> +                                                     safe_opp_index);
>> +                     goto out_free_table;
>> +             }
>> +             safe_voltage = dev_pm_opp_get_voltage(opp);
>> +             safe_frequency = freq_table[safe_opp_index].frequency;
>> +             rcu_read_unlock();
>> +     }
>> +
>>       of_property_read_u32(np, "voltage-tolerance", &voltage_tolerance);
>>
>>       if (of_property_read_u32(np, "clock-latency", &transition_latency))
>>               transition_latency = CPUFREQ_ETERNAL;
>>
>>       if (!IS_ERR(cpu_reg)) {
>> -             struct dev_pm_opp *opp;
>>               unsigned long min_uV, max_uV;
>>               int i;
>>
>> --
>> 1.6.6.rc2
>>
>



More information about the linux-arm-kernel mailing list