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

Merge branch 'msm-next' of git://people.freedesktop.org/~robclark/linux into drm-next

Big ticket items are hdmi support for 8996 (aka snapdragon 820), and
adreno 430 support. Also one more small uapi addition to support
timestamp queries.

* 'msm-next' of git://people.freedesktop.org/~robclark/linux: (29 commits)
drm/msm: rename hdmi symbols
drm/msm/adreno: remove duplicate adreno_hw_init() call
drm/msm: add timestamp param
drm/msm: fix small typo
drm/msm: grab struct_mutex after allocating submit
drm/msm: reject submit ioctl if no gpu
drm/msm/adreno: print details in case of a protect fault interrupt
drm/msm/adreno: get CP_RPTR from register instead of shadow memory
drm/msm/adreno: add adreno430 power control
drm/msm/adreno: support for adreno 430.
drm/msm: update generated headers
drm/msm/dsi: fix definition of msm_dsi_pll_28nm_8960_init()
drm/msm/dsi: Parse DSI lanes via DT
drm/msm/dsi: Drop VDD regulator for MSM8916
drm/msm/dsi: Remove incorrect warning on host attach
drm/msm: Free fb helper resources in msm_unload
drm/msm/mdp: Detach iommu in mdp4_destroy
drm/msm: make iommu port names const'ier
drm/msm/mdp: Use atomic helper to set crtc property
dt-bindings: msm/hdmi: Add HDMI PHY bindings
...

+4632 -1336
+29 -3
Documentation/devicetree/bindings/display/msm/dsi.txt
··· 44 44 - pinctrl-names: the pin control state names; should contain "default" 45 45 - pinctrl-0: the default pinctrl state (active) 46 46 - pinctrl-n: the "sleep" pinctrl state 47 - - port: DSI controller output port. This contains one endpoint subnode, with its 48 - remote-endpoint set to the phandle of the connected panel's endpoint. 49 - See Documentation/devicetree/bindings/graph.txt for device graph info. 47 + - port: DSI controller output port, containing one endpoint subnode. 48 + 49 + DSI Endpoint properties: 50 + - remote-endpoint: set to phandle of the connected panel's endpoint. 51 + See Documentation/devicetree/bindings/graph.txt for device graph info. 52 + - qcom,data-lane-map: this describes how the logical DSI lanes are mapped 53 + to the physical lanes on the given platform. The value contained in 54 + index n describes what logical data lane is mapped to the physical data 55 + lane n (DATAn, where n lies between 0 and 3). 56 + 57 + For example: 58 + 59 + qcom,data-lane-map = <3 0 1 2>; 60 + 61 + The above mapping describes that the logical data lane DATA3 is mapped to 62 + the physical data lane DATA0, logical DATA0 to physical DATA1, logic DATA1 63 + to phys DATA2 and logic DATA2 to phys DATA3. 64 + 65 + There are only a limited number of physical to logical mappings possible: 66 + 67 + "0123": Logic 0->Phys 0; Logic 1->Phys 1; Logic 2->Phys 2; Logic 3->Phys 3; 68 + "3012": Logic 3->Phys 0; Logic 0->Phys 1; Logic 1->Phys 2; Logic 2->Phys 3; 69 + "2301": Logic 2->Phys 0; Logic 3->Phys 1; Logic 0->Phys 2; Logic 1->Phys 3; 70 + "1230": Logic 1->Phys 0; Logic 2->Phys 1; Logic 3->Phys 2; Logic 0->Phys 3; 71 + "0321": Logic 0->Phys 0; Logic 3->Phys 1; Logic 2->Phys 2; Logic 1->Phys 3; 72 + "1032": Logic 1->Phys 0; Logic 0->Phys 1; Logic 3->Phys 2; Logic 2->Phys 3; 73 + "2103": Logic 2->Phys 0; Logic 1->Phys 1; Logic 0->Phys 2; Logic 3->Phys 3; 74 + "3210": Logic 3->Phys 0; Logic 2->Phys 1; Logic 1->Phys 2; Logic 0->Phys 3; 50 75 51 76 DSI PHY: 52 77 Required properties: ··· 156 131 port { 157 132 dsi0_out: endpoint { 158 133 remote-endpoint = <&panel_in>; 134 + lanes = <0 1 2 3>; 159 135 }; 160 136 }; 161 137 };
+44 -2
Documentation/devicetree/bindings/display/msm/hdmi.txt
··· 11 11 - reg: Physical base address and length of the controller's registers 12 12 - reg-names: "core_physical" 13 13 - interrupts: The interrupt signal from the hdmi block. 14 + - power-domains: Should be <&mmcc MDSS_GDSC>. 14 15 - clocks: device clocks 15 16 See ../clocks/clock-bindings.txt for details. 16 17 - qcom,hdmi-tx-ddc-clk-gpio: ddc clk pin ··· 19 18 - qcom,hdmi-tx-hpd-gpio: hpd pin 20 19 - core-vdda-supply: phandle to supply regulator 21 20 - hdmi-mux-supply: phandle to mux regulator 21 + - phys: the phandle for the HDMI PHY device 22 + - phy-names: the name of the corresponding PHY device 22 23 23 24 Optional properties: 24 25 - qcom,hdmi-tx-mux-en-gpio: hdmi mux enable pin ··· 30 27 - pinctrl-0: the default pinctrl state (active) 31 28 - pinctrl-1: the "sleep" pinctrl state 32 29 30 + HDMI PHY: 31 + Required properties: 32 + - compatible: Could be the following 33 + * "qcom,hdmi-phy-8660" 34 + * "qcom,hdmi-phy-8960" 35 + * "qcom,hdmi-phy-8974" 36 + * "qcom,hdmi-phy-8084" 37 + * "qcom,hdmi-phy-8996" 38 + - #phy-cells: Number of cells in a PHY specifier; Should be 0. 39 + - reg: Physical base address and length of the registers of the PHY sub blocks. 40 + - reg-names: The names of register regions. The following regions are required: 41 + * "hdmi_phy" 42 + * "hdmi_pll" 43 + For HDMI PHY on msm8996, these additional register regions are required: 44 + * "hdmi_tx_l0" 45 + * "hdmi_tx_l1" 46 + * "hdmi_tx_l3" 47 + * "hdmi_tx_l4" 48 + - power-domains: Should be <&mmcc MDSS_GDSC>. 49 + - clocks: device clocks 50 + See Documentation/devicetree/bindings/clocks/clock-bindings.txt for details. 51 + - core-vdda-supply: phandle to vdda regulator device node 52 + 33 53 Example: 34 54 35 55 / { 36 56 ... 37 57 38 - hdmi: qcom,hdmi-tx-8960@4a00000 { 58 + hdmi: hdmi@4a00000 { 39 59 compatible = "qcom,hdmi-tx-8960"; 40 60 reg-names = "core_physical"; 41 - reg = <0x04a00000 0x1000>; 61 + reg = <0x04a00000 0x2f0>; 42 62 interrupts = <GIC_SPI 79 0>; 43 63 power-domains = <&mmcc MDSS_GDSC>; 44 64 clock-names = ··· 80 54 pinctrl-names = "default", "sleep"; 81 55 pinctrl-0 = <&hpd_active &ddc_active &cec_active>; 82 56 pinctrl-1 = <&hpd_suspend &ddc_suspend &cec_suspend>; 57 + 58 + phys = <&hdmi_phy>; 59 + phy-names = "hdmi_phy"; 60 + }; 61 + 62 + hdmi_phy: phy@4a00400 { 63 + compatible = "qcom,hdmi-phy-8960"; 64 + reg-names = "hdmi_phy", 65 + "hdmi_pll"; 66 + reg = <0x4a00400 0x60>, 67 + <0x4a00500 0x100>; 68 + #phy-cells = <0>; 69 + power-domains = <&mmcc MDSS_GDSC>; 70 + clock-names = "slave_iface_clk"; 71 + clocks = <&mmcc HDMI_S_AHB_CLK>; 72 + core-vdda-supply = <&pm8921_hdmi_mvs>; 83 73 }; 84 74 };
+3
drivers/gpu/drm/msm/Makefile
··· 12 12 hdmi/hdmi_connector.o \ 13 13 hdmi/hdmi_hdcp.o \ 14 14 hdmi/hdmi_i2c.o \ 15 + hdmi/hdmi_phy.o \ 15 16 hdmi/hdmi_phy_8960.o \ 16 17 hdmi/hdmi_phy_8x60.o \ 17 18 hdmi/hdmi_phy_8x74.o \ ··· 53 52 54 53 msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o 55 54 msm-$(CONFIG_COMMON_CLK) += mdp/mdp4/mdp4_lvds_pll.o 55 + msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_pll_8960.o 56 + msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_phy_8996.o 56 57 57 58 msm-$(CONFIG_DRM_MSM_DSI) += dsi/dsi.o \ 58 59 mdp/mdp4/mdp4_dsi_encoder.o \
+6 -5
drivers/gpu/drm/msm/adreno/a2xx.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/adreno.xml ( 398 bytes, from 2015-09-24 17:25:31) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml ( 32901 bytes, from 2015-05-20 20:03:14) 14 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 10755 bytes, from 2015-09-14 20:46:55) 15 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 14968 bytes, from 2015-05-20 20:12:27) 16 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 67771 bytes, from 2015-09-14 20:46:55) 17 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 63970 bytes, from 2015-09-14 20:50:12) 14 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 11518 bytes, from 2016-02-10 21:03:25) 15 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 16166 bytes, from 2016-02-11 21:20:31) 16 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 83967 bytes, from 2016-02-10 17:07:21) 17 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 109916 bytes, from 2016-02-20 18:44:48) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml ( 1773 bytes, from 2015-09-24 17:30:00) 19 19 20 20 Copyright (C) 2013-2015 by the following authors: 21 21 - Rob Clark <robdclark@gmail.com> (robclark) 22 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 22 23 23 24 Permission is hereby granted, free of charge, to any person obtaining 24 25 a copy of this software and associated documentation files (the
+432 -69
drivers/gpu/drm/msm/adreno/a3xx.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/adreno.xml ( 398 bytes, from 2015-09-24 17:25:31) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml ( 32901 bytes, from 2015-05-20 20:03:14) 14 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 10755 bytes, from 2015-09-14 20:46:55) 15 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 14968 bytes, from 2015-05-20 20:12:27) 16 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 67771 bytes, from 2015-09-14 20:46:55) 17 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 63970 bytes, from 2015-09-14 20:50:12) 14 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 11518 bytes, from 2016-02-10 21:03:25) 15 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 16166 bytes, from 2016-02-11 21:20:31) 16 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 83967 bytes, from 2016-02-10 17:07:21) 17 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 109916 bytes, from 2016-02-20 18:44:48) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml ( 1773 bytes, from 2015-09-24 17:30:00) 19 19 20 - Copyright (C) 2013-2015 by the following authors: 20 + Copyright (C) 2013-2016 by the following authors: 21 21 - Rob Clark <robdclark@gmail.com> (robclark) 22 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 22 23 23 24 Permission is hereby granted, free of charge, to any person obtaining 24 25 a copy of this software and associated documentation files (the ··· 112 111 VFMT_8_8_SNORM = 53, 113 112 VFMT_8_8_8_SNORM = 54, 114 113 VFMT_8_8_8_8_SNORM = 55, 115 - VFMT_10_10_10_2_UINT = 60, 116 - VFMT_10_10_10_2_UNORM = 61, 117 - VFMT_10_10_10_2_SINT = 62, 118 - VFMT_10_10_10_2_SNORM = 63, 114 + VFMT_10_10_10_2_UINT = 56, 115 + VFMT_10_10_10_2_UNORM = 57, 116 + VFMT_10_10_10_2_SINT = 58, 117 + VFMT_10_10_10_2_SNORM = 59, 118 + VFMT_2_10_10_10_UINT = 60, 119 + VFMT_2_10_10_10_UNORM = 61, 120 + VFMT_2_10_10_10_SINT = 62, 121 + VFMT_2_10_10_10_SNORM = 63, 119 122 }; 120 123 121 124 enum a3xx_tex_fmt { ··· 143 138 TFMT_DXT1 = 36, 144 139 TFMT_DXT3 = 37, 145 140 TFMT_DXT5 = 38, 141 + TFMT_2_10_10_10_UNORM = 40, 146 142 TFMT_10_10_10_2_UNORM = 41, 147 143 TFMT_9_9_9_E5_FLOAT = 42, 148 144 TFMT_11_11_10_FLOAT = 43, 149 145 TFMT_A8_UNORM = 44, 146 + TFMT_L8_UNORM = 45, 150 147 TFMT_L8_A8_UNORM = 47, 151 148 TFMT_8_UNORM = 48, 152 149 TFMT_8_8_UNORM = 49, ··· 190 183 TFMT_32_SINT = 92, 191 184 TFMT_32_32_SINT = 93, 192 185 TFMT_32_32_32_32_SINT = 95, 186 + TFMT_2_10_10_10_UINT = 96, 187 + TFMT_10_10_10_2_UINT = 97, 193 188 TFMT_ETC2_RG11_SNORM = 112, 194 189 TFMT_ETC2_RG11_UNORM = 113, 195 190 TFMT_ETC2_R11_SNORM = 114, ··· 224 215 RB_R8_UINT = 14, 225 216 RB_R8_SINT = 15, 226 217 RB_R10G10B10A2_UNORM = 16, 218 + RB_A2R10G10B10_UNORM = 17, 219 + RB_R10G10B10A2_UINT = 18, 220 + RB_A2R10G10B10_UINT = 19, 227 221 RB_A8_UNORM = 20, 228 222 RB_R8_UNORM = 21, 229 223 RB_R16_FLOAT = 24, ··· 256 244 RB_R32G32B32A32_UINT = 59, 257 245 }; 258 246 259 - enum a3xx_sp_perfcounter_select { 260 - SP_FS_CFLOW_INSTRUCTIONS = 12, 261 - SP_FS_FULL_ALU_INSTRUCTIONS = 14, 262 - SP0_ICL1_MISSES = 26, 263 - SP_ALU_ACTIVE_CYCLES = 29, 247 + enum a3xx_cp_perfcounter_select { 248 + CP_ALWAYS_COUNT = 0, 249 + CP_AHB_PFPTRANS_WAIT = 3, 250 + CP_AHB_NRTTRANS_WAIT = 6, 251 + CP_CSF_NRT_READ_WAIT = 8, 252 + CP_CSF_I1_FIFO_FULL = 9, 253 + CP_CSF_I2_FIFO_FULL = 10, 254 + CP_CSF_ST_FIFO_FULL = 11, 255 + CP_RESERVED_12 = 12, 256 + CP_CSF_RING_ROQ_FULL = 13, 257 + CP_CSF_I1_ROQ_FULL = 14, 258 + CP_CSF_I2_ROQ_FULL = 15, 259 + CP_CSF_ST_ROQ_FULL = 16, 260 + CP_RESERVED_17 = 17, 261 + CP_MIU_TAG_MEM_FULL = 18, 262 + CP_MIU_NRT_WRITE_STALLED = 22, 263 + CP_MIU_NRT_READ_STALLED = 23, 264 + CP_ME_REGS_RB_DONE_FIFO_FULL = 26, 265 + CP_ME_REGS_VS_EVENT_FIFO_FULL = 27, 266 + CP_ME_REGS_PS_EVENT_FIFO_FULL = 28, 267 + CP_ME_REGS_CF_EVENT_FIFO_FULL = 29, 268 + CP_ME_MICRO_RB_STARVED = 30, 269 + CP_AHB_RBBM_DWORD_SENT = 40, 270 + CP_ME_BUSY_CLOCKS = 41, 271 + CP_ME_WAIT_CONTEXT_AVAIL = 42, 272 + CP_PFP_TYPE0_PACKET = 43, 273 + CP_PFP_TYPE3_PACKET = 44, 274 + CP_CSF_RB_WPTR_NEQ_RPTR = 45, 275 + CP_CSF_I1_SIZE_NEQ_ZERO = 46, 276 + CP_CSF_I2_SIZE_NEQ_ZERO = 47, 277 + CP_CSF_RBI1I2_FETCHING = 48, 264 278 }; 265 279 266 - enum a3xx_rop_code { 267 - ROP_CLEAR = 0, 268 - ROP_NOR = 1, 269 - ROP_AND_INVERTED = 2, 270 - ROP_COPY_INVERTED = 3, 271 - ROP_AND_REVERSE = 4, 272 - ROP_INVERT = 5, 273 - ROP_XOR = 6, 274 - ROP_NAND = 7, 275 - ROP_AND = 8, 276 - ROP_EQUIV = 9, 277 - ROP_NOOP = 10, 278 - ROP_OR_INVERTED = 11, 279 - ROP_COPY = 12, 280 - ROP_OR_REVERSE = 13, 281 - ROP_OR = 14, 282 - ROP_SET = 15, 280 + enum a3xx_gras_tse_perfcounter_select { 281 + GRAS_TSEPERF_INPUT_PRIM = 0, 282 + GRAS_TSEPERF_INPUT_NULL_PRIM = 1, 283 + GRAS_TSEPERF_TRIVAL_REJ_PRIM = 2, 284 + GRAS_TSEPERF_CLIPPED_PRIM = 3, 285 + GRAS_TSEPERF_NEW_PRIM = 4, 286 + GRAS_TSEPERF_ZERO_AREA_PRIM = 5, 287 + GRAS_TSEPERF_FACENESS_CULLED_PRIM = 6, 288 + GRAS_TSEPERF_ZERO_PIXEL_PRIM = 7, 289 + GRAS_TSEPERF_OUTPUT_NULL_PRIM = 8, 290 + GRAS_TSEPERF_OUTPUT_VISIBLE_PRIM = 9, 291 + GRAS_TSEPERF_PRE_CLIP_PRIM = 10, 292 + GRAS_TSEPERF_POST_CLIP_PRIM = 11, 293 + GRAS_TSEPERF_WORKING_CYCLES = 12, 294 + GRAS_TSEPERF_PC_STARVE = 13, 295 + GRAS_TSERASPERF_STALL = 14, 296 + }; 297 + 298 + enum a3xx_gras_ras_perfcounter_select { 299 + GRAS_RASPERF_16X16_TILES = 0, 300 + GRAS_RASPERF_8X8_TILES = 1, 301 + GRAS_RASPERF_4X4_TILES = 2, 302 + GRAS_RASPERF_WORKING_CYCLES = 3, 303 + GRAS_RASPERF_STALL_CYCLES_BY_RB = 4, 304 + GRAS_RASPERF_STALL_CYCLES_BY_VSC = 5, 305 + GRAS_RASPERF_STARVE_CYCLES_BY_TSE = 6, 306 + }; 307 + 308 + enum a3xx_hlsq_perfcounter_select { 309 + HLSQ_PERF_SP_VS_CONSTANT = 0, 310 + HLSQ_PERF_SP_VS_INSTRUCTIONS = 1, 311 + HLSQ_PERF_SP_FS_CONSTANT = 2, 312 + HLSQ_PERF_SP_FS_INSTRUCTIONS = 3, 313 + HLSQ_PERF_TP_STATE = 4, 314 + HLSQ_PERF_QUADS = 5, 315 + HLSQ_PERF_PIXELS = 6, 316 + HLSQ_PERF_VERTICES = 7, 317 + HLSQ_PERF_FS8_THREADS = 8, 318 + HLSQ_PERF_FS16_THREADS = 9, 319 + HLSQ_PERF_FS32_THREADS = 10, 320 + HLSQ_PERF_VS8_THREADS = 11, 321 + HLSQ_PERF_VS16_THREADS = 12, 322 + HLSQ_PERF_SP_VS_DATA_BYTES = 13, 323 + HLSQ_PERF_SP_FS_DATA_BYTES = 14, 324 + HLSQ_PERF_ACTIVE_CYCLES = 15, 325 + HLSQ_PERF_STALL_CYCLES_SP_STATE = 16, 326 + HLSQ_PERF_STALL_CYCLES_SP_VS = 17, 327 + HLSQ_PERF_STALL_CYCLES_SP_FS = 18, 328 + HLSQ_PERF_STALL_CYCLES_UCHE = 19, 329 + HLSQ_PERF_RBBM_LOAD_CYCLES = 20, 330 + HLSQ_PERF_DI_TO_VS_START_SP0 = 21, 331 + HLSQ_PERF_DI_TO_FS_START_SP0 = 22, 332 + HLSQ_PERF_VS_START_TO_DONE_SP0 = 23, 333 + HLSQ_PERF_FS_START_TO_DONE_SP0 = 24, 334 + HLSQ_PERF_SP_STATE_COPY_CYCLES_VS = 25, 335 + HLSQ_PERF_SP_STATE_COPY_CYCLES_FS = 26, 336 + HLSQ_PERF_UCHE_LATENCY_CYCLES = 27, 337 + HLSQ_PERF_UCHE_LATENCY_COUNT = 28, 338 + }; 339 + 340 + enum a3xx_pc_perfcounter_select { 341 + PC_PCPERF_VISIBILITY_STREAMS = 0, 342 + PC_PCPERF_TOTAL_INSTANCES = 1, 343 + PC_PCPERF_PRIMITIVES_PC_VPC = 2, 344 + PC_PCPERF_PRIMITIVES_KILLED_BY_VS = 3, 345 + PC_PCPERF_PRIMITIVES_VISIBLE_BY_VS = 4, 346 + PC_PCPERF_DRAWCALLS_KILLED_BY_VS = 5, 347 + PC_PCPERF_DRAWCALLS_VISIBLE_BY_VS = 6, 348 + PC_PCPERF_VERTICES_TO_VFD = 7, 349 + PC_PCPERF_REUSED_VERTICES = 8, 350 + PC_PCPERF_CYCLES_STALLED_BY_VFD = 9, 351 + PC_PCPERF_CYCLES_STALLED_BY_TSE = 10, 352 + PC_PCPERF_CYCLES_STALLED_BY_VBIF = 11, 353 + PC_PCPERF_CYCLES_IS_WORKING = 12, 354 + }; 355 + 356 + enum a3xx_rb_perfcounter_select { 357 + RB_RBPERF_ACTIVE_CYCLES_ANY = 0, 358 + RB_RBPERF_ACTIVE_CYCLES_ALL = 1, 359 + RB_RBPERF_STARVE_CYCLES_BY_SP = 2, 360 + RB_RBPERF_STARVE_CYCLES_BY_RAS = 3, 361 + RB_RBPERF_STARVE_CYCLES_BY_MARB = 4, 362 + RB_RBPERF_STALL_CYCLES_BY_MARB = 5, 363 + RB_RBPERF_STALL_CYCLES_BY_HLSQ = 6, 364 + RB_RBPERF_RB_MARB_DATA = 7, 365 + RB_RBPERF_SP_RB_QUAD = 8, 366 + RB_RBPERF_RAS_EARLY_Z_QUADS = 9, 367 + RB_RBPERF_GMEM_CH0_READ = 10, 368 + RB_RBPERF_GMEM_CH1_READ = 11, 369 + RB_RBPERF_GMEM_CH0_WRITE = 12, 370 + RB_RBPERF_GMEM_CH1_WRITE = 13, 371 + RB_RBPERF_CP_CONTEXT_DONE = 14, 372 + RB_RBPERF_CP_CACHE_FLUSH = 15, 373 + RB_RBPERF_CP_ZPASS_DONE = 16, 374 + }; 375 + 376 + enum a3xx_rbbm_perfcounter_select { 377 + RBBM_ALAWYS_ON = 0, 378 + RBBM_VBIF_BUSY = 1, 379 + RBBM_TSE_BUSY = 2, 380 + RBBM_RAS_BUSY = 3, 381 + RBBM_PC_DCALL_BUSY = 4, 382 + RBBM_PC_VSD_BUSY = 5, 383 + RBBM_VFD_BUSY = 6, 384 + RBBM_VPC_BUSY = 7, 385 + RBBM_UCHE_BUSY = 8, 386 + RBBM_VSC_BUSY = 9, 387 + RBBM_HLSQ_BUSY = 10, 388 + RBBM_ANY_RB_BUSY = 11, 389 + RBBM_ANY_TEX_BUSY = 12, 390 + RBBM_ANY_USP_BUSY = 13, 391 + RBBM_ANY_MARB_BUSY = 14, 392 + RBBM_ANY_ARB_BUSY = 15, 393 + RBBM_AHB_STATUS_BUSY = 16, 394 + RBBM_AHB_STATUS_STALLED = 17, 395 + RBBM_AHB_STATUS_TXFR = 18, 396 + RBBM_AHB_STATUS_TXFR_SPLIT = 19, 397 + RBBM_AHB_STATUS_TXFR_ERROR = 20, 398 + RBBM_AHB_STATUS_LONG_STALL = 21, 399 + RBBM_RBBM_STATUS_MASKED = 22, 400 + }; 401 + 402 + enum a3xx_sp_perfcounter_select { 403 + SP_LM_LOAD_INSTRUCTIONS = 0, 404 + SP_LM_STORE_INSTRUCTIONS = 1, 405 + SP_LM_ATOMICS = 2, 406 + SP_UCHE_LOAD_INSTRUCTIONS = 3, 407 + SP_UCHE_STORE_INSTRUCTIONS = 4, 408 + SP_UCHE_ATOMICS = 5, 409 + SP_VS_TEX_INSTRUCTIONS = 6, 410 + SP_VS_CFLOW_INSTRUCTIONS = 7, 411 + SP_VS_EFU_INSTRUCTIONS = 8, 412 + SP_VS_FULL_ALU_INSTRUCTIONS = 9, 413 + SP_VS_HALF_ALU_INSTRUCTIONS = 10, 414 + SP_FS_TEX_INSTRUCTIONS = 11, 415 + SP_FS_CFLOW_INSTRUCTIONS = 12, 416 + SP_FS_EFU_INSTRUCTIONS = 13, 417 + SP_FS_FULL_ALU_INSTRUCTIONS = 14, 418 + SP_FS_HALF_ALU_INSTRUCTIONS = 15, 419 + SP_FS_BARY_INSTRUCTIONS = 16, 420 + SP_VS_INSTRUCTIONS = 17, 421 + SP_FS_INSTRUCTIONS = 18, 422 + SP_ADDR_LOCK_COUNT = 19, 423 + SP_UCHE_READ_TRANS = 20, 424 + SP_UCHE_WRITE_TRANS = 21, 425 + SP_EXPORT_VPC_TRANS = 22, 426 + SP_EXPORT_RB_TRANS = 23, 427 + SP_PIXELS_KILLED = 24, 428 + SP_ICL1_REQUESTS = 25, 429 + SP_ICL1_MISSES = 26, 430 + SP_ICL0_REQUESTS = 27, 431 + SP_ICL0_MISSES = 28, 432 + SP_ALU_ACTIVE_CYCLES = 29, 433 + SP_EFU_ACTIVE_CYCLES = 30, 434 + SP_STALL_CYCLES_BY_VPC = 31, 435 + SP_STALL_CYCLES_BY_TP = 32, 436 + SP_STALL_CYCLES_BY_UCHE = 33, 437 + SP_STALL_CYCLES_BY_RB = 34, 438 + SP_ACTIVE_CYCLES_ANY = 35, 439 + SP_ACTIVE_CYCLES_ALL = 36, 440 + }; 441 + 442 + enum a3xx_tp_perfcounter_select { 443 + TPL1_TPPERF_L1_REQUESTS = 0, 444 + TPL1_TPPERF_TP0_L1_REQUESTS = 1, 445 + TPL1_TPPERF_TP0_L1_MISSES = 2, 446 + TPL1_TPPERF_TP1_L1_REQUESTS = 3, 447 + TPL1_TPPERF_TP1_L1_MISSES = 4, 448 + TPL1_TPPERF_TP2_L1_REQUESTS = 5, 449 + TPL1_TPPERF_TP2_L1_MISSES = 6, 450 + TPL1_TPPERF_TP3_L1_REQUESTS = 7, 451 + TPL1_TPPERF_TP3_L1_MISSES = 8, 452 + TPL1_TPPERF_OUTPUT_TEXELS_POINT = 9, 453 + TPL1_TPPERF_OUTPUT_TEXELS_BILINEAR = 10, 454 + TPL1_TPPERF_OUTPUT_TEXELS_MIP = 11, 455 + TPL1_TPPERF_OUTPUT_TEXELS_ANISO = 12, 456 + TPL1_TPPERF_BILINEAR_OPS = 13, 457 + TPL1_TPPERF_QUADSQUADS_OFFSET = 14, 458 + TPL1_TPPERF_QUADQUADS_SHADOW = 15, 459 + TPL1_TPPERF_QUADS_ARRAY = 16, 460 + TPL1_TPPERF_QUADS_PROJECTION = 17, 461 + TPL1_TPPERF_QUADS_GRADIENT = 18, 462 + TPL1_TPPERF_QUADS_1D2D = 19, 463 + TPL1_TPPERF_QUADS_3DCUBE = 20, 464 + TPL1_TPPERF_ZERO_LOD = 21, 465 + TPL1_TPPERF_OUTPUT_TEXELS = 22, 466 + TPL1_TPPERF_ACTIVE_CYCLES_ANY = 23, 467 + TPL1_TPPERF_ACTIVE_CYCLES_ALL = 24, 468 + TPL1_TPPERF_STALL_CYCLES_BY_ARB = 25, 469 + TPL1_TPPERF_LATENCY = 26, 470 + TPL1_TPPERF_LATENCY_TRANS = 27, 471 + }; 472 + 473 + enum a3xx_vfd_perfcounter_select { 474 + VFD_PERF_UCHE_BYTE_FETCHED = 0, 475 + VFD_PERF_UCHE_TRANS = 1, 476 + VFD_PERF_VPC_BYPASS_COMPONENTS = 2, 477 + VFD_PERF_FETCH_INSTRUCTIONS = 3, 478 + VFD_PERF_DECODE_INSTRUCTIONS = 4, 479 + VFD_PERF_ACTIVE_CYCLES = 5, 480 + VFD_PERF_STALL_CYCLES_UCHE = 6, 481 + VFD_PERF_STALL_CYCLES_HLSQ = 7, 482 + VFD_PERF_STALL_CYCLES_VPC_BYPASS = 8, 483 + VFD_PERF_STALL_CYCLES_VPC_ALLOC = 9, 484 + }; 485 + 486 + enum a3xx_vpc_perfcounter_select { 487 + VPC_PERF_SP_LM_PRIMITIVES = 0, 488 + VPC_PERF_COMPONENTS_FROM_SP = 1, 489 + VPC_PERF_SP_LM_COMPONENTS = 2, 490 + VPC_PERF_ACTIVE_CYCLES = 3, 491 + VPC_PERF_STALL_CYCLES_LM = 4, 492 + VPC_PERF_STALL_CYCLES_RAS = 5, 493 + }; 494 + 495 + enum a3xx_uche_perfcounter_select { 496 + UCHE_UCHEPERF_VBIF_READ_BEATS_TP = 0, 497 + UCHE_UCHEPERF_VBIF_READ_BEATS_VFD = 1, 498 + UCHE_UCHEPERF_VBIF_READ_BEATS_HLSQ = 2, 499 + UCHE_UCHEPERF_VBIF_READ_BEATS_MARB = 3, 500 + UCHE_UCHEPERF_VBIF_READ_BEATS_SP = 4, 501 + UCHE_UCHEPERF_READ_REQUESTS_TP = 8, 502 + UCHE_UCHEPERF_READ_REQUESTS_VFD = 9, 503 + UCHE_UCHEPERF_READ_REQUESTS_HLSQ = 10, 504 + UCHE_UCHEPERF_READ_REQUESTS_MARB = 11, 505 + UCHE_UCHEPERF_READ_REQUESTS_SP = 12, 506 + UCHE_UCHEPERF_WRITE_REQUESTS_MARB = 13, 507 + UCHE_UCHEPERF_WRITE_REQUESTS_SP = 14, 508 + UCHE_UCHEPERF_TAG_CHECK_FAILS = 15, 509 + UCHE_UCHEPERF_EVICTS = 16, 510 + UCHE_UCHEPERF_FLUSHES = 17, 511 + UCHE_UCHEPERF_VBIF_LATENCY_CYCLES = 18, 512 + UCHE_UCHEPERF_VBIF_LATENCY_SAMPLES = 19, 513 + UCHE_UCHEPERF_ACTIVE_CYCLES = 20, 283 514 }; 284 515 285 516 enum a3xx_rb_blend_opcode { ··· 1684 1429 #define REG_A3XX_PC_RESTART_INDEX 0x000021ed 1685 1430 1686 1431 #define REG_A3XX_HLSQ_CONTROL_0_REG 0x00002200 1687 - #define A3XX_HLSQ_CONTROL_0_REG_FSTHREADSIZE__MASK 0x00000010 1432 + #define A3XX_HLSQ_CONTROL_0_REG_FSTHREADSIZE__MASK 0x00000030 1688 1433 #define A3XX_HLSQ_CONTROL_0_REG_FSTHREADSIZE__SHIFT 4 1689 1434 static inline uint32_t A3XX_HLSQ_CONTROL_0_REG_FSTHREADSIZE(enum a3xx_threadsize val) 1690 1435 { 1691 1436 return ((val) << A3XX_HLSQ_CONTROL_0_REG_FSTHREADSIZE__SHIFT) & A3XX_HLSQ_CONTROL_0_REG_FSTHREADSIZE__MASK; 1692 1437 } 1693 1438 #define A3XX_HLSQ_CONTROL_0_REG_FSSUPERTHREADENABLE 0x00000040 1439 + #define A3XX_HLSQ_CONTROL_0_REG_COMPUTEMODE 0x00000100 1694 1440 #define A3XX_HLSQ_CONTROL_0_REG_SPSHADERRESTART 0x00000200 1695 1441 #define A3XX_HLSQ_CONTROL_0_REG_RESERVED2 0x00000400 1442 + #define A3XX_HLSQ_CONTROL_0_REG_CYCLETIMEOUTLIMITVPC__MASK 0x00fff000 1443 + #define A3XX_HLSQ_CONTROL_0_REG_CYCLETIMEOUTLIMITVPC__SHIFT 12 1444 + static inline uint32_t A3XX_HLSQ_CONTROL_0_REG_CYCLETIMEOUTLIMITVPC(uint32_t val) 1445 + { 1446 + return ((val) << A3XX_HLSQ_CONTROL_0_REG_CYCLETIMEOUTLIMITVPC__SHIFT) & A3XX_HLSQ_CONTROL_0_REG_CYCLETIMEOUTLIMITVPC__MASK; 1447 + } 1448 + #define A3XX_HLSQ_CONTROL_0_REG_FSONLYTEX 0x02000000 1696 1449 #define A3XX_HLSQ_CONTROL_0_REG_CHUNKDISABLE 0x04000000 1697 1450 #define A3XX_HLSQ_CONTROL_0_REG_CONSTMODE__MASK 0x08000000 1698 1451 #define A3XX_HLSQ_CONTROL_0_REG_CONSTMODE__SHIFT 27 ··· 1714 1451 #define A3XX_HLSQ_CONTROL_0_REG_SINGLECONTEXT 0x80000000 1715 1452 1716 1453 #define REG_A3XX_HLSQ_CONTROL_1_REG 0x00002201 1717 - #define A3XX_HLSQ_CONTROL_1_REG_VSTHREADSIZE__MASK 0x00000040 1454 + #define A3XX_HLSQ_CONTROL_1_REG_VSTHREADSIZE__MASK 0x000000c0 1718 1455 #define A3XX_HLSQ_CONTROL_1_REG_VSTHREADSIZE__SHIFT 6 1719 1456 static inline uint32_t A3XX_HLSQ_CONTROL_1_REG_VSTHREADSIZE(enum a3xx_threadsize val) 1720 1457 { 1721 1458 return ((val) << A3XX_HLSQ_CONTROL_1_REG_VSTHREADSIZE__SHIFT) & A3XX_HLSQ_CONTROL_1_REG_VSTHREADSIZE__MASK; 1722 1459 } 1723 1460 #define A3XX_HLSQ_CONTROL_1_REG_VSSUPERTHREADENABLE 0x00000100 1724 - #define A3XX_HLSQ_CONTROL_1_REG_RESERVED1 0x00000200 1725 - #define A3XX_HLSQ_CONTROL_1_REG_ZWCOORD 0x02000000 1461 + #define A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDXYREGID__MASK 0x00ff0000 1462 + #define A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDXYREGID__SHIFT 16 1463 + static inline uint32_t A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDXYREGID(uint32_t val) 1464 + { 1465 + return ((val) << A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDXYREGID__SHIFT) & A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDXYREGID__MASK; 1466 + } 1467 + #define A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDZWREGID__MASK 0xff000000 1468 + #define A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDZWREGID__SHIFT 24 1469 + static inline uint32_t A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDZWREGID(uint32_t val) 1470 + { 1471 + return ((val) << A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDZWREGID__SHIFT) & A3XX_HLSQ_CONTROL_1_REG_FRAGCOORDZWREGID__MASK; 1472 + } 1726 1473 1727 1474 #define REG_A3XX_HLSQ_CONTROL_2_REG 0x00002202 1475 + #define A3XX_HLSQ_CONTROL_2_REG_FACENESSREGID__MASK 0x000003fc 1476 + #define A3XX_HLSQ_CONTROL_2_REG_FACENESSREGID__SHIFT 2 1477 + static inline uint32_t A3XX_HLSQ_CONTROL_2_REG_FACENESSREGID(uint32_t val) 1478 + { 1479 + return ((val) << A3XX_HLSQ_CONTROL_2_REG_FACENESSREGID__SHIFT) & A3XX_HLSQ_CONTROL_2_REG_FACENESSREGID__MASK; 1480 + } 1481 + #define A3XX_HLSQ_CONTROL_2_REG_COVVALUEREGID__MASK 0x03fc0000 1482 + #define A3XX_HLSQ_CONTROL_2_REG_COVVALUEREGID__SHIFT 18 1483 + static inline uint32_t A3XX_HLSQ_CONTROL_2_REG_COVVALUEREGID(uint32_t val) 1484 + { 1485 + return ((val) << A3XX_HLSQ_CONTROL_2_REG_COVVALUEREGID__SHIFT) & A3XX_HLSQ_CONTROL_2_REG_COVVALUEREGID__MASK; 1486 + } 1728 1487 #define A3XX_HLSQ_CONTROL_2_REG_PRIMALLOCTHRESHOLD__MASK 0xfc000000 1729 1488 #define A3XX_HLSQ_CONTROL_2_REG_PRIMALLOCTHRESHOLD__SHIFT 26 1730 1489 static inline uint32_t A3XX_HLSQ_CONTROL_2_REG_PRIMALLOCTHRESHOLD(uint32_t val) ··· 1763 1478 } 1764 1479 1765 1480 #define REG_A3XX_HLSQ_VS_CONTROL_REG 0x00002204 1766 - #define A3XX_HLSQ_VS_CONTROL_REG_CONSTLENGTH__MASK 0x00000fff 1481 + #define A3XX_HLSQ_VS_CONTROL_REG_CONSTLENGTH__MASK 0x000003ff 1767 1482 #define A3XX_HLSQ_VS_CONTROL_REG_CONSTLENGTH__SHIFT 0 1768 1483 static inline uint32_t A3XX_HLSQ_VS_CONTROL_REG_CONSTLENGTH(uint32_t val) 1769 1484 { 1770 1485 return ((val) << A3XX_HLSQ_VS_CONTROL_REG_CONSTLENGTH__SHIFT) & A3XX_HLSQ_VS_CONTROL_REG_CONSTLENGTH__MASK; 1771 1486 } 1772 - #define A3XX_HLSQ_VS_CONTROL_REG_CONSTSTARTOFFSET__MASK 0x00fff000 1487 + #define A3XX_HLSQ_VS_CONTROL_REG_CONSTSTARTOFFSET__MASK 0x001ff000 1773 1488 #define A3XX_HLSQ_VS_CONTROL_REG_CONSTSTARTOFFSET__SHIFT 12 1774 1489 static inline uint32_t A3XX_HLSQ_VS_CONTROL_REG_CONSTSTARTOFFSET(uint32_t val) 1775 1490 { ··· 1783 1498 } 1784 1499 1785 1500 #define REG_A3XX_HLSQ_FS_CONTROL_REG 0x00002205 1786 - #define A3XX_HLSQ_FS_CONTROL_REG_CONSTLENGTH__MASK 0x00000fff 1501 + #define A3XX_HLSQ_FS_CONTROL_REG_CONSTLENGTH__MASK 0x000003ff 1787 1502 #define A3XX_HLSQ_FS_CONTROL_REG_CONSTLENGTH__SHIFT 0 1788 1503 static inline uint32_t A3XX_HLSQ_FS_CONTROL_REG_CONSTLENGTH(uint32_t val) 1789 1504 { 1790 1505 return ((val) << A3XX_HLSQ_FS_CONTROL_REG_CONSTLENGTH__SHIFT) & A3XX_HLSQ_FS_CONTROL_REG_CONSTLENGTH__MASK; 1791 1506 } 1792 - #define A3XX_HLSQ_FS_CONTROL_REG_CONSTSTARTOFFSET__MASK 0x00fff000 1507 + #define A3XX_HLSQ_FS_CONTROL_REG_CONSTSTARTOFFSET__MASK 0x001ff000 1793 1508 #define A3XX_HLSQ_FS_CONTROL_REG_CONSTSTARTOFFSET__SHIFT 12 1794 1509 static inline uint32_t A3XX_HLSQ_FS_CONTROL_REG_CONSTSTARTOFFSET(uint32_t val) 1795 1510 { ··· 1803 1518 } 1804 1519 1805 1520 #define REG_A3XX_HLSQ_CONST_VSPRESV_RANGE_REG 0x00002206 1806 - #define A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_STARTENTRY__MASK 0x0000ffff 1521 + #define A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_STARTENTRY__MASK 0x000001ff 1807 1522 #define A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_STARTENTRY__SHIFT 0 1808 1523 static inline uint32_t A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_STARTENTRY(uint32_t val) 1809 1524 { 1810 1525 return ((val) << A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_STARTENTRY__SHIFT) & A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_STARTENTRY__MASK; 1811 1526 } 1812 - #define A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_ENDENTRY__MASK 0xffff0000 1527 + #define A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_ENDENTRY__MASK 0x01ff0000 1813 1528 #define A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_ENDENTRY__SHIFT 16 1814 1529 static inline uint32_t A3XX_HLSQ_CONST_VSPRESV_RANGE_REG_ENDENTRY(uint32_t val) 1815 1530 { ··· 1817 1532 } 1818 1533 1819 1534 #define REG_A3XX_HLSQ_CONST_FSPRESV_RANGE_REG 0x00002207 1820 - #define A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_STARTENTRY__MASK 0x0000ffff 1535 + #define A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_STARTENTRY__MASK 0x000001ff 1821 1536 #define A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_STARTENTRY__SHIFT 0 1822 1537 static inline uint32_t A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_STARTENTRY(uint32_t val) 1823 1538 { 1824 1539 return ((val) << A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_STARTENTRY__SHIFT) & A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_STARTENTRY__MASK; 1825 1540 } 1826 - #define A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_ENDENTRY__MASK 0xffff0000 1541 + #define A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_ENDENTRY__MASK 0x01ff0000 1827 1542 #define A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_ENDENTRY__SHIFT 16 1828 1543 static inline uint32_t A3XX_HLSQ_CONST_FSPRESV_RANGE_REG_ENDENTRY(uint32_t val) 1829 1544 { ··· 1905 1620 } 1906 1621 1907 1622 #define REG_A3XX_VFD_CONTROL_1 0x00002241 1908 - #define A3XX_VFD_CONTROL_1_MAXSTORAGE__MASK 0x0000ffff 1623 + #define A3XX_VFD_CONTROL_1_MAXSTORAGE__MASK 0x0000000f 1909 1624 #define A3XX_VFD_CONTROL_1_MAXSTORAGE__SHIFT 0 1910 1625 static inline uint32_t A3XX_VFD_CONTROL_1_MAXSTORAGE(uint32_t val) 1911 1626 { 1912 1627 return ((val) << A3XX_VFD_CONTROL_1_MAXSTORAGE__SHIFT) & A3XX_VFD_CONTROL_1_MAXSTORAGE__MASK; 1628 + } 1629 + #define A3XX_VFD_CONTROL_1_MAXTHRESHOLD__MASK 0x000000f0 1630 + #define A3XX_VFD_CONTROL_1_MAXTHRESHOLD__SHIFT 4 1631 + static inline uint32_t A3XX_VFD_CONTROL_1_MAXTHRESHOLD(uint32_t val) 1632 + { 1633 + return ((val) << A3XX_VFD_CONTROL_1_MAXTHRESHOLD__SHIFT) & A3XX_VFD_CONTROL_1_MAXTHRESHOLD__MASK; 1634 + } 1635 + #define A3XX_VFD_CONTROL_1_MINTHRESHOLD__MASK 0x00000f00 1636 + #define A3XX_VFD_CONTROL_1_MINTHRESHOLD__SHIFT 8 1637 + static inline uint32_t A3XX_VFD_CONTROL_1_MINTHRESHOLD(uint32_t val) 1638 + { 1639 + return ((val) << A3XX_VFD_CONTROL_1_MINTHRESHOLD__SHIFT) & A3XX_VFD_CONTROL_1_MINTHRESHOLD__MASK; 1913 1640 } 1914 1641 #define A3XX_VFD_CONTROL_1_REGID4VTX__MASK 0x00ff0000 1915 1642 #define A3XX_VFD_CONTROL_1_REGID4VTX__SHIFT 16 ··· 2305 2008 return ((val) << A3XX_SP_VS_CTRL_REG0_INSTRBUFFERMODE__SHIFT) & A3XX_SP_VS_CTRL_REG0_INSTRBUFFERMODE__MASK; 2306 2009 } 2307 2010 #define A3XX_SP_VS_CTRL_REG0_CACHEINVALID 0x00000004 2011 + #define A3XX_SP_VS_CTRL_REG0_ALUSCHMODE 0x00000008 2308 2012 #define A3XX_SP_VS_CTRL_REG0_HALFREGFOOTPRINT__MASK 0x000003f0 2309 2013 #define A3XX_SP_VS_CTRL_REG0_HALFREGFOOTPRINT__SHIFT 4 2310 2014 static inline uint32_t A3XX_SP_VS_CTRL_REG0_HALFREGFOOTPRINT(uint32_t val) 2311 2015 { 2312 2016 return ((val) << A3XX_SP_VS_CTRL_REG0_HALFREGFOOTPRINT__SHIFT) & A3XX_SP_VS_CTRL_REG0_HALFREGFOOTPRINT__MASK; 2313 2017 } 2314 - #define A3XX_SP_VS_CTRL_REG0_FULLREGFOOTPRINT__MASK 0x0003fc00 2018 + #define A3XX_SP_VS_CTRL_REG0_FULLREGFOOTPRINT__MASK 0x0000fc00 2315 2019 #define A3XX_SP_VS_CTRL_REG0_FULLREGFOOTPRINT__SHIFT 10 2316 2020 static inline uint32_t A3XX_SP_VS_CTRL_REG0_FULLREGFOOTPRINT(uint32_t val) 2317 2021 { 2318 2022 return ((val) << A3XX_SP_VS_CTRL_REG0_FULLREGFOOTPRINT__SHIFT) & A3XX_SP_VS_CTRL_REG0_FULLREGFOOTPRINT__MASK; 2319 - } 2320 - #define A3XX_SP_VS_CTRL_REG0_INOUTREGOVERLAP__MASK 0x000c0000 2321 - #define A3XX_SP_VS_CTRL_REG0_INOUTREGOVERLAP__SHIFT 18 2322 - static inline uint32_t A3XX_SP_VS_CTRL_REG0_INOUTREGOVERLAP(uint32_t val) 2323 - { 2324 - return ((val) << A3XX_SP_VS_CTRL_REG0_INOUTREGOVERLAP__SHIFT) & A3XX_SP_VS_CTRL_REG0_INOUTREGOVERLAP__MASK; 2325 2023 } 2326 2024 #define A3XX_SP_VS_CTRL_REG0_THREADSIZE__MASK 0x00100000 2327 2025 #define A3XX_SP_VS_CTRL_REG0_THREADSIZE__SHIFT 20 ··· 2325 2033 return ((val) << A3XX_SP_VS_CTRL_REG0_THREADSIZE__SHIFT) & A3XX_SP_VS_CTRL_REG0_THREADSIZE__MASK; 2326 2034 } 2327 2035 #define A3XX_SP_VS_CTRL_REG0_SUPERTHREADMODE 0x00200000 2328 - #define A3XX_SP_VS_CTRL_REG0_PIXLODENABLE 0x00400000 2329 - #define A3XX_SP_VS_CTRL_REG0_COMPUTEMODE 0x00800000 2330 2036 #define A3XX_SP_VS_CTRL_REG0_LENGTH__MASK 0xff000000 2331 2037 #define A3XX_SP_VS_CTRL_REG0_LENGTH__SHIFT 24 2332 2038 static inline uint32_t A3XX_SP_VS_CTRL_REG0_LENGTH(uint32_t val) ··· 2365 2075 { 2366 2076 return ((val) << A3XX_SP_VS_PARAM_REG_PSIZEREGID__SHIFT) & A3XX_SP_VS_PARAM_REG_PSIZEREGID__MASK; 2367 2077 } 2368 - #define A3XX_SP_VS_PARAM_REG_TOTALVSOUTVAR__MASK 0xfff00000 2078 + #define A3XX_SP_VS_PARAM_REG_POS2DMODE 0x00010000 2079 + #define A3XX_SP_VS_PARAM_REG_TOTALVSOUTVAR__MASK 0x01f00000 2369 2080 #define A3XX_SP_VS_PARAM_REG_TOTALVSOUTVAR__SHIFT 20 2370 2081 static inline uint32_t A3XX_SP_VS_PARAM_REG_TOTALVSOUTVAR(uint32_t val) 2371 2082 { ··· 2376 2085 static inline uint32_t REG_A3XX_SP_VS_OUT(uint32_t i0) { return 0x000022c7 + 0x1*i0; } 2377 2086 2378 2087 static inline uint32_t REG_A3XX_SP_VS_OUT_REG(uint32_t i0) { return 0x000022c7 + 0x1*i0; } 2379 - #define A3XX_SP_VS_OUT_REG_A_REGID__MASK 0x000001ff 2088 + #define A3XX_SP_VS_OUT_REG_A_REGID__MASK 0x000000ff 2380 2089 #define A3XX_SP_VS_OUT_REG_A_REGID__SHIFT 0 2381 2090 static inline uint32_t A3XX_SP_VS_OUT_REG_A_REGID(uint32_t val) 2382 2091 { 2383 2092 return ((val) << A3XX_SP_VS_OUT_REG_A_REGID__SHIFT) & A3XX_SP_VS_OUT_REG_A_REGID__MASK; 2384 2093 } 2094 + #define A3XX_SP_VS_OUT_REG_A_HALF 0x00000100 2385 2095 #define A3XX_SP_VS_OUT_REG_A_COMPMASK__MASK 0x00001e00 2386 2096 #define A3XX_SP_VS_OUT_REG_A_COMPMASK__SHIFT 9 2387 2097 static inline uint32_t A3XX_SP_VS_OUT_REG_A_COMPMASK(uint32_t val) 2388 2098 { 2389 2099 return ((val) << A3XX_SP_VS_OUT_REG_A_COMPMASK__SHIFT) & A3XX_SP_VS_OUT_REG_A_COMPMASK__MASK; 2390 2100 } 2391 - #define A3XX_SP_VS_OUT_REG_B_REGID__MASK 0x01ff0000 2101 + #define A3XX_SP_VS_OUT_REG_B_REGID__MASK 0x00ff0000 2392 2102 #define A3XX_SP_VS_OUT_REG_B_REGID__SHIFT 16 2393 2103 static inline uint32_t A3XX_SP_VS_OUT_REG_B_REGID(uint32_t val) 2394 2104 { 2395 2105 return ((val) << A3XX_SP_VS_OUT_REG_B_REGID__SHIFT) & A3XX_SP_VS_OUT_REG_B_REGID__MASK; 2396 2106 } 2107 + #define A3XX_SP_VS_OUT_REG_B_HALF 0x01000000 2397 2108 #define A3XX_SP_VS_OUT_REG_B_COMPMASK__MASK 0x1e000000 2398 2109 #define A3XX_SP_VS_OUT_REG_B_COMPMASK__SHIFT 25 2399 2110 static inline uint32_t A3XX_SP_VS_OUT_REG_B_COMPMASK(uint32_t val) ··· 2406 2113 static inline uint32_t REG_A3XX_SP_VS_VPC_DST(uint32_t i0) { return 0x000022d0 + 0x1*i0; } 2407 2114 2408 2115 static inline uint32_t REG_A3XX_SP_VS_VPC_DST_REG(uint32_t i0) { return 0x000022d0 + 0x1*i0; } 2409 - #define A3XX_SP_VS_VPC_DST_REG_OUTLOC0__MASK 0x000000ff 2116 + #define A3XX_SP_VS_VPC_DST_REG_OUTLOC0__MASK 0x0000007f 2410 2117 #define A3XX_SP_VS_VPC_DST_REG_OUTLOC0__SHIFT 0 2411 2118 static inline uint32_t A3XX_SP_VS_VPC_DST_REG_OUTLOC0(uint32_t val) 2412 2119 { 2413 2120 return ((val) << A3XX_SP_VS_VPC_DST_REG_OUTLOC0__SHIFT) & A3XX_SP_VS_VPC_DST_REG_OUTLOC0__MASK; 2414 2121 } 2415 - #define A3XX_SP_VS_VPC_DST_REG_OUTLOC1__MASK 0x0000ff00 2122 + #define A3XX_SP_VS_VPC_DST_REG_OUTLOC1__MASK 0x00007f00 2416 2123 #define A3XX_SP_VS_VPC_DST_REG_OUTLOC1__SHIFT 8 2417 2124 static inline uint32_t A3XX_SP_VS_VPC_DST_REG_OUTLOC1(uint32_t val) 2418 2125 { 2419 2126 return ((val) << A3XX_SP_VS_VPC_DST_REG_OUTLOC1__SHIFT) & A3XX_SP_VS_VPC_DST_REG_OUTLOC1__MASK; 2420 2127 } 2421 - #define A3XX_SP_VS_VPC_DST_REG_OUTLOC2__MASK 0x00ff0000 2128 + #define A3XX_SP_VS_VPC_DST_REG_OUTLOC2__MASK 0x007f0000 2422 2129 #define A3XX_SP_VS_VPC_DST_REG_OUTLOC2__SHIFT 16 2423 2130 static inline uint32_t A3XX_SP_VS_VPC_DST_REG_OUTLOC2(uint32_t val) 2424 2131 { 2425 2132 return ((val) << A3XX_SP_VS_VPC_DST_REG_OUTLOC2__SHIFT) & A3XX_SP_VS_VPC_DST_REG_OUTLOC2__MASK; 2426 2133 } 2427 - #define A3XX_SP_VS_VPC_DST_REG_OUTLOC3__MASK 0xff000000 2134 + #define A3XX_SP_VS_VPC_DST_REG_OUTLOC3__MASK 0x7f000000 2428 2135 #define A3XX_SP_VS_VPC_DST_REG_OUTLOC3__SHIFT 24 2429 2136 static inline uint32_t A3XX_SP_VS_VPC_DST_REG_OUTLOC3(uint32_t val) 2430 2137 { ··· 2432 2139 } 2433 2140 2434 2141 #define REG_A3XX_SP_VS_OBJ_OFFSET_REG 0x000022d4 2142 + #define A3XX_SP_VS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__MASK 0x0000ffff 2143 + #define A3XX_SP_VS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__SHIFT 0 2144 + static inline uint32_t A3XX_SP_VS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET(uint32_t val) 2145 + { 2146 + return ((val) << A3XX_SP_VS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__SHIFT) & A3XX_SP_VS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__MASK; 2147 + } 2435 2148 #define A3XX_SP_VS_OBJ_OFFSET_REG_CONSTOBJECTOFFSET__MASK 0x01ff0000 2436 2149 #define A3XX_SP_VS_OBJ_OFFSET_REG_CONSTOBJECTOFFSET__SHIFT 16 2437 2150 static inline uint32_t A3XX_SP_VS_OBJ_OFFSET_REG_CONSTOBJECTOFFSET(uint32_t val) ··· 2454 2155 #define REG_A3XX_SP_VS_OBJ_START_REG 0x000022d5 2455 2156 2456 2157 #define REG_A3XX_SP_VS_PVT_MEM_PARAM_REG 0x000022d6 2158 + #define A3XX_SP_VS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__MASK 0x000000ff 2159 + #define A3XX_SP_VS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__SHIFT 0 2160 + static inline uint32_t A3XX_SP_VS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM(uint32_t val) 2161 + { 2162 + return ((val) << A3XX_SP_VS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__SHIFT) & A3XX_SP_VS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__MASK; 2163 + } 2164 + #define A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__MASK 0x00ffff00 2165 + #define A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__SHIFT 8 2166 + static inline uint32_t A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKOFFSET(uint32_t val) 2167 + { 2168 + return ((val) << A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__SHIFT) & A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__MASK; 2169 + } 2170 + #define A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__MASK 0xff000000 2171 + #define A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__SHIFT 24 2172 + static inline uint32_t A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD(uint32_t val) 2173 + { 2174 + return ((val) << A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__SHIFT) & A3XX_SP_VS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__MASK; 2175 + } 2457 2176 2458 2177 #define REG_A3XX_SP_VS_PVT_MEM_ADDR_REG 0x000022d7 2178 + #define A3XX_SP_VS_PVT_MEM_ADDR_REG_BURSTLEN__MASK 0x0000001f 2179 + #define A3XX_SP_VS_PVT_MEM_ADDR_REG_BURSTLEN__SHIFT 0 2180 + static inline uint32_t A3XX_SP_VS_PVT_MEM_ADDR_REG_BURSTLEN(uint32_t val) 2181 + { 2182 + return ((val) << A3XX_SP_VS_PVT_MEM_ADDR_REG_BURSTLEN__SHIFT) & A3XX_SP_VS_PVT_MEM_ADDR_REG_BURSTLEN__MASK; 2183 + } 2184 + #define A3XX_SP_VS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__MASK 0xffffffe0 2185 + #define A3XX_SP_VS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__SHIFT 5 2186 + static inline uint32_t A3XX_SP_VS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS(uint32_t val) 2187 + { 2188 + return ((val >> 5) << A3XX_SP_VS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__SHIFT) & A3XX_SP_VS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__MASK; 2189 + } 2459 2190 2460 2191 #define REG_A3XX_SP_VS_PVT_MEM_SIZE_REG 0x000022d8 2461 2192 ··· 2511 2182 return ((val) << A3XX_SP_FS_CTRL_REG0_INSTRBUFFERMODE__SHIFT) & A3XX_SP_FS_CTRL_REG0_INSTRBUFFERMODE__MASK; 2512 2183 } 2513 2184 #define A3XX_SP_FS_CTRL_REG0_CACHEINVALID 0x00000004 2185 + #define A3XX_SP_FS_CTRL_REG0_ALUSCHMODE 0x00000008 2514 2186 #define A3XX_SP_FS_CTRL_REG0_HALFREGFOOTPRINT__MASK 0x000003f0 2515 2187 #define A3XX_SP_FS_CTRL_REG0_HALFREGFOOTPRINT__SHIFT 4 2516 2188 static inline uint32_t A3XX_SP_FS_CTRL_REG0_HALFREGFOOTPRINT(uint32_t val) 2517 2189 { 2518 2190 return ((val) << A3XX_SP_FS_CTRL_REG0_HALFREGFOOTPRINT__SHIFT) & A3XX_SP_FS_CTRL_REG0_HALFREGFOOTPRINT__MASK; 2519 2191 } 2520 - #define A3XX_SP_FS_CTRL_REG0_FULLREGFOOTPRINT__MASK 0x0003fc00 2192 + #define A3XX_SP_FS_CTRL_REG0_FULLREGFOOTPRINT__MASK 0x0000fc00 2521 2193 #define A3XX_SP_FS_CTRL_REG0_FULLREGFOOTPRINT__SHIFT 10 2522 2194 static inline uint32_t A3XX_SP_FS_CTRL_REG0_FULLREGFOOTPRINT(uint32_t val) 2523 2195 { 2524 2196 return ((val) << A3XX_SP_FS_CTRL_REG0_FULLREGFOOTPRINT__SHIFT) & A3XX_SP_FS_CTRL_REG0_FULLREGFOOTPRINT__MASK; 2525 2197 } 2526 - #define A3XX_SP_FS_CTRL_REG0_INOUTREGOVERLAP__MASK 0x000c0000 2527 - #define A3XX_SP_FS_CTRL_REG0_INOUTREGOVERLAP__SHIFT 18 2528 - static inline uint32_t A3XX_SP_FS_CTRL_REG0_INOUTREGOVERLAP(uint32_t val) 2529 - { 2530 - return ((val) << A3XX_SP_FS_CTRL_REG0_INOUTREGOVERLAP__SHIFT) & A3XX_SP_FS_CTRL_REG0_INOUTREGOVERLAP__MASK; 2531 - } 2198 + #define A3XX_SP_FS_CTRL_REG0_FSBYPASSENABLE 0x00020000 2199 + #define A3XX_SP_FS_CTRL_REG0_INOUTREGOVERLAP 0x00040000 2200 + #define A3XX_SP_FS_CTRL_REG0_OUTORDERED 0x00080000 2532 2201 #define A3XX_SP_FS_CTRL_REG0_THREADSIZE__MASK 0x00100000 2533 2202 #define A3XX_SP_FS_CTRL_REG0_THREADSIZE__SHIFT 20 2534 2203 static inline uint32_t A3XX_SP_FS_CTRL_REG0_THREADSIZE(enum a3xx_threadsize val) ··· 2562 2235 { 2563 2236 return ((val) << A3XX_SP_FS_CTRL_REG1_INITIALOUTSTANDING__SHIFT) & A3XX_SP_FS_CTRL_REG1_INITIALOUTSTANDING__MASK; 2564 2237 } 2565 - #define A3XX_SP_FS_CTRL_REG1_HALFPRECVAROFFSET__MASK 0x3f000000 2238 + #define A3XX_SP_FS_CTRL_REG1_HALFPRECVAROFFSET__MASK 0x7f000000 2566 2239 #define A3XX_SP_FS_CTRL_REG1_HALFPRECVAROFFSET__SHIFT 24 2567 2240 static inline uint32_t A3XX_SP_FS_CTRL_REG1_HALFPRECVAROFFSET(uint32_t val) 2568 2241 { ··· 2570 2243 } 2571 2244 2572 2245 #define REG_A3XX_SP_FS_OBJ_OFFSET_REG 0x000022e2 2246 + #define A3XX_SP_FS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__MASK 0x0000ffff 2247 + #define A3XX_SP_FS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__SHIFT 0 2248 + static inline uint32_t A3XX_SP_FS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET(uint32_t val) 2249 + { 2250 + return ((val) << A3XX_SP_FS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__SHIFT) & A3XX_SP_FS_OBJ_OFFSET_REG_FIRSTEXECINSTROFFSET__MASK; 2251 + } 2573 2252 #define A3XX_SP_FS_OBJ_OFFSET_REG_CONSTOBJECTOFFSET__MASK 0x01ff0000 2574 2253 #define A3XX_SP_FS_OBJ_OFFSET_REG_CONSTOBJECTOFFSET__SHIFT 16 2575 2254 static inline uint32_t A3XX_SP_FS_OBJ_OFFSET_REG_CONSTOBJECTOFFSET(uint32_t val) ··· 2592 2259 #define REG_A3XX_SP_FS_OBJ_START_REG 0x000022e3 2593 2260 2594 2261 #define REG_A3XX_SP_FS_PVT_MEM_PARAM_REG 0x000022e4 2262 + #define A3XX_SP_FS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__MASK 0x000000ff 2263 + #define A3XX_SP_FS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__SHIFT 0 2264 + static inline uint32_t A3XX_SP_FS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM(uint32_t val) 2265 + { 2266 + return ((val) << A3XX_SP_FS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__SHIFT) & A3XX_SP_FS_PVT_MEM_PARAM_REG_MEMSIZEPERITEM__MASK; 2267 + } 2268 + #define A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__MASK 0x00ffff00 2269 + #define A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__SHIFT 8 2270 + static inline uint32_t A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKOFFSET(uint32_t val) 2271 + { 2272 + return ((val) << A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__SHIFT) & A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKOFFSET__MASK; 2273 + } 2274 + #define A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__MASK 0xff000000 2275 + #define A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__SHIFT 24 2276 + static inline uint32_t A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD(uint32_t val) 2277 + { 2278 + return ((val) << A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__SHIFT) & A3XX_SP_FS_PVT_MEM_PARAM_REG_HWSTACKSIZEPERTHREAD__MASK; 2279 + } 2595 2280 2596 2281 #define REG_A3XX_SP_FS_PVT_MEM_ADDR_REG 0x000022e5 2282 + #define A3XX_SP_FS_PVT_MEM_ADDR_REG_BURSTLEN__MASK 0x0000001f 2283 + #define A3XX_SP_FS_PVT_MEM_ADDR_REG_BURSTLEN__SHIFT 0 2284 + static inline uint32_t A3XX_SP_FS_PVT_MEM_ADDR_REG_BURSTLEN(uint32_t val) 2285 + { 2286 + return ((val) << A3XX_SP_FS_PVT_MEM_ADDR_REG_BURSTLEN__SHIFT) & A3XX_SP_FS_PVT_MEM_ADDR_REG_BURSTLEN__MASK; 2287 + } 2288 + #define A3XX_SP_FS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__MASK 0xffffffe0 2289 + #define A3XX_SP_FS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__SHIFT 5 2290 + static inline uint32_t A3XX_SP_FS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS(uint32_t val) 2291 + { 2292 + return ((val >> 5) << A3XX_SP_FS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__SHIFT) & A3XX_SP_FS_PVT_MEM_ADDR_REG_SHADERSTARTADDRESS__MASK; 2293 + } 2597 2294 2598 2295 #define REG_A3XX_SP_FS_PVT_MEM_SIZE_REG 0x000022e6 2599 2296
+1210 -67
drivers/gpu/drm/msm/adreno/a4xx.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/adreno.xml ( 398 bytes, from 2015-09-24 17:25:31) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml ( 32901 bytes, from 2015-05-20 20:03:14) 14 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 10755 bytes, from 2015-09-14 20:46:55) 15 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 14968 bytes, from 2015-05-20 20:12:27) 16 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 67771 bytes, from 2015-09-14 20:46:55) 17 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 63970 bytes, from 2015-09-14 20:50:12) 14 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 11518 bytes, from 2016-02-10 21:03:25) 15 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 16166 bytes, from 2016-02-11 21:20:31) 16 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 83967 bytes, from 2016-02-10 17:07:21) 17 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 109916 bytes, from 2016-02-20 18:44:48) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml ( 1773 bytes, from 2015-09-24 17:30:00) 19 19 20 - Copyright (C) 2013-2015 by the following authors: 20 + Copyright (C) 2013-2016 by the following authors: 21 21 - Rob Clark <robdclark@gmail.com> (robclark) 22 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 22 23 23 24 Permission is hereby granted, free of charge, to any person obtaining 24 25 a copy of this software and associated documentation files (the ··· 48 47 RB4_R8_UNORM = 2, 49 48 RB4_R4G4B4A4_UNORM = 8, 50 49 RB4_R5G5B5A1_UNORM = 10, 51 - RB4_R5G6R5_UNORM = 14, 50 + RB4_R5G6B5_UNORM = 14, 52 51 RB4_R8G8_UNORM = 15, 53 52 RB4_R8G8_SNORM = 16, 54 53 RB4_R8G8_UINT = 17, 55 54 RB4_R8G8_SINT = 18, 55 + RB4_R16_UNORM = 19, 56 + RB4_R16_SNORM = 20, 56 57 RB4_R16_FLOAT = 21, 57 58 RB4_R16_UINT = 22, 58 59 RB4_R16_SINT = 23, ··· 66 63 RB4_R10G10B10A2_UNORM = 31, 67 64 RB4_R10G10B10A2_UINT = 34, 68 65 RB4_R11G11B10_FLOAT = 39, 66 + RB4_R16G16_UNORM = 40, 67 + RB4_R16G16_SNORM = 41, 69 68 RB4_R16G16_FLOAT = 42, 70 69 RB4_R16G16_UINT = 43, 71 70 RB4_R16G16_SINT = 44, 72 71 RB4_R32_FLOAT = 45, 73 72 RB4_R32_UINT = 46, 74 73 RB4_R32_SINT = 47, 74 + RB4_R16G16B16A16_UNORM = 52, 75 + RB4_R16G16B16A16_SNORM = 53, 75 76 RB4_R16G16B16A16_FLOAT = 54, 76 77 RB4_R16G16B16A16_UINT = 55, 77 78 RB4_R16G16B16A16_SINT = 56, ··· 113 106 VFMT4_32_32_FIXED = 10, 114 107 VFMT4_32_32_32_FIXED = 11, 115 108 VFMT4_32_32_32_32_FIXED = 12, 109 + VFMT4_11_11_10_FLOAT = 13, 116 110 VFMT4_16_SINT = 16, 117 111 VFMT4_16_16_SINT = 17, 118 112 VFMT4_16_16_16_SINT = 18, ··· 154 146 VFMT4_8_8_SNORM = 53, 155 147 VFMT4_8_8_8_SNORM = 54, 156 148 VFMT4_8_8_8_8_SNORM = 55, 157 - VFMT4_10_10_10_2_UINT = 60, 158 - VFMT4_10_10_10_2_UNORM = 61, 159 - VFMT4_10_10_10_2_SINT = 62, 160 - VFMT4_10_10_10_2_SNORM = 63, 149 + VFMT4_10_10_10_2_UINT = 56, 150 + VFMT4_10_10_10_2_UNORM = 57, 151 + VFMT4_10_10_10_2_SINT = 58, 152 + VFMT4_10_10_10_2_SNORM = 59, 153 + VFMT4_2_10_10_10_UINT = 60, 154 + VFMT4_2_10_10_10_UNORM = 61, 155 + VFMT4_2_10_10_10_SINT = 62, 156 + VFMT4_2_10_10_10_SNORM = 63, 161 157 }; 162 158 163 159 enum a4xx_tex_fmt { 164 - TFMT4_5_6_5_UNORM = 11, 165 - TFMT4_5_5_5_1_UNORM = 10, 166 - TFMT4_4_4_4_4_UNORM = 8, 167 - TFMT4_X8Z24_UNORM = 71, 168 - TFMT4_10_10_10_2_UNORM = 33, 169 160 TFMT4_A8_UNORM = 3, 170 - TFMT4_L8_A8_UNORM = 13, 171 161 TFMT4_8_UNORM = 4, 172 - TFMT4_8_8_UNORM = 14, 173 - TFMT4_8_8_8_8_UNORM = 28, 174 162 TFMT4_8_SNORM = 5, 175 - TFMT4_8_8_SNORM = 15, 176 - TFMT4_8_8_8_8_SNORM = 29, 177 163 TFMT4_8_UINT = 6, 178 - TFMT4_8_8_UINT = 16, 179 - TFMT4_8_8_8_8_UINT = 30, 180 164 TFMT4_8_SINT = 7, 165 + TFMT4_4_4_4_4_UNORM = 8, 166 + TFMT4_5_5_5_1_UNORM = 9, 167 + TFMT4_5_6_5_UNORM = 11, 168 + TFMT4_L8_A8_UNORM = 13, 169 + TFMT4_8_8_UNORM = 14, 170 + TFMT4_8_8_SNORM = 15, 171 + TFMT4_8_8_UINT = 16, 181 172 TFMT4_8_8_SINT = 17, 182 - TFMT4_8_8_8_8_SINT = 31, 183 - TFMT4_16_UINT = 21, 184 - TFMT4_16_16_UINT = 41, 185 - TFMT4_16_16_16_16_UINT = 54, 186 - TFMT4_16_SINT = 22, 187 - TFMT4_16_16_SINT = 42, 188 - TFMT4_16_16_16_16_SINT = 55, 189 - TFMT4_32_UINT = 44, 190 - TFMT4_32_32_UINT = 57, 191 - TFMT4_32_32_32_32_UINT = 64, 192 - TFMT4_32_SINT = 45, 193 - TFMT4_32_32_SINT = 58, 194 - TFMT4_32_32_32_32_SINT = 65, 173 + TFMT4_16_UNORM = 18, 174 + TFMT4_16_SNORM = 19, 195 175 TFMT4_16_FLOAT = 20, 196 - TFMT4_16_16_FLOAT = 40, 197 - TFMT4_16_16_16_16_FLOAT = 53, 198 - TFMT4_32_FLOAT = 43, 199 - TFMT4_32_32_FLOAT = 56, 200 - TFMT4_32_32_32_32_FLOAT = 63, 176 + TFMT4_16_UINT = 21, 177 + TFMT4_16_SINT = 22, 178 + TFMT4_8_8_8_8_UNORM = 28, 179 + TFMT4_8_8_8_8_SNORM = 29, 180 + TFMT4_8_8_8_8_UINT = 30, 181 + TFMT4_8_8_8_8_SINT = 31, 201 182 TFMT4_9_9_9_E5_FLOAT = 32, 183 + TFMT4_10_10_10_2_UNORM = 33, 184 + TFMT4_10_10_10_2_UINT = 34, 202 185 TFMT4_11_11_10_FLOAT = 37, 186 + TFMT4_16_16_UNORM = 38, 187 + TFMT4_16_16_SNORM = 39, 188 + TFMT4_16_16_FLOAT = 40, 189 + TFMT4_16_16_UINT = 41, 190 + TFMT4_16_16_SINT = 42, 191 + TFMT4_32_FLOAT = 43, 192 + TFMT4_32_UINT = 44, 193 + TFMT4_32_SINT = 45, 194 + TFMT4_16_16_16_16_UNORM = 51, 195 + TFMT4_16_16_16_16_SNORM = 52, 196 + TFMT4_16_16_16_16_FLOAT = 53, 197 + TFMT4_16_16_16_16_UINT = 54, 198 + TFMT4_16_16_16_16_SINT = 55, 199 + TFMT4_32_32_FLOAT = 56, 200 + TFMT4_32_32_UINT = 57, 201 + TFMT4_32_32_SINT = 58, 202 + TFMT4_32_32_32_FLOAT = 59, 203 + TFMT4_32_32_32_UINT = 60, 204 + TFMT4_32_32_32_SINT = 61, 205 + TFMT4_32_32_32_32_FLOAT = 63, 206 + TFMT4_32_32_32_32_UINT = 64, 207 + TFMT4_32_32_32_32_SINT = 65, 208 + TFMT4_X8Z24_UNORM = 71, 209 + TFMT4_DXT1 = 86, 210 + TFMT4_DXT3 = 87, 211 + TFMT4_DXT5 = 88, 212 + TFMT4_RGTC1_UNORM = 90, 213 + TFMT4_RGTC1_SNORM = 91, 214 + TFMT4_RGTC2_UNORM = 94, 215 + TFMT4_RGTC2_SNORM = 95, 216 + TFMT4_BPTC_UFLOAT = 97, 217 + TFMT4_BPTC_FLOAT = 98, 218 + TFMT4_BPTC = 99, 203 219 TFMT4_ATC_RGB = 100, 204 220 TFMT4_ATC_RGBA_EXPLICIT = 101, 205 221 TFMT4_ATC_RGBA_INTERPOLATED = 102, ··· 270 238 EQUAL_SPACING = 0, 271 239 ODD_SPACING = 2, 272 240 EVEN_SPACING = 3, 241 + }; 242 + 243 + enum a4xx_ccu_perfcounter_select { 244 + CCU_BUSY_CYCLES = 0, 245 + CCU_RB_DEPTH_RETURN_STALL = 2, 246 + CCU_RB_COLOR_RETURN_STALL = 3, 247 + CCU_DEPTH_BLOCKS = 6, 248 + CCU_COLOR_BLOCKS = 7, 249 + CCU_DEPTH_BLOCK_HIT = 8, 250 + CCU_COLOR_BLOCK_HIT = 9, 251 + CCU_DEPTH_FLAG1_COUNT = 10, 252 + CCU_DEPTH_FLAG2_COUNT = 11, 253 + CCU_DEPTH_FLAG3_COUNT = 12, 254 + CCU_DEPTH_FLAG4_COUNT = 13, 255 + CCU_COLOR_FLAG1_COUNT = 14, 256 + CCU_COLOR_FLAG2_COUNT = 15, 257 + CCU_COLOR_FLAG3_COUNT = 16, 258 + CCU_COLOR_FLAG4_COUNT = 17, 259 + CCU_PARTIAL_BLOCK_READ = 18, 260 + }; 261 + 262 + enum a4xx_cp_perfcounter_select { 263 + CP_ALWAYS_COUNT = 0, 264 + CP_BUSY = 1, 265 + CP_PFP_IDLE = 2, 266 + CP_PFP_BUSY_WORKING = 3, 267 + CP_PFP_STALL_CYCLES_ANY = 4, 268 + CP_PFP_STARVE_CYCLES_ANY = 5, 269 + CP_PFP_STARVED_PER_LOAD_ADDR = 6, 270 + CP_PFP_STALLED_PER_STORE_ADDR = 7, 271 + CP_PFP_PC_PROFILE = 8, 272 + CP_PFP_MATCH_PM4_PKT_PROFILE = 9, 273 + CP_PFP_COND_INDIRECT_DISCARDED = 10, 274 + CP_LONG_RESUMPTIONS = 11, 275 + CP_RESUME_CYCLES = 12, 276 + CP_RESUME_TO_BOUNDARY_CYCLES = 13, 277 + CP_LONG_PREEMPTIONS = 14, 278 + CP_PREEMPT_CYCLES = 15, 279 + CP_PREEMPT_TO_BOUNDARY_CYCLES = 16, 280 + CP_ME_FIFO_EMPTY_PFP_IDLE = 17, 281 + CP_ME_FIFO_EMPTY_PFP_BUSY = 18, 282 + CP_ME_FIFO_NOT_EMPTY_NOT_FULL = 19, 283 + CP_ME_FIFO_FULL_ME_BUSY = 20, 284 + CP_ME_FIFO_FULL_ME_NON_WORKING = 21, 285 + CP_ME_WAITING_FOR_PACKETS = 22, 286 + CP_ME_BUSY_WORKING = 23, 287 + CP_ME_STARVE_CYCLES_ANY = 24, 288 + CP_ME_STARVE_CYCLES_PER_PROFILE = 25, 289 + CP_ME_STALL_CYCLES_PER_PROFILE = 26, 290 + CP_ME_PC_PROFILE = 27, 291 + CP_RCIU_FIFO_EMPTY = 28, 292 + CP_RCIU_FIFO_NOT_EMPTY_NOT_FULL = 29, 293 + CP_RCIU_FIFO_FULL = 30, 294 + CP_RCIU_FIFO_FULL_NO_CONTEXT = 31, 295 + CP_RCIU_FIFO_FULL_AHB_MASTER = 32, 296 + CP_RCIU_FIFO_FULL_OTHER = 33, 297 + CP_AHB_IDLE = 34, 298 + CP_AHB_STALL_ON_GRANT_NO_SPLIT = 35, 299 + CP_AHB_STALL_ON_GRANT_SPLIT = 36, 300 + CP_AHB_STALL_ON_GRANT_SPLIT_PROFILE = 37, 301 + CP_AHB_BUSY_WORKING = 38, 302 + CP_AHB_BUSY_STALL_ON_HRDY = 39, 303 + CP_AHB_BUSY_STALL_ON_HRDY_PROFILE = 40, 304 + }; 305 + 306 + enum a4xx_gras_ras_perfcounter_select { 307 + RAS_SUPER_TILES = 0, 308 + RAS_8X8_TILES = 1, 309 + RAS_4X4_TILES = 2, 310 + RAS_BUSY_CYCLES = 3, 311 + RAS_STALL_CYCLES_BY_RB = 4, 312 + RAS_STALL_CYCLES_BY_VSC = 5, 313 + RAS_STARVE_CYCLES_BY_TSE = 6, 314 + RAS_SUPERTILE_CYCLES = 7, 315 + RAS_TILE_CYCLES = 8, 316 + RAS_FULLY_COVERED_SUPER_TILES = 9, 317 + RAS_FULLY_COVERED_8X8_TILES = 10, 318 + RAS_4X4_PRIM = 11, 319 + RAS_8X4_4X8_PRIM = 12, 320 + RAS_8X8_PRIM = 13, 321 + }; 322 + 323 + enum a4xx_gras_tse_perfcounter_select { 324 + TSE_INPUT_PRIM = 0, 325 + TSE_INPUT_NULL_PRIM = 1, 326 + TSE_TRIVAL_REJ_PRIM = 2, 327 + TSE_CLIPPED_PRIM = 3, 328 + TSE_NEW_PRIM = 4, 329 + TSE_ZERO_AREA_PRIM = 5, 330 + TSE_FACENESS_CULLED_PRIM = 6, 331 + TSE_ZERO_PIXEL_PRIM = 7, 332 + TSE_OUTPUT_NULL_PRIM = 8, 333 + TSE_OUTPUT_VISIBLE_PRIM = 9, 334 + TSE_PRE_CLIP_PRIM = 10, 335 + TSE_POST_CLIP_PRIM = 11, 336 + TSE_BUSY_CYCLES = 12, 337 + TSE_PC_STARVE = 13, 338 + TSE_RAS_STALL = 14, 339 + TSE_STALL_BARYPLANE_FIFO_FULL = 15, 340 + TSE_STALL_ZPLANE_FIFO_FULL = 16, 341 + }; 342 + 343 + enum a4xx_hlsq_perfcounter_select { 344 + HLSQ_SP_VS_STAGE_CONSTANT = 0, 345 + HLSQ_SP_VS_STAGE_INSTRUCTIONS = 1, 346 + HLSQ_SP_FS_STAGE_CONSTANT = 2, 347 + HLSQ_SP_FS_STAGE_INSTRUCTIONS = 3, 348 + HLSQ_TP_STATE = 4, 349 + HLSQ_QUADS = 5, 350 + HLSQ_PIXELS = 6, 351 + HLSQ_VERTICES = 7, 352 + HLSQ_SP_VS_STAGE_DATA_BYTES = 13, 353 + HLSQ_SP_FS_STAGE_DATA_BYTES = 14, 354 + HLSQ_BUSY_CYCLES = 15, 355 + HLSQ_STALL_CYCLES_SP_STATE = 16, 356 + HLSQ_STALL_CYCLES_SP_VS_STAGE = 17, 357 + HLSQ_STALL_CYCLES_SP_FS_STAGE = 18, 358 + HLSQ_STALL_CYCLES_UCHE = 19, 359 + HLSQ_RBBM_LOAD_CYCLES = 20, 360 + HLSQ_DI_TO_VS_START_SP = 21, 361 + HLSQ_DI_TO_FS_START_SP = 22, 362 + HLSQ_VS_STAGE_START_TO_DONE_SP = 23, 363 + HLSQ_FS_STAGE_START_TO_DONE_SP = 24, 364 + HLSQ_SP_STATE_COPY_CYCLES_VS_STAGE = 25, 365 + HLSQ_SP_STATE_COPY_CYCLES_FS_STAGE = 26, 366 + HLSQ_UCHE_LATENCY_CYCLES = 27, 367 + HLSQ_UCHE_LATENCY_COUNT = 28, 368 + HLSQ_STARVE_CYCLES_VFD = 29, 369 + }; 370 + 371 + enum a4xx_pc_perfcounter_select { 372 + PC_VIS_STREAMS_LOADED = 0, 373 + PC_VPC_PRIMITIVES = 2, 374 + PC_DEAD_PRIM = 3, 375 + PC_LIVE_PRIM = 4, 376 + PC_DEAD_DRAWCALLS = 5, 377 + PC_LIVE_DRAWCALLS = 6, 378 + PC_VERTEX_MISSES = 7, 379 + PC_STALL_CYCLES_VFD = 9, 380 + PC_STALL_CYCLES_TSE = 10, 381 + PC_STALL_CYCLES_UCHE = 11, 382 + PC_WORKING_CYCLES = 12, 383 + PC_IA_VERTICES = 13, 384 + PC_GS_PRIMITIVES = 14, 385 + PC_HS_INVOCATIONS = 15, 386 + PC_DS_INVOCATIONS = 16, 387 + PC_DS_PRIMITIVES = 17, 388 + PC_STARVE_CYCLES_FOR_INDEX = 20, 389 + PC_STARVE_CYCLES_FOR_TESS_FACTOR = 21, 390 + PC_STARVE_CYCLES_FOR_VIZ_STREAM = 22, 391 + PC_STALL_CYCLES_TESS = 23, 392 + PC_STARVE_CYCLES_FOR_POSITION = 24, 393 + PC_MODE0_DRAWCALL = 25, 394 + PC_MODE1_DRAWCALL = 26, 395 + PC_MODE2_DRAWCALL = 27, 396 + PC_MODE3_DRAWCALL = 28, 397 + PC_MODE4_DRAWCALL = 29, 398 + PC_PREDICATED_DEAD_DRAWCALL = 30, 399 + PC_STALL_CYCLES_BY_TSE_ONLY = 31, 400 + PC_STALL_CYCLES_BY_VPC_ONLY = 32, 401 + PC_VPC_POS_DATA_TRANSACTION = 33, 402 + PC_BUSY_CYCLES = 34, 403 + PC_STARVE_CYCLES_DI = 35, 404 + PC_STALL_CYCLES_VPC = 36, 405 + TESS_WORKING_CYCLES = 37, 406 + TESS_NUM_CYCLES_SETUP_WORKING = 38, 407 + TESS_NUM_CYCLES_PTGEN_WORKING = 39, 408 + TESS_NUM_CYCLES_CONNGEN_WORKING = 40, 409 + TESS_BUSY_CYCLES = 41, 410 + TESS_STARVE_CYCLES_PC = 42, 411 + TESS_STALL_CYCLES_PC = 43, 412 + }; 413 + 414 + enum a4xx_pwr_perfcounter_select { 415 + PWR_CORE_CLOCK_CYCLES = 0, 416 + PWR_BUSY_CLOCK_CYCLES = 1, 417 + }; 418 + 419 + enum a4xx_rb_perfcounter_select { 420 + RB_BUSY_CYCLES = 0, 421 + RB_BUSY_CYCLES_BINNING = 1, 422 + RB_BUSY_CYCLES_RENDERING = 2, 423 + RB_BUSY_CYCLES_RESOLVE = 3, 424 + RB_STARVE_CYCLES_BY_SP = 4, 425 + RB_STARVE_CYCLES_BY_RAS = 5, 426 + RB_STARVE_CYCLES_BY_MARB = 6, 427 + RB_STALL_CYCLES_BY_MARB = 7, 428 + RB_STALL_CYCLES_BY_HLSQ = 8, 429 + RB_RB_RB_MARB_DATA = 9, 430 + RB_SP_RB_QUAD = 10, 431 + RB_RAS_RB_Z_QUADS = 11, 432 + RB_GMEM_CH0_READ = 12, 433 + RB_GMEM_CH1_READ = 13, 434 + RB_GMEM_CH0_WRITE = 14, 435 + RB_GMEM_CH1_WRITE = 15, 436 + RB_CP_CONTEXT_DONE = 16, 437 + RB_CP_CACHE_FLUSH = 17, 438 + RB_CP_ZPASS_DONE = 18, 439 + RB_STALL_FIFO0_FULL = 19, 440 + RB_STALL_FIFO1_FULL = 20, 441 + RB_STALL_FIFO2_FULL = 21, 442 + RB_STALL_FIFO3_FULL = 22, 443 + RB_RB_HLSQ_TRANSACTIONS = 23, 444 + RB_Z_READ = 24, 445 + RB_Z_WRITE = 25, 446 + RB_C_READ = 26, 447 + RB_C_WRITE = 27, 448 + RB_C_READ_LATENCY = 28, 449 + RB_Z_READ_LATENCY = 29, 450 + RB_STALL_BY_UCHE = 30, 451 + RB_MARB_UCHE_TRANSACTIONS = 31, 452 + RB_CACHE_STALL_MISS = 32, 453 + RB_CACHE_STALL_FIFO_FULL = 33, 454 + RB_8BIT_BLENDER_UNITS_ACTIVE = 34, 455 + RB_16BIT_BLENDER_UNITS_ACTIVE = 35, 456 + RB_SAMPLER_UNITS_ACTIVE = 36, 457 + RB_TOTAL_PASS = 38, 458 + RB_Z_PASS = 39, 459 + RB_Z_FAIL = 40, 460 + RB_S_FAIL = 41, 461 + RB_POWER0 = 42, 462 + RB_POWER1 = 43, 463 + RB_POWER2 = 44, 464 + RB_POWER3 = 45, 465 + RB_POWER4 = 46, 466 + RB_POWER5 = 47, 467 + RB_POWER6 = 48, 468 + RB_POWER7 = 49, 469 + }; 470 + 471 + enum a4xx_rbbm_perfcounter_select { 472 + RBBM_ALWAYS_ON = 0, 473 + RBBM_VBIF_BUSY = 1, 474 + RBBM_TSE_BUSY = 2, 475 + RBBM_RAS_BUSY = 3, 476 + RBBM_PC_DCALL_BUSY = 4, 477 + RBBM_PC_VSD_BUSY = 5, 478 + RBBM_VFD_BUSY = 6, 479 + RBBM_VPC_BUSY = 7, 480 + RBBM_UCHE_BUSY = 8, 481 + RBBM_VSC_BUSY = 9, 482 + RBBM_HLSQ_BUSY = 10, 483 + RBBM_ANY_RB_BUSY = 11, 484 + RBBM_ANY_TPL1_BUSY = 12, 485 + RBBM_ANY_SP_BUSY = 13, 486 + RBBM_ANY_MARB_BUSY = 14, 487 + RBBM_ANY_ARB_BUSY = 15, 488 + RBBM_AHB_STATUS_BUSY = 16, 489 + RBBM_AHB_STATUS_STALLED = 17, 490 + RBBM_AHB_STATUS_TXFR = 18, 491 + RBBM_AHB_STATUS_TXFR_SPLIT = 19, 492 + RBBM_AHB_STATUS_TXFR_ERROR = 20, 493 + RBBM_AHB_STATUS_LONG_STALL = 21, 494 + RBBM_STATUS_MASKED = 22, 495 + RBBM_CP_BUSY_GFX_CORE_IDLE = 23, 496 + RBBM_TESS_BUSY = 24, 497 + RBBM_COM_BUSY = 25, 498 + RBBM_DCOM_BUSY = 32, 499 + RBBM_ANY_CCU_BUSY = 33, 500 + RBBM_DPM_BUSY = 34, 501 + }; 502 + 503 + enum a4xx_sp_perfcounter_select { 504 + SP_LM_LOAD_INSTRUCTIONS = 0, 505 + SP_LM_STORE_INSTRUCTIONS = 1, 506 + SP_LM_ATOMICS = 2, 507 + SP_GM_LOAD_INSTRUCTIONS = 3, 508 + SP_GM_STORE_INSTRUCTIONS = 4, 509 + SP_GM_ATOMICS = 5, 510 + SP_VS_STAGE_TEX_INSTRUCTIONS = 6, 511 + SP_VS_STAGE_CFLOW_INSTRUCTIONS = 7, 512 + SP_VS_STAGE_EFU_INSTRUCTIONS = 8, 513 + SP_VS_STAGE_FULL_ALU_INSTRUCTIONS = 9, 514 + SP_VS_STAGE_HALF_ALU_INSTRUCTIONS = 10, 515 + SP_FS_STAGE_TEX_INSTRUCTIONS = 11, 516 + SP_FS_STAGE_CFLOW_INSTRUCTIONS = 12, 517 + SP_FS_STAGE_EFU_INSTRUCTIONS = 13, 518 + SP_FS_STAGE_FULL_ALU_INSTRUCTIONS = 14, 519 + SP_FS_STAGE_HALF_ALU_INSTRUCTIONS = 15, 520 + SP_VS_INSTRUCTIONS = 17, 521 + SP_FS_INSTRUCTIONS = 18, 522 + SP_ADDR_LOCK_COUNT = 19, 523 + SP_UCHE_READ_TRANS = 20, 524 + SP_UCHE_WRITE_TRANS = 21, 525 + SP_EXPORT_VPC_TRANS = 22, 526 + SP_EXPORT_RB_TRANS = 23, 527 + SP_PIXELS_KILLED = 24, 528 + SP_ICL1_REQUESTS = 25, 529 + SP_ICL1_MISSES = 26, 530 + SP_ICL0_REQUESTS = 27, 531 + SP_ICL0_MISSES = 28, 532 + SP_ALU_WORKING_CYCLES = 29, 533 + SP_EFU_WORKING_CYCLES = 30, 534 + SP_STALL_CYCLES_BY_VPC = 31, 535 + SP_STALL_CYCLES_BY_TP = 32, 536 + SP_STALL_CYCLES_BY_UCHE = 33, 537 + SP_STALL_CYCLES_BY_RB = 34, 538 + SP_BUSY_CYCLES = 35, 539 + SP_HS_INSTRUCTIONS = 36, 540 + SP_DS_INSTRUCTIONS = 37, 541 + SP_GS_INSTRUCTIONS = 38, 542 + SP_CS_INSTRUCTIONS = 39, 543 + SP_SCHEDULER_NON_WORKING = 40, 544 + SP_WAVE_CONTEXTS = 41, 545 + SP_WAVE_CONTEXT_CYCLES = 42, 546 + SP_POWER0 = 43, 547 + SP_POWER1 = 44, 548 + SP_POWER2 = 45, 549 + SP_POWER3 = 46, 550 + SP_POWER4 = 47, 551 + SP_POWER5 = 48, 552 + SP_POWER6 = 49, 553 + SP_POWER7 = 50, 554 + SP_POWER8 = 51, 555 + SP_POWER9 = 52, 556 + SP_POWER10 = 53, 557 + SP_POWER11 = 54, 558 + SP_POWER12 = 55, 559 + SP_POWER13 = 56, 560 + SP_POWER14 = 57, 561 + SP_POWER15 = 58, 562 + }; 563 + 564 + enum a4xx_tp_perfcounter_select { 565 + TP_L1_REQUESTS = 0, 566 + TP_L1_MISSES = 1, 567 + TP_QUADS_OFFSET = 8, 568 + TP_QUAD_SHADOW = 9, 569 + TP_QUADS_ARRAY = 10, 570 + TP_QUADS_GRADIENT = 11, 571 + TP_QUADS_1D2D = 12, 572 + TP_QUADS_3DCUBE = 13, 573 + TP_BUSY_CYCLES = 16, 574 + TP_STALL_CYCLES_BY_ARB = 17, 575 + TP_STATE_CACHE_REQUESTS = 20, 576 + TP_STATE_CACHE_MISSES = 21, 577 + TP_POWER0 = 22, 578 + TP_POWER1 = 23, 579 + TP_POWER2 = 24, 580 + TP_POWER3 = 25, 581 + TP_POWER4 = 26, 582 + TP_POWER5 = 27, 583 + TP_POWER6 = 28, 584 + TP_POWER7 = 29, 585 + }; 586 + 587 + enum a4xx_uche_perfcounter_select { 588 + UCHE_VBIF_READ_BEATS_TP = 0, 589 + UCHE_VBIF_READ_BEATS_VFD = 1, 590 + UCHE_VBIF_READ_BEATS_HLSQ = 2, 591 + UCHE_VBIF_READ_BEATS_MARB = 3, 592 + UCHE_VBIF_READ_BEATS_SP = 4, 593 + UCHE_READ_REQUESTS_TP = 5, 594 + UCHE_READ_REQUESTS_VFD = 6, 595 + UCHE_READ_REQUESTS_HLSQ = 7, 596 + UCHE_READ_REQUESTS_MARB = 8, 597 + UCHE_READ_REQUESTS_SP = 9, 598 + UCHE_WRITE_REQUESTS_MARB = 10, 599 + UCHE_WRITE_REQUESTS_SP = 11, 600 + UCHE_TAG_CHECK_FAILS = 12, 601 + UCHE_EVICTS = 13, 602 + UCHE_FLUSHES = 14, 603 + UCHE_VBIF_LATENCY_CYCLES = 15, 604 + UCHE_VBIF_LATENCY_SAMPLES = 16, 605 + UCHE_BUSY_CYCLES = 17, 606 + UCHE_VBIF_READ_BEATS_PC = 18, 607 + UCHE_READ_REQUESTS_PC = 19, 608 + UCHE_WRITE_REQUESTS_VPC = 20, 609 + UCHE_STALL_BY_VBIF = 21, 610 + UCHE_WRITE_REQUESTS_VSC = 22, 611 + UCHE_POWER0 = 23, 612 + UCHE_POWER1 = 24, 613 + UCHE_POWER2 = 25, 614 + UCHE_POWER3 = 26, 615 + UCHE_POWER4 = 27, 616 + UCHE_POWER5 = 28, 617 + UCHE_POWER6 = 29, 618 + UCHE_POWER7 = 30, 619 + }; 620 + 621 + enum a4xx_vbif_perfcounter_select { 622 + AXI_READ_REQUESTS_ID_0 = 0, 623 + AXI_READ_REQUESTS_ID_1 = 1, 624 + AXI_READ_REQUESTS_ID_2 = 2, 625 + AXI_READ_REQUESTS_ID_3 = 3, 626 + AXI_READ_REQUESTS_ID_4 = 4, 627 + AXI_READ_REQUESTS_ID_5 = 5, 628 + AXI_READ_REQUESTS_ID_6 = 6, 629 + AXI_READ_REQUESTS_ID_7 = 7, 630 + AXI_READ_REQUESTS_ID_8 = 8, 631 + AXI_READ_REQUESTS_ID_9 = 9, 632 + AXI_READ_REQUESTS_ID_10 = 10, 633 + AXI_READ_REQUESTS_ID_11 = 11, 634 + AXI_READ_REQUESTS_ID_12 = 12, 635 + AXI_READ_REQUESTS_ID_13 = 13, 636 + AXI_READ_REQUESTS_ID_14 = 14, 637 + AXI_READ_REQUESTS_ID_15 = 15, 638 + AXI0_READ_REQUESTS_TOTAL = 16, 639 + AXI1_READ_REQUESTS_TOTAL = 17, 640 + AXI2_READ_REQUESTS_TOTAL = 18, 641 + AXI3_READ_REQUESTS_TOTAL = 19, 642 + AXI_READ_REQUESTS_TOTAL = 20, 643 + AXI_WRITE_REQUESTS_ID_0 = 21, 644 + AXI_WRITE_REQUESTS_ID_1 = 22, 645 + AXI_WRITE_REQUESTS_ID_2 = 23, 646 + AXI_WRITE_REQUESTS_ID_3 = 24, 647 + AXI_WRITE_REQUESTS_ID_4 = 25, 648 + AXI_WRITE_REQUESTS_ID_5 = 26, 649 + AXI_WRITE_REQUESTS_ID_6 = 27, 650 + AXI_WRITE_REQUESTS_ID_7 = 28, 651 + AXI_WRITE_REQUESTS_ID_8 = 29, 652 + AXI_WRITE_REQUESTS_ID_9 = 30, 653 + AXI_WRITE_REQUESTS_ID_10 = 31, 654 + AXI_WRITE_REQUESTS_ID_11 = 32, 655 + AXI_WRITE_REQUESTS_ID_12 = 33, 656 + AXI_WRITE_REQUESTS_ID_13 = 34, 657 + AXI_WRITE_REQUESTS_ID_14 = 35, 658 + AXI_WRITE_REQUESTS_ID_15 = 36, 659 + AXI0_WRITE_REQUESTS_TOTAL = 37, 660 + AXI1_WRITE_REQUESTS_TOTAL = 38, 661 + AXI2_WRITE_REQUESTS_TOTAL = 39, 662 + AXI3_WRITE_REQUESTS_TOTAL = 40, 663 + AXI_WRITE_REQUESTS_TOTAL = 41, 664 + AXI_TOTAL_REQUESTS = 42, 665 + AXI_READ_DATA_BEATS_ID_0 = 43, 666 + AXI_READ_DATA_BEATS_ID_1 = 44, 667 + AXI_READ_DATA_BEATS_ID_2 = 45, 668 + AXI_READ_DATA_BEATS_ID_3 = 46, 669 + AXI_READ_DATA_BEATS_ID_4 = 47, 670 + AXI_READ_DATA_BEATS_ID_5 = 48, 671 + AXI_READ_DATA_BEATS_ID_6 = 49, 672 + AXI_READ_DATA_BEATS_ID_7 = 50, 673 + AXI_READ_DATA_BEATS_ID_8 = 51, 674 + AXI_READ_DATA_BEATS_ID_9 = 52, 675 + AXI_READ_DATA_BEATS_ID_10 = 53, 676 + AXI_READ_DATA_BEATS_ID_11 = 54, 677 + AXI_READ_DATA_BEATS_ID_12 = 55, 678 + AXI_READ_DATA_BEATS_ID_13 = 56, 679 + AXI_READ_DATA_BEATS_ID_14 = 57, 680 + AXI_READ_DATA_BEATS_ID_15 = 58, 681 + AXI0_READ_DATA_BEATS_TOTAL = 59, 682 + AXI1_READ_DATA_BEATS_TOTAL = 60, 683 + AXI2_READ_DATA_BEATS_TOTAL = 61, 684 + AXI3_READ_DATA_BEATS_TOTAL = 62, 685 + AXI_READ_DATA_BEATS_TOTAL = 63, 686 + AXI_WRITE_DATA_BEATS_ID_0 = 64, 687 + AXI_WRITE_DATA_BEATS_ID_1 = 65, 688 + AXI_WRITE_DATA_BEATS_ID_2 = 66, 689 + AXI_WRITE_DATA_BEATS_ID_3 = 67, 690 + AXI_WRITE_DATA_BEATS_ID_4 = 68, 691 + AXI_WRITE_DATA_BEATS_ID_5 = 69, 692 + AXI_WRITE_DATA_BEATS_ID_6 = 70, 693 + AXI_WRITE_DATA_BEATS_ID_7 = 71, 694 + AXI_WRITE_DATA_BEATS_ID_8 = 72, 695 + AXI_WRITE_DATA_BEATS_ID_9 = 73, 696 + AXI_WRITE_DATA_BEATS_ID_10 = 74, 697 + AXI_WRITE_DATA_BEATS_ID_11 = 75, 698 + AXI_WRITE_DATA_BEATS_ID_12 = 76, 699 + AXI_WRITE_DATA_BEATS_ID_13 = 77, 700 + AXI_WRITE_DATA_BEATS_ID_14 = 78, 701 + AXI_WRITE_DATA_BEATS_ID_15 = 79, 702 + AXI0_WRITE_DATA_BEATS_TOTAL = 80, 703 + AXI1_WRITE_DATA_BEATS_TOTAL = 81, 704 + AXI2_WRITE_DATA_BEATS_TOTAL = 82, 705 + AXI3_WRITE_DATA_BEATS_TOTAL = 83, 706 + AXI_WRITE_DATA_BEATS_TOTAL = 84, 707 + AXI_DATA_BEATS_TOTAL = 85, 708 + CYCLES_HELD_OFF_ID_0 = 86, 709 + CYCLES_HELD_OFF_ID_1 = 87, 710 + CYCLES_HELD_OFF_ID_2 = 88, 711 + CYCLES_HELD_OFF_ID_3 = 89, 712 + CYCLES_HELD_OFF_ID_4 = 90, 713 + CYCLES_HELD_OFF_ID_5 = 91, 714 + CYCLES_HELD_OFF_ID_6 = 92, 715 + CYCLES_HELD_OFF_ID_7 = 93, 716 + CYCLES_HELD_OFF_ID_8 = 94, 717 + CYCLES_HELD_OFF_ID_9 = 95, 718 + CYCLES_HELD_OFF_ID_10 = 96, 719 + CYCLES_HELD_OFF_ID_11 = 97, 720 + CYCLES_HELD_OFF_ID_12 = 98, 721 + CYCLES_HELD_OFF_ID_13 = 99, 722 + CYCLES_HELD_OFF_ID_14 = 100, 723 + CYCLES_HELD_OFF_ID_15 = 101, 724 + AXI_READ_REQUEST_HELD_OFF = 102, 725 + AXI_WRITE_REQUEST_HELD_OFF = 103, 726 + AXI_REQUEST_HELD_OFF = 104, 727 + AXI_WRITE_DATA_HELD_OFF = 105, 728 + OCMEM_AXI_READ_REQUEST_HELD_OFF = 106, 729 + OCMEM_AXI_WRITE_REQUEST_HELD_OFF = 107, 730 + OCMEM_AXI_REQUEST_HELD_OFF = 108, 731 + OCMEM_AXI_WRITE_DATA_HELD_OFF = 109, 732 + ELAPSED_CYCLES_DDR = 110, 733 + ELAPSED_CYCLES_OCMEM = 111, 734 + }; 735 + 736 + enum a4xx_vfd_perfcounter_select { 737 + VFD_UCHE_BYTE_FETCHED = 0, 738 + VFD_UCHE_TRANS = 1, 739 + VFD_FETCH_INSTRUCTIONS = 3, 740 + VFD_BUSY_CYCLES = 5, 741 + VFD_STALL_CYCLES_UCHE = 6, 742 + VFD_STALL_CYCLES_HLSQ = 7, 743 + VFD_STALL_CYCLES_VPC_BYPASS = 8, 744 + VFD_STALL_CYCLES_VPC_ALLOC = 9, 745 + VFD_MODE_0_FIBERS = 13, 746 + VFD_MODE_1_FIBERS = 14, 747 + VFD_MODE_2_FIBERS = 15, 748 + VFD_MODE_3_FIBERS = 16, 749 + VFD_MODE_4_FIBERS = 17, 750 + VFD_BFIFO_STALL = 18, 751 + VFD_NUM_VERTICES_TOTAL = 19, 752 + VFD_PACKER_FULL = 20, 753 + VFD_UCHE_REQUEST_FIFO_FULL = 21, 754 + VFD_STARVE_CYCLES_PC = 22, 755 + VFD_STARVE_CYCLES_UCHE = 23, 756 + }; 757 + 758 + enum a4xx_vpc_perfcounter_select { 759 + VPC_SP_LM_COMPONENTS = 2, 760 + VPC_SP0_LM_BYTES = 3, 761 + VPC_SP1_LM_BYTES = 4, 762 + VPC_SP2_LM_BYTES = 5, 763 + VPC_SP3_LM_BYTES = 6, 764 + VPC_WORKING_CYCLES = 7, 765 + VPC_STALL_CYCLES_LM = 8, 766 + VPC_STARVE_CYCLES_RAS = 9, 767 + VPC_STREAMOUT_CYCLES = 10, 768 + VPC_UCHE_TRANSACTIONS = 12, 769 + VPC_STALL_CYCLES_UCHE = 13, 770 + VPC_BUSY_CYCLES = 14, 771 + VPC_STARVE_CYCLES_SP = 15, 772 + }; 773 + 774 + enum a4xx_vsc_perfcounter_select { 775 + VSC_BUSY_CYCLES = 0, 776 + VSC_WORKING_CYCLES = 1, 777 + VSC_STALL_CYCLES_UCHE = 2, 778 + VSC_STARVE_CYCLES_RAS = 3, 779 + VSC_EOT_NUM = 4, 273 780 }; 274 781 275 782 enum a4xx_tex_filter { ··· 897 326 898 327 #define REG_A4XX_RB_PERFCTR_RB_SEL_7 0x00000cce 899 328 329 + #define REG_A4XX_RB_PERFCTR_CCU_SEL_0 0x00000ccf 330 + 331 + #define REG_A4XX_RB_PERFCTR_CCU_SEL_1 0x00000cd0 332 + 333 + #define REG_A4XX_RB_PERFCTR_CCU_SEL_2 0x00000cd1 334 + 900 335 #define REG_A4XX_RB_PERFCTR_CCU_SEL_3 0x00000cd2 901 336 902 337 #define REG_A4XX_RB_FRAME_BUFFER_DIMENSION 0x00000ce0 ··· 977 400 #define A4XX_RB_MRT_CONTROL_READ_DEST_ENABLE 0x00000008 978 401 #define A4XX_RB_MRT_CONTROL_BLEND 0x00000010 979 402 #define A4XX_RB_MRT_CONTROL_BLEND2 0x00000020 980 - #define A4XX_RB_MRT_CONTROL_FASTCLEAR 0x00000400 981 - #define A4XX_RB_MRT_CONTROL_B11 0x00000800 403 + #define A4XX_RB_MRT_CONTROL_ROP_ENABLE 0x00000040 404 + #define A4XX_RB_MRT_CONTROL_ROP_CODE__MASK 0x00000f00 405 + #define A4XX_RB_MRT_CONTROL_ROP_CODE__SHIFT 8 406 + static inline uint32_t A4XX_RB_MRT_CONTROL_ROP_CODE(enum a3xx_rop_code val) 407 + { 408 + return ((val) << A4XX_RB_MRT_CONTROL_ROP_CODE__SHIFT) & A4XX_RB_MRT_CONTROL_ROP_CODE__MASK; 409 + } 982 410 #define A4XX_RB_MRT_CONTROL_COMPONENT_ENABLE__MASK 0x0f000000 983 411 #define A4XX_RB_MRT_CONTROL_COMPONENT_ENABLE__SHIFT 24 984 412 static inline uint32_t A4XX_RB_MRT_CONTROL_COMPONENT_ENABLE(uint32_t val) ··· 1072 490 return ((val) << A4XX_RB_MRT_BLEND_CONTROL_ALPHA_DEST_FACTOR__SHIFT) & A4XX_RB_MRT_BLEND_CONTROL_ALPHA_DEST_FACTOR__MASK; 1073 491 } 1074 492 1075 - #define REG_A4XX_RB_BLEND_RED 0x000020f3 1076 - #define A4XX_RB_BLEND_RED_UINT__MASK 0x00007fff 493 + #define REG_A4XX_RB_BLEND_RED 0x000020f0 494 + #define A4XX_RB_BLEND_RED_UINT__MASK 0x0000ffff 1077 495 #define A4XX_RB_BLEND_RED_UINT__SHIFT 0 1078 496 static inline uint32_t A4XX_RB_BLEND_RED_UINT(uint32_t val) 1079 497 { ··· 1086 504 return ((util_float_to_half(val)) << A4XX_RB_BLEND_RED_FLOAT__SHIFT) & A4XX_RB_BLEND_RED_FLOAT__MASK; 1087 505 } 1088 506 1089 - #define REG_A4XX_RB_BLEND_GREEN 0x000020f4 1090 - #define A4XX_RB_BLEND_GREEN_UINT__MASK 0x00007fff 507 + #define REG_A4XX_RB_BLEND_RED_F32 0x000020f1 508 + #define A4XX_RB_BLEND_RED_F32__MASK 0xffffffff 509 + #define A4XX_RB_BLEND_RED_F32__SHIFT 0 510 + static inline uint32_t A4XX_RB_BLEND_RED_F32(float val) 511 + { 512 + return ((fui(val)) << A4XX_RB_BLEND_RED_F32__SHIFT) & A4XX_RB_BLEND_RED_F32__MASK; 513 + } 514 + 515 + #define REG_A4XX_RB_BLEND_GREEN 0x000020f2 516 + #define A4XX_RB_BLEND_GREEN_UINT__MASK 0x0000ffff 1091 517 #define A4XX_RB_BLEND_GREEN_UINT__SHIFT 0 1092 518 static inline uint32_t A4XX_RB_BLEND_GREEN_UINT(uint32_t val) 1093 519 { ··· 1108 518 return ((util_float_to_half(val)) << A4XX_RB_BLEND_GREEN_FLOAT__SHIFT) & A4XX_RB_BLEND_GREEN_FLOAT__MASK; 1109 519 } 1110 520 1111 - #define REG_A4XX_RB_BLEND_BLUE 0x000020f5 1112 - #define A4XX_RB_BLEND_BLUE_UINT__MASK 0x00007fff 521 + #define REG_A4XX_RB_BLEND_GREEN_F32 0x000020f3 522 + #define A4XX_RB_BLEND_GREEN_F32__MASK 0xffffffff 523 + #define A4XX_RB_BLEND_GREEN_F32__SHIFT 0 524 + static inline uint32_t A4XX_RB_BLEND_GREEN_F32(float val) 525 + { 526 + return ((fui(val)) << A4XX_RB_BLEND_GREEN_F32__SHIFT) & A4XX_RB_BLEND_GREEN_F32__MASK; 527 + } 528 + 529 + #define REG_A4XX_RB_BLEND_BLUE 0x000020f4 530 + #define A4XX_RB_BLEND_BLUE_UINT__MASK 0x0000ffff 1113 531 #define A4XX_RB_BLEND_BLUE_UINT__SHIFT 0 1114 532 static inline uint32_t A4XX_RB_BLEND_BLUE_UINT(uint32_t val) 1115 533 { ··· 1130 532 return ((util_float_to_half(val)) << A4XX_RB_BLEND_BLUE_FLOAT__SHIFT) & A4XX_RB_BLEND_BLUE_FLOAT__MASK; 1131 533 } 1132 534 535 + #define REG_A4XX_RB_BLEND_BLUE_F32 0x000020f5 536 + #define A4XX_RB_BLEND_BLUE_F32__MASK 0xffffffff 537 + #define A4XX_RB_BLEND_BLUE_F32__SHIFT 0 538 + static inline uint32_t A4XX_RB_BLEND_BLUE_F32(float val) 539 + { 540 + return ((fui(val)) << A4XX_RB_BLEND_BLUE_F32__SHIFT) & A4XX_RB_BLEND_BLUE_F32__MASK; 541 + } 542 + 1133 543 #define REG_A4XX_RB_BLEND_ALPHA 0x000020f6 1134 - #define A4XX_RB_BLEND_ALPHA_UINT__MASK 0x00007fff 544 + #define A4XX_RB_BLEND_ALPHA_UINT__MASK 0x0000ffff 1135 545 #define A4XX_RB_BLEND_ALPHA_UINT__SHIFT 0 1136 546 static inline uint32_t A4XX_RB_BLEND_ALPHA_UINT(uint32_t val) 1137 547 { ··· 1150 544 static inline uint32_t A4XX_RB_BLEND_ALPHA_FLOAT(float val) 1151 545 { 1152 546 return ((util_float_to_half(val)) << A4XX_RB_BLEND_ALPHA_FLOAT__SHIFT) & A4XX_RB_BLEND_ALPHA_FLOAT__MASK; 547 + } 548 + 549 + #define REG_A4XX_RB_BLEND_ALPHA_F32 0x000020f7 550 + #define A4XX_RB_BLEND_ALPHA_F32__MASK 0xffffffff 551 + #define A4XX_RB_BLEND_ALPHA_F32__SHIFT 0 552 + static inline uint32_t A4XX_RB_BLEND_ALPHA_F32(float val) 553 + { 554 + return ((fui(val)) << A4XX_RB_BLEND_ALPHA_F32__SHIFT) & A4XX_RB_BLEND_ALPHA_F32__MASK; 1153 555 } 1154 556 1155 557 #define REG_A4XX_RB_ALPHA_CONTROL 0x000020f8 ··· 1182 568 { 1183 569 return ((val) << A4XX_RB_FS_OUTPUT_ENABLE_BLEND__SHIFT) & A4XX_RB_FS_OUTPUT_ENABLE_BLEND__MASK; 1184 570 } 1185 - #define A4XX_RB_FS_OUTPUT_FAST_CLEAR 0x00000100 571 + #define A4XX_RB_FS_OUTPUT_INDEPENDENT_BLEND 0x00000100 1186 572 #define A4XX_RB_FS_OUTPUT_SAMPLE_MASK__MASK 0xffff0000 1187 573 #define A4XX_RB_FS_OUTPUT_SAMPLE_MASK__SHIFT 16 1188 574 static inline uint32_t A4XX_RB_FS_OUTPUT_SAMPLE_MASK(uint32_t val) ··· 1350 736 } 1351 737 #define A4XX_RB_DEPTH_CONTROL_BF_ENABLE 0x00000080 1352 738 #define A4XX_RB_DEPTH_CONTROL_EARLY_Z_DISABLE 0x00010000 739 + #define A4XX_RB_DEPTH_CONTROL_FORCE_FRAGZ_TO_FS 0x00020000 1353 740 #define A4XX_RB_DEPTH_CONTROL_Z_TEST_ENABLE 0x80000000 1354 741 1355 742 #define REG_A4XX_RB_DEPTH_CLEAR 0x00002102 ··· 1611 996 1612 997 #define REG_A4XX_RBBM_CFG_DEBBUS_SEL_D 0x0000004d 1613 998 999 + #define REG_A4XX_RBBM_POWER_CNTL_IP 0x00000098 1000 + #define A4XX_RBBM_POWER_CNTL_IP_SW_COLLAPSE 0x00000001 1001 + #define A4XX_RBBM_POWER_CNTL_IP_SP_TP_PWR_ON 0x00100000 1002 + 1614 1003 #define REG_A4XX_RBBM_PERFCTR_CP_0_LO 0x0000009c 1004 + 1005 + #define REG_A4XX_RBBM_PERFCTR_CP_0_HI 0x0000009d 1006 + 1007 + #define REG_A4XX_RBBM_PERFCTR_CP_1_LO 0x0000009e 1008 + 1009 + #define REG_A4XX_RBBM_PERFCTR_CP_1_HI 0x0000009f 1010 + 1011 + #define REG_A4XX_RBBM_PERFCTR_CP_2_LO 0x000000a0 1012 + 1013 + #define REG_A4XX_RBBM_PERFCTR_CP_2_HI 0x000000a1 1014 + 1015 + #define REG_A4XX_RBBM_PERFCTR_CP_3_LO 0x000000a2 1016 + 1017 + #define REG_A4XX_RBBM_PERFCTR_CP_3_HI 0x000000a3 1018 + 1019 + #define REG_A4XX_RBBM_PERFCTR_CP_4_LO 0x000000a4 1020 + 1021 + #define REG_A4XX_RBBM_PERFCTR_CP_4_HI 0x000000a5 1022 + 1023 + #define REG_A4XX_RBBM_PERFCTR_CP_5_LO 0x000000a6 1024 + 1025 + #define REG_A4XX_RBBM_PERFCTR_CP_5_HI 0x000000a7 1026 + 1027 + #define REG_A4XX_RBBM_PERFCTR_CP_6_LO 0x000000a8 1028 + 1029 + #define REG_A4XX_RBBM_PERFCTR_CP_6_HI 0x000000a9 1030 + 1031 + #define REG_A4XX_RBBM_PERFCTR_CP_7_LO 0x000000aa 1032 + 1033 + #define REG_A4XX_RBBM_PERFCTR_CP_7_HI 0x000000ab 1034 + 1035 + #define REG_A4XX_RBBM_PERFCTR_RBBM_0_LO 0x000000ac 1036 + 1037 + #define REG_A4XX_RBBM_PERFCTR_RBBM_0_HI 0x000000ad 1038 + 1039 + #define REG_A4XX_RBBM_PERFCTR_RBBM_1_LO 0x000000ae 1040 + 1041 + #define REG_A4XX_RBBM_PERFCTR_RBBM_1_HI 0x000000af 1042 + 1043 + #define REG_A4XX_RBBM_PERFCTR_RBBM_2_LO 0x000000b0 1044 + 1045 + #define REG_A4XX_RBBM_PERFCTR_RBBM_2_HI 0x000000b1 1046 + 1047 + #define REG_A4XX_RBBM_PERFCTR_RBBM_3_LO 0x000000b2 1048 + 1049 + #define REG_A4XX_RBBM_PERFCTR_RBBM_3_HI 0x000000b3 1050 + 1051 + #define REG_A4XX_RBBM_PERFCTR_PC_0_LO 0x000000b4 1052 + 1053 + #define REG_A4XX_RBBM_PERFCTR_PC_0_HI 0x000000b5 1054 + 1055 + #define REG_A4XX_RBBM_PERFCTR_PC_1_LO 0x000000b6 1056 + 1057 + #define REG_A4XX_RBBM_PERFCTR_PC_1_HI 0x000000b7 1058 + 1059 + #define REG_A4XX_RBBM_PERFCTR_PC_2_LO 0x000000b8 1060 + 1061 + #define REG_A4XX_RBBM_PERFCTR_PC_2_HI 0x000000b9 1062 + 1063 + #define REG_A4XX_RBBM_PERFCTR_PC_3_LO 0x000000ba 1064 + 1065 + #define REG_A4XX_RBBM_PERFCTR_PC_3_HI 0x000000bb 1066 + 1067 + #define REG_A4XX_RBBM_PERFCTR_PC_4_LO 0x000000bc 1068 + 1069 + #define REG_A4XX_RBBM_PERFCTR_PC_4_HI 0x000000bd 1070 + 1071 + #define REG_A4XX_RBBM_PERFCTR_PC_5_LO 0x000000be 1072 + 1073 + #define REG_A4XX_RBBM_PERFCTR_PC_5_HI 0x000000bf 1074 + 1075 + #define REG_A4XX_RBBM_PERFCTR_PC_6_LO 0x000000c0 1076 + 1077 + #define REG_A4XX_RBBM_PERFCTR_PC_6_HI 0x000000c1 1078 + 1079 + #define REG_A4XX_RBBM_PERFCTR_PC_7_LO 0x000000c2 1080 + 1081 + #define REG_A4XX_RBBM_PERFCTR_PC_7_HI 0x000000c3 1082 + 1083 + #define REG_A4XX_RBBM_PERFCTR_VFD_0_LO 0x000000c4 1084 + 1085 + #define REG_A4XX_RBBM_PERFCTR_VFD_0_HI 0x000000c5 1086 + 1087 + #define REG_A4XX_RBBM_PERFCTR_VFD_1_LO 0x000000c6 1088 + 1089 + #define REG_A4XX_RBBM_PERFCTR_VFD_1_HI 0x000000c7 1090 + 1091 + #define REG_A4XX_RBBM_PERFCTR_VFD_2_LO 0x000000c8 1092 + 1093 + #define REG_A4XX_RBBM_PERFCTR_VFD_2_HI 0x000000c9 1094 + 1095 + #define REG_A4XX_RBBM_PERFCTR_VFD_3_LO 0x000000ca 1096 + 1097 + #define REG_A4XX_RBBM_PERFCTR_VFD_3_HI 0x000000cb 1098 + 1099 + #define REG_A4XX_RBBM_PERFCTR_VFD_4_LO 0x000000cc 1100 + 1101 + #define REG_A4XX_RBBM_PERFCTR_VFD_4_HI 0x000000cd 1102 + 1103 + #define REG_A4XX_RBBM_PERFCTR_VFD_5_LO 0x000000ce 1104 + 1105 + #define REG_A4XX_RBBM_PERFCTR_VFD_5_HI 0x000000cf 1106 + 1107 + #define REG_A4XX_RBBM_PERFCTR_VFD_6_LO 0x000000d0 1108 + 1109 + #define REG_A4XX_RBBM_PERFCTR_VFD_6_HI 0x000000d1 1110 + 1111 + #define REG_A4XX_RBBM_PERFCTR_VFD_7_LO 0x000000d2 1112 + 1113 + #define REG_A4XX_RBBM_PERFCTR_VFD_7_HI 0x000000d3 1114 + 1115 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_0_LO 0x000000d4 1116 + 1117 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_0_HI 0x000000d5 1118 + 1119 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_1_LO 0x000000d6 1120 + 1121 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_1_HI 0x000000d7 1122 + 1123 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_2_LO 0x000000d8 1124 + 1125 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_2_HI 0x000000d9 1126 + 1127 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_3_LO 0x000000da 1128 + 1129 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_3_HI 0x000000db 1130 + 1131 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_4_LO 0x000000dc 1132 + 1133 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_4_HI 0x000000dd 1134 + 1135 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_5_LO 0x000000de 1136 + 1137 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_5_HI 0x000000df 1138 + 1139 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_6_LO 0x000000e0 1140 + 1141 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_6_HI 0x000000e1 1142 + 1143 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_7_LO 0x000000e2 1144 + 1145 + #define REG_A4XX_RBBM_PERFCTR_HLSQ_7_HI 0x000000e3 1146 + 1147 + #define REG_A4XX_RBBM_PERFCTR_VPC_0_LO 0x000000e4 1148 + 1149 + #define REG_A4XX_RBBM_PERFCTR_VPC_0_HI 0x000000e5 1150 + 1151 + #define REG_A4XX_RBBM_PERFCTR_VPC_1_LO 0x000000e6 1152 + 1153 + #define REG_A4XX_RBBM_PERFCTR_VPC_1_HI 0x000000e7 1154 + 1155 + #define REG_A4XX_RBBM_PERFCTR_VPC_2_LO 0x000000e8 1156 + 1157 + #define REG_A4XX_RBBM_PERFCTR_VPC_2_HI 0x000000e9 1158 + 1159 + #define REG_A4XX_RBBM_PERFCTR_VPC_3_LO 0x000000ea 1160 + 1161 + #define REG_A4XX_RBBM_PERFCTR_VPC_3_HI 0x000000eb 1162 + 1163 + #define REG_A4XX_RBBM_PERFCTR_CCU_0_LO 0x000000ec 1164 + 1165 + #define REG_A4XX_RBBM_PERFCTR_CCU_0_HI 0x000000ed 1166 + 1167 + #define REG_A4XX_RBBM_PERFCTR_CCU_1_LO 0x000000ee 1168 + 1169 + #define REG_A4XX_RBBM_PERFCTR_CCU_1_HI 0x000000ef 1170 + 1171 + #define REG_A4XX_RBBM_PERFCTR_CCU_2_LO 0x000000f0 1172 + 1173 + #define REG_A4XX_RBBM_PERFCTR_CCU_2_HI 0x000000f1 1174 + 1175 + #define REG_A4XX_RBBM_PERFCTR_CCU_3_LO 0x000000f2 1176 + 1177 + #define REG_A4XX_RBBM_PERFCTR_CCU_3_HI 0x000000f3 1178 + 1179 + #define REG_A4XX_RBBM_PERFCTR_TSE_0_LO 0x000000f4 1180 + 1181 + #define REG_A4XX_RBBM_PERFCTR_TSE_0_HI 0x000000f5 1182 + 1183 + #define REG_A4XX_RBBM_PERFCTR_TSE_1_LO 0x000000f6 1184 + 1185 + #define REG_A4XX_RBBM_PERFCTR_TSE_1_HI 0x000000f7 1186 + 1187 + #define REG_A4XX_RBBM_PERFCTR_TSE_2_LO 0x000000f8 1188 + 1189 + #define REG_A4XX_RBBM_PERFCTR_TSE_2_HI 0x000000f9 1190 + 1191 + #define REG_A4XX_RBBM_PERFCTR_TSE_3_LO 0x000000fa 1192 + 1193 + #define REG_A4XX_RBBM_PERFCTR_TSE_3_HI 0x000000fb 1194 + 1195 + #define REG_A4XX_RBBM_PERFCTR_RAS_0_LO 0x000000fc 1196 + 1197 + #define REG_A4XX_RBBM_PERFCTR_RAS_0_HI 0x000000fd 1198 + 1199 + #define REG_A4XX_RBBM_PERFCTR_RAS_1_LO 0x000000fe 1200 + 1201 + #define REG_A4XX_RBBM_PERFCTR_RAS_1_HI 0x000000ff 1202 + 1203 + #define REG_A4XX_RBBM_PERFCTR_RAS_2_LO 0x00000100 1204 + 1205 + #define REG_A4XX_RBBM_PERFCTR_RAS_2_HI 0x00000101 1206 + 1207 + #define REG_A4XX_RBBM_PERFCTR_RAS_3_LO 0x00000102 1208 + 1209 + #define REG_A4XX_RBBM_PERFCTR_RAS_3_HI 0x00000103 1210 + 1211 + #define REG_A4XX_RBBM_PERFCTR_UCHE_0_LO 0x00000104 1212 + 1213 + #define REG_A4XX_RBBM_PERFCTR_UCHE_0_HI 0x00000105 1214 + 1215 + #define REG_A4XX_RBBM_PERFCTR_UCHE_1_LO 0x00000106 1216 + 1217 + #define REG_A4XX_RBBM_PERFCTR_UCHE_1_HI 0x00000107 1218 + 1219 + #define REG_A4XX_RBBM_PERFCTR_UCHE_2_LO 0x00000108 1220 + 1221 + #define REG_A4XX_RBBM_PERFCTR_UCHE_2_HI 0x00000109 1222 + 1223 + #define REG_A4XX_RBBM_PERFCTR_UCHE_3_LO 0x0000010a 1224 + 1225 + #define REG_A4XX_RBBM_PERFCTR_UCHE_3_HI 0x0000010b 1226 + 1227 + #define REG_A4XX_RBBM_PERFCTR_UCHE_4_LO 0x0000010c 1228 + 1229 + #define REG_A4XX_RBBM_PERFCTR_UCHE_4_HI 0x0000010d 1230 + 1231 + #define REG_A4XX_RBBM_PERFCTR_UCHE_5_LO 0x0000010e 1232 + 1233 + #define REG_A4XX_RBBM_PERFCTR_UCHE_5_HI 0x0000010f 1234 + 1235 + #define REG_A4XX_RBBM_PERFCTR_UCHE_6_LO 0x00000110 1236 + 1237 + #define REG_A4XX_RBBM_PERFCTR_UCHE_6_HI 0x00000111 1238 + 1239 + #define REG_A4XX_RBBM_PERFCTR_UCHE_7_LO 0x00000112 1240 + 1241 + #define REG_A4XX_RBBM_PERFCTR_UCHE_7_HI 0x00000113 1242 + 1243 + #define REG_A4XX_RBBM_PERFCTR_TP_0_LO 0x00000114 1244 + 1245 + #define REG_A4XX_RBBM_PERFCTR_TP_0_HI 0x00000115 1246 + 1247 + #define REG_A4XX_RBBM_PERFCTR_TP_0_LO 0x00000114 1248 + 1249 + #define REG_A4XX_RBBM_PERFCTR_TP_0_HI 0x00000115 1250 + 1251 + #define REG_A4XX_RBBM_PERFCTR_TP_1_LO 0x00000116 1252 + 1253 + #define REG_A4XX_RBBM_PERFCTR_TP_1_HI 0x00000117 1254 + 1255 + #define REG_A4XX_RBBM_PERFCTR_TP_2_LO 0x00000118 1256 + 1257 + #define REG_A4XX_RBBM_PERFCTR_TP_2_HI 0x00000119 1258 + 1259 + #define REG_A4XX_RBBM_PERFCTR_TP_3_LO 0x0000011a 1260 + 1261 + #define REG_A4XX_RBBM_PERFCTR_TP_3_HI 0x0000011b 1262 + 1263 + #define REG_A4XX_RBBM_PERFCTR_TP_4_LO 0x0000011c 1264 + 1265 + #define REG_A4XX_RBBM_PERFCTR_TP_4_HI 0x0000011d 1266 + 1267 + #define REG_A4XX_RBBM_PERFCTR_TP_5_LO 0x0000011e 1268 + 1269 + #define REG_A4XX_RBBM_PERFCTR_TP_5_HI 0x0000011f 1270 + 1271 + #define REG_A4XX_RBBM_PERFCTR_TP_6_LO 0x00000120 1272 + 1273 + #define REG_A4XX_RBBM_PERFCTR_TP_6_HI 0x00000121 1274 + 1275 + #define REG_A4XX_RBBM_PERFCTR_TP_7_LO 0x00000122 1276 + 1277 + #define REG_A4XX_RBBM_PERFCTR_TP_7_HI 0x00000123 1278 + 1279 + #define REG_A4XX_RBBM_PERFCTR_SP_0_LO 0x00000124 1280 + 1281 + #define REG_A4XX_RBBM_PERFCTR_SP_0_HI 0x00000125 1282 + 1283 + #define REG_A4XX_RBBM_PERFCTR_SP_1_LO 0x00000126 1284 + 1285 + #define REG_A4XX_RBBM_PERFCTR_SP_1_HI 0x00000127 1286 + 1287 + #define REG_A4XX_RBBM_PERFCTR_SP_2_LO 0x00000128 1288 + 1289 + #define REG_A4XX_RBBM_PERFCTR_SP_2_HI 0x00000129 1290 + 1291 + #define REG_A4XX_RBBM_PERFCTR_SP_3_LO 0x0000012a 1292 + 1293 + #define REG_A4XX_RBBM_PERFCTR_SP_3_HI 0x0000012b 1294 + 1295 + #define REG_A4XX_RBBM_PERFCTR_SP_4_LO 0x0000012c 1296 + 1297 + #define REG_A4XX_RBBM_PERFCTR_SP_4_HI 0x0000012d 1298 + 1299 + #define REG_A4XX_RBBM_PERFCTR_SP_5_LO 0x0000012e 1300 + 1301 + #define REG_A4XX_RBBM_PERFCTR_SP_5_HI 0x0000012f 1302 + 1303 + #define REG_A4XX_RBBM_PERFCTR_SP_6_LO 0x00000130 1304 + 1305 + #define REG_A4XX_RBBM_PERFCTR_SP_6_HI 0x00000131 1306 + 1307 + #define REG_A4XX_RBBM_PERFCTR_SP_7_LO 0x00000132 1308 + 1309 + #define REG_A4XX_RBBM_PERFCTR_SP_7_HI 0x00000133 1310 + 1311 + #define REG_A4XX_RBBM_PERFCTR_SP_8_LO 0x00000134 1312 + 1313 + #define REG_A4XX_RBBM_PERFCTR_SP_8_HI 0x00000135 1314 + 1315 + #define REG_A4XX_RBBM_PERFCTR_SP_9_LO 0x00000136 1316 + 1317 + #define REG_A4XX_RBBM_PERFCTR_SP_9_HI 0x00000137 1318 + 1319 + #define REG_A4XX_RBBM_PERFCTR_SP_10_LO 0x00000138 1320 + 1321 + #define REG_A4XX_RBBM_PERFCTR_SP_10_HI 0x00000139 1322 + 1323 + #define REG_A4XX_RBBM_PERFCTR_SP_11_LO 0x0000013a 1324 + 1325 + #define REG_A4XX_RBBM_PERFCTR_SP_11_HI 0x0000013b 1326 + 1327 + #define REG_A4XX_RBBM_PERFCTR_RB_0_LO 0x0000013c 1328 + 1329 + #define REG_A4XX_RBBM_PERFCTR_RB_0_HI 0x0000013d 1330 + 1331 + #define REG_A4XX_RBBM_PERFCTR_RB_1_LO 0x0000013e 1332 + 1333 + #define REG_A4XX_RBBM_PERFCTR_RB_1_HI 0x0000013f 1334 + 1335 + #define REG_A4XX_RBBM_PERFCTR_RB_2_LO 0x00000140 1336 + 1337 + #define REG_A4XX_RBBM_PERFCTR_RB_2_HI 0x00000141 1338 + 1339 + #define REG_A4XX_RBBM_PERFCTR_RB_3_LO 0x00000142 1340 + 1341 + #define REG_A4XX_RBBM_PERFCTR_RB_3_HI 0x00000143 1342 + 1343 + #define REG_A4XX_RBBM_PERFCTR_RB_4_LO 0x00000144 1344 + 1345 + #define REG_A4XX_RBBM_PERFCTR_RB_4_HI 0x00000145 1346 + 1347 + #define REG_A4XX_RBBM_PERFCTR_RB_5_LO 0x00000146 1348 + 1349 + #define REG_A4XX_RBBM_PERFCTR_RB_5_HI 0x00000147 1350 + 1351 + #define REG_A4XX_RBBM_PERFCTR_RB_6_LO 0x00000148 1352 + 1353 + #define REG_A4XX_RBBM_PERFCTR_RB_6_HI 0x00000149 1354 + 1355 + #define REG_A4XX_RBBM_PERFCTR_RB_7_LO 0x0000014a 1356 + 1357 + #define REG_A4XX_RBBM_PERFCTR_RB_7_HI 0x0000014b 1358 + 1359 + #define REG_A4XX_RBBM_PERFCTR_VSC_0_LO 0x0000014c 1360 + 1361 + #define REG_A4XX_RBBM_PERFCTR_VSC_0_HI 0x0000014d 1362 + 1363 + #define REG_A4XX_RBBM_PERFCTR_VSC_1_LO 0x0000014e 1364 + 1365 + #define REG_A4XX_RBBM_PERFCTR_VSC_1_HI 0x0000014f 1366 + 1367 + #define REG_A4XX_RBBM_PERFCTR_PWR_0_LO 0x00000166 1368 + 1369 + #define REG_A4XX_RBBM_PERFCTR_PWR_0_HI 0x00000167 1370 + 1371 + #define REG_A4XX_RBBM_PERFCTR_PWR_1_LO 0x00000168 1372 + 1373 + #define REG_A4XX_RBBM_PERFCTR_PWR_1_HI 0x00000169 1374 + 1375 + #define REG_A4XX_RBBM_ALWAYSON_COUNTER_LO 0x0000016e 1376 + 1377 + #define REG_A4XX_RBBM_ALWAYSON_COUNTER_HI 0x0000016f 1615 1378 1616 1379 static inline uint32_t REG_A4XX_RBBM_CLOCK_CTL_SP(uint32_t i0) { return 0x00000068 + 0x1*i0; } 1617 1380 ··· 2039 1046 2040 1047 static inline uint32_t REG_A4XX_RBBM_CLOCK_DELAY_RB_MARB_CCU_L1_REG(uint32_t i0) { return 0x0000008e + 0x1*i0; } 2041 1048 1049 + #define REG_A4XX_RBBM_SP_REGFILE_SLEEP_CNTL_0 0x00000099 1050 + 1051 + #define REG_A4XX_RBBM_SP_REGFILE_SLEEP_CNTL_1 0x0000009a 1052 + 2042 1053 #define REG_A4XX_RBBM_PERFCTR_PWR_1_LO 0x00000168 2043 1054 2044 1055 #define REG_A4XX_RBBM_PERFCTR_CTL 0x00000170 ··· 2056 1059 #define REG_A4XX_RBBM_PERFCTR_LOAD_VALUE_LO 0x00000174 2057 1060 2058 1061 #define REG_A4XX_RBBM_PERFCTR_LOAD_VALUE_HI 0x00000175 1062 + 1063 + #define REG_A4XX_RBBM_PERFCTR_RBBM_SEL_0 0x00000176 1064 + 1065 + #define REG_A4XX_RBBM_PERFCTR_RBBM_SEL_1 0x00000177 1066 + 1067 + #define REG_A4XX_RBBM_PERFCTR_RBBM_SEL_2 0x00000178 1068 + 1069 + #define REG_A4XX_RBBM_PERFCTR_RBBM_SEL_3 0x00000179 2059 1070 2060 1071 #define REG_A4XX_RBBM_GPU_BUSY_MASKED 0x0000017a 2061 1072 ··· 2103 1098 #define A4XX_RBBM_STATUS_GPU_BUSY 0x80000000 2104 1099 2105 1100 #define REG_A4XX_RBBM_INTERFACE_RRDY_STATUS5 0x0000019f 1101 + 1102 + #define REG_A4XX_RBBM_POWER_STATUS 0x000001b0 1103 + #define A4XX_RBBM_POWER_STATUS_SP_TP_PWR_ON 0x00100000 1104 + 1105 + #define REG_A4XX_RBBM_WAIT_IDLE_CLOCKS_CTL2 0x000001b8 2106 1106 2107 1107 #define REG_A4XX_CP_SCRATCH_UMASK 0x00000228 2108 1108 ··· 2201 1191 2202 1192 #define REG_A4XX_CP_PERFCTR_CP_SEL_0 0x00000500 2203 1193 1194 + #define REG_A4XX_CP_PERFCTR_CP_SEL_1 0x00000501 1195 + 1196 + #define REG_A4XX_CP_PERFCTR_CP_SEL_2 0x00000502 1197 + 1198 + #define REG_A4XX_CP_PERFCTR_CP_SEL_3 0x00000503 1199 + 1200 + #define REG_A4XX_CP_PERFCTR_CP_SEL_4 0x00000504 1201 + 1202 + #define REG_A4XX_CP_PERFCTR_CP_SEL_5 0x00000505 1203 + 1204 + #define REG_A4XX_CP_PERFCTR_CP_SEL_6 0x00000506 1205 + 1206 + #define REG_A4XX_CP_PERFCTR_CP_SEL_7 0x00000507 1207 + 2204 1208 #define REG_A4XX_CP_PERFCOMBINER_SELECT 0x0000050b 2205 1209 2206 1210 static inline uint32_t REG_A4XX_CP_SCRATCH(uint32_t i0) { return 0x00000578 + 0x1*i0; } ··· 2224 1200 #define REG_A4XX_SP_VS_STATUS 0x00000ec0 2225 1201 2226 1202 #define REG_A4XX_SP_MODE_CONTROL 0x00000ec3 1203 + 1204 + #define REG_A4XX_SP_PERFCTR_SP_SEL_0 0x00000ec4 1205 + 1206 + #define REG_A4XX_SP_PERFCTR_SP_SEL_1 0x00000ec5 1207 + 1208 + #define REG_A4XX_SP_PERFCTR_SP_SEL_2 0x00000ec6 1209 + 1210 + #define REG_A4XX_SP_PERFCTR_SP_SEL_3 0x00000ec7 1211 + 1212 + #define REG_A4XX_SP_PERFCTR_SP_SEL_4 0x00000ec8 1213 + 1214 + #define REG_A4XX_SP_PERFCTR_SP_SEL_5 0x00000ec9 1215 + 1216 + #define REG_A4XX_SP_PERFCTR_SP_SEL_6 0x00000eca 1217 + 1218 + #define REG_A4XX_SP_PERFCTR_SP_SEL_7 0x00000ecb 1219 + 1220 + #define REG_A4XX_SP_PERFCTR_SP_SEL_8 0x00000ecc 1221 + 1222 + #define REG_A4XX_SP_PERFCTR_SP_SEL_9 0x00000ecd 1223 + 1224 + #define REG_A4XX_SP_PERFCTR_SP_SEL_10 0x00000ece 2227 1225 2228 1226 #define REG_A4XX_SP_PERFCTR_SP_SEL_11 0x00000ecf 2229 1227 ··· 2745 1699 2746 1700 #define REG_A4XX_VPC_DEBUG_ECO_CONTROL 0x00000e64 2747 1701 1702 + #define REG_A4XX_VPC_PERFCTR_VPC_SEL_0 0x00000e65 1703 + 1704 + #define REG_A4XX_VPC_PERFCTR_VPC_SEL_1 0x00000e66 1705 + 1706 + #define REG_A4XX_VPC_PERFCTR_VPC_SEL_2 0x00000e67 1707 + 2748 1708 #define REG_A4XX_VPC_PERFCTR_VPC_SEL_3 0x00000e68 2749 1709 2750 1710 #define REG_A4XX_VPC_ATTR 0x00002140 ··· 2862 1810 #define REG_A4XX_VSC_PERFCTR_VSC_SEL_1 0x00000c51 2863 1811 2864 1812 #define REG_A4XX_VFD_DEBUG_CONTROL 0x00000e40 1813 + 1814 + #define REG_A4XX_VFD_PERFCTR_VFD_SEL_0 0x00000e43 1815 + 1816 + #define REG_A4XX_VFD_PERFCTR_VFD_SEL_1 0x00000e44 1817 + 1818 + #define REG_A4XX_VFD_PERFCTR_VFD_SEL_2 0x00000e45 1819 + 1820 + #define REG_A4XX_VFD_PERFCTR_VFD_SEL_3 0x00000e46 1821 + 1822 + #define REG_A4XX_VFD_PERFCTR_VFD_SEL_4 0x00000e47 1823 + 1824 + #define REG_A4XX_VFD_PERFCTR_VFD_SEL_5 0x00000e48 1825 + 1826 + #define REG_A4XX_VFD_PERFCTR_VFD_SEL_6 0x00000e49 2865 1827 2866 1828 #define REG_A4XX_VFD_PERFCTR_VFD_SEL_7 0x00000e4a 2867 1829 ··· 3033 1967 3034 1968 #define REG_A4XX_TPL1_TP_MODE_CONTROL 0x00000f03 3035 1969 1970 + #define REG_A4XX_TPL1_PERFCTR_TP_SEL_0 0x00000f04 1971 + 1972 + #define REG_A4XX_TPL1_PERFCTR_TP_SEL_1 0x00000f05 1973 + 1974 + #define REG_A4XX_TPL1_PERFCTR_TP_SEL_2 0x00000f06 1975 + 1976 + #define REG_A4XX_TPL1_PERFCTR_TP_SEL_3 0x00000f07 1977 + 1978 + #define REG_A4XX_TPL1_PERFCTR_TP_SEL_4 0x00000f08 1979 + 1980 + #define REG_A4XX_TPL1_PERFCTR_TP_SEL_5 0x00000f09 1981 + 1982 + #define REG_A4XX_TPL1_PERFCTR_TP_SEL_6 0x00000f0a 1983 + 3036 1984 #define REG_A4XX_TPL1_PERFCTR_TP_SEL_7 0x00000f0b 3037 1985 3038 1986 #define REG_A4XX_TPL1_TP_TEX_OFFSET 0x00002380 ··· 3101 2021 3102 2022 #define REG_A4XX_GRAS_PERFCTR_TSE_SEL_0 0x00000c88 3103 2023 2024 + #define REG_A4XX_GRAS_PERFCTR_TSE_SEL_1 0x00000c89 2025 + 2026 + #define REG_A4XX_GRAS_PERFCTR_TSE_SEL_2 0x00000c8a 2027 + 3104 2028 #define REG_A4XX_GRAS_PERFCTR_TSE_SEL_3 0x00000c8b 3105 2029 2030 + #define REG_A4XX_GRAS_PERFCTR_RAS_SEL_0 0x00000c8c 2031 + 2032 + #define REG_A4XX_GRAS_PERFCTR_RAS_SEL_1 0x00000c8d 2033 + 2034 + #define REG_A4XX_GRAS_PERFCTR_RAS_SEL_2 0x00000c8e 2035 + 2036 + #define REG_A4XX_GRAS_PERFCTR_RAS_SEL_3 0x00000c8f 2037 + 3106 2038 #define REG_A4XX_GRAS_CL_CLIP_CNTL 0x00002000 2039 + #define A4XX_GRAS_CL_CLIP_CNTL_CLIP_DISABLE 0x00008000 2040 + #define A4XX_GRAS_CL_CLIP_CNTL_ZERO_GB_SCALE_Z 0x00400000 3107 2041 3108 2042 #define REG_A4XX_GRAS_CLEAR_CNTL 0x00002003 3109 2043 #define A4XX_GRAS_CLEAR_CNTL_NOT_FASTCLEAR 0x00000001 ··· 3208 2114 3209 2115 #define REG_A4XX_GRAS_ALPHA_CONTROL 0x00002073 3210 2116 #define A4XX_GRAS_ALPHA_CONTROL_ALPHA_TEST_ENABLE 0x00000004 2117 + #define A4XX_GRAS_ALPHA_CONTROL_FORCE_FRAGZ_TO_FS 0x00000008 3211 2118 3212 2119 #define REG_A4XX_GRAS_SU_POLY_OFFSET_SCALE 0x00002074 3213 2120 #define A4XX_GRAS_SU_POLY_OFFSET_SCALE__MASK 0xffffffff ··· 3380 2285 3381 2286 #define REG_A4XX_UCHE_CACHE_WAYS_VFD 0x00000e8c 3382 2287 2288 + #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_0 0x00000e8e 2289 + 2290 + #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_1 0x00000e8f 2291 + 2292 + #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_2 0x00000e90 2293 + 2294 + #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_3 0x00000e91 2295 + 2296 + #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_4 0x00000e92 2297 + 2298 + #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_5 0x00000e93 2299 + 2300 + #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_6 0x00000e94 2301 + 3383 2302 #define REG_A4XX_UCHE_PERFCTR_UCHE_SEL_7 0x00000e95 3384 2303 3385 2304 #define REG_A4XX_HLSQ_TIMEOUT_THRESHOLD 0x00000e00 ··· 3403 2294 #define REG_A4XX_HLSQ_MODE_CONTROL 0x00000e05 3404 2295 3405 2296 #define REG_A4XX_HLSQ_PERF_PIPE_MASK 0x00000e0e 2297 + 2298 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_0 0x00000e06 2299 + 2300 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_1 0x00000e07 2301 + 2302 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_2 0x00000e08 2303 + 2304 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_3 0x00000e09 2305 + 2306 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_4 0x00000e0a 2307 + 2308 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_5 0x00000e0b 2309 + 2310 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_6 0x00000e0c 2311 + 2312 + #define REG_A4XX_HLSQ_PERFCTR_HLSQ_SEL_7 0x00000e0d 3406 2313 3407 2314 #define REG_A4XX_HLSQ_CONTROL_0_REG 0x000023c0 3408 2315 #define A4XX_HLSQ_CONTROL_0_REG_FSTHREADSIZE__MASK 0x00000010 ··· 3674 2549 3675 2550 #define REG_A4XX_PC_PERFCTR_PC_SEL_0 0x00000d10 3676 2551 2552 + #define REG_A4XX_PC_PERFCTR_PC_SEL_1 0x00000d11 2553 + 2554 + #define REG_A4XX_PC_PERFCTR_PC_SEL_2 0x00000d12 2555 + 2556 + #define REG_A4XX_PC_PERFCTR_PC_SEL_3 0x00000d13 2557 + 2558 + #define REG_A4XX_PC_PERFCTR_PC_SEL_4 0x00000d14 2559 + 2560 + #define REG_A4XX_PC_PERFCTR_PC_SEL_5 0x00000d15 2561 + 2562 + #define REG_A4XX_PC_PERFCTR_PC_SEL_6 0x00000d16 2563 + 3677 2564 #define REG_A4XX_PC_PERFCTR_PC_SEL_7 0x00000d17 3678 2565 3679 2566 #define REG_A4XX_PC_BIN_BASE 0x000021c0 ··· 3701 2564 #define A4XX_PC_PRIM_VTX_CNTL_PROVOKING_VTX_LAST 0x02000000 3702 2565 #define A4XX_PC_PRIM_VTX_CNTL_PSIZE 0x04000000 3703 2566 3704 - #define REG_A4XX_UNKNOWN_21C5 0x000021c5 2567 + #define REG_A4XX_PC_PRIM_VTX_CNTL2 0x000021c5 2568 + #define A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_FRONT_PTYPE__MASK 0x00000007 2569 + #define A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_FRONT_PTYPE__SHIFT 0 2570 + static inline uint32_t A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_FRONT_PTYPE(enum adreno_pa_su_sc_draw val) 2571 + { 2572 + return ((val) << A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_FRONT_PTYPE__SHIFT) & A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_FRONT_PTYPE__MASK; 2573 + } 2574 + #define A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_BACK_PTYPE__MASK 0x00000038 2575 + #define A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_BACK_PTYPE__SHIFT 3 2576 + static inline uint32_t A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_BACK_PTYPE(enum adreno_pa_su_sc_draw val) 2577 + { 2578 + return ((val) << A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_BACK_PTYPE__SHIFT) & A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_BACK_PTYPE__MASK; 2579 + } 2580 + #define A4XX_PC_PRIM_VTX_CNTL2_POLYMODE_ENABLE 0x00000040 3705 2581 3706 2582 #define REG_A4XX_PC_RESTART_INDEX 0x000021c6 3707 2583 ··· 3796 2646 3797 2647 #define REG_A4XX_UNKNOWN_20EF 0x000020ef 3798 2648 3799 - #define REG_A4XX_UNKNOWN_20F0 0x000020f0 3800 - 3801 - #define REG_A4XX_UNKNOWN_20F1 0x000020f1 3802 - 3803 - #define REG_A4XX_UNKNOWN_20F2 0x000020f2 3804 - 3805 - #define REG_A4XX_UNKNOWN_20F7 0x000020f7 3806 - #define A4XX_UNKNOWN_20F7__MASK 0xffffffff 3807 - #define A4XX_UNKNOWN_20F7__SHIFT 0 3808 - static inline uint32_t A4XX_UNKNOWN_20F7(float val) 3809 - { 3810 - return ((fui(val)) << A4XX_UNKNOWN_20F7__SHIFT) & A4XX_UNKNOWN_20F7__MASK; 3811 - } 3812 - 3813 2649 #define REG_A4XX_UNKNOWN_2152 0x00002152 3814 2650 3815 2651 #define REG_A4XX_UNKNOWN_2153 0x00002153 ··· 3856 2720 { 3857 2721 return ((val) << A4XX_TEX_SAMP_0_ANISO__SHIFT) & A4XX_TEX_SAMP_0_ANISO__MASK; 3858 2722 } 2723 + #define A4XX_TEX_SAMP_0_LOD_BIAS__MASK 0xfff80000 2724 + #define A4XX_TEX_SAMP_0_LOD_BIAS__SHIFT 19 2725 + static inline uint32_t A4XX_TEX_SAMP_0_LOD_BIAS(float val) 2726 + { 2727 + return ((((int32_t)(val * 256.0))) << A4XX_TEX_SAMP_0_LOD_BIAS__SHIFT) & A4XX_TEX_SAMP_0_LOD_BIAS__MASK; 2728 + } 3859 2729 3860 2730 #define REG_A4XX_TEX_SAMP_1 0x00000001 3861 2731 #define A4XX_TEX_SAMP_1_COMPARE_FUNC__MASK 0x0000000e ··· 3870 2728 { 3871 2729 return ((val) << A4XX_TEX_SAMP_1_COMPARE_FUNC__SHIFT) & A4XX_TEX_SAMP_1_COMPARE_FUNC__MASK; 3872 2730 } 2731 + #define A4XX_TEX_SAMP_1_CUBEMAPSEAMLESSFILTOFF 0x00000010 3873 2732 #define A4XX_TEX_SAMP_1_UNNORM_COORDS 0x00000020 3874 2733 #define A4XX_TEX_SAMP_1_MIPFILTER_LINEAR_FAR 0x00000040 3875 2734 #define A4XX_TEX_SAMP_1_MAX_LOD__MASK 0x000fff00 ··· 3939 2796 { 3940 2797 return ((val) << A4XX_TEX_CONST_1_HEIGHT__SHIFT) & A4XX_TEX_CONST_1_HEIGHT__MASK; 3941 2798 } 3942 - #define A4XX_TEX_CONST_1_WIDTH__MASK 0x1fff8000 2799 + #define A4XX_TEX_CONST_1_WIDTH__MASK 0x3fff8000 3943 2800 #define A4XX_TEX_CONST_1_WIDTH__SHIFT 15 3944 2801 static inline uint32_t A4XX_TEX_CONST_1_WIDTH(uint32_t val) 3945 2802 {
+99 -9
drivers/gpu/drm/msm/adreno/a4xx_gpu.c
··· 102 102 gpu_write(gpu, REG_A4XX_RBBM_CLOCK_DELAY_TSE_RAS_RBBM, 0x00000222); 103 103 gpu_write(gpu, REG_A4XX_RBBM_CLOCK_CTL_HLSQ , 0x00000000); 104 104 gpu_write(gpu, REG_A4XX_RBBM_CLOCK_HYST_HLSQ, 0x00000000); 105 - gpu_write(gpu, REG_A4XX_RBBM_CLOCK_DELAY_HLSQ, 0x00020000); 106 - gpu_write(gpu, REG_A4XX_RBBM_CLOCK_CTL, 0xAAAAAAAA); 105 + gpu_write(gpu, REG_A4XX_RBBM_CLOCK_DELAY_HLSQ, 0x00220000); 106 + /* Early A430's have a timing issue with SP/TP power collapse; 107 + disabling HW clock gating prevents it. */ 108 + if (adreno_is_a430(adreno_gpu) && adreno_gpu->rev.patchid < 2) 109 + gpu_write(gpu, REG_A4XX_RBBM_CLOCK_CTL, 0); 110 + else 111 + gpu_write(gpu, REG_A4XX_RBBM_CLOCK_CTL, 0xAAAAAAAA); 107 112 gpu_write(gpu, REG_A4XX_RBBM_CLOCK_CTL2, 0); 108 113 } 114 + 109 115 110 116 static void a4xx_me_init(struct msm_gpu *gpu) 111 117 { ··· 147 141 uint32_t *ptr, len; 148 142 int i, ret; 149 143 150 - if (adreno_is_a4xx(adreno_gpu)) { 144 + if (adreno_is_a420(adreno_gpu)) { 151 145 gpu_write(gpu, REG_A4XX_VBIF_ABIT_SORT, 0x0001001F); 152 146 gpu_write(gpu, REG_A4XX_VBIF_ABIT_SORT_CONF, 0x000000A4); 147 + gpu_write(gpu, REG_A4XX_VBIF_GATE_OFF_WRREQ_EN, 0x00000001); 148 + gpu_write(gpu, REG_A4XX_VBIF_IN_RD_LIM_CONF0, 0x18181818); 149 + gpu_write(gpu, REG_A4XX_VBIF_IN_RD_LIM_CONF1, 0x00000018); 150 + gpu_write(gpu, REG_A4XX_VBIF_IN_WR_LIM_CONF0, 0x18181818); 151 + gpu_write(gpu, REG_A4XX_VBIF_IN_WR_LIM_CONF1, 0x00000018); 152 + gpu_write(gpu, REG_A4XX_VBIF_ROUND_ROBIN_QOS_ARB, 0x00000003); 153 + } else if (adreno_is_a430(adreno_gpu)) { 153 154 gpu_write(gpu, REG_A4XX_VBIF_GATE_OFF_WRREQ_EN, 0x00000001); 154 155 gpu_write(gpu, REG_A4XX_VBIF_IN_RD_LIM_CONF0, 0x18181818); 155 156 gpu_write(gpu, REG_A4XX_VBIF_IN_RD_LIM_CONF1, 0x00000018); ··· 173 160 /* Tune the hystersis counters for SP and CP idle detection */ 174 161 gpu_write(gpu, REG_A4XX_RBBM_SP_HYST_CNT, 0x10); 175 162 gpu_write(gpu, REG_A4XX_RBBM_WAIT_IDLE_CLOCKS_CTL, 0x10); 163 + 164 + if (adreno_is_a430(adreno_gpu)) { 165 + gpu_write(gpu, REG_A4XX_RBBM_WAIT_IDLE_CLOCKS_CTL2, 0x30); 166 + } 176 167 177 168 /* Enable the RBBM error reporting bits */ 178 169 gpu_write(gpu, REG_A4XX_RBBM_AHB_CTL0, 0x00000001); ··· 200 183 /* Turn on performance counters: */ 201 184 gpu_write(gpu, REG_A4XX_RBBM_PERFCTR_CTL, 0x01); 202 185 186 + /* use the first CP counter for timestamp queries.. userspace may set 187 + * this as well but it selects the same counter/countable: 188 + */ 189 + gpu_write(gpu, REG_A4XX_CP_PERFCTR_CP_SEL_0, CP_ALWAYS_COUNT); 190 + 191 + if (adreno_is_a430(adreno_gpu)) 192 + gpu_write(gpu, REG_A4XX_UCHE_CACHE_WAYS_VFD, 0x07); 193 + 203 194 /* Disable L2 bypass to avoid UCHE out of bounds errors */ 204 195 gpu_write(gpu, REG_A4XX_UCHE_TRAP_BASE_LO, 0xffff0000); 205 196 gpu_write(gpu, REG_A4XX_UCHE_TRAP_BASE_HI, 0xffff0000); 206 197 207 198 gpu_write(gpu, REG_A4XX_CP_DEBUG, (1 << 25) | 208 199 (adreno_is_a420(adreno_gpu) ? (1 << 29) : 0)); 200 + 201 + /* On A430 enable SP regfile sleep for power savings */ 202 + /* TODO downstream does this for !420, so maybe applies for 405 too? */ 203 + if (!adreno_is_a420(adreno_gpu)) { 204 + gpu_write(gpu, REG_A4XX_RBBM_SP_REGFILE_SLEEP_CNTL_0, 205 + 0x00000441); 206 + gpu_write(gpu, REG_A4XX_RBBM_SP_REGFILE_SLEEP_CNTL_1, 207 + 0x00000441); 208 + } 209 209 210 210 a4xx_enable_hwcg(gpu); 211 211 ··· 237 203 val |= 2 << A4XX_CGC_HLSQ_EARLY_CYC__SHIFT; 238 204 gpu_write(gpu, REG_A4XX_RBBM_CLOCK_DELAY_HLSQ, val); 239 205 } 240 - 241 - ret = adreno_hw_init(gpu); 242 - if (ret) 243 - return ret; 244 206 245 207 /* setup access protection: */ 246 208 gpu_write(gpu, REG_A4XX_CP_PROTECT_CTRL, 0x00000007); ··· 293 263 gpu_write(gpu, REG_A4XX_CP_ME_CNTL, 0); 294 264 295 265 a4xx_me_init(gpu); 266 + 296 267 return 0; 297 268 } 298 269 ··· 347 316 348 317 status = gpu_read(gpu, REG_A4XX_RBBM_INT_0_STATUS); 349 318 DBG("%s: Int status %08x", gpu->name, status); 319 + 320 + if (status & A4XX_INT0_CP_REG_PROTECT_FAULT) { 321 + uint32_t reg = gpu_read(gpu, REG_A4XX_CP_PROTECT_STATUS); 322 + printk("CP | Protected mode error| %s | addr=%x\n", 323 + reg & (1 << 24) ? "WRITE" : "READ", 324 + (reg & 0xFFFFF) >> 2); 325 + } 350 326 351 327 gpu_write(gpu, REG_A4XX_RBBM_INT_CLEAR_CMD, status); 352 328 ··· 550 512 adreno_dump(gpu); 551 513 } 552 514 515 + static int a4xx_pm_resume(struct msm_gpu *gpu) { 516 + struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); 517 + int ret; 518 + 519 + ret = msm_gpu_pm_resume(gpu); 520 + if (ret) 521 + return ret; 522 + 523 + if (adreno_is_a430(adreno_gpu)) { 524 + unsigned int reg; 525 + /* Set the default register values; set SW_COLLAPSE to 0 */ 526 + gpu_write(gpu, REG_A4XX_RBBM_POWER_CNTL_IP, 0x778000); 527 + do { 528 + udelay(5); 529 + reg = gpu_read(gpu, REG_A4XX_RBBM_POWER_STATUS); 530 + } while (!(reg & A4XX_RBBM_POWER_CNTL_IP_SP_TP_PWR_ON)); 531 + } 532 + return 0; 533 + } 534 + 535 + static int a4xx_pm_suspend(struct msm_gpu *gpu) { 536 + struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); 537 + int ret; 538 + 539 + ret = msm_gpu_pm_suspend(gpu); 540 + if (ret) 541 + return ret; 542 + 543 + if (adreno_is_a430(adreno_gpu)) { 544 + /* Set the default register values; set SW_COLLAPSE to 1 */ 545 + gpu_write(gpu, REG_A4XX_RBBM_POWER_CNTL_IP, 0x778001); 546 + } 547 + return 0; 548 + } 549 + 550 + static int a4xx_get_timestamp(struct msm_gpu *gpu, uint64_t *value) 551 + { 552 + uint32_t hi, lo, tmp; 553 + 554 + tmp = gpu_read(gpu, REG_A4XX_RBBM_PERFCTR_CP_0_HI); 555 + do { 556 + hi = tmp; 557 + lo = gpu_read(gpu, REG_A4XX_RBBM_PERFCTR_CP_0_LO); 558 + tmp = gpu_read(gpu, REG_A4XX_RBBM_PERFCTR_CP_0_HI); 559 + } while (tmp != hi); 560 + 561 + *value = (((uint64_t)hi) << 32) | lo; 562 + 563 + return 0; 564 + } 565 + 553 566 static const struct adreno_gpu_funcs funcs = { 554 567 .base = { 555 568 .get_param = adreno_get_param, 556 569 .hw_init = a4xx_hw_init, 557 - .pm_suspend = msm_gpu_pm_suspend, 558 - .pm_resume = msm_gpu_pm_resume, 570 + .pm_suspend = a4xx_pm_suspend, 571 + .pm_resume = a4xx_pm_resume, 559 572 .recover = a4xx_recover, 560 573 .last_fence = adreno_last_fence, 561 574 .submit = adreno_submit, ··· 618 529 .show = a4xx_show, 619 530 #endif 620 531 }, 532 + .get_timestamp = a4xx_get_timestamp, 621 533 }; 622 534 623 535 struct msm_gpu *a4xx_gpu_init(struct drm_device *dev)
+24 -6
drivers/gpu/drm/msm/adreno/adreno_common.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/adreno.xml ( 398 bytes, from 2015-09-24 17:25:31) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml ( 32901 bytes, from 2015-05-20 20:03:14) 14 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 10755 bytes, from 2015-09-14 20:46:55) 15 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 14968 bytes, from 2015-05-20 20:12:27) 16 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 67771 bytes, from 2015-09-14 20:46:55) 17 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 63970 bytes, from 2015-09-14 20:50:12) 14 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 11518 bytes, from 2016-02-10 21:03:25) 15 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 16166 bytes, from 2016-02-11 21:20:31) 16 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 83967 bytes, from 2016-02-10 17:07:21) 17 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 109916 bytes, from 2016-02-20 18:44:48) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml ( 1773 bytes, from 2015-09-24 17:30:00) 19 19 20 - Copyright (C) 2013-2015 by the following authors: 20 + Copyright (C) 2013-2016 by the following authors: 21 21 - Rob Clark <robdclark@gmail.com> (robclark) 22 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 22 23 23 24 Permission is hereby granted, free of charge, to any person obtaining 24 25 a copy of this software and associated documentation files (the ··· 118 117 RB_COPY_RESOLVE = 1, 119 118 RB_COPY_CLEAR = 2, 120 119 RB_COPY_DEPTH_STENCIL = 5, 120 + }; 121 + 122 + enum a3xx_rop_code { 123 + ROP_CLEAR = 0, 124 + ROP_NOR = 1, 125 + ROP_AND_INVERTED = 2, 126 + ROP_COPY_INVERTED = 3, 127 + ROP_AND_REVERSE = 4, 128 + ROP_INVERT = 5, 129 + ROP_NAND = 7, 130 + ROP_AND = 8, 131 + ROP_EQUIV = 9, 132 + ROP_NOOP = 10, 133 + ROP_OR_INVERTED = 11, 134 + ROP_OR_REVERSE = 13, 135 + ROP_OR = 14, 136 + ROP_SET = 15, 121 137 }; 122 138 123 139 enum a3xx_render_mode {
+8
drivers/gpu/drm/msm/adreno/adreno_device.c
··· 69 69 .pfpfw = "a420_pfp.fw", 70 70 .gmem = (SZ_1M + SZ_512K), 71 71 .init = a4xx_gpu_init, 72 + }, { 73 + .rev = ADRENO_REV(4, 3, 0, ANY_ID), 74 + .revn = 430, 75 + .name = "A430", 76 + .pm4fw = "a420_pm4.fw", 77 + .pfpfw = "a420_pfp.fw", 78 + .gmem = (SZ_1M + SZ_512K), 79 + .init = a4xx_gpu_init, 72 80 }, 73 81 }; 74 82
+28 -13
drivers/gpu/drm/msm/adreno/adreno_gpu.c
··· 44 44 case MSM_PARAM_MAX_FREQ: 45 45 *value = adreno_gpu->base.fast_rate; 46 46 return 0; 47 + case MSM_PARAM_TIMESTAMP: 48 + if (adreno_gpu->funcs->get_timestamp) 49 + return adreno_gpu->funcs->get_timestamp(gpu, value); 50 + return -EINVAL; 47 51 default: 48 52 DBG("%s: invalid param: %u", gpu->name, param); 49 53 return -EINVAL; ··· 75 71 adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_CNTL, 76 72 /* size is log2(quad-words): */ 77 73 AXXX_CP_RB_CNTL_BUFSZ(ilog2(gpu->rb->size / 8)) | 78 - AXXX_CP_RB_CNTL_BLKSZ(ilog2(RB_BLKSIZE / 8))); 74 + AXXX_CP_RB_CNTL_BLKSZ(ilog2(RB_BLKSIZE / 8)) | 75 + (adreno_is_a430(adreno_gpu) ? AXXX_CP_RB_CNTL_NO_UPDATE : 0)); 79 76 80 77 /* Setup ringbuffer address: */ 81 78 adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_BASE, gpu->rb_iova); 82 - adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_RPTR_ADDR, 83 - rbmemptr(adreno_gpu, rptr)); 84 79 85 - /* Setup scratch/timestamp: */ 86 - adreno_gpu_write(adreno_gpu, REG_ADRENO_SCRATCH_ADDR, 87 - rbmemptr(adreno_gpu, fence)); 88 - 89 - adreno_gpu_write(adreno_gpu, REG_ADRENO_SCRATCH_UMSK, 0x1); 80 + if (!adreno_is_a430(adreno_gpu)) 81 + adreno_gpu_write(adreno_gpu, REG_ADRENO_CP_RB_RPTR_ADDR, 82 + rbmemptr(adreno_gpu, rptr)); 90 83 91 84 return 0; 92 85 } ··· 91 90 static uint32_t get_wptr(struct msm_ringbuffer *ring) 92 91 { 93 92 return ring->cur - ring->start; 93 + } 94 + 95 + /* Use this helper to read rptr, since a430 doesn't update rptr in memory */ 96 + static uint32_t get_rptr(struct adreno_gpu *adreno_gpu) 97 + { 98 + if (adreno_is_a430(adreno_gpu)) 99 + return adreno_gpu->memptrs->rptr = adreno_gpu_read( 100 + adreno_gpu, REG_ADRENO_CP_RB_RPTR); 101 + else 102 + return adreno_gpu->memptrs->rptr; 94 103 } 95 104 96 105 uint32_t adreno_last_fence(struct msm_gpu *gpu) ··· 151 140 if (priv->lastctx == ctx) 152 141 break; 153 142 case MSM_SUBMIT_CMD_BUF: 154 - OUT_PKT3(ring, CP_INDIRECT_BUFFER_PFD, 2); 143 + OUT_PKT3(ring, adreno_is_a430(adreno_gpu) ? 144 + CP_INDIRECT_BUFFER_PFE : CP_INDIRECT_BUFFER_PFD, 2); 155 145 OUT_RING(ring, submit->cmd[i].iova); 156 146 OUT_RING(ring, submit->cmd[i].size); 157 147 ibs++; ··· 231 219 { 232 220 struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); 233 221 uint32_t wptr = get_wptr(gpu->rb); 222 + int ret; 234 223 235 224 /* wait for CP to drain ringbuffer: */ 236 - if (spin_until(adreno_gpu->memptrs->rptr == wptr)) 225 + ret = spin_until(get_rptr(adreno_gpu) == wptr); 226 + 227 + if (ret) 237 228 DRM_ERROR("%s: timeout waiting to drain ringbuffer!\n", gpu->name); 238 229 239 230 /* TODO maybe we need to reset GPU here to recover from hang? */ ··· 255 240 256 241 seq_printf(m, "fence: %d/%d\n", adreno_gpu->memptrs->fence, 257 242 gpu->submitted_fence); 258 - seq_printf(m, "rptr: %d\n", adreno_gpu->memptrs->rptr); 243 + seq_printf(m, "rptr: %d\n", get_rptr(adreno_gpu)); 259 244 seq_printf(m, "wptr: %d\n", adreno_gpu->memptrs->wptr); 260 245 seq_printf(m, "rb wptr: %d\n", get_wptr(gpu->rb)); 261 246 ··· 296 281 297 282 printk("fence: %d/%d\n", adreno_gpu->memptrs->fence, 298 283 gpu->submitted_fence); 299 - printk("rptr: %d\n", adreno_gpu->memptrs->rptr); 284 + printk("rptr: %d\n", get_rptr(adreno_gpu)); 300 285 printk("wptr: %d\n", adreno_gpu->memptrs->wptr); 301 286 printk("rb wptr: %d\n", get_wptr(gpu->rb)); 302 287 ··· 331 316 struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); 332 317 uint32_t size = gpu->rb->size / 4; 333 318 uint32_t wptr = get_wptr(gpu->rb); 334 - uint32_t rptr = adreno_gpu->memptrs->rptr; 319 + uint32_t rptr = get_rptr(adreno_gpu); 335 320 return (rptr + (size - 1) - wptr) % size; 336 321 } 337 322
+6
drivers/gpu/drm/msm/adreno/adreno_gpu.h
··· 114 114 115 115 struct adreno_gpu_funcs { 116 116 struct msm_gpu_funcs base; 117 + int (*get_timestamp)(struct msm_gpu *gpu, uint64_t *value); 117 118 }; 118 119 119 120 struct adreno_info { ··· 227 226 static inline int adreno_is_a420(struct adreno_gpu *gpu) 228 227 { 229 228 return gpu->revn == 420; 229 + } 230 + 231 + static inline int adreno_is_a430(struct adreno_gpu *gpu) 232 + { 233 + return gpu->revn == 430; 230 234 } 231 235 232 236 int adreno_get_param(struct msm_gpu *gpu, uint32_t param, uint64_t *value);
+41 -7
drivers/gpu/drm/msm/adreno/adreno_pm4.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/adreno.xml ( 398 bytes, from 2015-09-24 17:25:31) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/adreno/a2xx.xml ( 32901 bytes, from 2015-05-20 20:03:14) 14 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 10755 bytes, from 2015-09-14 20:46:55) 15 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 14968 bytes, from 2015-05-20 20:12:27) 16 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 67771 bytes, from 2015-09-14 20:46:55) 17 - - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 63970 bytes, from 2015-09-14 20:50:12) 14 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_common.xml ( 11518 bytes, from 2016-02-10 21:03:25) 15 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/adreno_pm4.xml ( 16166 bytes, from 2016-02-11 21:20:31) 16 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a3xx.xml ( 83967 bytes, from 2016-02-10 17:07:21) 17 + - /home/robclark/src/freedreno/envytools/rnndb/adreno/a4xx.xml ( 109916 bytes, from 2016-02-20 18:44:48) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/adreno/ocmem.xml ( 1773 bytes, from 2015-09-24 17:30:00) 19 19 20 - Copyright (C) 2013-2015 by the following authors: 20 + Copyright (C) 2013-2016 by the following authors: 21 21 - Rob Clark <robdclark@gmail.com> (robclark) 22 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 22 23 23 24 Permission is hereby granted, free of charge, to any person obtaining 24 25 a copy of this software and associated documentation files (the ··· 173 172 CP_UNKNOWN_1A = 26, 174 173 CP_UNKNOWN_4E = 78, 175 174 CP_WIDE_REG_WRITE = 116, 175 + CP_SCRATCH_TO_REG = 77, 176 + CP_REG_TO_SCRATCH = 74, 177 + CP_WAIT_MEM_WRITES = 18, 178 + CP_COND_REG_EXEC = 71, 179 + CP_MEM_TO_REG = 66, 176 180 IN_IB_PREFETCH_END = 23, 177 181 IN_SUBBLK_PREFETCH = 31, 178 182 IN_INSTR_PREFETCH = 32, ··· 205 199 206 200 enum adreno_state_src { 207 201 SS_DIRECT = 0, 202 + SS_INVALID_ALL_IC = 2, 203 + SS_INVALID_PART_IC = 3, 208 204 SS_INDIRECT = 4, 205 + SS_INDIRECT_TCM = 5, 206 + SS_INDIRECT_STM = 6, 209 207 }; 210 208 211 209 enum a4xx_index_size { ··· 237 227 { 238 228 return ((val) << CP_LOAD_STATE_0_STATE_BLOCK__SHIFT) & CP_LOAD_STATE_0_STATE_BLOCK__MASK; 239 229 } 240 - #define CP_LOAD_STATE_0_NUM_UNIT__MASK 0x7fc00000 230 + #define CP_LOAD_STATE_0_NUM_UNIT__MASK 0xffc00000 241 231 #define CP_LOAD_STATE_0_NUM_UNIT__SHIFT 22 242 232 static inline uint32_t CP_LOAD_STATE_0_NUM_UNIT(uint32_t val) 243 233 { ··· 507 497 static inline uint32_t CP_SET_BIN_DATA_1_BIN_SIZE_ADDRESS(uint32_t val) 508 498 { 509 499 return ((val) << CP_SET_BIN_DATA_1_BIN_SIZE_ADDRESS__SHIFT) & CP_SET_BIN_DATA_1_BIN_SIZE_ADDRESS__MASK; 500 + } 501 + 502 + #define REG_CP_REG_TO_MEM_0 0x00000000 503 + #define CP_REG_TO_MEM_0_REG__MASK 0x0000ffff 504 + #define CP_REG_TO_MEM_0_REG__SHIFT 0 505 + static inline uint32_t CP_REG_TO_MEM_0_REG(uint32_t val) 506 + { 507 + return ((val) << CP_REG_TO_MEM_0_REG__SHIFT) & CP_REG_TO_MEM_0_REG__MASK; 508 + } 509 + #define CP_REG_TO_MEM_0_CNT__MASK 0x3ff80000 510 + #define CP_REG_TO_MEM_0_CNT__SHIFT 19 511 + static inline uint32_t CP_REG_TO_MEM_0_CNT(uint32_t val) 512 + { 513 + return ((val) << CP_REG_TO_MEM_0_CNT__SHIFT) & CP_REG_TO_MEM_0_CNT__MASK; 514 + } 515 + #define CP_REG_TO_MEM_0_64B 0x40000000 516 + #define CP_REG_TO_MEM_0_ACCUMULATE 0x80000000 517 + 518 + #define REG_CP_REG_TO_MEM_1 0x00000001 519 + #define CP_REG_TO_MEM_1_DEST__MASK 0xffffffff 520 + #define CP_REG_TO_MEM_1_DEST__SHIFT 0 521 + static inline uint32_t CP_REG_TO_MEM_1_DEST(uint32_t val) 522 + { 523 + return ((val) << CP_REG_TO_MEM_1_DEST__SHIFT) & CP_REG_TO_MEM_1_DEST__MASK; 510 524 } 511 525 512 526
+3 -2
drivers/gpu/drm/msm/dsi/dsi.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+1 -2
drivers/gpu/drm/msm/dsi/dsi_cfg.c
··· 57 57 static const struct msm_dsi_config msm8916_dsi_cfg = { 58 58 .io_offset = DSI_6G_REG_SHIFT, 59 59 .reg_cfg = { 60 - .num = 4, 60 + .num = 3, 61 61 .regs = { 62 62 {"gdsc", -1, -1, -1, -1}, 63 - {"vdd", 2850000, 2850000, 100000, 100}, 64 63 {"vdda", 1200000, 1200000, 100000, 100}, 65 64 {"vddio", 1800000, 1800000, 100000, 100}, 66 65 },
+96 -22
drivers/gpu/drm/msm/dsi/dsi_host.c
··· 163 163 enum mipi_dsi_pixel_format format; 164 164 unsigned long mode_flags; 165 165 166 + /* lane data parsed via DT */ 167 + int dlane_swap; 168 + int num_data_lanes; 169 + 166 170 u32 dma_cmd_ctrl_restore; 167 171 168 172 bool registered; ··· 849 845 data = DSI_CTRL_CLK_EN; 850 846 851 847 DBG("lane number=%d", msm_host->lanes); 852 - if (msm_host->lanes == 2) { 853 - data |= DSI_CTRL_LANE1 | DSI_CTRL_LANE2; 854 - /* swap lanes for 2-lane panel for better performance */ 855 - dsi_write(msm_host, REG_DSI_LANE_SWAP_CTRL, 856 - DSI_LANE_SWAP_CTRL_DLN_SWAP_SEL(LANE_SWAP_1230)); 857 - } else { 858 - /* Take 4 lanes as default */ 859 - data |= DSI_CTRL_LANE0 | DSI_CTRL_LANE1 | DSI_CTRL_LANE2 | 860 - DSI_CTRL_LANE3; 861 - /* Do not swap lanes for 4-lane panel */ 862 - dsi_write(msm_host, REG_DSI_LANE_SWAP_CTRL, 863 - DSI_LANE_SWAP_CTRL_DLN_SWAP_SEL(LANE_SWAP_0123)); 864 - } 848 + data |= ((DSI_CTRL_LANE0 << msm_host->lanes) - DSI_CTRL_LANE0); 849 + 850 + dsi_write(msm_host, REG_DSI_LANE_SWAP_CTRL, 851 + DSI_LANE_SWAP_CTRL_DLN_SWAP_SEL(msm_host->dlane_swap)); 865 852 866 853 if (!(flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)) 867 854 dsi_write(msm_host, REG_DSI_LANE_CTRL, ··· 1474 1479 struct msm_dsi_host *msm_host = to_msm_dsi_host(host); 1475 1480 int ret; 1476 1481 1482 + if (dsi->lanes > msm_host->num_data_lanes) 1483 + return -EINVAL; 1484 + 1477 1485 msm_host->channel = dsi->channel; 1478 1486 msm_host->lanes = dsi->lanes; 1479 1487 msm_host->format = dsi->format; 1480 1488 msm_host->mode_flags = dsi->mode_flags; 1481 - 1482 - WARN_ON(dsi->dev.of_node != msm_host->device_node); 1483 1489 1484 1490 /* Some gpios defined in panel DT need to be controlled by host */ 1485 1491 ret = dsi_host_init_panel_gpios(msm_host, &dsi->dev); ··· 1530 1534 .transfer = dsi_host_transfer, 1531 1535 }; 1532 1536 1537 + /* 1538 + * List of supported physical to logical lane mappings. 1539 + * For example, the 2nd entry represents the following mapping: 1540 + * 1541 + * "3012": Logic 3->Phys 0; Logic 0->Phys 1; Logic 1->Phys 2; Logic 2->Phys 3; 1542 + */ 1543 + static const int supported_data_lane_swaps[][4] = { 1544 + { 0, 1, 2, 3 }, 1545 + { 3, 0, 1, 2 }, 1546 + { 2, 3, 0, 1 }, 1547 + { 1, 2, 3, 0 }, 1548 + { 0, 3, 2, 1 }, 1549 + { 1, 0, 3, 2 }, 1550 + { 2, 1, 0, 3 }, 1551 + { 3, 2, 1, 0 }, 1552 + }; 1553 + 1554 + static int dsi_host_parse_lane_data(struct msm_dsi_host *msm_host, 1555 + struct device_node *ep) 1556 + { 1557 + struct device *dev = &msm_host->pdev->dev; 1558 + struct property *prop; 1559 + u32 lane_map[4]; 1560 + int ret, i, len, num_lanes; 1561 + 1562 + prop = of_find_property(ep, "qcom,data-lane-map", &len); 1563 + if (!prop) { 1564 + dev_dbg(dev, "failed to find data lane mapping\n"); 1565 + return -EINVAL; 1566 + } 1567 + 1568 + num_lanes = len / sizeof(u32); 1569 + 1570 + if (num_lanes < 1 || num_lanes > 4) { 1571 + dev_err(dev, "bad number of data lanes\n"); 1572 + return -EINVAL; 1573 + } 1574 + 1575 + msm_host->num_data_lanes = num_lanes; 1576 + 1577 + ret = of_property_read_u32_array(ep, "qcom,data-lane-map", lane_map, 1578 + num_lanes); 1579 + if (ret) { 1580 + dev_err(dev, "failed to read lane data\n"); 1581 + return ret; 1582 + } 1583 + 1584 + /* 1585 + * compare DT specified physical-logical lane mappings with the ones 1586 + * supported by hardware 1587 + */ 1588 + for (i = 0; i < ARRAY_SIZE(supported_data_lane_swaps); i++) { 1589 + const int *swap = supported_data_lane_swaps[i]; 1590 + int j; 1591 + 1592 + for (j = 0; j < num_lanes; j++) { 1593 + if (swap[j] != lane_map[j]) 1594 + break; 1595 + } 1596 + 1597 + if (j == num_lanes) { 1598 + msm_host->dlane_swap = i; 1599 + return 0; 1600 + } 1601 + } 1602 + 1603 + return -EINVAL; 1604 + } 1605 + 1533 1606 static int dsi_host_parse_dt(struct msm_dsi_host *msm_host) 1534 1607 { 1535 1608 struct device *dev = &msm_host->pdev->dev; ··· 1625 1560 return 0; 1626 1561 } 1627 1562 1563 + ret = dsi_host_parse_lane_data(msm_host, endpoint); 1564 + if (ret) { 1565 + dev_err(dev, "%s: invalid lane configuration %d\n", 1566 + __func__, ret); 1567 + goto err; 1568 + } 1569 + 1628 1570 /* Get panel node from the output port's endpoint data */ 1629 1571 device_node = of_graph_get_remote_port_parent(endpoint); 1630 1572 if (!device_node) { 1631 1573 dev_err(dev, "%s: no valid device\n", __func__); 1632 - of_node_put(endpoint); 1633 - return -ENODEV; 1574 + ret = -ENODEV; 1575 + goto err; 1634 1576 } 1635 - 1636 - of_node_put(endpoint); 1637 - of_node_put(device_node); 1638 1577 1639 1578 msm_host->device_node = device_node; 1640 1579 ··· 1648 1579 if (IS_ERR(msm_host->sfpb)) { 1649 1580 dev_err(dev, "%s: failed to get sfpb regmap\n", 1650 1581 __func__); 1651 - return PTR_ERR(msm_host->sfpb); 1582 + ret = PTR_ERR(msm_host->sfpb); 1652 1583 } 1653 1584 } 1654 1585 1655 - return 0; 1586 + of_node_put(device_node); 1587 + 1588 + err: 1589 + of_node_put(endpoint); 1590 + 1591 + return ret; 1656 1592 } 1657 1593 1658 1594 int msm_dsi_host_init(struct msm_dsi *msm_dsi)
+3 -2
drivers/gpu/drm/msm/dsi/mmss_cc.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+2 -2
drivers/gpu/drm/msm/dsi/pll/dsi_pll.h
··· 97 97 struct msm_dsi_pll *msm_dsi_pll_28nm_8960_init(struct platform_device *pdev, 98 98 int id); 99 99 #else 100 - struct msm_dsi_pll *msm_dsi_pll_28nm_8960_init(struct platform_device *pdev, 101 - int id) 100 + static inline struct msm_dsi_pll *msm_dsi_pll_28nm_8960_init( 101 + struct platform_device *pdev, int id) 102 102 { 103 103 return ERR_PTR(-ENODEV); 104 104 }
+3 -2
drivers/gpu/drm/msm/dsi/sfpb.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+3 -2
drivers/gpu/drm/msm/edp/edp.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+105 -69
drivers/gpu/drm/msm/hdmi/hdmi.c
··· 21 21 22 22 #include "hdmi.h" 23 23 24 - void hdmi_set_mode(struct hdmi *hdmi, bool power_on) 24 + void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on) 25 25 { 26 26 uint32_t ctrl = 0; 27 27 unsigned long flags; ··· 46 46 power_on ? "Enable" : "Disable", ctrl); 47 47 } 48 48 49 - static irqreturn_t hdmi_irq(int irq, void *dev_id) 49 + static irqreturn_t msm_hdmi_irq(int irq, void *dev_id) 50 50 { 51 51 struct hdmi *hdmi = dev_id; 52 52 53 53 /* Process HPD: */ 54 - hdmi_connector_irq(hdmi->connector); 54 + msm_hdmi_connector_irq(hdmi->connector); 55 55 56 56 /* Process DDC: */ 57 - hdmi_i2c_irq(hdmi->i2c); 57 + msm_hdmi_i2c_irq(hdmi->i2c); 58 58 59 59 /* Process HDCP: */ 60 60 if (hdmi->hdcp_ctrl) 61 - hdmi_hdcp_irq(hdmi->hdcp_ctrl); 61 + msm_hdmi_hdcp_irq(hdmi->hdcp_ctrl); 62 62 63 63 /* TODO audio.. */ 64 64 65 65 return IRQ_HANDLED; 66 66 } 67 67 68 - static void hdmi_destroy(struct hdmi *hdmi) 68 + static void msm_hdmi_destroy(struct hdmi *hdmi) 69 69 { 70 - struct hdmi_phy *phy = hdmi->phy; 71 - 72 70 /* 73 71 * at this point, hpd has been disabled, 74 72 * after flush workq, it's safe to deinit hdcp ··· 75 77 flush_workqueue(hdmi->workq); 76 78 destroy_workqueue(hdmi->workq); 77 79 } 78 - hdmi_hdcp_destroy(hdmi); 79 - if (phy) 80 - phy->funcs->destroy(phy); 80 + msm_hdmi_hdcp_destroy(hdmi); 81 + 82 + if (hdmi->phy_dev) { 83 + put_device(hdmi->phy_dev); 84 + hdmi->phy = NULL; 85 + hdmi->phy_dev = NULL; 86 + } 81 87 82 88 if (hdmi->i2c) 83 - hdmi_i2c_destroy(hdmi->i2c); 89 + msm_hdmi_i2c_destroy(hdmi->i2c); 84 90 85 91 platform_set_drvdata(hdmi->pdev, NULL); 92 + } 93 + 94 + static int msm_hdmi_get_phy(struct hdmi *hdmi) 95 + { 96 + struct platform_device *pdev = hdmi->pdev; 97 + struct platform_device *phy_pdev; 98 + struct device_node *phy_node; 99 + 100 + phy_node = of_parse_phandle(pdev->dev.of_node, "phys", 0); 101 + if (!phy_node) { 102 + dev_err(&pdev->dev, "cannot find phy device\n"); 103 + return -ENXIO; 104 + } 105 + 106 + phy_pdev = of_find_device_by_node(phy_node); 107 + if (phy_pdev) 108 + hdmi->phy = platform_get_drvdata(phy_pdev); 109 + 110 + of_node_put(phy_node); 111 + 112 + if (!phy_pdev || !hdmi->phy) { 113 + dev_err(&pdev->dev, "phy driver is not ready\n"); 114 + return -EPROBE_DEFER; 115 + } 116 + 117 + hdmi->phy_dev = get_device(&phy_pdev->dev); 118 + 119 + return 0; 86 120 } 87 121 88 122 /* construct hdmi at bind/probe time, grab all the resources. If 89 123 * we are to EPROBE_DEFER we want to do it here, rather than later 90 124 * at modeset_init() time 91 125 */ 92 - static struct hdmi *hdmi_init(struct platform_device *pdev) 126 + static struct hdmi *msm_hdmi_init(struct platform_device *pdev) 93 127 { 94 128 struct hdmi_platform_config *config = pdev->dev.platform_data; 95 129 struct hdmi *hdmi = NULL; ··· 137 107 hdmi->pdev = pdev; 138 108 hdmi->config = config; 139 109 spin_lock_init(&hdmi->reg_lock); 140 - 141 - /* not sure about which phy maps to which msm.. probably I miss some */ 142 - if (config->phy_init) { 143 - hdmi->phy = config->phy_init(hdmi); 144 - 145 - if (IS_ERR(hdmi->phy)) { 146 - ret = PTR_ERR(hdmi->phy); 147 - dev_err(&pdev->dev, "failed to load phy: %d\n", ret); 148 - hdmi->phy = NULL; 149 - goto fail; 150 - } 151 - } 152 110 153 111 hdmi->mmio = msm_ioremap(pdev, config->mmio_name, "HDMI"); 154 112 if (IS_ERR(hdmi->mmio)) { ··· 240 222 241 223 hdmi->workq = alloc_ordered_workqueue("msm_hdmi", 0); 242 224 243 - hdmi->i2c = hdmi_i2c_init(hdmi); 225 + hdmi->i2c = msm_hdmi_i2c_init(hdmi); 244 226 if (IS_ERR(hdmi->i2c)) { 245 227 ret = PTR_ERR(hdmi->i2c); 246 228 dev_err(&pdev->dev, "failed to get i2c: %d\n", ret); ··· 248 230 goto fail; 249 231 } 250 232 251 - hdmi->hdcp_ctrl = hdmi_hdcp_init(hdmi); 233 + ret = msm_hdmi_get_phy(hdmi); 234 + if (ret) { 235 + dev_err(&pdev->dev, "failed to get phy\n"); 236 + goto fail; 237 + } 238 + 239 + hdmi->hdcp_ctrl = msm_hdmi_hdcp_init(hdmi); 252 240 if (IS_ERR(hdmi->hdcp_ctrl)) { 253 241 dev_warn(&pdev->dev, "failed to init hdcp: disabled\n"); 254 242 hdmi->hdcp_ctrl = NULL; ··· 264 240 265 241 fail: 266 242 if (hdmi) 267 - hdmi_destroy(hdmi); 243 + msm_hdmi_destroy(hdmi); 268 244 269 245 return ERR_PTR(ret); 270 246 } ··· 274 250 * driver (not hdmi sub-device's probe/bind!) 275 251 * 276 252 * Any resource (regulator/clk/etc) which could be missing at boot 277 - * should be handled in hdmi_init() so that failure happens from 253 + * should be handled in msm_hdmi_init() so that failure happens from 278 254 * hdmi sub-device's probe. 279 255 */ 280 - int hdmi_modeset_init(struct hdmi *hdmi, 256 + int msm_hdmi_modeset_init(struct hdmi *hdmi, 281 257 struct drm_device *dev, struct drm_encoder *encoder) 282 258 { 283 259 struct msm_drm_private *priv = dev->dev_private; ··· 289 265 290 266 hdmi_audio_infoframe_init(&hdmi->audio.infoframe); 291 267 292 - hdmi->bridge = hdmi_bridge_init(hdmi); 268 + hdmi->bridge = msm_hdmi_bridge_init(hdmi); 293 269 if (IS_ERR(hdmi->bridge)) { 294 270 ret = PTR_ERR(hdmi->bridge); 295 271 dev_err(dev->dev, "failed to create HDMI bridge: %d\n", ret); ··· 297 273 goto fail; 298 274 } 299 275 300 - hdmi->connector = hdmi_connector_init(hdmi); 276 + hdmi->connector = msm_hdmi_connector_init(hdmi); 301 277 if (IS_ERR(hdmi->connector)) { 302 278 ret = PTR_ERR(hdmi->connector); 303 279 dev_err(dev->dev, "failed to create HDMI connector: %d\n", ret); ··· 313 289 } 314 290 315 291 ret = devm_request_irq(&pdev->dev, hdmi->irq, 316 - hdmi_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, 292 + msm_hdmi_irq, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, 317 293 "hdmi_isr", hdmi); 318 294 if (ret < 0) { 319 295 dev_err(dev->dev, "failed to request IRQ%u: %d\n", ··· 333 309 fail: 334 310 /* bridge is normally destroyed by drm: */ 335 311 if (hdmi->bridge) { 336 - hdmi_bridge_destroy(hdmi->bridge); 312 + msm_hdmi_bridge_destroy(hdmi->bridge); 337 313 hdmi->bridge = NULL; 338 314 } 339 315 if (hdmi->connector) { ··· 355 331 static const char *pwr_reg_names_none[] = {}; 356 332 static const char *hpd_reg_names_none[] = {}; 357 333 358 - static struct hdmi_platform_config hdmi_tx_8660_config = { 359 - .phy_init = hdmi_phy_8x60_init, 360 - }; 334 + static struct hdmi_platform_config hdmi_tx_8660_config; 361 335 362 336 static const char *hpd_reg_names_8960[] = {"core-vdda", "hdmi-mux"}; 363 337 static const char *hpd_clk_names_8960[] = {"core_clk", "master_iface_clk", "slave_iface_clk"}; 364 338 365 339 static struct hdmi_platform_config hdmi_tx_8960_config = { 366 - .phy_init = hdmi_phy_8960_init, 367 340 HDMI_CFG(hpd_reg, 8960), 368 341 HDMI_CFG(hpd_clk, 8960), 369 342 }; ··· 372 351 static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0}; 373 352 374 353 static struct hdmi_platform_config hdmi_tx_8974_config = { 375 - .phy_init = hdmi_phy_8x74_init, 376 354 HDMI_CFG(pwr_reg, 8x74), 377 355 HDMI_CFG(hpd_reg, 8x74), 378 356 HDMI_CFG(pwr_clk, 8x74), ··· 382 362 static const char *hpd_reg_names_8084[] = {"hpd-gdsc", "hpd-5v", "hpd-5v-en"}; 383 363 384 364 static struct hdmi_platform_config hdmi_tx_8084_config = { 385 - .phy_init = hdmi_phy_8x74_init, 386 365 HDMI_CFG(pwr_reg, 8x74), 387 366 HDMI_CFG(hpd_reg, 8084), 388 367 HDMI_CFG(pwr_clk, 8x74), ··· 390 371 }; 391 372 392 373 static struct hdmi_platform_config hdmi_tx_8994_config = { 393 - .phy_init = NULL, /* nothing to do for this HDMI PHY 20nm */ 394 374 HDMI_CFG(pwr_reg, 8x74), 395 375 HDMI_CFG(hpd_reg, none), 396 376 HDMI_CFG(pwr_clk, 8x74), ··· 398 380 }; 399 381 400 382 static struct hdmi_platform_config hdmi_tx_8996_config = { 401 - .phy_init = NULL, 402 383 HDMI_CFG(pwr_reg, none), 403 384 HDMI_CFG(hpd_reg, none), 404 385 HDMI_CFG(pwr_clk, 8x74), ··· 405 388 .hpd_freq = hpd_clk_freq_8x74, 406 389 }; 407 390 408 - static int get_gpio(struct device *dev, struct device_node *of_node, const char *name) 391 + static const struct { 392 + const char *name; 393 + const bool output; 394 + const int value; 395 + const char *label; 396 + } msm_hdmi_gpio_pdata[] = { 397 + { "qcom,hdmi-tx-ddc-clk", true, 1, "HDMI_DDC_CLK" }, 398 + { "qcom,hdmi-tx-ddc-data", true, 1, "HDMI_DDC_DATA" }, 399 + { "qcom,hdmi-tx-hpd", false, 1, "HDMI_HPD" }, 400 + { "qcom,hdmi-tx-mux-en", true, 1, "HDMI_MUX_EN" }, 401 + { "qcom,hdmi-tx-mux-sel", true, 0, "HDMI_MUX_SEL" }, 402 + { "qcom,hdmi-tx-mux-lpm", true, 1, "HDMI_MUX_LPM" }, 403 + }; 404 + 405 + static int msm_hdmi_get_gpio(struct device_node *of_node, const char *name) 409 406 { 410 407 int gpio = of_get_named_gpio(of_node, name, 0); 411 408 if (gpio < 0) { ··· 434 403 return gpio; 435 404 } 436 405 437 - static int hdmi_bind(struct device *dev, struct device *master, void *data) 406 + static int msm_hdmi_bind(struct device *dev, struct device *master, void *data) 438 407 { 439 408 struct drm_device *drm = dev_get_drvdata(master); 440 409 struct msm_drm_private *priv = drm->dev_private; 441 410 static struct hdmi_platform_config *hdmi_cfg; 442 411 struct hdmi *hdmi; 443 412 struct device_node *of_node = dev->of_node; 413 + int i; 444 414 445 415 hdmi_cfg = (struct hdmi_platform_config *) 446 416 of_device_get_match_data(dev); ··· 452 420 453 421 hdmi_cfg->mmio_name = "core_physical"; 454 422 hdmi_cfg->qfprom_mmio_name = "qfprom_physical"; 455 - hdmi_cfg->ddc_clk_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-clk"); 456 - hdmi_cfg->ddc_data_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-ddc-data"); 457 - hdmi_cfg->hpd_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-hpd"); 458 - hdmi_cfg->mux_en_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-en"); 459 - hdmi_cfg->mux_sel_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-sel"); 460 - hdmi_cfg->mux_lpm_gpio = get_gpio(dev, of_node, "qcom,hdmi-tx-mux-lpm"); 423 + 424 + for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) { 425 + hdmi_cfg->gpios[i].num = msm_hdmi_get_gpio(of_node, 426 + msm_hdmi_gpio_pdata[i].name); 427 + hdmi_cfg->gpios[i].output = msm_hdmi_gpio_pdata[i].output; 428 + hdmi_cfg->gpios[i].value = msm_hdmi_gpio_pdata[i].value; 429 + hdmi_cfg->gpios[i].label = msm_hdmi_gpio_pdata[i].label; 430 + } 461 431 462 432 dev->platform_data = hdmi_cfg; 463 433 464 - hdmi = hdmi_init(to_platform_device(dev)); 434 + hdmi = msm_hdmi_init(to_platform_device(dev)); 465 435 if (IS_ERR(hdmi)) 466 436 return PTR_ERR(hdmi); 467 437 priv->hdmi = hdmi; ··· 471 437 return 0; 472 438 } 473 439 474 - static void hdmi_unbind(struct device *dev, struct device *master, 440 + static void msm_hdmi_unbind(struct device *dev, struct device *master, 475 441 void *data) 476 442 { 477 443 struct drm_device *drm = dev_get_drvdata(master); 478 444 struct msm_drm_private *priv = drm->dev_private; 479 445 if (priv->hdmi) { 480 - hdmi_destroy(priv->hdmi); 446 + msm_hdmi_destroy(priv->hdmi); 481 447 priv->hdmi = NULL; 482 448 } 483 449 } 484 450 485 - static const struct component_ops hdmi_ops = { 486 - .bind = hdmi_bind, 487 - .unbind = hdmi_unbind, 451 + static const struct component_ops msm_hdmi_ops = { 452 + .bind = msm_hdmi_bind, 453 + .unbind = msm_hdmi_unbind, 488 454 }; 489 455 490 - static int hdmi_dev_probe(struct platform_device *pdev) 456 + static int msm_hdmi_dev_probe(struct platform_device *pdev) 491 457 { 492 - return component_add(&pdev->dev, &hdmi_ops); 458 + return component_add(&pdev->dev, &msm_hdmi_ops); 493 459 } 494 460 495 - static int hdmi_dev_remove(struct platform_device *pdev) 461 + static int msm_hdmi_dev_remove(struct platform_device *pdev) 496 462 { 497 - component_del(&pdev->dev, &hdmi_ops); 463 + component_del(&pdev->dev, &msm_hdmi_ops); 498 464 return 0; 499 465 } 500 466 501 - static const struct of_device_id dt_match[] = { 467 + static const struct of_device_id msm_hdmi_dt_match[] = { 502 468 { .compatible = "qcom,hdmi-tx-8996", .data = &hdmi_tx_8996_config }, 503 469 { .compatible = "qcom,hdmi-tx-8994", .data = &hdmi_tx_8994_config }, 504 470 { .compatible = "qcom,hdmi-tx-8084", .data = &hdmi_tx_8084_config }, ··· 508 474 {} 509 475 }; 510 476 511 - static struct platform_driver hdmi_driver = { 512 - .probe = hdmi_dev_probe, 513 - .remove = hdmi_dev_remove, 477 + static struct platform_driver msm_hdmi_driver = { 478 + .probe = msm_hdmi_dev_probe, 479 + .remove = msm_hdmi_dev_remove, 514 480 .driver = { 515 481 .name = "hdmi_msm", 516 - .of_match_table = dt_match, 482 + .of_match_table = msm_hdmi_dt_match, 517 483 }, 518 484 }; 519 485 520 - void __init hdmi_register(void) 486 + void __init msm_hdmi_register(void) 521 487 { 522 - platform_driver_register(&hdmi_driver); 488 + msm_hdmi_phy_driver_register(); 489 + platform_driver_register(&msm_hdmi_driver); 523 490 } 524 491 525 - void __exit hdmi_unregister(void) 492 + void __exit msm_hdmi_unregister(void) 526 493 { 527 - platform_driver_unregister(&hdmi_driver); 494 + platform_driver_unregister(&msm_hdmi_driver); 495 + msm_hdmi_phy_driver_unregister(); 528 496 }
+83 -27
drivers/gpu/drm/msm/hdmi/hdmi.h
··· 27 27 #include "msm_drv.h" 28 28 #include "hdmi.xml.h" 29 29 30 + #define HDMI_MAX_NUM_GPIO 6 30 31 31 32 struct hdmi_phy; 32 33 struct hdmi_platform_config; 34 + 35 + struct hdmi_gpio_data { 36 + int num; 37 + bool output; 38 + int value; 39 + const char *label; 40 + }; 33 41 34 42 struct hdmi_audio { 35 43 bool enabled; ··· 70 62 struct clk **pwr_clks; 71 63 72 64 struct hdmi_phy *phy; 65 + struct device *phy_dev; 66 + 73 67 struct i2c_adapter *i2c; 74 68 struct drm_connector *connector; 75 69 struct drm_bridge *bridge; ··· 98 88 99 89 /* platform config data (ie. from DT, or pdata) */ 100 90 struct hdmi_platform_config { 101 - struct hdmi_phy *(*phy_init)(struct hdmi *hdmi); 102 91 const char *mmio_name; 103 92 const char *qfprom_mmio_name; 104 93 ··· 119 110 int pwr_clk_cnt; 120 111 121 112 /* gpio's: */ 122 - int ddc_clk_gpio, ddc_data_gpio, hpd_gpio, mux_en_gpio, mux_sel_gpio; 123 - int mux_lpm_gpio; 113 + struct hdmi_gpio_data gpios[HDMI_MAX_NUM_GPIO]; 124 114 }; 125 115 126 - void hdmi_set_mode(struct hdmi *hdmi, bool power_on); 116 + void msm_hdmi_set_mode(struct hdmi *hdmi, bool power_on); 127 117 128 118 static inline void hdmi_write(struct hdmi *hdmi, u32 reg, u32 data) 129 119 { ··· 140 132 } 141 133 142 134 /* 143 - * The phy appears to be different, for example between 8960 and 8x60, 144 - * so split the phy related functions out and load the correct one at 145 - * runtime: 135 + * hdmi phy: 146 136 */ 147 137 148 - struct hdmi_phy_funcs { 149 - void (*destroy)(struct hdmi_phy *phy); 138 + enum hdmi_phy_type { 139 + MSM_HDMI_PHY_8x60, 140 + MSM_HDMI_PHY_8960, 141 + MSM_HDMI_PHY_8x74, 142 + MSM_HDMI_PHY_8996, 143 + MSM_HDMI_PHY_MAX, 144 + }; 145 + 146 + struct hdmi_phy_cfg { 147 + enum hdmi_phy_type type; 150 148 void (*powerup)(struct hdmi_phy *phy, unsigned long int pixclock); 151 149 void (*powerdown)(struct hdmi_phy *phy); 150 + const char * const *reg_names; 151 + int num_regs; 152 + const char * const *clk_names; 153 + int num_clks; 152 154 }; 155 + 156 + extern const struct hdmi_phy_cfg msm_hdmi_phy_8x60_cfg; 157 + extern const struct hdmi_phy_cfg msm_hdmi_phy_8960_cfg; 158 + extern const struct hdmi_phy_cfg msm_hdmi_phy_8x74_cfg; 159 + extern const struct hdmi_phy_cfg msm_hdmi_phy_8996_cfg; 153 160 154 161 struct hdmi_phy { 162 + struct platform_device *pdev; 163 + void __iomem *mmio; 164 + struct hdmi_phy_cfg *cfg; 155 165 const struct hdmi_phy_funcs *funcs; 166 + struct regulator **regs; 167 + struct clk **clks; 156 168 }; 157 169 158 - struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi); 159 - struct hdmi_phy *hdmi_phy_8x60_init(struct hdmi *hdmi); 160 - struct hdmi_phy *hdmi_phy_8x74_init(struct hdmi *hdmi); 170 + static inline void hdmi_phy_write(struct hdmi_phy *phy, u32 reg, u32 data) 171 + { 172 + msm_writel(data, phy->mmio + reg); 173 + } 174 + 175 + static inline u32 hdmi_phy_read(struct hdmi_phy *phy, u32 reg) 176 + { 177 + return msm_readl(phy->mmio + reg); 178 + } 179 + 180 + int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy); 181 + void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy); 182 + void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long int pixclock); 183 + void msm_hdmi_phy_powerdown(struct hdmi_phy *phy); 184 + void __init msm_hdmi_phy_driver_register(void); 185 + void __exit msm_hdmi_phy_driver_unregister(void); 186 + 187 + #ifdef CONFIG_COMMON_CLK 188 + int msm_hdmi_pll_8960_init(struct platform_device *pdev); 189 + int msm_hdmi_pll_8996_init(struct platform_device *pdev); 190 + #else 191 + static inline int msm_hdmi_pll_8960_init(struct platform_device *pdev); 192 + { 193 + return -ENODEV; 194 + } 195 + 196 + static inline int msm_hdmi_pll_8996_init(struct platform_device *pdev) 197 + { 198 + return -ENODEV; 199 + } 200 + #endif 161 201 162 202 /* 163 203 * audio: 164 204 */ 165 205 166 - int hdmi_audio_update(struct hdmi *hdmi); 167 - int hdmi_audio_info_setup(struct hdmi *hdmi, bool enabled, 206 + int msm_hdmi_audio_update(struct hdmi *hdmi); 207 + int msm_hdmi_audio_info_setup(struct hdmi *hdmi, bool enabled, 168 208 uint32_t num_of_channels, uint32_t channel_allocation, 169 209 uint32_t level_shift, bool down_mix); 170 - void hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate); 210 + void msm_hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate); 171 211 172 212 173 213 /* 174 214 * hdmi bridge: 175 215 */ 176 216 177 - struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi); 178 - void hdmi_bridge_destroy(struct drm_bridge *bridge); 217 + struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi); 218 + void msm_hdmi_bridge_destroy(struct drm_bridge *bridge); 179 219 180 220 /* 181 221 * hdmi connector: 182 222 */ 183 223 184 - void hdmi_connector_irq(struct drm_connector *connector); 185 - struct drm_connector *hdmi_connector_init(struct hdmi *hdmi); 224 + void msm_hdmi_connector_irq(struct drm_connector *connector); 225 + struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi); 186 226 187 227 /* 188 228 * i2c adapter for ddc: 189 229 */ 190 230 191 - void hdmi_i2c_irq(struct i2c_adapter *i2c); 192 - void hdmi_i2c_destroy(struct i2c_adapter *i2c); 193 - struct i2c_adapter *hdmi_i2c_init(struct hdmi *hdmi); 231 + void msm_hdmi_i2c_irq(struct i2c_adapter *i2c); 232 + void msm_hdmi_i2c_destroy(struct i2c_adapter *i2c); 233 + struct i2c_adapter *msm_hdmi_i2c_init(struct hdmi *hdmi); 194 234 195 235 /* 196 236 * hdcp 197 237 */ 198 - struct hdmi_hdcp_ctrl *hdmi_hdcp_init(struct hdmi *hdmi); 199 - void hdmi_hdcp_destroy(struct hdmi *hdmi); 200 - void hdmi_hdcp_on(struct hdmi_hdcp_ctrl *hdcp_ctrl); 201 - void hdmi_hdcp_off(struct hdmi_hdcp_ctrl *hdcp_ctrl); 202 - void hdmi_hdcp_irq(struct hdmi_hdcp_ctrl *hdcp_ctrl); 238 + struct hdmi_hdcp_ctrl *msm_hdmi_hdcp_init(struct hdmi *hdmi); 239 + void msm_hdmi_hdcp_destroy(struct hdmi *hdmi); 240 + void msm_hdmi_hdcp_on(struct hdmi_hdcp_ctrl *hdcp_ctrl); 241 + void msm_hdmi_hdcp_off(struct hdmi_hdcp_ctrl *hdcp_ctrl); 242 + void msm_hdmi_hdcp_irq(struct hdmi_hdcp_ctrl *hdcp_ctrl); 203 243 204 244 #endif /* __HDMI_CONNECTOR_H__ */
+572 -75
drivers/gpu/drm/msm/hdmi/hdmi.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 - Copyright (C) 2013-2015 by the following authors: 23 + Copyright (C) 2013-2016 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the ··· 560 559 561 560 #define REG_HDMI_CEC_WR_CHECK_CONFIG 0x00000370 562 561 563 - #define REG_HDMI_8x60_PHY_REG0 0x00000300 562 + #define REG_HDMI_8x60_PHY_REG0 0x00000000 564 563 #define HDMI_8x60_PHY_REG0_DESER_DEL_CTRL__MASK 0x0000001c 565 564 #define HDMI_8x60_PHY_REG0_DESER_DEL_CTRL__SHIFT 2 566 565 static inline uint32_t HDMI_8x60_PHY_REG0_DESER_DEL_CTRL(uint32_t val) ··· 568 567 return ((val) << HDMI_8x60_PHY_REG0_DESER_DEL_CTRL__SHIFT) & HDMI_8x60_PHY_REG0_DESER_DEL_CTRL__MASK; 569 568 } 570 569 571 - #define REG_HDMI_8x60_PHY_REG1 0x00000304 570 + #define REG_HDMI_8x60_PHY_REG1 0x00000004 572 571 #define HDMI_8x60_PHY_REG1_DTEST_MUX_SEL__MASK 0x000000f0 573 572 #define HDMI_8x60_PHY_REG1_DTEST_MUX_SEL__SHIFT 4 574 573 static inline uint32_t HDMI_8x60_PHY_REG1_DTEST_MUX_SEL(uint32_t val) ··· 582 581 return ((val) << HDMI_8x60_PHY_REG1_OUTVOL_SWING_CTRL__SHIFT) & HDMI_8x60_PHY_REG1_OUTVOL_SWING_CTRL__MASK; 583 582 } 584 583 585 - #define REG_HDMI_8x60_PHY_REG2 0x00000308 584 + #define REG_HDMI_8x60_PHY_REG2 0x00000008 586 585 #define HDMI_8x60_PHY_REG2_PD_DESER 0x00000001 587 586 #define HDMI_8x60_PHY_REG2_PD_DRIVE_1 0x00000002 588 587 #define HDMI_8x60_PHY_REG2_PD_DRIVE_2 0x00000004 ··· 592 591 #define HDMI_8x60_PHY_REG2_PD_PWRGEN 0x00000040 593 592 #define HDMI_8x60_PHY_REG2_RCV_SENSE_EN 0x00000080 594 593 595 - #define REG_HDMI_8x60_PHY_REG3 0x0000030c 594 + #define REG_HDMI_8x60_PHY_REG3 0x0000000c 596 595 #define HDMI_8x60_PHY_REG3_PLL_ENABLE 0x00000001 597 596 598 - #define REG_HDMI_8x60_PHY_REG4 0x00000310 597 + #define REG_HDMI_8x60_PHY_REG4 0x00000010 599 598 600 - #define REG_HDMI_8x60_PHY_REG5 0x00000314 599 + #define REG_HDMI_8x60_PHY_REG5 0x00000014 601 600 602 - #define REG_HDMI_8x60_PHY_REG6 0x00000318 601 + #define REG_HDMI_8x60_PHY_REG6 0x00000018 603 602 604 - #define REG_HDMI_8x60_PHY_REG7 0x0000031c 603 + #define REG_HDMI_8x60_PHY_REG7 0x0000001c 605 604 606 - #define REG_HDMI_8x60_PHY_REG8 0x00000320 605 + #define REG_HDMI_8x60_PHY_REG8 0x00000020 607 606 608 - #define REG_HDMI_8x60_PHY_REG9 0x00000324 607 + #define REG_HDMI_8x60_PHY_REG9 0x00000024 609 608 610 - #define REG_HDMI_8x60_PHY_REG10 0x00000328 609 + #define REG_HDMI_8x60_PHY_REG10 0x00000028 611 610 612 - #define REG_HDMI_8x60_PHY_REG11 0x0000032c 611 + #define REG_HDMI_8x60_PHY_REG11 0x0000002c 613 612 614 - #define REG_HDMI_8x60_PHY_REG12 0x00000330 613 + #define REG_HDMI_8x60_PHY_REG12 0x00000030 615 614 #define HDMI_8x60_PHY_REG12_RETIMING_EN 0x00000001 616 615 #define HDMI_8x60_PHY_REG12_PLL_LOCK_DETECT_EN 0x00000002 617 616 #define HDMI_8x60_PHY_REG12_FORCE_LOCK 0x00000010 618 617 619 - #define REG_HDMI_8960_PHY_REG0 0x00000400 618 + #define REG_HDMI_8960_PHY_REG0 0x00000000 620 619 621 - #define REG_HDMI_8960_PHY_REG1 0x00000404 620 + #define REG_HDMI_8960_PHY_REG1 0x00000004 622 621 623 - #define REG_HDMI_8960_PHY_REG2 0x00000408 622 + #define REG_HDMI_8960_PHY_REG2 0x00000008 624 623 625 - #define REG_HDMI_8960_PHY_REG3 0x0000040c 624 + #define REG_HDMI_8960_PHY_REG3 0x0000000c 626 625 627 - #define REG_HDMI_8960_PHY_REG4 0x00000410 626 + #define REG_HDMI_8960_PHY_REG4 0x00000010 628 627 629 - #define REG_HDMI_8960_PHY_REG5 0x00000414 628 + #define REG_HDMI_8960_PHY_REG5 0x00000014 630 629 631 - #define REG_HDMI_8960_PHY_REG6 0x00000418 630 + #define REG_HDMI_8960_PHY_REG6 0x00000018 632 631 633 - #define REG_HDMI_8960_PHY_REG7 0x0000041c 632 + #define REG_HDMI_8960_PHY_REG7 0x0000001c 634 633 635 - #define REG_HDMI_8960_PHY_REG8 0x00000420 634 + #define REG_HDMI_8960_PHY_REG8 0x00000020 636 635 637 - #define REG_HDMI_8960_PHY_REG9 0x00000424 636 + #define REG_HDMI_8960_PHY_REG9 0x00000024 638 637 639 - #define REG_HDMI_8960_PHY_REG10 0x00000428 638 + #define REG_HDMI_8960_PHY_REG10 0x00000028 640 639 641 - #define REG_HDMI_8960_PHY_REG11 0x0000042c 640 + #define REG_HDMI_8960_PHY_REG11 0x0000002c 642 641 643 - #define REG_HDMI_8960_PHY_REG12 0x00000430 642 + #define REG_HDMI_8960_PHY_REG12 0x00000030 644 643 #define HDMI_8960_PHY_REG12_SW_RESET 0x00000020 645 644 #define HDMI_8960_PHY_REG12_PWRDN_B 0x00000080 646 645 647 - #define REG_HDMI_8960_PHY_REG_BIST_CFG 0x00000434 646 + #define REG_HDMI_8960_PHY_REG_BIST_CFG 0x00000034 648 647 649 - #define REG_HDMI_8960_PHY_DEBUG_BUS_SEL 0x00000438 648 + #define REG_HDMI_8960_PHY_DEBUG_BUS_SEL 0x00000038 650 649 651 - #define REG_HDMI_8960_PHY_REG_MISC0 0x0000043c 650 + #define REG_HDMI_8960_PHY_REG_MISC0 0x0000003c 652 651 653 - #define REG_HDMI_8960_PHY_REG13 0x00000440 652 + #define REG_HDMI_8960_PHY_REG13 0x00000040 654 653 655 - #define REG_HDMI_8960_PHY_REG14 0x00000444 654 + #define REG_HDMI_8960_PHY_REG14 0x00000044 656 655 657 - #define REG_HDMI_8960_PHY_REG15 0x00000448 656 + #define REG_HDMI_8960_PHY_REG15 0x00000048 658 657 659 - #define REG_HDMI_8960_PHY_PLL_REFCLK_CFG 0x00000500 658 + #define REG_HDMI_8960_PHY_PLL_REFCLK_CFG 0x00000000 660 659 661 - #define REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG 0x00000504 660 + #define REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG 0x00000004 662 661 663 - #define REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 0x00000508 662 + #define REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 0x00000008 664 663 665 - #define REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 0x0000050c 664 + #define REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 0x0000000c 666 665 667 - #define REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG 0x00000510 666 + #define REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG 0x00000010 668 667 669 - #define REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG 0x00000514 668 + #define REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG 0x00000014 670 669 671 - #define REG_HDMI_8960_PHY_PLL_PWRDN_B 0x00000518 670 + #define REG_HDMI_8960_PHY_PLL_PWRDN_B 0x00000018 672 671 #define HDMI_8960_PHY_PLL_PWRDN_B_PD_PLL 0x00000002 673 672 #define HDMI_8960_PHY_PLL_PWRDN_B_PLL_PWRDN_B 0x00000008 674 673 675 - #define REG_HDMI_8960_PHY_PLL_SDM_CFG0 0x0000051c 674 + #define REG_HDMI_8960_PHY_PLL_SDM_CFG0 0x0000001c 676 675 677 - #define REG_HDMI_8960_PHY_PLL_SDM_CFG1 0x00000520 676 + #define REG_HDMI_8960_PHY_PLL_SDM_CFG1 0x00000020 678 677 679 - #define REG_HDMI_8960_PHY_PLL_SDM_CFG2 0x00000524 678 + #define REG_HDMI_8960_PHY_PLL_SDM_CFG2 0x00000024 680 679 681 - #define REG_HDMI_8960_PHY_PLL_SDM_CFG3 0x00000528 680 + #define REG_HDMI_8960_PHY_PLL_SDM_CFG3 0x00000028 682 681 683 - #define REG_HDMI_8960_PHY_PLL_SDM_CFG4 0x0000052c 682 + #define REG_HDMI_8960_PHY_PLL_SDM_CFG4 0x0000002c 684 683 685 - #define REG_HDMI_8960_PHY_PLL_SSC_CFG0 0x00000530 684 + #define REG_HDMI_8960_PHY_PLL_SSC_CFG0 0x00000030 686 685 687 - #define REG_HDMI_8960_PHY_PLL_SSC_CFG1 0x00000534 686 + #define REG_HDMI_8960_PHY_PLL_SSC_CFG1 0x00000034 688 687 689 - #define REG_HDMI_8960_PHY_PLL_SSC_CFG2 0x00000538 688 + #define REG_HDMI_8960_PHY_PLL_SSC_CFG2 0x00000038 690 689 691 - #define REG_HDMI_8960_PHY_PLL_SSC_CFG3 0x0000053c 690 + #define REG_HDMI_8960_PHY_PLL_SSC_CFG3 0x0000003c 692 691 693 - #define REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 0x00000540 692 + #define REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 0x00000040 694 693 695 - #define REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 0x00000544 694 + #define REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 0x00000044 696 695 697 - #define REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 0x00000548 696 + #define REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 0x00000048 698 697 699 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 0x0000054c 698 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 0x0000004c 700 699 701 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 0x00000550 700 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 0x00000050 702 701 703 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 0x00000554 702 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 0x00000054 704 703 705 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 0x00000558 704 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 0x00000058 706 705 707 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 0x0000055c 706 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 0x0000005c 708 707 709 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 0x00000560 708 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 0x00000060 710 709 711 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 0x00000564 710 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 0x00000064 712 711 713 - #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 0x00000568 712 + #define REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 0x00000068 714 713 715 - #define REG_HDMI_8960_PHY_PLL_DEBUG_SEL 0x0000056c 714 + #define REG_HDMI_8960_PHY_PLL_DEBUG_SEL 0x0000006c 716 715 717 - #define REG_HDMI_8960_PHY_PLL_MISC0 0x00000570 716 + #define REG_HDMI_8960_PHY_PLL_MISC0 0x00000070 718 717 719 - #define REG_HDMI_8960_PHY_PLL_MISC1 0x00000574 718 + #define REG_HDMI_8960_PHY_PLL_MISC1 0x00000074 720 719 721 - #define REG_HDMI_8960_PHY_PLL_MISC2 0x00000578 720 + #define REG_HDMI_8960_PHY_PLL_MISC2 0x00000078 722 721 723 - #define REG_HDMI_8960_PHY_PLL_MISC3 0x0000057c 722 + #define REG_HDMI_8960_PHY_PLL_MISC3 0x0000007c 724 723 725 - #define REG_HDMI_8960_PHY_PLL_MISC4 0x00000580 724 + #define REG_HDMI_8960_PHY_PLL_MISC4 0x00000080 726 725 727 - #define REG_HDMI_8960_PHY_PLL_MISC5 0x00000584 726 + #define REG_HDMI_8960_PHY_PLL_MISC5 0x00000084 728 727 729 - #define REG_HDMI_8960_PHY_PLL_MISC6 0x00000588 728 + #define REG_HDMI_8960_PHY_PLL_MISC6 0x00000088 730 729 731 - #define REG_HDMI_8960_PHY_PLL_DEBUG_BUS0 0x0000058c 730 + #define REG_HDMI_8960_PHY_PLL_DEBUG_BUS0 0x0000008c 732 731 733 - #define REG_HDMI_8960_PHY_PLL_DEBUG_BUS1 0x00000590 732 + #define REG_HDMI_8960_PHY_PLL_DEBUG_BUS1 0x00000090 734 733 735 - #define REG_HDMI_8960_PHY_PLL_DEBUG_BUS2 0x00000594 734 + #define REG_HDMI_8960_PHY_PLL_DEBUG_BUS2 0x00000094 736 735 737 - #define REG_HDMI_8960_PHY_PLL_STATUS0 0x00000598 736 + #define REG_HDMI_8960_PHY_PLL_STATUS0 0x00000098 738 737 #define HDMI_8960_PHY_PLL_STATUS0_PLL_LOCK 0x00000001 739 738 740 - #define REG_HDMI_8960_PHY_PLL_STATUS1 0x0000059c 739 + #define REG_HDMI_8960_PHY_PLL_STATUS1 0x0000009c 741 740 742 741 #define REG_HDMI_8x74_ANA_CFG0 0x00000000 743 742 ··· 843 842 #define REG_HDMI_28nm_PHY_PLL_EFUSE_CFG 0x0000009c 844 843 845 844 #define REG_HDMI_28nm_PHY_PLL_DEBUG_BUS_SEL 0x000000a0 845 + 846 + #define REG_HDMI_8996_PHY_CFG 0x00000000 847 + 848 + #define REG_HDMI_8996_PHY_PD_CTL 0x00000004 849 + 850 + #define REG_HDMI_8996_PHY_MODE 0x00000008 851 + 852 + #define REG_HDMI_8996_PHY_MISR_CLEAR 0x0000000c 853 + 854 + #define REG_HDMI_8996_PHY_TX0_TX1_BIST_CFG0 0x00000010 855 + 856 + #define REG_HDMI_8996_PHY_TX0_TX1_BIST_CFG1 0x00000014 857 + 858 + #define REG_HDMI_8996_PHY_TX0_TX1_PRBS_SEED_BYTE0 0x00000018 859 + 860 + #define REG_HDMI_8996_PHY_TX0_TX1_PRBS_SEED_BYTE1 0x0000001c 861 + 862 + #define REG_HDMI_8996_PHY_TX0_TX1_BIST_PATTERN0 0x00000020 863 + 864 + #define REG_HDMI_8996_PHY_TX0_TX1_BIST_PATTERN1 0x00000024 865 + 866 + #define REG_HDMI_8996_PHY_TX2_TX3_BIST_CFG0 0x00000028 867 + 868 + #define REG_HDMI_8996_PHY_TX2_TX3_BIST_CFG1 0x0000002c 869 + 870 + #define REG_HDMI_8996_PHY_TX2_TX3_PRBS_SEED_BYTE0 0x00000030 871 + 872 + #define REG_HDMI_8996_PHY_TX2_TX3_PRBS_SEED_BYTE1 0x00000034 873 + 874 + #define REG_HDMI_8996_PHY_TX2_TX3_BIST_PATTERN0 0x00000038 875 + 876 + #define REG_HDMI_8996_PHY_TX2_TX3_BIST_PATTERN1 0x0000003c 877 + 878 + #define REG_HDMI_8996_PHY_DEBUG_BUS_SEL 0x00000040 879 + 880 + #define REG_HDMI_8996_PHY_TXCAL_CFG0 0x00000044 881 + 882 + #define REG_HDMI_8996_PHY_TXCAL_CFG1 0x00000048 883 + 884 + #define REG_HDMI_8996_PHY_TX0_TX1_LANE_CTL 0x0000004c 885 + 886 + #define REG_HDMI_8996_PHY_TX2_TX3_LANE_CTL 0x00000050 887 + 888 + #define REG_HDMI_8996_PHY_LANE_BIST_CONFIG 0x00000054 889 + 890 + #define REG_HDMI_8996_PHY_CLOCK 0x00000058 891 + 892 + #define REG_HDMI_8996_PHY_MISC1 0x0000005c 893 + 894 + #define REG_HDMI_8996_PHY_MISC2 0x00000060 895 + 896 + #define REG_HDMI_8996_PHY_TX0_TX1_BIST_STATUS0 0x00000064 897 + 898 + #define REG_HDMI_8996_PHY_TX0_TX1_BIST_STATUS1 0x00000068 899 + 900 + #define REG_HDMI_8996_PHY_TX0_TX1_BIST_STATUS2 0x0000006c 901 + 902 + #define REG_HDMI_8996_PHY_TX2_TX3_BIST_STATUS0 0x00000070 903 + 904 + #define REG_HDMI_8996_PHY_TX2_TX3_BIST_STATUS1 0x00000074 905 + 906 + #define REG_HDMI_8996_PHY_TX2_TX3_BIST_STATUS2 0x00000078 907 + 908 + #define REG_HDMI_8996_PHY_PRE_MISR_STATUS0 0x0000007c 909 + 910 + #define REG_HDMI_8996_PHY_PRE_MISR_STATUS1 0x00000080 911 + 912 + #define REG_HDMI_8996_PHY_PRE_MISR_STATUS2 0x00000084 913 + 914 + #define REG_HDMI_8996_PHY_PRE_MISR_STATUS3 0x00000088 915 + 916 + #define REG_HDMI_8996_PHY_POST_MISR_STATUS0 0x0000008c 917 + 918 + #define REG_HDMI_8996_PHY_POST_MISR_STATUS1 0x00000090 919 + 920 + #define REG_HDMI_8996_PHY_POST_MISR_STATUS2 0x00000094 921 + 922 + #define REG_HDMI_8996_PHY_POST_MISR_STATUS3 0x00000098 923 + 924 + #define REG_HDMI_8996_PHY_STATUS 0x0000009c 925 + 926 + #define REG_HDMI_8996_PHY_MISC3_STATUS 0x000000a0 927 + 928 + #define REG_HDMI_8996_PHY_MISC4_STATUS 0x000000a4 929 + 930 + #define REG_HDMI_8996_PHY_DEBUG_BUS0 0x000000a8 931 + 932 + #define REG_HDMI_8996_PHY_DEBUG_BUS1 0x000000ac 933 + 934 + #define REG_HDMI_8996_PHY_DEBUG_BUS2 0x000000b0 935 + 936 + #define REG_HDMI_8996_PHY_DEBUG_BUS3 0x000000b4 937 + 938 + #define REG_HDMI_8996_PHY_PHY_REVISION_ID0 0x000000b8 939 + 940 + #define REG_HDMI_8996_PHY_PHY_REVISION_ID1 0x000000bc 941 + 942 + #define REG_HDMI_8996_PHY_PHY_REVISION_ID2 0x000000c0 943 + 944 + #define REG_HDMI_8996_PHY_PHY_REVISION_ID3 0x000000c4 945 + 946 + #define REG_HDMI_PHY_QSERDES_COM_ATB_SEL1 0x00000000 947 + 948 + #define REG_HDMI_PHY_QSERDES_COM_ATB_SEL2 0x00000004 949 + 950 + #define REG_HDMI_PHY_QSERDES_COM_FREQ_UPDATE 0x00000008 951 + 952 + #define REG_HDMI_PHY_QSERDES_COM_BG_TIMER 0x0000000c 953 + 954 + #define REG_HDMI_PHY_QSERDES_COM_SSC_EN_CENTER 0x00000010 955 + 956 + #define REG_HDMI_PHY_QSERDES_COM_SSC_ADJ_PER1 0x00000014 957 + 958 + #define REG_HDMI_PHY_QSERDES_COM_SSC_ADJ_PER2 0x00000018 959 + 960 + #define REG_HDMI_PHY_QSERDES_COM_SSC_PER1 0x0000001c 961 + 962 + #define REG_HDMI_PHY_QSERDES_COM_SSC_PER2 0x00000020 963 + 964 + #define REG_HDMI_PHY_QSERDES_COM_SSC_STEP_SIZE1 0x00000024 965 + 966 + #define REG_HDMI_PHY_QSERDES_COM_SSC_STEP_SIZE2 0x00000028 967 + 968 + #define REG_HDMI_PHY_QSERDES_COM_POST_DIV 0x0000002c 969 + 970 + #define REG_HDMI_PHY_QSERDES_COM_POST_DIV_MUX 0x00000030 971 + 972 + #define REG_HDMI_PHY_QSERDES_COM_BIAS_EN_CLKBUFLR_EN 0x00000034 973 + 974 + #define REG_HDMI_PHY_QSERDES_COM_CLK_ENABLE1 0x00000038 975 + 976 + #define REG_HDMI_PHY_QSERDES_COM_SYS_CLK_CTRL 0x0000003c 977 + 978 + #define REG_HDMI_PHY_QSERDES_COM_SYSCLK_BUF_ENABLE 0x00000040 979 + 980 + #define REG_HDMI_PHY_QSERDES_COM_PLL_EN 0x00000044 981 + 982 + #define REG_HDMI_PHY_QSERDES_COM_PLL_IVCO 0x00000048 983 + 984 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP1_MODE0 0x0000004c 985 + 986 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP2_MODE0 0x00000050 987 + 988 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP3_MODE0 0x00000054 989 + 990 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP1_MODE1 0x00000058 991 + 992 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP2_MODE1 0x0000005c 993 + 994 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP3_MODE1 0x00000060 995 + 996 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP1_MODE2 0x00000064 997 + 998 + #define REG_HDMI_PHY_QSERDES_COM_CMN_RSVD0 0x00000064 999 + 1000 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP2_MODE2 0x00000068 1001 + 1002 + #define REG_HDMI_PHY_QSERDES_COM_EP_CLOCK_DETECT_CTRL 0x00000068 1003 + 1004 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP3_MODE2 0x0000006c 1005 + 1006 + #define REG_HDMI_PHY_QSERDES_COM_SYSCLK_DET_COMP_STATUS 0x0000006c 1007 + 1008 + #define REG_HDMI_PHY_QSERDES_COM_BG_TRIM 0x00000070 1009 + 1010 + #define REG_HDMI_PHY_QSERDES_COM_CLK_EP_DIV 0x00000074 1011 + 1012 + #define REG_HDMI_PHY_QSERDES_COM_CP_CTRL_MODE0 0x00000078 1013 + 1014 + #define REG_HDMI_PHY_QSERDES_COM_CP_CTRL_MODE1 0x0000007c 1015 + 1016 + #define REG_HDMI_PHY_QSERDES_COM_CP_CTRL_MODE2 0x00000080 1017 + 1018 + #define REG_HDMI_PHY_QSERDES_COM_CMN_RSVD1 0x00000080 1019 + 1020 + #define REG_HDMI_PHY_QSERDES_COM_PLL_RCTRL_MODE0 0x00000084 1021 + 1022 + #define REG_HDMI_PHY_QSERDES_COM_PLL_RCTRL_MODE1 0x00000088 1023 + 1024 + #define REG_HDMI_PHY_QSERDES_COM_PLL_RCTRL_MODE2 0x0000008c 1025 + 1026 + #define REG_HDMI_PHY_QSERDES_COM_CMN_RSVD2 0x0000008c 1027 + 1028 + #define REG_HDMI_PHY_QSERDES_COM_PLL_CCTRL_MODE0 0x00000090 1029 + 1030 + #define REG_HDMI_PHY_QSERDES_COM_PLL_CCTRL_MODE1 0x00000094 1031 + 1032 + #define REG_HDMI_PHY_QSERDES_COM_PLL_CCTRL_MODE2 0x00000098 1033 + 1034 + #define REG_HDMI_PHY_QSERDES_COM_CMN_RSVD3 0x00000098 1035 + 1036 + #define REG_HDMI_PHY_QSERDES_COM_PLL_CNTRL 0x0000009c 1037 + 1038 + #define REG_HDMI_PHY_QSERDES_COM_PHASE_SEL_CTRL 0x000000a0 1039 + 1040 + #define REG_HDMI_PHY_QSERDES_COM_PHASE_SEL_DC 0x000000a4 1041 + 1042 + #define REG_HDMI_PHY_QSERDES_COM_CORE_CLK_IN_SYNC_SEL 0x000000a8 1043 + 1044 + #define REG_HDMI_PHY_QSERDES_COM_BIAS_EN_CTRL_BY_PSM 0x000000a8 1045 + 1046 + #define REG_HDMI_PHY_QSERDES_COM_SYSCLK_EN_SEL 0x000000ac 1047 + 1048 + #define REG_HDMI_PHY_QSERDES_COM_CML_SYSCLK_SEL 0x000000b0 1049 + 1050 + #define REG_HDMI_PHY_QSERDES_COM_RESETSM_CNTRL 0x000000b4 1051 + 1052 + #define REG_HDMI_PHY_QSERDES_COM_RESETSM_CNTRL2 0x000000b8 1053 + 1054 + #define REG_HDMI_PHY_QSERDES_COM_RESTRIM_CTRL 0x000000bc 1055 + 1056 + #define REG_HDMI_PHY_QSERDES_COM_RESTRIM_CTRL2 0x000000c0 1057 + 1058 + #define REG_HDMI_PHY_QSERDES_COM_RESCODE_DIV_NUM 0x000000c4 1059 + 1060 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP_EN 0x000000c8 1061 + 1062 + #define REG_HDMI_PHY_QSERDES_COM_LOCK_CMP_CFG 0x000000cc 1063 + 1064 + #define REG_HDMI_PHY_QSERDES_COM_DEC_START_MODE0 0x000000d0 1065 + 1066 + #define REG_HDMI_PHY_QSERDES_COM_DEC_START_MODE1 0x000000d4 1067 + 1068 + #define REG_HDMI_PHY_QSERDES_COM_DEC_START_MODE2 0x000000d8 1069 + 1070 + #define REG_HDMI_PHY_QSERDES_COM_VCOCAL_DEADMAN_CTRL 0x000000d8 1071 + 1072 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START1_MODE0 0x000000dc 1073 + 1074 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START2_MODE0 0x000000e0 1075 + 1076 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START3_MODE0 0x000000e4 1077 + 1078 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START1_MODE1 0x000000e8 1079 + 1080 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START2_MODE1 0x000000ec 1081 + 1082 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START3_MODE1 0x000000f0 1083 + 1084 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START1_MODE2 0x000000f4 1085 + 1086 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_MINVAL1 0x000000f4 1087 + 1088 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START2_MODE2 0x000000f8 1089 + 1090 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_MINVAL2 0x000000f8 1091 + 1092 + #define REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START3_MODE2 0x000000fc 1093 + 1094 + #define REG_HDMI_PHY_QSERDES_COM_CMN_RSVD4 0x000000fc 1095 + 1096 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_INITVAL 0x00000100 1097 + 1098 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_EN 0x00000104 1099 + 1100 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN0_MODE0 0x00000108 1101 + 1102 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN1_MODE0 0x0000010c 1103 + 1104 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN0_MODE1 0x00000110 1105 + 1106 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN1_MODE1 0x00000114 1107 + 1108 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN0_MODE2 0x00000118 1109 + 1110 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_MAXVAL1 0x00000118 1111 + 1112 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN1_MODE2 0x0000011c 1113 + 1114 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_MAXVAL2 0x0000011c 1115 + 1116 + #define REG_HDMI_PHY_QSERDES_COM_RES_TRIM_CONTROL2 0x00000120 1117 + 1118 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_CTRL 0x00000124 1119 + 1120 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_MAP 0x00000128 1121 + 1122 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE1_MODE0 0x0000012c 1123 + 1124 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE2_MODE0 0x00000130 1125 + 1126 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE1_MODE1 0x00000134 1127 + 1128 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE2_MODE1 0x00000138 1129 + 1130 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE1_MODE2 0x0000013c 1131 + 1132 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_INITVAL1 0x0000013c 1133 + 1134 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE2_MODE2 0x00000140 1135 + 1136 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_INITVAL2 0x00000140 1137 + 1138 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_TIMER1 0x00000144 1139 + 1140 + #define REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_TIMER2 0x00000148 1141 + 1142 + #define REG_HDMI_PHY_QSERDES_COM_SAR 0x0000014c 1143 + 1144 + #define REG_HDMI_PHY_QSERDES_COM_SAR_CLK 0x00000150 1145 + 1146 + #define REG_HDMI_PHY_QSERDES_COM_SAR_CODE_OUT_STATUS 0x00000154 1147 + 1148 + #define REG_HDMI_PHY_QSERDES_COM_SAR_CODE_READY_STATUS 0x00000158 1149 + 1150 + #define REG_HDMI_PHY_QSERDES_COM_CMN_STATUS 0x0000015c 1151 + 1152 + #define REG_HDMI_PHY_QSERDES_COM_RESET_SM_STATUS 0x00000160 1153 + 1154 + #define REG_HDMI_PHY_QSERDES_COM_RESTRIM_CODE_STATUS 0x00000164 1155 + 1156 + #define REG_HDMI_PHY_QSERDES_COM_PLLCAL_CODE1_STATUS 0x00000168 1157 + 1158 + #define REG_HDMI_PHY_QSERDES_COM_PLLCAL_CODE2_STATUS 0x0000016c 1159 + 1160 + #define REG_HDMI_PHY_QSERDES_COM_BG_CTRL 0x00000170 1161 + 1162 + #define REG_HDMI_PHY_QSERDES_COM_CLK_SELECT 0x00000174 1163 + 1164 + #define REG_HDMI_PHY_QSERDES_COM_HSCLK_SEL 0x00000178 1165 + 1166 + #define REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_BINCODE_STATUS 0x0000017c 1167 + 1168 + #define REG_HDMI_PHY_QSERDES_COM_PLL_ANALOG 0x00000180 1169 + 1170 + #define REG_HDMI_PHY_QSERDES_COM_CORECLK_DIV 0x00000184 1171 + 1172 + #define REG_HDMI_PHY_QSERDES_COM_SW_RESET 0x00000188 1173 + 1174 + #define REG_HDMI_PHY_QSERDES_COM_CORE_CLK_EN 0x0000018c 1175 + 1176 + #define REG_HDMI_PHY_QSERDES_COM_C_READY_STATUS 0x00000190 1177 + 1178 + #define REG_HDMI_PHY_QSERDES_COM_CMN_CONFIG 0x00000194 1179 + 1180 + #define REG_HDMI_PHY_QSERDES_COM_CMN_RATE_OVERRIDE 0x00000198 1181 + 1182 + #define REG_HDMI_PHY_QSERDES_COM_SVS_MODE_CLK_SEL 0x0000019c 1183 + 1184 + #define REG_HDMI_PHY_QSERDES_COM_DEBUG_BUS0 0x000001a0 1185 + 1186 + #define REG_HDMI_PHY_QSERDES_COM_DEBUG_BUS1 0x000001a4 1187 + 1188 + #define REG_HDMI_PHY_QSERDES_COM_DEBUG_BUS2 0x000001a8 1189 + 1190 + #define REG_HDMI_PHY_QSERDES_COM_DEBUG_BUS3 0x000001ac 1191 + 1192 + #define REG_HDMI_PHY_QSERDES_COM_DEBUG_BUS_SEL 0x000001b0 1193 + 1194 + #define REG_HDMI_PHY_QSERDES_COM_CMN_MISC1 0x000001b4 1195 + 1196 + #define REG_HDMI_PHY_QSERDES_COM_CMN_MISC2 0x000001b8 1197 + 1198 + #define REG_HDMI_PHY_QSERDES_COM_CORECLK_DIV_MODE1 0x000001bc 1199 + 1200 + #define REG_HDMI_PHY_QSERDES_COM_CORECLK_DIV_MODE2 0x000001c0 1201 + 1202 + #define REG_HDMI_PHY_QSERDES_COM_CMN_RSVD5 0x000001c4 1203 + 1204 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_MODE_LANENO 0x00000000 1205 + 1206 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_INVERT 0x00000004 1207 + 1208 + #define REG_HDMI_PHY_QSERDES_TX_LX_CLKBUF_ENABLE 0x00000008 1209 + 1210 + #define REG_HDMI_PHY_QSERDES_TX_LX_CMN_CONTROL_ONE 0x0000000c 1211 + 1212 + #define REG_HDMI_PHY_QSERDES_TX_LX_CMN_CONTROL_TWO 0x00000010 1213 + 1214 + #define REG_HDMI_PHY_QSERDES_TX_LX_CMN_CONTROL_THREE 0x00000014 1215 + 1216 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_EMP_POST1_LVL 0x00000018 1217 + 1218 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_POST2_EMPH 0x0000001c 1219 + 1220 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_BOOST_LVL_UP_DN 0x00000020 1221 + 1222 + #define REG_HDMI_PHY_QSERDES_TX_LX_HP_PD_ENABLES 0x00000024 1223 + 1224 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_IDLE_LVL_LARGE_AMP 0x00000028 1225 + 1226 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_DRV_LVL 0x0000002c 1227 + 1228 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_DRV_LVL_OFFSET 0x00000030 1229 + 1230 + #define REG_HDMI_PHY_QSERDES_TX_LX_RESET_TSYNC_EN 0x00000034 1231 + 1232 + #define REG_HDMI_PHY_QSERDES_TX_LX_PRE_STALL_LDO_BOOST_EN 0x00000038 1233 + 1234 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_BAND 0x0000003c 1235 + 1236 + #define REG_HDMI_PHY_QSERDES_TX_LX_SLEW_CNTL 0x00000040 1237 + 1238 + #define REG_HDMI_PHY_QSERDES_TX_LX_INTERFACE_SELECT 0x00000044 1239 + 1240 + #define REG_HDMI_PHY_QSERDES_TX_LX_LPB_EN 0x00000048 1241 + 1242 + #define REG_HDMI_PHY_QSERDES_TX_LX_RES_CODE_LANE_TX 0x0000004c 1243 + 1244 + #define REG_HDMI_PHY_QSERDES_TX_LX_RES_CODE_LANE_RX 0x00000050 1245 + 1246 + #define REG_HDMI_PHY_QSERDES_TX_LX_RES_CODE_LANE_OFFSET 0x00000054 1247 + 1248 + #define REG_HDMI_PHY_QSERDES_TX_LX_PERL_LENGTH1 0x00000058 1249 + 1250 + #define REG_HDMI_PHY_QSERDES_TX_LX_PERL_LENGTH2 0x0000005c 1251 + 1252 + #define REG_HDMI_PHY_QSERDES_TX_LX_SERDES_BYP_EN_OUT 0x00000060 1253 + 1254 + #define REG_HDMI_PHY_QSERDES_TX_LX_DEBUG_BUS_SEL 0x00000064 1255 + 1256 + #define REG_HDMI_PHY_QSERDES_TX_LX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN 0x00000068 1257 + 1258 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_POL_INV 0x0000006c 1259 + 1260 + #define REG_HDMI_PHY_QSERDES_TX_LX_PARRATE_REC_DETECT_IDLE_EN 0x00000070 1261 + 1262 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN1 0x00000074 1263 + 1264 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN2 0x00000078 1265 + 1266 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN3 0x0000007c 1267 + 1268 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN4 0x00000080 1269 + 1270 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN5 0x00000084 1271 + 1272 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN6 0x00000088 1273 + 1274 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN7 0x0000008c 1275 + 1276 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_PATTERN8 0x00000090 1277 + 1278 + #define REG_HDMI_PHY_QSERDES_TX_LX_LANE_MODE 0x00000094 1279 + 1280 + #define REG_HDMI_PHY_QSERDES_TX_LX_IDAC_CAL_LANE_MODE 0x00000098 1281 + 1282 + #define REG_HDMI_PHY_QSERDES_TX_LX_IDAC_CAL_LANE_MODE_CONFIGURATION 0x0000009c 1283 + 1284 + #define REG_HDMI_PHY_QSERDES_TX_LX_ATB_SEL1 0x000000a0 1285 + 1286 + #define REG_HDMI_PHY_QSERDES_TX_LX_ATB_SEL2 0x000000a4 1287 + 1288 + #define REG_HDMI_PHY_QSERDES_TX_LX_RCV_DETECT_LVL 0x000000a8 1289 + 1290 + #define REG_HDMI_PHY_QSERDES_TX_LX_RCV_DETECT_LVL_2 0x000000ac 1291 + 1292 + #define REG_HDMI_PHY_QSERDES_TX_LX_PRBS_SEED1 0x000000b0 1293 + 1294 + #define REG_HDMI_PHY_QSERDES_TX_LX_PRBS_SEED2 0x000000b4 1295 + 1296 + #define REG_HDMI_PHY_QSERDES_TX_LX_PRBS_SEED3 0x000000b8 1297 + 1298 + #define REG_HDMI_PHY_QSERDES_TX_LX_PRBS_SEED4 0x000000bc 1299 + 1300 + #define REG_HDMI_PHY_QSERDES_TX_LX_RESET_GEN 0x000000c0 1301 + 1302 + #define REG_HDMI_PHY_QSERDES_TX_LX_RESET_GEN_MUXES 0x000000c4 1303 + 1304 + #define REG_HDMI_PHY_QSERDES_TX_LX_TRAN_DRVR_EMP_EN 0x000000c8 1305 + 1306 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_INTERFACE_MODE 0x000000cc 1307 + 1308 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_CTRL 0x000000d0 1309 + 1310 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_ENCODED_OR_DATA 0x000000d4 1311 + 1312 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_1_DIVIDER_BAND2 0x000000d8 1313 + 1314 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_2_DIVIDER_BAND2 0x000000dc 1315 + 1316 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_3_DIVIDER_BAND2 0x000000e0 1317 + 1318 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_4_DIVIDER_BAND2 0x000000e4 1319 + 1320 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_1_DIVIDER_BAND0_1 0x000000e8 1321 + 1322 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_2_DIVIDER_BAND0_1 0x000000ec 1323 + 1324 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_3_DIVIDER_BAND0_1 0x000000f0 1325 + 1326 + #define REG_HDMI_PHY_QSERDES_TX_LX_PWM_GEAR_4_DIVIDER_BAND0_1 0x000000f4 1327 + 1328 + #define REG_HDMI_PHY_QSERDES_TX_LX_VMODE_CTRL1 0x000000f8 1329 + 1330 + #define REG_HDMI_PHY_QSERDES_TX_LX_VMODE_CTRL2 0x000000fc 1331 + 1332 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_ALOG_INTF_OBSV_CNTL 0x00000100 1333 + 1334 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_STATUS 0x00000104 1335 + 1336 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_ERROR_COUNT1 0x00000108 1337 + 1338 + #define REG_HDMI_PHY_QSERDES_TX_LX_BIST_ERROR_COUNT2 0x0000010c 1339 + 1340 + #define REG_HDMI_PHY_QSERDES_TX_LX_TX_ALOG_INTF_OBSV 0x00000110 846 1341 847 1342 848 1343 #endif /* HDMI_XML */
+5 -5
drivers/gpu/drm/msm/hdmi/hdmi_audio.c
··· 89 89 return NULL; 90 90 } 91 91 92 - int hdmi_audio_update(struct hdmi *hdmi) 92 + int msm_hdmi_audio_update(struct hdmi *hdmi) 93 93 { 94 94 struct hdmi_audio *audio = &hdmi->audio; 95 95 struct hdmi_audio_infoframe *info = &audio->infoframe; ··· 232 232 return 0; 233 233 } 234 234 235 - int hdmi_audio_info_setup(struct hdmi *hdmi, bool enabled, 235 + int msm_hdmi_audio_info_setup(struct hdmi *hdmi, bool enabled, 236 236 uint32_t num_of_channels, uint32_t channel_allocation, 237 237 uint32_t level_shift, bool down_mix) 238 238 { ··· 252 252 audio->infoframe.level_shift_value = level_shift; 253 253 audio->infoframe.downmix_inhibit = down_mix; 254 254 255 - return hdmi_audio_update(hdmi); 255 + return msm_hdmi_audio_update(hdmi); 256 256 } 257 257 258 - void hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate) 258 + void msm_hdmi_audio_set_sample_rate(struct hdmi *hdmi, int rate) 259 259 { 260 260 struct hdmi_audio *audio; 261 261 ··· 268 268 return; 269 269 270 270 audio->rate = rate; 271 - hdmi_audio_update(hdmi); 271 + msm_hdmi_audio_update(hdmi); 272 272 }
+28 -28
drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
··· 23 23 }; 24 24 #define to_hdmi_bridge(x) container_of(x, struct hdmi_bridge, base) 25 25 26 - void hdmi_bridge_destroy(struct drm_bridge *bridge) 26 + void msm_hdmi_bridge_destroy(struct drm_bridge *bridge) 27 27 { 28 28 } 29 29 30 - static void power_on(struct drm_bridge *bridge) 30 + static void msm_hdmi_power_on(struct drm_bridge *bridge) 31 31 { 32 32 struct drm_device *dev = bridge->dev; 33 33 struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); ··· 86 86 } 87 87 } 88 88 89 - static void hdmi_bridge_pre_enable(struct drm_bridge *bridge) 89 + static void msm_hdmi_bridge_pre_enable(struct drm_bridge *bridge) 90 90 { 91 91 struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); 92 92 struct hdmi *hdmi = hdmi_bridge->hdmi; ··· 95 95 DBG("power up"); 96 96 97 97 if (!hdmi->power_on) { 98 - power_on(bridge); 98 + msm_hdmi_phy_resource_enable(phy); 99 + msm_hdmi_power_on(bridge); 99 100 hdmi->power_on = true; 100 - hdmi_audio_update(hdmi); 101 + msm_hdmi_audio_update(hdmi); 101 102 } 102 103 103 - if (phy) 104 - phy->funcs->powerup(phy, hdmi->pixclock); 104 + msm_hdmi_phy_powerup(phy, hdmi->pixclock); 105 105 106 - hdmi_set_mode(hdmi, true); 106 + msm_hdmi_set_mode(hdmi, true); 107 107 108 108 if (hdmi->hdcp_ctrl) 109 - hdmi_hdcp_on(hdmi->hdcp_ctrl); 109 + msm_hdmi_hdcp_on(hdmi->hdcp_ctrl); 110 110 } 111 111 112 - static void hdmi_bridge_enable(struct drm_bridge *bridge) 112 + static void msm_hdmi_bridge_enable(struct drm_bridge *bridge) 113 113 { 114 114 } 115 115 116 - static void hdmi_bridge_disable(struct drm_bridge *bridge) 116 + static void msm_hdmi_bridge_disable(struct drm_bridge *bridge) 117 117 { 118 118 } 119 119 120 - static void hdmi_bridge_post_disable(struct drm_bridge *bridge) 120 + static void msm_hdmi_bridge_post_disable(struct drm_bridge *bridge) 121 121 { 122 122 struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); 123 123 struct hdmi *hdmi = hdmi_bridge->hdmi; 124 124 struct hdmi_phy *phy = hdmi->phy; 125 125 126 126 if (hdmi->hdcp_ctrl) 127 - hdmi_hdcp_off(hdmi->hdcp_ctrl); 127 + msm_hdmi_hdcp_off(hdmi->hdcp_ctrl); 128 128 129 129 DBG("power down"); 130 - hdmi_set_mode(hdmi, false); 130 + msm_hdmi_set_mode(hdmi, false); 131 131 132 - if (phy) 133 - phy->funcs->powerdown(phy); 132 + msm_hdmi_phy_powerdown(phy); 134 133 135 134 if (hdmi->power_on) { 136 135 power_off(bridge); 137 136 hdmi->power_on = false; 138 - hdmi_audio_update(hdmi); 137 + msm_hdmi_audio_update(hdmi); 138 + msm_hdmi_phy_resource_disable(phy); 139 139 } 140 140 } 141 141 142 - static void hdmi_bridge_mode_set(struct drm_bridge *bridge, 142 + static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge, 143 143 struct drm_display_mode *mode, 144 144 struct drm_display_mode *adjusted_mode) 145 145 { ··· 196 196 DBG("frame_ctrl=%08x", frame_ctrl); 197 197 hdmi_write(hdmi, REG_HDMI_FRAME_CTRL, frame_ctrl); 198 198 199 - hdmi_audio_update(hdmi); 199 + msm_hdmi_audio_update(hdmi); 200 200 } 201 201 202 - static const struct drm_bridge_funcs hdmi_bridge_funcs = { 203 - .pre_enable = hdmi_bridge_pre_enable, 204 - .enable = hdmi_bridge_enable, 205 - .disable = hdmi_bridge_disable, 206 - .post_disable = hdmi_bridge_post_disable, 207 - .mode_set = hdmi_bridge_mode_set, 202 + static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { 203 + .pre_enable = msm_hdmi_bridge_pre_enable, 204 + .enable = msm_hdmi_bridge_enable, 205 + .disable = msm_hdmi_bridge_disable, 206 + .post_disable = msm_hdmi_bridge_post_disable, 207 + .mode_set = msm_hdmi_bridge_mode_set, 208 208 }; 209 209 210 210 211 211 /* initialize bridge */ 212 - struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi) 212 + struct drm_bridge *msm_hdmi_bridge_init(struct hdmi *hdmi) 213 213 { 214 214 struct drm_bridge *bridge = NULL; 215 215 struct hdmi_bridge *hdmi_bridge; ··· 225 225 hdmi_bridge->hdmi = hdmi; 226 226 227 227 bridge = &hdmi_bridge->base; 228 - bridge->funcs = &hdmi_bridge_funcs; 228 + bridge->funcs = &msm_hdmi_bridge_funcs; 229 229 230 230 ret = drm_bridge_attach(hdmi->dev, bridge); 231 231 if (ret) ··· 235 235 236 236 fail: 237 237 if (bridge) 238 - hdmi_bridge_destroy(bridge); 238 + msm_hdmi_bridge_destroy(bridge); 239 239 240 240 return ERR_PTR(ret); 241 241 }
+62 -110
drivers/gpu/drm/msm/hdmi/hdmi_connector.c
··· 28 28 }; 29 29 #define to_hdmi_connector(x) container_of(x, struct hdmi_connector, base) 30 30 31 - static void hdmi_phy_reset(struct hdmi *hdmi) 31 + static void msm_hdmi_phy_reset(struct hdmi *hdmi) 32 32 { 33 33 unsigned int val; 34 34 ··· 81 81 { 82 82 struct device *dev = &hdmi->pdev->dev; 83 83 const struct hdmi_platform_config *config = hdmi->config; 84 - int ret; 84 + int ret, i; 85 85 86 86 if (on) { 87 - if (config->ddc_clk_gpio != -1) { 88 - ret = gpio_request(config->ddc_clk_gpio, "HDMI_DDC_CLK"); 89 - if (ret) { 90 - dev_err(dev, "'%s'(%d) gpio_request failed: %d\n", 91 - "HDMI_DDC_CLK", config->ddc_clk_gpio, ret); 92 - goto error1; 87 + for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) { 88 + struct hdmi_gpio_data gpio = config->gpios[i]; 89 + 90 + if (gpio.num != -1) { 91 + ret = gpio_request(gpio.num, gpio.label); 92 + if (ret) { 93 + dev_err(dev, 94 + "'%s'(%d) gpio_request failed: %d\n", 95 + gpio.label, gpio.num, ret); 96 + goto err; 97 + } 98 + 99 + if (gpio.output) { 100 + gpio_direction_output(gpio.num, 101 + gpio.value); 102 + } else { 103 + gpio_direction_input(gpio.num); 104 + gpio_set_value_cansleep(gpio.num, 105 + gpio.value); 106 + } 93 107 } 94 - gpio_set_value_cansleep(config->ddc_clk_gpio, 1); 95 108 } 96 109 97 - if (config->ddc_data_gpio != -1) { 98 - ret = gpio_request(config->ddc_data_gpio, "HDMI_DDC_DATA"); 99 - if (ret) { 100 - dev_err(dev, "'%s'(%d) gpio_request failed: %d\n", 101 - "HDMI_DDC_DATA", config->ddc_data_gpio, ret); 102 - goto error2; 103 - } 104 - gpio_set_value_cansleep(config->ddc_data_gpio, 1); 105 - } 106 - 107 - ret = gpio_request(config->hpd_gpio, "HDMI_HPD"); 108 - if (ret) { 109 - dev_err(dev, "'%s'(%d) gpio_request failed: %d\n", 110 - "HDMI_HPD", config->hpd_gpio, ret); 111 - goto error3; 112 - } 113 - gpio_direction_input(config->hpd_gpio); 114 - gpio_set_value_cansleep(config->hpd_gpio, 1); 115 - 116 - if (config->mux_en_gpio != -1) { 117 - ret = gpio_request(config->mux_en_gpio, "HDMI_MUX_EN"); 118 - if (ret) { 119 - dev_err(dev, "'%s'(%d) gpio_request failed: %d\n", 120 - "HDMI_MUX_EN", config->mux_en_gpio, ret); 121 - goto error4; 122 - } 123 - gpio_set_value_cansleep(config->mux_en_gpio, 1); 124 - } 125 - 126 - if (config->mux_sel_gpio != -1) { 127 - ret = gpio_request(config->mux_sel_gpio, "HDMI_MUX_SEL"); 128 - if (ret) { 129 - dev_err(dev, "'%s'(%d) gpio_request failed: %d\n", 130 - "HDMI_MUX_SEL", config->mux_sel_gpio, ret); 131 - goto error5; 132 - } 133 - gpio_set_value_cansleep(config->mux_sel_gpio, 0); 134 - } 135 - 136 - if (config->mux_lpm_gpio != -1) { 137 - ret = gpio_request(config->mux_lpm_gpio, 138 - "HDMI_MUX_LPM"); 139 - if (ret) { 140 - dev_err(dev, 141 - "'%s'(%d) gpio_request failed: %d\n", 142 - "HDMI_MUX_LPM", 143 - config->mux_lpm_gpio, ret); 144 - goto error6; 145 - } 146 - gpio_set_value_cansleep(config->mux_lpm_gpio, 1); 147 - } 148 110 DBG("gpio on"); 149 111 } else { 150 - if (config->ddc_clk_gpio != -1) 151 - gpio_free(config->ddc_clk_gpio); 112 + for (i = 0; i < HDMI_MAX_NUM_GPIO; i++) { 113 + struct hdmi_gpio_data gpio = config->gpios[i]; 152 114 153 - if (config->ddc_data_gpio != -1) 154 - gpio_free(config->ddc_data_gpio); 115 + if (gpio.output) { 116 + int value = gpio.value ? 0 : 1; 155 117 156 - gpio_free(config->hpd_gpio); 118 + gpio_set_value_cansleep(gpio.num, value); 119 + } 157 120 158 - if (config->mux_en_gpio != -1) { 159 - gpio_set_value_cansleep(config->mux_en_gpio, 0); 160 - gpio_free(config->mux_en_gpio); 161 - } 121 + gpio_free(gpio.num); 122 + }; 162 123 163 - if (config->mux_sel_gpio != -1) { 164 - gpio_set_value_cansleep(config->mux_sel_gpio, 1); 165 - gpio_free(config->mux_sel_gpio); 166 - } 167 - 168 - if (config->mux_lpm_gpio != -1) { 169 - gpio_set_value_cansleep(config->mux_lpm_gpio, 0); 170 - gpio_free(config->mux_lpm_gpio); 171 - } 172 124 DBG("gpio off"); 173 125 } 174 126 175 127 return 0; 128 + err: 129 + while (i--) 130 + gpio_free(config->gpios[i].num); 176 131 177 - error6: 178 - if (config->mux_sel_gpio != -1) 179 - gpio_free(config->mux_sel_gpio); 180 - error5: 181 - if (config->mux_en_gpio != -1) 182 - gpio_free(config->mux_en_gpio); 183 - error4: 184 - gpio_free(config->hpd_gpio); 185 - error3: 186 - if (config->ddc_data_gpio != -1) 187 - gpio_free(config->ddc_data_gpio); 188 - error2: 189 - if (config->ddc_clk_gpio != -1) 190 - gpio_free(config->ddc_clk_gpio); 191 - error1: 192 132 return ret; 193 133 } 194 134 ··· 179 239 } 180 240 } 181 241 182 - hdmi_set_mode(hdmi, false); 183 - hdmi_phy_reset(hdmi); 184 - hdmi_set_mode(hdmi, true); 242 + msm_hdmi_set_mode(hdmi, false); 243 + msm_hdmi_phy_reset(hdmi); 244 + msm_hdmi_set_mode(hdmi, true); 185 245 186 246 hdmi_write(hdmi, REG_HDMI_USEC_REFTIMER, 0x0001001b); 187 247 ··· 218 278 /* Disable HPD interrupt */ 219 279 hdmi_write(hdmi, REG_HDMI_HPD_INT_CTRL, 0); 220 280 221 - hdmi_set_mode(hdmi, false); 281 + msm_hdmi_set_mode(hdmi, false); 222 282 223 283 for (i = 0; i < config->hpd_clk_cnt; i++) 224 284 clk_disable_unprepare(hdmi->hpd_clks[i]); ··· 240 300 } 241 301 242 302 static void 243 - hotplug_work(struct work_struct *work) 303 + msm_hdmi_hotplug_work(struct work_struct *work) 244 304 { 245 305 struct hdmi_connector *hdmi_connector = 246 306 container_of(work, struct hdmi_connector, hpd_work); ··· 248 308 drm_helper_hpd_irq_event(connector->dev); 249 309 } 250 310 251 - void hdmi_connector_irq(struct drm_connector *connector) 311 + void msm_hdmi_connector_irq(struct drm_connector *connector) 252 312 { 253 313 struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); 254 314 struct hdmi *hdmi = hdmi_connector->hdmi; ··· 285 345 connector_status_connected : connector_status_disconnected; 286 346 } 287 347 348 + #define HPD_GPIO_INDEX 2 288 349 static enum drm_connector_status detect_gpio(struct hdmi *hdmi) 289 350 { 290 351 const struct hdmi_platform_config *config = hdmi->config; 291 - return gpio_get_value(config->hpd_gpio) ? 352 + struct hdmi_gpio_data hpd_gpio = config->gpios[HPD_GPIO_INDEX]; 353 + 354 + return gpio_get_value(hpd_gpio.num) ? 292 355 connector_status_connected : 293 356 connector_status_disconnected; 294 357 } ··· 301 358 { 302 359 struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); 303 360 struct hdmi *hdmi = hdmi_connector->hdmi; 361 + const struct hdmi_platform_config *config = hdmi->config; 362 + struct hdmi_gpio_data hpd_gpio = config->gpios[HPD_GPIO_INDEX]; 304 363 enum drm_connector_status stat_gpio, stat_reg; 305 364 int retry = 20; 365 + 366 + /* 367 + * some platforms may not have hpd gpio. Rely only on the status 368 + * provided by REG_HDMI_HPD_INT_STATUS in this case. 369 + */ 370 + if (hpd_gpio.num == -1) 371 + return detect_reg(hdmi); 306 372 307 373 do { 308 374 stat_gpio = detect_gpio(hdmi); ··· 347 395 kfree(hdmi_connector); 348 396 } 349 397 350 - static int hdmi_connector_get_modes(struct drm_connector *connector) 398 + static int msm_hdmi_connector_get_modes(struct drm_connector *connector) 351 399 { 352 400 struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); 353 401 struct hdmi *hdmi = hdmi_connector->hdmi; ··· 373 421 return ret; 374 422 } 375 423 376 - static int hdmi_connector_mode_valid(struct drm_connector *connector, 424 + static int msm_hdmi_connector_mode_valid(struct drm_connector *connector, 377 425 struct drm_display_mode *mode) 378 426 { 379 427 struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); ··· 403 451 } 404 452 405 453 static struct drm_encoder * 406 - hdmi_connector_best_encoder(struct drm_connector *connector) 454 + msm_hdmi_connector_best_encoder(struct drm_connector *connector) 407 455 { 408 456 struct hdmi_connector *hdmi_connector = to_hdmi_connector(connector); 409 457 return hdmi_connector->hdmi->encoder; ··· 419 467 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 420 468 }; 421 469 422 - static const struct drm_connector_helper_funcs hdmi_connector_helper_funcs = { 423 - .get_modes = hdmi_connector_get_modes, 424 - .mode_valid = hdmi_connector_mode_valid, 425 - .best_encoder = hdmi_connector_best_encoder, 470 + static const struct drm_connector_helper_funcs msm_hdmi_connector_helper_funcs = { 471 + .get_modes = msm_hdmi_connector_get_modes, 472 + .mode_valid = msm_hdmi_connector_mode_valid, 473 + .best_encoder = msm_hdmi_connector_best_encoder, 426 474 }; 427 475 428 476 /* initialize connector */ 429 - struct drm_connector *hdmi_connector_init(struct hdmi *hdmi) 477 + struct drm_connector *msm_hdmi_connector_init(struct hdmi *hdmi) 430 478 { 431 479 struct drm_connector *connector = NULL; 432 480 struct hdmi_connector *hdmi_connector; ··· 439 487 } 440 488 441 489 hdmi_connector->hdmi = hdmi; 442 - INIT_WORK(&hdmi_connector->hpd_work, hotplug_work); 490 + INIT_WORK(&hdmi_connector->hpd_work, msm_hdmi_hotplug_work); 443 491 444 492 connector = &hdmi_connector->base; 445 493 446 494 drm_connector_init(hdmi->dev, connector, &hdmi_connector_funcs, 447 495 DRM_MODE_CONNECTOR_HDMIA); 448 - drm_connector_helper_add(connector, &hdmi_connector_helper_funcs); 496 + drm_connector_helper_add(connector, &msm_hdmi_connector_helper_funcs); 449 497 450 498 connector->polled = DRM_CONNECTOR_POLL_CONNECT | 451 499 DRM_CONNECTOR_POLL_DISCONNECT;
+83 -83
drivers/gpu/drm/msm/hdmi/hdmi_hdcp.c
··· 84 84 bool max_dev_exceeded; 85 85 }; 86 86 87 - static int hdmi_ddc_read(struct hdmi *hdmi, u16 addr, u8 offset, 87 + static int msm_hdmi_ddc_read(struct hdmi *hdmi, u16 addr, u8 offset, 88 88 u8 *data, u16 data_len) 89 89 { 90 90 int rc; ··· 122 122 123 123 #define HDCP_DDC_WRITE_MAX_BYTE_NUM 32 124 124 125 - static int hdmi_ddc_write(struct hdmi *hdmi, u16 addr, u8 offset, 125 + static int msm_hdmi_ddc_write(struct hdmi *hdmi, u16 addr, u8 offset, 126 126 u8 *data, u16 data_len) 127 127 { 128 128 int rc; ··· 162 162 return rc; 163 163 } 164 164 165 - static int hdmi_hdcp_scm_wr(struct hdmi_hdcp_ctrl *hdcp_ctrl, u32 *preg, 165 + static int msm_hdmi_hdcp_scm_wr(struct hdmi_hdcp_ctrl *hdcp_ctrl, u32 *preg, 166 166 u32 *pdata, u32 count) 167 167 { 168 168 struct hdmi *hdmi = hdcp_ctrl->hdmi; ··· 202 202 return ret; 203 203 } 204 204 205 - void hdmi_hdcp_irq(struct hdmi_hdcp_ctrl *hdcp_ctrl) 205 + void msm_hdmi_hdcp_irq(struct hdmi_hdcp_ctrl *hdcp_ctrl) 206 206 { 207 207 struct hdmi *hdmi = hdcp_ctrl->hdmi; 208 208 u32 reg_val, hdcp_int_status; ··· 247 247 } 248 248 } 249 249 250 - static int hdmi_hdcp_msleep(struct hdmi_hdcp_ctrl *hdcp_ctrl, u32 ms, u32 ev) 250 + static int msm_hdmi_hdcp_msleep(struct hdmi_hdcp_ctrl *hdcp_ctrl, u32 ms, u32 ev) 251 251 { 252 252 int rc; 253 253 ··· 264 264 return 0; 265 265 } 266 266 267 - static int hdmi_hdcp_read_validate_aksv(struct hdmi_hdcp_ctrl *hdcp_ctrl) 267 + static int msm_hdmi_hdcp_read_validate_aksv(struct hdmi_hdcp_ctrl *hdcp_ctrl) 268 268 { 269 269 struct hdmi *hdmi = hdcp_ctrl->hdmi; 270 270 ··· 287 287 return 0; 288 288 } 289 289 290 - static int reset_hdcp_ddc_failures(struct hdmi_hdcp_ctrl *hdcp_ctrl) 290 + static int msm_reset_hdcp_ddc_failures(struct hdmi_hdcp_ctrl *hdcp_ctrl) 291 291 { 292 292 struct hdmi *hdmi = hdcp_ctrl->hdmi; 293 293 u32 reg_val, failure, nack0; ··· 337 337 reg_val |= HDMI_DDC_CTRL_SW_STATUS_RESET; 338 338 hdmi_write(hdmi, REG_HDMI_DDC_CTRL, reg_val); 339 339 340 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 340 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 341 341 342 342 reg_val = hdmi_read(hdmi, REG_HDMI_DDC_CTRL); 343 343 reg_val &= ~HDMI_DDC_CTRL_SW_STATUS_RESET; ··· 350 350 351 351 /* If previous msleep is aborted, skip this msleep */ 352 352 if (!rc) 353 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 353 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 354 354 355 355 reg_val = hdmi_read(hdmi, REG_HDMI_DDC_CTRL); 356 356 reg_val &= ~HDMI_DDC_CTRL_SOFT_RESET; ··· 362 362 return rc; 363 363 } 364 364 365 - static int hdmi_hdcp_hw_ddc_clean(struct hdmi_hdcp_ctrl *hdcp_ctrl) 365 + static int msm_hdmi_hdcp_hw_ddc_clean(struct hdmi_hdcp_ctrl *hdcp_ctrl) 366 366 { 367 367 int rc; 368 368 u32 hdcp_ddc_status, ddc_hw_status; ··· 394 394 return -ETIMEDOUT; 395 395 } 396 396 397 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 397 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 398 398 if (rc) 399 399 return rc; 400 400 } while (1); ··· 402 402 return 0; 403 403 } 404 404 405 - static void hdmi_hdcp_reauth_work(struct work_struct *work) 405 + static void msm_hdmi_hdcp_reauth_work(struct work_struct *work) 406 406 { 407 407 struct hdmi_hdcp_ctrl *hdcp_ctrl = container_of(work, 408 408 struct hdmi_hdcp_ctrl, hdcp_reauth_work); ··· 430 430 HDMI_HDCP_RESET_LINK0_DEAUTHENTICATE); 431 431 432 432 /* Wait to be clean on DDC HW engine */ 433 - if (hdmi_hdcp_hw_ddc_clean(hdcp_ctrl)) { 433 + if (msm_hdmi_hdcp_hw_ddc_clean(hdcp_ctrl)) { 434 434 pr_info("%s: reauth work aborted\n", __func__); 435 435 return; 436 436 } ··· 461 461 queue_work(hdmi->workq, &hdcp_ctrl->hdcp_auth_work); 462 462 } 463 463 464 - static int hdmi_hdcp_auth_prepare(struct hdmi_hdcp_ctrl *hdcp_ctrl) 464 + static int msm_hdmi_hdcp_auth_prepare(struct hdmi_hdcp_ctrl *hdcp_ctrl) 465 465 { 466 466 struct hdmi *hdmi = hdcp_ctrl->hdmi; 467 467 u32 link0_status; ··· 470 470 int rc; 471 471 472 472 if (!hdcp_ctrl->aksv_valid) { 473 - rc = hdmi_hdcp_read_validate_aksv(hdcp_ctrl); 473 + rc = msm_hdmi_hdcp_read_validate_aksv(hdcp_ctrl); 474 474 if (rc) { 475 475 pr_err("%s: ASKV validation failed\n", __func__); 476 476 hdcp_ctrl->hdcp_state = HDCP_STATE_NO_AKSV; ··· 538 538 DBG("An not ready after enabling HDCP"); 539 539 540 540 /* Clear any DDC failures from previous tries before enable HDCP*/ 541 - rc = reset_hdcp_ddc_failures(hdcp_ctrl); 541 + rc = msm_reset_hdcp_ddc_failures(hdcp_ctrl); 542 542 543 543 return rc; 544 544 } 545 545 546 - static void hdmi_hdcp_auth_fail(struct hdmi_hdcp_ctrl *hdcp_ctrl) 546 + static void msm_hdmi_hdcp_auth_fail(struct hdmi_hdcp_ctrl *hdcp_ctrl) 547 547 { 548 548 struct hdmi *hdmi = hdcp_ctrl->hdmi; 549 549 u32 reg_val; ··· 561 561 queue_work(hdmi->workq, &hdcp_ctrl->hdcp_reauth_work); 562 562 } 563 563 564 - static void hdmi_hdcp_auth_done(struct hdmi_hdcp_ctrl *hdcp_ctrl) 564 + static void msm_hdmi_hdcp_auth_done(struct hdmi_hdcp_ctrl *hdcp_ctrl) 565 565 { 566 566 struct hdmi *hdmi = hdcp_ctrl->hdmi; 567 567 u32 reg_val; ··· 596 596 * Write An and AKSV to sink 597 597 * Read BKSV from sink and write into HDCP engine 598 598 */ 599 - static int hdmi_hdcp_wait_key_an_ready(struct hdmi_hdcp_ctrl *hdcp_ctrl) 599 + static int msm_hdmi_hdcp_wait_key_an_ready(struct hdmi_hdcp_ctrl *hdcp_ctrl) 600 600 { 601 601 int rc; 602 602 struct hdmi *hdmi = hdcp_ctrl->hdmi; ··· 621 621 return -ETIMEDOUT; 622 622 } 623 623 624 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 624 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 625 625 if (rc) 626 626 return rc; 627 627 } while (1); ··· 643 643 return -ETIMEDOUT; 644 644 } 645 645 646 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 646 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 647 647 if (rc) 648 648 return rc; 649 649 } while (1); ··· 651 651 return 0; 652 652 } 653 653 654 - static int hdmi_hdcp_send_aksv_an(struct hdmi_hdcp_ctrl *hdcp_ctrl) 654 + static int msm_hdmi_hdcp_send_aksv_an(struct hdmi_hdcp_ctrl *hdcp_ctrl) 655 655 { 656 656 int rc = 0; 657 657 struct hdmi *hdmi = hdcp_ctrl->hdmi; ··· 676 676 aksv[4] = link0_aksv_1 & 0xFF; 677 677 678 678 /* Write An to offset 0x18 */ 679 - rc = hdmi_ddc_write(hdmi, HDCP_PORT_ADDR, 0x18, (u8 *)link0_an, 679 + rc = msm_hdmi_ddc_write(hdmi, HDCP_PORT_ADDR, 0x18, (u8 *)link0_an, 680 680 (u16)sizeof(link0_an)); 681 681 if (rc) { 682 682 pr_err("%s:An write failed\n", __func__); ··· 685 685 DBG("Link0-An=%08x%08x", link0_an[0], link0_an[1]); 686 686 687 687 /* Write AKSV to offset 0x10 */ 688 - rc = hdmi_ddc_write(hdmi, HDCP_PORT_ADDR, 0x10, aksv, 5); 688 + rc = msm_hdmi_ddc_write(hdmi, HDCP_PORT_ADDR, 0x10, aksv, 5); 689 689 if (rc) { 690 690 pr_err("%s:AKSV write failed\n", __func__); 691 691 return rc; ··· 695 695 return 0; 696 696 } 697 697 698 - static int hdmi_hdcp_recv_bksv(struct hdmi_hdcp_ctrl *hdcp_ctrl) 698 + static int msm_hdmi_hdcp_recv_bksv(struct hdmi_hdcp_ctrl *hdcp_ctrl) 699 699 { 700 700 int rc = 0; 701 701 struct hdmi *hdmi = hdcp_ctrl->hdmi; ··· 703 703 u32 reg[2], data[2]; 704 704 705 705 /* Read BKSV at offset 0x00 */ 706 - rc = hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x00, bksv, 5); 706 + rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x00, bksv, 5); 707 707 if (rc) { 708 708 pr_err("%s:BKSV read failed\n", __func__); 709 709 return rc; ··· 728 728 data[0] = hdcp_ctrl->bksv_lsb; 729 729 reg[1] = REG_HDMI_HDCP_RCVPORT_DATA1; 730 730 data[1] = hdcp_ctrl->bksv_msb; 731 - rc = hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data, 2); 731 + rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data, 2); 732 732 733 733 return rc; 734 734 } 735 735 736 - static int hdmi_hdcp_recv_bcaps(struct hdmi_hdcp_ctrl *hdcp_ctrl) 736 + static int msm_hdmi_hdcp_recv_bcaps(struct hdmi_hdcp_ctrl *hdcp_ctrl) 737 737 { 738 738 int rc = 0; 739 739 struct hdmi *hdmi = hdcp_ctrl->hdmi; 740 740 u32 reg, data; 741 741 u8 bcaps; 742 742 743 - rc = hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x40, &bcaps, 1); 743 + rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x40, &bcaps, 1); 744 744 if (rc) { 745 745 pr_err("%s:BCAPS read failed\n", __func__); 746 746 return rc; ··· 753 753 /* Write BCAPS to the hardware */ 754 754 reg = REG_HDMI_HDCP_RCVPORT_DATA12; 755 755 data = (u32)bcaps; 756 - rc = hdmi_hdcp_scm_wr(hdcp_ctrl, &reg, &data, 1); 756 + rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, &reg, &data, 1); 757 757 758 758 return rc; 759 759 } 760 760 761 - static int hdmi_hdcp_auth_part1_key_exchange(struct hdmi_hdcp_ctrl *hdcp_ctrl) 761 + static int msm_hdmi_hdcp_auth_part1_key_exchange(struct hdmi_hdcp_ctrl *hdcp_ctrl) 762 762 { 763 763 struct hdmi *hdmi = hdcp_ctrl->hdmi; 764 764 unsigned long flags; 765 765 int rc; 766 766 767 767 /* Wait for AKSV key and An ready */ 768 - rc = hdmi_hdcp_wait_key_an_ready(hdcp_ctrl); 768 + rc = msm_hdmi_hdcp_wait_key_an_ready(hdcp_ctrl); 769 769 if (rc) { 770 770 pr_err("%s: wait key and an ready failed\n", __func__); 771 771 return rc; 772 772 }; 773 773 774 774 /* Read BCAPS and send to HDCP engine */ 775 - rc = hdmi_hdcp_recv_bcaps(hdcp_ctrl); 775 + rc = msm_hdmi_hdcp_recv_bcaps(hdcp_ctrl); 776 776 if (rc) { 777 777 pr_err("%s: read bcaps error, abort\n", __func__); 778 778 return rc; ··· 785 785 hdmi_write(hdmi, REG_HDMI_HDCP_RCVPORT_DATA4, 0); 786 786 787 787 /* Send AKSV and An to sink */ 788 - rc = hdmi_hdcp_send_aksv_an(hdcp_ctrl); 788 + rc = msm_hdmi_hdcp_send_aksv_an(hdcp_ctrl); 789 789 if (rc) { 790 790 pr_err("%s:An/Aksv write failed\n", __func__); 791 791 return rc; 792 792 } 793 793 794 794 /* Read BKSV and send to HDCP engine*/ 795 - rc = hdmi_hdcp_recv_bksv(hdcp_ctrl); 795 + rc = msm_hdmi_hdcp_recv_bksv(hdcp_ctrl); 796 796 if (rc) { 797 797 pr_err("%s:BKSV Process failed\n", __func__); 798 798 return rc; ··· 812 812 } 813 813 814 814 /* read R0' from sink and pass it to HDCP engine */ 815 - static int hdmi_hdcp_auth_part1_recv_r0(struct hdmi_hdcp_ctrl *hdcp_ctrl) 815 + static int msm_hdmi_hdcp_auth_part1_recv_r0(struct hdmi_hdcp_ctrl *hdcp_ctrl) 816 816 { 817 817 struct hdmi *hdmi = hdcp_ctrl->hdmi; 818 818 int rc = 0; ··· 822 822 * HDCP Compliance Test case 1A-01: 823 823 * Wait here at least 100ms before reading R0' 824 824 */ 825 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 125, AUTH_ABORT_EV); 825 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 125, AUTH_ABORT_EV); 826 826 if (rc) 827 827 return rc; 828 828 829 829 /* Read R0' at offset 0x08 */ 830 - rc = hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x08, buf, 2); 830 + rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x08, buf, 2); 831 831 if (rc) { 832 832 pr_err("%s:R0' read failed\n", __func__); 833 833 return rc; ··· 842 842 } 843 843 844 844 /* Wait for authenticating result: R0/R0' are matched or not */ 845 - static int hdmi_hdcp_auth_part1_verify_r0(struct hdmi_hdcp_ctrl *hdcp_ctrl) 845 + static int msm_hdmi_hdcp_auth_part1_verify_r0(struct hdmi_hdcp_ctrl *hdcp_ctrl) 846 846 { 847 847 struct hdmi *hdmi = hdcp_ctrl->hdmi; 848 848 u32 link0_status; 849 849 int rc; 850 850 851 851 /* wait for hdcp irq, 10 sec should be long enough */ 852 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 10000, AUTH_RESULT_RDY_EV); 852 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 10000, AUTH_RESULT_RDY_EV); 853 853 if (!rc) { 854 854 pr_err("%s: Wait Auth IRQ timeout\n", __func__); 855 855 return -ETIMEDOUT; ··· 869 869 return 0; 870 870 } 871 871 872 - static int hdmi_hdcp_recv_check_bstatus(struct hdmi_hdcp_ctrl *hdcp_ctrl, 872 + static int msm_hdmi_hdcp_recv_check_bstatus(struct hdmi_hdcp_ctrl *hdcp_ctrl, 873 873 u16 *pbstatus) 874 874 { 875 875 int rc; ··· 880 880 u8 buf[2]; 881 881 882 882 /* Read BSTATUS at offset 0x41 */ 883 - rc = hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x41, buf, 2); 883 + rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x41, buf, 2); 884 884 if (rc) { 885 885 pr_err("%s: BSTATUS read failed\n", __func__); 886 886 goto error; ··· 936 936 return rc; 937 937 } 938 938 939 - static int hdmi_hdcp_auth_part2_wait_ksv_fifo_ready( 939 + static int msm_hdmi_hdcp_auth_part2_wait_ksv_fifo_ready( 940 940 struct hdmi_hdcp_ctrl *hdcp_ctrl) 941 941 { 942 942 int rc; ··· 953 953 timeout_count = 100; 954 954 do { 955 955 /* Read BCAPS at offset 0x40 */ 956 - rc = hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x40, &bcaps, 1); 956 + rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x40, &bcaps, 1); 957 957 if (rc) { 958 958 pr_err("%s: BCAPS read failed\n", __func__); 959 959 return rc; ··· 968 968 return -ETIMEDOUT; 969 969 } 970 970 971 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 971 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 972 972 if (rc) 973 973 return rc; 974 974 } while (1); 975 975 976 - rc = hdmi_hdcp_recv_check_bstatus(hdcp_ctrl, &bstatus); 976 + rc = msm_hdmi_hdcp_recv_check_bstatus(hdcp_ctrl, &bstatus); 977 977 if (rc) { 978 978 pr_err("%s: bstatus error\n", __func__); 979 979 return rc; ··· 982 982 /* Write BSTATUS and BCAPS to HDCP registers */ 983 983 reg = REG_HDMI_HDCP_RCVPORT_DATA12; 984 984 data = bcaps | (bstatus << 8); 985 - rc = hdmi_hdcp_scm_wr(hdcp_ctrl, &reg, &data, 1); 985 + rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, &reg, &data, 1); 986 986 if (rc) { 987 987 pr_err("%s: BSTATUS write failed\n", __func__); 988 988 return rc; ··· 997 997 * transfer V' from sink to HDCP engine 998 998 * reset SHA engine 999 999 */ 1000 - static int hdmi_hdcp_transfer_v_h(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1000 + static int msm_hdmi_hdcp_transfer_v_h(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1001 1001 { 1002 1002 struct hdmi *hdmi = hdcp_ctrl->hdmi; 1003 1003 int rc = 0; ··· 1016 1016 1017 1017 for (i = 0; i < size; i++) { 1018 1018 rd = &reg_data[i]; 1019 - rc = hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 1019 + rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 1020 1020 rd->off, (u8 *)&data[i], (u16)sizeof(data[i])); 1021 1021 if (rc) { 1022 1022 pr_err("%s: Read %s failed\n", __func__, rd->name); ··· 1027 1027 reg[i] = reg_data[i].reg_id; 1028 1028 } 1029 1029 1030 - rc = hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data, size); 1030 + rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data, size); 1031 1031 1032 1032 error: 1033 1033 return rc; 1034 1034 } 1035 1035 1036 - static int hdmi_hdcp_recv_ksv_fifo(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1036 + static int msm_hdmi_hdcp_recv_ksv_fifo(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1037 1037 { 1038 1038 int rc; 1039 1039 struct hdmi *hdmi = hdcp_ctrl->hdmi; ··· 1041 1041 1042 1042 ksv_bytes = 5 * hdcp_ctrl->dev_count; 1043 1043 1044 - rc = hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x43, 1044 + rc = msm_hdmi_ddc_read(hdmi, HDCP_PORT_ADDR, 0x43, 1045 1045 hdcp_ctrl->ksv_list, ksv_bytes); 1046 1046 if (rc) 1047 1047 pr_err("%s: KSV FIFO read failed\n", __func__); ··· 1049 1049 return rc; 1050 1050 } 1051 1051 1052 - static int hdmi_hdcp_reset_sha_engine(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1052 + static int msm_hdmi_hdcp_reset_sha_engine(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1053 1053 { 1054 1054 u32 reg[2], data[2]; 1055 1055 u32 rc = 0; ··· 1059 1059 reg[1] = REG_HDMI_HDCP_SHA_CTRL; 1060 1060 data[1] = HDCP_REG_DISABLE; 1061 1061 1062 - rc = hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data, 2); 1062 + rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, reg, data, 2); 1063 1063 1064 1064 return rc; 1065 1065 } 1066 1066 1067 - static int hdmi_hdcp_auth_part2_recv_ksv_fifo( 1067 + static int msm_hdmi_hdcp_auth_part2_recv_ksv_fifo( 1068 1068 struct hdmi_hdcp_ctrl *hdcp_ctrl) 1069 1069 { 1070 1070 int rc; ··· 1081 1081 */ 1082 1082 timeout_count = 100; 1083 1083 do { 1084 - rc = hdmi_hdcp_recv_ksv_fifo(hdcp_ctrl); 1084 + rc = msm_hdmi_hdcp_recv_ksv_fifo(hdcp_ctrl); 1085 1085 if (!rc) 1086 1086 break; 1087 1087 ··· 1091 1091 return -ETIMEDOUT; 1092 1092 } 1093 1093 1094 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 25, AUTH_ABORT_EV); 1094 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 25, AUTH_ABORT_EV); 1095 1095 if (rc) 1096 1096 return rc; 1097 1097 } while (1); 1098 1098 1099 - rc = hdmi_hdcp_transfer_v_h(hdcp_ctrl); 1099 + rc = msm_hdmi_hdcp_transfer_v_h(hdcp_ctrl); 1100 1100 if (rc) { 1101 1101 pr_err("%s: transfer V failed\n", __func__); 1102 1102 return rc; 1103 1103 } 1104 1104 1105 1105 /* reset SHA engine before write ksv fifo */ 1106 - rc = hdmi_hdcp_reset_sha_engine(hdcp_ctrl); 1106 + rc = msm_hdmi_hdcp_reset_sha_engine(hdcp_ctrl); 1107 1107 if (rc) { 1108 1108 pr_err("%s: fail to reset sha engine\n", __func__); 1109 1109 return rc; ··· 1120 1120 * If the last byte is written, we need to poll for 1121 1121 * HDCP_SHA_COMP_DONE to wait until HW finish 1122 1122 */ 1123 - static int hdmi_hdcp_write_ksv_fifo(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1123 + static int msm_hdmi_hdcp_write_ksv_fifo(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1124 1124 { 1125 1125 int i; 1126 1126 struct hdmi *hdmi = hdcp_ctrl->hdmi; ··· 1169 1169 1170 1170 reg = REG_HDMI_HDCP_SHA_DATA; 1171 1171 data = reg_val; 1172 - rc = hdmi_hdcp_scm_wr(hdcp_ctrl, &reg, &data, 1); 1172 + rc = msm_hdmi_hdcp_scm_wr(hdcp_ctrl, &reg, &data, 1); 1173 1173 1174 1174 if (rc) 1175 1175 return rc; ··· 1184 1184 } 1185 1185 1186 1186 /* write ksv fifo into HDCP engine */ 1187 - static int hdmi_hdcp_auth_part2_write_ksv_fifo( 1187 + static int msm_hdmi_hdcp_auth_part2_write_ksv_fifo( 1188 1188 struct hdmi_hdcp_ctrl *hdcp_ctrl) 1189 1189 { 1190 1190 int rc; ··· 1193 1193 hdcp_ctrl->ksv_fifo_w_index = 0; 1194 1194 timeout_count = 100; 1195 1195 do { 1196 - rc = hdmi_hdcp_write_ksv_fifo(hdcp_ctrl); 1196 + rc = msm_hdmi_hdcp_write_ksv_fifo(hdcp_ctrl); 1197 1197 if (!rc) 1198 1198 break; 1199 1199 ··· 1206 1206 return -ETIMEDOUT; 1207 1207 } 1208 1208 1209 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 1209 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 1210 1210 if (rc) 1211 1211 return rc; 1212 1212 } while (1); ··· 1214 1214 return 0; 1215 1215 } 1216 1216 1217 - static int hdmi_hdcp_auth_part2_check_v_match(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1217 + static int msm_hdmi_hdcp_auth_part2_check_v_match(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1218 1218 { 1219 1219 int rc = 0; 1220 1220 struct hdmi *hdmi = hdcp_ctrl->hdmi; ··· 1232 1232 return -ETIMEDOUT; 1233 1233 } 1234 1234 1235 - rc = hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 1235 + rc = msm_hdmi_hdcp_msleep(hdcp_ctrl, 20, AUTH_ABORT_EV); 1236 1236 if (rc) 1237 1237 return rc; 1238 1238 } while (1); ··· 1240 1240 return 0; 1241 1241 } 1242 1242 1243 - static void hdmi_hdcp_auth_work(struct work_struct *work) 1243 + static void msm_hdmi_hdcp_auth_work(struct work_struct *work) 1244 1244 { 1245 1245 struct hdmi_hdcp_ctrl *hdcp_ctrl = container_of(work, 1246 1246 struct hdmi_hdcp_ctrl, hdcp_auth_work); 1247 1247 int rc; 1248 1248 1249 - rc = hdmi_hdcp_auth_prepare(hdcp_ctrl); 1249 + rc = msm_hdmi_hdcp_auth_prepare(hdcp_ctrl); 1250 1250 if (rc) { 1251 1251 pr_err("%s: auth prepare failed %d\n", __func__, rc); 1252 1252 goto end; 1253 1253 } 1254 1254 1255 1255 /* HDCP PartI */ 1256 - rc = hdmi_hdcp_auth_part1_key_exchange(hdcp_ctrl); 1256 + rc = msm_hdmi_hdcp_auth_part1_key_exchange(hdcp_ctrl); 1257 1257 if (rc) { 1258 1258 pr_err("%s: key exchange failed %d\n", __func__, rc); 1259 1259 goto end; 1260 1260 } 1261 1261 1262 - rc = hdmi_hdcp_auth_part1_recv_r0(hdcp_ctrl); 1262 + rc = msm_hdmi_hdcp_auth_part1_recv_r0(hdcp_ctrl); 1263 1263 if (rc) { 1264 1264 pr_err("%s: receive r0 failed %d\n", __func__, rc); 1265 1265 goto end; 1266 1266 } 1267 1267 1268 - rc = hdmi_hdcp_auth_part1_verify_r0(hdcp_ctrl); 1268 + rc = msm_hdmi_hdcp_auth_part1_verify_r0(hdcp_ctrl); 1269 1269 if (rc) { 1270 1270 pr_err("%s: verify r0 failed %d\n", __func__, rc); 1271 1271 goto end; ··· 1275 1275 goto end; 1276 1276 1277 1277 /* HDCP PartII */ 1278 - rc = hdmi_hdcp_auth_part2_wait_ksv_fifo_ready(hdcp_ctrl); 1278 + rc = msm_hdmi_hdcp_auth_part2_wait_ksv_fifo_ready(hdcp_ctrl); 1279 1279 if (rc) { 1280 1280 pr_err("%s: wait ksv fifo ready failed %d\n", __func__, rc); 1281 1281 goto end; 1282 1282 } 1283 1283 1284 - rc = hdmi_hdcp_auth_part2_recv_ksv_fifo(hdcp_ctrl); 1284 + rc = msm_hdmi_hdcp_auth_part2_recv_ksv_fifo(hdcp_ctrl); 1285 1285 if (rc) { 1286 1286 pr_err("%s: recv ksv fifo failed %d\n", __func__, rc); 1287 1287 goto end; 1288 1288 } 1289 1289 1290 - rc = hdmi_hdcp_auth_part2_write_ksv_fifo(hdcp_ctrl); 1290 + rc = msm_hdmi_hdcp_auth_part2_write_ksv_fifo(hdcp_ctrl); 1291 1291 if (rc) { 1292 1292 pr_err("%s: write ksv fifo failed %d\n", __func__, rc); 1293 1293 goto end; 1294 1294 } 1295 1295 1296 - rc = hdmi_hdcp_auth_part2_check_v_match(hdcp_ctrl); 1296 + rc = msm_hdmi_hdcp_auth_part2_check_v_match(hdcp_ctrl); 1297 1297 if (rc) 1298 1298 pr_err("%s: check v match failed %d\n", __func__, rc); 1299 1299 ··· 1304 1304 pr_info("%s: hdcp is not supported\n", __func__); 1305 1305 } else if (rc) { 1306 1306 pr_err("%s: hdcp authentication failed\n", __func__); 1307 - hdmi_hdcp_auth_fail(hdcp_ctrl); 1307 + msm_hdmi_hdcp_auth_fail(hdcp_ctrl); 1308 1308 } else { 1309 - hdmi_hdcp_auth_done(hdcp_ctrl); 1309 + msm_hdmi_hdcp_auth_done(hdcp_ctrl); 1310 1310 } 1311 1311 } 1312 1312 1313 - void hdmi_hdcp_on(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1313 + void msm_hdmi_hdcp_on(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1314 1314 { 1315 1315 struct hdmi *hdmi = hdcp_ctrl->hdmi; 1316 1316 u32 reg_val; ··· 1335 1335 queue_work(hdmi->workq, &hdcp_ctrl->hdcp_auth_work); 1336 1336 } 1337 1337 1338 - void hdmi_hdcp_off(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1338 + void msm_hdmi_hdcp_off(struct hdmi_hdcp_ctrl *hdcp_ctrl) 1339 1339 { 1340 1340 struct hdmi *hdmi = hdcp_ctrl->hdmi; 1341 1341 unsigned long flags; ··· 1399 1399 DBG("HDCP: Off"); 1400 1400 } 1401 1401 1402 - struct hdmi_hdcp_ctrl *hdmi_hdcp_init(struct hdmi *hdmi) 1402 + struct hdmi_hdcp_ctrl *msm_hdmi_hdcp_init(struct hdmi *hdmi) 1403 1403 { 1404 1404 struct hdmi_hdcp_ctrl *hdcp_ctrl = NULL; 1405 1405 ··· 1413 1413 if (!hdcp_ctrl) 1414 1414 return ERR_PTR(-ENOMEM); 1415 1415 1416 - INIT_WORK(&hdcp_ctrl->hdcp_auth_work, hdmi_hdcp_auth_work); 1417 - INIT_WORK(&hdcp_ctrl->hdcp_reauth_work, hdmi_hdcp_reauth_work); 1416 + INIT_WORK(&hdcp_ctrl->hdcp_auth_work, msm_hdmi_hdcp_auth_work); 1417 + INIT_WORK(&hdcp_ctrl->hdcp_reauth_work, msm_hdmi_hdcp_reauth_work); 1418 1418 init_waitqueue_head(&hdcp_ctrl->auth_event_queue); 1419 1419 hdcp_ctrl->hdmi = hdmi; 1420 1420 hdcp_ctrl->hdcp_state = HDCP_STATE_INACTIVE; ··· 1428 1428 return hdcp_ctrl; 1429 1429 } 1430 1430 1431 - void hdmi_hdcp_destroy(struct hdmi *hdmi) 1431 + void msm_hdmi_hdcp_destroy(struct hdmi *hdmi) 1432 1432 { 1433 1433 if (hdmi && hdmi->hdcp_ctrl) { 1434 1434 kfree(hdmi->hdcp_ctrl);
+10 -10
drivers/gpu/drm/msm/hdmi/hdmi_i2c.c
··· 97 97 return hdmi_i2c->sw_done; 98 98 } 99 99 100 - static int hdmi_i2c_xfer(struct i2c_adapter *i2c, 100 + static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c, 101 101 struct i2c_msg *msgs, int num) 102 102 { 103 103 struct hdmi_i2c_adapter *hdmi_i2c = to_hdmi_i2c_adapter(i2c); ··· 216 216 return i; 217 217 } 218 218 219 - static u32 hdmi_i2c_func(struct i2c_adapter *adapter) 219 + static u32 msm_hdmi_i2c_func(struct i2c_adapter *adapter) 220 220 { 221 221 return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL; 222 222 } 223 223 224 - static const struct i2c_algorithm hdmi_i2c_algorithm = { 225 - .master_xfer = hdmi_i2c_xfer, 226 - .functionality = hdmi_i2c_func, 224 + static const struct i2c_algorithm msm_hdmi_i2c_algorithm = { 225 + .master_xfer = msm_hdmi_i2c_xfer, 226 + .functionality = msm_hdmi_i2c_func, 227 227 }; 228 228 229 - void hdmi_i2c_irq(struct i2c_adapter *i2c) 229 + void msm_hdmi_i2c_irq(struct i2c_adapter *i2c) 230 230 { 231 231 struct hdmi_i2c_adapter *hdmi_i2c = to_hdmi_i2c_adapter(i2c); 232 232 ··· 234 234 wake_up_all(&hdmi_i2c->ddc_event); 235 235 } 236 236 237 - void hdmi_i2c_destroy(struct i2c_adapter *i2c) 237 + void msm_hdmi_i2c_destroy(struct i2c_adapter *i2c) 238 238 { 239 239 struct hdmi_i2c_adapter *hdmi_i2c = to_hdmi_i2c_adapter(i2c); 240 240 i2c_del_adapter(i2c); 241 241 kfree(hdmi_i2c); 242 242 } 243 243 244 - struct i2c_adapter *hdmi_i2c_init(struct hdmi *hdmi) 244 + struct i2c_adapter *msm_hdmi_i2c_init(struct hdmi *hdmi) 245 245 { 246 246 struct drm_device *dev = hdmi->dev; 247 247 struct hdmi_i2c_adapter *hdmi_i2c; ··· 264 264 i2c->class = I2C_CLASS_DDC; 265 265 snprintf(i2c->name, sizeof(i2c->name), "msm hdmi i2c"); 266 266 i2c->dev.parent = &hdmi->pdev->dev; 267 - i2c->algo = &hdmi_i2c_algorithm; 267 + i2c->algo = &msm_hdmi_i2c_algorithm; 268 268 269 269 ret = i2c_add_adapter(i2c); 270 270 if (ret) { ··· 276 276 277 277 fail: 278 278 if (i2c) 279 - hdmi_i2c_destroy(i2c); 279 + msm_hdmi_i2c_destroy(i2c); 280 280 return ERR_PTR(ret); 281 281 }
+230
drivers/gpu/drm/msm/hdmi/hdmi_phy.c
··· 1 + /* 2 + * Copyright (c) 2016, The Linux Foundation. All rights reserved. 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 and 6 + * only version 2 as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/of_device.h> 15 + 16 + #include "hdmi.h" 17 + 18 + static int msm_hdmi_phy_resource_init(struct hdmi_phy *phy) 19 + { 20 + struct hdmi_phy_cfg *cfg = phy->cfg; 21 + struct device *dev = &phy->pdev->dev; 22 + int i, ret; 23 + 24 + phy->regs = devm_kzalloc(dev, sizeof(phy->regs[0]) * cfg->num_regs, 25 + GFP_KERNEL); 26 + if (!phy->regs) 27 + return -ENOMEM; 28 + 29 + phy->clks = devm_kzalloc(dev, sizeof(phy->clks[0]) * cfg->num_clks, 30 + GFP_KERNEL); 31 + if (!phy->clks) 32 + return -ENOMEM; 33 + 34 + for (i = 0; i < cfg->num_regs; i++) { 35 + struct regulator *reg; 36 + 37 + reg = devm_regulator_get(dev, cfg->reg_names[i]); 38 + if (IS_ERR(reg)) { 39 + ret = PTR_ERR(reg); 40 + dev_err(dev, "failed to get phy regulator: %s (%d)\n", 41 + cfg->reg_names[i], ret); 42 + return ret; 43 + } 44 + 45 + phy->regs[i] = reg; 46 + } 47 + 48 + for (i = 0; i < cfg->num_clks; i++) { 49 + struct clk *clk; 50 + 51 + clk = devm_clk_get(dev, cfg->clk_names[i]); 52 + if (IS_ERR(clk)) { 53 + ret = PTR_ERR(clk); 54 + dev_err(dev, "failed to get phy clock: %s (%d)\n", 55 + cfg->clk_names[i], ret); 56 + return ret; 57 + } 58 + 59 + phy->clks[i] = clk; 60 + } 61 + 62 + return 0; 63 + } 64 + 65 + int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy) 66 + { 67 + struct hdmi_phy_cfg *cfg = phy->cfg; 68 + struct device *dev = &phy->pdev->dev; 69 + int i, ret = 0; 70 + 71 + pm_runtime_get_sync(dev); 72 + 73 + for (i = 0; i < cfg->num_regs; i++) { 74 + ret = regulator_enable(phy->regs[i]); 75 + if (ret) 76 + dev_err(dev, "failed to enable regulator: %s (%d)\n", 77 + cfg->reg_names[i], ret); 78 + } 79 + 80 + for (i = 0; i < cfg->num_clks; i++) { 81 + ret = clk_prepare_enable(phy->clks[i]); 82 + if (ret) 83 + dev_err(dev, "failed to enable clock: %s (%d)\n", 84 + cfg->clk_names[i], ret); 85 + } 86 + 87 + return ret; 88 + } 89 + 90 + void msm_hdmi_phy_resource_disable(struct hdmi_phy *phy) 91 + { 92 + struct hdmi_phy_cfg *cfg = phy->cfg; 93 + struct device *dev = &phy->pdev->dev; 94 + int i; 95 + 96 + for (i = cfg->num_clks - 1; i >= 0; i--) 97 + clk_disable_unprepare(phy->clks[i]); 98 + 99 + for (i = cfg->num_regs - 1; i >= 0; i--) 100 + regulator_disable(phy->regs[i]); 101 + 102 + pm_runtime_put_sync(dev); 103 + } 104 + 105 + void msm_hdmi_phy_powerup(struct hdmi_phy *phy, unsigned long int pixclock) 106 + { 107 + if (!phy || !phy->cfg->powerup) 108 + return; 109 + 110 + phy->cfg->powerup(phy, pixclock); 111 + } 112 + 113 + void msm_hdmi_phy_powerdown(struct hdmi_phy *phy) 114 + { 115 + if (!phy || !phy->cfg->powerdown) 116 + return; 117 + 118 + phy->cfg->powerdown(phy); 119 + } 120 + 121 + static int msm_hdmi_phy_pll_init(struct platform_device *pdev, 122 + enum hdmi_phy_type type) 123 + { 124 + int ret; 125 + 126 + switch (type) { 127 + case MSM_HDMI_PHY_8960: 128 + ret = msm_hdmi_pll_8960_init(pdev); 129 + break; 130 + case MSM_HDMI_PHY_8996: 131 + ret = msm_hdmi_pll_8996_init(pdev); 132 + break; 133 + /* 134 + * we don't have PLL support for these, don't report an error for now 135 + */ 136 + case MSM_HDMI_PHY_8x60: 137 + case MSM_HDMI_PHY_8x74: 138 + default: 139 + ret = 0; 140 + break; 141 + } 142 + 143 + return ret; 144 + } 145 + 146 + static int msm_hdmi_phy_probe(struct platform_device *pdev) 147 + { 148 + struct device *dev = &pdev->dev; 149 + struct hdmi_phy *phy; 150 + int ret; 151 + 152 + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL); 153 + if (!phy) 154 + return -ENODEV; 155 + 156 + phy->cfg = (struct hdmi_phy_cfg *)of_device_get_match_data(dev); 157 + if (!phy->cfg) 158 + return -ENODEV; 159 + 160 + phy->mmio = msm_ioremap(pdev, "hdmi_phy", "HDMI_PHY"); 161 + if (IS_ERR(phy->mmio)) { 162 + dev_err(dev, "%s: failed to map phy base\n", __func__); 163 + return -ENOMEM; 164 + } 165 + 166 + phy->pdev = pdev; 167 + 168 + ret = msm_hdmi_phy_resource_init(phy); 169 + if (ret) 170 + return ret; 171 + 172 + pm_runtime_enable(&pdev->dev); 173 + 174 + ret = msm_hdmi_phy_resource_enable(phy); 175 + if (ret) 176 + return ret; 177 + 178 + ret = msm_hdmi_phy_pll_init(pdev, phy->cfg->type); 179 + if (ret) { 180 + dev_err(dev, "couldn't init PLL\n"); 181 + msm_hdmi_phy_resource_disable(phy); 182 + return ret; 183 + } 184 + 185 + msm_hdmi_phy_resource_disable(phy); 186 + 187 + platform_set_drvdata(pdev, phy); 188 + 189 + return 0; 190 + } 191 + 192 + static int msm_hdmi_phy_remove(struct platform_device *pdev) 193 + { 194 + pm_runtime_disable(&pdev->dev); 195 + 196 + return 0; 197 + } 198 + 199 + static const struct of_device_id msm_hdmi_phy_dt_match[] = { 200 + { .compatible = "qcom,hdmi-phy-8660", 201 + .data = &msm_hdmi_phy_8x60_cfg }, 202 + { .compatible = "qcom,hdmi-phy-8960", 203 + .data = &msm_hdmi_phy_8960_cfg }, 204 + { .compatible = "qcom,hdmi-phy-8974", 205 + .data = &msm_hdmi_phy_8x74_cfg }, 206 + { .compatible = "qcom,hdmi-phy-8084", 207 + .data = &msm_hdmi_phy_8x74_cfg }, 208 + { .compatible = "qcom,hdmi-phy-8996", 209 + .data = &msm_hdmi_phy_8996_cfg }, 210 + {} 211 + }; 212 + 213 + static struct platform_driver msm_hdmi_phy_platform_driver = { 214 + .probe = msm_hdmi_phy_probe, 215 + .remove = msm_hdmi_phy_remove, 216 + .driver = { 217 + .name = "msm_hdmi_phy", 218 + .of_match_table = msm_hdmi_phy_dt_match, 219 + }, 220 + }; 221 + 222 + void __init msm_hdmi_phy_driver_register(void) 223 + { 224 + platform_driver_register(&msm_hdmi_phy_platform_driver); 225 + } 226 + 227 + void __exit msm_hdmi_phy_driver_unregister(void) 228 + { 229 + platform_driver_unregister(&msm_hdmi_phy_platform_driver); 230 + }
+28 -475
drivers/gpu/drm/msm/hdmi/hdmi_phy_8960.c
··· 15 15 * this program. If not, see <http://www.gnu.org/licenses/>. 16 16 */ 17 17 18 - #ifdef CONFIG_COMMON_CLK 19 - #include <linux/clk.h> 20 - #include <linux/clk-provider.h> 21 - #endif 22 - 23 18 #include "hdmi.h" 24 19 25 - struct hdmi_phy_8960 { 26 - struct hdmi_phy base; 27 - struct hdmi *hdmi; 28 - #ifdef CONFIG_COMMON_CLK 29 - struct clk_hw pll_hw; 30 - struct clk *pll; 31 - unsigned long pixclk; 32 - #endif 33 - }; 34 - #define to_hdmi_phy_8960(x) container_of(x, struct hdmi_phy_8960, base) 35 - 36 - #ifdef CONFIG_COMMON_CLK 37 - #define clk_to_phy(x) container_of(x, struct hdmi_phy_8960, pll_hw) 38 - 39 - /* 40 - * HDMI PLL: 41 - * 42 - * To get the parent clock setup properly, we need to plug in hdmi pll 43 - * configuration into common-clock-framework. 44 - */ 45 - 46 - struct pll_rate { 47 - unsigned long rate; 48 - struct { 49 - uint32_t val; 50 - uint32_t reg; 51 - } conf[32]; 52 - }; 53 - 54 - /* NOTE: keep sorted highest freq to lowest: */ 55 - static const struct pll_rate freqtbl[] = { 56 - { 154000000, { 57 - { 0x08, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 58 - { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 59 - { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 60 - { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 61 - { 0x03, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 62 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 63 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 64 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 65 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 66 - { 0x0d, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 67 - { 0x4d, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 68 - { 0x5e, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 69 - { 0x42, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 70 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 71 - { 0, 0 } } 72 - }, 73 - /* 1080p60/1080p50 case */ 74 - { 148500000, { 75 - { 0x02, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 76 - { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 77 - { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 78 - { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 79 - { 0x2c, REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG }, 80 - { 0x06, REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG }, 81 - { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 82 - { 0x76, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 83 - { 0x01, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 84 - { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 85 - { 0xc0, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 86 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 87 - { 0x9a, REG_HDMI_8960_PHY_PLL_SSC_CFG0 }, 88 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG1 }, 89 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG2 }, 90 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG3 }, 91 - { 0x10, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 }, 92 - { 0x1a, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 }, 93 - { 0x0d, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 }, 94 - { 0xe6, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 95 - { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 96 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 97 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 98 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 99 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 100 - { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 101 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 102 - { 0, 0 } } 103 - }, 104 - { 108000000, { 105 - { 0x08, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 106 - { 0x21, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 107 - { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 108 - { 0x1c, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 109 - { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 110 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 111 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 112 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 113 - { 0x49, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 114 - { 0x49, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 115 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 116 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 117 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 118 - { 0, 0 } } 119 - }, 120 - /* 720p60/720p50/1080i60/1080i50/1080p24/1080p30/1080p25 */ 121 - { 74250000, { 122 - { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 123 - { 0x12, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 124 - { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 125 - { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 126 - { 0x76, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 127 - { 0xe6, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 128 - { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 129 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 130 - { 0, 0 } } 131 - }, 132 - { 74176000, { 133 - { 0x18, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 134 - { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 135 - { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 136 - { 0xe5, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 137 - { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 138 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 139 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 140 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 141 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 142 - { 0x0c, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 143 - { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 144 - { 0x7d, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 145 - { 0xbc, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 146 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 147 - { 0, 0 } } 148 - }, 149 - { 65000000, { 150 - { 0x18, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 151 - { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 152 - { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 153 - { 0x8a, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 154 - { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 155 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 156 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 157 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 158 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 159 - { 0x0b, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 160 - { 0x4b, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 161 - { 0x7b, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 162 - { 0x09, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 163 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 164 - { 0, 0 } } 165 - }, 166 - /* 480p60/480i60 */ 167 - { 27030000, { 168 - { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 169 - { 0x38, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 170 - { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 171 - { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 172 - { 0xff, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 173 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 174 - { 0x4e, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 175 - { 0xd7, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 176 - { 0x03, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 177 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 178 - { 0x2a, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 179 - { 0x03, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 180 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 181 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 182 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 183 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 184 - { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 185 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 186 - { 0, 0 } } 187 - }, 188 - /* 576p50/576i50 */ 189 - { 27000000, { 190 - { 0x32, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 191 - { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 192 - { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 193 - { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 194 - { 0x2c, REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG }, 195 - { 0x06, REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG }, 196 - { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 197 - { 0x7b, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 198 - { 0x01, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 199 - { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 200 - { 0xc0, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 201 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 202 - { 0x9a, REG_HDMI_8960_PHY_PLL_SSC_CFG0 }, 203 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG1 }, 204 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG2 }, 205 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG3 }, 206 - { 0x10, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 }, 207 - { 0x1a, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 }, 208 - { 0x0d, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 }, 209 - { 0x2a, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 210 - { 0x03, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 211 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 212 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 213 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 214 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 215 - { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 216 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 217 - { 0, 0 } } 218 - }, 219 - /* 640x480p60 */ 220 - { 25200000, { 221 - { 0x32, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 222 - { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 223 - { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 224 - { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 225 - { 0x2c, REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG }, 226 - { 0x06, REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG }, 227 - { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 228 - { 0x77, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 229 - { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 230 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 231 - { 0xc0, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 232 - { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 233 - { 0x9a, REG_HDMI_8960_PHY_PLL_SSC_CFG0 }, 234 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG1 }, 235 - { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG2 }, 236 - { 0x20, REG_HDMI_8960_PHY_PLL_SSC_CFG3 }, 237 - { 0x10, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 }, 238 - { 0x1a, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 }, 239 - { 0x0d, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 }, 240 - { 0xf4, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 241 - { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 242 - { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 243 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 244 - { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 245 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 246 - { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 247 - { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 248 - { 0, 0 } } 249 - }, 250 - }; 251 - 252 - static int hdmi_pll_enable(struct clk_hw *hw) 253 - { 254 - struct hdmi_phy_8960 *phy_8960 = clk_to_phy(hw); 255 - struct hdmi *hdmi = phy_8960->hdmi; 256 - int timeout_count, pll_lock_retry = 10; 257 - unsigned int val; 258 - 259 - DBG(""); 260 - 261 - /* Assert PLL S/W reset */ 262 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x8d); 263 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0, 0x10); 264 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1, 0x1a); 265 - 266 - /* Wait for a short time before de-asserting 267 - * to allow the hardware to complete its job. 268 - * This much of delay should be fine for hardware 269 - * to assert and de-assert. 270 - */ 271 - udelay(10); 272 - 273 - /* De-assert PLL S/W reset */ 274 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x0d); 275 - 276 - val = hdmi_read(hdmi, REG_HDMI_8960_PHY_REG12); 277 - val |= HDMI_8960_PHY_REG12_SW_RESET; 278 - /* Assert PHY S/W reset */ 279 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG12, val); 280 - val &= ~HDMI_8960_PHY_REG12_SW_RESET; 281 - /* Wait for a short time before de-asserting 282 - to allow the hardware to complete its job. 283 - This much of delay should be fine for hardware 284 - to assert and de-assert. */ 285 - udelay(10); 286 - /* De-assert PHY S/W reset */ 287 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG12, val); 288 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG2, 0x3f); 289 - 290 - val = hdmi_read(hdmi, REG_HDMI_8960_PHY_REG12); 291 - val |= HDMI_8960_PHY_REG12_PWRDN_B; 292 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG12, val); 293 - /* Wait 10 us for enabling global power for PHY */ 294 - mb(); 295 - udelay(10); 296 - 297 - val = hdmi_read(hdmi, REG_HDMI_8960_PHY_PLL_PWRDN_B); 298 - val |= HDMI_8960_PHY_PLL_PWRDN_B_PLL_PWRDN_B; 299 - val &= ~HDMI_8960_PHY_PLL_PWRDN_B_PD_PLL; 300 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_PWRDN_B, val); 301 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG2, 0x80); 302 - 303 - timeout_count = 1000; 304 - while (--pll_lock_retry > 0) { 305 - 306 - /* are we there yet? */ 307 - val = hdmi_read(hdmi, REG_HDMI_8960_PHY_PLL_STATUS0); 308 - if (val & HDMI_8960_PHY_PLL_STATUS0_PLL_LOCK) 309 - break; 310 - 311 - udelay(1); 312 - 313 - if (--timeout_count > 0) 314 - continue; 315 - 316 - /* 317 - * PLL has still not locked. 318 - * Do a software reset and try again 319 - * Assert PLL S/W reset first 320 - */ 321 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x8d); 322 - udelay(10); 323 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x0d); 324 - 325 - /* 326 - * Wait for a short duration for the PLL calibration 327 - * before checking if the PLL gets locked 328 - */ 329 - udelay(350); 330 - 331 - timeout_count = 1000; 332 - } 333 - 334 - return 0; 335 - } 336 - 337 - static void hdmi_pll_disable(struct clk_hw *hw) 338 - { 339 - struct hdmi_phy_8960 *phy_8960 = clk_to_phy(hw); 340 - struct hdmi *hdmi = phy_8960->hdmi; 341 - unsigned int val; 342 - 343 - DBG(""); 344 - 345 - val = hdmi_read(hdmi, REG_HDMI_8960_PHY_REG12); 346 - val &= ~HDMI_8960_PHY_REG12_PWRDN_B; 347 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG12, val); 348 - 349 - val = hdmi_read(hdmi, REG_HDMI_8960_PHY_PLL_PWRDN_B); 350 - val |= HDMI_8960_PHY_REG12_SW_RESET; 351 - val &= ~HDMI_8960_PHY_REG12_PWRDN_B; 352 - hdmi_write(hdmi, REG_HDMI_8960_PHY_PLL_PWRDN_B, val); 353 - /* Make sure HDMI PHY/PLL are powered down */ 354 - mb(); 355 - } 356 - 357 - static const struct pll_rate *find_rate(unsigned long rate) 358 - { 359 - int i; 360 - for (i = 1; i < ARRAY_SIZE(freqtbl); i++) 361 - if (rate > freqtbl[i].rate) 362 - return &freqtbl[i-1]; 363 - return &freqtbl[i-1]; 364 - } 365 - 366 - static unsigned long hdmi_pll_recalc_rate(struct clk_hw *hw, 367 - unsigned long parent_rate) 368 - { 369 - struct hdmi_phy_8960 *phy_8960 = clk_to_phy(hw); 370 - return phy_8960->pixclk; 371 - } 372 - 373 - static long hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, 374 - unsigned long *parent_rate) 375 - { 376 - const struct pll_rate *pll_rate = find_rate(rate); 377 - return pll_rate->rate; 378 - } 379 - 380 - static int hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, 381 - unsigned long parent_rate) 382 - { 383 - struct hdmi_phy_8960 *phy_8960 = clk_to_phy(hw); 384 - struct hdmi *hdmi = phy_8960->hdmi; 385 - const struct pll_rate *pll_rate = find_rate(rate); 386 - int i; 387 - 388 - DBG("rate=%lu", rate); 389 - 390 - for (i = 0; pll_rate->conf[i].reg; i++) 391 - hdmi_write(hdmi, pll_rate->conf[i].reg, pll_rate->conf[i].val); 392 - 393 - phy_8960->pixclk = rate; 394 - 395 - return 0; 396 - } 397 - 398 - 399 - static const struct clk_ops hdmi_pll_ops = { 400 - .enable = hdmi_pll_enable, 401 - .disable = hdmi_pll_disable, 402 - .recalc_rate = hdmi_pll_recalc_rate, 403 - .round_rate = hdmi_pll_round_rate, 404 - .set_rate = hdmi_pll_set_rate, 405 - }; 406 - 407 - static const char *hdmi_pll_parents[] = { 408 - "pxo", 409 - }; 410 - 411 - static struct clk_init_data pll_init = { 412 - .name = "hdmi_pll", 413 - .ops = &hdmi_pll_ops, 414 - .parent_names = hdmi_pll_parents, 415 - .num_parents = ARRAY_SIZE(hdmi_pll_parents), 416 - }; 417 - #endif 418 - 419 - /* 420 - * HDMI Phy: 421 - */ 422 - 423 - static void hdmi_phy_8960_destroy(struct hdmi_phy *phy) 424 - { 425 - struct hdmi_phy_8960 *phy_8960 = to_hdmi_phy_8960(phy); 426 - kfree(phy_8960); 427 - } 428 - 429 20 static void hdmi_phy_8960_powerup(struct hdmi_phy *phy, 430 - unsigned long int pixclock) 21 + unsigned long int pixclock) 431 22 { 432 - struct hdmi_phy_8960 *phy_8960 = to_hdmi_phy_8960(phy); 433 - struct hdmi *hdmi = phy_8960->hdmi; 434 - 435 23 DBG("pixclock: %lu", pixclock); 436 24 437 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG2, 0x00); 438 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG0, 0x1b); 439 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG1, 0xf2); 440 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG4, 0x00); 441 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG5, 0x00); 442 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG6, 0x00); 443 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG7, 0x00); 444 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG8, 0x00); 445 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG9, 0x00); 446 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG10, 0x00); 447 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG11, 0x00); 448 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG3, 0x20); 25 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG2, 0x00); 26 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG0, 0x1b); 27 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG1, 0xf2); 28 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG4, 0x00); 29 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG5, 0x00); 30 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG6, 0x00); 31 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG7, 0x00); 32 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG8, 0x00); 33 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG9, 0x00); 34 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG10, 0x00); 35 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG11, 0x00); 36 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG3, 0x20); 449 37 } 450 38 451 39 static void hdmi_phy_8960_powerdown(struct hdmi_phy *phy) 452 40 { 453 - struct hdmi_phy_8960 *phy_8960 = to_hdmi_phy_8960(phy); 454 - struct hdmi *hdmi = phy_8960->hdmi; 455 - 456 41 DBG(""); 457 42 458 - hdmi_write(hdmi, REG_HDMI_8960_PHY_REG2, 0x7f); 43 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG2, 0x7f); 459 44 } 460 45 461 - static const struct hdmi_phy_funcs hdmi_phy_8960_funcs = { 462 - .destroy = hdmi_phy_8960_destroy, 463 - .powerup = hdmi_phy_8960_powerup, 464 - .powerdown = hdmi_phy_8960_powerdown, 46 + static const char * const hdmi_phy_8960_reg_names[] = { 47 + "core-vdda", 465 48 }; 466 49 467 - struct hdmi_phy *hdmi_phy_8960_init(struct hdmi *hdmi) 468 - { 469 - struct hdmi_phy_8960 *phy_8960; 470 - struct hdmi_phy *phy = NULL; 471 - int ret; 472 - #ifdef CONFIG_COMMON_CLK 473 - int i; 50 + static const char * const hdmi_phy_8960_clk_names[] = { 51 + "slave_iface_clk", 52 + }; 474 53 475 - /* sanity check: */ 476 - for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) 477 - if (WARN_ON(freqtbl[i].rate < freqtbl[i+1].rate)) 478 - return ERR_PTR(-EINVAL); 479 - #endif 480 - 481 - phy_8960 = kzalloc(sizeof(*phy_8960), GFP_KERNEL); 482 - if (!phy_8960) { 483 - ret = -ENOMEM; 484 - goto fail; 485 - } 486 - 487 - phy = &phy_8960->base; 488 - 489 - phy->funcs = &hdmi_phy_8960_funcs; 490 - 491 - phy_8960->hdmi = hdmi; 492 - 493 - #ifdef CONFIG_COMMON_CLK 494 - phy_8960->pll_hw.init = &pll_init; 495 - phy_8960->pll = devm_clk_register(&hdmi->pdev->dev, &phy_8960->pll_hw); 496 - if (IS_ERR(phy_8960->pll)) { 497 - ret = PTR_ERR(phy_8960->pll); 498 - phy_8960->pll = NULL; 499 - goto fail; 500 - } 501 - #endif 502 - 503 - return phy; 504 - 505 - fail: 506 - if (phy) 507 - hdmi_phy_8960_destroy(phy); 508 - return ERR_PTR(ret); 509 - } 54 + const struct hdmi_phy_cfg msm_hdmi_phy_8960_cfg = { 55 + .type = MSM_HDMI_PHY_8960, 56 + .powerup = hdmi_phy_8960_powerup, 57 + .powerdown = hdmi_phy_8960_powerdown, 58 + .reg_names = hdmi_phy_8960_reg_names, 59 + .num_regs = ARRAY_SIZE(hdmi_phy_8960_reg_names), 60 + .clk_names = hdmi_phy_8960_clk_names, 61 + .num_clks = ARRAY_SIZE(hdmi_phy_8960_clk_names), 62 + };
+766
drivers/gpu/drm/msm/hdmi/hdmi_phy_8996.c
··· 1 + /* 2 + * Copyright (c) 2016, The Linux Foundation. All rights reserved. 3 + * 4 + * This program is free software; you can redistribute it and/or modify 5 + * it under the terms of the GNU General Public License version 2 and 6 + * only version 2 as published by the Free Software Foundation. 7 + * 8 + * This program is distributed in the hope that it will be useful, 9 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 + * GNU General Public License for more details. 12 + */ 13 + 14 + #include <linux/clk-provider.h> 15 + 16 + #include "hdmi.h" 17 + 18 + #define HDMI_VCO_MAX_FREQ 12000000000UL 19 + #define HDMI_VCO_MIN_FREQ 8000000000UL 20 + 21 + #define HDMI_PCLK_MAX_FREQ 600000000 22 + #define HDMI_PCLK_MIN_FREQ 25000000 23 + 24 + #define HDMI_HIGH_FREQ_BIT_CLK_THRESHOLD 3400000000UL 25 + #define HDMI_DIG_FREQ_BIT_CLK_THRESHOLD 1500000000UL 26 + #define HDMI_MID_FREQ_BIT_CLK_THRESHOLD 750000000UL 27 + #define HDMI_CORECLK_DIV 5 28 + #define HDMI_DEFAULT_REF_CLOCK 19200000 29 + #define HDMI_PLL_CMP_CNT 1024 30 + 31 + #define HDMI_PLL_POLL_MAX_READS 100 32 + #define HDMI_PLL_POLL_TIMEOUT_US 150 33 + 34 + #define HDMI_NUM_TX_CHANNEL 4 35 + 36 + struct hdmi_pll_8996 { 37 + struct platform_device *pdev; 38 + struct clk_hw clk_hw; 39 + 40 + /* pll mmio base */ 41 + void __iomem *mmio_qserdes_com; 42 + /* tx channel base */ 43 + void __iomem *mmio_qserdes_tx[HDMI_NUM_TX_CHANNEL]; 44 + }; 45 + 46 + #define hw_clk_to_pll(x) container_of(x, struct hdmi_pll_8996, clk_hw) 47 + 48 + struct hdmi_8996_phy_pll_reg_cfg { 49 + u32 tx_lx_lane_mode[HDMI_NUM_TX_CHANNEL]; 50 + u32 tx_lx_tx_band[HDMI_NUM_TX_CHANNEL]; 51 + u32 com_svs_mode_clk_sel; 52 + u32 com_hsclk_sel; 53 + u32 com_pll_cctrl_mode0; 54 + u32 com_pll_rctrl_mode0; 55 + u32 com_cp_ctrl_mode0; 56 + u32 com_dec_start_mode0; 57 + u32 com_div_frac_start1_mode0; 58 + u32 com_div_frac_start2_mode0; 59 + u32 com_div_frac_start3_mode0; 60 + u32 com_integloop_gain0_mode0; 61 + u32 com_integloop_gain1_mode0; 62 + u32 com_lock_cmp_en; 63 + u32 com_lock_cmp1_mode0; 64 + u32 com_lock_cmp2_mode0; 65 + u32 com_lock_cmp3_mode0; 66 + u32 com_core_clk_en; 67 + u32 com_coreclk_div; 68 + u32 com_vco_tune_ctrl; 69 + 70 + u32 tx_lx_tx_drv_lvl[HDMI_NUM_TX_CHANNEL]; 71 + u32 tx_lx_tx_emp_post1_lvl[HDMI_NUM_TX_CHANNEL]; 72 + u32 tx_lx_vmode_ctrl1[HDMI_NUM_TX_CHANNEL]; 73 + u32 tx_lx_vmode_ctrl2[HDMI_NUM_TX_CHANNEL]; 74 + u32 tx_lx_res_code_lane_tx[HDMI_NUM_TX_CHANNEL]; 75 + u32 tx_lx_hp_pd_enables[HDMI_NUM_TX_CHANNEL]; 76 + 77 + u32 phy_mode; 78 + }; 79 + 80 + struct hdmi_8996_post_divider { 81 + u64 vco_freq; 82 + int hsclk_divsel; 83 + int vco_ratio; 84 + int tx_band_sel; 85 + int half_rate_mode; 86 + }; 87 + 88 + static inline struct hdmi_phy *pll_get_phy(struct hdmi_pll_8996 *pll) 89 + { 90 + return platform_get_drvdata(pll->pdev); 91 + } 92 + 93 + static inline void hdmi_pll_write(struct hdmi_pll_8996 *pll, int offset, 94 + u32 data) 95 + { 96 + msm_writel(data, pll->mmio_qserdes_com + offset); 97 + } 98 + 99 + static inline u32 hdmi_pll_read(struct hdmi_pll_8996 *pll, int offset) 100 + { 101 + return msm_readl(pll->mmio_qserdes_com + offset); 102 + } 103 + 104 + static inline void hdmi_tx_chan_write(struct hdmi_pll_8996 *pll, int channel, 105 + int offset, int data) 106 + { 107 + msm_writel(data, pll->mmio_qserdes_tx[channel] + offset); 108 + } 109 + 110 + static inline u32 pll_get_cpctrl(u64 frac_start, unsigned long ref_clk, 111 + bool gen_ssc) 112 + { 113 + if ((frac_start != 0) || gen_ssc) 114 + return (11000000 / (ref_clk / 20)); 115 + 116 + return 0x23; 117 + } 118 + 119 + static inline u32 pll_get_rctrl(u64 frac_start, bool gen_ssc) 120 + { 121 + if ((frac_start != 0) || gen_ssc) 122 + return 0x16; 123 + 124 + return 0x10; 125 + } 126 + 127 + static inline u32 pll_get_cctrl(u64 frac_start, bool gen_ssc) 128 + { 129 + if ((frac_start != 0) || gen_ssc) 130 + return 0x28; 131 + 132 + return 0x1; 133 + } 134 + 135 + static inline u32 pll_get_integloop_gain(u64 frac_start, u64 bclk, u32 ref_clk, 136 + bool gen_ssc) 137 + { 138 + int digclk_divsel = bclk >= HDMI_DIG_FREQ_BIT_CLK_THRESHOLD ? 1 : 2; 139 + u64 base; 140 + 141 + if ((frac_start != 0) || gen_ssc) 142 + base = (64 * ref_clk) / HDMI_DEFAULT_REF_CLOCK; 143 + else 144 + base = (1022 * ref_clk) / 100; 145 + 146 + base <<= digclk_divsel; 147 + 148 + return (base <= 2046 ? base : 2046); 149 + } 150 + 151 + static inline u32 pll_get_pll_cmp(u64 fdata, unsigned long ref_clk) 152 + { 153 + u64 dividend = HDMI_PLL_CMP_CNT * fdata; 154 + u32 divisor = ref_clk * 10; 155 + u32 rem; 156 + 157 + rem = do_div(dividend, divisor); 158 + if (rem > (divisor >> 1)) 159 + dividend++; 160 + 161 + return dividend - 1; 162 + } 163 + 164 + static inline u64 pll_cmp_to_fdata(u32 pll_cmp, unsigned long ref_clk) 165 + { 166 + u64 fdata = ((u64)pll_cmp) * ref_clk * 10; 167 + 168 + do_div(fdata, HDMI_PLL_CMP_CNT); 169 + 170 + return fdata; 171 + } 172 + 173 + static int pll_get_post_div(struct hdmi_8996_post_divider *pd, u64 bclk) 174 + { 175 + int ratio[] = { 2, 3, 4, 5, 6, 9, 10, 12, 14, 15, 20, 21, 25, 28, 35 }; 176 + int hs_divsel[] = { 0, 4, 8, 12, 1, 5, 2, 9, 3, 13, 10, 7, 14, 11, 15 }; 177 + int tx_band_sel[] = { 0, 1, 2, 3 }; 178 + u64 vco_freq[60]; 179 + u64 vco, vco_optimal; 180 + int half_rate_mode = 0; 181 + int vco_optimal_index, vco_freq_index; 182 + int i, j; 183 + 184 + retry: 185 + vco_optimal = HDMI_VCO_MAX_FREQ; 186 + vco_optimal_index = -1; 187 + vco_freq_index = 0; 188 + for (i = 0; i < 15; i++) { 189 + for (j = 0; j < 4; j++) { 190 + u32 ratio_mult = ratio[i] << tx_band_sel[j]; 191 + 192 + vco = bclk >> half_rate_mode; 193 + vco *= ratio_mult; 194 + vco_freq[vco_freq_index++] = vco; 195 + } 196 + } 197 + 198 + for (i = 0; i < 60; i++) { 199 + u64 vco_tmp = vco_freq[i]; 200 + 201 + if ((vco_tmp >= HDMI_VCO_MIN_FREQ) && 202 + (vco_tmp <= vco_optimal)) { 203 + vco_optimal = vco_tmp; 204 + vco_optimal_index = i; 205 + } 206 + } 207 + 208 + if (vco_optimal_index == -1) { 209 + if (!half_rate_mode) { 210 + half_rate_mode = 1; 211 + goto retry; 212 + } 213 + } else { 214 + pd->vco_freq = vco_optimal; 215 + pd->tx_band_sel = tx_band_sel[vco_optimal_index % 4]; 216 + pd->vco_ratio = ratio[vco_optimal_index / 4]; 217 + pd->hsclk_divsel = hs_divsel[vco_optimal_index / 4]; 218 + 219 + return 0; 220 + } 221 + 222 + return -EINVAL; 223 + } 224 + 225 + static int pll_calculate(unsigned long pix_clk, unsigned long ref_clk, 226 + struct hdmi_8996_phy_pll_reg_cfg *cfg) 227 + { 228 + struct hdmi_8996_post_divider pd; 229 + u64 bclk; 230 + u64 tmds_clk; 231 + u64 dec_start; 232 + u64 frac_start; 233 + u64 fdata; 234 + u32 pll_divisor; 235 + u32 rem; 236 + u32 cpctrl; 237 + u32 rctrl; 238 + u32 cctrl; 239 + u32 integloop_gain; 240 + u32 pll_cmp; 241 + int i, ret; 242 + 243 + /* bit clk = 10 * pix_clk */ 244 + bclk = ((u64)pix_clk) * 10; 245 + 246 + if (bclk > HDMI_HIGH_FREQ_BIT_CLK_THRESHOLD) 247 + tmds_clk = pix_clk >> 2; 248 + else 249 + tmds_clk = pix_clk; 250 + 251 + ret = pll_get_post_div(&pd, bclk); 252 + if (ret) 253 + return ret; 254 + 255 + dec_start = pd.vco_freq; 256 + pll_divisor = 4 * ref_clk; 257 + do_div(dec_start, pll_divisor); 258 + 259 + frac_start = pd.vco_freq * (1 << 20); 260 + 261 + rem = do_div(frac_start, pll_divisor); 262 + frac_start -= dec_start * (1 << 20); 263 + if (rem > (pll_divisor >> 1)) 264 + frac_start++; 265 + 266 + cpctrl = pll_get_cpctrl(frac_start, ref_clk, false); 267 + rctrl = pll_get_rctrl(frac_start, false); 268 + cctrl = pll_get_cctrl(frac_start, false); 269 + integloop_gain = pll_get_integloop_gain(frac_start, bclk, 270 + ref_clk, false); 271 + 272 + fdata = pd.vco_freq; 273 + do_div(fdata, pd.vco_ratio); 274 + 275 + pll_cmp = pll_get_pll_cmp(fdata, ref_clk); 276 + 277 + DBG("VCO freq: %llu", pd.vco_freq); 278 + DBG("fdata: %llu", fdata); 279 + DBG("pix_clk: %lu", pix_clk); 280 + DBG("tmds clk: %llu", tmds_clk); 281 + DBG("HSCLK_SEL: %d", pd.hsclk_divsel); 282 + DBG("DEC_START: %llu", dec_start); 283 + DBG("DIV_FRAC_START: %llu", frac_start); 284 + DBG("PLL_CPCTRL: %u", cpctrl); 285 + DBG("PLL_RCTRL: %u", rctrl); 286 + DBG("PLL_CCTRL: %u", cctrl); 287 + DBG("INTEGLOOP_GAIN: %u", integloop_gain); 288 + DBG("TX_BAND: %d", pd.tx_band_sel); 289 + DBG("PLL_CMP: %u", pll_cmp); 290 + 291 + /* Convert these values to register specific values */ 292 + if (bclk > HDMI_DIG_FREQ_BIT_CLK_THRESHOLD) 293 + cfg->com_svs_mode_clk_sel = 1; 294 + else 295 + cfg->com_svs_mode_clk_sel = 2; 296 + 297 + cfg->com_hsclk_sel = (0x20 | pd.hsclk_divsel); 298 + cfg->com_pll_cctrl_mode0 = cctrl; 299 + cfg->com_pll_rctrl_mode0 = rctrl; 300 + cfg->com_cp_ctrl_mode0 = cpctrl; 301 + cfg->com_dec_start_mode0 = dec_start; 302 + cfg->com_div_frac_start1_mode0 = (frac_start & 0xff); 303 + cfg->com_div_frac_start2_mode0 = ((frac_start & 0xff00) >> 8); 304 + cfg->com_div_frac_start3_mode0 = ((frac_start & 0xf0000) >> 16); 305 + cfg->com_integloop_gain0_mode0 = (integloop_gain & 0xff); 306 + cfg->com_integloop_gain1_mode0 = ((integloop_gain & 0xf00) >> 8); 307 + cfg->com_lock_cmp1_mode0 = (pll_cmp & 0xff); 308 + cfg->com_lock_cmp2_mode0 = ((pll_cmp & 0xff00) >> 8); 309 + cfg->com_lock_cmp3_mode0 = ((pll_cmp & 0x30000) >> 16); 310 + cfg->com_lock_cmp_en = 0x0; 311 + cfg->com_core_clk_en = 0x2c; 312 + cfg->com_coreclk_div = HDMI_CORECLK_DIV; 313 + cfg->phy_mode = (bclk > HDMI_HIGH_FREQ_BIT_CLK_THRESHOLD) ? 0x10 : 0x0; 314 + cfg->com_vco_tune_ctrl = 0x0; 315 + 316 + cfg->tx_lx_lane_mode[0] = 317 + cfg->tx_lx_lane_mode[2] = 0x43; 318 + 319 + cfg->tx_lx_hp_pd_enables[0] = 320 + cfg->tx_lx_hp_pd_enables[1] = 321 + cfg->tx_lx_hp_pd_enables[2] = 0x0c; 322 + cfg->tx_lx_hp_pd_enables[3] = 0x3; 323 + 324 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) 325 + cfg->tx_lx_tx_band[i] = pd.tx_band_sel + 4; 326 + 327 + if (bclk > HDMI_HIGH_FREQ_BIT_CLK_THRESHOLD) { 328 + cfg->tx_lx_tx_drv_lvl[0] = 329 + cfg->tx_lx_tx_drv_lvl[1] = 330 + cfg->tx_lx_tx_drv_lvl[2] = 0x25; 331 + cfg->tx_lx_tx_drv_lvl[3] = 0x22; 332 + 333 + cfg->tx_lx_tx_emp_post1_lvl[0] = 334 + cfg->tx_lx_tx_emp_post1_lvl[1] = 335 + cfg->tx_lx_tx_emp_post1_lvl[2] = 0x23; 336 + cfg->tx_lx_tx_emp_post1_lvl[3] = 0x27; 337 + 338 + cfg->tx_lx_vmode_ctrl1[0] = 339 + cfg->tx_lx_vmode_ctrl1[1] = 340 + cfg->tx_lx_vmode_ctrl1[2] = 341 + cfg->tx_lx_vmode_ctrl1[3] = 0x00; 342 + 343 + cfg->tx_lx_vmode_ctrl2[0] = 344 + cfg->tx_lx_vmode_ctrl2[1] = 345 + cfg->tx_lx_vmode_ctrl2[2] = 0x0D; 346 + 347 + cfg->tx_lx_vmode_ctrl2[3] = 0x00; 348 + } else if (bclk > HDMI_MID_FREQ_BIT_CLK_THRESHOLD) { 349 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) { 350 + cfg->tx_lx_tx_drv_lvl[i] = 0x25; 351 + cfg->tx_lx_tx_emp_post1_lvl[i] = 0x23; 352 + cfg->tx_lx_vmode_ctrl1[i] = 0x00; 353 + } 354 + 355 + cfg->tx_lx_vmode_ctrl2[0] = 356 + cfg->tx_lx_vmode_ctrl2[1] = 357 + cfg->tx_lx_vmode_ctrl2[2] = 0x0D; 358 + cfg->tx_lx_vmode_ctrl2[3] = 0x00; 359 + } else { 360 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) { 361 + cfg->tx_lx_tx_drv_lvl[i] = 0x20; 362 + cfg->tx_lx_tx_emp_post1_lvl[i] = 0x20; 363 + cfg->tx_lx_vmode_ctrl1[i] = 0x00; 364 + cfg->tx_lx_vmode_ctrl2[i] = 0x0E; 365 + } 366 + } 367 + 368 + DBG("com_svs_mode_clk_sel = 0x%x", cfg->com_svs_mode_clk_sel); 369 + DBG("com_hsclk_sel = 0x%x", cfg->com_hsclk_sel); 370 + DBG("com_lock_cmp_en = 0x%x", cfg->com_lock_cmp_en); 371 + DBG("com_pll_cctrl_mode0 = 0x%x", cfg->com_pll_cctrl_mode0); 372 + DBG("com_pll_rctrl_mode0 = 0x%x", cfg->com_pll_rctrl_mode0); 373 + DBG("com_cp_ctrl_mode0 = 0x%x", cfg->com_cp_ctrl_mode0); 374 + DBG("com_dec_start_mode0 = 0x%x", cfg->com_dec_start_mode0); 375 + DBG("com_div_frac_start1_mode0 = 0x%x", cfg->com_div_frac_start1_mode0); 376 + DBG("com_div_frac_start2_mode0 = 0x%x", cfg->com_div_frac_start2_mode0); 377 + DBG("com_div_frac_start3_mode0 = 0x%x", cfg->com_div_frac_start3_mode0); 378 + DBG("com_integloop_gain0_mode0 = 0x%x", cfg->com_integloop_gain0_mode0); 379 + DBG("com_integloop_gain1_mode0 = 0x%x", cfg->com_integloop_gain1_mode0); 380 + DBG("com_lock_cmp1_mode0 = 0x%x", cfg->com_lock_cmp1_mode0); 381 + DBG("com_lock_cmp2_mode0 = 0x%x", cfg->com_lock_cmp2_mode0); 382 + DBG("com_lock_cmp3_mode0 = 0x%x", cfg->com_lock_cmp3_mode0); 383 + DBG("com_core_clk_en = 0x%x", cfg->com_core_clk_en); 384 + DBG("com_coreclk_div = 0x%x", cfg->com_coreclk_div); 385 + DBG("phy_mode = 0x%x", cfg->phy_mode); 386 + 387 + DBG("tx_l0_lane_mode = 0x%x", cfg->tx_lx_lane_mode[0]); 388 + DBG("tx_l2_lane_mode = 0x%x", cfg->tx_lx_lane_mode[2]); 389 + 390 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) { 391 + DBG("tx_l%d_tx_band = 0x%x", i, cfg->tx_lx_tx_band[i]); 392 + DBG("tx_l%d_tx_drv_lvl = 0x%x", i, cfg->tx_lx_tx_drv_lvl[i]); 393 + DBG("tx_l%d_tx_emp_post1_lvl = 0x%x", i, 394 + cfg->tx_lx_tx_emp_post1_lvl[i]); 395 + DBG("tx_l%d_vmode_ctrl1 = 0x%x", i, cfg->tx_lx_vmode_ctrl1[i]); 396 + DBG("tx_l%d_vmode_ctrl2 = 0x%x", i, cfg->tx_lx_vmode_ctrl2[i]); 397 + } 398 + 399 + return 0; 400 + } 401 + 402 + static int hdmi_8996_pll_set_clk_rate(struct clk_hw *hw, unsigned long rate, 403 + unsigned long parent_rate) 404 + { 405 + struct hdmi_pll_8996 *pll = hw_clk_to_pll(hw); 406 + struct hdmi_phy *phy = pll_get_phy(pll); 407 + struct hdmi_8996_phy_pll_reg_cfg cfg; 408 + int i, ret; 409 + 410 + memset(&cfg, 0x00, sizeof(cfg)); 411 + 412 + ret = pll_calculate(rate, parent_rate, &cfg); 413 + if (ret) { 414 + DRM_ERROR("PLL calculation failed\n"); 415 + return ret; 416 + } 417 + 418 + /* Initially shut down PHY */ 419 + DBG("Disabling PHY"); 420 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_PD_CTL, 0x0); 421 + udelay(500); 422 + 423 + /* Power up sequence */ 424 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_BG_CTRL, 0x04); 425 + 426 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_PD_CTL, 0x1); 427 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_RESETSM_CNTRL, 0x20); 428 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_TX0_TX1_LANE_CTL, 0x0F); 429 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_TX2_TX3_LANE_CTL, 0x0F); 430 + 431 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) { 432 + hdmi_tx_chan_write(pll, i, 433 + REG_HDMI_PHY_QSERDES_TX_LX_CLKBUF_ENABLE, 434 + 0x03); 435 + hdmi_tx_chan_write(pll, i, 436 + REG_HDMI_PHY_QSERDES_TX_LX_TX_BAND, 437 + cfg.tx_lx_tx_band[i]); 438 + hdmi_tx_chan_write(pll, i, 439 + REG_HDMI_PHY_QSERDES_TX_LX_RESET_TSYNC_EN, 440 + 0x03); 441 + } 442 + 443 + hdmi_tx_chan_write(pll, 0, REG_HDMI_PHY_QSERDES_TX_LX_LANE_MODE, 444 + cfg.tx_lx_lane_mode[0]); 445 + hdmi_tx_chan_write(pll, 2, REG_HDMI_PHY_QSERDES_TX_LX_LANE_MODE, 446 + cfg.tx_lx_lane_mode[2]); 447 + 448 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SYSCLK_BUF_ENABLE, 0x1E); 449 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_BIAS_EN_CLKBUFLR_EN, 0x07); 450 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SYSCLK_EN_SEL, 0x37); 451 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SYS_CLK_CTRL, 0x02); 452 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_CLK_ENABLE1, 0x0E); 453 + 454 + /* Bypass VCO calibration */ 455 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SVS_MODE_CLK_SEL, 456 + cfg.com_svs_mode_clk_sel); 457 + 458 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_BG_TRIM, 0x0F); 459 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_PLL_IVCO, 0x0F); 460 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_CTRL, 461 + cfg.com_vco_tune_ctrl); 462 + 463 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_BG_CTRL, 0x06); 464 + 465 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_CLK_SELECT, 0x30); 466 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_HSCLK_SEL, 467 + cfg.com_hsclk_sel); 468 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_LOCK_CMP_EN, 469 + cfg.com_lock_cmp_en); 470 + 471 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_PLL_CCTRL_MODE0, 472 + cfg.com_pll_cctrl_mode0); 473 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_PLL_RCTRL_MODE0, 474 + cfg.com_pll_rctrl_mode0); 475 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_CP_CTRL_MODE0, 476 + cfg.com_cp_ctrl_mode0); 477 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_DEC_START_MODE0, 478 + cfg.com_dec_start_mode0); 479 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START1_MODE0, 480 + cfg.com_div_frac_start1_mode0); 481 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START2_MODE0, 482 + cfg.com_div_frac_start2_mode0); 483 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_DIV_FRAC_START3_MODE0, 484 + cfg.com_div_frac_start3_mode0); 485 + 486 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN0_MODE0, 487 + cfg.com_integloop_gain0_mode0); 488 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_INTEGLOOP_GAIN1_MODE0, 489 + cfg.com_integloop_gain1_mode0); 490 + 491 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_LOCK_CMP1_MODE0, 492 + cfg.com_lock_cmp1_mode0); 493 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_LOCK_CMP2_MODE0, 494 + cfg.com_lock_cmp2_mode0); 495 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_LOCK_CMP3_MODE0, 496 + cfg.com_lock_cmp3_mode0); 497 + 498 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_VCO_TUNE_MAP, 0x00); 499 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_CORE_CLK_EN, 500 + cfg.com_core_clk_en); 501 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_CORECLK_DIV, 502 + cfg.com_coreclk_div); 503 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_CMN_CONFIG, 0x02); 504 + 505 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_RESCODE_DIV_NUM, 0x15); 506 + 507 + /* TX lanes setup (TX 0/1/2/3) */ 508 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) { 509 + hdmi_tx_chan_write(pll, i, 510 + REG_HDMI_PHY_QSERDES_TX_LX_TX_DRV_LVL, 511 + cfg.tx_lx_tx_drv_lvl[i]); 512 + hdmi_tx_chan_write(pll, i, 513 + REG_HDMI_PHY_QSERDES_TX_LX_TX_EMP_POST1_LVL, 514 + cfg.tx_lx_tx_emp_post1_lvl[i]); 515 + hdmi_tx_chan_write(pll, i, 516 + REG_HDMI_PHY_QSERDES_TX_LX_VMODE_CTRL1, 517 + cfg.tx_lx_vmode_ctrl1[i]); 518 + hdmi_tx_chan_write(pll, i, 519 + REG_HDMI_PHY_QSERDES_TX_LX_VMODE_CTRL2, 520 + cfg.tx_lx_vmode_ctrl2[i]); 521 + hdmi_tx_chan_write(pll, i, 522 + REG_HDMI_PHY_QSERDES_TX_LX_TX_DRV_LVL_OFFSET, 523 + 0x00); 524 + hdmi_tx_chan_write(pll, i, 525 + REG_HDMI_PHY_QSERDES_TX_LX_RES_CODE_LANE_OFFSET, 526 + 0x00); 527 + hdmi_tx_chan_write(pll, i, 528 + REG_HDMI_PHY_QSERDES_TX_LX_TRAN_DRVR_EMP_EN, 529 + 0x03); 530 + hdmi_tx_chan_write(pll, i, 531 + REG_HDMI_PHY_QSERDES_TX_LX_PARRATE_REC_DETECT_IDLE_EN, 532 + 0x40); 533 + hdmi_tx_chan_write(pll, i, 534 + REG_HDMI_PHY_QSERDES_TX_LX_HP_PD_ENABLES, 535 + cfg.tx_lx_hp_pd_enables[i]); 536 + } 537 + 538 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_MODE, cfg.phy_mode); 539 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_PD_CTL, 0x1F); 540 + 541 + /* 542 + * Ensure that vco configuration gets flushed to hardware before 543 + * enabling the PLL 544 + */ 545 + wmb(); 546 + 547 + return 0; 548 + } 549 + 550 + static int hdmi_8996_phy_ready_status(struct hdmi_phy *phy) 551 + { 552 + u32 nb_tries = HDMI_PLL_POLL_MAX_READS; 553 + unsigned long timeout = HDMI_PLL_POLL_TIMEOUT_US; 554 + u32 status; 555 + int phy_ready = 0; 556 + 557 + DBG("Waiting for PHY ready"); 558 + 559 + while (nb_tries--) { 560 + status = hdmi_phy_read(phy, REG_HDMI_8996_PHY_STATUS); 561 + phy_ready = status & BIT(0); 562 + 563 + if (phy_ready) 564 + break; 565 + 566 + udelay(timeout); 567 + } 568 + 569 + DBG("PHY is %sready", phy_ready ? "" : "*not* "); 570 + 571 + return phy_ready; 572 + } 573 + 574 + static int hdmi_8996_pll_lock_status(struct hdmi_pll_8996 *pll) 575 + { 576 + u32 status; 577 + int nb_tries = HDMI_PLL_POLL_MAX_READS; 578 + unsigned long timeout = HDMI_PLL_POLL_TIMEOUT_US; 579 + int pll_locked = 0; 580 + 581 + DBG("Waiting for PLL lock"); 582 + 583 + while (nb_tries--) { 584 + status = hdmi_pll_read(pll, 585 + REG_HDMI_PHY_QSERDES_COM_C_READY_STATUS); 586 + pll_locked = status & BIT(0); 587 + 588 + if (pll_locked) 589 + break; 590 + 591 + udelay(timeout); 592 + } 593 + 594 + DBG("HDMI PLL is %slocked", pll_locked ? "" : "*not* "); 595 + 596 + return pll_locked; 597 + } 598 + 599 + static int hdmi_8996_pll_prepare(struct clk_hw *hw) 600 + { 601 + struct hdmi_pll_8996 *pll = hw_clk_to_pll(hw); 602 + struct hdmi_phy *phy = pll_get_phy(pll); 603 + int i, ret = 0; 604 + 605 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_CFG, 0x1); 606 + udelay(100); 607 + 608 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_CFG, 0x19); 609 + udelay(100); 610 + 611 + ret = hdmi_8996_pll_lock_status(pll); 612 + if (!ret) 613 + return ret; 614 + 615 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) 616 + hdmi_tx_chan_write(pll, i, 617 + REG_HDMI_PHY_QSERDES_TX_LX_HIGHZ_TRANSCEIVEREN_BIAS_DRVR_EN, 618 + 0x6F); 619 + 620 + /* Disable SSC */ 621 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SSC_PER1, 0x0); 622 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SSC_PER2, 0x0); 623 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SSC_STEP_SIZE1, 0x0); 624 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SSC_STEP_SIZE2, 0x0); 625 + hdmi_pll_write(pll, REG_HDMI_PHY_QSERDES_COM_SSC_EN_CENTER, 0x2); 626 + 627 + ret = hdmi_8996_phy_ready_status(phy); 628 + if (!ret) 629 + return ret; 630 + 631 + /* Restart the retiming buffer */ 632 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_CFG, 0x18); 633 + udelay(1); 634 + hdmi_phy_write(phy, REG_HDMI_8996_PHY_CFG, 0x19); 635 + 636 + return 0; 637 + } 638 + 639 + static long hdmi_8996_pll_round_rate(struct clk_hw *hw, 640 + unsigned long rate, 641 + unsigned long *parent_rate) 642 + { 643 + if (rate < HDMI_PCLK_MIN_FREQ) 644 + return HDMI_PCLK_MIN_FREQ; 645 + else if (rate > HDMI_PCLK_MAX_FREQ) 646 + return HDMI_PCLK_MAX_FREQ; 647 + else 648 + return rate; 649 + } 650 + 651 + static unsigned long hdmi_8996_pll_recalc_rate(struct clk_hw *hw, 652 + unsigned long parent_rate) 653 + { 654 + struct hdmi_pll_8996 *pll = hw_clk_to_pll(hw); 655 + u64 fdata; 656 + u32 cmp1, cmp2, cmp3, pll_cmp; 657 + 658 + cmp1 = hdmi_pll_read(pll, REG_HDMI_PHY_QSERDES_COM_LOCK_CMP1_MODE0); 659 + cmp2 = hdmi_pll_read(pll, REG_HDMI_PHY_QSERDES_COM_LOCK_CMP2_MODE0); 660 + cmp3 = hdmi_pll_read(pll, REG_HDMI_PHY_QSERDES_COM_LOCK_CMP3_MODE0); 661 + 662 + pll_cmp = cmp1 | (cmp2 << 8) | (cmp3 << 16); 663 + 664 + fdata = pll_cmp_to_fdata(pll_cmp + 1, parent_rate); 665 + 666 + do_div(fdata, 10); 667 + 668 + return fdata; 669 + } 670 + 671 + static void hdmi_8996_pll_unprepare(struct clk_hw *hw) 672 + { 673 + } 674 + 675 + static int hdmi_8996_pll_is_enabled(struct clk_hw *hw) 676 + { 677 + struct hdmi_pll_8996 *pll = hw_clk_to_pll(hw); 678 + u32 status; 679 + int pll_locked; 680 + 681 + status = hdmi_pll_read(pll, REG_HDMI_PHY_QSERDES_COM_C_READY_STATUS); 682 + pll_locked = status & BIT(0); 683 + 684 + return pll_locked; 685 + } 686 + 687 + static struct clk_ops hdmi_8996_pll_ops = { 688 + .set_rate = hdmi_8996_pll_set_clk_rate, 689 + .round_rate = hdmi_8996_pll_round_rate, 690 + .recalc_rate = hdmi_8996_pll_recalc_rate, 691 + .prepare = hdmi_8996_pll_prepare, 692 + .unprepare = hdmi_8996_pll_unprepare, 693 + .is_enabled = hdmi_8996_pll_is_enabled, 694 + }; 695 + 696 + static const char * const hdmi_pll_parents[] = { 697 + "xo", 698 + }; 699 + 700 + static struct clk_init_data pll_init = { 701 + .name = "hdmipll", 702 + .ops = &hdmi_8996_pll_ops, 703 + .parent_names = hdmi_pll_parents, 704 + .num_parents = ARRAY_SIZE(hdmi_pll_parents), 705 + }; 706 + 707 + int msm_hdmi_pll_8996_init(struct platform_device *pdev) 708 + { 709 + struct device *dev = &pdev->dev; 710 + struct hdmi_pll_8996 *pll; 711 + struct clk *clk; 712 + int i; 713 + 714 + pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); 715 + if (!pll) 716 + return -ENOMEM; 717 + 718 + pll->pdev = pdev; 719 + 720 + pll->mmio_qserdes_com = msm_ioremap(pdev, "hdmi_pll", "HDMI_PLL"); 721 + if (IS_ERR(pll->mmio_qserdes_com)) { 722 + dev_err(dev, "failed to map pll base\n"); 723 + return -ENOMEM; 724 + } 725 + 726 + for (i = 0; i < HDMI_NUM_TX_CHANNEL; i++) { 727 + char name[32], label[32]; 728 + 729 + snprintf(name, sizeof(name), "hdmi_tx_l%d", i); 730 + snprintf(label, sizeof(label), "HDMI_TX_L%d", i); 731 + 732 + pll->mmio_qserdes_tx[i] = msm_ioremap(pdev, name, label); 733 + if (IS_ERR(pll->mmio_qserdes_tx[i])) { 734 + dev_err(dev, "failed to map pll base\n"); 735 + return -ENOMEM; 736 + } 737 + } 738 + pll->clk_hw.init = &pll_init; 739 + 740 + clk = devm_clk_register(dev, &pll->clk_hw); 741 + if (IS_ERR(clk)) { 742 + dev_err(dev, "failed to register pll clock\n"); 743 + return -EINVAL; 744 + } 745 + 746 + return 0; 747 + } 748 + 749 + static const char * const hdmi_phy_8996_reg_names[] = { 750 + "vddio", 751 + "vcca", 752 + }; 753 + 754 + static const char * const hdmi_phy_8996_clk_names[] = { 755 + "mmagic_iface_clk", 756 + "iface_clk", 757 + "ref_clk", 758 + }; 759 + 760 + const struct hdmi_phy_cfg msm_hdmi_phy_8996_cfg = { 761 + .type = MSM_HDMI_PHY_8996, 762 + .reg_names = hdmi_phy_8996_reg_names, 763 + .num_regs = ARRAY_SIZE(hdmi_phy_8996_reg_names), 764 + .clk_names = hdmi_phy_8996_clk_names, 765 + .num_clks = ARRAY_SIZE(hdmi_phy_8996_clk_names), 766 + };
+75 -119
drivers/gpu/drm/msm/hdmi/hdmi_phy_8x60.c
··· 17 17 18 18 #include "hdmi.h" 19 19 20 - struct hdmi_phy_8x60 { 21 - struct hdmi_phy base; 22 - struct hdmi *hdmi; 23 - }; 24 - #define to_hdmi_phy_8x60(x) container_of(x, struct hdmi_phy_8x60, base) 25 - 26 - static void hdmi_phy_8x60_destroy(struct hdmi_phy *phy) 27 - { 28 - struct hdmi_phy_8x60 *phy_8x60 = to_hdmi_phy_8x60(phy); 29 - kfree(phy_8x60); 30 - } 31 - 32 20 static void hdmi_phy_8x60_powerup(struct hdmi_phy *phy, 33 21 unsigned long int pixclock) 34 22 { 35 - struct hdmi_phy_8x60 *phy_8x60 = to_hdmi_phy_8x60(phy); 36 - struct hdmi *hdmi = phy_8x60->hdmi; 37 - 38 23 /* De-serializer delay D/C for non-lbk mode: */ 39 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG0, 40 - HDMI_8x60_PHY_REG0_DESER_DEL_CTRL(3)); 24 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG0, 25 + HDMI_8x60_PHY_REG0_DESER_DEL_CTRL(3)); 41 26 42 27 if (pixclock == 27000000) { 43 28 /* video_format == HDMI_VFRMT_720x480p60_16_9 */ 44 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG1, 45 - HDMI_8x60_PHY_REG1_DTEST_MUX_SEL(5) | 46 - HDMI_8x60_PHY_REG1_OUTVOL_SWING_CTRL(3)); 29 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG1, 30 + HDMI_8x60_PHY_REG1_DTEST_MUX_SEL(5) | 31 + HDMI_8x60_PHY_REG1_OUTVOL_SWING_CTRL(3)); 47 32 } else { 48 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG1, 49 - HDMI_8x60_PHY_REG1_DTEST_MUX_SEL(5) | 50 - HDMI_8x60_PHY_REG1_OUTVOL_SWING_CTRL(4)); 33 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG1, 34 + HDMI_8x60_PHY_REG1_DTEST_MUX_SEL(5) | 35 + HDMI_8x60_PHY_REG1_OUTVOL_SWING_CTRL(4)); 51 36 } 52 37 53 38 /* No matter what, start from the power down mode: */ 54 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG2, 55 - HDMI_8x60_PHY_REG2_PD_PWRGEN | 56 - HDMI_8x60_PHY_REG2_PD_PLL | 57 - HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 58 - HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 59 - HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 60 - HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 61 - HDMI_8x60_PHY_REG2_PD_DESER); 39 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG2, 40 + HDMI_8x60_PHY_REG2_PD_PWRGEN | 41 + HDMI_8x60_PHY_REG2_PD_PLL | 42 + HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 43 + HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 44 + HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 45 + HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 46 + HDMI_8x60_PHY_REG2_PD_DESER); 62 47 63 48 /* Turn PowerGen on: */ 64 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG2, 65 - HDMI_8x60_PHY_REG2_PD_PLL | 66 - HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 67 - HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 68 - HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 69 - HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 70 - HDMI_8x60_PHY_REG2_PD_DESER); 49 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG2, 50 + HDMI_8x60_PHY_REG2_PD_PLL | 51 + HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 52 + HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 53 + HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 54 + HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 55 + HDMI_8x60_PHY_REG2_PD_DESER); 71 56 72 57 /* Turn PLL power on: */ 73 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG2, 74 - HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 75 - HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 76 - HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 77 - HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 78 - HDMI_8x60_PHY_REG2_PD_DESER); 58 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG2, 59 + HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 60 + HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 61 + HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 62 + HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 63 + HDMI_8x60_PHY_REG2_PD_DESER); 79 64 80 65 /* Write to HIGH after PLL power down de-assert: */ 81 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG3, 82 - HDMI_8x60_PHY_REG3_PLL_ENABLE); 66 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG3, 67 + HDMI_8x60_PHY_REG3_PLL_ENABLE); 83 68 84 69 /* ASIC power on; PHY REG9 = 0 */ 85 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG9, 0); 70 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG9, 0); 86 71 87 72 /* Enable PLL lock detect, PLL lock det will go high after lock 88 73 * Enable the re-time logic 89 74 */ 90 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG12, 91 - HDMI_8x60_PHY_REG12_RETIMING_EN | 92 - HDMI_8x60_PHY_REG12_PLL_LOCK_DETECT_EN); 75 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG12, 76 + HDMI_8x60_PHY_REG12_RETIMING_EN | 77 + HDMI_8x60_PHY_REG12_PLL_LOCK_DETECT_EN); 93 78 94 79 /* Drivers are on: */ 95 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG2, 96 - HDMI_8x60_PHY_REG2_PD_DESER); 80 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG2, 81 + HDMI_8x60_PHY_REG2_PD_DESER); 97 82 98 83 /* If the RX detector is needed: */ 99 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG2, 100 - HDMI_8x60_PHY_REG2_RCV_SENSE_EN | 101 - HDMI_8x60_PHY_REG2_PD_DESER); 84 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG2, 85 + HDMI_8x60_PHY_REG2_RCV_SENSE_EN | 86 + HDMI_8x60_PHY_REG2_PD_DESER); 102 87 103 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG4, 0); 104 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG5, 0); 105 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG6, 0); 106 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG7, 0); 107 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG8, 0); 108 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG9, 0); 109 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG10, 0); 110 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG11, 0); 88 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG4, 0); 89 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG5, 0); 90 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG6, 0); 91 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG7, 0); 92 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG8, 0); 93 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG9, 0); 94 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG10, 0); 95 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG11, 0); 111 96 112 97 /* If we want to use lock enable based on counting: */ 113 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG12, 114 - HDMI_8x60_PHY_REG12_RETIMING_EN | 115 - HDMI_8x60_PHY_REG12_PLL_LOCK_DETECT_EN | 116 - HDMI_8x60_PHY_REG12_FORCE_LOCK); 98 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG12, 99 + HDMI_8x60_PHY_REG12_RETIMING_EN | 100 + HDMI_8x60_PHY_REG12_PLL_LOCK_DETECT_EN | 101 + HDMI_8x60_PHY_REG12_FORCE_LOCK); 117 102 } 118 103 119 104 static void hdmi_phy_8x60_powerdown(struct hdmi_phy *phy) 120 105 { 121 - struct hdmi_phy_8x60 *phy_8x60 = to_hdmi_phy_8x60(phy); 122 - struct hdmi *hdmi = phy_8x60->hdmi; 123 - 124 106 /* Assert RESET PHY from controller */ 125 - hdmi_write(hdmi, REG_HDMI_PHY_CTRL, 126 - HDMI_PHY_CTRL_SW_RESET); 107 + hdmi_phy_write(phy, REG_HDMI_PHY_CTRL, 108 + HDMI_PHY_CTRL_SW_RESET); 127 109 udelay(10); 128 110 /* De-assert RESET PHY from controller */ 129 - hdmi_write(hdmi, REG_HDMI_PHY_CTRL, 0); 111 + hdmi_phy_write(phy, REG_HDMI_PHY_CTRL, 0); 130 112 /* Turn off Driver */ 131 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG2, 132 - HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 133 - HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 134 - HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 135 - HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 136 - HDMI_8x60_PHY_REG2_PD_DESER); 113 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG2, 114 + HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 115 + HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 116 + HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 117 + HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 118 + HDMI_8x60_PHY_REG2_PD_DESER); 137 119 udelay(10); 138 120 /* Disable PLL */ 139 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG3, 0); 121 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG3, 0); 140 122 /* Power down PHY, but keep RX-sense: */ 141 - hdmi_write(hdmi, REG_HDMI_8x60_PHY_REG2, 142 - HDMI_8x60_PHY_REG2_RCV_SENSE_EN | 143 - HDMI_8x60_PHY_REG2_PD_PWRGEN | 144 - HDMI_8x60_PHY_REG2_PD_PLL | 145 - HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 146 - HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 147 - HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 148 - HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 149 - HDMI_8x60_PHY_REG2_PD_DESER); 123 + hdmi_phy_write(phy, REG_HDMI_8x60_PHY_REG2, 124 + HDMI_8x60_PHY_REG2_RCV_SENSE_EN | 125 + HDMI_8x60_PHY_REG2_PD_PWRGEN | 126 + HDMI_8x60_PHY_REG2_PD_PLL | 127 + HDMI_8x60_PHY_REG2_PD_DRIVE_4 | 128 + HDMI_8x60_PHY_REG2_PD_DRIVE_3 | 129 + HDMI_8x60_PHY_REG2_PD_DRIVE_2 | 130 + HDMI_8x60_PHY_REG2_PD_DRIVE_1 | 131 + HDMI_8x60_PHY_REG2_PD_DESER); 150 132 } 151 133 152 - static const struct hdmi_phy_funcs hdmi_phy_8x60_funcs = { 153 - .destroy = hdmi_phy_8x60_destroy, 154 - .powerup = hdmi_phy_8x60_powerup, 155 - .powerdown = hdmi_phy_8x60_powerdown, 134 + const struct hdmi_phy_cfg msm_hdmi_phy_8x60_cfg = { 135 + .type = MSM_HDMI_PHY_8x60, 136 + .powerup = hdmi_phy_8x60_powerup, 137 + .powerdown = hdmi_phy_8x60_powerdown, 156 138 }; 157 - 158 - struct hdmi_phy *hdmi_phy_8x60_init(struct hdmi *hdmi) 159 - { 160 - struct hdmi_phy_8x60 *phy_8x60; 161 - struct hdmi_phy *phy = NULL; 162 - int ret; 163 - 164 - phy_8x60 = kzalloc(sizeof(*phy_8x60), GFP_KERNEL); 165 - if (!phy_8x60) { 166 - ret = -ENOMEM; 167 - goto fail; 168 - } 169 - 170 - phy = &phy_8x60->base; 171 - 172 - phy->funcs = &hdmi_phy_8x60_funcs; 173 - 174 - phy_8x60->hdmi = hdmi; 175 - 176 - return phy; 177 - 178 - fail: 179 - if (phy) 180 - hdmi_phy_8x60_destroy(phy); 181 - return ERR_PTR(ret); 182 - }
+25 -69
drivers/gpu/drm/msm/hdmi/hdmi_phy_8x74.c
··· 17 17 18 18 #include "hdmi.h" 19 19 20 - struct hdmi_phy_8x74 { 21 - struct hdmi_phy base; 22 - void __iomem *mmio; 23 - }; 24 - #define to_hdmi_phy_8x74(x) container_of(x, struct hdmi_phy_8x74, base) 25 - 26 - 27 - static void phy_write(struct hdmi_phy_8x74 *phy, u32 reg, u32 data) 28 - { 29 - msm_writel(data, phy->mmio + reg); 30 - } 31 - 32 - //static u32 phy_read(struct hdmi_phy_8x74 *phy, u32 reg) 33 - //{ 34 - // return msm_readl(phy->mmio + reg); 35 - //} 36 - 37 - static void hdmi_phy_8x74_destroy(struct hdmi_phy *phy) 38 - { 39 - struct hdmi_phy_8x74 *phy_8x74 = to_hdmi_phy_8x74(phy); 40 - kfree(phy_8x74); 41 - } 42 - 43 20 static void hdmi_phy_8x74_powerup(struct hdmi_phy *phy, 44 21 unsigned long int pixclock) 45 22 { 46 - struct hdmi_phy_8x74 *phy_8x74 = to_hdmi_phy_8x74(phy); 47 - 48 - phy_write(phy_8x74, REG_HDMI_8x74_ANA_CFG0, 0x1b); 49 - phy_write(phy_8x74, REG_HDMI_8x74_ANA_CFG1, 0xf2); 50 - phy_write(phy_8x74, REG_HDMI_8x74_BIST_CFG0, 0x0); 51 - phy_write(phy_8x74, REG_HDMI_8x74_BIST_PATN0, 0x0); 52 - phy_write(phy_8x74, REG_HDMI_8x74_BIST_PATN1, 0x0); 53 - phy_write(phy_8x74, REG_HDMI_8x74_BIST_PATN2, 0x0); 54 - phy_write(phy_8x74, REG_HDMI_8x74_BIST_PATN3, 0x0); 55 - phy_write(phy_8x74, REG_HDMI_8x74_PD_CTRL1, 0x20); 23 + hdmi_phy_write(phy, REG_HDMI_8x74_ANA_CFG0, 0x1b); 24 + hdmi_phy_write(phy, REG_HDMI_8x74_ANA_CFG1, 0xf2); 25 + hdmi_phy_write(phy, REG_HDMI_8x74_BIST_CFG0, 0x0); 26 + hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN0, 0x0); 27 + hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN1, 0x0); 28 + hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN2, 0x0); 29 + hdmi_phy_write(phy, REG_HDMI_8x74_BIST_PATN3, 0x0); 30 + hdmi_phy_write(phy, REG_HDMI_8x74_PD_CTRL1, 0x20); 56 31 } 57 32 58 33 static void hdmi_phy_8x74_powerdown(struct hdmi_phy *phy) 59 34 { 60 - struct hdmi_phy_8x74 *phy_8x74 = to_hdmi_phy_8x74(phy); 61 - phy_write(phy_8x74, REG_HDMI_8x74_PD_CTRL0, 0x7f); 35 + hdmi_phy_write(phy, REG_HDMI_8x74_PD_CTRL0, 0x7f); 62 36 } 63 37 64 - static const struct hdmi_phy_funcs hdmi_phy_8x74_funcs = { 65 - .destroy = hdmi_phy_8x74_destroy, 66 - .powerup = hdmi_phy_8x74_powerup, 67 - .powerdown = hdmi_phy_8x74_powerdown, 38 + static const char * const hdmi_phy_8x74_reg_names[] = { 39 + "core-vdda", 40 + "vddio", 68 41 }; 69 42 70 - struct hdmi_phy *hdmi_phy_8x74_init(struct hdmi *hdmi) 71 - { 72 - struct hdmi_phy_8x74 *phy_8x74; 73 - struct hdmi_phy *phy = NULL; 74 - int ret; 43 + static const char * const hdmi_phy_8x74_clk_names[] = { 44 + "iface_clk", 45 + "alt_iface_clk" 46 + }; 75 47 76 - phy_8x74 = kzalloc(sizeof(*phy_8x74), GFP_KERNEL); 77 - if (!phy_8x74) { 78 - ret = -ENOMEM; 79 - goto fail; 80 - } 81 - 82 - phy = &phy_8x74->base; 83 - 84 - phy->funcs = &hdmi_phy_8x74_funcs; 85 - 86 - /* for 8x74, the phy mmio is mapped separately: */ 87 - phy_8x74->mmio = msm_ioremap(hdmi->pdev, 88 - "phy_physical", "HDMI_8x74"); 89 - if (IS_ERR(phy_8x74->mmio)) { 90 - ret = PTR_ERR(phy_8x74->mmio); 91 - goto fail; 92 - } 93 - 94 - return phy; 95 - 96 - fail: 97 - if (phy) 98 - hdmi_phy_8x74_destroy(phy); 99 - return ERR_PTR(ret); 100 - } 48 + const struct hdmi_phy_cfg msm_hdmi_phy_8x74_cfg = { 49 + .type = MSM_HDMI_PHY_8x74, 50 + .powerup = hdmi_phy_8x74_powerup, 51 + .powerdown = hdmi_phy_8x74_powerdown, 52 + .reg_names = hdmi_phy_8x74_reg_names, 53 + .num_regs = ARRAY_SIZE(hdmi_phy_8x74_reg_names), 54 + .clk_names = hdmi_phy_8x74_clk_names, 55 + .num_clks = ARRAY_SIZE(hdmi_phy_8x74_clk_names), 56 + };
+461
drivers/gpu/drm/msm/hdmi/hdmi_pll_8960.c
··· 1 + /* 2 + * Copyright (c) 2016, The Linux Foundation. All rights reserved. 3 + * Copyright (C) 2013 Red Hat 4 + * Author: Rob Clark <robdclark@gmail.com> 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License version 2 as published by 8 + * the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope that it will be useful, but WITHOUT 11 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 13 + * more details. 14 + * 15 + * You should have received a copy of the GNU General Public License along with 16 + * this program. If not, see <http://www.gnu.org/licenses/>. 17 + */ 18 + 19 + #include <linux/clk-provider.h> 20 + #include "hdmi.h" 21 + 22 + struct hdmi_pll_8960 { 23 + struct platform_device *pdev; 24 + struct clk_hw clk_hw; 25 + void __iomem *mmio; 26 + 27 + unsigned long pixclk; 28 + }; 29 + 30 + #define hw_clk_to_pll(x) container_of(x, struct hdmi_pll_8960, clk_hw) 31 + 32 + /* 33 + * HDMI PLL: 34 + * 35 + * To get the parent clock setup properly, we need to plug in hdmi pll 36 + * configuration into common-clock-framework. 37 + */ 38 + 39 + struct pll_rate { 40 + unsigned long rate; 41 + int num_reg; 42 + struct { 43 + u32 val; 44 + u32 reg; 45 + } conf[32]; 46 + }; 47 + 48 + /* NOTE: keep sorted highest freq to lowest: */ 49 + static const struct pll_rate freqtbl[] = { 50 + { 154000000, 14, { 51 + { 0x08, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 52 + { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 53 + { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 54 + { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 55 + { 0x03, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 56 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 57 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 58 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 59 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 60 + { 0x0d, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 61 + { 0x4d, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 62 + { 0x5e, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 63 + { 0x42, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 64 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 65 + } 66 + }, 67 + /* 1080p60/1080p50 case */ 68 + { 148500000, 27, { 69 + { 0x02, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 70 + { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 71 + { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 72 + { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 73 + { 0x2c, REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG }, 74 + { 0x06, REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG }, 75 + { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 76 + { 0x76, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 77 + { 0x01, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 78 + { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 79 + { 0xc0, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 80 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 81 + { 0x9a, REG_HDMI_8960_PHY_PLL_SSC_CFG0 }, 82 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG1 }, 83 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG2 }, 84 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG3 }, 85 + { 0x10, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 }, 86 + { 0x1a, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 }, 87 + { 0x0d, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 }, 88 + { 0xe6, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 89 + { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 90 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 91 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 92 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 93 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 94 + { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 95 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 96 + } 97 + }, 98 + { 108000000, 13, { 99 + { 0x08, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 100 + { 0x21, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 101 + { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 102 + { 0x1c, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 103 + { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 104 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 105 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 106 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 107 + { 0x49, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 108 + { 0x49, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 109 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 110 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 111 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 112 + } 113 + }, 114 + /* 720p60/720p50/1080i60/1080i50/1080p24/1080p30/1080p25 */ 115 + { 74250000, 8, { 116 + { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 117 + { 0x12, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 118 + { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 119 + { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 120 + { 0x76, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 121 + { 0xe6, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 122 + { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 123 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 124 + } 125 + }, 126 + { 74176000, 14, { 127 + { 0x18, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 128 + { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 129 + { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 130 + { 0xe5, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 131 + { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 132 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 133 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 134 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 135 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 136 + { 0x0c, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 137 + { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 138 + { 0x7d, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 139 + { 0xbc, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 140 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 141 + } 142 + }, 143 + { 65000000, 14, { 144 + { 0x18, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 145 + { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 146 + { 0xf9, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 147 + { 0x8a, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 148 + { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 149 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 150 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 151 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 152 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 153 + { 0x0b, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 154 + { 0x4b, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 155 + { 0x7b, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 156 + { 0x09, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 157 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 158 + } 159 + }, 160 + /* 480p60/480i60 */ 161 + { 27030000, 18, { 162 + { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 163 + { 0x38, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 164 + { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 165 + { 0x20, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 166 + { 0xff, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 167 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 168 + { 0x4e, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 169 + { 0xd7, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 170 + { 0x03, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 171 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 172 + { 0x2a, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 173 + { 0x03, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 174 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 175 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 176 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 177 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 178 + { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 179 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 180 + } 181 + }, 182 + /* 576p50/576i50 */ 183 + { 27000000, 27, { 184 + { 0x32, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 185 + { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 186 + { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 187 + { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 188 + { 0x2c, REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG }, 189 + { 0x06, REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG }, 190 + { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 191 + { 0x7b, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 192 + { 0x01, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 193 + { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 194 + { 0xc0, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 195 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 196 + { 0x9a, REG_HDMI_8960_PHY_PLL_SSC_CFG0 }, 197 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG1 }, 198 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG2 }, 199 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG3 }, 200 + { 0x10, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 }, 201 + { 0x1a, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 }, 202 + { 0x0d, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 }, 203 + { 0x2a, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 204 + { 0x03, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 205 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 206 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 207 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 208 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 209 + { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 210 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 211 + } 212 + }, 213 + /* 640x480p60 */ 214 + { 25200000, 27, { 215 + { 0x32, REG_HDMI_8960_PHY_PLL_REFCLK_CFG }, 216 + { 0x02, REG_HDMI_8960_PHY_PLL_CHRG_PUMP_CFG }, 217 + { 0x01, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG0 }, 218 + { 0x33, REG_HDMI_8960_PHY_PLL_LOOP_FLT_CFG1 }, 219 + { 0x2c, REG_HDMI_8960_PHY_PLL_IDAC_ADJ_CFG }, 220 + { 0x06, REG_HDMI_8960_PHY_PLL_I_VI_KVCO_CFG }, 221 + { 0x0a, REG_HDMI_8960_PHY_PLL_PWRDN_B }, 222 + { 0x77, REG_HDMI_8960_PHY_PLL_SDM_CFG0 }, 223 + { 0x4c, REG_HDMI_8960_PHY_PLL_SDM_CFG1 }, 224 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG2 }, 225 + { 0xc0, REG_HDMI_8960_PHY_PLL_SDM_CFG3 }, 226 + { 0x00, REG_HDMI_8960_PHY_PLL_SDM_CFG4 }, 227 + { 0x9a, REG_HDMI_8960_PHY_PLL_SSC_CFG0 }, 228 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG1 }, 229 + { 0x00, REG_HDMI_8960_PHY_PLL_SSC_CFG2 }, 230 + { 0x20, REG_HDMI_8960_PHY_PLL_SSC_CFG3 }, 231 + { 0x10, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0 }, 232 + { 0x1a, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1 }, 233 + { 0x0d, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2 }, 234 + { 0xf4, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG0 }, 235 + { 0x02, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG1 }, 236 + { 0x3b, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG2 }, 237 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG3 }, 238 + { 0x86, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG4 }, 239 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG5 }, 240 + { 0x33, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG6 }, 241 + { 0x00, REG_HDMI_8960_PHY_PLL_VCOCAL_CFG7 }, 242 + } 243 + }, 244 + }; 245 + 246 + static inline void pll_write(struct hdmi_pll_8960 *pll, u32 reg, u32 data) 247 + { 248 + msm_writel(data, pll->mmio + reg); 249 + } 250 + 251 + static inline u32 pll_read(struct hdmi_pll_8960 *pll, u32 reg) 252 + { 253 + return msm_readl(pll->mmio + reg); 254 + } 255 + 256 + static inline struct hdmi_phy *pll_get_phy(struct hdmi_pll_8960 *pll) 257 + { 258 + return platform_get_drvdata(pll->pdev); 259 + } 260 + 261 + static int hdmi_pll_enable(struct clk_hw *hw) 262 + { 263 + struct hdmi_pll_8960 *pll = hw_clk_to_pll(hw); 264 + struct hdmi_phy *phy = pll_get_phy(pll); 265 + int timeout_count, pll_lock_retry = 10; 266 + unsigned int val; 267 + 268 + DBG(""); 269 + 270 + /* Assert PLL S/W reset */ 271 + pll_write(pll, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x8d); 272 + pll_write(pll, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG0, 0x10); 273 + pll_write(pll, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG1, 0x1a); 274 + 275 + /* Wait for a short time before de-asserting 276 + * to allow the hardware to complete its job. 277 + * This much of delay should be fine for hardware 278 + * to assert and de-assert. 279 + */ 280 + udelay(10); 281 + 282 + /* De-assert PLL S/W reset */ 283 + pll_write(pll, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x0d); 284 + 285 + val = hdmi_phy_read(phy, REG_HDMI_8960_PHY_REG12); 286 + val |= HDMI_8960_PHY_REG12_SW_RESET; 287 + /* Assert PHY S/W reset */ 288 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG12, val); 289 + val &= ~HDMI_8960_PHY_REG12_SW_RESET; 290 + /* 291 + * Wait for a short time before de-asserting to allow the hardware to 292 + * complete its job. This much of delay should be fine for hardware to 293 + * assert and de-assert. 294 + */ 295 + udelay(10); 296 + /* De-assert PHY S/W reset */ 297 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG12, val); 298 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG2, 0x3f); 299 + 300 + val = hdmi_phy_read(phy, REG_HDMI_8960_PHY_REG12); 301 + val |= HDMI_8960_PHY_REG12_PWRDN_B; 302 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG12, val); 303 + /* Wait 10 us for enabling global power for PHY */ 304 + mb(); 305 + udelay(10); 306 + 307 + val = pll_read(pll, REG_HDMI_8960_PHY_PLL_PWRDN_B); 308 + val |= HDMI_8960_PHY_PLL_PWRDN_B_PLL_PWRDN_B; 309 + val &= ~HDMI_8960_PHY_PLL_PWRDN_B_PD_PLL; 310 + pll_write(pll, REG_HDMI_8960_PHY_PLL_PWRDN_B, val); 311 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG2, 0x80); 312 + 313 + timeout_count = 1000; 314 + while (--pll_lock_retry > 0) { 315 + /* are we there yet? */ 316 + val = pll_read(pll, REG_HDMI_8960_PHY_PLL_STATUS0); 317 + if (val & HDMI_8960_PHY_PLL_STATUS0_PLL_LOCK) 318 + break; 319 + 320 + udelay(1); 321 + 322 + if (--timeout_count > 0) 323 + continue; 324 + 325 + /* 326 + * PLL has still not locked. 327 + * Do a software reset and try again 328 + * Assert PLL S/W reset first 329 + */ 330 + pll_write(pll, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x8d); 331 + udelay(10); 332 + pll_write(pll, REG_HDMI_8960_PHY_PLL_LOCKDET_CFG2, 0x0d); 333 + 334 + /* 335 + * Wait for a short duration for the PLL calibration 336 + * before checking if the PLL gets locked 337 + */ 338 + udelay(350); 339 + 340 + timeout_count = 1000; 341 + } 342 + 343 + return 0; 344 + } 345 + 346 + static void hdmi_pll_disable(struct clk_hw *hw) 347 + { 348 + struct hdmi_pll_8960 *pll = hw_clk_to_pll(hw); 349 + struct hdmi_phy *phy = pll_get_phy(pll); 350 + unsigned int val; 351 + 352 + DBG(""); 353 + 354 + val = hdmi_phy_read(phy, REG_HDMI_8960_PHY_REG12); 355 + val &= ~HDMI_8960_PHY_REG12_PWRDN_B; 356 + hdmi_phy_write(phy, REG_HDMI_8960_PHY_REG12, val); 357 + 358 + val = pll_read(pll, REG_HDMI_8960_PHY_PLL_PWRDN_B); 359 + val |= HDMI_8960_PHY_REG12_SW_RESET; 360 + val &= ~HDMI_8960_PHY_REG12_PWRDN_B; 361 + pll_write(pll, REG_HDMI_8960_PHY_PLL_PWRDN_B, val); 362 + /* Make sure HDMI PHY/PLL are powered down */ 363 + mb(); 364 + } 365 + 366 + static const struct pll_rate *find_rate(unsigned long rate) 367 + { 368 + int i; 369 + 370 + for (i = 1; i < ARRAY_SIZE(freqtbl); i++) 371 + if (rate > freqtbl[i].rate) 372 + return &freqtbl[i - 1]; 373 + 374 + return &freqtbl[i - 1]; 375 + } 376 + 377 + static unsigned long hdmi_pll_recalc_rate(struct clk_hw *hw, 378 + unsigned long parent_rate) 379 + { 380 + struct hdmi_pll_8960 *pll = hw_clk_to_pll(hw); 381 + 382 + return pll->pixclk; 383 + } 384 + 385 + static long hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, 386 + unsigned long *parent_rate) 387 + { 388 + const struct pll_rate *pll_rate = find_rate(rate); 389 + 390 + return pll_rate->rate; 391 + } 392 + 393 + static int hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, 394 + unsigned long parent_rate) 395 + { 396 + struct hdmi_pll_8960 *pll = hw_clk_to_pll(hw); 397 + const struct pll_rate *pll_rate = find_rate(rate); 398 + int i; 399 + 400 + DBG("rate=%lu", rate); 401 + 402 + for (i = 0; i < pll_rate->num_reg; i++) 403 + pll_write(pll, pll_rate->conf[i].reg, pll_rate->conf[i].val); 404 + 405 + pll->pixclk = rate; 406 + 407 + return 0; 408 + } 409 + 410 + static const struct clk_ops hdmi_pll_ops = { 411 + .enable = hdmi_pll_enable, 412 + .disable = hdmi_pll_disable, 413 + .recalc_rate = hdmi_pll_recalc_rate, 414 + .round_rate = hdmi_pll_round_rate, 415 + .set_rate = hdmi_pll_set_rate, 416 + }; 417 + 418 + static const char * const hdmi_pll_parents[] = { 419 + "pxo", 420 + }; 421 + 422 + static struct clk_init_data pll_init = { 423 + .name = "hdmi_pll", 424 + .ops = &hdmi_pll_ops, 425 + .parent_names = hdmi_pll_parents, 426 + .num_parents = ARRAY_SIZE(hdmi_pll_parents), 427 + }; 428 + 429 + int msm_hdmi_pll_8960_init(struct platform_device *pdev) 430 + { 431 + struct device *dev = &pdev->dev; 432 + struct hdmi_pll_8960 *pll; 433 + struct clk *clk; 434 + int i; 435 + 436 + /* sanity check: */ 437 + for (i = 0; i < (ARRAY_SIZE(freqtbl) - 1); i++) 438 + if (WARN_ON(freqtbl[i].rate < freqtbl[i + 1].rate)) 439 + return -EINVAL; 440 + 441 + pll = devm_kzalloc(dev, sizeof(*pll), GFP_KERNEL); 442 + if (!pll) 443 + return -ENOMEM; 444 + 445 + pll->mmio = msm_ioremap(pdev, "hdmi_pll", "HDMI_PLL"); 446 + if (IS_ERR(pll->mmio)) { 447 + dev_err(dev, "failed to map pll base\n"); 448 + return -ENOMEM; 449 + } 450 + 451 + pll->pdev = pdev; 452 + pll->clk_hw.init = &pll_init; 453 + 454 + clk = devm_clk_register(dev, &pll->clk_hw); 455 + if (IS_ERR(clk)) { 456 + dev_err(dev, "failed to register pll clock\n"); 457 + return -EINVAL; 458 + } 459 + 460 + return 0; 461 + }
+3 -2
drivers/gpu/drm/msm/hdmi/qfprom.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+3 -2
drivers/gpu/drm/msm/mdp/mdp4/mdp4.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+1 -8
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
··· 361 361 request_pending(crtc, PENDING_FLIP); 362 362 } 363 363 364 - static int mdp4_crtc_set_property(struct drm_crtc *crtc, 365 - struct drm_property *property, uint64_t val) 366 - { 367 - // XXX 368 - return -EINVAL; 369 - } 370 - 371 364 #define CURSOR_WIDTH 64 372 365 #define CURSOR_HEIGHT 64 373 366 ··· 492 499 .set_config = drm_atomic_helper_set_config, 493 500 .destroy = mdp4_crtc_destroy, 494 501 .page_flip = drm_atomic_helper_page_flip, 495 - .set_property = mdp4_crtc_set_property, 502 + .set_property = drm_atomic_helper_crtc_set_property, 496 503 .cursor_set = mdp4_crtc_cursor_set, 497 504 .cursor_move = mdp4_crtc_cursor_move, 498 505 .reset = drm_atomic_helper_crtc_reset,
+14 -5
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
··· 179 179 } 180 180 } 181 181 182 + static const char * const iommu_ports[] = { 183 + "mdp_port0_cb0", "mdp_port1_cb0", 184 + }; 185 + 182 186 static void mdp4_destroy(struct msm_kms *kms) 183 187 { 184 188 struct mdp4_kms *mdp4_kms = to_mdp4_kms(to_mdp_kms(kms)); 189 + struct msm_mmu *mmu = mdp4_kms->mmu; 190 + 191 + if (mmu) { 192 + mmu->funcs->detach(mmu, iommu_ports, ARRAY_SIZE(iommu_ports)); 193 + mmu->funcs->destroy(mmu); 194 + } 195 + 185 196 if (mdp4_kms->blank_cursor_iova) 186 197 msm_gem_put_iova(mdp4_kms->blank_cursor_bo, mdp4_kms->id); 187 198 if (mdp4_kms->blank_cursor_bo) ··· 326 315 327 316 if (priv->hdmi) { 328 317 /* Construct bridge/connector for HDMI: */ 329 - ret = hdmi_modeset_init(priv->hdmi, dev, encoder); 318 + ret = msm_hdmi_modeset_init(priv->hdmi, dev, encoder); 330 319 if (ret) { 331 320 dev_err(dev->dev, "failed to initialize HDMI: %d\n", ret); 332 321 return ret; ··· 457 446 return ret; 458 447 } 459 448 460 - static const char *iommu_ports[] = { 461 - "mdp_port0_cb0", "mdp_port1_cb0", 462 - }; 463 - 464 449 struct msm_kms *mdp4_kms_init(struct drm_device *dev) 465 450 { 466 451 struct platform_device *pdev = dev->platformdev; ··· 561 554 ARRAY_SIZE(iommu_ports)); 562 555 if (ret) 563 556 goto fail; 557 + 558 + mdp4_kms->mmu = mmu; 564 559 } else { 565 560 dev_info(dev->dev, "no iommu, fallback to phys " 566 561 "contig buffers for scanout\n");
+1
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.h
··· 45 45 struct clk *pclk; 46 46 struct clk *lut_clk; 47 47 struct clk *axi_clk; 48 + struct msm_mmu *mmu; 48 49 49 50 struct mdp_irq error_handler; 50 51
+3 -2
drivers/gpu/drm/msm/mdp/mdp5/mdp5.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+1 -8
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
··· 468 468 request_pending(crtc, PENDING_FLIP); 469 469 } 470 470 471 - static int mdp5_crtc_set_property(struct drm_crtc *crtc, 472 - struct drm_property *property, uint64_t val) 473 - { 474 - // XXX 475 - return -EINVAL; 476 - } 477 - 478 471 static void get_roi(struct drm_crtc *crtc, uint32_t *roi_w, uint32_t *roi_h) 479 472 { 480 473 struct mdp5_crtc *mdp5_crtc = to_mdp5_crtc(crtc); ··· 618 625 .set_config = drm_atomic_helper_set_config, 619 626 .destroy = mdp5_crtc_destroy, 620 627 .page_flip = drm_atomic_helper_page_flip, 621 - .set_property = mdp5_crtc_set_property, 628 + .set_property = drm_atomic_helper_crtc_set_property, 622 629 .reset = drm_atomic_helper_crtc_reset, 623 630 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, 624 631 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state,
+1 -1
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
··· 284 284 break; 285 285 } 286 286 287 - ret = hdmi_modeset_init(priv->hdmi, dev, encoder); 287 + ret = msm_hdmi_modeset_init(priv->hdmi, dev, encoder); 288 288 break; 289 289 case INTF_DSI: 290 290 {
+3 -2
drivers/gpu/drm/msm/mdp/mdp_common.xml.h
··· 9 9 10 10 The rules-ng-ng source files this header was generated from are: 11 11 - /home/robclark/src/freedreno/envytools/rnndb/msm.xml ( 676 bytes, from 2015-05-20 20:03:14) 12 - - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1453 bytes, from 2015-05-20 20:03:07) 12 + - /home/robclark/src/freedreno/envytools/rnndb/freedreno_copyright.xml ( 1572 bytes, from 2016-02-10 17:07:21) 13 13 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp4.xml ( 20915 bytes, from 2015-05-20 20:03:14) 14 14 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp_common.xml ( 2849 bytes, from 2015-09-18 12:07:28) 15 15 - /home/robclark/src/freedreno/envytools/rnndb/mdp/mdp5.xml ( 37194 bytes, from 2015-09-18 12:07:28) ··· 17 17 - /home/robclark/src/freedreno/envytools/rnndb/dsi/sfpb.xml ( 602 bytes, from 2015-10-22 16:35:02) 18 18 - /home/robclark/src/freedreno/envytools/rnndb/dsi/mmss_cc.xml ( 1686 bytes, from 2015-05-20 20:03:14) 19 19 - /home/robclark/src/freedreno/envytools/rnndb/hdmi/qfprom.xml ( 600 bytes, from 2015-05-20 20:03:07) 20 - - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 29154 bytes, from 2015-08-10 21:25:43) 20 + - /home/robclark/src/freedreno/envytools/rnndb/hdmi/hdmi.xml ( 41472 bytes, from 2016-01-22 18:18:18) 21 21 - /home/robclark/src/freedreno/envytools/rnndb/edp/edp.xml ( 10416 bytes, from 2015-05-20 20:03:14) 22 22 23 23 Copyright (C) 2013-2015 by the following authors: 24 24 - Rob Clark <robdclark@gmail.com> (robclark) 25 + - Ilia Mirkin <imirkin@alum.mit.edu> (imirkin) 25 26 26 27 Permission is hereby granted, free of charge, to any person obtaining 27 28 a copy of this software and associated documentation files (the
+8 -3
drivers/gpu/drm/msm/msm_drv.c
··· 61 61 #endif 62 62 63 63 static char *vram = "16m"; 64 - MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU"); 64 + MODULE_PARM_DESC(vram, "Configure VRAM size (for devices without IOMMU/GPUMMU)"); 65 65 module_param(vram, charp, 0); 66 66 67 67 /* ··· 196 196 } 197 197 198 198 drm_kms_helper_poll_fini(dev); 199 + 200 + #ifdef CONFIG_DRM_FBDEV_EMULATION 201 + if (fbdev && priv->fbdev) 202 + msm_fbdev_free(dev); 203 + #endif 199 204 drm_mode_config_cleanup(dev); 200 205 drm_vblank_cleanup(dev); 201 206 ··· 1121 1116 DBG("init"); 1122 1117 msm_dsi_register(); 1123 1118 msm_edp_register(); 1124 - hdmi_register(); 1119 + msm_hdmi_register(); 1125 1120 adreno_register(); 1126 1121 return platform_driver_register(&msm_platform_driver); 1127 1122 } ··· 1130 1125 { 1131 1126 DBG("fini"); 1132 1127 platform_driver_unregister(&msm_platform_driver); 1133 - hdmi_unregister(); 1128 + msm_hdmi_unregister(); 1134 1129 adreno_unregister(); 1135 1130 msm_edp_unregister(); 1136 1131 msm_dsi_unregister();
+4 -3
drivers/gpu/drm/msm/msm_drv.h
··· 240 240 struct drm_file *file, const struct drm_mode_fb_cmd2 *mode_cmd); 241 241 242 242 struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev); 243 + void msm_fbdev_free(struct drm_device *dev); 243 244 244 245 struct hdmi; 245 - int hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev, 246 + int msm_hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev, 246 247 struct drm_encoder *encoder); 247 - void __init hdmi_register(void); 248 - void __exit hdmi_unregister(void); 248 + void __init msm_hdmi_register(void); 249 + void __exit msm_hdmi_unregister(void); 249 250 250 251 struct msm_edp; 251 252 void __init msm_edp_register(void);
+9 -11
drivers/gpu/drm/msm/msm_gem_submit.c
··· 323 323 struct drm_msm_gem_submit *args = data; 324 324 struct msm_file_private *ctx = file->driver_priv; 325 325 struct msm_gem_submit *submit; 326 - struct msm_gpu *gpu; 326 + struct msm_gpu *gpu = priv->gpu; 327 327 unsigned i; 328 328 int ret; 329 + 330 + if (!gpu) 331 + return -ENXIO; 329 332 330 333 /* for now, we just have 3d pipe.. eventually this would need to 331 334 * be more clever to dispatch to appropriate gpu module: ··· 336 333 if (args->pipe != MSM_PIPE_3D0) 337 334 return -EINVAL; 338 335 339 - gpu = priv->gpu; 340 - 341 336 if (args->nr_cmds > MAX_CMDS) 342 337 return -EINVAL; 343 338 344 - mutex_lock(&dev->struct_mutex); 345 - 346 339 submit = submit_create(dev, gpu, args->nr_bos); 347 - if (!submit) { 348 - ret = -ENOMEM; 349 - goto out; 350 - } 340 + if (!submit) 341 + return -ENOMEM; 342 + 343 + mutex_lock(&dev->struct_mutex); 351 344 352 345 ret = submit_lookup_objects(submit, args, file); 353 346 if (ret) ··· 418 419 args->fence = submit->fence; 419 420 420 421 out: 421 - if (submit) 422 - submit_cleanup(submit, !!ret); 422 + submit_cleanup(submit, !!ret); 423 423 mutex_unlock(&dev->struct_mutex); 424 424 return ret; 425 425 }
+4 -2
drivers/gpu/drm/msm/msm_iommu.c
··· 31 31 return 0; 32 32 } 33 33 34 - static int msm_iommu_attach(struct msm_mmu *mmu, const char **names, int cnt) 34 + static int msm_iommu_attach(struct msm_mmu *mmu, const char * const *names, 35 + int cnt) 35 36 { 36 37 struct msm_iommu *iommu = to_msm_iommu(mmu); 37 38 return iommu_attach_device(iommu->domain, mmu->dev); 38 39 } 39 40 40 - static void msm_iommu_detach(struct msm_mmu *mmu, const char **names, int cnt) 41 + static void msm_iommu_detach(struct msm_mmu *mmu, const char * const *names, 42 + int cnt) 41 43 { 42 44 struct msm_iommu *iommu = to_msm_iommu(mmu); 43 45 iommu_detach_device(iommu->domain, mmu->dev);
+2 -2
drivers/gpu/drm/msm/msm_mmu.h
··· 21 21 #include <linux/iommu.h> 22 22 23 23 struct msm_mmu_funcs { 24 - int (*attach)(struct msm_mmu *mmu, const char **names, int cnt); 25 - void (*detach)(struct msm_mmu *mmu, const char **names, int cnt); 24 + int (*attach)(struct msm_mmu *mmu, const char * const *names, int cnt); 25 + void (*detach)(struct msm_mmu *mmu, const char * const *names, int cnt); 26 26 int (*map)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt, 27 27 unsigned len, int prot); 28 28 int (*unmap)(struct msm_mmu *mmu, uint32_t iova, struct sg_table *sgt,
+1
include/uapi/drm/msm_drm.h
··· 51 51 #define MSM_PARAM_GMEM_SIZE 0x02 52 52 #define MSM_PARAM_CHIP_ID 0x03 53 53 #define MSM_PARAM_MAX_FREQ 0x04 54 + #define MSM_PARAM_TIMESTAMP 0x05 54 55 55 56 struct drm_msm_param { 56 57 __u32 pipe; /* in, MSM_PIPE_x */