18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#ifndef _DP_POWER_H_
78c2ecf20Sopenharmony_ci#define _DP_POWER_H_
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include "dp_parser.h"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci/**
128c2ecf20Sopenharmony_ci * sruct dp_power - DisplayPort's power related data
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * @init: initializes the regulators/core clocks/GPIOs/pinctrl
158c2ecf20Sopenharmony_ci * @deinit: turns off the regulators/core clocks/GPIOs/pinctrl
168c2ecf20Sopenharmony_ci * @clk_enable: enable/disable the DP clocks
178c2ecf20Sopenharmony_ci * @set_pixel_clk_parent: set the parent of DP pixel clock
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_cistruct dp_power {
208c2ecf20Sopenharmony_ci	bool core_clks_on;
218c2ecf20Sopenharmony_ci	bool link_clks_on;
228c2ecf20Sopenharmony_ci	bool stream_clks_on;
238c2ecf20Sopenharmony_ci};
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci/**
268c2ecf20Sopenharmony_ci * dp_power_init() - enable power supplies for display controller
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci * @power: instance of power module
298c2ecf20Sopenharmony_ci * @flip: bool for flipping gpio direction
308c2ecf20Sopenharmony_ci * return: 0 if success or error if failure.
318c2ecf20Sopenharmony_ci *
328c2ecf20Sopenharmony_ci * This API will turn on the regulators and configures gpio's
338c2ecf20Sopenharmony_ci * aux/hpd.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_ciint dp_power_init(struct dp_power *power, bool flip);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci/**
388c2ecf20Sopenharmony_ci * dp_power_deinit() - turn off regulators and gpios.
398c2ecf20Sopenharmony_ci *
408c2ecf20Sopenharmony_ci * @power: instance of power module
418c2ecf20Sopenharmony_ci * return: 0 for success
428c2ecf20Sopenharmony_ci *
438c2ecf20Sopenharmony_ci * This API turns off power and regulators.
448c2ecf20Sopenharmony_ci */
458c2ecf20Sopenharmony_ciint dp_power_deinit(struct dp_power *power);
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/**
488c2ecf20Sopenharmony_ci * dp_power_clk_status() - display controller clocks status
498c2ecf20Sopenharmony_ci *
508c2ecf20Sopenharmony_ci * @power: instance of power module
518c2ecf20Sopenharmony_ci * @pm_type: type of pm, core/ctrl/phy
528c2ecf20Sopenharmony_ci * return: status of power clocks
538c2ecf20Sopenharmony_ci *
548c2ecf20Sopenharmony_ci * This API return status of DP clocks
558c2ecf20Sopenharmony_ci */
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ciint dp_power_clk_status(struct dp_power *dp_power, enum dp_pm_type pm_type);
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/**
608c2ecf20Sopenharmony_ci * dp_power_clk_enable() - enable display controller clocks
618c2ecf20Sopenharmony_ci *
628c2ecf20Sopenharmony_ci * @power: instance of power module
638c2ecf20Sopenharmony_ci * @pm_type: type of pm, core/ctrl/phy
648c2ecf20Sopenharmony_ci * @enable: enables or disables
658c2ecf20Sopenharmony_ci * return: pointer to allocated power module data
668c2ecf20Sopenharmony_ci *
678c2ecf20Sopenharmony_ci * This API will call setrate and enable for DP clocks
688c2ecf20Sopenharmony_ci */
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ciint dp_power_clk_enable(struct dp_power *power, enum dp_pm_type pm_type,
718c2ecf20Sopenharmony_ci				bool enable);
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci/**
748c2ecf20Sopenharmony_ci * dp_power_client_init() - initialize clock and regulator modules
758c2ecf20Sopenharmony_ci *
768c2ecf20Sopenharmony_ci * @power: instance of power module
778c2ecf20Sopenharmony_ci * return: 0 for success, error for failure.
788c2ecf20Sopenharmony_ci *
798c2ecf20Sopenharmony_ci * This API will configure the DisplayPort's clocks and regulator
808c2ecf20Sopenharmony_ci * modules.
818c2ecf20Sopenharmony_ci */
828c2ecf20Sopenharmony_ciint dp_power_client_init(struct dp_power *power);
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/**
858c2ecf20Sopenharmony_ci * dp_power_clinet_deinit() - de-initialize clock and regulator modules
868c2ecf20Sopenharmony_ci *
878c2ecf20Sopenharmony_ci * @power: instance of power module
888c2ecf20Sopenharmony_ci * return: 0 for success, error for failure.
898c2ecf20Sopenharmony_ci *
908c2ecf20Sopenharmony_ci * This API will de-initialize the DisplayPort's clocks and regulator
918c2ecf20Sopenharmony_ci * modueles.
928c2ecf20Sopenharmony_ci */
938c2ecf20Sopenharmony_civoid dp_power_client_deinit(struct dp_power *power);
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci/**
968c2ecf20Sopenharmony_ci * dp_power_get() - configure and get the DisplayPort power module data
978c2ecf20Sopenharmony_ci *
988c2ecf20Sopenharmony_ci * @parser: instance of parser module
998c2ecf20Sopenharmony_ci * return: pointer to allocated power module data
1008c2ecf20Sopenharmony_ci *
1018c2ecf20Sopenharmony_ci * This API will configure the DisplayPort's power module and provides
1028c2ecf20Sopenharmony_ci * methods to be called by the client to configure the power related
1038c2ecf20Sopenharmony_ci * modueles.
1048c2ecf20Sopenharmony_ci */
1058c2ecf20Sopenharmony_cistruct dp_power *dp_power_get(struct dp_parser *parser);
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ci#endif /* _DP_POWER_H_ */
108