I am interested to study your patchset, could send it ?
Ok, here it is (plus some notes):
I am still playing with it and it obviously doesn’t support multiple drivers as that doesn’t appear in any of the codelines yet.
I have the basics for reading stuff out of the DTS and getting the states from the driver in the powerdown flow, but haven’t put that in TC2 yet (not sure I need to as it only has 2 states). For our internal platforms I have added a function that is called in powerdown flow :
static int get_c_state_from_res(u64 residency) { struct cpuidle_driver *drv = cpuidle_get_driver();
if (drv) { struct cpuidle_state *st; int index; st = &drv->states[0];
for (index = 0; index < drv->state_count; st++, index++) if (residency < (u64)st->target_residency) { dbg("%s: match %d res %llu target %u\n", __func__, index, residency, st->target_residency); return index; } } dbg("%s: no-match for res %llu returning C4\n", __func__, residency); return drv->state_count; }
There are too many printk's in the patch and the example and some other bits that need cleaning up, I can do this if you are interested in using it until the real solution is available.
Mark