]> Git Repo - linux.git/commitdiff
Merge back cpufreq updates for v5.11.
authorRafael J. Wysocki <[email protected]>
Mon, 16 Nov 2020 12:20:31 +0000 (13:20 +0100)
committerRafael J. Wysocki <[email protected]>
Mon, 16 Nov 2020 12:20:31 +0000 (13:20 +0100)
1  2 
drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h

index 1e7e3f2ff09f0d6236491bb2f380a2b3ad2d6273,f2d96175f62d6fbe14688f3355bbe0787048dafa..d66d0df3707251b5c820347da932d5f0639504bb
@@@ -2123,7 -2123,7 +2123,7 @@@ static int __target_intermediate(struc
  static int __target_index(struct cpufreq_policy *policy, int index)
  {
        struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0};
-       unsigned int intermediate_freq = 0;
+       unsigned int restore_freq, intermediate_freq = 0;
        unsigned int newfreq = policy->freq_table[index].frequency;
        int retval = -EINVAL;
        bool notify;
        if (newfreq == policy->cur)
                return 0;
  
+       /* Save last value to restore later on errors */
+       restore_freq = policy->cur;
        notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION);
        if (notify) {
                /* Handle switching to intermediate frequency */
                 */
                if (unlikely(retval && intermediate_freq)) {
                        freqs.old = intermediate_freq;
-                       freqs.new = policy->restore_freq;
+                       freqs.new = restore_freq;
                        cpufreq_freq_transition_begin(policy, &freqs);
                        cpufreq_freq_transition_end(policy, &freqs, 0);
                }
@@@ -2203,9 -2206,6 +2206,6 @@@ int __cpufreq_driver_target(struct cpuf
            !(cpufreq_driver->flags & CPUFREQ_NEED_UPDATE_LIMITS))
                return 0;
  
-       /* Save last value to restore later on errors */
-       policy->restore_freq = policy->cur;
        if (cpufreq_driver->target)
                return cpufreq_driver->target(policy, target_freq, relation);
  
@@@ -2254,7 -2254,7 +2254,7 @@@ static int cpufreq_init_governor(struc
                return -EINVAL;
  
        /* Platform doesn't want dynamic frequency switching ? */
 -      if (policy->governor->dynamic_switching &&
 +      if (policy->governor->flags & CPUFREQ_GOV_DYNAMIC_SWITCHING &&
            cpufreq_driver->flags & CPUFREQ_NO_AUTO_DYNAMIC_SWITCHING) {
                struct cpufreq_governor *gov = cpufreq_fallback_governor();
  
                }
        }
  
 +      policy->strict_target = !!(policy->governor->flags & CPUFREQ_GOV_STRICT_TARGET);
 +
        return 0;
  }
  
diff --combined include/linux/cpufreq.h
index acbad3b363226efa0bd6dd45514cc1490edb2813,9779a6cd8baa49b06d3f5760f37a17dc647a00b4..584fccd4fcabb8114f32e2f6b87c2933bbd640b5
@@@ -65,7 -65,6 +65,6 @@@ struct cpufreq_policy 
        unsigned int            max;    /* in kHz */
        unsigned int            cur;    /* in kHz, only needed if cpufreq
                                         * governors are used */
-       unsigned int            restore_freq; /* = policy->cur before transition */
        unsigned int            suspend_freq; /* freq to set during suspend */
  
        unsigned int            policy; /* see above */
        bool                    fast_switch_possible;
        bool                    fast_switch_enabled;
  
 +      /*
 +       * Set if the CPUFREQ_GOV_STRICT_TARGET flag is set for the current
 +       * governor.
 +       */
 +      bool                    strict_target;
 +
        /*
         * Preferred average time interval between consecutive invocations of
         * the driver to set the frequency for this policy.  To be set by the
@@@ -314,10 -307,6 +313,6 @@@ struct cpufreq_driver 
        /* define one out of two */
        int             (*setpolicy)(struct cpufreq_policy *policy);
  
-       /*
-        * On failure, should always restore frequency to policy->restore_freq
-        * (i.e. old freq).
-        */
        int             (*target)(struct cpufreq_policy *policy,
                                  unsigned int target_freq,
                                  unsigned int relation);       /* Deprecated */
@@@ -576,20 -565,12 +571,20 @@@ struct cpufreq_governor 
                                         char *buf);
        int     (*store_setspeed)       (struct cpufreq_policy *policy,
                                         unsigned int freq);
 -      /* For governors which change frequency dynamically by themselves */
 -      bool                    dynamic_switching;
        struct list_head        governor_list;
        struct module           *owner;
 +      u8                      flags;
  };
  
 +/* Governor flags */
 +
 +/* For governors which change frequency dynamically by themselves */
 +#define CPUFREQ_GOV_DYNAMIC_SWITCHING BIT(0)
 +
 +/* For governors wanting the target frequency to be set exactly */
 +#define CPUFREQ_GOV_STRICT_TARGET     BIT(1)
 +
 +
  /* Pass a target to the cpufreq driver */
  unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
                                        unsigned int target_freq);
This page took 0.056686 seconds and 4 git commands to generate.