Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 375706
b: refs/heads/master
c: 0a3b15a
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed May 12, 2013
1 parent 3cc495a commit 142eb2d
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 89 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d5a2fa27ecd772b51d93a91209205ec4d6ea2da1
refs/heads/master: 0a3b15ac3cc3ddc791901e12bdc930b5fa11a30a
8 changes: 4 additions & 4 deletions trunk/drivers/acpi/processor_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@ static const struct acpi_device_id processor_device_ids[] = {
};
MODULE_DEVICE_TABLE(acpi, processor_device_ids);

static SIMPLE_DEV_PM_OPS(acpi_processor_pm,
acpi_processor_suspend, acpi_processor_resume);

static struct acpi_driver acpi_processor_driver = {
.name = "processor",
.class = ACPI_PROCESSOR_CLASS,
Expand All @@ -107,7 +104,6 @@ static struct acpi_driver acpi_processor_driver = {
.remove = acpi_processor_remove,
.notify = acpi_processor_notify,
},
.drv.pm = &acpi_processor_pm,
};

#define INSTALL_NOTIFY_HANDLER 1
Expand Down Expand Up @@ -934,6 +930,8 @@ static int __init acpi_processor_init(void)
if (result < 0)
return result;

acpi_processor_syscore_init();

acpi_processor_install_hotplug_notify();

acpi_thermal_cpufreq_init();
Expand All @@ -956,6 +954,8 @@ static void __exit acpi_processor_exit(void)

acpi_processor_uninstall_hotplug_notify();

acpi_processor_syscore_exit();

acpi_bus_unregister_driver(&acpi_processor_driver);

return;
Expand Down
29 changes: 19 additions & 10 deletions trunk/drivers/acpi/processor_idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <linux/sched.h> /* need_resched() */
#include <linux/clockchips.h>
#include <linux/cpuidle.h>
#include <linux/syscore_ops.h>

/*
* Include the apic definitions for x86 to have the APIC timer related defines
Expand Down Expand Up @@ -210,33 +211,41 @@ static void lapic_timer_state_broadcast(struct acpi_processor *pr,

#endif

#ifdef CONFIG_PM_SLEEP
static u32 saved_bm_rld;

static void acpi_idle_bm_rld_save(void)
int acpi_processor_suspend(void)
{
acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &saved_bm_rld);
return 0;
}
static void acpi_idle_bm_rld_restore(void)

void acpi_processor_resume(void)
{
u32 resumed_bm_rld;

acpi_read_bit_register(ACPI_BITREG_BUS_MASTER_RLD, &resumed_bm_rld);
if (resumed_bm_rld == saved_bm_rld)
return;

if (resumed_bm_rld != saved_bm_rld)
acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
acpi_write_bit_register(ACPI_BITREG_BUS_MASTER_RLD, saved_bm_rld);
}

int acpi_processor_suspend(struct device *dev)
static struct syscore_ops acpi_processor_syscore_ops = {
.suspend = acpi_processor_suspend,
.resume = acpi_processor_resume,
};

void acpi_processor_syscore_init(void)
{
acpi_idle_bm_rld_save();
return 0;
register_syscore_ops(&acpi_processor_syscore_ops);
}

int acpi_processor_resume(struct device *dev)
void acpi_processor_syscore_exit(void)
{
acpi_idle_bm_rld_restore();
return 0;
unregister_syscore_ops(&acpi_processor_syscore_ops);
}
#endif /* CONFIG_PM_SLEEP */

#if defined(CONFIG_X86)
static void tsc_check_state(int state)
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/cpufreq/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ config CPU_FREQ_STAT_DETAILS

choice
prompt "Default CPUFreq governor"
default CPU_FREQ_DEFAULT_GOV_USERSPACE if ARM_SA1100_CPUFREQ || ARM_SA1110_CPUFREQ
default CPU_FREQ_DEFAULT_GOV_USERSPACE if CPU_FREQ_SA1100 || CPU_FREQ_SA1110
default CPU_FREQ_DEFAULT_GOV_PERFORMANCE
help
This option sets which CPUFreq governor shall be loaded at
Expand Down
15 changes: 7 additions & 8 deletions trunk/drivers/cpufreq/Kconfig.arm
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@
#

config ARM_BIG_LITTLE_CPUFREQ
tristate "Generic ARM big LITTLE CPUfreq driver"
depends on ARM_CPU_TOPOLOGY && PM_OPP && HAVE_CLK
help
This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
tristate
depends on ARM_CPU_TOPOLOGY

config ARM_DT_BL_CPUFREQ
tristate "Generic probing via DT for ARM big LITTLE CPUfreq driver"
depends on ARM_BIG_LITTLE_CPUFREQ && OF
tristate "Generic ARM big LITTLE CPUfreq driver probed via DT"
select ARM_BIG_LITTLE_CPUFREQ
depends on OF && HAVE_CLK
help
This enables probing via DT for Generic CPUfreq driver for ARM
big.LITTLE platform. This gets frequency tables from DT.
This enables the Generic CPUfreq driver for ARM big.LITTLE platform.
This gets frequency tables from DT.

config ARM_EXYNOS_CPUFREQ
bool "SAMSUNG EXYNOS SoCs"
Expand Down
7 changes: 6 additions & 1 deletion trunk/drivers/cpufreq/arm_big_little.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ static struct clk *clk[MAX_CLUSTERS];
static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS];
static atomic_t cluster_usage[MAX_CLUSTERS] = {ATOMIC_INIT(0), ATOMIC_INIT(0)};

static int cpu_to_cluster(int cpu)
{
return topology_physical_package_id(cpu);
}

static unsigned int bL_cpufreq_get(unsigned int cpu)
{
u32 cur_cluster = cpu_to_cluster(cpu);
Expand Down Expand Up @@ -187,7 +192,7 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)

cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu));

dev_info(cpu_dev, "%s: CPU %d initialized\n", __func__, policy->cpu);
dev_info(cpu_dev, "CPU %d initialized\n", policy->cpu);
return 0;
}

Expand Down
5 changes: 0 additions & 5 deletions trunk/drivers/cpufreq/arm_big_little.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ struct cpufreq_arm_bL_ops {
int (*init_opp_table)(struct device *cpu_dev);
};

static inline int cpu_to_cluster(int cpu)
{
return topology_physical_package_id(cpu);
}

int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops);
void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops);

Expand Down
9 changes: 4 additions & 5 deletions trunk/drivers/cpufreq/arm_big_little_dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ static int dt_get_transition_latency(struct device *cpu_dev)

parent = of_find_node_by_path("/cpus");
if (!parent) {
pr_info("Failed to find OF /cpus. Use CPUFREQ_ETERNAL transition latency\n");
return CPUFREQ_ETERNAL;
pr_err("failed to find OF /cpus\n");
return -ENOENT;
}

for_each_child_of_node(parent, np) {
Expand All @@ -78,11 +78,10 @@ static int dt_get_transition_latency(struct device *cpu_dev)
of_node_put(np);
of_node_put(parent);

return transition_latency;
return 0;
}

pr_info("clock-latency isn't found, use CPUFREQ_ETERNAL transition latency\n");
return CPUFREQ_ETERNAL;
return -ENODEV;
}

static struct cpufreq_arm_bL_ops dt_bL_ops = {
Expand Down
27 changes: 7 additions & 20 deletions trunk/drivers/cpufreq/cpufreq-cpu0.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,36 +189,25 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)

if (!np) {
pr_err("failed to find cpu0 node\n");
ret = -ENOENT;
goto out_put_parent;
return -ENOENT;
}

cpu_dev = &pdev->dev;
cpu_dev->of_node = np;

cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
if (IS_ERR(cpu_reg)) {
/*
* If cpu0 regulator supply node is present, but regulator is
* not yet registered, we should try defering probe.
*/
if (PTR_ERR(cpu_reg) == -EPROBE_DEFER) {
dev_err(cpu_dev, "cpu0 regulator not ready, retry\n");
ret = -EPROBE_DEFER;
goto out_put_node;
}
pr_warn("failed to get cpu0 regulator: %ld\n",
PTR_ERR(cpu_reg));
cpu_reg = NULL;
}

cpu_clk = devm_clk_get(cpu_dev, NULL);
if (IS_ERR(cpu_clk)) {
ret = PTR_ERR(cpu_clk);
pr_err("failed to get cpu0 clock: %d\n", ret);
goto out_put_node;
}

cpu_reg = devm_regulator_get(cpu_dev, "cpu0");
if (IS_ERR(cpu_reg)) {
pr_warn("failed to get cpu0 regulator\n");
cpu_reg = NULL;
}

ret = of_init_opp_table(cpu_dev);
if (ret) {
pr_err("failed to init OPP table: %d\n", ret);
Expand Down Expand Up @@ -275,8 +264,6 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev)
opp_free_cpufreq_table(cpu_dev, &freq_table);
out_put_node:
of_node_put(np);
out_put_parent:
of_node_put(parent);
return ret;
}

Expand Down
6 changes: 3 additions & 3 deletions trunk/drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1075,14 +1075,14 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif
__func__, cpu_dev->id, cpu);
}

if ((cpus == 1) && (cpufreq_driver->target))
__cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);

pr_debug("%s: removing link, cpu: %d\n", __func__, cpu);
cpufreq_cpu_put(data);

/* If cpu is last user of policy, free policy */
if (cpus == 1) {
if (cpufreq_driver->target)
__cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);

lock_policy_rwsem_read(cpu);
kobj = &data->kobj;
cmp = &data->kobj_unregister;
Expand Down
11 changes: 4 additions & 7 deletions trunk/drivers/cpufreq/cpufreq_governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
if (have_governor_per_policy()) {
WARN_ON(dbs_data);
} else if (dbs_data) {
dbs_data->usage_count++;
policy->governor_data = dbs_data;
return 0;
}
Expand All @@ -267,7 +266,6 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
}

dbs_data->cdata = cdata;
dbs_data->usage_count = 1;
rc = cdata->init(dbs_data);
if (rc) {
pr_err("%s: POLICY_INIT: init() failed\n", __func__);
Expand Down Expand Up @@ -296,8 +294,7 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,
set_sampling_rate(dbs_data, max(dbs_data->min_sampling_rate,
latency * LATENCY_MULTIPLIER));

if ((cdata->governor == GOV_CONSERVATIVE) &&
(!policy->governor->initialized)) {
if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;

cpufreq_register_notifier(cs_ops->notifier_block,
Expand All @@ -309,12 +306,12 @@ int cpufreq_governor_dbs(struct cpufreq_policy *policy,

return 0;
case CPUFREQ_GOV_POLICY_EXIT:
if (!--dbs_data->usage_count) {
if ((policy->governor->initialized == 1) ||
have_governor_per_policy()) {
sysfs_remove_group(get_governor_parent_kobj(policy),
get_sysfs_attr(dbs_data));

if ((dbs_data->cdata->governor == GOV_CONSERVATIVE) &&
(policy->governor->initialized == 1)) {
if (dbs_data->cdata->governor == GOV_CONSERVATIVE) {
struct cs_ops *cs_ops = dbs_data->cdata->gov_ops;

cpufreq_unregister_notifier(cs_ops->notifier_block,
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/cpufreq/cpufreq_governor.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ struct common_dbs_data {
struct dbs_data {
struct common_dbs_data *cdata;
unsigned int min_sampling_rate;
int usage_count;
void *tuners;

/* dbs_mutex protects dbs_enable in governor start/stop */
Expand Down
1 change: 1 addition & 0 deletions trunk/drivers/cpufreq/cpufreq_ondemand.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ static int od_init(struct dbs_data *dbs_data)
tuners->io_is_busy = should_io_be_busy();

dbs_data->tuners = tuners;
pr_info("%s: tuners %p\n", __func__, tuners);
mutex_init(&dbs_data->mutex);
return 0;
}
Expand Down
Loading

0 comments on commit 142eb2d

Please sign in to comment.