lkml.org 
[lkml]   [2015]   [Oct]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[RFC v3 5/7] drivers: cpu-pd: allow calling of_cpu_pd_init from platform code.
    Date
    From: Marc Titinger <mtitinger@baylibre.com>

    re-instate a two step init, first register the CPU-power domains, then
    attach the CPUs, because CPU ordering does not match cluster/PD boundaries.

    Signed-off-by: Marc Titinger <mtitinger+renesas@baylibre.com>
    ---
    drivers/base/power/cpu-pd.c | 29 ++++++++++++-----------------
    include/linux/cpu-pd.h | 2 ++
    2 files changed, 14 insertions(+), 17 deletions(-)

    diff --git a/drivers/base/power/cpu-pd.c b/drivers/base/power/cpu-pd.c
    index eddee98..701a68f 100644
    --- a/drivers/base/power/cpu-pd.c
    +++ b/drivers/base/power/cpu-pd.c
    @@ -8,8 +8,6 @@
    * published by the Free Software Foundation.
    */

    -#define DEBUG
    -
    #include <linux/kernel.h>
    #include <linux/export.h>
    #include <linux/cpu.h>
    @@ -160,8 +158,6 @@ static int cpu_hotplug(struct notifier_block *nb,
    int of_register_cpu_pm_domain(struct device_node *dn,
    struct cpu_pm_domain *pd)
    {
    - int ret;
    -
    if (!pd || !pd->genpd)
    return -EINVAL;

    @@ -187,14 +183,6 @@ int of_register_cpu_pm_domain(struct device_node *dn,
    pm_genpd_init_simple(pd->genpd, &simple_qos_governor, false);
    of_genpd_add_provider_simple(dn, pd->genpd);

    - /* Attach the CPUs to the CPU PM domain */
    - ret = of_pm_domain_attach_cpus();
    - if (ret) {
    - of_genpd_del_provider(dn);
    - return ret;
    - }
    -
    - hotcpu_notifier(cpu_hotplug, 0)
    return 0;
    }
    EXPORT_SYMBOL(of_register_cpu_pm_domain);
    @@ -245,21 +233,28 @@ int of_init_cpu_pm_domain(struct device_node *dn, struct cpu_pm_ops *ops)
    EXPORT_SYMBOL(of_init_cpu_pm_domain);


    -static int __init of_cpu_pd_init(void)
    +int __init of_cpu_pd_init(const char *compatible)
    {
    struct device_node *dn;
    int ret;

    - for_each_compatible_node(dn, NULL, "cpu,pd") {
    + if (!compatible)
    + return -EINVAL;
    +
    + for_each_compatible_node(dn, NULL, compatible) {

    if (!of_device_is_available(dn))
    continue;

    ret = of_init_cpu_pm_domain(dn, NULL);
    - if (!ret)
    + if (ret)
    return ret;

    }
    - return 0;
    +
    + ret = of_pm_domain_attach_cpus();
    + if (!ret)
    + hotcpu_notifier(cpu_hotplug, 0);
    +
    + return ret;
    }
    -device_initcall(of_cpu_pd_init);
    diff --git a/include/linux/cpu-pd.h b/include/linux/cpu-pd.h
    index 9ae6f5b..f3066d0 100644
    --- a/include/linux/cpu-pd.h
    +++ b/include/linux/cpu-pd.h
    @@ -32,4 +32,6 @@ extern int of_register_cpu_pm_domain(struct device_node *dn,
    extern int of_init_cpu_pm_domain(struct device_node *dn,
    struct cpu_pm_ops *ops);

    +extern int __init of_cpu_pd_init(const char *compatible);
    +
    #endif /* __CPU_PD_H__ */
    --
    1.9.1


    \
     
     \ /
      Last update: 2015-10-27 19:01    [W:3.657 / U:1.304 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site