summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_dio.c
blob: edcf4e67483bb96cea19f0dde71a5c3f471a9ea2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// SPDX-License-Identifier: MIT
//
// Copyright 2025 Advanced Micro Devices, Inc.

#include "dc_hw_types.h"
#include "dm_services.h"
#include "reg_helper.h"
#include "dcn10_dio.h"

#define CTX \
	dio10->base.ctx
#define REG(reg)\
	dio10->regs->reg

#undef FN
#define FN(reg_name, field_name) \
	dio10->shifts->field_name, dio10->masks->field_name

static void dcn10_dio_mem_pwr_ctrl(struct dio *dio, bool enable_i2c_light_sleep)
{
	struct dcn10_dio *dio10 = TO_DCN10_DIO(dio);

	/* power AFMT HDMI memory */
	REG_WRITE(DIO_MEM_PWR_CTRL, 0);

	if (enable_i2c_light_sleep)
		REG_UPDATE(DIO_MEM_PWR_CTRL, I2C_LIGHT_SLEEP_FORCE, 1);
}

static const struct dio_funcs dcn10_dio_funcs = {
	.mem_pwr_ctrl = dcn10_dio_mem_pwr_ctrl,
};

void dcn10_dio_construct(
	struct dcn10_dio *dio10,
	struct dc_context *ctx,
	const struct dcn_dio_registers *regs,
	const struct dcn_dio_shift *shifts,
	const struct dcn_dio_mask *masks)
{
	dio10->base.ctx = ctx;
	dio10->base.funcs = &dcn10_dio_funcs;

	dio10->regs = regs;
	dio10->shifts = shifts;
	dio10->masks = masks;
}