Back to home page

OSCL-LXR

 
 

    


0001 /*
0002 * Copyright 2018 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  * Authors: AMD
0023  *
0024  */
0025 #include "dm_services.h"
0026 #include "dcn20/dcn20_hubbub.h"
0027 #include "dcn201_hubbub.h"
0028 #include "reg_helper.h"
0029 
0030 #define REG(reg)\
0031     hubbub1->regs->reg
0032 
0033 #define DC_LOGGER \
0034     hubbub1->base.ctx->logger
0035 
0036 #define CTX \
0037     hubbub1->base.ctx
0038 
0039 #undef FN
0040 #define FN(reg_name, field_name) \
0041     hubbub1->shifts->field_name, hubbub1->masks->field_name
0042 
0043 #define REG(reg)\
0044     hubbub1->regs->reg
0045 
0046 #define CTX \
0047     hubbub1->base.ctx
0048 
0049 #undef FN
0050 #define FN(reg_name, field_name) \
0051     hubbub1->shifts->field_name, hubbub1->masks->field_name
0052 
0053 static bool hubbub201_program_watermarks(
0054         struct hubbub *hubbub,
0055         struct dcn_watermark_set *watermarks,
0056         unsigned int refclk_mhz,
0057         bool safe_to_lower)
0058 {
0059     struct dcn20_hubbub *hubbub1 = TO_DCN20_HUBBUB(hubbub);
0060     bool wm_pending = false;
0061 
0062     if (hubbub1_program_urgent_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower))
0063         wm_pending = true;
0064 
0065     if (hubbub1_program_pstate_watermarks(hubbub, watermarks, refclk_mhz, safe_to_lower))
0066         wm_pending = true;
0067 
0068     REG_SET(DCHUBBUB_ARB_SAT_LEVEL, 0,
0069             DCHUBBUB_ARB_SAT_LEVEL, 60 * refclk_mhz);
0070     REG_UPDATE(DCHUBBUB_ARB_DF_REQ_OUTSTAND,
0071             DCHUBBUB_ARB_MIN_REQ_OUTSTAND, 68);
0072 
0073     hubbub1_allow_self_refresh_control(hubbub, !hubbub->ctx->dc->debug.disable_stutter);
0074 
0075     return wm_pending;
0076 }
0077 
0078 static const struct hubbub_funcs hubbub201_funcs = {
0079     .update_dchub = hubbub2_update_dchub,
0080     .init_dchub_sys_ctx = NULL,
0081     .init_vm_ctx = NULL,
0082     .dcc_support_swizzle = hubbub2_dcc_support_swizzle,
0083     .dcc_support_pixel_format = hubbub2_dcc_support_pixel_format,
0084     .get_dcc_compression_cap = hubbub2_get_dcc_compression_cap,
0085     .wm_read_state = hubbub2_wm_read_state,
0086     .get_dchub_ref_freq = hubbub2_get_dchub_ref_freq,
0087     .program_watermarks = hubbub201_program_watermarks,
0088     .hubbub_read_state = hubbub2_read_state,
0089 };
0090 
0091 void hubbub201_construct(struct dcn20_hubbub *hubbub,
0092     struct dc_context *ctx,
0093     const struct dcn_hubbub_registers *hubbub_regs,
0094     const struct dcn_hubbub_shift *hubbub_shift,
0095     const struct dcn_hubbub_mask *hubbub_mask)
0096 {
0097     hubbub->base.ctx = ctx;
0098 
0099     hubbub->base.funcs = &hubbub201_funcs;
0100 
0101     hubbub->regs = hubbub_regs;
0102     hubbub->shifts = hubbub_shift;
0103     hubbub->masks = hubbub_mask;
0104 
0105     hubbub->debug_test_index_pstate = 0xB;
0106     hubbub->detile_buf_size = 164 * 1024;
0107 }