[PATCH 18/76] drm/amd/dal: Use future proof reg access for HPD and DDC

Harry Wentland harry.wentland at amd.com
Mon Nov 21 23:00:38 UTC 2016


Signed-off-by: Harry Wentland <harry.wentland at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 drivers/gpu/drm/amd/dal/dc/gpio/dce110/hw_factory_dce110.c | 14 ++++++++++----
 drivers/gpu/drm/amd/dal/dc/gpio/dce80/hw_factory_dce80.c   |  3 +++
 drivers/gpu/drm/amd/dal/dc/gpio/ddc_regs.h                 |  8 ++++----
 drivers/gpu/drm/amd/dal/dc/gpio/hpd_regs.h                 |  6 +++---
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/gpio/dce110/hw_factory_dce110.c b/drivers/gpu/drm/amd/dal/dc/gpio/dce110/hw_factory_dce110.c
index 3ab6010f4641..20d81bca119c 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpio/dce110/hw_factory_dce110.c
+++ b/drivers/gpu/drm/amd/dal/dc/gpio/dce110/hw_factory_dce110.c
@@ -27,10 +27,6 @@
 #include "include/gpio_types.h"
 #include "../hw_factory.h"
 
-#include "../hw_gpio.h"
-#include "../hw_ddc.h"
-#include "../hw_hpd.h"
-
 #include "hw_factory_dce110.h"
 
 #include "dce/dce_11_0_d.h"
@@ -40,6 +36,16 @@
 #define SF_HPD(reg_name, field_name, post_fix)\
 	.field_name = reg_name ## __ ## field_name ## post_fix
 
+#define REG(reg_name)\
+		mm ## reg_name
+
+#define REGI(reg_name, block, id)\
+	mm ## block ## id ## _ ## reg_name
+
+#include "../hw_gpio.h"
+#include "../hw_ddc.h"
+#include "../hw_hpd.h"
+
 #include "reg_helper.h"
 #include "../hpd_regs.h"
 
diff --git a/drivers/gpu/drm/amd/dal/dc/gpio/dce80/hw_factory_dce80.c b/drivers/gpu/drm/amd/dal/dc/gpio/dce80/hw_factory_dce80.c
index 7065ba078ec7..48b67866377e 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpio/dce80/hw_factory_dce80.c
+++ b/drivers/gpu/drm/amd/dal/dc/gpio/dce80/hw_factory_dce80.c
@@ -36,6 +36,9 @@
 #include "dce/dce_8_0_d.h"
 #include "dce/dce_8_0_sh_mask.h"
 
+#define REG(reg_name)\
+		mm ## reg_name
+
 #include "reg_helper.h"
 #include "../hpd_regs.h"
 
diff --git a/drivers/gpu/drm/amd/dal/dc/gpio/ddc_regs.h b/drivers/gpu/drm/amd/dal/dc/gpio/ddc_regs.h
index a3cd1c1f6daf..ddd0de0950a6 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpio/ddc_regs.h
+++ b/drivers/gpu/drm/amd/dal/dc/gpio/ddc_regs.h
@@ -32,7 +32,7 @@
 /*** following in header */
 
 #define DDC_GPIO_REG_LIST_ENTRY(type,cd,id) \
-	.type ## _reg =   mmDC_GPIO_DDC ## id ## _ ## type,\
+	.type ## _reg =   REG(DC_GPIO_DDC ## id ## _ ## type),\
 	.type ## _mask =  DC_GPIO_DDC ## id ## _ ## type ## __DC_GPIO_DDC ## id ## cd ## _ ## type ## _MASK,\
 	.type ## _shift = DC_GPIO_DDC ## id ## _ ## type ## __DC_GPIO_DDC ## id ## cd ## _ ## type ## __SHIFT
 
@@ -46,10 +46,10 @@
 
 #define DDC_REG_LIST(cd,id) \
 	DDC_GPIO_REG_LIST(cd,id),\
-	.ddc_setup = mmDC_I2C_DDC ## id ## _SETUP
+	.ddc_setup = REG(DC_I2C_DDC ## id ## _SETUP)
 
 #define DDC_GPIO_VGA_REG_LIST_ENTRY(type,cd)\
-	.type ## _reg =   mmDC_GPIO_DDCVGA_ ## type,\
+	.type ## _reg =   REG(DC_GPIO_DDCVGA_ ## type),\
 	.type ## _mask =  DC_GPIO_DDCVGA_ ## type ## __DC_GPIO_DDCVGA ## cd ## _ ## type ## _MASK,\
 	.type ## _shift = DC_GPIO_DDCVGA_ ## type ## __DC_GPIO_DDCVGA ## cd ## _ ## type ## __SHIFT
 
@@ -66,7 +66,7 @@
 	.ddc_setup = mmDC_I2C_DDCVGA_SETUP
 
 #define DDC_GPIO_I2C_REG_LIST_ENTRY(type,cd) \
-	.type ## _reg =   mmDC_GPIO_I2CPAD_ ## type,\
+	.type ## _reg =   REG(DC_GPIO_I2CPAD_ ## type),\
 	.type ## _mask =  DC_GPIO_I2CPAD_ ## type ## __DC_GPIO_ ## cd ## _ ## type ## _MASK,\
 	.type ## _shift = DC_GPIO_I2CPAD_ ## type ## __DC_GPIO_ ## cd ## _ ## type ## __SHIFT
 
diff --git a/drivers/gpu/drm/amd/dal/dc/gpio/hpd_regs.h b/drivers/gpu/drm/amd/dal/dc/gpio/hpd_regs.h
index b5f9ed4cdf2e..f5cbe9ad00e6 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpio/hpd_regs.h
+++ b/drivers/gpu/drm/amd/dal/dc/gpio/hpd_regs.h
@@ -37,7 +37,7 @@
 
 
 #define HPD_GPIO_REG_LIST_ENTRY(type,cd,id) \
-	.type ## _reg =   mmDC_GPIO_HPD_## type,\
+	.type ## _reg =  REG(DC_GPIO_HPD_## type),\
 	.type ## _mask =  DC_GPIO_HPD_ ## type ## __DC_GPIO_HPD ## id ## _ ## type ## _MASK,\
 	.type ## _shift = DC_GPIO_HPD_ ## type ## __DC_GPIO_HPD ## id ## _ ## type ## __SHIFT
 
@@ -51,8 +51,8 @@
 
 #define HPD_REG_LIST(id) \
 	HPD_GPIO_REG_LIST(ONE_MORE_ ## id), \
-	.int_status = mmHPD ## id ## _DC_HPD_INT_STATUS,\
-	.toggle_filt_cntl = mmHPD ## id ## _DC_HPD_TOGGLE_FILT_CNTL
+	.int_status = REGI(DC_HPD_INT_STATUS, HPD, id),\
+	.toggle_filt_cntl = REGI(DC_HPD_TOGGLE_FILT_CNTL, HPD, id)
 
  #define HPD_MASK_SH_LIST(mask_sh) \
 		SF_HPD(DC_HPD_INT_STATUS, DC_HPD_SENSE_DELAYED, mask_sh),\
-- 
2.10.1



More information about the amd-gfx mailing list