mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
ARM: ux500: Convert power-domain code into a regular platform driver
To make the code more standalone and moveable, let's convert it into a platform driver. Cc: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
parent
444ffc820d
commit
bd4ce2d7f9
3 changed files with 20 additions and 27 deletions
|
@ -26,8 +26,6 @@
|
||||||
#include <asm/mach/map.h>
|
#include <asm/mach/map.h>
|
||||||
#include <asm/mach/arch.h>
|
#include <asm/mach/arch.h>
|
||||||
|
|
||||||
#include "pm_domains.h"
|
|
||||||
|
|
||||||
static int __init ux500_l2x0_unlock(void)
|
static int __init ux500_l2x0_unlock(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -115,9 +113,6 @@ static const struct of_device_id u8500_local_bus_nodes[] = {
|
||||||
|
|
||||||
static void __init u8500_init_machine(void)
|
static void __init u8500_init_machine(void)
|
||||||
{
|
{
|
||||||
/* Initialize ux500 power domains */
|
|
||||||
ux500_pm_domains_init();
|
|
||||||
|
|
||||||
of_platform_populate(NULL, u8500_local_bus_nodes,
|
of_platform_populate(NULL, u8500_local_bus_nodes,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
*
|
*
|
||||||
* Implements PM domains using the generic PM domain for ux500.
|
* Implements PM domains using the generic PM domain for ux500.
|
||||||
*/
|
*/
|
||||||
|
#include <linux/device.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
#include <linux/printk.h>
|
#include <linux/printk.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
|
@ -13,7 +16,6 @@
|
||||||
#include <linux/pm_domain.h>
|
#include <linux/pm_domain.h>
|
||||||
|
|
||||||
#include <dt-bindings/arm/ux500_pm_domains.h>
|
#include <dt-bindings/arm/ux500_pm_domains.h>
|
||||||
#include "pm_domains.h"
|
|
||||||
|
|
||||||
static int pd_power_off(struct generic_pm_domain *domain)
|
static int pd_power_off(struct generic_pm_domain *domain)
|
||||||
{
|
{
|
||||||
|
@ -49,18 +51,17 @@ static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = {
|
||||||
[DOMAIN_VAPE] = &ux500_pm_domain_vape,
|
[DOMAIN_VAPE] = &ux500_pm_domain_vape,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct of_device_id ux500_pm_domain_matches[] __initconst = {
|
static const struct of_device_id ux500_pm_domain_matches[] = {
|
||||||
{ .compatible = "stericsson,ux500-pm-domains", },
|
{ .compatible = "stericsson,ux500-pm-domains", },
|
||||||
{ },
|
{ },
|
||||||
};
|
};
|
||||||
|
|
||||||
int __init ux500_pm_domains_init(void)
|
static int ux500_pm_domains_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct genpd_onecell_data *genpd_data;
|
struct genpd_onecell_data *genpd_data;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
np = of_find_matching_node(NULL, ux500_pm_domain_matches);
|
|
||||||
if (!np)
|
if (!np)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
@ -77,3 +78,17 @@ int __init ux500_pm_domains_init(void)
|
||||||
of_genpd_add_provider_onecell(np, genpd_data);
|
of_genpd_add_provider_onecell(np, genpd_data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct platform_driver ux500_pm_domains_driver = {
|
||||||
|
.probe = ux500_pm_domains_probe,
|
||||||
|
.driver = {
|
||||||
|
.name = "ux500_pm_domains",
|
||||||
|
.of_match_table = ux500_pm_domain_matches,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init ux500_pm_domains_init(void)
|
||||||
|
{
|
||||||
|
return platform_driver_register(&ux500_pm_domains_driver);
|
||||||
|
}
|
||||||
|
arch_initcall(ux500_pm_domains_init);
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
||||||
/*
|
|
||||||
* Copyright (C) 2014 Linaro Ltd.
|
|
||||||
*
|
|
||||||
* Author: Ulf Hansson <ulf.hansson@linaro.org>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __MACH_UX500_PM_DOMAINS_H
|
|
||||||
#define __MACH_UX500_PM_DOMAINS_H
|
|
||||||
|
|
||||||
#ifdef CONFIG_PM_GENERIC_DOMAINS
|
|
||||||
extern int __init ux500_pm_domains_init(void);
|
|
||||||
#else
|
|
||||||
static inline int ux500_pm_domains_init(void) { return 0; }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
Add table
Add a link
Reference in a new issue