1 /* SPDX-License-Identifier: GPL-2.0 */
3 * Copyright (c) 2016, NVIDIA CORPORATION.
6 #ifndef _POWER_DOMAIN_UCLASS_H
7 #define _POWER_DOMAIN_UCLASS_H
9 /* See power-domain.h for background documentation. */
11 #include <power-domain.h>
16 * struct power_domain_ops - The functions that a power domain controller driver
19 struct power_domain_ops {
21 * of_xlate - Translate a client's device-tree (OF) power domain
24 * The power domain core calls this function as the first step in
25 * implementing a client's power_domain_get() call.
27 * If this function pointer is set to NULL, the power domain core will
28 * use a default implementation, which assumes #power-domain-cells =
29 * <1>, and that the DT cell contains a simple integer power domain ID.
31 * At present, the power domain API solely supports device-tree. If
32 * this changes, other xxx_xlate() functions may be added to support
33 * those other mechanisms.
35 * @power_domain: The power domain struct to hold the
37 * @args: The power domain specifier values from device
39 * @return 0 if OK, or a negative error code.
41 int (*of_xlate)(struct power_domain *power_domain,
42 struct ofnode_phandle_args *args);
44 * request - Request a translated power domain.
46 * The power domain core calls this function as the second step in
47 * implementing a client's power_domain_get() call, following a
48 * successful xxx_xlate() call.
50 * @power_domain: The power domain to request; this has been
51 * filled in by a previous xxx_xlate() function
53 * @return 0 if OK, or a negative error code.
55 int (*request)(struct power_domain *power_domain);
57 * free - Free a previously requested power domain.
59 * This is the implementation of the client power_domain_free() API.
61 * @power_domain: The power domain to free.
62 * @return 0 if OK, or a negative error code.
64 int (*free)(struct power_domain *power_domain);
66 * on - Power on a power domain.
68 * @power_domain: The power domain to turn on.
69 * @return 0 if OK, or a negative error code.
71 int (*on)(struct power_domain *power_domain);
73 * off - Power off a power domain.
75 * @power_domain: The power domain to turn off.
76 * @return 0 if OK, or a negative error code.
78 int (*off)(struct power_domain *power_domain);