cpufreq - pstate - support incr of 5 percent to allow for better control

some intel cpu's only go down to 20%, some down to 10% min state....
so let's do this in lots of 5% to allow for some future cpu's. now
it's not just 0, 25, 50, 75, 100 it's worth making it a real loop to
save on code too. this allows me to actually control the cpu's i see
at the detail level i see they can be controlled at.
This commit is contained in:
Carsten Haitzler 2019-08-11 22:47:28 +01:00
parent 67da43ee36
commit a2c1e59cb5
1 changed files with 34 additions and 32 deletions

View File

@ -338,45 +338,47 @@ _button_cb_mouse_down(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNU
if (cpufreq_config->status->pstate) if (cpufreq_config->status->pstate)
{ {
int set; int set, pc;
mo = e_menu_new(); mo = e_menu_new();
cpufreq_config->menu_pstate1 = mo; cpufreq_config->menu_pstate1 = mo;
set = 0; set = 0;
#define VALMIN(_n) \ for (pc = 0; pc <= 100; pc += 5)
mi = e_menu_item_new(mo); \ {
e_menu_item_label_set(mi, #_n); \ mi = e_menu_item_new(mo);
e_menu_item_radio_set(mi, 1); \ snprintf(buf, sizeof(buf), "%i", pc);
e_menu_item_radio_group_set(mi, 1); \ e_menu_item_label_set(mi, buf);
if ((!set) && (cpufreq_config->status->pstate_min <= _n)) \ e_menu_item_radio_set(mi, 1);
{ set = 1; e_menu_item_toggle_set(mi, 1); } \ e_menu_item_radio_group_set(mi, 1);
e_menu_item_callback_set(mi, _cpufreq_menu_pstate_min, (void *)_n) if ((!set) && (cpufreq_config->status->pstate_min <= pc))
VALMIN(0); {
VALMIN(25); set = 1;
VALMIN(50); e_menu_item_toggle_set(mi, 1);
VALMIN(75); }
VALMIN(100); e_menu_item_callback_set(mi, _cpufreq_menu_pstate_min,
(void *)(intptr_t)pc);
}
mo = e_menu_new(); mo = e_menu_new();
cpufreq_config->menu_pstate2 = mo; cpufreq_config->menu_pstate2 = mo;
set = 0; set = 0;
#define VALMAX(_n) \ for (pc = 0; pc <= 100; pc += 5)
mi = e_menu_item_new(mo); \ {
e_menu_item_label_set(mi, #_n); \ mi = e_menu_item_new(mo);
e_menu_item_radio_set(mi, 1); \ snprintf(buf, sizeof(buf), "%i", pc);
e_menu_item_radio_group_set(mi, 1); \ e_menu_item_label_set(mi, buf);
if ((!set) && (cpufreq_config->status->pstate_max <= _n)) \ e_menu_item_radio_set(mi, 1);
{ set = 1; e_menu_item_toggle_set(mi, 1); } \ e_menu_item_radio_group_set(mi, 1);
e_menu_item_callback_set(mi, _cpufreq_menu_pstate_max, (void *)_n) if ((!set) && (cpufreq_config->status->pstate_max <= pc))
VALMAX(5); {
VALMAX(25); set = 1;
VALMAX(50); e_menu_item_toggle_set(mi, 1);
VALMAX(75); }
VALMAX(100); e_menu_item_callback_set(mi, _cpufreq_menu_pstate_max,
(void *)(intptr_t)pc);
}
} }
mg = e_menu_new(); mg = e_menu_new();
mi = e_menu_item_new(mg); mi = e_menu_item_new(mg);
e_menu_item_label_set(mi, _("Time Between Updates")); e_menu_item_label_set(mi, _("Time Between Updates"));