@@ -509,6 +509,52 @@ static int amd_pstate_cpu_exit(struct cpufreq_policy *policy)
509
509
return 0 ;
510
510
}
511
511
512
+ /* Sysfs attributes */
513
+
514
+ /*
515
+ * This frequency is to indicate the maximum hardware frequency.
516
+ * If boost is not active but supported, the frequency will be larger than the
517
+ * one in cpuinfo.
518
+ */
519
+ static ssize_t show_amd_pstate_max_freq (struct cpufreq_policy * policy ,
520
+ char * buf )
521
+ {
522
+ int max_freq ;
523
+ struct amd_cpudata * cpudata ;
524
+
525
+ cpudata = policy -> driver_data ;
526
+
527
+ max_freq = amd_get_max_freq (cpudata );
528
+ if (max_freq < 0 )
529
+ return max_freq ;
530
+
531
+ return sprintf (& buf [0 ], "%u\n" , max_freq );
532
+ }
533
+
534
+ static ssize_t show_amd_pstate_lowest_nonlinear_freq (struct cpufreq_policy * policy ,
535
+ char * buf )
536
+ {
537
+ int freq ;
538
+ struct amd_cpudata * cpudata ;
539
+
540
+ cpudata = policy -> driver_data ;
541
+
542
+ freq = amd_get_lowest_nonlinear_freq (cpudata );
543
+ if (freq < 0 )
544
+ return freq ;
545
+
546
+ return sprintf (& buf [0 ], "%u\n" , freq );
547
+ }
548
+
549
+ cpufreq_freq_attr_ro (amd_pstate_max_freq );
550
+ cpufreq_freq_attr_ro (amd_pstate_lowest_nonlinear_freq );
551
+
552
+ static struct freq_attr * amd_pstate_attr [] = {
553
+ & amd_pstate_max_freq ,
554
+ & amd_pstate_lowest_nonlinear_freq ,
555
+ NULL ,
556
+ };
557
+
512
558
static struct cpufreq_driver amd_pstate_driver = {
513
559
.flags = CPUFREQ_CONST_LOOPS | CPUFREQ_NEED_UPDATE_LIMITS ,
514
560
.verify = amd_pstate_verify ,
@@ -517,6 +563,7 @@ static struct cpufreq_driver amd_pstate_driver = {
517
563
.exit = amd_pstate_cpu_exit ,
518
564
.set_boost = amd_pstate_set_boost ,
519
565
.name = "amd-pstate" ,
566
+ .attr = amd_pstate_attr ,
520
567
};
521
568
522
569
static int __init amd_pstate_init (void )
0 commit comments