Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Apr 14-17, 2025
Register
Loading...
Note: File does not exist in v4.6.
  1/*
  2* Copyright 2018 Advanced Micro Devices, Inc.
  3 *
  4 * Permission is hereby granted, free of charge, to any person obtaining a
  5 * copy of this software and associated documentation files (the "Software"),
  6 * to deal in the Software without restriction, including without limitation
  7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8 * and/or sell copies of the Software, and to permit persons to whom the
  9 * Software is furnished to do so, subject to the following conditions:
 10 *
 11 * The above copyright notice and this permission notice shall be included in
 12 * all copies or substantial portions of the Software.
 13 *
 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 20 * OTHER DEALINGS IN THE SOFTWARE.
 21 *
 22 * Authors: AMD
 23 *
 24 */
 25#include "dm_services.h"
 26#include "dcn20/dcn20_hubbub.h"
 27#include "dcn201_hubbub.h"
 28#include "reg_helper.h"
 29
 30#define REG(reg)\
 31	hubbub1->regs->reg
 32
 33#define DC_LOGGER \
 34	hubbub1->base.ctx->logger
 35
 36#define CTX \
 37	hubbub1->base.ctx
 38
 39#undef FN
 40#define FN(reg_name, field_name) \
 41	hubbub1->shifts->field_name, hubbub1->masks->field_name
 42
 43#define REG(reg)\
 44	hubbub1->regs->reg
 45
 46#define CTX \
 47	hubbub1->base.ctx
 48
 49#undef FN
 50#define FN(reg_name, field_name) \
 51	hubbub1->shifts->field_name, hubbub1->masks->field_name
 52
 53static bool hubbub201_program_watermarks(
 54		struct hubbub *hubbub,
 55		struct dcn_watermark_set *watermarks,
 56		unsigned int refclk_mhz,
 57		bool safe_to_lower)
 58{
 59	struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub);
 60	bool wm_pending = false;
 61
 62	if (hubbub1_program_urgent_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower))
 63		wm_pending = true;
 64
 65	if (hubbub1_program_pstate_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower))
 66		wm_pending = true;
 67
 68	REG_SET(DCHUBBUB_ARB_SAT_LEVEL, 0,
 69			DCHUBBUB_ARB_SAT_LEVEL, 60 * refclk_mhz);
 70	REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND,
 71			DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 68);
 72
 73	hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
 74
 75	return wm_pending;
 76}
 77
 78static const struct hubbub_funcs hubbub201_funcs = {
 79	.update_dchub = hubbub2_update_dchub,
 80	.init_dchub_sys_ctx = NULL,
 81	.init_vm_ctx = NULL,
 82	.dcc_support_swizzle = hubbub2_dcc_support_swizzle,
 83	.dcc_support_pixel_format = hubbub2_dcc_support_pixel_format,
 84	.get_dcc_compression_cap = hubbub2_get_dcc_compression_cap,
 85	.wm_read_state = hubbub2_wm_read_state,
 86	.get_dchub_ref_freq = hubbub2_get_dchub_ref_freq,
 87	.program_watermarks = hubbub201_program_watermarks,
 88	.hubbub_read_state = hubbub2_read_state,
 89};
 90
 91void hubbub201_construct(struct dcn20_hubbub *hubbub,
 92	struct dc_context *ctx,
 93	const struct dcn_hubbub_registers *hubbub_regs,
 94	const struct dcn_hubbub_shift *hubbub_shift,
 95	const struct dcn_hubbub_mask *hubbub_mask)
 96{
 97	hubbub->base.ctx = ctx;
 98
 99	hubbub->base.funcs = &hubbub201_funcs;
100
101	hubbub->regs = hubbub_regs;
102	hubbub->shifts = hubbub_shift;
103	hubbub->masks = hubbub_mask;
104
105	hubbub->debug_test_index_pstate = 0xB;
106	hubbub->detile_buf_size = 164 * 1024;
107}