forked from Mirrors/opensbi
		
	platform: generic: allwinner: Advertise nonretentive suspend
Add D1's nonretentive suspend state to the devicetree so S-mode software knows about it and can use it. Latency and power measurements were taken on an Allwinner Nezha board: - Entry latency was measured from the beginning of sbi_ecall_handler() to before the call to wfi() in sun20i_d1_hart_suspend(). - Exit latency was measured from the beginning of sbi_init() to before the call to sbi_hart_switch_mode() in init_warmboot(). - There was a 17.5 mW benefit from non-retentive suspend compared to WFI, with a 170 mW cost during the 107 us entry/exit period. This provides a break-even point around 1040 us. Residency includes entry latency, so round this up to 1100 us. - The hardware power sequence latency (after the WFI) is assumed to be negligible, so set the wakeup latency to the exit latency. Reviewed-by: Anup Patel <anup@brainfault.org> Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							33bf917460
						
					
				
				
					commit
					c45992cc2b
				
			@@ -12,6 +12,7 @@
 | 
			
		||||
#include <sbi/sbi_error.h>
 | 
			
		||||
#include <sbi/sbi_hsm.h>
 | 
			
		||||
#include <sbi/sbi_pmu.h>
 | 
			
		||||
#include <sbi_utils/fdt/fdt_fixup.h>
 | 
			
		||||
#include <sbi_utils/fdt/fdt_helper.h>
 | 
			
		||||
#include <sbi_utils/irqchip/fdt_irqchip_plic.h>
 | 
			
		||||
 | 
			
		||||
@@ -202,6 +203,24 @@ static int sun20i_d1_final_init(bool cold_boot, const struct fdt_match *match)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct sbi_cpu_idle_state sun20i_d1_cpu_idle_states[] = {
 | 
			
		||||
	{
 | 
			
		||||
		.name			= "cpu-nonretentive",
 | 
			
		||||
		.suspend_param		= SBI_HSM_SUSPEND_NON_RET_DEFAULT,
 | 
			
		||||
		.local_timer_stop	= true,
 | 
			
		||||
		.entry_latency_us	= 40,
 | 
			
		||||
		.exit_latency_us	= 67,
 | 
			
		||||
		.min_residency_us	= 1100,
 | 
			
		||||
		.wakeup_latency_us	= 67,
 | 
			
		||||
	},
 | 
			
		||||
	{ }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static int sun20i_d1_fdt_fixup(void *fdt, const struct fdt_match *match)
 | 
			
		||||
{
 | 
			
		||||
	return fdt_add_cpu_idle_states(fdt, sun20i_d1_cpu_idle_states);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void thead_c9xx_pmu_ctr_enable_irq(uint32_t ctr_idx)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long mip_val;
 | 
			
		||||
@@ -265,5 +284,6 @@ static const struct fdt_match sun20i_d1_match[] = {
 | 
			
		||||
const struct platform_override sun20i_d1 = {
 | 
			
		||||
	.match_table	= sun20i_d1_match,
 | 
			
		||||
	.final_init	= sun20i_d1_final_init,
 | 
			
		||||
	.fdt_fixup	= sun20i_d1_fdt_fixup,
 | 
			
		||||
	.extensions_init = sun20i_d1_extensions_init,
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user