cregit-Linux how code gets into the kernel

Release 4.11 arch/arm/mach-omap2/pm-debug.c

/*
 * OMAP Power Management debug routines
 *
 * Copyright (C) 2005 Texas Instruments, Inc.
 * Copyright (C) 2006-2008 Nokia Corporation
 *
 * Written by:
 * Richard Woodruff <r-woodruff2@ti.com>
 * Tony Lindgren
 * Juha Yrjola
 * Amit Kucheria <amit.kucheria@nokia.com>
 * Igor Stoppa <igor.stoppa@nokia.com>
 * Jouni Hogander
 *
 * Based on pm.c for omap2
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/sched/clock.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/slab.h>

#include "clock.h"
#include "powerdomain.h"
#include "clockdomain.h"
#include "omap-pm.h"

#include "soc.h"
#include "cm2xxx_3xxx.h"
#include "prm2xxx_3xxx.h"
#include "pm.h"


u32 enable_off_mode;

#ifdef CONFIG_DEBUG_FS
#include <linux/debugfs.h>
#include <linux/seq_file.h>


static int pm_dbg_init_done;

static int pm_dbg_init(void);

enum {
	
DEBUG_FILE_COUNTERS = 0,
	
DEBUG_FILE_TIMERS,
};


static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = {
	"OFF",
	"RET",
	"INA",
	"ON"
};


void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) { s64 t; if (!pm_dbg_init_done) return ; /* Update timer for previous state */ t = sched_clock(); pwrdm->state_timer[prev] += t - pwrdm->timer; pwrdm->timer = t; }

Contributors

PersonTokensPropCommitsCommitProp
Tero Kristo47100.00%1100.00%
Total47100.00%1100.00%


static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) { struct seq_file *s = (struct seq_file *)user; if (strcmp(clkdm->name, "emu_clkdm") == 0 || strcmp(clkdm->name, "wkup_clkdm") == 0 || strncmp(clkdm->name, "dpll", 4) == 0) return 0; seq_printf(s, "%s->%s (%d)\n", clkdm->name, clkdm->pwrdm.ptr->name, clkdm->usecount); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Tero Kristo9298.92%150.00%
Paul Walmsley11.08%150.00%
Total93100.00%2100.00%


static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user) { struct seq_file *s = (struct seq_file *)user; int i; if (strcmp(pwrdm->name, "emu_pwrdm") == 0 || strcmp(pwrdm->name, "wkup_pwrdm") == 0 || strncmp(pwrdm->name, "dpll", 4) == 0) return 0; if (pwrdm->state != pwrdm_read_pwrst(pwrdm)) printk(KERN_ERR "pwrdm state mismatch(%s) %d != %d\n", pwrdm->name, pwrdm->state, pwrdm_read_pwrst(pwrdm)); seq_printf(s, "%s (%s)", pwrdm->name, pwrdm_state_names[pwrdm->state]); for (i = 0; i < PWRDM_MAX_PWRSTS; i++) seq_printf(s, ",%s:%d", pwrdm_state_names[i], pwrdm->state_counter[i]); seq_printf(s, ",RET-LOGIC-OFF:%d", pwrdm->ret_logic_off_counter); for (i = 0; i < pwrdm->banks; i++) seq_printf(s, ",RET-MEMBANK%d-OFF:%d", i + 1, pwrdm->ret_mem_off_counter[i]); seq_putc(s, '\n'); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Peter 'p2' De Schrijver14169.12%120.00%
Thara Gopinath4321.08%120.00%
Tero Kristo178.33%120.00%
SF Markus Elfring20.98%120.00%
Paul Walmsley10.49%120.00%
Total204100.00%5100.00%


static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user) { struct seq_file *s = (struct seq_file *)user; int i; if (strcmp(pwrdm->name, "emu_pwrdm") == 0 || strcmp(pwrdm->name, "wkup_pwrdm") == 0 || strncmp(pwrdm->name, "dpll", 4) == 0) return 0; pwrdm_state_switch(pwrdm); seq_printf(s, "%s (%s)", pwrdm->name, pwrdm_state_names[pwrdm->state]); for (i = 0; i < 4; i++) seq_printf(s, ",%s:%lld", pwrdm_state_names[i], pwrdm->state_timer[i]); seq_putc(s, '\n'); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Peter 'p2' De Schrijver13398.52%150.00%
SF Markus Elfring21.48%150.00%
Total135100.00%2100.00%


static int pm_dbg_show_counters(struct seq_file *s, void *unused) { pwrdm_for_each(pwrdm_dbg_show_counter, s); clkdm_for_each(clkdm_dbg_show_counter, s); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Peter 'p2' De Schrijver32100.00%1100.00%
Total32100.00%1100.00%


static int pm_dbg_show_timers(struct seq_file *s, void *unused) { pwrdm_for_each(pwrdm_dbg_show_timer, s); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Peter 'p2' De Schrijver25100.00%1100.00%
Total25100.00%1100.00%


static int pm_dbg_open(struct inode *inode, struct file *file) { switch ((int)inode->i_private) { case DEBUG_FILE_COUNTERS: return single_open(file, pm_dbg_show_counters, &inode->i_private); case DEBUG_FILE_TIMERS: default: return single_open(file, pm_dbg_show_timers, &inode->i_private); } }

Contributors

PersonTokensPropCommitsCommitProp
Peter 'p2' De Schrijver4575.00%133.33%
Kevin Hilman1016.67%133.33%
Tero Kristo58.33%133.33%
Total60100.00%3100.00%

static const struct file_operations debug_fops = { .open = pm_dbg_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, };
static int pwrdm_suspend_get(void *data, u64 *val) { int ret = -EINVAL; if (cpu_is_omap34xx()) ret = omap3_pm_get_suspend_state((struct powerdomain *)data); *val = ret; if (ret >= 0) return 0; return *val; }

Contributors

PersonTokensPropCommitsCommitProp
Tero Kristo3767.27%133.33%
Roel Kluin1018.18%133.33%
Thara Gopinath814.55%133.33%
Total55100.00%3100.00%


static int pwrdm_suspend_set(void *data, u64 val) { if (cpu_is_omap34xx()) return omap3_pm_set_suspend_state( (struct powerdomain *)data, (int)val); return -EINVAL; }

Contributors

PersonTokensPropCommitsCommitProp
Tero Kristo2976.32%150.00%
Thara Gopinath923.68%150.00%
Total38100.00%2100.00%

DEFINE_SIMPLE_ATTRIBUTE(pwrdm_suspend_fops, pwrdm_suspend_get, pwrdm_suspend_set, "%llu\n");
static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir) { int i; s64 t; struct dentry *d; t = sched_clock(); for (i = 0; i < 4; i++) pwrdm->state_timer[i] = 0; pwrdm->timer = t; if (strncmp(pwrdm->name, "dpll", 4) == 0) return 0; d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); if (d) (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, (void *)pwrdm, &pwrdm_suspend_fops); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Tero Kristo6350.81%133.33%
Peter 'p2' De Schrijver5745.97%133.33%
Jean Pihet43.23%133.33%
Total124100.00%3100.00%


static int option_get(void *data, u64 *val) { u32 *option = data; *val = *option; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Kevin Hilman29100.00%1100.00%
Total29100.00%1100.00%


static int option_set(void *data, u64 val) { u32 *option = data; *option = val; if (option == &enable_off_mode) { if (val) omap_pm_enable_off_mode(); else omap_pm_disable_off_mode(); if (cpu_is_omap34xx()) omap3_pm_off_mode_enable(val); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Kevin Hilman5087.72%266.67%
Thara Gopinath712.28%133.33%
Total57100.00%3100.00%

DEFINE_SIMPLE_ATTRIBUTE(pm_dbg_option_fops, option_get, option_set, "%llu\n");
static int __init pm_dbg_init(void) { struct dentry *d; if (pm_dbg_init_done) return 0; d = debugfs_create_dir("pm_debug", NULL); if (!d) return -EINVAL; (void) debugfs_create_file("count", S_IRUGO, d, (void *)DEBUG_FILE_COUNTERS, &debug_fops); (void) debugfs_create_file("time", S_IRUGO, d, (void *)DEBUG_FILE_TIMERS, &debug_fops); pwrdm_for_each(pwrdms_setup, (void *)d); (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUSR, d, &enable_off_mode, &pm_dbg_option_fops); pm_dbg_init_done = 1; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
Peter 'p2' De Schrijver8369.75%114.29%
Kevin Hilman1915.97%114.29%
Tero Kristo1210.08%228.57%
Russell King32.52%114.29%
Vasiliy Kulikov10.84%114.29%
Paul Walmsley10.84%114.29%
Total119100.00%7100.00%

omap_arch_initcall(pm_dbg_init); #endif

Overall Contributors

PersonTokensPropCommitsCommitProp
Peter 'p2' De Schrijver53845.79%13.85%
Tero Kristo37031.49%27.69%
Kevin Hilman15713.36%415.38%
Thara Gopinath685.79%27.69%
Roel Kluin100.85%13.85%
Paul Walmsley90.77%726.92%
Tony Lindgren50.43%311.54%
Jean Pihet40.34%13.85%
SF Markus Elfring40.34%13.85%
Tejun Heo30.26%13.85%
Ingo Molnar30.26%13.85%
Russell King30.26%13.85%
Vasiliy Kulikov10.09%13.85%
Total1175100.00%26100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.