[PATCH 6/6] mfd: db8500-prcmu: Always submit an explicit APE OPP request

Linus Walleij linusw at kernel.org
Fri Nov 27 15:42:34 PST 2026


Do not infer the hardware state from a cache of previous Linux
requests. With firmware starting in an unknown state, the old path
could report success for a 50% request without sending it.

Accept the two supported firmware levels and always check the
acknowledgment. The clock driver will decide when to request a
transition.

Signed-off-by: Linus Walleij <linusw at kernel.org>
---
 drivers/mfd/db8500-prcmu.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 98ab0dc3d145..080ab61d7a29 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -366,13 +366,11 @@ static struct {
  * mb1_transfer - state needed for mailbox 1 communication.
  * @lock:	The transaction lock.
  * @work:	The transaction completion structure.
- * @ape_opp:	The current APE OPP.
  * @ack:	Reply ("acknowledge") data.
  */
 static struct {
 	struct mutex lock;
 	struct completion work;
-	u8 ape_opp;
 	struct {
 		u8 header;
 		u8 arm_opp;
@@ -692,14 +690,11 @@ int db8500_prcmu_set_ape_opp(u8 opp)
 {
 	int r = 0;
 
-	if (opp == mb1_transfer.ape_opp)
-		return 0;
+	if (opp != APE_50_OPP && opp != APE_100_OPP)
+		return -EINVAL;
 
 	mutex_lock(&mb1_transfer.lock);
 
-	if ((opp != APE_100_OPP) && (mb1_transfer.ape_opp != APE_100_OPP))
-		goto skip_message;
-
 	while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1))
 		cpu_relax();
 
@@ -714,10 +709,6 @@ int db8500_prcmu_set_ape_opp(u8 opp)
 		(mb1_transfer.ack.ape_opp != opp))
 		r = -EIO;
 
-skip_message:
-	if (!r)
-		mb1_transfer.ape_opp = opp;
-
 	mutex_unlock(&mb1_transfer.lock);
 
 	return r;
@@ -1760,7 +1751,6 @@ void __init db8500_prcmu_early_init(void)
 	init_completion(&mb0_transfer.ac_wake_work);
 	mutex_init(&mb1_transfer.lock);
 	init_completion(&mb1_transfer.work);
-	mb1_transfer.ape_opp = APE_NO_CHANGE;
 	mutex_init(&mb2_transfer.lock);
 	init_completion(&mb2_transfer.work);
 	spin_lock_init(&mb2_transfer.auto_pm_lock);

-- 
2.56.1




More information about the linux-arm-kernel mailing list