Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * OMAP Power Management debug routines
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2005 Texas Instruments, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  * Copyright (C) 2006-2008 Nokia Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * Written by:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Richard Woodruff <r-woodruff2@ti.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * Tony Lindgren
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * Juha Yrjola
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * Amit Kucheria <amit.kucheria@nokia.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  * Igor Stoppa <igor.stoppa@nokia.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * Jouni Hogander
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  * Based on pm.c for omap2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/sched/clock.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/clk.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) #include "clock.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #include "powerdomain.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #include "clockdomain.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #include "soc.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #include "cm2xxx_3xxx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #include "prm2xxx_3xxx.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #include "pm.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #include <linux/debugfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) #include <linux/seq_file.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) static int pm_dbg_init_done;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) static int pm_dbg_init(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 	"OFF",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	"RET",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	"INA",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	"ON"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) void pm_dbg_update_time(struct powerdomain *pwrdm, int prev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	s64 t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	if (!pm_dbg_init_done)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		return ;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	/* Update timer for previous state */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	t = sched_clock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	pwrdm->state_timer[prev] += t - pwrdm->timer;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	pwrdm->timer = t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	struct seq_file *s = (struct seq_file *)user;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	if (strcmp(clkdm->name, "emu_clkdm") == 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		strcmp(clkdm->name, "wkup_clkdm") == 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		strncmp(clkdm->name, "dpll", 4) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	seq_printf(s, "%s->%s (%d)\n", clkdm->name, clkdm->pwrdm.ptr->name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		   clkdm->usecount);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	struct seq_file *s = (struct seq_file *)user;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		strcmp(pwrdm->name, "wkup_pwrdm") == 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 		strncmp(pwrdm->name, "dpll", 4) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	if (pwrdm->state != pwrdm_read_pwrst(pwrdm))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		printk(KERN_ERR "pwrdm state mismatch(%s) %d != %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 			pwrdm->name, pwrdm->state, pwrdm_read_pwrst(pwrdm));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	seq_printf(s, "%s (%s)", pwrdm->name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			pwrdm_state_names[pwrdm->state]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		seq_printf(s, ",%s:%d", pwrdm_state_names[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			pwrdm->state_counter[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	seq_printf(s, ",RET-LOGIC-OFF:%d", pwrdm->ret_logic_off_counter);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	for (i = 0; i < pwrdm->banks; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		seq_printf(s, ",RET-MEMBANK%d-OFF:%d", i + 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 				pwrdm->ret_mem_off_counter[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 	seq_putc(s, '\n');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	struct seq_file *s = (struct seq_file *)user;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	if (strcmp(pwrdm->name, "emu_pwrdm") == 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		strcmp(pwrdm->name, "wkup_pwrdm") == 0 ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		strncmp(pwrdm->name, "dpll", 4) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	pwrdm_state_switch(pwrdm);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	seq_printf(s, "%s (%s)", pwrdm->name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		pwrdm_state_names[pwrdm->state]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	for (i = 0; i < 4; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		seq_printf(s, ",%s:%lld", pwrdm_state_names[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 			pwrdm->state_timer[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	seq_putc(s, '\n');
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static int pm_dbg_counters_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	pwrdm_for_each(pwrdm_dbg_show_counter, s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	clkdm_for_each(clkdm_dbg_show_counter, s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) DEFINE_SHOW_ATTRIBUTE(pm_dbg_counters);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) static int pm_dbg_timers_show(struct seq_file *s, void *unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	pwrdm_for_each(pwrdm_dbg_show_timer, s);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) DEFINE_SHOW_ATTRIBUTE(pm_dbg_timers);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) static int pwrdm_suspend_get(void *data, u64 *val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	int ret = -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	if (cpu_is_omap34xx())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 		ret = omap3_pm_get_suspend_state((struct powerdomain *)data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	*val = ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	if (ret >= 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	return *val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) static int pwrdm_suspend_set(void *data, u64 val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	if (cpu_is_omap34xx())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 		return omap3_pm_set_suspend_state(
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 			(struct powerdomain *)data, (int)val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 	return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) DEFINE_SIMPLE_ATTRIBUTE(pwrdm_suspend_fops, pwrdm_suspend_get,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 			pwrdm_suspend_set, "%llu\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	s64 t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	struct dentry *d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	t = sched_clock();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	for (i = 0; i < 4; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		pwrdm->state_timer[i] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	pwrdm->timer = t;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	if (strncmp(pwrdm->name, "dpll", 4) == 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, pwrdm,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 			    &pwrdm_suspend_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static int option_get(void *data, u64 *val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	u32 *option = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	*val = *option;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) static int option_set(void *data, u64 val)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	u32 *option = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	*option = val;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	if (option == &enable_off_mode) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		if (cpu_is_omap34xx())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 			omap3_pm_off_mode_enable(val);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) DEFINE_SIMPLE_ATTRIBUTE(pm_dbg_option_fops, option_get, option_set, "%llu\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) static int __init pm_dbg_init(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	struct dentry *d;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 	if (pm_dbg_init_done)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	d = debugfs_create_dir("pm_debug", NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	debugfs_create_file("count", 0444, d, NULL, &pm_dbg_counters_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	debugfs_create_file("time", 0444, d, NULL, &pm_dbg_timers_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	pwrdm_for_each(pwrdms_setup, (void *)d);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 			    &enable_off_mode, &pm_dbg_option_fops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	pm_dbg_init_done = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) omap_arch_initcall(pm_dbg_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) #endif