Skip to content

Commit 7322aed

Browse files
committed
drm/i915: convert _MMIO_PIPE3()/_MMIO_PORT3() to accept base
Most users of _MMIO_PIPE3() and _MMIO_PORT3() need to add the MMIO base to the registers. Convert the macros to _MMIO_BASE_PIPE3() and _MMIO_BASE_PORT3() to move the base addition until after the register selection. If the register address depends on DISPLAY_MMIO_BASE(), this removes the need to figure the base out for each register, and it only needs to be added once. Reviewed-by: Rodrigo Vivi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/4b95f125f5021abc00b5fc661b2728f1b583c01e.1713890614.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <[email protected]>
1 parent 6068bc2 commit 7322aed

File tree

2 files changed

+44
-40
lines changed

2 files changed

+44
-40
lines changed

drivers/gpu/drm/i915/display/intel_display_reg_defs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
#define _MMIO_PLL(pll, a, b) _MMIO(_PLL(pll, a, b))
3030
#define _MMIO_PHY(phy, a, b) _MMIO(_PHY(phy, a, b))
3131

32-
#define _MMIO_PIPE3(pipe, a, b, c) _MMIO(_PICK_EVEN_2RANGES(pipe, 1, a, a, b, c))
33-
#define _MMIO_PORT3(pipe, a, b, c) _MMIO(_PICK_EVEN_2RANGES(pipe, 1, a, a, b, c))
32+
#define _MMIO_BASE_PIPE3(base, pipe, a, b, c) _MMIO((base) + _PICK_EVEN_2RANGES(pipe, 1, a, a, b, c))
33+
#define _MMIO_BASE_PORT3(base, pipe, a, b, c) _MMIO((base) + _PICK_EVEN_2RANGES(pipe, 1, a, a, b, c))
3434

3535
/*
3636
* Device info offset array based helpers for groups of registers with unevenly

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 42 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -973,13 +973,13 @@
973973
#define VLV_AUD_CHICKEN_BIT_REG _MMIO(VLV_DISPLAY_BASE + 0x62F38)
974974
#define VLV_CHICKEN_BIT_DBG_ENABLE (1 << 0)
975975

976-
#define _VLV_AUD_PORT_EN_B_DBG (VLV_DISPLAY_BASE + 0x62F20)
977-
#define _VLV_AUD_PORT_EN_C_DBG (VLV_DISPLAY_BASE + 0x62F30)
978-
#define _VLV_AUD_PORT_EN_D_DBG (VLV_DISPLAY_BASE + 0x62F34)
979-
#define VLV_AUD_PORT_EN_DBG(port) _MMIO_PORT3((port) - PORT_B, \
980-
_VLV_AUD_PORT_EN_B_DBG, \
981-
_VLV_AUD_PORT_EN_C_DBG, \
982-
_VLV_AUD_PORT_EN_D_DBG)
976+
#define _VLV_AUD_PORT_EN_B_DBG 0x62F20
977+
#define _VLV_AUD_PORT_EN_C_DBG 0x62F30
978+
#define _VLV_AUD_PORT_EN_D_DBG 0x62F34
979+
#define VLV_AUD_PORT_EN_DBG(port) _MMIO_BASE_PORT3(VLV_DISPLAY_BASE, (port) - PORT_B, \
980+
_VLV_AUD_PORT_EN_B_DBG, \
981+
_VLV_AUD_PORT_EN_C_DBG, \
982+
_VLV_AUD_PORT_EN_D_DBG)
983983
#define VLV_AMP_MUTE (1 << 1)
984984

985985
#define GEN6_BSD_RNCID _MMIO(0x12198)
@@ -1147,10 +1147,11 @@
11471147
/*
11481148
* Clock control & power management
11491149
*/
1150-
#define _DPLL_A (DISPLAY_MMIO_BASE(dev_priv) + 0x6014)
1151-
#define _DPLL_B (DISPLAY_MMIO_BASE(dev_priv) + 0x6018)
1152-
#define _CHV_DPLL_C (DISPLAY_MMIO_BASE(dev_priv) + 0x6030)
1153-
#define DPLL(pipe) _MMIO_PIPE3((pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
1150+
#define _DPLL_A 0x6014
1151+
#define _DPLL_B 0x6018
1152+
#define _CHV_DPLL_C 0x6030
1153+
#define DPLL(pipe) _MMIO_BASE_PIPE3(DISPLAY_MMIO_BASE(dev_priv), \
1154+
(pipe), _DPLL_A, _DPLL_B, _CHV_DPLL_C)
11541155

11551156
#define VGA0 _MMIO(0x6000)
11561157
#define VGA1 _MMIO(0x6004)
@@ -1246,10 +1247,11 @@
12461247
#define SDVO_MULTIPLIER_SHIFT_HIRES 4
12471248
#define SDVO_MULTIPLIER_SHIFT_VGA 0
12481249

1249-
#define _DPLL_A_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x601c)
1250-
#define _DPLL_B_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x6020)
1251-
#define _CHV_DPLL_C_MD (DISPLAY_MMIO_BASE(dev_priv) + 0x603c)
1252-
#define DPLL_MD(pipe) _MMIO_PIPE3((pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
1250+
#define _DPLL_A_MD 0x601c
1251+
#define _DPLL_B_MD 0x6020
1252+
#define _CHV_DPLL_C_MD 0x603c
1253+
#define DPLL_MD(pipe) _MMIO_BASE_PIPE3(DISPLAY_MMIO_BASE(dev_priv), \
1254+
(pipe), _DPLL_A_MD, _DPLL_B_MD, _CHV_DPLL_C_MD)
12531255

12541256
/*
12551257
* UDI pixel divider, controlling how many pixels are stuffed into a packet.
@@ -2718,8 +2720,8 @@
27182720
#define _WM0_PIPEA_ILK 0x45100
27192721
#define _WM0_PIPEB_ILK 0x45104
27202722
#define _WM0_PIPEC_IVB 0x45200
2721-
#define WM0_PIPE_ILK(pipe) _MMIO_PIPE3((pipe), _WM0_PIPEA_ILK, \
2722-
_WM0_PIPEB_ILK, _WM0_PIPEC_IVB)
2723+
#define WM0_PIPE_ILK(pipe) _MMIO_BASE_PIPE3(0, (pipe), _WM0_PIPEA_ILK, \
2724+
_WM0_PIPEB_ILK, _WM0_PIPEC_IVB)
27232725
#define WM0_PIPE_PRIMARY_MASK REG_GENMASK(31, 16)
27242726
#define WM0_PIPE_SPRITE_MASK REG_GENMASK(15, 8)
27252727
#define WM0_PIPE_CURSOR_MASK REG_GENMASK(7, 0)
@@ -4767,27 +4769,29 @@
47674769
#define TVIDEO_DIP_GCP(pipe) _MMIO_PIPE(pipe, _VIDEO_DIP_GCP_A, _VIDEO_DIP_GCP_B)
47684770

47694771
/* Per-transcoder DIP controls (VLV) */
4770-
#define _VLV_VIDEO_DIP_CTL_A (VLV_DISPLAY_BASE + 0x60200)
4771-
#define _VLV_VIDEO_DIP_DATA_A (VLV_DISPLAY_BASE + 0x60208)
4772-
#define _VLV_VIDEO_DIP_GDCP_PAYLOAD_A (VLV_DISPLAY_BASE + 0x60210)
4773-
4774-
#define _VLV_VIDEO_DIP_CTL_B (VLV_DISPLAY_BASE + 0x61170)
4775-
#define _VLV_VIDEO_DIP_DATA_B (VLV_DISPLAY_BASE + 0x61174)
4776-
#define _VLV_VIDEO_DIP_GDCP_PAYLOAD_B (VLV_DISPLAY_BASE + 0x61178)
4777-
4778-
#define _CHV_VIDEO_DIP_CTL_C (VLV_DISPLAY_BASE + 0x611f0)
4779-
#define _CHV_VIDEO_DIP_DATA_C (VLV_DISPLAY_BASE + 0x611f4)
4780-
#define _CHV_VIDEO_DIP_GDCP_PAYLOAD_C (VLV_DISPLAY_BASE + 0x611f8)
4781-
4782-
#define VLV_TVIDEO_DIP_CTL(pipe) \
4783-
_MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_CTL_A, \
4784-
_VLV_VIDEO_DIP_CTL_B, _CHV_VIDEO_DIP_CTL_C)
4785-
#define VLV_TVIDEO_DIP_DATA(pipe) \
4786-
_MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_DATA_A, \
4787-
_VLV_VIDEO_DIP_DATA_B, _CHV_VIDEO_DIP_DATA_C)
4788-
#define VLV_TVIDEO_DIP_GCP(pipe) \
4789-
_MMIO_PIPE3((pipe), _VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \
4790-
_VLV_VIDEO_DIP_GDCP_PAYLOAD_B, _CHV_VIDEO_DIP_GDCP_PAYLOAD_C)
4772+
#define _VLV_VIDEO_DIP_CTL_A 0x60200
4773+
#define _VLV_VIDEO_DIP_CTL_B 0x61170
4774+
#define _CHV_VIDEO_DIP_CTL_C 0x611f0
4775+
#define VLV_TVIDEO_DIP_CTL(pipe) _MMIO_BASE_PIPE3(VLV_DISPLAY_BASE, (pipe), \
4776+
_VLV_VIDEO_DIP_CTL_A, \
4777+
_VLV_VIDEO_DIP_CTL_B, \
4778+
_CHV_VIDEO_DIP_CTL_C)
4779+
4780+
#define _VLV_VIDEO_DIP_DATA_A 0x60208
4781+
#define _VLV_VIDEO_DIP_DATA_B 0x61174
4782+
#define _CHV_VIDEO_DIP_DATA_C 0x611f4
4783+
#define VLV_TVIDEO_DIP_DATA(pipe) _MMIO_BASE_PIPE3(VLV_DISPLAY_BASE, (pipe), \
4784+
_VLV_VIDEO_DIP_DATA_A, \
4785+
_VLV_VIDEO_DIP_DATA_B, \
4786+
_CHV_VIDEO_DIP_DATA_C)
4787+
4788+
#define _VLV_VIDEO_DIP_GDCP_PAYLOAD_A 0x60210
4789+
#define _VLV_VIDEO_DIP_GDCP_PAYLOAD_B 0x61178
4790+
#define _CHV_VIDEO_DIP_GDCP_PAYLOAD_C 0x611f8
4791+
#define VLV_TVIDEO_DIP_GCP(pipe) _MMIO_BASE_PIPE3(VLV_DISPLAY_BASE, (pipe), \
4792+
_VLV_VIDEO_DIP_GDCP_PAYLOAD_A, \
4793+
_VLV_VIDEO_DIP_GDCP_PAYLOAD_B, \
4794+
_CHV_VIDEO_DIP_GDCP_PAYLOAD_C)
47914795

47924796
/* Haswell DIP controls */
47934797

0 commit comments

Comments
 (0)