Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+20 -27
-5
arch/arm/mach-ux500/cpu-db8500.c
··· 26 26 #include <asm/mach/map.h> 27 27 #include <asm/mach/arch.h> 28 28 29 - #include "pm_domains.h" 30 - 31 29 static int __init ux500_l2x0_unlock(void) 32 30 { 33 31 int i; ··· 113 115 114 116 static void __init u8500_init_machine(void) 115 117 { 116 - /* Initialize ux500 power domains */ 117 - ux500_pm_domains_init(); 118 - 119 118 of_platform_populate(NULL, u8500_local_bus_nodes, 120 119 NULL, NULL); 121 120 }
+20 -5
arch/arm/mach-ux500/pm_domains.c
··· 6 6 * 7 7 * Implements PM domains using the generic PM domain for ux500. 8 8 */ 9 + #include <linux/device.h> 10 + #include <linux/kernel.h> 11 + #include <linux/platform_device.h> 9 12 #include <linux/printk.h> 10 13 #include <linux/slab.h> 11 14 #include <linux/err.h> ··· 16 13 #include <linux/pm_domain.h> 17 14 18 15 #include <dt-bindings/arm/ux500_pm_domains.h> 19 - #include "pm_domains.h" 20 16 21 17 static int pd_power_off(struct generic_pm_domain *domain) 22 18 { ··· 51 49 [DOMAIN_VAPE] = &ux500_pm_domain_vape, 52 50 }; 53 51 54 - static const struct of_device_id ux500_pm_domain_matches[] __initconst = { 52 + static const struct of_device_id ux500_pm_domain_matches[] = { 55 53 { .compatible = "stericsson,ux500-pm-domains", }, 56 54 { }, 57 55 }; 58 56 59 - int __init ux500_pm_domains_init(void) 57 + static int ux500_pm_domains_probe(struct platform_device *pdev) 60 58 { 61 - struct device_node *np; 59 + struct device_node *np = pdev->dev.of_node; 62 60 struct genpd_onecell_data *genpd_data; 63 61 int i; 64 62 65 - np = of_find_matching_node(NULL, ux500_pm_domain_matches); 66 63 if (!np) 67 64 return -ENODEV; 68 65 ··· 78 77 of_genpd_add_provider_onecell(np, genpd_data); 79 78 return 0; 80 79 } 80 + 81 + static struct platform_driver ux500_pm_domains_driver = { 82 + .probe = ux500_pm_domains_probe, 83 + .driver = { 84 + .name = "ux500_pm_domains", 85 + .of_match_table = ux500_pm_domain_matches, 86 + }, 87 + }; 88 + 89 + static int __init ux500_pm_domains_init(void) 90 + { 91 + return platform_driver_register(&ux500_pm_domains_driver); 92 + } 93 + arch_initcall(ux500_pm_domains_init);
-17
arch/arm/mach-ux500/pm_domains.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (C) 2014 Linaro Ltd. 4 - * 5 - * Author: Ulf Hansson <ulf.hansson@linaro.org> 6 - */ 7 - 8 - #ifndef __MACH_UX500_PM_DOMAINS_H 9 - #define __MACH_UX500_PM_DOMAINS_H 10 - 11 - #ifdef CONFIG_PM_GENERIC_DOMAINS 12 - extern int __init ux500_pm_domains_init(void); 13 - #else 14 - static inline int ux500_pm_domains_init(void) { return 0; } 15 - #endif 16 - 17 - #endif