/* * arm64_idle_init * * Registers the arm64 specific cpuidle driver with the cpuidle * framework. It relies on core code to parse the idle states * and initialize them using driver data structures accordingly. */ int __init mt8173_cpuidle_init(void) { int cpu, ret; struct cpuidle_driver *drv = &mt8173_cpuidle_driver; /* * Call arch CPU operations in order to initialize * idle states suspend back-end specific data */ for_each_possible_cpu(cpu) { ret = cpu_init_idle(cpu); if (ret) { pr_err("CPU %d failed to init idle CPU ops\n", cpu); return ret; } } ret = cpuidle_register(drv, NULL); if (ret) { pr_err("failed to register cpuidle driver\n"); return ret; } return 0; }
/* * arm64_idle_init * * Registers the arm64 specific cpuidle driver with the cpuidle * framework. It relies on core code to parse the idle states * and initialize them using driver data structures accordingly. */ static int __init arm64_idle_init(void) { int cpu, ret; struct cpuidle_driver *drv = &arm64_idle_driver; /* * Initialize idle states data, starting at index 1. * This driver is DT only, if no DT idle states are detected (ret == 0) * let the driver initialization fail accordingly since there is no * reason to initialize the idle driver if only wfi is supported. */ ret = dt_init_idle_driver(drv, arm64_idle_state_match, 1); if (ret <= 0) { if (ret) pr_err("failed to initialize idle states\n"); return ret ? : -ENODEV; } /* * Call arch CPU operations in order to initialize * idle states suspend back-end specific data */ for_each_possible_cpu(cpu) { ret = cpu_init_idle(cpu); if (ret) { pr_err("CPU %d failed to init idle CPU ops\n", cpu); return ret; } } ret = cpuidle_register(drv, NULL); if (ret) { pr_err("failed to register cpuidle driver\n"); return ret; } return 0; }