Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/msm/dp: drop the msm_dp_catalog module

Now as the msm_dp_catalog module became nearly empty, drop it, accessing
registers directly from the corresponding submodules.

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Tested-by: Stephen Boyd <swboyd@chromium.org> # sc7180-trogdor
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/654332/
Link: https://lore.kernel.org/r/20250518-fd-dp-audio-fixup-v6-11-2f0ec3ec000d@oss.qualcomm.com

authored by

Dmitry Baryshkov and committed by
Dmitry Baryshkov
603fc0fc d11f5a7a

+434 -521
-1
drivers/gpu/drm/msm/Makefile
··· 135 135 dp/dp_debug.o 136 136 137 137 msm-display-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \ 138 - dp/dp_catalog.o \ 139 138 dp/dp_ctrl.o \ 140 139 dp/dp_display.o \ 141 140 dp/dp_drm.o \
+39 -31
drivers/gpu/drm/msm/dp/dp_audio.c
··· 11 11 #include <drm/display/drm_dp_helper.h> 12 12 #include <drm/drm_edid.h> 13 13 14 - #include "dp_catalog.h" 15 14 #include "dp_audio.h" 16 15 #include "dp_drm.h" 17 16 #include "dp_panel.h" ··· 21 22 struct msm_dp_audio_private { 22 23 struct platform_device *pdev; 23 24 struct drm_device *drm_dev; 24 - struct msm_dp_catalog *catalog; 25 + void __iomem *link_base; 25 26 26 27 u32 channels; 27 28 28 29 struct msm_dp_audio msm_dp_audio; 29 30 }; 30 31 32 + static inline u32 msm_dp_read_link(struct msm_dp_audio_private *audio, u32 offset) 33 + { 34 + return readl_relaxed(audio->link_base + offset); 35 + } 36 + 37 + static inline void msm_dp_write_link(struct msm_dp_audio_private *audio, 38 + u32 offset, u32 data) 39 + { 40 + /* 41 + * To make sure link reg writes happens before any other operation, 42 + * this function uses writel() instread of writel_relaxed() 43 + */ 44 + writel(data, audio->link_base + offset); 45 + } 46 + 31 47 static void msm_dp_audio_stream_sdp(struct msm_dp_audio_private *audio) 32 48 { 33 - struct msm_dp_catalog *catalog = audio->catalog; 34 49 struct dp_sdp_header sdp_hdr = { 35 50 .HB0 = 0x00, 36 51 .HB1 = 0x02, ··· 55 42 56 43 msm_dp_utils_pack_sdp_header(&sdp_hdr, header); 57 44 58 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_STREAM_0, header[0]); 59 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_STREAM_1, header[1]); 45 + msm_dp_write_link(audio, MMSS_DP_AUDIO_STREAM_0, header[0]); 46 + msm_dp_write_link(audio, MMSS_DP_AUDIO_STREAM_1, header[1]); 60 47 } 61 48 62 49 static void msm_dp_audio_timestamp_sdp(struct msm_dp_audio_private *audio) 63 50 { 64 - struct msm_dp_catalog *catalog = audio->catalog; 65 51 struct dp_sdp_header sdp_hdr = { 66 52 .HB0 = 0x00, 67 53 .HB1 = 0x01, ··· 71 59 72 60 msm_dp_utils_pack_sdp_header(&sdp_hdr, header); 73 61 74 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_TIMESTAMP_0, header[0]); 75 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_TIMESTAMP_1, header[1]); 62 + msm_dp_write_link(audio, MMSS_DP_AUDIO_TIMESTAMP_0, header[0]); 63 + msm_dp_write_link(audio, MMSS_DP_AUDIO_TIMESTAMP_1, header[1]); 76 64 } 77 65 78 66 static void msm_dp_audio_infoframe_sdp(struct msm_dp_audio_private *audio) 79 67 { 80 - struct msm_dp_catalog *catalog = audio->catalog; 81 68 struct dp_sdp_header sdp_hdr = { 82 69 .HB0 = 0x00, 83 70 .HB1 = 0x84, ··· 87 76 88 77 msm_dp_utils_pack_sdp_header(&sdp_hdr, header); 89 78 90 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_INFOFRAME_0, header[0]); 91 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_INFOFRAME_1, header[1]); 79 + msm_dp_write_link(audio, MMSS_DP_AUDIO_INFOFRAME_0, header[0]); 80 + msm_dp_write_link(audio, MMSS_DP_AUDIO_INFOFRAME_1, header[1]); 92 81 } 93 82 94 83 static void msm_dp_audio_copy_management_sdp(struct msm_dp_audio_private *audio) 95 84 { 96 - struct msm_dp_catalog *catalog = audio->catalog; 97 85 struct dp_sdp_header sdp_hdr = { 98 86 .HB0 = 0x00, 99 87 .HB1 = 0x05, ··· 103 93 104 94 msm_dp_utils_pack_sdp_header(&sdp_hdr, header); 105 95 106 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_COPYMANAGEMENT_0, header[0]); 107 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_COPYMANAGEMENT_1, header[1]); 96 + msm_dp_write_link(audio, MMSS_DP_AUDIO_COPYMANAGEMENT_0, header[0]); 97 + msm_dp_write_link(audio, MMSS_DP_AUDIO_COPYMANAGEMENT_1, header[1]); 108 98 } 109 99 110 100 static void msm_dp_audio_isrc_sdp(struct msm_dp_audio_private *audio) 111 101 { 112 - struct msm_dp_catalog *catalog = audio->catalog; 113 102 struct dp_sdp_header sdp_hdr = { 114 103 .HB0 = 0x00, 115 104 .HB1 = 0x06, ··· 119 110 u32 reg; 120 111 121 112 /* XXX: is it necessary to preserve this field? */ 122 - reg = msm_dp_read_link(catalog, MMSS_DP_AUDIO_ISRC_1); 113 + reg = msm_dp_read_link(audio, MMSS_DP_AUDIO_ISRC_1); 123 114 sdp_hdr.HB3 = FIELD_GET(HEADER_3_MASK, reg); 124 115 125 116 msm_dp_utils_pack_sdp_header(&sdp_hdr, header); 126 117 127 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_ISRC_0, header[0]); 128 - msm_dp_write_link(catalog, MMSS_DP_AUDIO_ISRC_1, header[1]); 118 + msm_dp_write_link(audio, MMSS_DP_AUDIO_ISRC_0, header[0]); 119 + msm_dp_write_link(audio, MMSS_DP_AUDIO_ISRC_1, header[1]); 129 120 } 130 121 131 122 static void msm_dp_audio_config_sdp(struct msm_dp_audio_private *audio) 132 123 { 133 - struct msm_dp_catalog *msm_dp_catalog = audio->catalog; 134 124 u32 sdp_cfg, sdp_cfg2; 135 125 136 - sdp_cfg = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG); 126 + sdp_cfg = msm_dp_read_link(audio, MMSS_DP_SDP_CFG); 137 127 /* AUDIO_TIMESTAMP_SDP_EN */ 138 128 sdp_cfg |= BIT(1); 139 129 /* AUDIO_STREAM_SDP_EN */ ··· 146 138 147 139 drm_dbg_dp(audio->drm_dev, "sdp_cfg = 0x%x\n", sdp_cfg); 148 140 149 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG, sdp_cfg); 141 + msm_dp_write_link(audio, MMSS_DP_SDP_CFG, sdp_cfg); 150 142 151 - sdp_cfg2 = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG2); 143 + sdp_cfg2 = msm_dp_read_link(audio, MMSS_DP_SDP_CFG2); 152 144 /* IFRM_REGSRC -> Do not use reg values */ 153 145 sdp_cfg2 &= ~BIT(0); 154 146 /* AUDIO_STREAM_HB3_REGSRC-> Do not use reg values */ ··· 156 148 157 149 drm_dbg_dp(audio->drm_dev, "sdp_cfg2 = 0x%x\n", sdp_cfg2); 158 150 159 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG2, sdp_cfg2); 151 + msm_dp_write_link(audio, MMSS_DP_SDP_CFG2, sdp_cfg2); 160 152 } 161 153 162 154 static void msm_dp_audio_setup_sdp(struct msm_dp_audio_private *audio) ··· 198 190 drm_dbg_dp(audio->drm_dev, "select: %#x, acr_ctrl: %#x\n", 199 191 select, acr_ctrl); 200 192 201 - msm_dp_write_link(audio->catalog, MMSS_DP_AUDIO_ACR_CTRL, acr_ctrl); 193 + msm_dp_write_link(audio, MMSS_DP_AUDIO_ACR_CTRL, acr_ctrl); 202 194 } 203 195 204 196 static void msm_dp_audio_safe_to_exit_level(struct msm_dp_audio_private *audio) ··· 223 215 break; 224 216 } 225 217 226 - mainlink_levels = msm_dp_read_link(audio->catalog, REG_DP_MAINLINK_LEVELS); 218 + mainlink_levels = msm_dp_read_link(audio, REG_DP_MAINLINK_LEVELS); 227 219 mainlink_levels &= 0xFE0; 228 220 mainlink_levels |= safe_to_exit_level; 229 221 ··· 231 223 "mainlink_level = 0x%x, safe_to_exit_level = 0x%x\n", 232 224 mainlink_levels, safe_to_exit_level); 233 225 234 - msm_dp_write_link(audio->catalog, REG_DP_MAINLINK_LEVELS, mainlink_levels); 226 + msm_dp_write_link(audio, REG_DP_MAINLINK_LEVELS, mainlink_levels); 235 227 } 236 228 237 229 static void msm_dp_audio_enable(struct msm_dp_audio_private *audio, bool enable) 238 230 { 239 231 u32 audio_ctrl; 240 232 241 - audio_ctrl = msm_dp_read_link(audio->catalog, MMSS_DP_AUDIO_CFG); 233 + audio_ctrl = msm_dp_read_link(audio, MMSS_DP_AUDIO_CFG); 242 234 243 235 if (enable) 244 236 audio_ctrl |= BIT(0); ··· 247 239 248 240 drm_dbg_dp(audio->drm_dev, "dp_audio_cfg = 0x%x\n", audio_ctrl); 249 241 250 - msm_dp_write_link(audio->catalog, MMSS_DP_AUDIO_CFG, audio_ctrl); 242 + msm_dp_write_link(audio, MMSS_DP_AUDIO_CFG, audio_ctrl); 251 243 /* make sure audio engine is disabled */ 252 244 wmb(); 253 245 } ··· 338 330 } 339 331 340 332 struct msm_dp_audio *msm_dp_audio_get(struct platform_device *pdev, 341 - struct msm_dp_catalog *catalog) 333 + void __iomem *link_base) 342 334 { 343 335 int rc = 0; 344 336 struct msm_dp_audio_private *audio; 345 337 struct msm_dp_audio *msm_dp_audio; 346 338 347 - if (!pdev || !catalog) { 339 + if (!pdev) { 348 340 DRM_ERROR("invalid input\n"); 349 341 rc = -EINVAL; 350 342 goto error; ··· 357 349 } 358 350 359 351 audio->pdev = pdev; 360 - audio->catalog = catalog; 352 + audio->link_base = link_base; 361 353 362 354 msm_dp_audio = &audio->msm_dp_audio; 363 355
+4 -3
drivers/gpu/drm/msm/dp/dp_audio.h
··· 8 8 9 9 #include <linux/platform_device.h> 10 10 11 - #include "dp_catalog.h" 12 11 #include <sound/hdmi-codec.h> 12 + 13 + struct drm_bridge; 13 14 14 15 /** 15 16 * struct msm_dp_audio ··· 28 27 * Creates and instance of dp audio. 29 28 * 30 29 * @pdev: caller's platform device instance. 31 - * @catalog: an instance of msm_dp_catalog module. 30 + * @link_base: pointer to the msm_dp_link resource. 32 31 * 33 32 * Returns the error code in case of failure, otherwize 34 33 * an instance of newly created msm_dp_module. 35 34 */ 36 35 struct msm_dp_audio *msm_dp_audio_get(struct platform_device *pdev, 37 - struct msm_dp_catalog *catalog); 36 + void __iomem *link_base); 38 37 39 38 /** 40 39 * msm_dp_audio_put()
+56 -57
drivers/gpu/drm/msm/dp/dp_aux.c
··· 23 23 24 24 struct msm_dp_aux_private { 25 25 struct device *dev; 26 - struct msm_dp_catalog *catalog; 26 + void __iomem *aux_base; 27 27 28 28 struct phy *phy; 29 29 ··· 46 46 struct drm_dp_aux msm_dp_aux; 47 47 }; 48 48 49 + static inline u32 msm_dp_read_aux(struct msm_dp_aux_private *aux, u32 offset) 50 + { 51 + return readl_relaxed(aux->aux_base + offset); 52 + } 53 + 54 + static inline void msm_dp_write_aux(struct msm_dp_aux_private *aux, 55 + u32 offset, u32 data) 56 + { 57 + /* 58 + * To make sure aux reg writes happens before any other operation, 59 + * this function uses writel() instread of writel_relaxed() 60 + */ 61 + writel(data, aux->aux_base + offset); 62 + } 63 + 49 64 static void msm_dp_aux_clear_hw_interrupts(struct msm_dp_aux_private *aux) 50 65 { 51 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 52 - 53 - msm_dp_read_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_STATUS); 54 - msm_dp_write_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x1f); 55 - msm_dp_write_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x9f); 56 - msm_dp_write_aux(msm_dp_catalog, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0); 66 + msm_dp_read_aux(aux, REG_DP_PHY_AUX_INTERRUPT_STATUS); 67 + msm_dp_write_aux(aux, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x1f); 68 + msm_dp_write_aux(aux, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0x9f); 69 + msm_dp_write_aux(aux, REG_DP_PHY_AUX_INTERRUPT_CLEAR, 0); 57 70 } 58 71 59 72 /* ··· 74 61 */ 75 62 static void msm_dp_aux_reset(struct msm_dp_aux_private *aux) 76 63 { 77 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 78 64 u32 aux_ctrl; 79 65 80 - aux_ctrl = msm_dp_read_aux(msm_dp_catalog, REG_DP_AUX_CTRL); 66 + aux_ctrl = msm_dp_read_aux(aux, REG_DP_AUX_CTRL); 81 67 82 68 aux_ctrl |= DP_AUX_CTRL_RESET; 83 - msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl); 69 + msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl); 84 70 usleep_range(1000, 1100); /* h/w recommended delay */ 85 71 86 72 aux_ctrl &= ~DP_AUX_CTRL_RESET; 87 - msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl); 73 + msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl); 88 74 } 89 75 90 76 static void msm_dp_aux_enable(struct msm_dp_aux_private *aux) 91 77 { 92 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 93 78 u32 aux_ctrl; 94 79 95 - aux_ctrl = msm_dp_read_aux(msm_dp_catalog, REG_DP_AUX_CTRL); 80 + aux_ctrl = msm_dp_read_aux(aux, REG_DP_AUX_CTRL); 96 81 97 - msm_dp_write_aux(msm_dp_catalog, REG_DP_TIMEOUT_COUNT, 0xffff); 98 - msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_LIMITS, 0xffff); 82 + msm_dp_write_aux(aux, REG_DP_TIMEOUT_COUNT, 0xffff); 83 + msm_dp_write_aux(aux, REG_DP_AUX_LIMITS, 0xffff); 99 84 100 85 aux_ctrl |= DP_AUX_CTRL_ENABLE; 101 - msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl); 86 + msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl); 102 87 } 103 88 104 89 static void msm_dp_aux_disable(struct msm_dp_aux_private *aux) 105 90 { 106 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 107 91 u32 aux_ctrl; 108 92 109 - aux_ctrl = msm_dp_read_aux(msm_dp_catalog, REG_DP_AUX_CTRL); 93 + aux_ctrl = msm_dp_read_aux(aux, REG_DP_AUX_CTRL); 110 94 aux_ctrl &= ~DP_AUX_CTRL_ENABLE; 111 - msm_dp_write_aux(msm_dp_catalog, REG_DP_AUX_CTRL, aux_ctrl); 95 + msm_dp_write_aux(aux, REG_DP_AUX_CTRL, aux_ctrl); 112 96 } 113 97 114 98 static int msm_dp_aux_wait_for_hpd_connect_state(struct msm_dp_aux_private *aux, 115 99 unsigned long wait_us) 116 100 { 117 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 118 101 u32 state; 119 102 120 103 /* poll for hpd connected status every 2ms and timeout after wait_us */ 121 - return readl_poll_timeout(msm_dp_catalog->aux_base + 104 + return readl_poll_timeout(aux->aux_base + 122 105 REG_DP_DP_HPD_INT_STATUS, 123 106 state, state & DP_DP_HPD_STATE_STATUS_CONNECTED, 124 107 min(wait_us, 2000), wait_us); ··· 163 154 /* index = 0, write */ 164 155 if (i == 0) 165 156 reg |= DP_AUX_DATA_INDEX_WRITE; 166 - msm_dp_write_aux(aux->catalog, REG_DP_AUX_DATA, reg); 157 + msm_dp_write_aux(aux, REG_DP_AUX_DATA, reg); 167 158 } 168 159 169 - msm_dp_write_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL, 0); 160 + msm_dp_write_aux(aux, REG_DP_AUX_TRANS_CTRL, 0); 170 161 msm_dp_aux_clear_hw_interrupts(aux); 171 162 172 163 reg = 0; /* Transaction number == 1 */ ··· 181 172 } 182 173 183 174 reg |= DP_AUX_TRANS_CTRL_GO; 184 - msm_dp_write_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL, reg); 175 + msm_dp_write_aux(aux, REG_DP_AUX_TRANS_CTRL, reg); 185 176 186 177 return len; 187 178 } ··· 214 205 u32 i, actual_i; 215 206 u32 len = msg->size; 216 207 217 - data = msm_dp_read_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL); 208 + data = msm_dp_read_aux(aux, REG_DP_AUX_TRANS_CTRL); 218 209 data &= ~DP_AUX_TRANS_CTRL_GO; 219 - msm_dp_write_aux(aux->catalog, REG_DP_AUX_TRANS_CTRL, data); 210 + msm_dp_write_aux(aux, REG_DP_AUX_TRANS_CTRL, data); 220 211 221 212 data = DP_AUX_DATA_INDEX_WRITE; /* INDEX_WRITE */ 222 213 data |= DP_AUX_DATA_READ; /* read */ 223 214 224 - msm_dp_write_aux(aux->catalog, REG_DP_AUX_DATA, data); 215 + msm_dp_write_aux(aux, REG_DP_AUX_DATA, data); 225 216 226 217 dp = msg->buffer; 227 218 228 219 /* discard first byte */ 229 - data = msm_dp_read_aux(aux->catalog, REG_DP_AUX_DATA); 220 + data = msm_dp_read_aux(aux, REG_DP_AUX_DATA); 230 221 231 222 for (i = 0; i < len; i++) { 232 - data = msm_dp_read_aux(aux->catalog, REG_DP_AUX_DATA); 223 + data = msm_dp_read_aux(aux, REG_DP_AUX_DATA); 233 224 *dp++ = (u8)((data >> DP_AUX_DATA_OFFSET) & 0xff); 234 225 235 226 actual_i = (data >> DP_AUX_DATA_INDEX_OFFSET) & 0xFF; ··· 597 588 { 598 589 struct msm_dp_aux_private *aux = 599 590 container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux); 600 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 601 591 u32 reg; 602 592 603 593 /* Configure REFTIMER and enable it */ 604 - reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER); 594 + reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_REFTIMER); 605 595 reg |= DP_DP_HPD_REFTIMER_ENABLE; 606 - msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER, reg); 596 + msm_dp_write_aux(aux, REG_DP_DP_HPD_REFTIMER, reg); 607 597 608 598 /* Enable HPD */ 609 - msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN); 599 + msm_dp_write_aux(aux, REG_DP_DP_HPD_CTRL, DP_DP_HPD_CTRL_HPD_EN); 610 600 } 611 601 612 602 void msm_dp_aux_hpd_disable(struct drm_dp_aux *msm_dp_aux) 613 603 { 614 604 struct msm_dp_aux_private *aux = 615 605 container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux); 616 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 617 606 u32 reg; 618 607 619 - reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER); 608 + reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_REFTIMER); 620 609 reg &= ~DP_DP_HPD_REFTIMER_ENABLE; 621 - msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_REFTIMER, reg); 610 + msm_dp_write_aux(aux, REG_DP_DP_HPD_REFTIMER, reg); 622 611 623 - msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_CTRL, 0); 612 + msm_dp_write_aux(aux, REG_DP_DP_HPD_CTRL, 0); 624 613 } 625 614 626 615 void msm_dp_aux_hpd_intr_enable(struct drm_dp_aux *msm_dp_aux) 627 616 { 628 617 struct msm_dp_aux_private *aux = 629 618 container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux); 630 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 631 619 u32 reg; 632 620 633 - reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK); 621 + reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_MASK); 634 622 reg |= DP_DP_HPD_INT_MASK; 635 - msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK, 623 + msm_dp_write_aux(aux, REG_DP_DP_HPD_INT_MASK, 636 624 reg & DP_DP_HPD_INT_MASK); 637 625 } 638 626 ··· 637 631 { 638 632 struct msm_dp_aux_private *aux = 639 633 container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux); 640 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 641 634 u32 reg; 642 635 643 - reg = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK); 636 + reg = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_MASK); 644 637 reg &= ~DP_DP_HPD_INT_MASK; 645 - msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK, 638 + msm_dp_write_aux(aux, REG_DP_DP_HPD_INT_MASK, 646 639 reg & DP_DP_HPD_INT_MASK); 647 640 } 648 641 ··· 649 644 { 650 645 struct msm_dp_aux_private *aux = 651 646 container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux); 652 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 653 647 int isr, mask; 654 648 655 - isr = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_STATUS); 656 - msm_dp_write_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_ACK, 649 + isr = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_STATUS); 650 + msm_dp_write_aux(aux, REG_DP_DP_HPD_INT_ACK, 657 651 (isr & DP_DP_HPD_INT_MASK)); 658 - mask = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_MASK); 652 + mask = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_MASK); 659 653 660 654 /* 661 655 * We only want to return interrupts that are unmasked to the caller. ··· 670 666 { 671 667 struct msm_dp_aux_private *aux = 672 668 container_of(msm_dp_aux, struct msm_dp_aux_private, msm_dp_aux); 673 - struct msm_dp_catalog *msm_dp_catalog = aux->catalog; 674 669 u32 status; 675 670 676 - status = msm_dp_read_aux(msm_dp_catalog, REG_DP_DP_HPD_INT_STATUS); 671 + status = msm_dp_read_aux(aux, REG_DP_DP_HPD_INT_STATUS); 677 672 status >>= DP_DP_HPD_STATE_STATUS_BITS_SHIFT; 678 673 status &= DP_DP_HPD_STATE_STATUS_BITS_MASK; 679 674 680 675 return status; 681 676 } 682 677 683 - struct drm_dp_aux *msm_dp_aux_get(struct device *dev, struct msm_dp_catalog *catalog, 678 + struct drm_dp_aux *msm_dp_aux_get(struct device *dev, 684 679 struct phy *phy, 685 - bool is_edp) 680 + bool is_edp, 681 + void __iomem *aux_base) 686 682 { 687 683 struct msm_dp_aux_private *aux; 688 - 689 - if (!catalog) { 690 - DRM_ERROR("invalid input\n"); 691 - return ERR_PTR(-ENODEV); 692 - } 693 684 694 685 aux = devm_kzalloc(dev, sizeof(*aux), GFP_KERNEL); 695 686 if (!aux) ··· 696 697 mutex_init(&aux->mutex); 697 698 698 699 aux->dev = dev; 699 - aux->catalog = catalog; 700 700 aux->phy = phy; 701 701 aux->retry_cnt = 0; 702 + aux->aux_base = aux_base; 702 703 703 704 /* 704 705 * Use the drm_dp_aux_init() to use the aux adapter
+3 -3
drivers/gpu/drm/msm/dp/dp_aux.h
··· 6 6 #ifndef _DP_AUX_H_ 7 7 #define _DP_AUX_H_ 8 8 9 - #include "dp_catalog.h" 10 9 #include <drm/display/drm_dp_helper.h> 11 10 12 11 int msm_dp_aux_register(struct drm_dp_aux *msm_dp_aux); ··· 24 25 u32 msm_dp_aux_is_link_connected(struct drm_dp_aux *msm_dp_aux); 25 26 26 27 struct phy; 27 - struct drm_dp_aux *msm_dp_aux_get(struct device *dev, struct msm_dp_catalog *catalog, 28 + struct drm_dp_aux *msm_dp_aux_get(struct device *dev, 28 29 struct phy *phy, 29 - bool is_edp); 30 + bool is_edp, 31 + void __iomem *aux_base); 30 32 void msm_dp_aux_put(struct drm_dp_aux *aux); 31 33 32 34 #endif /*__DP_AUX_H_*/
-126
drivers/gpu/drm/msm/dp/dp_catalog.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 4 - */ 5 - 6 - #define pr_fmt(fmt) "[drm-dp] %s: " fmt, __func__ 7 - 8 - #include <linux/delay.h> 9 - #include <linux/iopoll.h> 10 - #include <linux/platform_device.h> 11 - #include <linux/rational.h> 12 - #include <drm/display/drm_dp_helper.h> 13 - #include <drm/drm_print.h> 14 - 15 - #include "dp_catalog.h" 16 - #include "dp_reg.h" 17 - 18 - #define DP_DEFAULT_AHB_OFFSET 0x0000 19 - #define DP_DEFAULT_AHB_SIZE 0x0200 20 - #define DP_DEFAULT_AUX_OFFSET 0x0200 21 - #define DP_DEFAULT_AUX_SIZE 0x0200 22 - #define DP_DEFAULT_LINK_OFFSET 0x0400 23 - #define DP_DEFAULT_LINK_SIZE 0x0C00 24 - #define DP_DEFAULT_P0_OFFSET 0x1000 25 - #define DP_DEFAULT_P0_SIZE 0x0400 26 - 27 - struct msm_dp_catalog_private { 28 - struct device *dev; 29 - struct drm_device *drm_dev; 30 - struct msm_dp_catalog msm_dp_catalog; 31 - }; 32 - 33 - void msm_dp_catalog_snapshot(struct msm_dp_catalog *msm_dp_catalog, struct msm_disp_state *disp_state) 34 - { 35 - msm_disp_snapshot_add_block(disp_state, 36 - msm_dp_catalog->ahb_len, msm_dp_catalog->ahb_base, "dp_ahb"); 37 - msm_disp_snapshot_add_block(disp_state, 38 - msm_dp_catalog->aux_len, msm_dp_catalog->aux_base, "dp_aux"); 39 - msm_disp_snapshot_add_block(disp_state, 40 - msm_dp_catalog->link_len, msm_dp_catalog->link_base, "dp_link"); 41 - msm_disp_snapshot_add_block(disp_state, 42 - msm_dp_catalog->p0_len, msm_dp_catalog->p0_base, "dp_p0"); 43 - } 44 - 45 - static void __iomem *msm_dp_ioremap(struct platform_device *pdev, int idx, size_t *len) 46 - { 47 - struct resource *res; 48 - void __iomem *base; 49 - 50 - base = devm_platform_get_and_ioremap_resource(pdev, idx, &res); 51 - if (!IS_ERR(base)) 52 - *len = resource_size(res); 53 - 54 - return base; 55 - } 56 - 57 - static int msm_dp_catalog_get_io(struct msm_dp_catalog_private *catalog) 58 - { 59 - struct msm_dp_catalog *msm_dp_catalog = &catalog->msm_dp_catalog; 60 - struct platform_device *pdev = to_platform_device(catalog->dev); 61 - 62 - msm_dp_catalog->ahb_base = msm_dp_ioremap(pdev, 0, &msm_dp_catalog->ahb_len); 63 - if (IS_ERR(msm_dp_catalog->ahb_base)) 64 - return PTR_ERR(msm_dp_catalog->ahb_base); 65 - 66 - msm_dp_catalog->aux_base = msm_dp_ioremap(pdev, 1, &msm_dp_catalog->aux_len); 67 - if (IS_ERR(msm_dp_catalog->aux_base)) { 68 - /* 69 - * The initial binding had a single reg, but in order to 70 - * support variation in the sub-region sizes this was split. 71 - * msm_dp_ioremap() will fail with -EINVAL here if only a single 72 - * reg is specified, so fill in the sub-region offsets and 73 - * lengths based on this single region. 74 - */ 75 - if (PTR_ERR(msm_dp_catalog->aux_base) == -EINVAL) { 76 - if (msm_dp_catalog->ahb_len < DP_DEFAULT_P0_OFFSET + DP_DEFAULT_P0_SIZE) { 77 - DRM_ERROR("legacy memory region not large enough\n"); 78 - return -EINVAL; 79 - } 80 - 81 - msm_dp_catalog->ahb_len = DP_DEFAULT_AHB_SIZE; 82 - msm_dp_catalog->aux_base = msm_dp_catalog->ahb_base + DP_DEFAULT_AUX_OFFSET; 83 - msm_dp_catalog->aux_len = DP_DEFAULT_AUX_SIZE; 84 - msm_dp_catalog->link_base = msm_dp_catalog->ahb_base + 85 - DP_DEFAULT_LINK_OFFSET; 86 - msm_dp_catalog->link_len = DP_DEFAULT_LINK_SIZE; 87 - msm_dp_catalog->p0_base = msm_dp_catalog->ahb_base + DP_DEFAULT_P0_OFFSET; 88 - msm_dp_catalog->p0_len = DP_DEFAULT_P0_SIZE; 89 - } else { 90 - DRM_ERROR("unable to remap aux region: %pe\n", msm_dp_catalog->aux_base); 91 - return PTR_ERR(msm_dp_catalog->aux_base); 92 - } 93 - } else { 94 - msm_dp_catalog->link_base = msm_dp_ioremap(pdev, 2, &msm_dp_catalog->link_len); 95 - if (IS_ERR(msm_dp_catalog->link_base)) { 96 - DRM_ERROR("unable to remap link region: %pe\n", msm_dp_catalog->link_base); 97 - return PTR_ERR(msm_dp_catalog->link_base); 98 - } 99 - 100 - msm_dp_catalog->p0_base = msm_dp_ioremap(pdev, 3, &msm_dp_catalog->p0_len); 101 - if (IS_ERR(msm_dp_catalog->p0_base)) { 102 - DRM_ERROR("unable to remap p0 region: %pe\n", msm_dp_catalog->p0_base); 103 - return PTR_ERR(msm_dp_catalog->p0_base); 104 - } 105 - } 106 - 107 - return 0; 108 - } 109 - 110 - struct msm_dp_catalog *msm_dp_catalog_get(struct device *dev) 111 - { 112 - struct msm_dp_catalog_private *catalog; 113 - int ret; 114 - 115 - catalog = devm_kzalloc(dev, sizeof(*catalog), GFP_KERNEL); 116 - if (!catalog) 117 - return ERR_PTR(-ENOMEM); 118 - 119 - catalog->dev = dev; 120 - 121 - ret = msm_dp_catalog_get_io(catalog); 122 - if (ret) 123 - return ERR_PTR(ret); 124 - 125 - return &catalog->msm_dp_catalog; 126 - }
-100
drivers/gpu/drm/msm/dp/dp_catalog.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. 4 - */ 5 - 6 - #ifndef _DP_CATALOG_H_ 7 - #define _DP_CATALOG_H_ 8 - 9 - #include <drm/drm_modes.h> 10 - 11 - #include "dp_utils.h" 12 - #include "disp/msm_disp_snapshot.h" 13 - 14 - #define DP_HW_VERSION_1_0 0x10000000 15 - #define DP_HW_VERSION_1_2 0x10020000 16 - 17 - struct msm_dp_catalog { 18 - bool wide_bus_en; 19 - 20 - void __iomem *ahb_base; 21 - size_t ahb_len; 22 - 23 - void __iomem *aux_base; 24 - size_t aux_len; 25 - 26 - void __iomem *link_base; 27 - size_t link_len; 28 - 29 - void __iomem *p0_base; 30 - size_t p0_len; 31 - }; 32 - 33 - /* IO */ 34 - static inline u32 msm_dp_read_aux(struct msm_dp_catalog *msm_dp_catalog, u32 offset) 35 - { 36 - return readl_relaxed(msm_dp_catalog->aux_base + offset); 37 - } 38 - 39 - static inline void msm_dp_write_aux(struct msm_dp_catalog *msm_dp_catalog, 40 - u32 offset, u32 data) 41 - { 42 - /* 43 - * To make sure aux reg writes happens before any other operation, 44 - * this function uses writel() instread of writel_relaxed() 45 - */ 46 - writel(data, msm_dp_catalog->aux_base + offset); 47 - } 48 - 49 - static inline u32 msm_dp_read_ahb(const struct msm_dp_catalog *msm_dp_catalog, u32 offset) 50 - { 51 - return readl_relaxed(msm_dp_catalog->ahb_base + offset); 52 - } 53 - 54 - static inline void msm_dp_write_ahb(struct msm_dp_catalog *msm_dp_catalog, 55 - u32 offset, u32 data) 56 - { 57 - /* 58 - * To make sure phy reg writes happens before any other operation, 59 - * this function uses writel() instread of writel_relaxed() 60 - */ 61 - writel(data, msm_dp_catalog->ahb_base + offset); 62 - } 63 - 64 - static inline void msm_dp_write_p0(struct msm_dp_catalog *msm_dp_catalog, 65 - u32 offset, u32 data) 66 - { 67 - /* 68 - * To make sure interface reg writes happens before any other operation, 69 - * this function uses writel() instread of writel_relaxed() 70 - */ 71 - writel(data, msm_dp_catalog->p0_base + offset); 72 - } 73 - 74 - static inline u32 msm_dp_read_p0(struct msm_dp_catalog *msm_dp_catalog, 75 - u32 offset) 76 - { 77 - return readl_relaxed(msm_dp_catalog->p0_base + offset); 78 - } 79 - 80 - static inline u32 msm_dp_read_link(struct msm_dp_catalog *msm_dp_catalog, u32 offset) 81 - { 82 - return readl_relaxed(msm_dp_catalog->link_base + offset); 83 - } 84 - 85 - static inline void msm_dp_write_link(struct msm_dp_catalog *msm_dp_catalog, 86 - u32 offset, u32 data) 87 - { 88 - /* 89 - * To make sure link reg writes happens before any other operation, 90 - * this function uses writel() instread of writel_relaxed() 91 - */ 92 - writel(data, msm_dp_catalog->link_base + offset); 93 - } 94 - 95 - /* Debug module */ 96 - void msm_dp_catalog_snapshot(struct msm_dp_catalog *msm_dp_catalog, struct msm_disp_state *disp_state); 97 - 98 - struct msm_dp_catalog *msm_dp_catalog_get(struct device *dev); 99 - 100 - #endif /* _DP_CATALOG_H_ */
+122 -109
drivers/gpu/drm/msm/dp/dp_ctrl.c
··· 6 6 #define pr_fmt(fmt) "[drm-dp] %s: " fmt, __func__ 7 7 8 8 #include <linux/types.h> 9 + #include <linux/clk.h> 9 10 #include <linux/completion.h> 10 11 #include <linux/delay.h> 11 12 #include <linux/iopoll.h> ··· 17 16 #include <linux/string_choices.h> 18 17 19 18 #include <drm/display/drm_dp_helper.h> 19 + #include <drm/drm_device.h> 20 20 #include <drm/drm_fixed.h> 21 21 #include <drm/drm_print.h> 22 22 ··· 116 114 struct drm_dp_aux *aux; 117 115 struct msm_dp_panel *panel; 118 116 struct msm_dp_link *link; 119 - struct msm_dp_catalog *catalog; 117 + void __iomem *ahb_base; 118 + void __iomem *link_base; 120 119 121 120 struct phy *phy; 122 121 ··· 141 138 bool link_clks_on; 142 139 bool stream_clks_on; 143 140 }; 141 + 142 + static inline u32 msm_dp_read_ahb(const struct msm_dp_ctrl_private *ctrl, u32 offset) 143 + { 144 + return readl_relaxed(ctrl->ahb_base + offset); 145 + } 146 + 147 + static inline void msm_dp_write_ahb(struct msm_dp_ctrl_private *ctrl, 148 + u32 offset, u32 data) 149 + { 150 + /* 151 + * To make sure phy reg writes happens before any other operation, 152 + * this function uses writel() instread of writel_relaxed() 153 + */ 154 + writel(data, ctrl->ahb_base + offset); 155 + } 156 + 157 + static inline u32 msm_dp_read_link(struct msm_dp_ctrl_private *ctrl, u32 offset) 158 + { 159 + return readl_relaxed(ctrl->link_base + offset); 160 + } 161 + 162 + static inline void msm_dp_write_link(struct msm_dp_ctrl_private *ctrl, 163 + u32 offset, u32 data) 164 + { 165 + /* 166 + * To make sure link reg writes happens before any other operation, 167 + * this function uses writel() instread of writel_relaxed() 168 + */ 169 + writel(data, ctrl->link_base + offset); 170 + } 144 171 145 172 static int msm_dp_aux_link_configure(struct drm_dp_aux *aux, 146 173 struct msm_dp_link_info *link) ··· 198 165 { 199 166 struct msm_dp_ctrl_private *ctrl = 200 167 container_of(msm_dp_ctrl, struct msm_dp_ctrl_private, msm_dp_ctrl); 201 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 202 168 u32 sw_reset; 203 169 204 - sw_reset = msm_dp_read_ahb(msm_dp_catalog, REG_DP_SW_RESET); 170 + sw_reset = msm_dp_read_ahb(ctrl, REG_DP_SW_RESET); 205 171 206 172 sw_reset |= DP_SW_RESET; 207 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_SW_RESET, sw_reset); 173 + msm_dp_write_ahb(ctrl, REG_DP_SW_RESET, sw_reset); 208 174 usleep_range(1000, 1100); /* h/w recommended delay */ 209 175 210 176 sw_reset &= ~DP_SW_RESET; 211 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_SW_RESET, sw_reset); 177 + msm_dp_write_ahb(ctrl, REG_DP_SW_RESET, sw_reset); 212 178 213 179 if (!ctrl->hw_revision) { 214 - ctrl->hw_revision = msm_dp_read_ahb(msm_dp_catalog, REG_DP_HW_VERSION); 180 + ctrl->hw_revision = msm_dp_read_ahb(ctrl, REG_DP_HW_VERSION); 215 181 ctrl->panel->hw_revision = ctrl->hw_revision; 216 182 } 217 183 } 218 184 219 185 static u32 msm_dp_ctrl_get_aux_interrupt(struct msm_dp_ctrl_private *ctrl) 220 186 { 221 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 222 187 u32 intr, intr_ack; 223 188 224 - intr = msm_dp_read_ahb(msm_dp_catalog, REG_DP_INTR_STATUS); 189 + intr = msm_dp_read_ahb(ctrl, REG_DP_INTR_STATUS); 225 190 intr &= ~DP_INTERRUPT_STATUS1_MASK; 226 191 intr_ack = (intr & DP_INTERRUPT_STATUS1) 227 192 << DP_INTERRUPT_STATUS_ACK_SHIFT; 228 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_STATUS, 193 + msm_dp_write_ahb(ctrl, REG_DP_INTR_STATUS, 229 194 intr_ack | DP_INTERRUPT_STATUS1_MASK); 230 195 231 196 return intr; ··· 232 201 233 202 static u32 msm_dp_ctrl_get_interrupt(struct msm_dp_ctrl_private *ctrl) 234 203 { 235 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 236 204 u32 intr, intr_ack; 237 205 238 - intr = msm_dp_read_ahb(msm_dp_catalog, REG_DP_INTR_STATUS2); 206 + intr = msm_dp_read_ahb(ctrl, REG_DP_INTR_STATUS2); 239 207 intr &= ~DP_INTERRUPT_STATUS2_MASK; 240 208 intr_ack = (intr & DP_INTERRUPT_STATUS2) 241 209 << DP_INTERRUPT_STATUS_ACK_SHIFT; 242 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_STATUS2, 210 + msm_dp_write_ahb(ctrl, REG_DP_INTR_STATUS2, 243 211 intr_ack | DP_INTERRUPT_STATUS2_MASK); 244 212 245 213 return intr; ··· 248 218 { 249 219 struct msm_dp_ctrl_private *ctrl = 250 220 container_of(msm_dp_ctrl, struct msm_dp_ctrl_private, msm_dp_ctrl); 251 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 252 221 253 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_STATUS, 222 + msm_dp_write_ahb(ctrl, REG_DP_INTR_STATUS, 254 223 DP_INTERRUPT_STATUS1_MASK); 255 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_STATUS2, 224 + msm_dp_write_ahb(ctrl, REG_DP_INTR_STATUS2, 256 225 DP_INTERRUPT_STATUS2_MASK); 257 226 } 258 227 ··· 259 230 { 260 231 struct msm_dp_ctrl_private *ctrl = 261 232 container_of(msm_dp_ctrl, struct msm_dp_ctrl_private, msm_dp_ctrl); 262 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 263 233 264 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_STATUS, 0x00); 265 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_STATUS2, 0x00); 234 + msm_dp_write_ahb(ctrl, REG_DP_INTR_STATUS, 0x00); 235 + msm_dp_write_ahb(ctrl, REG_DP_INTR_STATUS2, 0x00); 266 236 } 267 237 268 238 static u32 msm_dp_ctrl_get_psr_interrupt(struct msm_dp_ctrl_private *ctrl) 269 239 { 270 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 271 240 u32 intr, intr_ack; 272 241 273 - intr = msm_dp_read_ahb(msm_dp_catalog, REG_DP_INTR_STATUS4); 242 + intr = msm_dp_read_ahb(ctrl, REG_DP_INTR_STATUS4); 274 243 intr_ack = (intr & DP_INTERRUPT_STATUS4) 275 244 << DP_INTERRUPT_STATUS_ACK_SHIFT; 276 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_STATUS4, intr_ack); 245 + msm_dp_write_ahb(ctrl, REG_DP_INTR_STATUS4, intr_ack); 277 246 278 247 return intr; 279 248 } 280 249 281 250 static void msm_dp_ctrl_config_psr_interrupt(struct msm_dp_ctrl_private *ctrl) 282 251 { 283 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 284 - 285 - msm_dp_write_ahb(msm_dp_catalog, REG_DP_INTR_MASK4, DP_INTERRUPT_MASK4); 252 + msm_dp_write_ahb(ctrl, REG_DP_INTR_MASK4, DP_INTERRUPT_MASK4); 286 253 } 287 254 288 255 static void msm_dp_ctrl_psr_mainlink_enable(struct msm_dp_ctrl_private *ctrl) 289 256 { 290 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 291 257 u32 val; 292 258 293 - val = msm_dp_read_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL); 259 + val = msm_dp_read_link(ctrl, REG_DP_MAINLINK_CTRL); 294 260 val |= DP_MAINLINK_CTRL_ENABLE; 295 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, val); 261 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, val); 296 262 } 297 263 298 264 static void msm_dp_ctrl_psr_mainlink_disable(struct msm_dp_ctrl_private *ctrl) 299 265 { 300 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 301 266 u32 val; 302 267 303 - val = msm_dp_read_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL); 268 + val = msm_dp_read_link(ctrl, REG_DP_MAINLINK_CTRL); 304 269 val &= ~DP_MAINLINK_CTRL_ENABLE; 305 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, val); 270 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, val); 306 271 } 307 272 308 273 static void msm_dp_ctrl_mainlink_enable(struct msm_dp_ctrl_private *ctrl) 309 274 { 310 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 311 275 u32 mainlink_ctrl; 312 276 313 277 drm_dbg_dp(ctrl->drm_dev, "enable\n"); 314 278 315 - mainlink_ctrl = msm_dp_read_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL); 279 + mainlink_ctrl = msm_dp_read_link(ctrl, REG_DP_MAINLINK_CTRL); 316 280 317 281 mainlink_ctrl &= ~(DP_MAINLINK_CTRL_RESET | 318 282 DP_MAINLINK_CTRL_ENABLE); 319 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 283 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 320 284 321 285 mainlink_ctrl |= DP_MAINLINK_CTRL_RESET; 322 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 286 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 323 287 324 288 mainlink_ctrl &= ~DP_MAINLINK_CTRL_RESET; 325 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 289 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 326 290 327 291 mainlink_ctrl |= (DP_MAINLINK_CTRL_ENABLE | 328 292 DP_MAINLINK_FB_BOUNDARY_SEL); 329 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 293 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 330 294 } 331 295 332 296 static void msm_dp_ctrl_mainlink_disable(struct msm_dp_ctrl_private *ctrl) 333 297 { 334 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 335 298 u32 mainlink_ctrl; 336 299 337 300 drm_dbg_dp(ctrl->drm_dev, "disable\n"); 338 301 339 - mainlink_ctrl = msm_dp_read_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL); 302 + mainlink_ctrl = msm_dp_read_link(ctrl, REG_DP_MAINLINK_CTRL); 340 303 mainlink_ctrl &= ~DP_MAINLINK_CTRL_ENABLE; 341 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 304 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 342 305 } 343 306 344 307 static void msm_dp_setup_peripheral_flush(struct msm_dp_ctrl_private *ctrl) 345 308 { 346 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 347 309 u32 mainlink_ctrl; 348 310 349 - mainlink_ctrl = msm_dp_read_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL); 311 + mainlink_ctrl = msm_dp_read_link(ctrl, REG_DP_MAINLINK_CTRL); 350 312 351 313 if (ctrl->hw_revision >= DP_HW_VERSION_1_2) 352 314 mainlink_ctrl |= DP_MAINLINK_FLUSH_MODE_SDE_PERIPH_UPDATE; 353 315 else 354 316 mainlink_ctrl |= DP_MAINLINK_FLUSH_MODE_UPDATE_SDP; 355 317 356 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 318 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, mainlink_ctrl); 357 319 } 358 320 359 321 static bool msm_dp_ctrl_mainlink_ready(struct msm_dp_ctrl_private *ctrl) 360 322 { 361 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 362 323 u32 data; 363 324 int ret; 364 325 365 326 /* Poll for mainlink ready status */ 366 - ret = readl_poll_timeout(msm_dp_catalog->link_base + REG_DP_MAINLINK_READY, 327 + ret = readl_poll_timeout(ctrl->link_base + REG_DP_MAINLINK_READY, 367 328 data, data & DP_MAINLINK_READY_FOR_VIDEO, 368 329 POLLING_SLEEP_US, POLLING_TIMEOUT_US); 369 330 if (ret < 0) { ··· 371 352 ctrl = container_of(msm_dp_ctrl, struct msm_dp_ctrl_private, msm_dp_ctrl); 372 353 373 354 reinit_completion(&ctrl->idle_comp); 374 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, DP_STATE_CTRL_PUSH_IDLE); 355 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, DP_STATE_CTRL_PUSH_IDLE); 375 356 376 357 if (!wait_for_completion_timeout(&ctrl->idle_comp, 377 358 IDLE_PATTERN_COMPLETION_TIMEOUT_JIFFIES)) ··· 418 399 419 400 drm_dbg_dp(ctrl->drm_dev, "DP_CONFIGURATION_CTRL=0x%x\n", config); 420 401 421 - msm_dp_write_link(ctrl->catalog, REG_DP_CONFIGURATION_CTRL, config); 402 + msm_dp_write_link(ctrl, REG_DP_CONFIGURATION_CTRL, config); 422 403 } 423 404 424 405 static void msm_dp_ctrl_lane_mapping(struct msm_dp_ctrl_private *ctrl) 425 406 { 426 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 427 407 u32 ln_0 = 0, ln_1 = 1, ln_2 = 2, ln_3 = 3; /* One-to-One mapping */ 428 408 u32 ln_mapping; 429 409 ··· 431 413 ln_mapping |= ln_2 << LANE2_MAPPING_SHIFT; 432 414 ln_mapping |= ln_3 << LANE3_MAPPING_SHIFT; 433 415 434 - msm_dp_write_link(msm_dp_catalog, REG_DP_LOGICAL2PHYSICAL_LANE_MAPPING, 416 + msm_dp_write_link(ctrl, REG_DP_LOGICAL2PHYSICAL_LANE_MAPPING, 435 417 ln_mapping); 436 418 } 437 419 ··· 447 429 test_bits_depth = msm_dp_link_get_test_bits_depth(ctrl->link, ctrl->panel->msm_dp_mode.bpp); 448 430 colorimetry_cfg = msm_dp_link_get_colorimetry_config(ctrl->link); 449 431 450 - misc_val = msm_dp_read_link(ctrl->catalog, REG_DP_MISC1_MISC0); 432 + misc_val = msm_dp_read_link(ctrl, REG_DP_MISC1_MISC0); 451 433 452 434 /* clear bpp bits */ 453 435 misc_val &= ~(0x07 << DP_MISC0_TEST_BITS_DEPTH_SHIFT); ··· 457 439 misc_val |= DP_MISC0_SYNCHRONOUS_CLK; 458 440 459 441 drm_dbg_dp(ctrl->drm_dev, "misc settings = 0x%x\n", misc_val); 460 - msm_dp_write_link(ctrl->catalog, REG_DP_MISC1_MISC0, misc_val); 442 + msm_dp_write_link(ctrl, REG_DP_MISC1_MISC0, misc_val); 461 443 462 - msm_dp_panel_timing_cfg(ctrl->panel); 444 + msm_dp_panel_timing_cfg(ctrl->panel, ctrl->msm_dp_ctrl.wide_bus_en); 463 445 } 464 446 465 447 /* ··· 1275 1257 pr_debug("dp_tu=0x%x, valid_boundary=0x%x, valid_boundary2=0x%x\n", 1276 1258 msm_dp_tu, valid_boundary, valid_boundary2); 1277 1259 1278 - msm_dp_write_link(ctrl->catalog, REG_DP_VALID_BOUNDARY, valid_boundary); 1279 - msm_dp_write_link(ctrl->catalog, REG_DP_TU, msm_dp_tu); 1280 - msm_dp_write_link(ctrl->catalog, REG_DP_VALID_BOUNDARY_2, valid_boundary2); 1260 + msm_dp_write_link(ctrl, REG_DP_VALID_BOUNDARY, valid_boundary); 1261 + msm_dp_write_link(ctrl, REG_DP_TU, msm_dp_tu); 1262 + msm_dp_write_link(ctrl, REG_DP_VALID_BOUNDARY_2, valid_boundary2); 1281 1263 } 1282 1264 1283 1265 static int msm_dp_ctrl_wait4video_ready(struct msm_dp_ctrl_private *ctrl) ··· 1394 1376 1395 1377 bit = BIT(state_bit - 1); 1396 1378 drm_dbg_dp(ctrl->drm_dev, "hw: bit=%d train=%d\n", bit, state_bit); 1397 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, bit); 1379 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, bit); 1398 1380 1399 1381 bit = BIT(state_bit - 1) << DP_MAINLINK_READY_LINK_TRAINING_SHIFT; 1400 1382 1401 1383 /* Poll for mainlink ready status */ 1402 - ret = readx_poll_timeout(readl, ctrl->catalog->link_base + REG_DP_MAINLINK_READY, 1384 + ret = readx_poll_timeout(readl, ctrl->link_base + REG_DP_MAINLINK_READY, 1403 1385 data, data & bit, 1404 1386 POLLING_SLEEP_US, POLLING_TIMEOUT_US); 1405 1387 if (ret < 0) { ··· 1421 1403 delay_us = drm_dp_read_clock_recovery_delay(ctrl->aux, 1422 1404 ctrl->panel->dpcd, dp_phy, false); 1423 1405 1424 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, 0); 1406 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 0); 1425 1407 1426 1408 *training_step = DP_TRAINING_1; 1427 1409 ··· 1539 1521 delay_us = drm_dp_read_channel_eq_delay(ctrl->aux, 1540 1522 ctrl->panel->dpcd, dp_phy, false); 1541 1523 1542 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, 0); 1524 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 0); 1543 1525 1544 1526 *training_step = DP_TRAINING_2; 1545 1527 ··· 1656 1638 } 1657 1639 1658 1640 end: 1659 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, 0); 1641 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 0); 1660 1642 1661 1643 return ret; 1662 1644 } ··· 1801 1783 1802 1784 static void msm_dp_ctrl_enable_sdp(struct msm_dp_ctrl_private *ctrl) 1803 1785 { 1804 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 1805 - 1806 1786 /* trigger sdp */ 1807 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG3, UPDATE_SDP); 1808 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG3, 0x0); 1787 + msm_dp_write_link(ctrl, MMSS_DP_SDP_CFG3, UPDATE_SDP); 1788 + msm_dp_write_link(ctrl, MMSS_DP_SDP_CFG3, 0x0); 1809 1789 } 1810 1790 1811 1791 static void msm_dp_ctrl_psr_enter(struct msm_dp_ctrl_private *ctrl) 1812 1792 { 1813 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 1814 1793 u32 cmd; 1815 1794 1816 - cmd = msm_dp_read_link(msm_dp_catalog, REG_PSR_CMD); 1795 + cmd = msm_dp_read_link(ctrl, REG_PSR_CMD); 1817 1796 1818 1797 cmd &= ~(PSR_ENTER | PSR_EXIT); 1819 1798 cmd |= PSR_ENTER; 1820 1799 1821 1800 msm_dp_ctrl_enable_sdp(ctrl); 1822 - msm_dp_write_link(msm_dp_catalog, REG_PSR_CMD, cmd); 1801 + msm_dp_write_link(ctrl, REG_PSR_CMD, cmd); 1823 1802 } 1824 1803 1825 1804 static void msm_dp_ctrl_psr_exit(struct msm_dp_ctrl_private *ctrl) 1826 1805 { 1827 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 1828 1806 u32 cmd; 1829 1807 1830 - cmd = msm_dp_read_link(msm_dp_catalog, REG_PSR_CMD); 1808 + cmd = msm_dp_read_link(ctrl, REG_PSR_CMD); 1831 1809 1832 1810 cmd &= ~(PSR_ENTER | PSR_EXIT); 1833 1811 cmd |= PSR_EXIT; 1834 1812 1835 1813 msm_dp_ctrl_enable_sdp(ctrl); 1836 - msm_dp_write_link(msm_dp_catalog, REG_PSR_CMD, cmd); 1814 + msm_dp_write_link(ctrl, REG_PSR_CMD, cmd); 1837 1815 } 1838 1816 1839 1817 void msm_dp_ctrl_config_psr(struct msm_dp_ctrl *msm_dp_ctrl) 1840 1818 { 1841 1819 struct msm_dp_ctrl_private *ctrl = container_of(msm_dp_ctrl, 1842 1820 struct msm_dp_ctrl_private, msm_dp_ctrl); 1843 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 1844 1821 u32 cfg; 1845 1822 1846 1823 if (!ctrl->panel->psr_cap.version) 1847 1824 return; 1848 1825 1849 1826 /* enable PSR1 function */ 1850 - cfg = msm_dp_read_link(msm_dp_catalog, REG_PSR_CONFIG); 1827 + cfg = msm_dp_read_link(ctrl, REG_PSR_CONFIG); 1851 1828 cfg |= PSR1_SUPPORTED; 1852 - msm_dp_write_link(msm_dp_catalog, REG_PSR_CONFIG, cfg); 1829 + msm_dp_write_link(ctrl, REG_PSR_CONFIG, cfg); 1853 1830 1854 1831 msm_dp_ctrl_config_psr_interrupt(ctrl); 1855 1832 msm_dp_ctrl_enable_sdp(ctrl); ··· 1883 1870 } 1884 1871 1885 1872 msm_dp_ctrl_push_idle(msm_dp_ctrl); 1886 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, 0); 1873 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 0); 1887 1874 1888 1875 msm_dp_ctrl_psr_mainlink_disable(ctrl); 1889 1876 } else { 1890 1877 msm_dp_ctrl_psr_mainlink_enable(ctrl); 1891 1878 1892 1879 msm_dp_ctrl_psr_exit(ctrl); 1893 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, DP_STATE_CTRL_SEND_VIDEO); 1880 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, DP_STATE_CTRL_SEND_VIDEO); 1894 1881 msm_dp_ctrl_wait4video_ready(ctrl); 1895 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, 0); 1882 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 0); 1896 1883 } 1897 1884 } 1898 1885 1899 1886 static void msm_dp_ctrl_phy_reset(struct msm_dp_ctrl_private *ctrl) 1900 1887 { 1901 - msm_dp_write_ahb(ctrl->catalog, REG_DP_PHY_CTRL, 1888 + msm_dp_write_ahb(ctrl, REG_DP_PHY_CTRL, 1902 1889 DP_PHY_CTRL_SW_RESET | DP_PHY_CTRL_SW_RESET_PLL); 1903 1890 usleep_range(1000, 1100); /* h/w recommended delay */ 1904 - msm_dp_write_ahb(ctrl->catalog, REG_DP_PHY_CTRL, 0x0); 1891 + msm_dp_write_ahb(ctrl, REG_DP_PHY_CTRL, 0x0); 1905 1892 } 1906 1893 1907 1894 void msm_dp_ctrl_phy_init(struct msm_dp_ctrl *msm_dp_ctrl) ··· 2003 1990 2004 1991 msm_dp_ctrl_clear_training_pattern(ctrl, DP_PHY_DPRX); 2005 1992 2006 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, DP_STATE_CTRL_SEND_VIDEO); 1993 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, DP_STATE_CTRL_SEND_VIDEO); 2007 1994 2008 1995 ret = msm_dp_ctrl_wait4video_ready(ctrl); 2009 1996 end: ··· 2015 2002 static void msm_dp_ctrl_send_phy_pattern(struct msm_dp_ctrl_private *ctrl, 2016 2003 u32 pattern) 2017 2004 { 2018 - struct msm_dp_catalog *msm_dp_catalog = ctrl->catalog; 2019 2005 u32 value = 0x0; 2020 2006 2021 2007 /* Make sure to clear the current pattern before starting a new one */ 2022 - msm_dp_write_link(msm_dp_catalog, REG_DP_STATE_CTRL, 0x0); 2008 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 0x0); 2023 2009 2024 2010 drm_dbg_dp(ctrl->drm_dev, "pattern: %#x\n", pattern); 2025 2011 switch (pattern) { 2026 2012 case DP_PHY_TEST_PATTERN_D10_2: 2027 - msm_dp_write_link(msm_dp_catalog, REG_DP_STATE_CTRL, 2013 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 2028 2014 DP_STATE_CTRL_LINK_TRAINING_PATTERN1); 2029 2015 break; 2030 2016 2031 2017 case DP_PHY_TEST_PATTERN_ERROR_COUNT: 2032 2018 value &= ~(1 << 16); 2033 - msm_dp_write_link(msm_dp_catalog, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2019 + msm_dp_write_link(ctrl, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2034 2020 value); 2035 2021 value |= SCRAMBLER_RESET_COUNT_VALUE; 2036 - msm_dp_write_link(msm_dp_catalog, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2022 + msm_dp_write_link(ctrl, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2037 2023 value); 2038 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_LEVELS, 2024 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_LEVELS, 2039 2025 DP_MAINLINK_SAFE_TO_EXIT_LEVEL_2); 2040 - msm_dp_write_link(msm_dp_catalog, REG_DP_STATE_CTRL, 2026 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 2041 2027 DP_STATE_CTRL_LINK_SYMBOL_ERR_MEASURE); 2042 2028 break; 2043 2029 2044 2030 case DP_PHY_TEST_PATTERN_PRBS7: 2045 - msm_dp_write_link(msm_dp_catalog, REG_DP_STATE_CTRL, 2031 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 2046 2032 DP_STATE_CTRL_LINK_PRBS7); 2047 2033 break; 2048 2034 2049 2035 case DP_PHY_TEST_PATTERN_80BIT_CUSTOM: 2050 - msm_dp_write_link(msm_dp_catalog, REG_DP_STATE_CTRL, 2036 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 2051 2037 DP_STATE_CTRL_LINK_TEST_CUSTOM_PATTERN); 2052 2038 /* 00111110000011111000001111100000 */ 2053 - msm_dp_write_link(msm_dp_catalog, REG_DP_TEST_80BIT_CUSTOM_PATTERN_REG0, 2039 + msm_dp_write_link(ctrl, REG_DP_TEST_80BIT_CUSTOM_PATTERN_REG0, 2054 2040 0x3E0F83E0); 2055 2041 /* 00001111100000111110000011111000 */ 2056 - msm_dp_write_link(msm_dp_catalog, REG_DP_TEST_80BIT_CUSTOM_PATTERN_REG1, 2042 + msm_dp_write_link(ctrl, REG_DP_TEST_80BIT_CUSTOM_PATTERN_REG1, 2057 2043 0x0F83E0F8); 2058 2044 /* 1111100000111110 */ 2059 - msm_dp_write_link(msm_dp_catalog, REG_DP_TEST_80BIT_CUSTOM_PATTERN_REG2, 2045 + msm_dp_write_link(ctrl, REG_DP_TEST_80BIT_CUSTOM_PATTERN_REG2, 2060 2046 0x0000F83E); 2061 2047 break; 2062 2048 2063 2049 case DP_PHY_TEST_PATTERN_CP2520: 2064 - value = msm_dp_read_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL); 2050 + value = msm_dp_read_link(ctrl, REG_DP_MAINLINK_CTRL); 2065 2051 value &= ~DP_MAINLINK_CTRL_SW_BYPASS_SCRAMBLER; 2066 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, value); 2052 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, value); 2067 2053 2068 2054 value = DP_HBR2_ERM_PATTERN; 2069 - msm_dp_write_link(msm_dp_catalog, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2055 + msm_dp_write_link(ctrl, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2070 2056 value); 2071 2057 value |= SCRAMBLER_RESET_COUNT_VALUE; 2072 - msm_dp_write_link(msm_dp_catalog, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2058 + msm_dp_write_link(ctrl, REG_DP_HBR2_COMPLIANCE_SCRAMBLER_RESET, 2073 2059 value); 2074 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_LEVELS, 2060 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_LEVELS, 2075 2061 DP_MAINLINK_SAFE_TO_EXIT_LEVEL_2); 2076 - msm_dp_write_link(msm_dp_catalog, REG_DP_STATE_CTRL, 2062 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 2077 2063 DP_STATE_CTRL_LINK_SYMBOL_ERR_MEASURE); 2078 - value = msm_dp_read_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL); 2064 + value = msm_dp_read_link(ctrl, REG_DP_MAINLINK_CTRL); 2079 2065 value |= DP_MAINLINK_CTRL_ENABLE; 2080 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, value); 2066 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, value); 2081 2067 break; 2082 2068 2083 2069 case DP_PHY_TEST_PATTERN_SEL_MASK: 2084 - msm_dp_write_link(msm_dp_catalog, REG_DP_MAINLINK_CTRL, 2070 + msm_dp_write_link(ctrl, REG_DP_MAINLINK_CTRL, 2085 2071 DP_MAINLINK_CTRL_ENABLE); 2086 - msm_dp_write_link(msm_dp_catalog, REG_DP_STATE_CTRL, 2072 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, 2087 2073 DP_STATE_CTRL_LINK_TRAINING_PATTERN4); 2088 2074 break; 2089 2075 ··· 2111 2099 msm_dp_ctrl_update_phy_vx_px(ctrl, DP_PHY_DPRX); 2112 2100 msm_dp_link_send_test_response(ctrl->link); 2113 2101 2114 - pattern_sent = msm_dp_read_link(ctrl->catalog, REG_DP_MAINLINK_READY); 2102 + pattern_sent = msm_dp_read_link(ctrl, REG_DP_MAINLINK_READY); 2115 2103 2116 2104 switch (pattern_sent) { 2117 2105 case MR_LINK_TRAINING1: ··· 2442 2430 nvid *= 3; 2443 2431 2444 2432 drm_dbg_dp(ctrl->drm_dev, "mvid=0x%x, nvid=0x%x\n", mvid, nvid); 2445 - msm_dp_write_link(ctrl->catalog, REG_DP_SOFTWARE_MVID, mvid); 2446 - msm_dp_write_link(ctrl->catalog, REG_DP_SOFTWARE_NVID, nvid); 2433 + msm_dp_write_link(ctrl, REG_DP_SOFTWARE_MVID, mvid); 2434 + msm_dp_write_link(ctrl, REG_DP_SOFTWARE_NVID, nvid); 2447 2435 } 2448 2436 2449 2437 int msm_dp_ctrl_on_stream(struct msm_dp_ctrl *msm_dp_ctrl, bool force_link_train) ··· 2520 2508 2521 2509 msm_dp_ctrl_setup_tr_unit(ctrl); 2522 2510 2523 - msm_dp_write_link(ctrl->catalog, REG_DP_STATE_CTRL, DP_STATE_CTRL_SEND_VIDEO); 2511 + msm_dp_write_link(ctrl, REG_DP_STATE_CTRL, DP_STATE_CTRL_SEND_VIDEO); 2524 2512 2525 2513 ret = msm_dp_ctrl_wait4video_ready(ctrl); 2526 2514 if (ret) ··· 2717 2705 2718 2706 struct msm_dp_ctrl *msm_dp_ctrl_get(struct device *dev, struct msm_dp_link *link, 2719 2707 struct msm_dp_panel *panel, struct drm_dp_aux *aux, 2720 - struct msm_dp_catalog *catalog, 2721 - struct phy *phy) 2708 + struct phy *phy, 2709 + void __iomem *ahb_base, 2710 + void __iomem *link_base) 2722 2711 { 2723 2712 struct msm_dp_ctrl_private *ctrl; 2724 2713 int ret; 2725 2714 2726 - if (!dev || !panel || !aux || 2727 - !link || !catalog) { 2715 + if (!dev || !panel || !aux || !link) { 2728 2716 DRM_ERROR("invalid input\n"); 2729 2717 return ERR_PTR(-EINVAL); 2730 2718 } ··· 2755 2743 ctrl->panel = panel; 2756 2744 ctrl->aux = aux; 2757 2745 ctrl->link = link; 2758 - ctrl->catalog = catalog; 2759 2746 ctrl->dev = dev; 2760 2747 ctrl->phy = phy; 2748 + ctrl->ahb_base = ahb_base; 2749 + ctrl->link_base = link_base; 2761 2750 2762 2751 ret = msm_dp_ctrl_clk_init(&ctrl->msm_dp_ctrl); 2763 2752 if (ret) {
+7 -5
drivers/gpu/drm/msm/dp/dp_ctrl.h
··· 9 9 #include "dp_aux.h" 10 10 #include "dp_panel.h" 11 11 #include "dp_link.h" 12 - #include "dp_catalog.h" 13 12 14 13 struct msm_dp_ctrl { 15 14 bool wide_bus_en; ··· 24 25 void msm_dp_ctrl_push_idle(struct msm_dp_ctrl *msm_dp_ctrl); 25 26 irqreturn_t msm_dp_ctrl_isr(struct msm_dp_ctrl *msm_dp_ctrl); 26 27 void msm_dp_ctrl_handle_sink_request(struct msm_dp_ctrl *msm_dp_ctrl); 27 - struct msm_dp_ctrl *msm_dp_ctrl_get(struct device *dev, struct msm_dp_link *link, 28 - struct msm_dp_panel *panel, struct drm_dp_aux *aux, 29 - struct msm_dp_catalog *catalog, 30 - struct phy *phy); 28 + struct msm_dp_ctrl *msm_dp_ctrl_get(struct device *dev, 29 + struct msm_dp_link *link, 30 + struct msm_dp_panel *panel, 31 + struct drm_dp_aux *aux, 32 + struct phy *phy, 33 + void __iomem *ahb_base, 34 + void __iomem *link_base); 31 35 32 36 void msm_dp_ctrl_reset(struct msm_dp_ctrl *msm_dp_ctrl); 33 37 void msm_dp_ctrl_phy_init(struct msm_dp_ctrl *msm_dp_ctrl);
-1
drivers/gpu/drm/msm/dp/dp_debug.c
··· 9 9 #include <drm/drm_connector.h> 10 10 #include <drm/drm_file.h> 11 11 12 - #include "dp_catalog.h" 13 12 #include "dp_aux.h" 14 13 #include "dp_ctrl.h" 15 14 #include "dp_debug.h"
+102 -21
drivers/gpu/drm/msm/dp/dp_display.c
··· 19 19 #include "msm_drv.h" 20 20 #include "msm_kms.h" 21 21 #include "dp_ctrl.h" 22 - #include "dp_catalog.h" 23 22 #include "dp_aux.h" 24 23 #include "dp_reg.h" 25 24 #include "dp_link.h" ··· 86 87 87 88 struct drm_device *drm_dev; 88 89 89 - struct msm_dp_catalog *catalog; 90 90 struct drm_dp_aux *aux; 91 91 struct msm_dp_link *link; 92 92 struct msm_dp_panel *panel; ··· 110 112 bool wide_bus_supported; 111 113 112 114 struct msm_dp_audio *audio; 115 + 116 + void __iomem *ahb_base; 117 + size_t ahb_len; 118 + 119 + void __iomem *aux_base; 120 + size_t aux_len; 121 + 122 + void __iomem *link_base; 123 + size_t link_len; 124 + 125 + void __iomem *p0_base; 126 + size_t p0_len; 113 127 }; 114 128 115 129 struct msm_dp_desc { ··· 766 756 dp->msm_dp_display.is_edp ? PHY_SUBMODE_EDP : PHY_SUBMODE_DP); 767 757 if (rc) { 768 758 DRM_ERROR("failed to set phy submode, rc = %d\n", rc); 769 - dp->catalog = NULL; 770 759 goto error; 771 760 } 772 761 773 - dp->catalog = msm_dp_catalog_get(dev); 774 - if (IS_ERR(dp->catalog)) { 775 - rc = PTR_ERR(dp->catalog); 776 - DRM_ERROR("failed to initialize catalog, rc = %d\n", rc); 777 - dp->catalog = NULL; 778 - goto error; 779 - } 780 - 781 - dp->aux = msm_dp_aux_get(dev, dp->catalog, 782 - phy, 783 - dp->msm_dp_display.is_edp); 762 + dp->aux = msm_dp_aux_get(dev, phy, dp->msm_dp_display.is_edp, dp->aux_base); 784 763 if (IS_ERR(dp->aux)) { 785 764 rc = PTR_ERR(dp->aux); 786 765 DRM_ERROR("failed to initialize aux, rc = %d\n", rc); ··· 785 786 goto error_link; 786 787 } 787 788 788 - dp->panel = msm_dp_panel_get(dev, dp->aux, dp->link, dp->catalog); 789 + dp->panel = msm_dp_panel_get(dev, dp->aux, dp->link, dp->link_base, dp->p0_base); 789 790 if (IS_ERR(dp->panel)) { 790 791 rc = PTR_ERR(dp->panel); 791 792 DRM_ERROR("failed to initialize panel, rc = %d\n", rc); ··· 794 795 } 795 796 796 797 dp->ctrl = msm_dp_ctrl_get(dev, dp->link, dp->panel, dp->aux, 797 - dp->catalog, 798 - phy); 798 + phy, dp->ahb_base, dp->link_base); 799 799 if (IS_ERR(dp->ctrl)) { 800 800 rc = PTR_ERR(dp->ctrl); 801 801 DRM_ERROR("failed to initialize ctrl, rc = %d\n", rc); ··· 802 804 goto error_ctrl; 803 805 } 804 806 805 - dp->audio = msm_dp_audio_get(dp->msm_dp_display.pdev, dp->catalog); 807 + dp->audio = msm_dp_audio_get(dp->msm_dp_display.pdev, dp->link_base); 806 808 if (IS_ERR(dp->audio)) { 807 809 rc = PTR_ERR(dp->audio); 808 810 pr_err("failed to initialize audio, rc = %d\n", rc); ··· 1025 1027 return; 1026 1028 } 1027 1029 1028 - msm_dp_catalog_snapshot(msm_dp_display->catalog, disp_state); 1030 + msm_disp_snapshot_add_block(disp_state, msm_dp_display->ahb_len, 1031 + msm_dp_display->ahb_base, "dp_ahb"); 1032 + msm_disp_snapshot_add_block(disp_state, msm_dp_display->aux_len, 1033 + msm_dp_display->aux_base, "dp_aux"); 1034 + msm_disp_snapshot_add_block(disp_state, msm_dp_display->link_len, 1035 + msm_dp_display->link_base, "dp_link"); 1036 + msm_disp_snapshot_add_block(disp_state, msm_dp_display->p0_len, 1037 + msm_dp_display->p0_base, "dp_p0"); 1029 1038 1030 1039 mutex_unlock(&msm_dp_display->event_mutex); 1031 1040 } ··· 1279 1274 return connector_type; 1280 1275 } 1281 1276 1277 + static void __iomem *msm_dp_ioremap(struct platform_device *pdev, int idx, size_t *len) 1278 + { 1279 + struct resource *res; 1280 + void __iomem *base; 1281 + 1282 + base = devm_platform_get_and_ioremap_resource(pdev, idx, &res); 1283 + if (!IS_ERR(base)) 1284 + *len = resource_size(res); 1285 + 1286 + return base; 1287 + } 1288 + 1289 + #define DP_DEFAULT_AHB_OFFSET 0x0000 1290 + #define DP_DEFAULT_AHB_SIZE 0x0200 1291 + #define DP_DEFAULT_AUX_OFFSET 0x0200 1292 + #define DP_DEFAULT_AUX_SIZE 0x0200 1293 + #define DP_DEFAULT_LINK_OFFSET 0x0400 1294 + #define DP_DEFAULT_LINK_SIZE 0x0C00 1295 + #define DP_DEFAULT_P0_OFFSET 0x1000 1296 + #define DP_DEFAULT_P0_SIZE 0x0400 1297 + 1298 + static int msm_dp_display_get_io(struct msm_dp_display_private *display) 1299 + { 1300 + struct platform_device *pdev = display->msm_dp_display.pdev; 1301 + 1302 + display->ahb_base = msm_dp_ioremap(pdev, 0, &display->ahb_len); 1303 + if (IS_ERR(display->ahb_base)) 1304 + return PTR_ERR(display->ahb_base); 1305 + 1306 + display->aux_base = msm_dp_ioremap(pdev, 1, &display->aux_len); 1307 + if (IS_ERR(display->aux_base)) { 1308 + if (display->aux_base != ERR_PTR(-EINVAL)) { 1309 + DRM_ERROR("unable to remap aux region: %pe\n", display->aux_base); 1310 + return PTR_ERR(display->aux_base); 1311 + } 1312 + 1313 + /* 1314 + * The initial binding had a single reg, but in order to 1315 + * support variation in the sub-region sizes this was split. 1316 + * msm_dp_ioremap() will fail with -EINVAL here if only a single 1317 + * reg is specified, so fill in the sub-region offsets and 1318 + * lengths based on this single region. 1319 + */ 1320 + if (display->ahb_len < DP_DEFAULT_P0_OFFSET + DP_DEFAULT_P0_SIZE) { 1321 + DRM_ERROR("legacy memory region not large enough\n"); 1322 + return -EINVAL; 1323 + } 1324 + 1325 + display->ahb_len = DP_DEFAULT_AHB_SIZE; 1326 + display->aux_base = display->ahb_base + DP_DEFAULT_AUX_OFFSET; 1327 + display->aux_len = DP_DEFAULT_AUX_SIZE; 1328 + display->link_base = display->ahb_base + DP_DEFAULT_LINK_OFFSET; 1329 + display->link_len = DP_DEFAULT_LINK_SIZE; 1330 + display->p0_base = display->ahb_base + DP_DEFAULT_P0_OFFSET; 1331 + display->p0_len = DP_DEFAULT_P0_SIZE; 1332 + 1333 + return 0; 1334 + } 1335 + 1336 + display->link_base = msm_dp_ioremap(pdev, 2, &display->link_len); 1337 + if (IS_ERR(display->link_base)) { 1338 + DRM_ERROR("unable to remap link region: %pe\n", display->link_base); 1339 + return PTR_ERR(display->link_base); 1340 + } 1341 + 1342 + display->p0_base = msm_dp_ioremap(pdev, 3, &display->p0_len); 1343 + if (IS_ERR(display->p0_base)) { 1344 + DRM_ERROR("unable to remap p0 region: %pe\n", display->p0_base); 1345 + return PTR_ERR(display->p0_base); 1346 + } 1347 + 1348 + return 0; 1349 + } 1350 + 1282 1351 static int msm_dp_display_probe(struct platform_device *pdev) 1283 1352 { 1284 1353 int rc = 0; ··· 1378 1299 dp->wide_bus_supported = desc->wide_bus_supported; 1379 1300 dp->msm_dp_display.is_edp = 1380 1301 (dp->msm_dp_display.connector_type == DRM_MODE_CONNECTOR_eDP); 1302 + 1303 + rc = msm_dp_display_get_io(dp); 1304 + if (rc) 1305 + return rc; 1381 1306 1382 1307 rc = msm_dp_init_sub_modules(dp); 1383 1308 if (rc) { ··· 1727 1644 1728 1645 /* populate wide_bus_support to different layers */ 1729 1646 msm_dp_display->ctrl->wide_bus_en = 1730 - msm_dp_display->msm_dp_mode.out_fmt_is_yuv_420 ? false : msm_dp_display->wide_bus_supported; 1731 - msm_dp_display->catalog->wide_bus_en = 1732 1647 msm_dp_display->msm_dp_mode.out_fmt_is_yuv_420 ? false : msm_dp_display->wide_bus_supported; 1733 1648 } 1734 1649
+1
drivers/gpu/drm/msm/dp/dp_link.c
··· 5 5 6 6 #define pr_fmt(fmt) "[drm-dp] %s: " fmt, __func__ 7 7 8 + #include <drm/drm_device.h> 8 9 #include <drm/drm_print.h> 9 10 10 11 #include "dp_reg.h"
+93 -62
drivers/gpu/drm/msm/dp/dp_panel.c
··· 23 23 struct msm_dp_panel msm_dp_panel; 24 24 struct drm_dp_aux *aux; 25 25 struct msm_dp_link *link; 26 - struct msm_dp_catalog *catalog; 26 + void __iomem *link_base; 27 + void __iomem *p0_base; 27 28 bool panel_on; 28 29 }; 30 + 31 + static inline u32 msm_dp_read_link(struct msm_dp_panel_private *panel, u32 offset) 32 + { 33 + return readl_relaxed(panel->link_base + offset); 34 + } 35 + 36 + static inline void msm_dp_write_link(struct msm_dp_panel_private *panel, 37 + u32 offset, u32 data) 38 + { 39 + /* 40 + * To make sure link reg writes happens before any other operation, 41 + * this function uses writel() instread of writel_relaxed() 42 + */ 43 + writel(data, panel->link_base + offset); 44 + } 45 + 46 + static inline void msm_dp_write_p0(struct msm_dp_panel_private *panel, 47 + u32 offset, u32 data) 48 + { 49 + /* 50 + * To make sure interface reg writes happens before any other operation, 51 + * this function uses writel() instread of writel_relaxed() 52 + */ 53 + writel(data, panel->p0_base + offset); 54 + } 55 + 56 + static inline u32 msm_dp_read_p0(struct msm_dp_panel_private *panel, 57 + u32 offset) 58 + { 59 + /* 60 + * To make sure interface reg writes happens before any other operation, 61 + * this function uses writel() instread of writel_relaxed() 62 + */ 63 + return readl_relaxed(panel->p0_base + offset); 64 + } 29 65 30 66 static void msm_dp_panel_read_psr_cap(struct msm_dp_panel_private *panel) 31 67 { ··· 296 260 { 297 261 struct msm_dp_panel_private *panel = 298 262 container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_panel); 299 - struct msm_dp_catalog *catalog = panel->catalog; 300 263 u32 hsync_period, vsync_period; 301 264 u32 display_v_start, display_v_end; 302 265 u32 hsync_start_x, hsync_end_x; ··· 327 292 display_hctl = (hsync_end_x << 16) | hsync_start_x; 328 293 329 294 330 - msm_dp_write_p0(catalog, MMSS_DP_INTF_HSYNC_CTL, hsync_ctl); 331 - msm_dp_write_p0(catalog, MMSS_DP_INTF_VSYNC_PERIOD_F0, vsync_period * 295 + msm_dp_write_p0(panel, MMSS_DP_INTF_HSYNC_CTL, hsync_ctl); 296 + msm_dp_write_p0(panel, MMSS_DP_INTF_VSYNC_PERIOD_F0, vsync_period * 332 297 hsync_period); 333 - msm_dp_write_p0(catalog, MMSS_DP_INTF_VSYNC_PULSE_WIDTH_F0, v_sync_width * 298 + msm_dp_write_p0(panel, MMSS_DP_INTF_VSYNC_PULSE_WIDTH_F0, v_sync_width * 334 299 hsync_period); 335 - msm_dp_write_p0(catalog, MMSS_DP_INTF_VSYNC_PERIOD_F1, 0); 336 - msm_dp_write_p0(catalog, MMSS_DP_INTF_VSYNC_PULSE_WIDTH_F1, 0); 337 - msm_dp_write_p0(catalog, MMSS_DP_INTF_DISPLAY_HCTL, display_hctl); 338 - msm_dp_write_p0(catalog, MMSS_DP_INTF_ACTIVE_HCTL, 0); 339 - msm_dp_write_p0(catalog, MMSS_INTF_DISPLAY_V_START_F0, display_v_start); 340 - msm_dp_write_p0(catalog, MMSS_DP_INTF_DISPLAY_V_END_F0, display_v_end); 341 - msm_dp_write_p0(catalog, MMSS_INTF_DISPLAY_V_START_F1, 0); 342 - msm_dp_write_p0(catalog, MMSS_DP_INTF_DISPLAY_V_END_F1, 0); 343 - msm_dp_write_p0(catalog, MMSS_DP_INTF_ACTIVE_V_START_F0, 0); 344 - msm_dp_write_p0(catalog, MMSS_DP_INTF_ACTIVE_V_END_F0, 0); 345 - msm_dp_write_p0(catalog, MMSS_DP_INTF_ACTIVE_V_START_F1, 0); 346 - msm_dp_write_p0(catalog, MMSS_DP_INTF_ACTIVE_V_END_F1, 0); 347 - msm_dp_write_p0(catalog, MMSS_DP_INTF_POLARITY_CTL, 0); 300 + msm_dp_write_p0(panel, MMSS_DP_INTF_VSYNC_PERIOD_F1, 0); 301 + msm_dp_write_p0(panel, MMSS_DP_INTF_VSYNC_PULSE_WIDTH_F1, 0); 302 + msm_dp_write_p0(panel, MMSS_DP_INTF_DISPLAY_HCTL, display_hctl); 303 + msm_dp_write_p0(panel, MMSS_DP_INTF_ACTIVE_HCTL, 0); 304 + msm_dp_write_p0(panel, MMSS_INTF_DISPLAY_V_START_F0, display_v_start); 305 + msm_dp_write_p0(panel, MMSS_DP_INTF_DISPLAY_V_END_F0, display_v_end); 306 + msm_dp_write_p0(panel, MMSS_INTF_DISPLAY_V_START_F1, 0); 307 + msm_dp_write_p0(panel, MMSS_DP_INTF_DISPLAY_V_END_F1, 0); 308 + msm_dp_write_p0(panel, MMSS_DP_INTF_ACTIVE_V_START_F0, 0); 309 + msm_dp_write_p0(panel, MMSS_DP_INTF_ACTIVE_V_END_F0, 0); 310 + msm_dp_write_p0(panel, MMSS_DP_INTF_ACTIVE_V_START_F1, 0); 311 + msm_dp_write_p0(panel, MMSS_DP_INTF_ACTIVE_V_END_F1, 0); 312 + msm_dp_write_p0(panel, MMSS_DP_INTF_POLARITY_CTL, 0); 348 313 349 - msm_dp_write_p0(catalog, MMSS_DP_TPG_MAIN_CONTROL, 314 + msm_dp_write_p0(panel, MMSS_DP_TPG_MAIN_CONTROL, 350 315 DP_TPG_CHECKERED_RECT_PATTERN); 351 - msm_dp_write_p0(catalog, MMSS_DP_TPG_VIDEO_CONFIG, 316 + msm_dp_write_p0(panel, MMSS_DP_TPG_VIDEO_CONFIG, 352 317 DP_TPG_VIDEO_CONFIG_BPP_8BIT | 353 318 DP_TPG_VIDEO_CONFIG_RGB); 354 - msm_dp_write_p0(catalog, MMSS_DP_BIST_ENABLE, 319 + msm_dp_write_p0(panel, MMSS_DP_BIST_ENABLE, 355 320 DP_BIST_ENABLE_DPBIST_EN); 356 - msm_dp_write_p0(catalog, MMSS_DP_TIMING_ENGINE_EN, 321 + msm_dp_write_p0(panel, MMSS_DP_TIMING_ENGINE_EN, 357 322 DP_TIMING_ENGINE_EN_EN); 358 323 drm_dbg_dp(panel->drm_dev, "%s: enabled tpg\n", __func__); 359 324 } ··· 362 327 { 363 328 struct msm_dp_panel_private *panel = 364 329 container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_panel); 365 - struct msm_dp_catalog *catalog = panel->catalog; 366 330 367 - msm_dp_write_p0(catalog, MMSS_DP_TPG_MAIN_CONTROL, 0x0); 368 - msm_dp_write_p0(catalog, MMSS_DP_BIST_ENABLE, 0x0); 369 - msm_dp_write_p0(catalog, MMSS_DP_TIMING_ENGINE_EN, 0x0); 331 + msm_dp_write_p0(panel, MMSS_DP_TPG_MAIN_CONTROL, 0x0); 332 + msm_dp_write_p0(panel, MMSS_DP_BIST_ENABLE, 0x0); 333 + msm_dp_write_p0(panel, MMSS_DP_TIMING_ENGINE_EN, 0x0); 370 334 } 371 335 372 336 void msm_dp_panel_tpg_config(struct msm_dp_panel *msm_dp_panel, bool enable) ··· 398 364 { 399 365 struct msm_dp_panel_private *panel = 400 366 container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_panel); 401 - struct msm_dp_catalog *catalog = panel->catalog; 402 367 403 - msm_dp_write_p0(catalog, MMSS_DP_DSC_DTO, 0x0); 368 + msm_dp_write_p0(panel, MMSS_DP_DSC_DTO, 0x0); 404 369 } 405 370 406 371 static void msm_dp_panel_send_vsc_sdp(struct msm_dp_panel_private *panel, struct dp_sdp *vsc_sdp) 407 372 { 408 - struct msm_dp_catalog *msm_dp_catalog = panel->catalog; 409 373 u32 header[2]; 410 374 u32 val; 411 375 int i; 412 376 413 377 msm_dp_utils_pack_sdp_header(&vsc_sdp->sdp_header, header); 414 378 415 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_GENERIC0_0, header[0]); 416 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_GENERIC0_1, header[1]); 379 + msm_dp_write_link(panel, MMSS_DP_GENERIC0_0, header[0]); 380 + msm_dp_write_link(panel, MMSS_DP_GENERIC0_1, header[1]); 417 381 418 382 for (i = 0; i < sizeof(vsc_sdp->db); i += 4) { 419 383 val = ((vsc_sdp->db[i]) | (vsc_sdp->db[i + 1] << 8) | (vsc_sdp->db[i + 2] << 16) | 420 384 (vsc_sdp->db[i + 3] << 24)); 421 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_GENERIC0_2 + i, val); 385 + msm_dp_write_link(panel, MMSS_DP_GENERIC0_2 + i, val); 422 386 } 423 387 } 424 388 ··· 426 394 427 395 if (hw_revision >= DP_HW_VERSION_1_0 && 428 396 hw_revision < DP_HW_VERSION_1_2) { 429 - msm_dp_write_link(panel->catalog, MMSS_DP_SDP_CFG3, UPDATE_SDP); 430 - msm_dp_write_link(panel->catalog, MMSS_DP_SDP_CFG3, 0x0); 397 + msm_dp_write_link(panel, MMSS_DP_SDP_CFG3, UPDATE_SDP); 398 + msm_dp_write_link(panel, MMSS_DP_SDP_CFG3, 0x0); 431 399 } 432 400 } 433 401 ··· 435 403 { 436 404 struct msm_dp_panel_private *panel = 437 405 container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_panel); 438 - struct msm_dp_catalog *msm_dp_catalog = panel->catalog; 439 406 u32 cfg, cfg2, misc; 440 407 441 - cfg = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG); 442 - cfg2 = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG2); 443 - misc = msm_dp_read_link(msm_dp_catalog, REG_DP_MISC1_MISC0); 408 + cfg = msm_dp_read_link(panel, MMSS_DP_SDP_CFG); 409 + cfg2 = msm_dp_read_link(panel, MMSS_DP_SDP_CFG2); 410 + misc = msm_dp_read_link(panel, REG_DP_MISC1_MISC0); 444 411 445 412 cfg |= GEN0_SDP_EN; 446 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG, cfg); 413 + msm_dp_write_link(panel, MMSS_DP_SDP_CFG, cfg); 447 414 448 415 cfg2 |= GENERIC0_SDPSIZE_VALID; 449 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG2, cfg2); 416 + msm_dp_write_link(panel, MMSS_DP_SDP_CFG2, cfg2); 450 417 451 418 msm_dp_panel_send_vsc_sdp(panel, vsc_sdp); 452 419 ··· 455 424 drm_dbg_dp(panel->drm_dev, "vsc sdp enable=1\n"); 456 425 457 426 pr_debug("misc settings = 0x%x\n", misc); 458 - msm_dp_write_link(msm_dp_catalog, REG_DP_MISC1_MISC0, misc); 427 + msm_dp_write_link(panel, REG_DP_MISC1_MISC0, misc); 459 428 460 429 msm_dp_panel_update_sdp(panel); 461 430 } ··· 464 433 { 465 434 struct msm_dp_panel_private *panel = 466 435 container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_panel); 467 - struct msm_dp_catalog *msm_dp_catalog = panel->catalog; 468 436 u32 cfg, cfg2, misc; 469 437 470 - cfg = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG); 471 - cfg2 = msm_dp_read_link(msm_dp_catalog, MMSS_DP_SDP_CFG2); 472 - misc = msm_dp_read_link(msm_dp_catalog, REG_DP_MISC1_MISC0); 438 + cfg = msm_dp_read_link(panel, MMSS_DP_SDP_CFG); 439 + cfg2 = msm_dp_read_link(panel, MMSS_DP_SDP_CFG2); 440 + misc = msm_dp_read_link(panel, REG_DP_MISC1_MISC0); 473 441 474 442 cfg &= ~GEN0_SDP_EN; 475 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG, cfg); 443 + msm_dp_write_link(panel, MMSS_DP_SDP_CFG, cfg); 476 444 477 445 cfg2 &= ~GENERIC0_SDPSIZE_VALID; 478 - msm_dp_write_link(msm_dp_catalog, MMSS_DP_SDP_CFG2, cfg2); 446 + msm_dp_write_link(panel, MMSS_DP_SDP_CFG2, cfg2); 479 447 480 448 /* switch back to MSA */ 481 449 misc &= ~DP_MISC1_VSC_SDP; ··· 482 452 drm_dbg_dp(panel->drm_dev, "vsc sdp enable=0\n"); 483 453 484 454 pr_debug("misc settings = 0x%x\n", misc); 485 - msm_dp_write_link(msm_dp_catalog, REG_DP_MISC1_MISC0, misc); 455 + msm_dp_write_link(panel, REG_DP_MISC1_MISC0, misc); 486 456 487 457 msm_dp_panel_update_sdp(panel); 488 458 } ··· 530 500 return 0; 531 501 } 532 502 533 - int msm_dp_panel_timing_cfg(struct msm_dp_panel *msm_dp_panel) 503 + int msm_dp_panel_timing_cfg(struct msm_dp_panel *msm_dp_panel, bool wide_bus_en) 534 504 { 535 505 u32 data, total_ver, total_hor; 536 - struct msm_dp_catalog *catalog; 537 506 struct msm_dp_panel_private *panel; 538 507 struct drm_display_mode *drm_mode; 539 508 u32 width_blanking; ··· 542 513 u32 reg; 543 514 544 515 panel = container_of(msm_dp_panel, struct msm_dp_panel_private, msm_dp_panel); 545 - catalog = panel->catalog; 546 516 drm_mode = &panel->msm_dp_panel.msm_dp_mode.drm_mode; 547 517 548 518 drm_dbg_dp(panel->drm_dev, "width=%d hporch= %d %d %d\n", ··· 584 556 585 557 msm_dp_active = data; 586 558 587 - msm_dp_write_link(catalog, REG_DP_TOTAL_HOR_VER, total); 588 - msm_dp_write_link(catalog, REG_DP_START_HOR_VER_FROM_SYNC, sync_start); 589 - msm_dp_write_link(catalog, REG_DP_HSYNC_VSYNC_WIDTH_POLARITY, width_blanking); 590 - msm_dp_write_link(catalog, REG_DP_ACTIVE_HOR_VER, msm_dp_active); 559 + msm_dp_write_link(panel, REG_DP_TOTAL_HOR_VER, total); 560 + msm_dp_write_link(panel, REG_DP_START_HOR_VER_FROM_SYNC, sync_start); 561 + msm_dp_write_link(panel, REG_DP_HSYNC_VSYNC_WIDTH_POLARITY, width_blanking); 562 + msm_dp_write_link(panel, REG_DP_ACTIVE_HOR_VER, msm_dp_active); 591 563 592 - reg = msm_dp_read_p0(catalog, MMSS_DP_INTF_CONFIG); 593 - if (catalog->wide_bus_en) 564 + reg = msm_dp_read_p0(panel, MMSS_DP_INTF_CONFIG); 565 + if (wide_bus_en) 594 566 reg |= DP_INTF_CONFIG_DATABUS_WIDEN; 595 567 else 596 568 reg &= ~DP_INTF_CONFIG_DATABUS_WIDEN; 597 569 598 - drm_dbg_dp(panel->drm_dev, "wide_bus_en=%d reg=%#x\n", catalog->wide_bus_en, reg); 570 + drm_dbg_dp(panel->drm_dev, "wide_bus_en=%d reg=%#x\n", wide_bus_en, reg); 599 571 600 - msm_dp_write_p0(catalog, MMSS_DP_INTF_CONFIG, reg); 572 + msm_dp_write_p0(panel, MMSS_DP_INTF_CONFIG, reg); 601 573 602 574 if (msm_dp_panel->msm_dp_mode.out_fmt_is_yuv_420) 603 575 msm_dp_panel_setup_vsc_sdp_yuv_420(msm_dp_panel); ··· 701 673 } 702 674 703 675 struct msm_dp_panel *msm_dp_panel_get(struct device *dev, struct drm_dp_aux *aux, 704 - struct msm_dp_link *link, struct msm_dp_catalog *catalog) 676 + struct msm_dp_link *link, 677 + void __iomem *link_base, 678 + void __iomem *p0_base) 705 679 { 706 680 struct msm_dp_panel_private *panel; 707 681 struct msm_dp_panel *msm_dp_panel; 708 682 int ret; 709 683 710 - if (!dev || !catalog || !aux || !link) { 684 + if (!dev || !aux || !link) { 711 685 DRM_ERROR("invalid input\n"); 712 686 return ERR_PTR(-EINVAL); 713 687 } ··· 720 690 721 691 panel->dev = dev; 722 692 panel->aux = aux; 723 - panel->catalog = catalog; 724 693 panel->link = link; 694 + panel->link_base = link_base; 695 + panel->p0_base = p0_base; 725 696 726 697 msm_dp_panel = &panel->msm_dp_panel; 727 698 msm_dp_panel->max_bw_code = DP_LINK_BW_8_1;
+5 -2
drivers/gpu/drm/msm/dp/dp_panel.h
··· 6 6 #ifndef _DP_PANEL_H_ 7 7 #define _DP_PANEL_H_ 8 8 9 + #include <drm/drm_modes.h> 9 10 #include <drm/msm_drm.h> 10 11 11 12 #include "dp_aux.h" ··· 49 48 50 49 int msm_dp_panel_init_panel_info(struct msm_dp_panel *msm_dp_panel); 51 50 int msm_dp_panel_deinit(struct msm_dp_panel *msm_dp_panel); 52 - int msm_dp_panel_timing_cfg(struct msm_dp_panel *msm_dp_panel); 51 + int msm_dp_panel_timing_cfg(struct msm_dp_panel *msm_dp_panel, bool wide_bus_en); 53 52 int msm_dp_panel_read_sink_caps(struct msm_dp_panel *msm_dp_panel, 54 53 struct drm_connector *connector); 55 54 u32 msm_dp_panel_get_mode_bpp(struct msm_dp_panel *msm_dp_panel, u32 mode_max_bpp, ··· 92 91 } 93 92 94 93 struct msm_dp_panel *msm_dp_panel_get(struct device *dev, struct drm_dp_aux *aux, 95 - struct msm_dp_link *link, struct msm_dp_catalog *catalog); 94 + struct msm_dp_link *link, 95 + void __iomem *link_base, 96 + void __iomem *p0_base); 96 97 void msm_dp_panel_put(struct msm_dp_panel *msm_dp_panel); 97 98 #endif /* _DP_PANEL_H_ */
+2
drivers/gpu/drm/msm/dp/dp_reg.h
··· 11 11 12 12 /* DP_TX Registers */ 13 13 #define REG_DP_HW_VERSION (0x00000000) 14 + #define DP_HW_VERSION_1_0 0x10000000 15 + #define DP_HW_VERSION_1_2 0x10020000 14 16 15 17 #define REG_DP_SW_RESET (0x00000010) 16 18 #define DP_SW_RESET (0x00000001)