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