Commit bbf854dc authored by David Francis's avatar David Francis Committed by Alex Deucher
Browse files

drm/amd/display: Load DMCU IRAM



DMCU IRAM must be loaded by the driver before DMCU
can function.

Move the IRAM code out of the shadows and into a new file
modules/power/power_helpers.c

The IRAM table contains the backlight curve and ABM parameters

Add this new file to the Makefiles

Call dmcu_load_iram in late init of DM

Move struct dmcu_version from dc.h to dmcu.h to allow
dmcu to be included on its own

Signed-off-by: default avatarDavid Francis <David.Francis@amd.com>
Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 51f1f6f5
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -32,11 +32,12 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/inc
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/freesync
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/color
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/info_packet
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/power

#TODO: remove when Timing Sync feature is complete
subdir-ccflags-y += -DBUILD_FEATURE_TIMING_SYNC=0

DAL_LIBS = amdgpu_dm dc	modules/freesync modules/color modules/info_packet
DAL_LIBS = amdgpu_dm dc	modules/freesync modules/color modules/info_packet modules/power

AMD_DAL = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/,$(DAL_LIBS)))

+21 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@
#endif

#include "modules/inc/mod_freesync.h"
#include "modules/power/power_helpers.h"

#define FIRMWARE_RAVEN_DMCU		"amdgpu/raven_dmcu.bin"
MODULE_FIRMWARE(FIRMWARE_RAVEN_DMCU);
@@ -642,6 +643,26 @@ static int dm_late_init(void *handle)
{
	struct amdgpu_device *adev = (struct amdgpu_device *)handle;

	struct dmcu_iram_parameters params;
	unsigned int linear_lut[16];
	int i;
	struct dmcu *dmcu = adev->dm.dc->res_pool->dmcu;
	bool ret;

	for (i = 0; i < 16; i++)
		linear_lut[i] = 0xFFFF * i / 15;

	params.set = 0;
	params.backlight_ramping_start = 0xCCCC;
	params.backlight_ramping_reduction = 0xCCCCCCCC;
	params.backlight_lut_array_size = 16;
	params.backlight_lut_array = linear_lut;

	ret = dmcu_load_iram(dmcu, params);

	if (!ret)
		return -EINVAL;

	return detect_mst_link_for_all_connectors(adev->ddev);
}

+1 −7
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@

#include "inc/hw_sequencer.h"
#include "inc/compressor.h"
#include "inc/hw/dmcu.h"
#include "dml/display_mode_lib.h"

#define DC_VER "3.2.06"
@@ -47,13 +48,6 @@
/*******************************************************************************
 * Display Core Interfaces
 ******************************************************************************/
struct dmcu_version {
	unsigned int date;
	unsigned int month;
	unsigned int year;
	unsigned int interface_version;
};

struct dc_versions {
	const char *dc_ver;
	struct dmcu_version dmcu_version;
+7 −0
Original line number Diff line number Diff line
@@ -32,6 +32,13 @@ enum dmcu_state {
	DMCU_RUNNING = 1
};

struct dmcu_version {
	unsigned int date;
	unsigned int month;
	unsigned int year;
	unsigned int interface_version;
};

struct dmcu {
	struct dc_context *ctx;
	const struct dmcu_funcs *funcs;
+31 −0
Original line number Diff line number Diff line
#
# Copyright 2017 Advanced Micro Devices, Inc.
#
# 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.
#
#
# Makefile for the 'power' sub-module of DAL.
#

MOD_POWER = power_helpers.o

AMD_DAL_MOD_POWER = $(addprefix $(AMDDALPATH)/modules/power/,$(MOD_POWER))
#$(info ************  DAL POWER MODULE MAKEFILE ************)

AMD_DISPLAY_FILES += $(AMD_DAL_MOD_POWER)
 No newline at end of file
Loading