xref: /openbmc/linux/drivers/gpu/drm/msm/dp/dp_power.h (revision 9134211f)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
4  */
5 
6 #ifndef _DP_POWER_H_
7 #define _DP_POWER_H_
8 
9 #include "dp_parser.h"
10 
11 /**
12  * sruct dp_power - DisplayPort's power related data
13  *
14  * @init: initializes the regulators/core clocks/GPIOs/pinctrl
15  * @deinit: turns off the regulators/core clocks/GPIOs/pinctrl
16  * @clk_enable: enable/disable the DP clocks
17  * @set_pixel_clk_parent: set the parent of DP pixel clock
18  */
19 struct dp_power {
20 	bool core_clks_on;
21 	bool link_clks_on;
22 	bool stream_clks_on;
23 };
24 
25 /**
26  * dp_power_init() - enable power supplies for display controller
27  *
28  * @power: instance of power module
29  * return: 0 if success or error if failure.
30  *
31  * This API will turn on the regulators and configures gpio's
32  * aux/hpd.
33  */
34 int dp_power_init(struct dp_power *power);
35 
36 /**
37  * dp_power_deinit() - turn off regulators and gpios.
38  *
39  * @power: instance of power module
40  * return: 0 for success
41  *
42  * This API turns off power and regulators.
43  */
44 int dp_power_deinit(struct dp_power *power);
45 
46 /**
47  * dp_power_clk_status() - display controller clocks status
48  *
49  * @power: instance of power module
50  * @pm_type: type of pm, core/ctrl/phy
51  * return: status of power clocks
52  *
53  * This API return status of DP clocks
54  */
55 
56 int dp_power_clk_status(struct dp_power *dp_power, enum dp_pm_type pm_type);
57 
58 /**
59  * dp_power_clk_enable() - enable display controller clocks
60  *
61  * @power: instance of power module
62  * @pm_type: type of pm, core/ctrl/phy
63  * @enable: enables or disables
64  * return: pointer to allocated power module data
65  *
66  * This API will call setrate and enable for DP clocks
67  */
68 
69 int dp_power_clk_enable(struct dp_power *power, enum dp_pm_type pm_type,
70 				bool enable);
71 
72 /**
73  * dp_power_client_init() - initialize clock and regulator modules
74  *
75  * @power: instance of power module
76  * return: 0 for success, error for failure.
77  *
78  * This API will configure the DisplayPort's clocks and regulator
79  * modules.
80  */
81 int dp_power_client_init(struct dp_power *power);
82 
83 /**
84  * dp_power_clinet_deinit() - de-initialize clock and regulator modules
85  *
86  * @power: instance of power module
87  * return: 0 for success, error for failure.
88  *
89  * This API will de-initialize the DisplayPort's clocks and regulator
90  * modules.
91  */
92 void dp_power_client_deinit(struct dp_power *power);
93 
94 /**
95  * dp_power_get() - configure and get the DisplayPort power module data
96  *
97  * @parser: instance of parser module
98  * return: pointer to allocated power module data
99  *
100  * This API will configure the DisplayPort's power module and provides
101  * methods to be called by the client to configure the power related
102  * modules.
103  */
104 struct dp_power *dp_power_get(struct device *dev, struct dp_parser *parser);
105 
106 #endif /* _DP_POWER_H_ */
107