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 * @flip: bool for flipping gpio direction 30 * return: 0 if success or error if failure. 31 * 32 * This API will turn on the regulators and configures gpio's 33 * aux/hpd. 34 */ 35 int dp_power_init(struct dp_power *power, bool flip); 36 37 /** 38 * dp_power_deinit() - turn off regulators and gpios. 39 * 40 * @power: instance of power module 41 * return: 0 for success 42 * 43 * This API turns off power and regulators. 44 */ 45 int dp_power_deinit(struct dp_power *power); 46 47 /** 48 * dp_power_clk_status() - display controller clocks status 49 * 50 * @power: instance of power module 51 * @pm_type: type of pm, core/ctrl/phy 52 * return: status of power clocks 53 * 54 * This API return status of DP clocks 55 */ 56 57 int dp_power_clk_status(struct dp_power *dp_power, enum dp_pm_type pm_type); 58 59 /** 60 * dp_power_clk_enable() - enable display controller clocks 61 * 62 * @power: instance of power module 63 * @pm_type: type of pm, core/ctrl/phy 64 * @enable: enables or disables 65 * return: pointer to allocated power module data 66 * 67 * This API will call setrate and enable for DP clocks 68 */ 69 70 int dp_power_clk_enable(struct dp_power *power, enum dp_pm_type pm_type, 71 bool enable); 72 73 /** 74 * dp_power_client_init() - initialize clock and regulator modules 75 * 76 * @power: instance of power module 77 * return: 0 for success, error for failure. 78 * 79 * This API will configure the DisplayPort's clocks and regulator 80 * modules. 81 */ 82 int dp_power_client_init(struct dp_power *power); 83 84 /** 85 * dp_power_clinet_deinit() - de-initialize clock and regulator modules 86 * 87 * @power: instance of power module 88 * return: 0 for success, error for failure. 89 * 90 * This API will de-initialize the DisplayPort's clocks and regulator 91 * modueles. 92 */ 93 void dp_power_client_deinit(struct dp_power *power); 94 95 /** 96 * dp_power_get() - configure and get the DisplayPort power module data 97 * 98 * @parser: instance of parser module 99 * return: pointer to allocated power module data 100 * 101 * This API will configure the DisplayPort's power module and provides 102 * methods to be called by the client to configure the power related 103 * modueles. 104 */ 105 struct dp_power *dp_power_get(struct device *dev, struct dp_parser *parser); 106 107 #endif /* _DP_POWER_H_ */ 108