mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
Merge branches 'sh/pm-runtime' and 'common/clkfwk' into sh-fixes-for-linus
This commit is contained in:
commit
37bef8f989
3472 changed files with 65364 additions and 35672 deletions
|
|
@ -7,3 +7,11 @@ obj-$(CONFIG_HAVE_CLK) += clk/
|
|||
obj-$(CONFIG_MAPLE) += maple/
|
||||
obj-$(CONFIG_SUPERHYWAY) += superhyway/
|
||||
obj-$(CONFIG_GENERIC_GPIO) += pfc.o
|
||||
|
||||
#
|
||||
# For the moment we only use this framework for ARM-based SH/R-Mobile
|
||||
# platforms and generic SH. SH-based SH-Mobile platforms are still using
|
||||
# an older framework that is pending up-porting, at which point this
|
||||
# special casing can go away.
|
||||
#
|
||||
obj-$(CONFIG_SUPERH)$(CONFIG_ARCH_SHMOBILE) += pm_runtime.o
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@
|
|||
#include <linux/seq_file.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/cpufreq.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/sh_clk.h>
|
||||
|
|
@ -173,6 +172,26 @@ long clk_rate_div_range_round(struct clk *clk, unsigned int div_min,
|
|||
return clk_rate_round_helper(&div_range_round);
|
||||
}
|
||||
|
||||
static long clk_rate_mult_range_iter(unsigned int pos,
|
||||
struct clk_rate_round_data *rounder)
|
||||
{
|
||||
return clk_get_rate(rounder->arg) * pos;
|
||||
}
|
||||
|
||||
long clk_rate_mult_range_round(struct clk *clk, unsigned int mult_min,
|
||||
unsigned int mult_max, unsigned long rate)
|
||||
{
|
||||
struct clk_rate_round_data mult_range_round = {
|
||||
.min = mult_min,
|
||||
.max = mult_max,
|
||||
.func = clk_rate_mult_range_iter,
|
||||
.arg = clk_get_parent(clk),
|
||||
.rate = rate,
|
||||
};
|
||||
|
||||
return clk_rate_round_helper(&mult_range_round);
|
||||
}
|
||||
|
||||
int clk_rate_table_find(struct clk *clk,
|
||||
struct cpufreq_frequency_table *freq_table,
|
||||
unsigned long rate)
|
||||
|
|
@ -205,9 +224,6 @@ int clk_reparent(struct clk *child, struct clk *parent)
|
|||
list_add(&child->sibling, &parent->children);
|
||||
child->parent = parent;
|
||||
|
||||
/* now do the debugfs renaming to reattach the child
|
||||
to the proper parent */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -665,89 +681,6 @@ static int __init clk_syscore_init(void)
|
|||
subsys_initcall(clk_syscore_init);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* debugfs support to trace clock tree hierarchy and attributes
|
||||
*/
|
||||
static struct dentry *clk_debugfs_root;
|
||||
|
||||
static int clk_debugfs_register_one(struct clk *c)
|
||||
{
|
||||
int err;
|
||||
struct dentry *d;
|
||||
struct clk *pa = c->parent;
|
||||
char s[255];
|
||||
char *p = s;
|
||||
|
||||
p += sprintf(p, "%p", c);
|
||||
d = debugfs_create_dir(s, pa ? pa->dentry : clk_debugfs_root);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
c->dentry = d;
|
||||
|
||||
d = debugfs_create_u8("usecount", S_IRUGO, c->dentry, (u8 *)&c->usecount);
|
||||
if (!d) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
d = debugfs_create_u32("rate", S_IRUGO, c->dentry, (u32 *)&c->rate);
|
||||
if (!d) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
d = debugfs_create_x32("flags", S_IRUGO, c->dentry, (u32 *)&c->flags);
|
||||
if (!d) {
|
||||
err = -ENOMEM;
|
||||
goto err_out;
|
||||
}
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
debugfs_remove_recursive(c->dentry);
|
||||
return err;
|
||||
}
|
||||
|
||||
static int clk_debugfs_register(struct clk *c)
|
||||
{
|
||||
int err;
|
||||
struct clk *pa = c->parent;
|
||||
|
||||
if (pa && !pa->dentry) {
|
||||
err = clk_debugfs_register(pa);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!c->dentry) {
|
||||
err = clk_debugfs_register_one(c);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __init clk_debugfs_init(void)
|
||||
{
|
||||
struct clk *c;
|
||||
struct dentry *d;
|
||||
int err;
|
||||
|
||||
d = debugfs_create_dir("clock", NULL);
|
||||
if (!d)
|
||||
return -ENOMEM;
|
||||
clk_debugfs_root = d;
|
||||
|
||||
list_for_each_entry(c, &clock_list, node) {
|
||||
err = clk_debugfs_register(c);
|
||||
if (err)
|
||||
goto err_out;
|
||||
}
|
||||
return 0;
|
||||
err_out:
|
||||
debugfs_remove_recursive(clk_debugfs_root);
|
||||
return err;
|
||||
}
|
||||
late_initcall(clk_debugfs_init);
|
||||
|
||||
static int __init clk_late_init(void)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ static unsigned char intc_irq_sense_table[IRQ_TYPE_SENSE_MASK + 1] = {
|
|||
!defined(CONFIG_CPU_SUBTYPE_SH7709)
|
||||
[IRQ_TYPE_LEVEL_HIGH] = VALID(3),
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_SH7372)
|
||||
#if defined(CONFIG_ARM) /* all recent SH-Mobile / R-Mobile ARM support this */
|
||||
[IRQ_TYPE_EDGE_BOTH] = VALID(4),
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include <linux/irq.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/stat.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/sh_intc.h>
|
||||
#include <linux/sysdev.h>
|
||||
|
|
@ -29,6 +30,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/radix-tree.h>
|
||||
#include <linux/export.h>
|
||||
#include "internals.h"
|
||||
|
||||
LIST_HEAD(intc_list);
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <linux/irq.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/module.h>
|
||||
#include "internals.h" /* only for activate_irq() damage.. */
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
#include <linux/list.h>
|
||||
#include <linux/radix-tree.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/export.h>
|
||||
#include "internals.h"
|
||||
|
||||
static struct intc_map_entry intc_irq_xlate[NR_IRQS];
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include <linux/maple.h>
|
||||
#include <linux/dma-mapping.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/module.h>
|
||||
#include <asm/cacheflush.h>
|
||||
#include <asm/dma.h>
|
||||
#include <asm/io.h>
|
||||
|
|
|
|||
65
drivers/sh/pm_runtime.c
Normal file
65
drivers/sh/pm_runtime.c
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
* Runtime PM support code
|
||||
*
|
||||
* Copyright (C) 2009-2010 Magnus Damm
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file "COPYING" in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/pm_domain.h>
|
||||
#include <linux/pm_clock.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/sh_clk.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#ifdef CONFIG_PM_RUNTIME
|
||||
|
||||
static int default_platform_runtime_idle(struct device *dev)
|
||||
{
|
||||
/* suspend synchronously to disable clocks immediately */
|
||||
return pm_runtime_suspend(dev);
|
||||
}
|
||||
|
||||
static struct dev_pm_domain default_pm_domain = {
|
||||
.ops = {
|
||||
.runtime_suspend = pm_clk_suspend,
|
||||
.runtime_resume = pm_clk_resume,
|
||||
.runtime_idle = default_platform_runtime_idle,
|
||||
USE_PLATFORM_PM_SLEEP_OPS
|
||||
},
|
||||
};
|
||||
|
||||
#define DEFAULT_PM_DOMAIN_PTR (&default_pm_domain)
|
||||
|
||||
#else
|
||||
|
||||
#define DEFAULT_PM_DOMAIN_PTR NULL
|
||||
|
||||
#endif /* CONFIG_PM_RUNTIME */
|
||||
|
||||
static struct pm_clk_notifier_block platform_bus_notifier = {
|
||||
.pm_domain = DEFAULT_PM_DOMAIN_PTR,
|
||||
.con_ids = { NULL, },
|
||||
};
|
||||
|
||||
static int __init sh_pm_runtime_init(void)
|
||||
{
|
||||
pm_clk_add_notifier(&platform_bus_type, &platform_bus_notifier);
|
||||
return 0;
|
||||
}
|
||||
core_initcall(sh_pm_runtime_init);
|
||||
|
||||
static int __init sh_pm_runtime_late_init(void)
|
||||
{
|
||||
pm_genpd_poweroff_unused();
|
||||
return 0;
|
||||
}
|
||||
late_initcall(sh_pm_runtime_late_init);
|
||||
Loading…
Reference in a new issue