Re: [PATCH 4/7] irqchip/irq-qcom-mpm: Program wakeup timer when CPU cluster goes to LPM

Sneh Mankad <[email protected]> Mon, 3 Aug 2026 16:33:28 +0530
Newsgroups org.kernel.vger.linux-arm-msm,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>

On 13-Jul-26 8:48 PM, Marc Zyngier wrote:
> On Mon, 13 Jul 2026 11:25:44 +0100,
> Sneh Mankad <[email protected]> wrote:
>>
>> The next wakeup timer value needs to be set in MPM timer as the arch timer
>> interrupt can not wakeup the SoC if after the deepest CPUidle states the
>> SoC also enters deepest low power state.
>>
>> To wakeup the SoC in such scenarios the earliest wakeup time is set in MPM
>> timer and the Resource Power Manager (RPM processor) takes care of setting
>> the timer in HW.
>>
>> Add MPM timer programming when CPU cluster enters power collapse.
>>
>> Signed-off-by: Sneh Mankad <[email protected]>
>> ---
>>  drivers/irqchip/irq-qcom-mpm.c | 44 ++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 44 insertions(+)
>>
>> diff --git a/drivers/irqchip/irq-qcom-mpm.c b/drivers/irqchip/irq-qcom-mpm.c
>> index 763eddee99dc4cdd5edab22ce54808528f9ef165..f43c4a1c35f78b6cdae194dc7ae88c5c307ada94 100644
>> --- a/drivers/irqchip/irq-qcom-mpm.c
>> +++ b/drivers/irqchip/irq-qcom-mpm.c
>> @@ -13,6 +13,7 @@
>>  #include <linux/io.h>
>>  #include <linux/irqchip.h>
>>  #include <linux/irqdomain.h>
>> +#include <linux/ktime.h>
>>  #include <linux/mailbox_client.h>
>>  #include <linux/module.h>
>>  #include <linux/of.h>
>> @@ -25,6 +26,8 @@
>>  #include <linux/soc/qcom/irq.h>
>>  #include <linux/spinlock.h>
>>  
>> +#include <clocksource/arm_arch_timer.h>
>> +
>>  /*
>>   * This is the driver for Qualcomm MPM (MSM Power Manager) interrupt controller,
>>   * which is commonly found on Qualcomm SoCs built on the RPM architecture.
>> @@ -77,6 +80,13 @@ enum qcom_mpm_reg {
>>  	MPM_REG_STATUS,
>>  };
>>  
>> +#define USECS_TO_CYCLES(time_usecs)	xloops_to_cycles((time_usecs) * 0x10C7UL)
>> +
>> +static inline unsigned long xloops_to_cycles(u64 xloops)
>> +{
>> +	return (xloops * loops_per_jiffy * HZ) >> 32;
>> +}
>> +
> 
> Do we really need arch-specific code to be literally copied from
> arm64's delay.c, without any comment or attempt at making it generic?
> 
> Specially after having added the same stuff to rpmh-rsc.c 4 years ago?
> 
> See a pattern here?

Agreed Marc, there should be a more generic way to get this information. I will
work on it and post.

Thanks,
Sneh