Commit 5d6d185f authored by Dmytro Laktyushkin's avatar Dmytro Laktyushkin Committed by Alex Deucher

drm/amd/display: restyle display clock calls part 2

Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 1a687574
...@@ -1223,12 +1223,13 @@ static enum dc_status enable_link_dp(struct pipe_ctx *pipe_ctx) ...@@ -1223,12 +1223,13 @@ static enum dc_status enable_link_dp(struct pipe_ctx *pipe_ctx)
if (link_settings.link_rate == max_link_rate) { if (link_settings.link_rate == max_link_rate) {
cur_min_clock_state = CLOCKS_STATE_INVALID; cur_min_clock_state = CLOCKS_STATE_INVALID;
if (dal_display_clock_get_min_clocks_state( if (pipe_ctx->dis_clk->funcs->get_min_clocks_state) {
pipe_ctx->dis_clk, &cur_min_clock_state)) { cur_min_clock_state =
pipe_ctx->dis_clk->funcs->get_min_clocks_state(
pipe_ctx->dis_clk);
if (cur_min_clock_state < CLOCKS_STATE_NOMINAL) if (cur_min_clock_state < CLOCKS_STATE_NOMINAL)
dal_display_clock_set_min_clocks_state( pipe_ctx->dis_clk->funcs->set_min_clocks_state(
pipe_ctx->dis_clk, pipe_ctx->dis_clk, CLOCKS_STATE_NOMINAL);
CLOCKS_STATE_NOMINAL);
} else { } else {
} }
} }
......
...@@ -717,7 +717,9 @@ static void destruct(struct dce110_resource_pool *pool) ...@@ -717,7 +717,9 @@ static void destruct(struct dce110_resource_pool *pool)
} }
if (pool->base.display_clock != NULL) if (pool->base.display_clock != NULL)
dal_display_clock_destroy(&pool->base.display_clock); pool->base.display_clock->funcs->destroy(
&pool->base.display_clock);
pool->base.display_clock = NULL;
if (pool->base.irqs != NULL) if (pool->base.irqs != NULL)
dal_irq_service_destroy(&pool->base.irqs); dal_irq_service_destroy(&pool->base.irqs);
......
...@@ -1099,9 +1099,11 @@ static void apply_min_clocks( ...@@ -1099,9 +1099,11 @@ static void apply_min_clocks(
if (!pre_mode_set) { if (!pre_mode_set) {
/* set clock_state without verification */ /* set clock_state without verification */
if (dal_display_clock_set_min_clocks_state( if (pipe_ctx->dis_clk->funcs->set_min_clocks_state) {
pipe_ctx->dis_clk, *clocks_state)) pipe_ctx->dis_clk->funcs->set_min_clocks_state(
pipe_ctx->dis_clk, *clocks_state);
return; return;
}
/* TODOFPGA */ /* TODOFPGA */
} }
...@@ -1114,9 +1116,10 @@ static void apply_min_clocks( ...@@ -1114,9 +1116,10 @@ static void apply_min_clocks(
req_clocks.pixel_clk_khz = get_max_pixel_clock_for_all_paths( req_clocks.pixel_clk_khz = get_max_pixel_clock_for_all_paths(
dc, context, true); dc, context, true);
if (dal_display_clock_get_required_clocks_state( if (pipe_ctx->dis_clk->funcs->get_required_clocks_state) {
pipe_ctx->dis_clk, &req_clocks, clocks_state)) { *clocks_state = pipe_ctx->dis_clk->funcs->get_required_clocks_state(
dal_display_clock_set_min_clocks_state( pipe_ctx->dis_clk, &req_clocks);
pipe_ctx->dis_clk->funcs->set_min_clocks_state(
pipe_ctx->dis_clk, *clocks_state); pipe_ctx->dis_clk, *clocks_state);
} else { } else {
} }
......
...@@ -700,7 +700,9 @@ static void destruct(struct dce110_resource_pool *pool) ...@@ -700,7 +700,9 @@ static void destruct(struct dce110_resource_pool *pool)
} }
if (pool->base.display_clock != NULL) { if (pool->base.display_clock != NULL) {
dal_display_clock_destroy(&pool->base.display_clock); pool->base.display_clock->funcs->destroy(
&pool->base.display_clock);
pool->base.display_clock = NULL;
} }
if (pool->base.irqs != NULL) { if (pool->base.irqs != NULL) {
......
...@@ -734,7 +734,9 @@ static void destruct(struct dce110_resource_pool *pool) ...@@ -734,7 +734,9 @@ static void destruct(struct dce110_resource_pool *pool)
} }
if (pool->base.display_clock != NULL) { if (pool->base.display_clock != NULL) {
dal_display_clock_destroy(&pool->base.display_clock); pool->base.display_clock->funcs->destroy(
&pool->base.display_clock);
pool->base.display_clock = NULL;
} }
if (pool->base.irqs != NULL) { if (pool->base.irqs != NULL) {
......
...@@ -657,7 +657,9 @@ static void destruct(struct dce110_resource_pool *pool) ...@@ -657,7 +657,9 @@ static void destruct(struct dce110_resource_pool *pool)
} }
if (pool->base.display_clock != NULL) { if (pool->base.display_clock != NULL) {
dal_display_clock_destroy(&pool->base.display_clock); pool->base.display_clock->funcs->destroy(
&pool->base.display_clock);
pool->base.display_clock = NULL;
} }
if (pool->base.irqs != NULL) { if (pool->base.irqs != NULL) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
# It provides the control and status of HW adapter resources, # It provides the control and status of HW adapter resources,
# that are global for the ASIC and sharable between pipes. # that are global for the ASIC and sharable between pipes.
GPU = display_clock.o divider_range.o GPU = divider_range.o
AMD_DAL_GPU = $(addprefix $(AMDDALPATH)/dc/gpu/,$(GPU)) AMD_DAL_GPU = $(addprefix $(AMDDALPATH)/dc/gpu/,$(GPU))
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef __DAL_DISPLAY_CLOCK_DCE110_H__ #ifndef __DAL_DISPLAY_CLOCK_DCE110_H__
#define __DAL_DISPLAY_CLOCK_DCE110_H__ #define __DAL_DISPLAY_CLOCK_DCE110_H__
#include "gpu/display_clock.h" #include "display_clock_interface.h"
struct display_clock_dce110 { struct display_clock_dce110 {
struct display_clock disp_clk_base; struct display_clock disp_clk_base;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef __DAL_DISPLAY_CLOCK_DCE112_H__ #ifndef __DAL_DISPLAY_CLOCK_DCE112_H__
#define __DAL_DISPLAY_CLOCK_DCE112_H__ #define __DAL_DISPLAY_CLOCK_DCE112_H__
#include "gpu/display_clock.h" #include "display_clock_interface.h"
struct display_clock_dce112 { struct display_clock_dce112 {
struct display_clock disp_clk_base; struct display_clock disp_clk_base;
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#ifndef __DAL_DISPLAY_CLOCK_DCE80_H__ #ifndef __DAL_DISPLAY_CLOCK_DCE80_H__
#define __DAL_DISPLAY_CLOCK_DCE80_H__ #define __DAL_DISPLAY_CLOCK_DCE80_H__
#include "gpu/display_clock.h" #include "display_clock_interface.h"
struct display_clock_dce80 { struct display_clock_dce80 {
struct display_clock disp_clk; struct display_clock disp_clk;
......
/*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#include "dm_services.h"
#include "display_clock.h"
void dal_display_clock_destroy(struct display_clock **disp_clk)
{
if (!disp_clk || !*disp_clk) {
BREAK_TO_DEBUGGER();
return;
}
(*disp_clk)->funcs->destroy(disp_clk);
*disp_clk = NULL;
}
bool dal_display_clock_get_min_clocks_state(
struct display_clock *disp_clk,
enum clocks_state *clocks_state)
{
if (!disp_clk->funcs->get_min_clocks_state)
return false;
*clocks_state = disp_clk->funcs->get_min_clocks_state(disp_clk);
return true;
}
bool dal_display_clock_get_required_clocks_state(
struct display_clock *disp_clk,
struct state_dependent_clocks *req_clocks,
enum clocks_state *clocks_state)
{
if (!disp_clk->funcs->get_required_clocks_state)
return false;
*clocks_state = disp_clk->funcs->get_required_clocks_state(
disp_clk, req_clocks);
return true;
}
bool dal_display_clock_set_min_clocks_state(
struct display_clock *disp_clk,
enum clocks_state clocks_state)
{
if (!disp_clk->funcs->set_min_clocks_state)
return false;
disp_clk->funcs->set_min_clocks_state(disp_clk, clocks_state);
return true;
}
/*
* Copyright 2012-15 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef __DAL_DISPLAY_CLOCK_H__
#define __DAL_DISPLAY_CLOCK_H__
#include "include/display_clock_interface.h"
#endif /* __DAL_DISPLAY_CLOCK_H__*/
...@@ -93,15 +93,4 @@ struct display_clock *dal_display_clock_dce80_create( ...@@ -93,15 +93,4 @@ struct display_clock *dal_display_clock_dce80_create(
void dal_display_clock_destroy(struct display_clock **to_destroy); void dal_display_clock_destroy(struct display_clock **to_destroy);
bool dal_display_clock_get_min_clocks_state(
struct display_clock *disp_clk,
enum clocks_state *clocks_state);
bool dal_display_clock_get_required_clocks_state(
struct display_clock *disp_clk,
struct state_dependent_clocks *req_clocks,
enum clocks_state *clocks_state);
bool dal_display_clock_set_min_clocks_state(
struct display_clock *disp_clk,
enum clocks_state clocks_state);
#endif /* __DISPLAY_CLOCK_INTERFACE_H__ */ #endif /* __DISPLAY_CLOCK_INTERFACE_H__ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment