linux/drivers/gpu/drm/amd/display/dc/resource/dcn21/dcn21_resource.c

/*
* Copyright 2018 Advanced Micro Devices, Inc.
 * Copyright 2019 Raptor Engineering, LLC
 *
 * 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 <linux/slab.h>

#include "dm_services.h"
#include "dc.h"

#include "dcn21/dcn21_init.h"

#include "resource.h"
#include "include/irq_service_interface.h"
#include "dcn20/dcn20_resource.h"
#include "dcn21/dcn21_resource.h"

#include "dml/dcn20/dcn20_fpu.h"

#include "clk_mgr.h"
#include "dcn10/dcn10_hubp.h"
#include "dcn10/dcn10_ipp.h"
#include "dcn20/dcn20_hubbub.h"
#include "dcn20/dcn20_mpc.h"
#include "dcn20/dcn20_hubp.h"
#include "dcn21/dcn21_hubp.h"
#include "irq/dcn21/irq_service_dcn21.h"
#include "dcn20/dcn20_dpp.h"
#include "dcn20/dcn20_optc.h"
#include "dcn21/dcn21_hwseq.h"
#include "dce110/dce110_hwseq.h"
#include "dcn20/dcn20_opp.h"
#include "dcn20/dcn20_dsc.h"
#include "dcn21/dcn21_link_encoder.h"
#include "dcn20/dcn20_stream_encoder.h"
#include "dce/dce_clock_source.h"
#include "dce/dce_audio.h"
#include "dce/dce_hwseq.h"
#include "virtual/virtual_stream_encoder.h"
#include "dml/display_mode_vba.h"
#include "dcn20/dcn20_dccg.h"
#include "dcn21/dcn21_dccg.h"
#include "dcn21/dcn21_hubbub.h"
#include "dcn10/dcn10_resource.h"
#include "dce/dce_panel_cntl.h"

#include "dcn20/dcn20_dwb.h"
#include "dcn20/dcn20_mmhubbub.h"
#include "dpcs/dpcs_2_1_0_offset.h"
#include "dpcs/dpcs_2_1_0_sh_mask.h"

#include "renoir_ip_offset.h"
#include "dcn/dcn_2_1_0_offset.h"
#include "dcn/dcn_2_1_0_sh_mask.h"

#include "nbio/nbio_7_0_offset.h"

#include "mmhub/mmhub_2_0_0_offset.h"
#include "mmhub/mmhub_2_0_0_sh_mask.h"

#include "reg_helper.h"
#include "dce/dce_abm.h"
#include "dce/dce_dmcu.h"
#include "dce/dce_aux.h"
#include "dce/dce_i2c.h"
#include "dcn21_resource.h"
#include "vm_helper.h"
#include "dcn20/dcn20_vmid.h"
#include "dce/dmub_psr.h"
#include "dce/dmub_abm.h"

/* begin *********************
 * macros to expend register list macro defined in HW object header file */

/* DCN */
#define BASE_INNER(seg)

#define BASE(seg)

#define SR(reg_name)

#define SRI(reg_name, block, id)

#define SRIR(var_name, reg_name, block, id)

#define SRII(reg_name, block, id)

#define DCCG_SRII(reg_name, block, id)

#define VUPDATE_SRII(reg_name, block, id)

/* NBIO */
#define NBIO_BASE_INNER(seg)

#define NBIO_BASE(seg)

#define NBIO_SR(reg_name)

/* MMHUB */
#define MMHUB_BASE_INNER(seg)

#define MMHUB_BASE(seg)

#define MMHUB_SR(reg_name)

#define clk_src_regs(index, pllid)

static const struct dce110_clk_src_regs clk_src_regs[] =;

static const struct dce110_clk_src_shift cs_shift =;

static const struct dce110_clk_src_mask cs_mask =;

static const struct bios_registers bios_regs =;

static const struct dce_dmcu_registers dmcu_regs =;

static const struct dce_dmcu_shift dmcu_shift =;

static const struct dce_dmcu_mask dmcu_mask =;

static const struct dce_abm_registers abm_regs =;

static const struct dce_abm_shift abm_shift =;

static const struct dce_abm_mask abm_mask =;

#define audio_regs(id)

static const struct dce_audio_registers audio_regs[] =;

#define DCE120_AUD_COMMON_MASK_SH_LIST(mask_sh)

static const struct dce_audio_shift audio_shift =;

static const struct dce_audio_mask audio_mask =;

static const struct dccg_registers dccg_regs =;

static const struct dccg_shift dccg_shift =;

static const struct dccg_mask dccg_mask =;

#define opp_regs(id)

static const struct dcn20_opp_registers opp_regs[] =;

static const struct dcn20_opp_shift opp_shift =;

static const struct dcn20_opp_mask opp_mask =;

#define tg_regs(id)

static const struct dcn_optc_registers tg_regs[] =;

static const struct dcn_optc_shift tg_shift =;

static const struct dcn_optc_mask tg_mask =;

static const struct dcn20_mpc_registers mpc_regs =;

static const struct dcn20_mpc_shift mpc_shift =;

static const struct dcn20_mpc_mask mpc_mask =;

#define hubp_regs(id)

static const struct dcn_hubp2_registers hubp_regs[] =;

static const struct dcn_hubp2_shift hubp_shift =;

static const struct dcn_hubp2_mask hubp_mask =;

static const struct dcn_hubbub_registers hubbub_reg =;

static const struct dcn_hubbub_shift hubbub_shift =;

static const struct dcn_hubbub_mask hubbub_mask =;


#define vmid_regs(id)

static const struct dcn_vmid_registers vmid_regs[] =;

static const struct dcn20_vmid_shift vmid_shifts =;

static const struct dcn20_vmid_mask vmid_masks =;

#define dsc_regsDCN20(id)

static const struct dcn20_dsc_registers dsc_regs[] =;

static const struct dcn20_dsc_shift dsc_shift =;

static const struct dcn20_dsc_mask dsc_mask =;

#define ipp_regs(id)

static const struct dcn10_ipp_registers ipp_regs[] =;

static const struct dcn10_ipp_shift ipp_shift =;

static const struct dcn10_ipp_mask ipp_mask =;

#define opp_regs(id)


#define aux_engine_regs(id)

static const struct dce110_aux_registers aux_engine_regs[] =;

#define tf_regs(id)

static const struct dcn2_dpp_registers tf_regs[] =;

static const struct dcn2_dpp_shift tf_shift =;

static const struct dcn2_dpp_mask tf_mask =;

#define stream_enc_regs(id)

static const struct dcn10_stream_enc_registers stream_enc_regs[] =;

static const struct dce110_aux_registers_shift aux_shift =;

static const struct dce110_aux_registers_mask aux_mask =;

static const struct dcn10_stream_encoder_shift se_shift =;

static const struct dcn10_stream_encoder_mask se_mask =;

static void dcn21_pp_smu_destroy(struct pp_smu_funcs **pp_smu);

static struct input_pixel_processor *dcn21_ipp_create(
	struct dc_context *ctx, uint32_t inst)
{}

static struct dpp *dcn21_dpp_create(
	struct dc_context *ctx,
	uint32_t inst)
{}

static struct dce_aux *dcn21_aux_engine_create(
	struct dc_context *ctx,
	uint32_t inst)
{}

#define i2c_inst_regs(id)

static const struct dce_i2c_registers i2c_hw_regs[] =;

static const struct dce_i2c_shift i2c_shifts =;

static const struct dce_i2c_mask i2c_masks =;

static struct dce_i2c_hw *dcn21_i2c_hw_create(struct dc_context *ctx,
					      uint32_t inst)
{}

static const struct resource_caps res_cap_rn =;

static const struct dc_plane_cap plane_cap =;

static const struct dc_debug_options debug_defaults_drv =;

static const struct dc_panel_config panel_config_defaults =;

enum dcn20_clk_src_array_id {};

static void dcn21_resource_destruct(struct dcn21_resource_pool *pool)
{}

bool dcn21_fast_validate_bw(struct dc *dc,
			    struct dc_state *context,
			    display_e2e_pipe_params_st *pipes,
			    int *pipe_cnt_out,
			    int *pipe_split_from,
			    int *vlevel_out,
			    bool fast_validate)
{}

/*
 * Some of the functions further below use the FPU, so we need to wrap this
 * with DC_FP_START()/DC_FP_END(). Use the same approach as for
 * dcn20_validate_bandwidth in dcn20_resource.c.
 */
static bool dcn21_validate_bandwidth(struct dc *dc, struct dc_state *context,
		bool fast_validate)
{}

static void dcn21_destroy_resource_pool(struct resource_pool **pool)
{}

static struct clock_source *dcn21_clock_source_create(
		struct dc_context *ctx,
		struct dc_bios *bios,
		enum clock_source_id id,
		const struct dce110_clk_src_regs *regs,
		bool dp_clk_src)
{}

static struct hubp *dcn21_hubp_create(
	struct dc_context *ctx,
	uint32_t inst)
{}

static struct hubbub *dcn21_hubbub_create(struct dc_context *ctx)
{}

static struct output_pixel_processor *dcn21_opp_create(struct dc_context *ctx,
						       uint32_t inst)
{}

static struct timing_generator *dcn21_timing_generator_create(struct dc_context *ctx,
							      uint32_t instance)
{}

static struct mpc *dcn21_mpc_create(struct dc_context *ctx)
{}

static void read_dce_straps(
	struct dc_context *ctx,
	struct resource_straps *straps)
{}


static struct display_stream_compressor *dcn21_dsc_create(struct dc_context *ctx,
							  uint32_t inst)
{}

static struct pp_smu_funcs *dcn21_pp_smu_create(struct dc_context *ctx)
{}

static void dcn21_pp_smu_destroy(struct pp_smu_funcs **pp_smu)
{}

static struct audio *dcn21_create_audio(
		struct dc_context *ctx, unsigned int inst)
{}

static struct dc_cap_funcs cap_funcs =;

static struct stream_encoder *dcn21_stream_encoder_create(enum engine_id eng_id,
							  struct dc_context *ctx)
{}

static const struct dce_hwseq_registers hwseq_reg =;

static const struct dce_hwseq_shift hwseq_shift =;

static const struct dce_hwseq_mask hwseq_mask =;

static struct dce_hwseq *dcn21_hwseq_create(
	struct dc_context *ctx)
{}

static const struct resource_create_funcs res_create_funcs =;

static const struct encoder_feature_support link_enc_feature =;


#define link_regs(id, phyid)

static const struct dcn10_link_enc_registers link_enc_regs[] =;

static const struct dce_panel_cntl_registers panel_cntl_regs[] =;

static const struct dce_panel_cntl_shift panel_cntl_shift =;

static const struct dce_panel_cntl_mask panel_cntl_mask =;

#define aux_regs(id)

static const struct dcn10_link_enc_aux_registers link_enc_aux_regs[] =;

#define hpd_regs(id)

static const struct dcn10_link_enc_hpd_registers link_enc_hpd_regs[] =;

static const struct dcn10_link_enc_shift le_shift =;

static const struct dcn10_link_enc_mask le_mask =;

static int map_transmitter_id_to_phy_instance(
	enum transmitter transmitter)
{}

static struct link_encoder *dcn21_link_encoder_create(
	struct dc_context *ctx,
	const struct encoder_init_data *enc_init_data)
{}

static struct panel_cntl *dcn21_panel_cntl_create(const struct panel_cntl_init_data *init_data)
{}

static void dcn21_get_panel_config_defaults(struct dc_panel_config *panel_config)
{}

#define CTX

#define REG(reg_name)

static uint32_t read_pipe_fuses(struct dc_context *ctx)
{}

static enum dc_status dcn21_patch_unknown_plane_state(struct dc_plane_state *plane_state)
{}

static const struct resource_funcs dcn21_res_pool_funcs =;

static bool dcn21_resource_construct(
	uint8_t num_virtual_links,
	struct dc *dc,
	struct dcn21_resource_pool *pool)
{}

struct resource_pool *dcn21_create_resource_pool(
		const struct dc_init_data *init_data,
		struct dc *dc)
{}