cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

pm_domains.c (2028B)


      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 * Implements PM domains using the generic PM domain for ux500.
      8 */
      9#include <linux/printk.h>
     10#include <linux/slab.h>
     11#include <linux/err.h>
     12#include <linux/of.h>
     13#include <linux/pm_domain.h>
     14
     15#include <dt-bindings/arm/ux500_pm_domains.h>
     16#include "pm_domains.h"
     17
     18static int pd_power_off(struct generic_pm_domain *domain)
     19{
     20	/*
     21	 * Handle the gating of the PM domain regulator here.
     22	 *
     23	 * Drivers/subsystems handling devices in the PM domain needs to perform
     24	 * register context save/restore from their respective runtime PM
     25	 * callbacks, to be able to enable PM domain gating/ungating.
     26	 */
     27	return 0;
     28}
     29
     30static int pd_power_on(struct generic_pm_domain *domain)
     31{
     32	/*
     33	 * Handle the ungating of the PM domain regulator here.
     34	 *
     35	 * Drivers/subsystems handling devices in the PM domain needs to perform
     36	 * register context save/restore from their respective runtime PM
     37	 * callbacks, to be able to enable PM domain gating/ungating.
     38	 */
     39	return 0;
     40}
     41
     42static struct generic_pm_domain ux500_pm_domain_vape = {
     43	.name = "VAPE",
     44	.power_off = pd_power_off,
     45	.power_on = pd_power_on,
     46};
     47
     48static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = {
     49	[DOMAIN_VAPE] = &ux500_pm_domain_vape,
     50};
     51
     52static const struct of_device_id ux500_pm_domain_matches[] __initconst = {
     53	{ .compatible = "stericsson,ux500-pm-domains", },
     54	{ },
     55};
     56
     57int __init ux500_pm_domains_init(void)
     58{
     59	struct device_node *np;
     60	struct genpd_onecell_data *genpd_data;
     61	int i;
     62
     63	np = of_find_matching_node(NULL, ux500_pm_domain_matches);
     64	if (!np)
     65		return -ENODEV;
     66
     67	genpd_data = kzalloc(sizeof(*genpd_data), GFP_KERNEL);
     68	if (!genpd_data)
     69		return -ENOMEM;
     70
     71	genpd_data->domains = ux500_pm_domains;
     72	genpd_data->num_domains = ARRAY_SIZE(ux500_pm_domains);
     73
     74	for (i = 0; i < ARRAY_SIZE(ux500_pm_domains); ++i)
     75		pm_genpd_init(ux500_pm_domains[i], NULL, false);
     76
     77	of_genpd_add_provider_onecell(np, genpd_data);
     78	return 0;
     79}