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

Merge tag 'drm-next-20221109' of git://linuxtv.org/pinchartl/media into drm-next

- Renesas RZ/G2L DSI support
- Renesas DU Kconfig cleanup
- Xilinx DPSUB fix

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Link: https://patchwork.freedesktop.org/patch/msgid/Y2u+mhkPJQ4de3q5@pendragon.ideasonboard.com

+1163 -5
+182
Documentation/devicetree/bindings/display/bridge/renesas,dsi.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/display/bridge/renesas,dsi.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Renesas RZ/G2L MIPI DSI Encoder 8 + 9 + maintainers: 10 + - Biju Das <biju.das.jz@bp.renesas.com> 11 + 12 + description: | 13 + This binding describes the MIPI DSI encoder embedded in the Renesas 14 + RZ/G2L alike family of SoC's. The encoder can operate in DSI mode, with 15 + up to four data lanes. 16 + 17 + allOf: 18 + - $ref: /schemas/display/dsi-controller.yaml# 19 + 20 + properties: 21 + compatible: 22 + items: 23 + - enum: 24 + - renesas,r9a07g044-mipi-dsi # RZ/G2{L,LC} 25 + - const: renesas,rzg2l-mipi-dsi 26 + 27 + reg: 28 + maxItems: 1 29 + 30 + interrupts: 31 + items: 32 + - description: Sequence operation channel 0 interrupt 33 + - description: Sequence operation channel 1 interrupt 34 + - description: Video-Input operation channel 1 interrupt 35 + - description: DSI Packet Receive interrupt 36 + - description: DSI Fatal Error interrupt 37 + - description: DSI D-PHY PPI interrupt 38 + - description: Debug interrupt 39 + 40 + interrupt-names: 41 + items: 42 + - const: seq0 43 + - const: seq1 44 + - const: vin1 45 + - const: rcv 46 + - const: ferr 47 + - const: ppi 48 + - const: debug 49 + 50 + clocks: 51 + items: 52 + - description: DSI D-PHY PLL multiplied clock 53 + - description: DSI D-PHY system clock 54 + - description: DSI AXI bus clock 55 + - description: DSI Register access clock 56 + - description: DSI Video clock 57 + - description: DSI D-PHY Escape mode transmit clock 58 + 59 + clock-names: 60 + items: 61 + - const: pllclk 62 + - const: sysclk 63 + - const: aclk 64 + - const: pclk 65 + - const: vclk 66 + - const: lpclk 67 + 68 + resets: 69 + items: 70 + - description: MIPI_DSI_CMN_RSTB 71 + - description: MIPI_DSI_ARESET_N 72 + - description: MIPI_DSI_PRESET_N 73 + 74 + reset-names: 75 + items: 76 + - const: rst 77 + - const: arst 78 + - const: prst 79 + 80 + power-domains: 81 + maxItems: 1 82 + 83 + ports: 84 + $ref: /schemas/graph.yaml#/properties/ports 85 + 86 + properties: 87 + port@0: 88 + $ref: /schemas/graph.yaml#/properties/port 89 + description: Parallel input port 90 + 91 + port@1: 92 + $ref: /schemas/graph.yaml#/$defs/port-base 93 + unevaluatedProperties: false 94 + description: DSI output port 95 + 96 + properties: 97 + endpoint: 98 + $ref: /schemas/media/video-interfaces.yaml# 99 + unevaluatedProperties: false 100 + 101 + properties: 102 + data-lanes: 103 + description: array of physical DSI data lane indexes. 104 + minItems: 1 105 + items: 106 + - const: 1 107 + - const: 2 108 + - const: 3 109 + - const: 4 110 + 111 + required: 112 + - data-lanes 113 + 114 + required: 115 + - port@0 116 + - port@1 117 + 118 + required: 119 + - compatible 120 + - reg 121 + - interrupts 122 + - interrupt-names 123 + - clocks 124 + - clock-names 125 + - resets 126 + - reset-names 127 + - power-domains 128 + - ports 129 + 130 + additionalProperties: false 131 + 132 + examples: 133 + - | 134 + #include <dt-bindings/clock/r9a07g044-cpg.h> 135 + #include <dt-bindings/interrupt-controller/arm-gic.h> 136 + 137 + dsi0: dsi@10850000 { 138 + compatible = "renesas,r9a07g044-mipi-dsi", "renesas,rzg2l-mipi-dsi"; 139 + reg = <0x10850000 0x20000>; 140 + interrupts = <GIC_SPI 142 IRQ_TYPE_LEVEL_HIGH>, 141 + <GIC_SPI 143 IRQ_TYPE_LEVEL_HIGH>, 142 + <GIC_SPI 144 IRQ_TYPE_LEVEL_HIGH>, 143 + <GIC_SPI 145 IRQ_TYPE_LEVEL_HIGH>, 144 + <GIC_SPI 146 IRQ_TYPE_LEVEL_HIGH>, 145 + <GIC_SPI 147 IRQ_TYPE_LEVEL_HIGH>, 146 + <GIC_SPI 148 IRQ_TYPE_LEVEL_HIGH>; 147 + interrupt-names = "seq0", "seq1", "vin1", "rcv", 148 + "ferr", "ppi", "debug"; 149 + clocks = <&cpg CPG_MOD R9A07G044_MIPI_DSI_PLLCLK>, 150 + <&cpg CPG_MOD R9A07G044_MIPI_DSI_SYSCLK>, 151 + <&cpg CPG_MOD R9A07G044_MIPI_DSI_ACLK>, 152 + <&cpg CPG_MOD R9A07G044_MIPI_DSI_PCLK>, 153 + <&cpg CPG_MOD R9A07G044_MIPI_DSI_VCLK>, 154 + <&cpg CPG_MOD R9A07G044_MIPI_DSI_LPCLK>; 155 + clock-names = "pllclk", "sysclk", "aclk", "pclk", "vclk", "lpclk"; 156 + resets = <&cpg R9A07G044_MIPI_DSI_CMN_RSTB>, 157 + <&cpg R9A07G044_MIPI_DSI_ARESET_N>, 158 + <&cpg R9A07G044_MIPI_DSI_PRESET_N>; 159 + reset-names = "rst", "arst", "prst"; 160 + power-domains = <&cpg>; 161 + 162 + ports { 163 + #address-cells = <1>; 164 + #size-cells = <0>; 165 + 166 + port@0 { 167 + reg = <0>; 168 + dsi0_in: endpoint { 169 + remote-endpoint = <&du_out_dsi0>; 170 + }; 171 + }; 172 + 173 + port@1 { 174 + reg = <1>; 175 + dsi0_out: endpoint { 176 + data-lanes = <1 2 3 4>; 177 + remote-endpoint = <&adv7535_in>; 178 + }; 179 + }; 180 + }; 181 + }; 182 + ...
+8 -2
drivers/gpu/drm/rcar-du/Kconfig
··· 41 41 depends on DRM_RCAR_USE_LVDS 42 42 select DRM_KMS_HELPER 43 43 select DRM_PANEL 44 - select OF_FLATTREE 45 - select OF_OVERLAY 46 44 47 45 config DRM_RCAR_MIPI_DSI 48 46 tristate "R-Car DU MIPI DSI Encoder Support" ··· 48 50 select DRM_MIPI_DSI 49 51 help 50 52 Enable support for the R-Car Display Unit embedded MIPI DSI encoders. 53 + 54 + config DRM_RZG2L_MIPI_DSI 55 + tristate "RZ/G2L MIPI DSI Encoder Support" 56 + depends on DRM_BRIDGE && OF 57 + depends on ARCH_RENESAS || COMPILE_TEST 58 + select DRM_MIPI_DSI 59 + help 60 + Enable support for the RZ/G2L Display Unit embedded MIPI DSI encoders. 51 61 52 62 config DRM_RCAR_VSP 53 63 bool "R-Car DU VSP Compositor Support" if ARM
+2
drivers/gpu/drm/rcar-du/Makefile
··· 14 14 obj-$(CONFIG_DRM_RCAR_DW_HDMI) += rcar_dw_hdmi.o 15 15 obj-$(CONFIG_DRM_RCAR_LVDS) += rcar_lvds.o 16 16 obj-$(CONFIG_DRM_RCAR_MIPI_DSI) += rcar_mipi_dsi.o 17 + 18 + obj-$(CONFIG_DRM_RZG2L_MIPI_DSI) += rzg2l_mipi_dsi.o
+816
drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * RZ/G2L MIPI DSI Encoder Driver 4 + * 5 + * Copyright (C) 2022 Renesas Electronics Corporation 6 + */ 7 + #include <linux/clk.h> 8 + #include <linux/delay.h> 9 + #include <linux/io.h> 10 + #include <linux/iopoll.h> 11 + #include <linux/module.h> 12 + #include <linux/of.h> 13 + #include <linux/of_device.h> 14 + #include <linux/of_graph.h> 15 + #include <linux/platform_device.h> 16 + #include <linux/pm_runtime.h> 17 + #include <linux/reset.h> 18 + #include <linux/slab.h> 19 + 20 + #include <drm/drm_atomic.h> 21 + #include <drm/drm_atomic_helper.h> 22 + #include <drm/drm_bridge.h> 23 + #include <drm/drm_mipi_dsi.h> 24 + #include <drm/drm_of.h> 25 + #include <drm/drm_panel.h> 26 + #include <drm/drm_probe_helper.h> 27 + 28 + #include "rzg2l_mipi_dsi_regs.h" 29 + 30 + struct rzg2l_mipi_dsi { 31 + struct device *dev; 32 + void __iomem *mmio; 33 + 34 + struct reset_control *rstc; 35 + struct reset_control *arstc; 36 + struct reset_control *prstc; 37 + 38 + struct mipi_dsi_host host; 39 + struct drm_bridge bridge; 40 + struct drm_bridge *next_bridge; 41 + 42 + struct clk *vclk; 43 + 44 + enum mipi_dsi_pixel_format format; 45 + unsigned int num_data_lanes; 46 + unsigned int lanes; 47 + unsigned long mode_flags; 48 + }; 49 + 50 + static inline struct rzg2l_mipi_dsi * 51 + bridge_to_rzg2l_mipi_dsi(struct drm_bridge *bridge) 52 + { 53 + return container_of(bridge, struct rzg2l_mipi_dsi, bridge); 54 + } 55 + 56 + static inline struct rzg2l_mipi_dsi * 57 + host_to_rzg2l_mipi_dsi(struct mipi_dsi_host *host) 58 + { 59 + return container_of(host, struct rzg2l_mipi_dsi, host); 60 + } 61 + 62 + struct rzg2l_mipi_dsi_timings { 63 + unsigned long hsfreq_max; 64 + u32 t_init; 65 + u32 tclk_prepare; 66 + u32 ths_prepare; 67 + u32 tclk_zero; 68 + u32 tclk_pre; 69 + u32 tclk_post; 70 + u32 tclk_trail; 71 + u32 ths_zero; 72 + u32 ths_trail; 73 + u32 ths_exit; 74 + u32 tlpx; 75 + }; 76 + 77 + static const struct rzg2l_mipi_dsi_timings rzg2l_mipi_dsi_global_timings[] = { 78 + { 79 + .hsfreq_max = 80000, 80 + .t_init = 79801, 81 + .tclk_prepare = 8, 82 + .ths_prepare = 13, 83 + .tclk_zero = 33, 84 + .tclk_pre = 24, 85 + .tclk_post = 94, 86 + .tclk_trail = 10, 87 + .ths_zero = 23, 88 + .ths_trail = 17, 89 + .ths_exit = 13, 90 + .tlpx = 6, 91 + }, 92 + { 93 + .hsfreq_max = 125000, 94 + .t_init = 79801, 95 + .tclk_prepare = 8, 96 + .ths_prepare = 12, 97 + .tclk_zero = 33, 98 + .tclk_pre = 15, 99 + .tclk_post = 94, 100 + .tclk_trail = 10, 101 + .ths_zero = 23, 102 + .ths_trail = 17, 103 + .ths_exit = 13, 104 + .tlpx = 6, 105 + }, 106 + { 107 + .hsfreq_max = 250000, 108 + .t_init = 79801, 109 + .tclk_prepare = 8, 110 + .ths_prepare = 12, 111 + .tclk_zero = 33, 112 + .tclk_pre = 13, 113 + .tclk_post = 94, 114 + .tclk_trail = 10, 115 + .ths_zero = 23, 116 + .ths_trail = 16, 117 + .ths_exit = 13, 118 + .tlpx = 6, 119 + }, 120 + { 121 + .hsfreq_max = 360000, 122 + .t_init = 79801, 123 + .tclk_prepare = 8, 124 + .ths_prepare = 10, 125 + .tclk_zero = 33, 126 + .tclk_pre = 4, 127 + .tclk_post = 35, 128 + .tclk_trail = 7, 129 + .ths_zero = 16, 130 + .ths_trail = 9, 131 + .ths_exit = 13, 132 + .tlpx = 6, 133 + }, 134 + { 135 + .hsfreq_max = 720000, 136 + .t_init = 79801, 137 + .tclk_prepare = 8, 138 + .ths_prepare = 9, 139 + .tclk_zero = 33, 140 + .tclk_pre = 4, 141 + .tclk_post = 35, 142 + .tclk_trail = 7, 143 + .ths_zero = 16, 144 + .ths_trail = 9, 145 + .ths_exit = 13, 146 + .tlpx = 6, 147 + }, 148 + { 149 + .hsfreq_max = 1500000, 150 + .t_init = 79801, 151 + .tclk_prepare = 8, 152 + .ths_prepare = 9, 153 + .tclk_zero = 33, 154 + .tclk_pre = 4, 155 + .tclk_post = 35, 156 + .tclk_trail = 7, 157 + .ths_zero = 16, 158 + .ths_trail = 9, 159 + .ths_exit = 13, 160 + .tlpx = 6, 161 + }, 162 + }; 163 + 164 + static void rzg2l_mipi_dsi_phy_write(struct rzg2l_mipi_dsi *dsi, u32 reg, u32 data) 165 + { 166 + iowrite32(data, dsi->mmio + reg); 167 + } 168 + 169 + static void rzg2l_mipi_dsi_link_write(struct rzg2l_mipi_dsi *dsi, u32 reg, u32 data) 170 + { 171 + iowrite32(data, dsi->mmio + LINK_REG_OFFSET + reg); 172 + } 173 + 174 + static u32 rzg2l_mipi_dsi_phy_read(struct rzg2l_mipi_dsi *dsi, u32 reg) 175 + { 176 + return ioread32(dsi->mmio + reg); 177 + } 178 + 179 + static u32 rzg2l_mipi_dsi_link_read(struct rzg2l_mipi_dsi *dsi, u32 reg) 180 + { 181 + return ioread32(dsi->mmio + LINK_REG_OFFSET + reg); 182 + } 183 + 184 + /* ----------------------------------------------------------------------------- 185 + * Hardware Setup 186 + */ 187 + 188 + static int rzg2l_mipi_dsi_dphy_init(struct rzg2l_mipi_dsi *dsi, 189 + unsigned long hsfreq) 190 + { 191 + const struct rzg2l_mipi_dsi_timings *dphy_timings; 192 + unsigned int i; 193 + u32 dphyctrl0; 194 + u32 dphytim0; 195 + u32 dphytim1; 196 + u32 dphytim2; 197 + u32 dphytim3; 198 + int ret; 199 + 200 + /* All DSI global operation timings are set with recommended setting */ 201 + for (i = 0; i < ARRAY_SIZE(rzg2l_mipi_dsi_global_timings); ++i) { 202 + dphy_timings = &rzg2l_mipi_dsi_global_timings[i]; 203 + if (hsfreq <= dphy_timings->hsfreq_max) 204 + break; 205 + } 206 + 207 + /* Initializing DPHY before accessing LINK */ 208 + dphyctrl0 = DSIDPHYCTRL0_CAL_EN_HSRX_OFS | DSIDPHYCTRL0_CMN_MASTER_EN | 209 + DSIDPHYCTRL0_RE_VDD_DETVCCQLV18 | DSIDPHYCTRL0_EN_BGR; 210 + 211 + rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYCTRL0, dphyctrl0); 212 + usleep_range(20, 30); 213 + 214 + dphyctrl0 |= DSIDPHYCTRL0_EN_LDO1200; 215 + rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYCTRL0, dphyctrl0); 216 + usleep_range(10, 20); 217 + 218 + dphytim0 = DSIDPHYTIM0_TCLK_MISS(0) | 219 + DSIDPHYTIM0_T_INIT(dphy_timings->t_init); 220 + dphytim1 = DSIDPHYTIM1_THS_PREPARE(dphy_timings->ths_prepare) | 221 + DSIDPHYTIM1_TCLK_PREPARE(dphy_timings->tclk_prepare) | 222 + DSIDPHYTIM1_THS_SETTLE(0) | 223 + DSIDPHYTIM1_TCLK_SETTLE(0); 224 + dphytim2 = DSIDPHYTIM2_TCLK_TRAIL(dphy_timings->tclk_trail) | 225 + DSIDPHYTIM2_TCLK_POST(dphy_timings->tclk_post) | 226 + DSIDPHYTIM2_TCLK_PRE(dphy_timings->tclk_pre) | 227 + DSIDPHYTIM2_TCLK_ZERO(dphy_timings->tclk_zero); 228 + dphytim3 = DSIDPHYTIM3_TLPX(dphy_timings->tlpx) | 229 + DSIDPHYTIM3_THS_EXIT(dphy_timings->ths_exit) | 230 + DSIDPHYTIM3_THS_TRAIL(dphy_timings->ths_trail) | 231 + DSIDPHYTIM3_THS_ZERO(dphy_timings->ths_zero); 232 + 233 + rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYTIM0, dphytim0); 234 + rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYTIM1, dphytim1); 235 + rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYTIM2, dphytim2); 236 + rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYTIM3, dphytim3); 237 + 238 + ret = reset_control_deassert(dsi->rstc); 239 + if (ret < 0) 240 + return ret; 241 + 242 + udelay(1); 243 + 244 + return 0; 245 + } 246 + 247 + static void rzg2l_mipi_dsi_dphy_exit(struct rzg2l_mipi_dsi *dsi) 248 + { 249 + u32 dphyctrl0; 250 + 251 + dphyctrl0 = rzg2l_mipi_dsi_phy_read(dsi, DSIDPHYCTRL0); 252 + 253 + dphyctrl0 &= ~(DSIDPHYCTRL0_EN_LDO1200 | DSIDPHYCTRL0_EN_BGR); 254 + rzg2l_mipi_dsi_phy_write(dsi, DSIDPHYCTRL0, dphyctrl0); 255 + 256 + reset_control_assert(dsi->rstc); 257 + } 258 + 259 + static int rzg2l_mipi_dsi_startup(struct rzg2l_mipi_dsi *dsi, 260 + const struct drm_display_mode *mode) 261 + { 262 + unsigned long hsfreq; 263 + unsigned int bpp; 264 + u32 txsetr; 265 + u32 clstptsetr; 266 + u32 lptrnstsetr; 267 + u32 clkkpt; 268 + u32 clkbfht; 269 + u32 clkstpt; 270 + u32 golpbkt; 271 + int ret; 272 + 273 + /* 274 + * Relationship between hsclk and vclk must follow 275 + * vclk * bpp = hsclk * 8 * lanes 276 + * where vclk: video clock (Hz) 277 + * bpp: video pixel bit depth 278 + * hsclk: DSI HS Byte clock frequency (Hz) 279 + * lanes: number of data lanes 280 + * 281 + * hsclk(bit) = hsclk(byte) * 8 282 + */ 283 + bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); 284 + hsfreq = (mode->clock * bpp * 8) / (8 * dsi->lanes); 285 + 286 + ret = pm_runtime_resume_and_get(dsi->dev); 287 + if (ret < 0) 288 + return ret; 289 + 290 + clk_set_rate(dsi->vclk, mode->clock * 1000); 291 + 292 + ret = rzg2l_mipi_dsi_dphy_init(dsi, hsfreq); 293 + if (ret < 0) 294 + goto err_phy; 295 + 296 + /* Enable Data lanes and Clock lanes */ 297 + txsetr = TXSETR_DLEN | TXSETR_NUMLANEUSE(dsi->lanes - 1) | TXSETR_CLEN; 298 + rzg2l_mipi_dsi_link_write(dsi, TXSETR, txsetr); 299 + 300 + /* 301 + * Global timings characteristic depends on high speed Clock Frequency 302 + * Currently MIPI DSI-IF just supports maximum FHD@60 with: 303 + * - videoclock = 148.5 (MHz) 304 + * - bpp: maximum 24bpp 305 + * - data lanes: maximum 4 lanes 306 + * Therefore maximum hsclk will be 891 Mbps. 307 + */ 308 + if (hsfreq > 445500) { 309 + clkkpt = 12; 310 + clkbfht = 15; 311 + clkstpt = 48; 312 + golpbkt = 75; 313 + } else if (hsfreq > 250000) { 314 + clkkpt = 7; 315 + clkbfht = 8; 316 + clkstpt = 27; 317 + golpbkt = 40; 318 + } else { 319 + clkkpt = 8; 320 + clkbfht = 6; 321 + clkstpt = 24; 322 + golpbkt = 29; 323 + } 324 + 325 + clstptsetr = CLSTPTSETR_CLKKPT(clkkpt) | CLSTPTSETR_CLKBFHT(clkbfht) | 326 + CLSTPTSETR_CLKSTPT(clkstpt); 327 + rzg2l_mipi_dsi_link_write(dsi, CLSTPTSETR, clstptsetr); 328 + 329 + lptrnstsetr = LPTRNSTSETR_GOLPBKT(golpbkt); 330 + rzg2l_mipi_dsi_link_write(dsi, LPTRNSTSETR, lptrnstsetr); 331 + 332 + return 0; 333 + 334 + err_phy: 335 + rzg2l_mipi_dsi_dphy_exit(dsi); 336 + pm_runtime_put(dsi->dev); 337 + 338 + return ret; 339 + } 340 + 341 + static void rzg2l_mipi_dsi_stop(struct rzg2l_mipi_dsi *dsi) 342 + { 343 + rzg2l_mipi_dsi_dphy_exit(dsi); 344 + pm_runtime_put(dsi->dev); 345 + } 346 + 347 + static void rzg2l_mipi_dsi_set_display_timing(struct rzg2l_mipi_dsi *dsi, 348 + const struct drm_display_mode *mode) 349 + { 350 + u32 vich1ppsetr; 351 + u32 vich1vssetr; 352 + u32 vich1vpsetr; 353 + u32 vich1hssetr; 354 + u32 vich1hpsetr; 355 + int dsi_format; 356 + u32 delay[2]; 357 + u8 index; 358 + 359 + /* Configuration for Pixel Packet */ 360 + dsi_format = mipi_dsi_pixel_format_to_bpp(dsi->format); 361 + switch (dsi_format) { 362 + case 24: 363 + vich1ppsetr = VICH1PPSETR_DT_RGB24; 364 + break; 365 + case 18: 366 + vich1ppsetr = VICH1PPSETR_DT_RGB18; 367 + break; 368 + } 369 + 370 + if ((dsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) && 371 + !(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)) 372 + vich1ppsetr |= VICH1PPSETR_TXESYNC_PULSE; 373 + 374 + rzg2l_mipi_dsi_link_write(dsi, VICH1PPSETR, vich1ppsetr); 375 + 376 + /* Configuration for Video Parameters */ 377 + vich1vssetr = VICH1VSSETR_VACTIVE(mode->vdisplay) | 378 + VICH1VSSETR_VSA(mode->vsync_end - mode->vsync_start); 379 + vich1vssetr |= (mode->flags & DRM_MODE_FLAG_PVSYNC) ? 380 + VICH1VSSETR_VSPOL_HIGH : VICH1VSSETR_VSPOL_LOW; 381 + 382 + vich1vpsetr = VICH1VPSETR_VFP(mode->vsync_start - mode->vdisplay) | 383 + VICH1VPSETR_VBP(mode->vtotal - mode->vsync_end); 384 + 385 + vich1hssetr = VICH1HSSETR_HACTIVE(mode->hdisplay) | 386 + VICH1HSSETR_HSA(mode->hsync_end - mode->hsync_start); 387 + vich1hssetr |= (mode->flags & DRM_MODE_FLAG_PHSYNC) ? 388 + VICH1HSSETR_HSPOL_HIGH : VICH1HSSETR_HSPOL_LOW; 389 + 390 + vich1hpsetr = VICH1HPSETR_HFP(mode->hsync_start - mode->hdisplay) | 391 + VICH1HPSETR_HBP(mode->htotal - mode->hsync_end); 392 + 393 + rzg2l_mipi_dsi_link_write(dsi, VICH1VSSETR, vich1vssetr); 394 + rzg2l_mipi_dsi_link_write(dsi, VICH1VPSETR, vich1vpsetr); 395 + rzg2l_mipi_dsi_link_write(dsi, VICH1HSSETR, vich1hssetr); 396 + rzg2l_mipi_dsi_link_write(dsi, VICH1HPSETR, vich1hpsetr); 397 + 398 + /* 399 + * Configuration for Delay Value 400 + * Delay value based on 2 ranges of video clock. 401 + * 74.25MHz is videoclock of HD@60p or FHD@30p 402 + */ 403 + if (mode->clock > 74250) { 404 + delay[0] = 231; 405 + delay[1] = 216; 406 + } else { 407 + delay[0] = 220; 408 + delay[1] = 212; 409 + } 410 + 411 + if (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) 412 + index = 0; 413 + else 414 + index = 1; 415 + 416 + rzg2l_mipi_dsi_link_write(dsi, VICH1SET1R, 417 + VICH1SET1R_DLY(delay[index])); 418 + } 419 + 420 + static int rzg2l_mipi_dsi_start_hs_clock(struct rzg2l_mipi_dsi *dsi) 421 + { 422 + bool is_clk_cont; 423 + u32 hsclksetr; 424 + u32 status; 425 + int ret; 426 + 427 + is_clk_cont = !(dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS); 428 + 429 + /* Start HS clock */ 430 + hsclksetr = HSCLKSETR_HSCLKRUN_HS | (is_clk_cont ? 431 + HSCLKSETR_HSCLKMODE_CONT : 432 + HSCLKSETR_HSCLKMODE_NON_CONT); 433 + rzg2l_mipi_dsi_link_write(dsi, HSCLKSETR, hsclksetr); 434 + 435 + if (is_clk_cont) { 436 + ret = read_poll_timeout(rzg2l_mipi_dsi_link_read, status, 437 + status & PLSR_CLLP2HS, 438 + 2000, 20000, false, dsi, PLSR); 439 + if (ret < 0) { 440 + dev_err(dsi->dev, "failed to start HS clock\n"); 441 + return ret; 442 + } 443 + } 444 + 445 + dev_dbg(dsi->dev, "Start High Speed Clock with %s clock mode", 446 + is_clk_cont ? "continuous" : "non-continuous"); 447 + 448 + return 0; 449 + } 450 + 451 + static int rzg2l_mipi_dsi_stop_hs_clock(struct rzg2l_mipi_dsi *dsi) 452 + { 453 + bool is_clk_cont; 454 + u32 status; 455 + int ret; 456 + 457 + is_clk_cont = !(dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS); 458 + 459 + /* Stop HS clock */ 460 + rzg2l_mipi_dsi_link_write(dsi, HSCLKSETR, 461 + is_clk_cont ? HSCLKSETR_HSCLKMODE_CONT : 462 + HSCLKSETR_HSCLKMODE_NON_CONT); 463 + 464 + if (is_clk_cont) { 465 + ret = read_poll_timeout(rzg2l_mipi_dsi_link_read, status, 466 + status & PLSR_CLHS2LP, 467 + 2000, 20000, false, dsi, PLSR); 468 + if (ret < 0) { 469 + dev_err(dsi->dev, "failed to stop HS clock\n"); 470 + return ret; 471 + } 472 + } 473 + 474 + return 0; 475 + } 476 + 477 + static int rzg2l_mipi_dsi_start_video(struct rzg2l_mipi_dsi *dsi) 478 + { 479 + u32 vich1set0r; 480 + u32 status; 481 + int ret; 482 + 483 + /* Configuration for Blanking sequence and start video input*/ 484 + vich1set0r = VICH1SET0R_HFPNOLP | VICH1SET0R_HBPNOLP | 485 + VICH1SET0R_HSANOLP | VICH1SET0R_VSTART; 486 + rzg2l_mipi_dsi_link_write(dsi, VICH1SET0R, vich1set0r); 487 + 488 + ret = read_poll_timeout(rzg2l_mipi_dsi_link_read, status, 489 + status & VICH1SR_VIRDY, 490 + 2000, 20000, false, dsi, VICH1SR); 491 + if (ret < 0) 492 + dev_err(dsi->dev, "Failed to start video signal input\n"); 493 + 494 + return ret; 495 + } 496 + 497 + static int rzg2l_mipi_dsi_stop_video(struct rzg2l_mipi_dsi *dsi) 498 + { 499 + u32 status; 500 + int ret; 501 + 502 + rzg2l_mipi_dsi_link_write(dsi, VICH1SET0R, VICH1SET0R_VSTPAFT); 503 + ret = read_poll_timeout(rzg2l_mipi_dsi_link_read, status, 504 + (status & VICH1SR_STOP) && (!(status & VICH1SR_RUNNING)), 505 + 2000, 20000, false, dsi, VICH1SR); 506 + if (ret < 0) 507 + goto err; 508 + 509 + ret = read_poll_timeout(rzg2l_mipi_dsi_link_read, status, 510 + !(status & LINKSR_HSBUSY), 511 + 2000, 20000, false, dsi, LINKSR); 512 + if (ret < 0) 513 + goto err; 514 + 515 + return 0; 516 + 517 + err: 518 + dev_err(dsi->dev, "Failed to stop video signal input\n"); 519 + return ret; 520 + } 521 + 522 + /* ----------------------------------------------------------------------------- 523 + * Bridge 524 + */ 525 + 526 + static int rzg2l_mipi_dsi_attach(struct drm_bridge *bridge, 527 + enum drm_bridge_attach_flags flags) 528 + { 529 + struct rzg2l_mipi_dsi *dsi = bridge_to_rzg2l_mipi_dsi(bridge); 530 + 531 + return drm_bridge_attach(bridge->encoder, dsi->next_bridge, bridge, 532 + flags); 533 + } 534 + 535 + static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge, 536 + struct drm_bridge_state *old_bridge_state) 537 + { 538 + struct drm_atomic_state *state = old_bridge_state->base.state; 539 + struct rzg2l_mipi_dsi *dsi = bridge_to_rzg2l_mipi_dsi(bridge); 540 + const struct drm_display_mode *mode; 541 + struct drm_connector *connector; 542 + struct drm_crtc *crtc; 543 + int ret; 544 + 545 + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); 546 + crtc = drm_atomic_get_new_connector_state(state, connector)->crtc; 547 + mode = &drm_atomic_get_new_crtc_state(state, crtc)->adjusted_mode; 548 + 549 + ret = rzg2l_mipi_dsi_startup(dsi, mode); 550 + if (ret < 0) 551 + return; 552 + 553 + rzg2l_mipi_dsi_set_display_timing(dsi, mode); 554 + 555 + ret = rzg2l_mipi_dsi_start_hs_clock(dsi); 556 + if (ret < 0) 557 + goto err_stop; 558 + 559 + ret = rzg2l_mipi_dsi_start_video(dsi); 560 + if (ret < 0) 561 + goto err_stop_clock; 562 + 563 + return; 564 + 565 + err_stop_clock: 566 + rzg2l_mipi_dsi_stop_hs_clock(dsi); 567 + err_stop: 568 + rzg2l_mipi_dsi_stop(dsi); 569 + } 570 + 571 + static void rzg2l_mipi_dsi_atomic_disable(struct drm_bridge *bridge, 572 + struct drm_bridge_state *old_bridge_state) 573 + { 574 + struct rzg2l_mipi_dsi *dsi = bridge_to_rzg2l_mipi_dsi(bridge); 575 + 576 + rzg2l_mipi_dsi_stop_video(dsi); 577 + rzg2l_mipi_dsi_stop_hs_clock(dsi); 578 + rzg2l_mipi_dsi_stop(dsi); 579 + } 580 + 581 + static enum drm_mode_status 582 + rzg2l_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge, 583 + const struct drm_display_info *info, 584 + const struct drm_display_mode *mode) 585 + { 586 + if (mode->clock > 148500) 587 + return MODE_CLOCK_HIGH; 588 + 589 + return MODE_OK; 590 + } 591 + 592 + static const struct drm_bridge_funcs rzg2l_mipi_dsi_bridge_ops = { 593 + .attach = rzg2l_mipi_dsi_attach, 594 + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, 595 + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, 596 + .atomic_reset = drm_atomic_helper_bridge_reset, 597 + .atomic_enable = rzg2l_mipi_dsi_atomic_enable, 598 + .atomic_disable = rzg2l_mipi_dsi_atomic_disable, 599 + .mode_valid = rzg2l_mipi_dsi_bridge_mode_valid, 600 + }; 601 + 602 + /* ----------------------------------------------------------------------------- 603 + * Host setting 604 + */ 605 + 606 + static int rzg2l_mipi_dsi_host_attach(struct mipi_dsi_host *host, 607 + struct mipi_dsi_device *device) 608 + { 609 + struct rzg2l_mipi_dsi *dsi = host_to_rzg2l_mipi_dsi(host); 610 + int ret; 611 + 612 + if (device->lanes > dsi->num_data_lanes) { 613 + dev_err(dsi->dev, 614 + "Number of lines of device (%u) exceeds host (%u)\n", 615 + device->lanes, dsi->num_data_lanes); 616 + return -EINVAL; 617 + } 618 + 619 + switch (mipi_dsi_pixel_format_to_bpp(device->format)) { 620 + case 24: 621 + case 18: 622 + break; 623 + default: 624 + dev_err(dsi->dev, "Unsupported format 0x%04x\n", device->format); 625 + return -EINVAL; 626 + } 627 + 628 + dsi->lanes = device->lanes; 629 + dsi->format = device->format; 630 + dsi->mode_flags = device->mode_flags; 631 + 632 + dsi->next_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 633 + 1, 0); 634 + if (IS_ERR(dsi->next_bridge)) { 635 + ret = PTR_ERR(dsi->next_bridge); 636 + dev_err(dsi->dev, "failed to get next bridge: %d\n", ret); 637 + return ret; 638 + } 639 + 640 + drm_bridge_add(&dsi->bridge); 641 + 642 + return 0; 643 + } 644 + 645 + static int rzg2l_mipi_dsi_host_detach(struct mipi_dsi_host *host, 646 + struct mipi_dsi_device *device) 647 + { 648 + struct rzg2l_mipi_dsi *dsi = host_to_rzg2l_mipi_dsi(host); 649 + 650 + drm_bridge_remove(&dsi->bridge); 651 + 652 + return 0; 653 + } 654 + 655 + static const struct mipi_dsi_host_ops rzg2l_mipi_dsi_host_ops = { 656 + .attach = rzg2l_mipi_dsi_host_attach, 657 + .detach = rzg2l_mipi_dsi_host_detach, 658 + }; 659 + 660 + /* ----------------------------------------------------------------------------- 661 + * Power Management 662 + */ 663 + 664 + static int __maybe_unused rzg2l_mipi_pm_runtime_suspend(struct device *dev) 665 + { 666 + struct rzg2l_mipi_dsi *dsi = dev_get_drvdata(dev); 667 + 668 + reset_control_assert(dsi->prstc); 669 + reset_control_assert(dsi->arstc); 670 + 671 + return 0; 672 + } 673 + 674 + static int __maybe_unused rzg2l_mipi_pm_runtime_resume(struct device *dev) 675 + { 676 + struct rzg2l_mipi_dsi *dsi = dev_get_drvdata(dev); 677 + int ret; 678 + 679 + ret = reset_control_deassert(dsi->arstc); 680 + if (ret < 0) 681 + return ret; 682 + 683 + ret = reset_control_deassert(dsi->prstc); 684 + if (ret < 0) 685 + reset_control_assert(dsi->arstc); 686 + 687 + return ret; 688 + } 689 + 690 + static const struct dev_pm_ops rzg2l_mipi_pm_ops = { 691 + SET_RUNTIME_PM_OPS(rzg2l_mipi_pm_runtime_suspend, rzg2l_mipi_pm_runtime_resume, NULL) 692 + }; 693 + 694 + /* ----------------------------------------------------------------------------- 695 + * Probe & Remove 696 + */ 697 + 698 + static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) 699 + { 700 + unsigned int num_data_lanes; 701 + struct rzg2l_mipi_dsi *dsi; 702 + u32 txsetr; 703 + int ret; 704 + 705 + dsi = devm_kzalloc(&pdev->dev, sizeof(*dsi), GFP_KERNEL); 706 + if (!dsi) 707 + return -ENOMEM; 708 + 709 + platform_set_drvdata(pdev, dsi); 710 + dsi->dev = &pdev->dev; 711 + 712 + ret = drm_of_get_data_lanes_count_ep(dsi->dev->of_node, 1, 0, 1, 4); 713 + if (ret < 0) 714 + return dev_err_probe(dsi->dev, ret, 715 + "missing or invalid data-lanes property\n"); 716 + 717 + num_data_lanes = ret; 718 + 719 + dsi->mmio = devm_platform_ioremap_resource(pdev, 0); 720 + if (IS_ERR(dsi->mmio)) 721 + return PTR_ERR(dsi->mmio); 722 + 723 + dsi->vclk = devm_clk_get(dsi->dev, "vclk"); 724 + if (IS_ERR(dsi->vclk)) 725 + return PTR_ERR(dsi->vclk); 726 + 727 + dsi->rstc = devm_reset_control_get_exclusive(dsi->dev, "rst"); 728 + if (IS_ERR(dsi->rstc)) 729 + return dev_err_probe(dsi->dev, PTR_ERR(dsi->rstc), 730 + "failed to get rst\n"); 731 + 732 + dsi->arstc = devm_reset_control_get_exclusive(dsi->dev, "arst"); 733 + if (IS_ERR(dsi->arstc)) 734 + return dev_err_probe(&pdev->dev, PTR_ERR(dsi->arstc), 735 + "failed to get arst\n"); 736 + 737 + dsi->prstc = devm_reset_control_get_exclusive(dsi->dev, "prst"); 738 + if (IS_ERR(dsi->prstc)) 739 + return dev_err_probe(dsi->dev, PTR_ERR(dsi->prstc), 740 + "failed to get prst\n"); 741 + 742 + platform_set_drvdata(pdev, dsi); 743 + 744 + pm_runtime_enable(dsi->dev); 745 + 746 + ret = pm_runtime_resume_and_get(dsi->dev); 747 + if (ret < 0) 748 + goto err_pm_disable; 749 + 750 + /* 751 + * TXSETR register can be read only after DPHY init. But during probe 752 + * mode->clock and format are not available. So initialize DPHY with 753 + * timing parameters for 80Mbps. 754 + */ 755 + ret = rzg2l_mipi_dsi_dphy_init(dsi, 80000); 756 + if (ret < 0) 757 + goto err_phy; 758 + 759 + txsetr = rzg2l_mipi_dsi_link_read(dsi, TXSETR); 760 + dsi->num_data_lanes = min(((txsetr >> 16) & 3) + 1, num_data_lanes); 761 + rzg2l_mipi_dsi_dphy_exit(dsi); 762 + pm_runtime_put(dsi->dev); 763 + 764 + /* Initialize the DRM bridge. */ 765 + dsi->bridge.funcs = &rzg2l_mipi_dsi_bridge_ops; 766 + dsi->bridge.of_node = dsi->dev->of_node; 767 + 768 + /* Init host device */ 769 + dsi->host.dev = dsi->dev; 770 + dsi->host.ops = &rzg2l_mipi_dsi_host_ops; 771 + ret = mipi_dsi_host_register(&dsi->host); 772 + if (ret < 0) 773 + goto err_pm_disable; 774 + 775 + return 0; 776 + 777 + err_phy: 778 + rzg2l_mipi_dsi_dphy_exit(dsi); 779 + pm_runtime_put(dsi->dev); 780 + err_pm_disable: 781 + pm_runtime_disable(dsi->dev); 782 + return ret; 783 + } 784 + 785 + static int rzg2l_mipi_dsi_remove(struct platform_device *pdev) 786 + { 787 + struct rzg2l_mipi_dsi *dsi = platform_get_drvdata(pdev); 788 + 789 + mipi_dsi_host_unregister(&dsi->host); 790 + pm_runtime_disable(&pdev->dev); 791 + 792 + return 0; 793 + } 794 + 795 + static const struct of_device_id rzg2l_mipi_dsi_of_table[] = { 796 + { .compatible = "renesas,rzg2l-mipi-dsi" }, 797 + { /* sentinel */ } 798 + }; 799 + 800 + MODULE_DEVICE_TABLE(of, rzg2l_mipi_dsi_of_table); 801 + 802 + static struct platform_driver rzg2l_mipi_dsi_platform_driver = { 803 + .probe = rzg2l_mipi_dsi_probe, 804 + .remove = rzg2l_mipi_dsi_remove, 805 + .driver = { 806 + .name = "rzg2l-mipi-dsi", 807 + .pm = &rzg2l_mipi_pm_ops, 808 + .of_match_table = rzg2l_mipi_dsi_of_table, 809 + }, 810 + }; 811 + 812 + module_platform_driver(rzg2l_mipi_dsi_platform_driver); 813 + 814 + MODULE_AUTHOR("Biju Das <biju.das.jz@bp.renesas.com>"); 815 + MODULE_DESCRIPTION("Renesas RZ/G2L MIPI DSI Encoder Driver"); 816 + MODULE_LICENSE("GPL");
+151
drivers/gpu/drm/rcar-du/rzg2l_mipi_dsi_regs.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * RZ/G2L MIPI DSI Interface Registers Definitions 4 + * 5 + * Copyright (C) 2022 Renesas Electronics Corporation 6 + */ 7 + 8 + #ifndef __RZG2L_MIPI_DSI_REGS_H__ 9 + #define __RZG2L_MIPI_DSI_REGS_H__ 10 + 11 + #include <linux/bits.h> 12 + 13 + /* DPHY Registers */ 14 + #define DSIDPHYCTRL0 0x00 15 + #define DSIDPHYCTRL0_CAL_EN_HSRX_OFS BIT(16) 16 + #define DSIDPHYCTRL0_CMN_MASTER_EN BIT(8) 17 + #define DSIDPHYCTRL0_RE_VDD_DETVCCQLV18 BIT(2) 18 + #define DSIDPHYCTRL0_EN_LDO1200 BIT(1) 19 + #define DSIDPHYCTRL0_EN_BGR BIT(0) 20 + 21 + #define DSIDPHYTIM0 0x04 22 + #define DSIDPHYTIM0_TCLK_MISS(x) ((x) << 24) 23 + #define DSIDPHYTIM0_T_INIT(x) ((x) << 0) 24 + 25 + #define DSIDPHYTIM1 0x08 26 + #define DSIDPHYTIM1_THS_PREPARE(x) ((x) << 24) 27 + #define DSIDPHYTIM1_TCLK_PREPARE(x) ((x) << 16) 28 + #define DSIDPHYTIM1_THS_SETTLE(x) ((x) << 8) 29 + #define DSIDPHYTIM1_TCLK_SETTLE(x) ((x) << 0) 30 + 31 + #define DSIDPHYTIM2 0x0c 32 + #define DSIDPHYTIM2_TCLK_TRAIL(x) ((x) << 24) 33 + #define DSIDPHYTIM2_TCLK_POST(x) ((x) << 16) 34 + #define DSIDPHYTIM2_TCLK_PRE(x) ((x) << 8) 35 + #define DSIDPHYTIM2_TCLK_ZERO(x) ((x) << 0) 36 + 37 + #define DSIDPHYTIM3 0x10 38 + #define DSIDPHYTIM3_TLPX(x) ((x) << 24) 39 + #define DSIDPHYTIM3_THS_EXIT(x) ((x) << 16) 40 + #define DSIDPHYTIM3_THS_TRAIL(x) ((x) << 8) 41 + #define DSIDPHYTIM3_THS_ZERO(x) ((x) << 0) 42 + 43 + /* --------------------------------------------------------*/ 44 + /* Link Registers */ 45 + #define LINK_REG_OFFSET 0x10000 46 + 47 + /* Link Status Register */ 48 + #define LINKSR 0x10 49 + #define LINKSR_LPBUSY BIT(13) 50 + #define LINKSR_HSBUSY BIT(12) 51 + #define LINKSR_VICHRUN1 BIT(8) 52 + #define LINKSR_SQCHRUN1 BIT(4) 53 + #define LINKSR_SQCHRUN0 BIT(0) 54 + 55 + /* Tx Set Register */ 56 + #define TXSETR 0x100 57 + #define TXSETR_NUMLANECAP (0x3 << 16) 58 + #define TXSETR_DLEN (1 << 9) 59 + #define TXSETR_CLEN (1 << 8) 60 + #define TXSETR_NUMLANEUSE(x) (((x) & 0x3) << 0) 61 + 62 + /* HS Clock Set Register */ 63 + #define HSCLKSETR 0x104 64 + #define HSCLKSETR_HSCLKMODE_CONT (1 << 1) 65 + #define HSCLKSETR_HSCLKMODE_NON_CONT (0 << 1) 66 + #define HSCLKSETR_HSCLKRUN_HS (1 << 0) 67 + #define HSCLKSETR_HSCLKRUN_LP (0 << 0) 68 + 69 + /* Reset Control Register */ 70 + #define RSTCR 0x110 71 + #define RSTCR_SWRST BIT(0) 72 + #define RSTCR_FCETXSTP BIT(16) 73 + 74 + /* Reset Status Register */ 75 + #define RSTSR 0x114 76 + #define RSTSR_DL0DIR (1 << 15) 77 + #define RSTSR_DLSTPST (0xf << 8) 78 + #define RSTSR_SWRSTV1 (1 << 4) 79 + #define RSTSR_SWRSTIB (1 << 3) 80 + #define RSTSR_SWRSTAPB (1 << 2) 81 + #define RSTSR_SWRSTLP (1 << 1) 82 + #define RSTSR_SWRSTHS (1 << 0) 83 + 84 + /* Clock Lane Stop Time Set Register */ 85 + #define CLSTPTSETR 0x314 86 + #define CLSTPTSETR_CLKKPT(x) ((x) << 24) 87 + #define CLSTPTSETR_CLKBFHT(x) ((x) << 16) 88 + #define CLSTPTSETR_CLKSTPT(x) ((x) << 2) 89 + 90 + /* LP Transition Time Set Register */ 91 + #define LPTRNSTSETR 0x318 92 + #define LPTRNSTSETR_GOLPBKT(x) ((x) << 0) 93 + 94 + /* Physical Lane Status Register */ 95 + #define PLSR 0x320 96 + #define PLSR_CLHS2LP BIT(27) 97 + #define PLSR_CLLP2HS BIT(26) 98 + 99 + /* Video-Input Channel 1 Set 0 Register */ 100 + #define VICH1SET0R 0x400 101 + #define VICH1SET0R_VSEN BIT(12) 102 + #define VICH1SET0R_HFPNOLP BIT(10) 103 + #define VICH1SET0R_HBPNOLP BIT(9) 104 + #define VICH1SET0R_HSANOLP BIT(8) 105 + #define VICH1SET0R_VSTPAFT BIT(1) 106 + #define VICH1SET0R_VSTART BIT(0) 107 + 108 + /* Video-Input Channel 1 Set 1 Register */ 109 + #define VICH1SET1R 0x404 110 + #define VICH1SET1R_DLY(x) (((x) & 0xfff) << 2) 111 + 112 + /* Video-Input Channel 1 Status Register */ 113 + #define VICH1SR 0x410 114 + #define VICH1SR_VIRDY BIT(3) 115 + #define VICH1SR_RUNNING BIT(2) 116 + #define VICH1SR_STOP BIT(1) 117 + #define VICH1SR_START BIT(0) 118 + 119 + /* Video-Input Channel 1 Pixel Packet Set Register */ 120 + #define VICH1PPSETR 0x420 121 + #define VICH1PPSETR_DT_RGB18 (0x1e << 16) 122 + #define VICH1PPSETR_DT_RGB18_LS (0x2e << 16) 123 + #define VICH1PPSETR_DT_RGB24 (0x3e << 16) 124 + #define VICH1PPSETR_TXESYNC_PULSE (1 << 15) 125 + #define VICH1PPSETR_VC(x) ((x) << 22) 126 + 127 + /* Video-Input Channel 1 Vertical Size Set Register */ 128 + #define VICH1VSSETR 0x428 129 + #define VICH1VSSETR_VACTIVE(x) (((x) & 0x7fff) << 16) 130 + #define VICH1VSSETR_VSPOL_LOW (1 << 15) 131 + #define VICH1VSSETR_VSPOL_HIGH (0 << 15) 132 + #define VICH1VSSETR_VSA(x) (((x) & 0xfff) << 0) 133 + 134 + /* Video-Input Channel 1 Vertical Porch Set Register */ 135 + #define VICH1VPSETR 0x42c 136 + #define VICH1VPSETR_VFP(x) (((x) & 0x1fff) << 16) 137 + #define VICH1VPSETR_VBP(x) (((x) & 0x1fff) << 0) 138 + 139 + /* Video-Input Channel 1 Horizontal Size Set Register */ 140 + #define VICH1HSSETR 0x430 141 + #define VICH1HSSETR_HACTIVE(x) (((x) & 0x7fff) << 16) 142 + #define VICH1HSSETR_HSPOL_LOW (1 << 15) 143 + #define VICH1HSSETR_HSPOL_HIGH (0 << 15) 144 + #define VICH1HSSETR_HSA(x) (((x) & 0xfff) << 0) 145 + 146 + /* Video-Input Channel 1 Horizontal Porch Set Register */ 147 + #define VICH1HPSETR 0x434 148 + #define VICH1HPSETR_HFP(x) (((x) & 0x1fff) << 16) 149 + #define VICH1HPSETR_HBP(x) (((x) & 0x1fff) << 0) 150 + 151 + #endif /* __RZG2L_MIPI_DSI_REGS_H__ */
+4 -3
drivers/gpu/drm/xlnx/zynqmp_dp.c
··· 1362 1362 zynqmp_dp_aux_cleanup(dp); 1363 1363 } 1364 1364 1365 - static int zynqmp_dp_bridge_mode_valid(struct drm_bridge *bridge, 1366 - const struct drm_display_info *info, 1367 - const struct drm_display_mode *mode) 1365 + static enum drm_mode_status 1366 + zynqmp_dp_bridge_mode_valid(struct drm_bridge *bridge, 1367 + const struct drm_display_info *info, 1368 + const struct drm_display_mode *mode) 1368 1369 { 1369 1370 struct zynqmp_dp *dp = bridge_to_dp(bridge); 1370 1371 int rate;