[PATCH 2/2] cpuidle: dt: Add support to keep idle state disabled

From: Tushar Nimkar
Date: Thu Jun 08 2023 - 04:56:57 EST


Mark the idle state as disabled using CPUIDLE_FLAG_OFF when
idle-state-disabled property is present.

Such idle states stays disabled and can be enabled using below command.

echo N > /sys/devices/system/cpu/cpuX/cpuidle/stateX/disable

Signed-off-by: Tushar Nimkar <quic_tnimkar@xxxxxxxxxxx>
---
drivers/cpuidle/dt_idle_states.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/cpuidle/dt_idle_states.c b/drivers/cpuidle/dt_idle_states.c
index 12fec92a85fd..3d50181512a3 100644
--- a/drivers/cpuidle/dt_idle_states.c
+++ b/drivers/cpuidle/dt_idle_states.c
@@ -79,6 +79,9 @@ static int init_state_node(struct cpuidle_state *idle_state,
idle_state->flags = CPUIDLE_FLAG_RCU_IDLE;
if (of_property_read_bool(state_node, "local-timer-stop"))
idle_state->flags |= CPUIDLE_FLAG_TIMER_STOP;
+
+ if (of_property_read_bool(state_node, "idle-state-disabled"))
+ idle_state->flags |= CPUIDLE_FLAG_OFF;
/*
* TODO:
* replace with kstrdup and pointer assignment when name
--
2.17.1