From 17345dc54501820d82995be29b161a8f69564129 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 11 Apr 2016 17:37:17 +1000 Subject: [PATCH 1015/1110] drm/amd/dal: avoid extra interfaces for scratch_critical_state. This is just an example of an over abstracted interface. Signed-off-by: Dave Airlie Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c | 26 ---------------------- .../gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h | 6 +++++ .../dal/dc/bios/dce110/bios_parser_helper_dce110.c | 6 ++--- drivers/gpu/drm/amd/dal/dc/dc_bios_types.h | 2 -- .../drm/amd/dal/dc/dce110/dce110_hw_sequencer.c | 17 +++++++------- 5 files changed, 16 insertions(+), 41 deletions(-) create mode 100644 drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h diff --git a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c index ddb5fc8..fe3cc60 100644 --- a/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c +++ b/drivers/gpu/drm/amd/dal/dc/bios/bios_parser.c @@ -4139,32 +4139,6 @@ bool dc_bios_is_accelerated_mode(struct dc_bios *dcb) #endif } -/** - * bios_parser_set_scratch_critical_state - * - * @brief - * update critical state bit in VBIOS scratch register - * - * @param - * bool - to set or reset state - */ -void dc_bios_set_scratch_critical_state( - struct dc_bios *dcb, - bool state) -{ - struct bios_parser *bp = BP_FROM_DCB(dcb); - -#ifdef CONFIG_DRM_AMD_DAL_VBIOS_PRESENT - bp->bios_helper->set_scratch_critical_state( - bp->ctx, state); -#else - dal_logger_write(bp->ctx->logger, - LOG_MAJOR_BIOS, - LOG_MINOR_BIOS_CMD_TABLE, - "%s: VBIOS is not supported", __func__); -#endif -} - void dc_bios_set_scratch_acc_mode_change(struct dc_bios *dcb) { struct bios_parser *bp = BP_FROM_DCB(dcb); diff --git a/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h new file mode 100644 index 0000000..a994d81 --- /dev/null +++ b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_dce110.h @@ -0,0 +1,6 @@ +#ifndef BIOS_DCE110_H +#define BIOS_DCE110_H +void dce110_set_scratch_critical_state(struct dc_context *ctx, + bool state); + +#endif diff --git a/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c index 924957e..442e2a3 100644 --- a/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c +++ b/drivers/gpu/drm/amd/dal/dc/bios/dce110/bios_parser_helper_dce110.c @@ -312,9 +312,8 @@ static enum signal_type detect_sink( return SIGNAL_TYPE_NONE; } -static void set_scratch_critical_state( - struct dc_context *ctx, - bool state) +void dce110_set_scratch_critical_state(struct dc_context *ctx, + bool state) { uint32_t addr = mmBIOS_SCRATCH_6; uint32_t value = dm_read_reg(ctx, addr); @@ -372,7 +371,6 @@ static const struct bios_parser_helper bios_parser_helper_funcs = { prepare_scratch_active_and_requested, .set_scratch_acc_mode_change = set_scratch_acc_mode_change, .set_scratch_active_and_requested = set_scratch_active_and_requested, - .set_scratch_critical_state = set_scratch_critical_state, .set_scratch_lcd_scale = set_scratch_lcd_scale, .take_backlight_control = NULL, .update_requested_backlight_level = NULL, diff --git a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h index 458dcac..7e37a72 100644 --- a/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h +++ b/drivers/gpu/drm/amd/dal/dc/dc_bios_types.h @@ -152,8 +152,6 @@ void dc_bios_prepare_scratch_active_and_requested(struct dc_bios *bios, enum signal_type signal, const struct connector_device_tag_info *device_tag); void dc_bios_set_scratch_active_and_requested(struct dc_bios *bios); -void dc_bios_set_scratch_critical_state(struct dc_bios *bios, - bool state); void dc_bios_set_scratch_acc_mode_change(struct dc_bios *bios); /* COMMANDS */ diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c index 73c576e..fbb9f63 100644 --- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_hw_sequencer.c @@ -34,6 +34,7 @@ #include "gpu/dce110/dc_clock_gating_dce110.h" +#include "bios/dce110/bios_dce110.h" #include "timing_generator.h" #include "mem_input.h" #include "opp.h" @@ -514,12 +515,12 @@ static void program_fmt( return; } -static void update_bios_scratch_critical_state(struct adapter_service *as, - bool state) +static void update_bios_scratch_critical_state(struct core_dc *dc, + bool state) { - struct dc_bios *dcb = dal_adapter_service_get_bios_parser(as); - - dc_bios_set_scratch_critical_state(dcb, state); +#ifdef CONFIG_DRM_AMD_DAL_VBIOS_PRESENT + dce110_set_scratch_critical_state(dc->ctx, state); +#endif } static void update_info_frame(struct pipe_ctx *pipe_ctx) @@ -1206,8 +1207,7 @@ static enum dc_status apply_ctx_to_hw( return DC_OK; /* Apply new context */ - update_bios_scratch_critical_state(context->res_ctx.pool.adapter_srv, - true); + update_bios_scratch_critical_state(dc, true); for (i = 0; i < MAX_PIPES; i++) { struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i]; @@ -1275,8 +1275,7 @@ static enum dc_status apply_ctx_to_hw( dc->hwss.set_displaymarks(dc, context); - update_bios_scratch_critical_state(context->res_ctx.pool.adapter_srv, - false); + update_bios_scratch_critical_state(dc, false); switch_dp_clock_sources(dc, &context->res_ctx); -- 2.7.4