Commit 240e6d25 authored by Isabella Basso's avatar Isabella Basso Committed by Alex Deucher
Browse files

drm/amd/display: fix function scopes



This turns previously global functions into static, thus removing
compile-time warnings such as:

 warning: no previous prototype for 'get_highest_allowed_voltage_level'
 [-Wmissing-prototypes]
 742 | unsigned int get_highest_allowed_voltage_level(uint32_t chip_family, uint32_t hw_internal_rev, uint32_t pci_revision_id)
     |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 warning: no previous prototype for 'rv1_vbios_smu_send_msg_with_param'
 [-Wmissing-prototypes]
 102 | int rv1_vbios_smu_send_msg_with_param(struct clk_mgr_internal *clk_mgr, unsigned int msg_id, unsigned int param)
     |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Changes since v1:
- As suggested by Rodrigo Siqueira:
  1. Rewrite function signatures to make them more readable.
  2. Get rid of unused functions in order to remove 'defined but not
     used' warnings.

Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: default avatarIsabella Basso <isabbasso@riseup.net>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 33c3365e
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -632,7 +632,8 @@ static void dm_dcn_vertical_interrupt0_high_irq(void *interrupt_params)
 * Copies dmub notification to DM which is to be read by AUX command.
 * issuing thread and also signals the event to wake up the thread.
 */
void dmub_aux_setconfig_callback(struct amdgpu_device *adev, struct dmub_notification *notify)
static void dmub_aux_setconfig_callback(struct amdgpu_device *adev,
					struct dmub_notification *notify)
{
	if (adev->dm.dmub_notify)
		memcpy(adev->dm.dmub_notify, notify, sizeof(struct dmub_notification));
@@ -648,7 +649,8 @@ void dmub_aux_setconfig_callback(struct amdgpu_device *adev, struct dmub_notific
 * Dmub Hpd interrupt processing callback. Gets displayindex through the
 * ink index and calls helper to do the processing.
 */
void dmub_hpd_callback(struct amdgpu_device *adev, struct dmub_notification *notify)
static void dmub_hpd_callback(struct amdgpu_device *adev,
			      struct dmub_notification *notify)
{
	struct amdgpu_dm_connector *aconnector;
	struct amdgpu_dm_connector *hpd_aconnector = NULL;
@@ -705,8 +707,10 @@ void dmub_hpd_callback(struct amdgpu_device *adev, struct dmub_notification *not
 * to dmub interrupt handling thread
 * Return: true if successfully registered, false if there is existing registration
 */
bool register_dmub_notify_callback(struct amdgpu_device *adev, enum dmub_notification_type type,
dmub_notify_interrupt_callback_t callback, bool dmub_int_thread_offload)
static bool register_dmub_notify_callback(struct amdgpu_device *adev,
					  enum dmub_notification_type type,
					  dmub_notify_interrupt_callback_t callback,
					  bool dmub_int_thread_offload)
{
	if (callback != NULL && type < ARRAY_SIZE(adev->dm.dmub_thread_offload)) {
		adev->dm.dmub_callback[type] = callback;
@@ -11621,8 +11625,10 @@ uint32_t dm_read_reg_func(const struct dc_context *ctx, uint32_t address,
	return value;
}

int amdgpu_dm_set_dmub_async_sync_status(bool is_cmd_aux, struct dc_context *ctx,
	uint8_t status_type, uint32_t *operation_result)
static int amdgpu_dm_set_dmub_async_sync_status(bool is_cmd_aux,
						struct dc_context *ctx,
						uint8_t status_type,
						uint32_t *operation_result)
{
	struct amdgpu_device *adev = ctx->driver_context;
	int return_status = -1;
+3 −1
Original line number Diff line number Diff line
@@ -739,7 +739,9 @@ static void hack_bounding_box(struct dcn_bw_internal_vars *v,
		hack_force_pipe_split(v, context->streams[0]->timing.pix_clk_100hz);
}

unsigned int get_highest_allowed_voltage_level(uint32_t chip_family, uint32_t hw_internal_rev, uint32_t pci_revision_id)
static unsigned int get_highest_allowed_voltage_level(uint32_t chip_family,
						      uint32_t hw_internal_rev,
						      uint32_t pci_revision_id)
{
	/* for low power RV2 variants, the highest voltage level we want is 0 */
	if ((chip_family == FAMILY_RV) &&
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
#include "rv1_clk_mgr_vbios_smu.h"
#include "rv1_clk_mgr_clk.h"

void rv1_init_clocks(struct clk_mgr *clk_mgr)
static void rv1_init_clocks(struct clk_mgr *clk_mgr)
{
	memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks));
}
+1 −1
Original line number Diff line number Diff line
@@ -409,7 +409,7 @@ void dcn2_init_clocks(struct clk_mgr *clk_mgr)
	clk_mgr->clks.prev_p_state_change_support = true;
}

void dcn2_enable_pme_wa(struct clk_mgr *clk_mgr_base)
static void dcn2_enable_pme_wa(struct clk_mgr *clk_mgr_base)
{
	struct clk_mgr_internal *clk_mgr = TO_CLK_MGR_INTERNAL(clk_mgr_base);
	struct pp_smu_funcs_nv *pp_smu = NULL;
+0 −36
Original line number Diff line number Diff line
@@ -74,42 +74,6 @@ static const struct clk_mgr_mask clk_mgr_mask = {
	CLK_COMMON_MASK_SH_LIST_DCN201_BASE(_MASK)
};

void dcn201_update_clocks_vbios(struct clk_mgr *clk_mgr,
			struct dc_state *context,
			bool safe_to_lower)
{
	struct dc_clocks *new_clocks = &context->bw_ctx.bw.dcn.clk;

	bool update_dppclk = false;
	bool update_dispclk = false;

	if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->clks.dppclk_khz)) {
		clk_mgr->clks.dppclk_khz = new_clocks->dppclk_khz;
		update_dppclk = true;
	}

	if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr->clks.dispclk_khz)) {
		clk_mgr->clks.dispclk_khz = new_clocks->dispclk_khz;
		update_dispclk = true;
	}

	if (update_dppclk || update_dispclk) {
		struct bp_set_dce_clock_parameters dce_clk_params;
		struct dc_bios *bp = clk_mgr->ctx->dc_bios;

		if (update_dispclk) {
			memset(&dce_clk_params, 0, sizeof(dce_clk_params));
			dce_clk_params.target_clock_frequency = new_clocks->dispclk_khz;
			dce_clk_params.pll_id = CLOCK_SOURCE_ID_DFS;
			dce_clk_params.clock_type = DCECLOCK_TYPE_DISPLAY_CLOCK;
			bp->funcs->set_dce_clock(bp, &dce_clk_params);
		}
		/* currently there is no DCECLOCK_TYPE_DPPCLK type defined in VBIOS interface.
		 * vbios program DPPCLK to the same DispCLK limitation
		 */
	}
}

static void dcn201_init_clocks(struct clk_mgr *clk_mgr)
{
	memset(&(clk_mgr->clks), 0, sizeof(struct dc_clocks));
Loading