xref: /linux/drivers/gpu/drm/amd/display/dc/dio/dcn10/dcn10_dio.c (revision d4a292c5f8e65d2784b703c67179f4f7d0c7846c)
1 // SPDX-License-Identifier: MIT
2 //
3 // Copyright 2025 Advanced Micro Devices, Inc.
4 
5 #include "dc_hw_types.h"
6 #include "dm_services.h"
7 #include "reg_helper.h"
8 #include "dcn10_dio.h"
9 
10 #define CTX \
11 	dio10->base.ctx
12 #define REG(reg)\
13 	dio10->regs->reg
14 
15 #undef FN
16 #define FN(reg_name, field_name) \
17 	dio10->shifts->field_name, dio10->masks->field_name
18 
dcn10_dio_mem_pwr_ctrl(struct dio * dio,bool enable_i2c_light_sleep)19 static void dcn10_dio_mem_pwr_ctrl(struct dio *dio, bool enable_i2c_light_sleep)
20 {
21 	struct dcn10_dio *dio10 = TO_DCN10_DIO(dio);
22 
23 	/* power AFMT HDMI memory */
24 	REG_WRITE(DIO_MEM_PWR_CTRL, 0);
25 
26 	if (enable_i2c_light_sleep)
27 		REG_UPDATE(DIO_MEM_PWR_CTRL, I2C_LIGHT_SLEEP_FORCE, 1);
28 }
29 
30 static const struct dio_funcs dcn10_dio_funcs = {
31 	.mem_pwr_ctrl = dcn10_dio_mem_pwr_ctrl,
32 };
33 
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)34 void dcn10_dio_construct(
35 	struct dcn10_dio *dio10,
36 	struct dc_context *ctx,
37 	const struct dcn_dio_registers *regs,
38 	const struct dcn_dio_shift *shifts,
39 	const struct dcn_dio_mask *masks)
40 {
41 	dio10->base.ctx = ctx;
42 	dio10->base.funcs = &dcn10_dio_funcs;
43 
44 	dio10->regs = regs;
45 	dio10->shifts = shifts;
46 	dio10->masks = masks;
47 }
48