2 * Copyright (c) 2016, NVIDIA CORPORATION.
4 * SPDX-License-Identifier: GPL-2.0
7 #ifndef _POWER_DOMAIN_UCLASS_H
8 #define _POWER_DOMAIN_UCLASS_H
10 /* See power-domain.h for background documentation. */
12 #include <power-domain.h>
17 * struct power_domain_ops - The functions that a power domain controller driver
20 struct power_domain_ops {
22 * of_xlate - Translate a client's device-tree (OF) power domain
25 * The power domain core calls this function as the first step in
26 * implementing a client's power_domain_get() call.
28 * If this function pointer is set to NULL, the power domain core will
29 * use a default implementation, which assumes #power-domain-cells =
30 * <1>, and that the DT cell contains a simple integer power domain ID.
32 * At present, the power domain API solely supports device-tree. If
33 * this changes, other xxx_xlate() functions may be added to support
34 * those other mechanisms.
36 * @power_domain: The power domain struct to hold the
38 * @args: The power domain specifier values from device
40 * @return 0 if OK, or a negative error code.
42 int (*of_xlate)(struct power_domain *power_domain,
43 struct ofnode_phandle_args *args);
45 * request - Request a translated power domain.
47 * The power domain core calls this function as the second step in
48 * implementing a client's power_domain_get() call, following a
49 * successful xxx_xlate() call.
51 * @power_domain: The power domain to request; this has been
52 * filled in by a previous xxx_xlate() function
54 * @return 0 if OK, or a negative error code.
56 int (*request)(struct power_domain *power_domain);
58 * free - Free a previously requested power domain.
60 * This is the implementation of the client power_domain_free() API.
62 * @power_domain: The power domain to free.
63 * @return 0 if OK, or a negative error code.
65 int (*free)(struct power_domain *power_domain);
67 * on - Power on a power domain.
69 * @power_domain: The power domain to turn on.
70 * @return 0 if OK, or a negative error code.
72 int (*on)(struct power_domain *power_domain);
74 * off - Power off a power domain.
76 * @power_domain: The power domain to turn off.
77 * @return 0 if OK, or a negative error code.
79 int (*off)(struct power_domain *power_domain);