Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

platform/x86: pmc_atom: Check state of PMC clocks on s2idle

Extend the s2idle check with checking that none of the PMC clocks
is in the forced-on state. If one of the clocks is in forced on
state then S0i3 cannot be reached.

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20240305105915.76242-5-hdegoede@redhat.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Hans de Goede and committed by
Ilpo Järvinen
86cef459 1bde4afc

+11
+11
drivers/platform/x86/pmc_atom.c
··· 477 477 u32 func_dis, func_dis_2; 478 478 u32 d3_sts_0, d3_sts_1; 479 479 u32 false_pos_sts_0, false_pos_sts_1; 480 + int i; 480 481 481 482 func_dis = pmc_reg_read(pmc, PMC_FUNC_DIS); 482 483 func_dis_2 = pmc_reg_read(pmc, PMC_FUNC_DIS_2); ··· 502 501 503 502 pmc_dev_state_check(d3_sts_0, m->d3_sts_0, func_dis, m->func_dis, false_pos_sts_0); 504 503 pmc_dev_state_check(d3_sts_1, m->d3_sts_1, func_dis_2, m->func_dis_2, false_pos_sts_1); 504 + 505 + /* Forced-on PMC clocks prevent S0i3 */ 506 + for (i = 0; i < PMC_CLK_NUM; i++) { 507 + u32 ctl = pmc_reg_read(pmc, PMC_CLK_CTL_OFFSET + 4 * i); 508 + 509 + if ((ctl & PMC_MASK_CLK_CTL) != PMC_CLK_CTL_FORCE_ON) 510 + continue; 511 + 512 + pr_err("clock %d is ON prior to freeze (ctl 0x%08x)\n", i, ctl); 513 + } 505 514 } 506 515 507 516 static struct acpi_s2idle_dev_ops pmc_s2idle_ops = {