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

Merge tag 'drm-misc-next-2021-07-29' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v5.15:

UAPI Changes:
- Add modifiers for arm fixed rate compression.

Cross-subsystem Changes:
- Assorted dt binding fixes.
- Convert ssd1307fb to json-schema.
- Update a lot of irc channels to point to OFTC, as everyone moved there.
- Fix the same divide by zero for asilantfb, kyro, rivafb.

Core Changes:
- Document requirements for new atomic properties.
- Add drm_gem_fb_(begin/end)_cpu_access helpers, and use them in some drivers.
- Document drm_property_enum.value for bitfields.
- Add explicit _NO_ for MIPI_DSI flags that disable features.
- Assorted documentation fixes.
- Update fb_damage handling, and move drm_plane_enable_fb_damage_clips to core.
- Add logging and docs to RMFB ioctl.
- Assorted small fixes to dp_mst, master handling.
- Clarify drm lease usage.

Driver Changes:
- Assorted small fixes to panfrost, hibmc, bridge/nwl-dsi, rockchip, vc4.
- More drm -> linux irq conversions.
- Add support for some Logic Technologies and Multi-Inno panels.
- Expose phy-functionality for drm/rockchip, to allow controlling from the media subsystem.
- Add support for 2 AUO panels.
- Add damage handling to ssd1307fb.
- Improve FIFO handling on mxsfb.
- Assorted small fixes to vmwgfx, and bump version to 2.19 for the new ioctls.
- Improve sony acx424akp backlight handling.

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

From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/a753221a-e23e-0dc4-7ca6-8c1b179738d0@linux.intel.com

+1795 -678
+10
Documentation/devicetree/bindings/display/panel/panel-simple.yaml
··· 46 46 # AU Optronics Corporation 11.6" HD (1366x768) color TFT-LCD panel 47 47 - auo,b116xw03 48 48 # AU Optronics Corporation 13.3" FHD (1920x1080) color TFT-LCD panel 49 + - auo,b133han05 50 + # AU Optronics Corporation 13.3" FHD (1920x1080) color TFT-LCD panel 49 51 - auo,b133htn01 50 52 # AU Optronics Corporation 13.3" WXGA (1366x768) TFT LCD panel 51 53 - auo,b133xtn01 54 + # AU Optronics Corporation 14.0" FHD (1920x1080) color TFT-LCD panel 55 + - auo,b140han06 52 56 # AU Optronics Corporation 7.0" FHD (800 x 480) TFT LCD panel 53 57 - auo,g070vvn01 54 58 # AU Optronics Corporation 10.1" (1280x800) color TFT LCD panel ··· 212 208 - logictechno,lt161010-2nhr 213 209 # Logic Technologies LT170410-2WHC 10.1" 1280x800 IPS TFT Cap Touch Mod. 214 210 - logictechno,lt170410-2whc 211 + # Logic Technologies LTTD800x480 L2RT 7" 800x480 TFT Resistive Touch Module 212 + - logictechno,lttd800480070-l2rt 213 + # Logic Technologies LTTD800480070-L6WH-RT 7” 800x480 TFT Resistive Touch Module 214 + - logictechno,lttd800480070-l6wh-rt 215 215 # Mitsubishi "AA070MC01 7.0" WVGA TFT LCD panel 216 216 - mitsubishi,aa070mc01-ca1 217 + # Multi-Inno Technology Co.,Ltd MI1010AIT-1CP 10.1" 1280x800 LVDS IPS Cap Touch Mod. 218 + - multi-inno,mi1010ait-1cp 217 219 # NEC LCD Technologies, Ltd. 12.1" WXGA (1280x800) LVDS TFT LCD panel 218 220 - nec,nl12880bc20-05 219 221 # NEC LCD Technologies,Ltd. WQVGA TFT LCD panel
+1
Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
··· 23 23 Optional properties: 24 24 - phys: from general PHY binding: the phandle for the PHY device. 25 25 - phy-names: Should be "dphy" if phys references an external phy. 26 + - #phy-cells: Defined when used as ISP phy, should be 0. 26 27 - power-domains: a phandle to mipi dsi power domain node. 27 28 - resets: list of phandle + reset specifier pairs, as described in [3]. 28 29 - reset-names: string reset name, must be "apb".
+208
Documentation/devicetree/bindings/display/solomon,ssd1307fb.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/solomon,ssd1307fb.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Solomon SSD1307 OLED Controller Framebuffer 8 + 9 + maintainers: 10 + - Maxime Ripard <mripard@kernel.org> 11 + 12 + properties: 13 + compatible: 14 + enum: 15 + - solomon,ssd1305fb-i2c 16 + - solomon,ssd1306fb-i2c 17 + - solomon,ssd1307fb-i2c 18 + - solomon,ssd1309fb-i2c 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + pwms: 24 + maxItems: 1 25 + 26 + reset-gpios: 27 + maxItems: 1 28 + 29 + vbat-supply: 30 + description: The supply for VBAT 31 + 32 + solomon,height: 33 + $ref: /schemas/types.yaml#/definitions/uint32 34 + default: 16 35 + description: 36 + Height in pixel of the screen driven by the controller 37 + 38 + solomon,width: 39 + $ref: /schemas/types.yaml#/definitions/uint32 40 + default: 96 41 + description: 42 + Width in pixel of the screen driven by the controller 43 + 44 + solomon,page-offset: 45 + $ref: /schemas/types.yaml#/definitions/uint32 46 + default: 1 47 + description: 48 + Offset of pages (band of 8 pixels) that the screen is mapped to 49 + 50 + solomon,segment-no-remap: 51 + type: boolean 52 + description: 53 + Display needs normal (non-inverted) data column to segment mapping 54 + 55 + solomon,col-offset: 56 + $ref: /schemas/types.yaml#/definitions/uint32 57 + default: 0 58 + description: 59 + Offset of columns (COL/SEG) that the screen is mapped to 60 + 61 + solomon,com-seq: 62 + type: boolean 63 + description: 64 + Display uses sequential COM pin configuration 65 + 66 + solomon,com-lrremap: 67 + type: boolean 68 + description: 69 + Display uses left-right COM pin remap 70 + 71 + solomon,com-invdir: 72 + type: boolean 73 + description: 74 + Display uses inverted COM pin scan direction 75 + 76 + solomon,com-offset: 77 + $ref: /schemas/types.yaml#/definitions/uint32 78 + default: 0 79 + description: 80 + Number of the COM pin wired to the first display line 81 + 82 + solomon,prechargep1: 83 + $ref: /schemas/types.yaml#/definitions/uint32 84 + default: 2 85 + description: 86 + Length of deselect period (phase 1) in clock cycles 87 + 88 + solomon,prechargep2: 89 + $ref: /schemas/types.yaml#/definitions/uint32 90 + default: 2 91 + description: 92 + Length of precharge period (phase 2) in clock cycles. This needs to be 93 + the higher, the higher the capacitance of the OLED's pixels is. 94 + 95 + solomon,dclk-div: 96 + $ref: /schemas/types.yaml#/definitions/uint32 97 + minimum: 1 98 + maximum: 16 99 + description: 100 + Clock divisor. The default value is controller-dependent. 101 + 102 + solomon,dclk-frq: 103 + $ref: /schemas/types.yaml#/definitions/uint32 104 + minimum: 0 105 + maximum: 15 106 + description: 107 + Clock frequency, higher value means higher frequency. 108 + The default value is controller-dependent. 109 + 110 + solomon,lookup-table: 111 + $ref: /schemas/types.yaml#/definitions/uint8-array 112 + maxItems: 4 113 + description: 114 + 8 bit value array of current drive pulse widths for BANK0, and colors A, 115 + B, and C. Each value in range of 31 to 63 for pulse widths of 32 to 64. 116 + Color D is always width 64. 117 + 118 + solomon,area-color-enable: 119 + type: boolean 120 + description: 121 + Display uses color mode 122 + 123 + solomon,low-power: 124 + type: boolean 125 + description: 126 + Display runs in low power mode 127 + 128 + required: 129 + - compatible 130 + - reg 131 + 132 + allOf: 133 + - if: 134 + properties: 135 + compatible: 136 + contains: 137 + const: solomon,ssd1305fb-i2c 138 + then: 139 + properties: 140 + solomon,dclk-div: 141 + default: 1 142 + solomon,dclk-frq: 143 + default: 7 144 + 145 + - if: 146 + properties: 147 + compatible: 148 + contains: 149 + const: solomon,ssd1306fb-i2c 150 + then: 151 + properties: 152 + solomon,dclk-div: 153 + default: 1 154 + solomon,dclk-frq: 155 + default: 8 156 + 157 + - if: 158 + properties: 159 + compatible: 160 + contains: 161 + const: solomon,ssd1307fb-i2c 162 + then: 163 + properties: 164 + solomon,dclk-div: 165 + default: 2 166 + solomon,dclk-frq: 167 + default: 12 168 + required: 169 + - pwms 170 + 171 + - if: 172 + properties: 173 + compatible: 174 + contains: 175 + const: solomon,ssd1309fb-i2c 176 + then: 177 + properties: 178 + solomon,dclk-div: 179 + default: 1 180 + solomon,dclk-frq: 181 + default: 10 182 + 183 + additionalProperties: false 184 + 185 + examples: 186 + - | 187 + i2c1 { 188 + #address-cells = <1>; 189 + #size-cells = <0>; 190 + 191 + ssd1307: oled@3c { 192 + compatible = "solomon,ssd1307fb-i2c"; 193 + reg = <0x3c>; 194 + pwms = <&pwm 4 3000>; 195 + reset-gpios = <&gpio2 7>; 196 + }; 197 + 198 + ssd1306: oled@3d { 199 + compatible = "solomon,ssd1306fb-i2c"; 200 + reg = <0x3c>; 201 + pwms = <&pwm 4 3000>; 202 + reset-gpios = <&gpio2 7>; 203 + solomon,com-lrremap; 204 + solomon,com-invdir; 205 + solomon,com-offset = <32>; 206 + solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>; 207 + }; 208 + };
-60
Documentation/devicetree/bindings/display/ssd1307fb.txt
··· 1 - * Solomon SSD1307 Framebuffer Driver 2 - 3 - Required properties: 4 - - compatible: Should be "solomon,<chip>fb-<bus>". The only supported bus for 5 - now is i2c, and the supported chips are ssd1305, ssd1306, ssd1307 and 6 - ssd1309. 7 - - reg: Should contain address of the controller on the I2C bus. Most likely 8 - 0x3c or 0x3d 9 - - pwm: Should contain the pwm to use according to the OF device tree PWM 10 - specification [0]. Only required for the ssd1307. 11 - - solomon,height: Height in pixel of the screen driven by the controller 12 - - solomon,width: Width in pixel of the screen driven by the controller 13 - - solomon,page-offset: Offset of pages (band of 8 pixels) that the screen is 14 - mapped to. 15 - 16 - Optional properties: 17 - - reset-gpios: The GPIO used to reset the OLED display, if available. See 18 - Documentation/devicetree/bindings/gpio/gpio.txt for details. 19 - - vbat-supply: The supply for VBAT 20 - - solomon,segment-no-remap: Display needs normal (non-inverted) data column 21 - to segment mapping 22 - - solomon,col-offset: Offset of columns (COL/SEG) that the screen is mapped to. 23 - - solomon,com-seq: Display uses sequential COM pin configuration 24 - - solomon,com-lrremap: Display uses left-right COM pin remap 25 - - solomon,com-invdir: Display uses inverted COM pin scan direction 26 - - solomon,com-offset: Number of the COM pin wired to the first display line 27 - - solomon,prechargep1: Length of deselect period (phase 1) in clock cycles. 28 - - solomon,prechargep2: Length of precharge period (phase 2) in clock cycles. 29 - This needs to be the higher, the higher the capacitance 30 - of the OLED's pixels is 31 - - solomon,dclk-div: Clock divisor 1 to 16 32 - - solomon,dclk-frq: Clock frequency 0 to 15, higher value means higher 33 - frequency 34 - - solomon,lookup-table: 8 bit value array of current drive pulse widths for 35 - BANK0, and colors A, B, and C. Each value in range 36 - of 31 to 63 for pulse widths of 32 to 64. Color D 37 - is always width 64. 38 - - solomon,area-color-enable: Display uses color mode 39 - - solomon,low-power. Display runs in low power mode 40 - 41 - [0]: Documentation/devicetree/bindings/pwm/pwm.txt 42 - 43 - Examples: 44 - ssd1307: oled@3c { 45 - compatible = "solomon,ssd1307fb-i2c"; 46 - reg = <0x3c>; 47 - pwms = <&pwm 4 3000>; 48 - reset-gpios = <&gpio2 7>; 49 - }; 50 - 51 - ssd1306: oled@3c { 52 - compatible = "solomon,ssd1306fb-i2c"; 53 - reg = <0x3c>; 54 - pwms = <&pwm 4 3000>; 55 - reset-gpios = <&gpio2 7>; 56 - solomon,com-lrremap; 57 - solomon,com-invdir; 58 - solomon,com-offset = <32>; 59 - solomon,lookup-table = /bits/ 8 <0x3f 0x3f 0x3f 0x3f>; 60 - };
+2
Documentation/devicetree/bindings/vendor-prefixes.yaml
··· 936 936 description: Chengdu Kaixuan Information Technology Co., Ltd. 937 937 "^qiaodian,.*": 938 938 description: QiaoDian XianShi Corporation 939 + "^qishenglong,.*": 940 + description: Shenzhen QiShenglong Industrialist Co., Ltd. 939 941 "^qnap,.*": 940 942 description: QNAP Systems, Inc. 941 943 "^radxa,.*":
+1 -1
Documentation/driver-api/thermal/nouveau_thermal.rst
··· 90 90 ----------- 91 91 92 92 Thermal management on Nouveau is new and may not work on all cards. If you have 93 - inquiries, please ping mupuf on IRC (#nouveau, freenode). 93 + inquiries, please ping mupuf on IRC (#nouveau, OFTC). 94 94 95 95 Bug reports should be filled on Freedesktop's bug tracker. Please follow 96 96 https://nouveau.freedesktop.org/wiki/Bugs
+31 -2
Documentation/gpu/drm-kms.rst
··· 463 463 This section of the documentation is primarily aimed at user-space developers. 464 464 For the driver APIs, see the other sections. 465 465 466 + Requirements 467 + ------------ 468 + 469 + KMS drivers might need to add extra properties to support new features. Each 470 + new property introduced in a driver needs to meet a few requirements, in 471 + addition to the one mentioned above: 472 + 473 + * It must be standardized, documenting: 474 + 475 + * The full, exact, name string; 476 + * If the property is an enum, all the valid value name strings; 477 + * What values are accepted, and what these values mean; 478 + * What the property does and how it can be used; 479 + * How the property might interact with other, existing properties. 480 + 481 + * It must provide a generic helper in the core code to register that 482 + property on the object it attaches to. 483 + 484 + * Its content must be decoded by the core and provided in the object's 485 + associated state structure. That includes anything drivers might want 486 + to precompute, like struct drm_clip_rect for planes. 487 + 488 + * Its initial state must match the behavior prior to the property 489 + introduction. This might be a fixed value matching what the hardware 490 + does, or it may be inherited from the state the firmware left the 491 + system in during boot. 492 + 493 + * An IGT test must be submitted where reasonable. 494 + 466 495 Property Types and Blob Property Support 467 496 ---------------------------------------- 468 497 ··· 537 508 Damage Tracking Properties 538 509 -------------------------- 539 510 540 - .. kernel-doc:: drivers/gpu/drm/drm_damage_helper.c 541 - :doc: overview 511 + .. kernel-doc:: drivers/gpu/drm/drm_plane.c 512 + :doc: damage tracking 542 513 543 514 Color Management Properties 544 515 ---------------------------
+9
Documentation/gpu/drm-uapi.rst
··· 37 37 .. kernel-doc:: include/drm/drm_auth.h 38 38 :internal: 39 39 40 + 41 + .. _drm_leasing: 42 + 43 + DRM Display Resource Leasing 44 + ============================ 45 + 46 + .. kernel-doc:: drivers/gpu/drm/drm_lease.c 47 + :doc: drm leasing 48 + 40 49 Open-Source Userspace Requirements 41 50 ================================== 42 51
+3 -3
MAINTAINERS
··· 1690 1690 S: Maintained 1691 1691 W: https://asahilinux.org 1692 1692 B: https://github.com/AsahiLinux/linux/issues 1693 - C: irc://chat.freenode.net/asahi-dev 1693 + C: irc://irc.oftc.net/asahi-dev 1694 1694 T: git https://github.com/AsahiLinux/linux.git 1695 1695 F: Documentation/devicetree/bindings/arm/apple.yaml 1696 1696 F: Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml ··· 6080 6080 L: dri-devel@lists.freedesktop.org 6081 6081 S: Maintained 6082 6082 B: https://gitlab.freedesktop.org/drm 6083 - C: irc://chat.freenode.net/dri-devel 6083 + C: irc://irc.oftc.net/dri-devel 6084 6084 T: git git://anongit.freedesktop.org/drm/drm 6085 6085 F: Documentation/devicetree/bindings/display/ 6086 6086 F: Documentation/devicetree/bindings/gpu/ ··· 9264 9264 W: https://01.org/linuxgraphics/ 9265 9265 Q: http://patchwork.freedesktop.org/project/intel-gfx/ 9266 9266 B: https://gitlab.freedesktop.org/drm/intel/-/wikis/How-to-file-i915-bugs 9267 - C: irc://chat.freenode.net/intel-gfx 9267 + C: irc://irc.oftc.net/intel-gfx 9268 9268 T: git git://anongit.freedesktop.org/drm-intel 9269 9269 F: Documentation/gpu/i915.rst 9270 9270 F: drivers/gpu/drm/i915/
+1 -1
drivers/gpu/drm/bridge/adv7511/adv7533.c
··· 165 165 dsi->lanes = adv->num_dsi_lanes; 166 166 dsi->format = MIPI_DSI_FMT_RGB888; 167 167 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE | 168 - MIPI_DSI_MODE_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE; 168 + MIPI_DSI_MODE_NO_EOT_PACKET | MIPI_DSI_MODE_VIDEO_HSE; 169 169 170 170 ret = mipi_dsi_attach(dsi); 171 171 if (ret < 0) {
+1 -1
drivers/gpu/drm/bridge/analogix/anx7625.c
··· 1307 1307 dsi->format = MIPI_DSI_FMT_RGB888; 1308 1308 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | 1309 1309 MIPI_DSI_MODE_VIDEO_SYNC_PULSE | 1310 - MIPI_DSI_MODE_EOT_PACKET | 1310 + MIPI_DSI_MODE_NO_EOT_PACKET | 1311 1311 MIPI_DSI_MODE_VIDEO_HSE; 1312 1312 1313 1313 if (mipi_dsi_attach(dsi) < 0) {
+2 -2
drivers/gpu/drm/bridge/cdns-dsi.c
··· 829 829 tmp = DIV_ROUND_UP(dsi_cfg.htotal, nlanes) - 830 830 DIV_ROUND_UP(dsi_cfg.hsa, nlanes); 831 831 832 - if (!(output->dev->mode_flags & MIPI_DSI_MODE_EOT_PACKET)) 832 + if (!(output->dev->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)) 833 833 tmp -= DIV_ROUND_UP(DSI_EOT_PKT_SIZE, nlanes); 834 834 835 835 tx_byte_period = DIV_ROUND_DOWN_ULL((u64)NSEC_PER_SEC * 8, ··· 902 902 tmp = readl(dsi->regs + MCTL_MAIN_DATA_CTL); 903 903 tmp &= ~(IF_VID_SELECT_MASK | HOST_EOT_GEN | IF_VID_MODE); 904 904 905 - if (!(output->dev->mode_flags & MIPI_DSI_MODE_EOT_PACKET)) 905 + if (!(output->dev->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)) 906 906 tmp |= HOST_EOT_GEN; 907 907 908 908 if (output->dev->mode_flags & MIPI_DSI_MODE_VIDEO)
+1 -1
drivers/gpu/drm/bridge/lontium-lt8912b.c
··· 487 487 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | 488 488 MIPI_DSI_MODE_VIDEO_BURST | 489 489 MIPI_DSI_MODE_LPM | 490 - MIPI_DSI_MODE_EOT_PACKET; 490 + MIPI_DSI_MODE_NO_EOT_PACKET; 491 491 492 492 ret = mipi_dsi_attach(dsi); 493 493 if (ret < 0) {
+1 -1
drivers/gpu/drm/bridge/nwl-dsi.c
··· 190 190 u32 bpp = mipi_dsi_pixel_format_to_bpp(dsi->format); 191 191 192 192 return DIV64_U64_ROUND_UP(ps * dsi->mode.clock * bpp, 193 - dsi->lanes * 8 * NSEC_PER_SEC); 193 + dsi->lanes * 8ULL * NSEC_PER_SEC); 194 194 } 195 195 196 196 /*
+43 -15
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
··· 246 246 247 247 struct clk *pclk; 248 248 249 + bool device_found; 249 250 unsigned int lane_mbps; /* per lane */ 250 251 u32 channel; 251 252 u32 lanes; ··· 310 309 return readl(dsi->base + reg); 311 310 } 312 311 312 + static int dw_mipi_dsi_panel_or_bridge(struct dw_mipi_dsi *dsi, 313 + struct device_node *node) 314 + { 315 + struct drm_bridge *bridge; 316 + struct drm_panel *panel; 317 + int ret; 318 + 319 + ret = drm_of_find_panel_or_bridge(node, 1, 0, &panel, &bridge); 320 + if (ret) 321 + return ret; 322 + 323 + if (panel) { 324 + bridge = drm_panel_bridge_add_typed(panel, 325 + DRM_MODE_CONNECTOR_DSI); 326 + if (IS_ERR(bridge)) 327 + return PTR_ERR(bridge); 328 + } 329 + 330 + dsi->panel_bridge = bridge; 331 + 332 + if (!dsi->panel_bridge) 333 + return -EPROBE_DEFER; 334 + 335 + return 0; 336 + } 337 + 313 338 static int dw_mipi_dsi_host_attach(struct mipi_dsi_host *host, 314 339 struct mipi_dsi_device *device) 315 340 { 316 341 struct dw_mipi_dsi *dsi = host_to_dsi(host); 317 342 const struct dw_mipi_dsi_plat_data *pdata = dsi->plat_data; 318 - struct drm_bridge *bridge; 319 - struct drm_panel *panel; 320 343 int ret; 321 344 322 345 if (device->lanes > dsi->plat_data->max_data_lanes) { ··· 354 329 dsi->format = device->format; 355 330 dsi->mode_flags = device->mode_flags; 356 331 357 - ret = drm_of_find_panel_or_bridge(host->dev->of_node, 1, 0, 358 - &panel, &bridge); 359 - if (ret) 360 - return ret; 332 + if (!dsi->device_found) { 333 + ret = dw_mipi_dsi_panel_or_bridge(dsi, host->dev->of_node); 334 + if (ret) 335 + return ret; 361 336 362 - if (panel) { 363 - bridge = drm_panel_bridge_add_typed(panel, 364 - DRM_MODE_CONNECTOR_DSI); 365 - if (IS_ERR(bridge)) 366 - return PTR_ERR(bridge); 337 + dsi->device_found = true; 367 338 } 368 - 369 - dsi->panel_bridge = bridge; 370 - 371 - drm_bridge_add(&dsi->bridge); 372 339 373 340 if (pdata->host_ops && pdata->host_ops->attach) { 374 341 ret = pdata->host_ops->attach(pdata->priv_data, device); ··· 1016 999 /* Set the encoder type as caller does not know it */ 1017 1000 bridge->encoder->encoder_type = DRM_MODE_ENCODER_DSI; 1018 1001 1002 + if (!dsi->device_found) { 1003 + int ret; 1004 + 1005 + ret = dw_mipi_dsi_panel_or_bridge(dsi, dsi->dev->of_node); 1006 + if (ret) 1007 + return ret; 1008 + 1009 + dsi->device_found = true; 1010 + } 1011 + 1019 1012 /* Attach the panel-bridge to the dsi bridge */ 1020 1013 return drm_bridge_attach(bridge->encoder, dsi->panel_bridge, bridge, 1021 1014 flags); ··· 1208 1181 #ifdef CONFIG_OF 1209 1182 dsi->bridge.of_node = pdev->dev.of_node; 1210 1183 #endif 1184 + drm_bridge_add(&dsi->bridge); 1211 1185 1212 1186 return dsi; 1213 1187 }
+1 -1
drivers/gpu/drm/bridge/tc358768.c
··· 825 825 if (!(dsi_dev->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)) 826 826 val |= TC358768_DSI_CONTROL_HSCKMD; 827 827 828 - if (dsi_dev->mode_flags & MIPI_DSI_MODE_EOT_PACKET) 828 + if (dsi_dev->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET) 829 829 val |= TC358768_DSI_CONTROL_EOTDIS; 830 830 831 831 tc358768_write(priv, TC358768_DSI_CONFW, val);
+1 -1
drivers/gpu/drm/drm_atomic.c
··· 660 660 return -ENOSPC; 661 661 } 662 662 663 - clips = drm_plane_get_damage_clips(new_plane_state); 663 + clips = __drm_plane_get_damage_clips(new_plane_state); 664 664 num_clips = drm_plane_get_damage_clips_count(new_plane_state); 665 665 666 666 /* Make sure damage clips are valid and inside the fb. */
+5 -4
drivers/gpu/drm/drm_auth.c
··· 63 63 64 64 static bool drm_is_current_master_locked(struct drm_file *fpriv) 65 65 { 66 - lockdep_assert_held_once(&fpriv->minor->dev->master_mutex); 67 - 66 + /* Either drm_device.master_mutex or drm_file.master_lookup_lock 67 + * should be held here. 68 + */ 68 69 return fpriv->is_master && drm_lease_owner(fpriv->master) == fpriv->minor->dev->master; 69 70 } 70 71 ··· 83 82 { 84 83 bool ret; 85 84 86 - mutex_lock(&fpriv->minor->dev->master_mutex); 85 + spin_lock(&fpriv->master_lookup_lock); 87 86 ret = drm_is_current_master_locked(fpriv); 88 - mutex_unlock(&fpriv->minor->dev->master_mutex); 87 + spin_unlock(&fpriv->master_lookup_lock); 89 88 90 89 return ret; 91 90 }
+2
drivers/gpu/drm/drm_crtc_internal.h
··· 262 262 void drm_plane_unregister_all(struct drm_device *dev); 263 263 int drm_plane_check_pixel_format(struct drm_plane *plane, 264 264 u32 format, u64 modifier); 265 + struct drm_mode_rect * 266 + __drm_plane_get_damage_clips(const struct drm_plane_state *state); 265 267 266 268 /* drm_bridge.c */ 267 269 void drm_bridge_detach(struct drm_bridge *bridge);
+1 -55
drivers/gpu/drm/drm_damage_helper.c
··· 34 34 #include <drm/drm_damage_helper.h> 35 35 #include <drm/drm_device.h> 36 36 37 - /** 38 - * DOC: overview 39 - * 40 - * FB_DAMAGE_CLIPS is an optional plane property which provides a means to 41 - * specify a list of damage rectangles on a plane in framebuffer coordinates of 42 - * the framebuffer attached to the plane. In current context damage is the area 43 - * of plane framebuffer that has changed since last plane update (also called 44 - * page-flip), irrespective of whether currently attached framebuffer is same as 45 - * framebuffer attached during last plane update or not. 46 - * 47 - * FB_DAMAGE_CLIPS is a hint to kernel which could be helpful for some drivers 48 - * to optimize internally especially for virtual devices where each framebuffer 49 - * change needs to be transmitted over network, usb, etc. 50 - * 51 - * Since FB_DAMAGE_CLIPS is a hint so it is an optional property. User-space can 52 - * ignore damage clips property and in that case driver will do a full plane 53 - * update. In case damage clips are provided then it is guaranteed that the area 54 - * inside damage clips will be updated to plane. For efficiency driver can do 55 - * full update or can update more than specified in damage clips. Since driver 56 - * is free to read more, user-space must always render the entire visible 57 - * framebuffer. Otherwise there can be corruptions. Also, if a user-space 58 - * provides damage clips which doesn't encompass the actual damage to 59 - * framebuffer (since last plane update) can result in incorrect rendering. 60 - * 61 - * FB_DAMAGE_CLIPS is a blob property with the layout of blob data is simply an 62 - * array of &drm_mode_rect. Unlike plane &drm_plane_state.src coordinates, 63 - * damage clips are not in 16.16 fixed point. Similar to plane src in 64 - * framebuffer, damage clips cannot be negative. In damage clip, x1/y1 are 65 - * inclusive and x2/y2 are exclusive. While kernel does not error for overlapped 66 - * damage clips, it is strongly discouraged. 67 - * 68 - * Drivers that are interested in damage interface for plane should enable 69 - * FB_DAMAGE_CLIPS property by calling drm_plane_enable_fb_damage_clips(). 70 - * Drivers implementing damage can use drm_atomic_helper_damage_iter_init() and 71 - * drm_atomic_helper_damage_iter_next() helper iterator function to get damage 72 - * rectangles clipped to &drm_plane_state.src. 73 - */ 74 - 75 37 static void convert_clip_rect_to_rect(const struct drm_clip_rect *src, 76 38 struct drm_mode_rect *dest, 77 39 uint32_t num_clips, uint32_t src_inc) ··· 48 86 num_clips--; 49 87 } 50 88 } 51 - 52 - /** 53 - * drm_plane_enable_fb_damage_clips - Enables plane fb damage clips property. 54 - * @plane: Plane on which to enable damage clips property. 55 - * 56 - * This function lets driver to enable the damage clips property on a plane. 57 - */ 58 - void drm_plane_enable_fb_damage_clips(struct drm_plane *plane) 59 - { 60 - struct drm_device *dev = plane->dev; 61 - struct drm_mode_config *config = &dev->mode_config; 62 - 63 - drm_object_attach_property(&plane->base, config->prop_fb_damage_clips, 64 - 0); 65 - } 66 - EXPORT_SYMBOL(drm_plane_enable_fb_damage_clips); 67 89 68 90 /** 69 91 * drm_atomic_helper_check_plane_damage - Verify plane damage on atomic_check. ··· 228 282 if (!state || !state->crtc || !state->fb || !state->visible) 229 283 return; 230 284 231 - iter->clips = drm_helper_get_plane_damage_clips(state); 285 + iter->clips = (struct drm_rect *)drm_plane_get_damage_clips(state); 232 286 iter->num_clips = drm_plane_get_damage_clips_count(state); 233 287 234 288 /* Round down for x1/y1 and round up for x2/y2 to catch all pixels */
+6 -4
drivers/gpu/drm/drm_dp_mst_topology.c
··· 2872 2872 idx += tosend + 1; 2873 2873 2874 2874 ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx); 2875 - if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) { 2876 - struct drm_printer p = drm_debug_printer(DBG_PREFIX); 2875 + if (ret) { 2876 + if (drm_debug_enabled(DRM_UT_DP)) { 2877 + struct drm_printer p = drm_debug_printer(DBG_PREFIX); 2877 2878 2878 - drm_printf(&p, "sideband msg failed to send\n"); 2879 - drm_dp_mst_dump_sideband_msg_tx(&p, txmsg); 2879 + drm_printf(&p, "sideband msg failed to send\n"); 2880 + drm_dp_mst_dump_sideband_msg_tx(&p, txmsg); 2881 + } 2880 2882 return ret; 2881 2883 } 2882 2884
+21 -1
drivers/gpu/drm/drm_framebuffer.c
··· 404 404 struct drm_framebuffer *fb = 405 405 list_first_entry(&arg->fbs, typeof(*fb), filp_head); 406 406 407 + drm_dbg_kms(fb->dev, 408 + "Removing [FB:%d] from all active usage due to RMFB ioctl\n", 409 + fb->base.id); 407 410 list_del_init(&fb->filp_head); 408 411 drm_framebuffer_remove(fb); 409 412 } ··· 984 981 if (plane->state->fb != fb) 985 982 continue; 986 983 984 + drm_dbg_kms(dev, 985 + "Disabling [PLANE:%d:%s] because [FB:%d] is removed\n", 986 + plane->base.id, plane->name, fb->base.id); 987 + 987 988 plane_state = drm_atomic_get_plane_state(state, plane); 988 989 if (IS_ERR(plane_state)) { 989 990 ret = PTR_ERR(plane_state); ··· 996 989 997 990 if (disable_crtcs && plane_state->crtc->primary == plane) { 998 991 struct drm_crtc_state *crtc_state; 992 + 993 + drm_dbg_kms(dev, 994 + "Disabling [CRTC:%d:%s] because [FB:%d] is removed\n", 995 + plane_state->crtc->base.id, 996 + plane_state->crtc->name, fb->base.id); 999 997 1000 998 crtc_state = drm_atomic_get_existing_crtc_state(state, plane_state->crtc); 1001 999 ··· 1064 1052 /* remove from any CRTC */ 1065 1053 drm_for_each_crtc(crtc, dev) { 1066 1054 if (crtc->primary->fb == fb) { 1055 + drm_dbg_kms(dev, 1056 + "Disabling [CRTC:%d:%s] because [FB:%d] is removed\n", 1057 + crtc->base.id, crtc->name, fb->base.id); 1058 + 1067 1059 /* should turn off the crtc */ 1068 1060 if (drm_crtc_force_disable(crtc)) 1069 1061 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc); ··· 1075 1059 } 1076 1060 1077 1061 drm_for_each_plane(plane, dev) { 1078 - if (plane->fb == fb) 1062 + if (plane->fb == fb) { 1063 + drm_dbg_kms(dev, 1064 + "Disabling [PLANE:%d:%s] because [FB:%d] is removed\n", 1065 + plane->base.id, plane->name, fb->base.id); 1079 1066 drm_plane_force_disable(plane); 1067 + } 1080 1068 } 1081 1069 drm_modeset_unlock_all(dev); 1082 1070 }
+89
drivers/gpu/drm/drm_gem_framebuffer_helper.c
··· 306 306 } 307 307 EXPORT_SYMBOL_GPL(drm_gem_fb_create_with_dirty); 308 308 309 + /** 310 + * drm_gem_fb_begin_cpu_access - prepares GEM buffer objects for CPU access 311 + * @fb: the framebuffer 312 + * @dir: access mode 313 + * 314 + * Prepares a framebuffer's GEM buffer objects for CPU access. This function 315 + * must be called before accessing the BO data within the kernel. For imported 316 + * BOs, the function calls dma_buf_begin_cpu_access(). 317 + * 318 + * See drm_gem_fb_end_cpu_access() for signalling the end of CPU access. 319 + * 320 + * Returns: 321 + * 0 on success, or a negative errno code otherwise. 322 + */ 323 + int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir) 324 + { 325 + struct dma_buf_attachment *import_attach; 326 + struct drm_gem_object *obj; 327 + size_t i; 328 + int ret, ret2; 329 + 330 + for (i = 0; i < ARRAY_SIZE(fb->obj); ++i) { 331 + obj = drm_gem_fb_get_obj(fb, i); 332 + if (!obj) 333 + continue; 334 + import_attach = obj->import_attach; 335 + if (!import_attach) 336 + continue; 337 + ret = dma_buf_begin_cpu_access(import_attach->dmabuf, dir); 338 + if (ret) 339 + goto err_dma_buf_end_cpu_access; 340 + } 341 + 342 + return 0; 343 + 344 + err_dma_buf_end_cpu_access: 345 + while (i) { 346 + --i; 347 + obj = drm_gem_fb_get_obj(fb, i); 348 + if (!obj) 349 + continue; 350 + import_attach = obj->import_attach; 351 + if (!import_attach) 352 + continue; 353 + ret2 = dma_buf_end_cpu_access(import_attach->dmabuf, dir); 354 + if (ret2) { 355 + drm_err(fb->dev, 356 + "dma_buf_end_cpu_access() failed during error handling: %d\n", 357 + ret2); 358 + } 359 + } 360 + 361 + return ret; 362 + } 363 + EXPORT_SYMBOL(drm_gem_fb_begin_cpu_access); 364 + 365 + /** 366 + * drm_gem_fb_end_cpu_access - signals end of CPU access to GEM buffer objects 367 + * @fb: the framebuffer 368 + * @dir: access mode 369 + * 370 + * Signals the end of CPU access to the given framebuffer's GEM buffer objects. This 371 + * function must be paired with a corresponding call to drm_gem_fb_begin_cpu_access(). 372 + * For imported BOs, the function calls dma_buf_end_cpu_access(). 373 + * 374 + * See also drm_gem_fb_begin_cpu_access(). 375 + */ 376 + void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir) 377 + { 378 + size_t i = ARRAY_SIZE(fb->obj); 379 + struct dma_buf_attachment *import_attach; 380 + struct drm_gem_object *obj; 381 + int ret; 382 + 383 + while (i) { 384 + --i; 385 + obj = drm_gem_fb_get_obj(fb, i); 386 + if (!obj) 387 + continue; 388 + import_attach = obj->import_attach; 389 + if (!import_attach) 390 + continue; 391 + ret = dma_buf_end_cpu_access(import_attach->dmabuf, dir); 392 + if (ret) 393 + drm_err(fb->dev, "dma_buf_end_cpu_access() failed: %d\n", ret); 394 + } 395 + } 396 + EXPORT_SYMBOL(drm_gem_fb_end_cpu_access); 397 + 309 398 static __u32 drm_gem_afbc_get_bpp(struct drm_device *dev, 310 399 const struct drm_mode_fb_cmd2 *mode_cmd) 311 400 {
+51
drivers/gpu/drm/drm_lease.c
··· 15 15 #include "drm_crtc_internal.h" 16 16 #include "drm_internal.h" 17 17 18 + /** 19 + * DOC: drm leasing 20 + * 21 + * DRM leases provide information about whether a DRM master may control a DRM 22 + * mode setting object. This enables the creation of multiple DRM masters that 23 + * manage subsets of display resources. 24 + * 25 + * The original DRM master of a device 'owns' the available drm resources. It 26 + * may create additional DRM masters and 'lease' resources which it controls 27 + * to the new DRM master. This gives the new DRM master control over the 28 + * leased resources until the owner revokes the lease, or the new DRM master 29 + * is closed. Some helpful terminology: 30 + * 31 + * - An 'owner' is a &struct drm_master that is not leasing objects from 32 + * another &struct drm_master, and hence 'owns' the objects. The owner can be 33 + * identified as the &struct drm_master for which &drm_master.lessor is NULL. 34 + * 35 + * - A 'lessor' is a &struct drm_master which is leasing objects to one or more 36 + * other &struct drm_master. Currently, lessees are not allowed to 37 + * create sub-leases, hence the lessor is the same as the owner. 38 + * 39 + * - A 'lessee' is a &struct drm_master which is leasing objects from some 40 + * other &struct drm_master. Each lessee only leases resources from a single 41 + * lessor recorded in &drm_master.lessor, and holds the set of objects that 42 + * it is leasing in &drm_master.leases. 43 + * 44 + * - A 'lease' is a contract between the lessor and lessee that identifies 45 + * which resources may be controlled by the lessee. All of the resources 46 + * that are leased must be owned by or leased to the lessor, and lessors are 47 + * not permitted to lease the same object to multiple lessees. 48 + * 49 + * The set of objects any &struct drm_master 'controls' is limited to the set 50 + * of objects it leases (for lessees) or all objects (for owners). 51 + * 52 + * Objects not controlled by a &struct drm_master cannot be modified through 53 + * the various state manipulating ioctls, and any state reported back to user 54 + * space will be edited to make them appear idle and/or unusable. For 55 + * instance, connectors always report 'disconnected', while encoders 56 + * report no possible crtcs or clones. 57 + * 58 + * Since each lessee may lease objects from a single lessor, display resource 59 + * leases form a tree of &struct drm_master. As lessees are currently not 60 + * allowed to create sub-leases, the tree depth is limited to 1. All of 61 + * these get activated simultaneously when the top level device owner changes 62 + * through the SETMASTER or DROPMASTER IOCTL, so &drm_device.master points to 63 + * the owner at the top of the lease tree (i.e. the &struct drm_master for which 64 + * &drm_master.lessor is NULL). The full list of lessees that are leasing 65 + * objects from the owner can be searched via the owner's 66 + * &drm_master.lessee_idr. 67 + */ 68 + 18 69 #define drm_for_each_lessee(lessee, lessor) \ 19 70 list_for_each_entry((lessee), &(lessor)->lessees, lessee_list) 20 71
+7 -13
drivers/gpu/drm/drm_mipi_dbi.c
··· 7 7 8 8 #include <linux/debugfs.h> 9 9 #include <linux/delay.h> 10 - #include <linux/dma-buf.h> 11 10 #include <linux/gpio/consumer.h> 12 11 #include <linux/module.h> 13 12 #include <linux/regulator/consumer.h> ··· 201 202 { 202 203 struct drm_gem_object *gem = drm_gem_fb_get_obj(fb, 0); 203 204 struct drm_gem_cma_object *cma_obj = to_drm_gem_cma_obj(gem); 204 - struct dma_buf_attachment *import_attach = gem->import_attach; 205 205 void *src = cma_obj->vaddr; 206 - int ret = 0; 206 + int ret; 207 207 208 - if (import_attach) { 209 - ret = dma_buf_begin_cpu_access(import_attach->dmabuf, 210 - DMA_FROM_DEVICE); 211 - if (ret) 212 - return ret; 213 - } 208 + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); 209 + if (ret) 210 + return ret; 214 211 215 212 switch (fb->format->format) { 216 213 case DRM_FORMAT_RGB565: 217 214 if (swap) 218 - drm_fb_swab(dst, src, fb, clip, !import_attach); 215 + drm_fb_swab(dst, src, fb, clip, !gem->import_attach); 219 216 else 220 217 drm_fb_memcpy(dst, src, fb, clip); 221 218 break; ··· 224 229 return -EINVAL; 225 230 } 226 231 227 - if (import_attach) 228 - ret = dma_buf_end_cpu_access(import_attach->dmabuf, 229 - DMA_FROM_DEVICE); 232 + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); 233 + 230 234 return ret; 231 235 } 232 236 EXPORT_SYMBOL(mipi_dbi_buf_copy);
+104
drivers/gpu/drm/drm_plane.c
··· 1397 1397 return ret; 1398 1398 } 1399 1399 1400 + /** 1401 + * DOC: damage tracking 1402 + * 1403 + * FB_DAMAGE_CLIPS is an optional plane property which provides a means to 1404 + * specify a list of damage rectangles on a plane in framebuffer coordinates of 1405 + * the framebuffer attached to the plane. In current context damage is the area 1406 + * of plane framebuffer that has changed since last plane update (also called 1407 + * page-flip), irrespective of whether currently attached framebuffer is same as 1408 + * framebuffer attached during last plane update or not. 1409 + * 1410 + * FB_DAMAGE_CLIPS is a hint to kernel which could be helpful for some drivers 1411 + * to optimize internally especially for virtual devices where each framebuffer 1412 + * change needs to be transmitted over network, usb, etc. 1413 + * 1414 + * Since FB_DAMAGE_CLIPS is a hint so it is an optional property. User-space can 1415 + * ignore damage clips property and in that case driver will do a full plane 1416 + * update. In case damage clips are provided then it is guaranteed that the area 1417 + * inside damage clips will be updated to plane. For efficiency driver can do 1418 + * full update or can update more than specified in damage clips. Since driver 1419 + * is free to read more, user-space must always render the entire visible 1420 + * framebuffer. Otherwise there can be corruptions. Also, if a user-space 1421 + * provides damage clips which doesn't encompass the actual damage to 1422 + * framebuffer (since last plane update) can result in incorrect rendering. 1423 + * 1424 + * FB_DAMAGE_CLIPS is a blob property with the layout of blob data is simply an 1425 + * array of &drm_mode_rect. Unlike plane &drm_plane_state.src coordinates, 1426 + * damage clips are not in 16.16 fixed point. Similar to plane src in 1427 + * framebuffer, damage clips cannot be negative. In damage clip, x1/y1 are 1428 + * inclusive and x2/y2 are exclusive. While kernel does not error for overlapped 1429 + * damage clips, it is strongly discouraged. 1430 + * 1431 + * Drivers that are interested in damage interface for plane should enable 1432 + * FB_DAMAGE_CLIPS property by calling drm_plane_enable_fb_damage_clips(). 1433 + * Drivers implementing damage can use drm_atomic_helper_damage_iter_init() and 1434 + * drm_atomic_helper_damage_iter_next() helper iterator function to get damage 1435 + * rectangles clipped to &drm_plane_state.src. 1436 + */ 1437 + 1438 + /** 1439 + * drm_plane_enable_fb_damage_clips - Enables plane fb damage clips property. 1440 + * @plane: Plane on which to enable damage clips property. 1441 + * 1442 + * This function lets driver to enable the damage clips property on a plane. 1443 + */ 1444 + void drm_plane_enable_fb_damage_clips(struct drm_plane *plane) 1445 + { 1446 + struct drm_device *dev = plane->dev; 1447 + struct drm_mode_config *config = &dev->mode_config; 1448 + 1449 + drm_object_attach_property(&plane->base, config->prop_fb_damage_clips, 1450 + 0); 1451 + } 1452 + EXPORT_SYMBOL(drm_plane_enable_fb_damage_clips); 1453 + 1454 + /** 1455 + * drm_plane_get_damage_clips_count - Returns damage clips count. 1456 + * @state: Plane state. 1457 + * 1458 + * Simple helper to get the number of &drm_mode_rect clips set by user-space 1459 + * during plane update. 1460 + * 1461 + * Return: Number of clips in plane fb_damage_clips blob property. 1462 + */ 1463 + unsigned int 1464 + drm_plane_get_damage_clips_count(const struct drm_plane_state *state) 1465 + { 1466 + return (state && state->fb_damage_clips) ? 1467 + state->fb_damage_clips->length/sizeof(struct drm_mode_rect) : 0; 1468 + } 1469 + EXPORT_SYMBOL(drm_plane_get_damage_clips_count); 1470 + 1471 + struct drm_mode_rect * 1472 + __drm_plane_get_damage_clips(const struct drm_plane_state *state) 1473 + { 1474 + return (struct drm_mode_rect *)((state && state->fb_damage_clips) ? 1475 + state->fb_damage_clips->data : NULL); 1476 + } 1477 + 1478 + /** 1479 + * drm_plane_get_damage_clips - Returns damage clips. 1480 + * @state: Plane state. 1481 + * 1482 + * Note that this function returns uapi type &drm_mode_rect. Drivers might want 1483 + * to use the helper functions drm_atomic_helper_damage_iter_init() and 1484 + * drm_atomic_helper_damage_iter_next() or drm_atomic_helper_damage_merged() if 1485 + * the driver can only handle a single damage region at most. 1486 + * 1487 + * Return: Damage clips in plane fb_damage_clips blob property. 1488 + */ 1489 + struct drm_mode_rect * 1490 + drm_plane_get_damage_clips(const struct drm_plane_state *state) 1491 + { 1492 + struct drm_device *dev = state->plane->dev; 1493 + struct drm_mode_config *config = &dev->mode_config; 1494 + 1495 + /* check that drm_plane_enable_fb_damage_clips() was called */ 1496 + if (!drm_mode_obj_find_prop_id(&state->plane->base, 1497 + config->prop_fb_damage_clips->base.id)) 1498 + drm_warn_once(dev, "drm_plane_enable_fb_damage_clips() not called\n"); 1499 + 1500 + return __drm_plane_get_damage_clips(state); 1501 + } 1502 + EXPORT_SYMBOL(drm_plane_get_damage_clips); 1503 + 1400 1504 struct drm_property * 1401 1505 drm_create_scaling_filter_prop(struct drm_device *dev, 1402 1506 unsigned int supported_filters)
+1 -1
drivers/gpu/drm/drm_prime.c
··· 549 549 * 550 550 * FIXME: The underlying helper functions are named rather inconsistently. 551 551 * 552 - * Exporting buffers 552 + * Importing buffers 553 553 * ~~~~~~~~~~~~~~~~~ 554 554 * 555 555 * Importing dma-bufs using drm_gem_prime_import() relies on
+4 -4
drivers/gpu/drm/exynos/exynos_drm_dsi.c
··· 809 809 reg |= DSIM_AUTO_MODE; 810 810 if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO_HSE) 811 811 reg |= DSIM_HSE_MODE; 812 - if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_HFP)) 812 + if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HFP)) 813 813 reg |= DSIM_HFP_MODE; 814 - if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_HBP)) 814 + if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HBP)) 815 815 reg |= DSIM_HBP_MODE; 816 - if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_HSA)) 816 + if (!(dsi->mode_flags & MIPI_DSI_MODE_VIDEO_NO_HSA)) 817 817 reg |= DSIM_HSA_MODE; 818 818 } 819 819 820 - if (!(dsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET)) 820 + if (!(dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)) 821 821 reg |= DSIM_EOT_DISABLE; 822 822 823 823 switch (dsi->format) {
+5 -8
drivers/gpu/drm/gud/gud_pipe.c
··· 3 3 * Copyright 2020 Noralf Trønnes 4 4 */ 5 5 6 - #include <linux/dma-buf.h> 7 6 #include <linux/lz4.h> 8 7 #include <linux/usb.h> 9 8 #include <linux/workqueue.h> ··· 14 15 #include <drm/drm_format_helper.h> 15 16 #include <drm/drm_fourcc.h> 16 17 #include <drm/drm_framebuffer.h> 18 + #include <drm/drm_gem_framebuffer_helper.h> 17 19 #include <drm/drm_gem_shmem_helper.h> 18 20 #include <drm/drm_print.h> 19 21 #include <drm/drm_rect.h> ··· 168 168 169 169 vaddr = map.vaddr + fb->offsets[0]; 170 170 171 - if (import_attach) { 172 - ret = dma_buf_begin_cpu_access(import_attach->dmabuf, DMA_FROM_DEVICE); 173 - if (ret) 174 - goto vunmap; 175 - } 171 + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); 172 + if (ret) 173 + goto vunmap; 176 174 retry: 177 175 if (compression) 178 176 buf = gdrm->compress_buf; ··· 223 225 } 224 226 225 227 end_cpu_access: 226 - if (import_attach) 227 - dma_buf_end_cpu_access(import_attach->dmabuf, DMA_FROM_DEVICE); 228 + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); 228 229 vunmap: 229 230 drm_gem_shmem_vunmap(fb->obj[0], &map); 230 231
-1
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
··· 249 249 250 250 static int hibmc_unload(struct drm_device *dev) 251 251 { 252 - struct hibmc_drm_private *priv = to_hibmc_drm_private(dev); 253 252 struct pci_dev *pdev = to_pci_dev(dev->dev); 254 253 255 254 drm_atomic_helper_shutdown(dev);
+1 -1
drivers/gpu/drm/mcde/mcde_dsi.c
··· 760 760 DSI_MCTL_MAIN_DATA_CTL_BTA_EN | 761 761 DSI_MCTL_MAIN_DATA_CTL_READ_EN | 762 762 DSI_MCTL_MAIN_DATA_CTL_REG_TE_EN; 763 - if (!(d->mdsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET)) 763 + if (!(d->mdsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)) 764 764 val |= DSI_MCTL_MAIN_DATA_CTL_HOST_EOT_GEN; 765 765 writel(val, d->regs + DSI_MCTL_MAIN_DATA_CTL); 766 766
+2 -2
drivers/gpu/drm/mediatek/mtk_dsi.c
··· 404 404 if (dsi->mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) 405 405 tmp_reg |= HSTX_CKLP_EN; 406 406 407 - if (!(dsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET)) 407 + if (!(dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET)) 408 408 tmp_reg |= DIS_EOT; 409 409 410 410 writel(tmp_reg, dsi->regs + DSI_TXRX_CTRL); ··· 481 481 timing->da_hs_zero + timing->da_hs_exit + 3; 482 482 483 483 delta = dsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST ? 18 : 12; 484 - delta += dsi->mode_flags & MIPI_DSI_MODE_EOT_PACKET ? 2 : 0; 484 + delta += dsi->mode_flags & MIPI_DSI_MODE_NO_EOT_PACKET ? 2 : 0; 485 485 486 486 horizontal_frontporch_byte = vm->hfront_porch * dsi_tmp_buf_bpp; 487 487 horizontal_front_back_byte = horizontal_frontporch_byte + horizontal_backporch_byte;
+4 -4
drivers/gpu/drm/msm/dsi/dsi_host.c
··· 849 849 if (flags & MIPI_DSI_MODE_VIDEO) { 850 850 if (flags & MIPI_DSI_MODE_VIDEO_HSE) 851 851 data |= DSI_VID_CFG0_PULSE_MODE_HSA_HE; 852 - if (flags & MIPI_DSI_MODE_VIDEO_HFP) 852 + if (flags & MIPI_DSI_MODE_VIDEO_NO_HFP) 853 853 data |= DSI_VID_CFG0_HFP_POWER_STOP; 854 - if (flags & MIPI_DSI_MODE_VIDEO_HBP) 854 + if (flags & MIPI_DSI_MODE_VIDEO_NO_HBP) 855 855 data |= DSI_VID_CFG0_HBP_POWER_STOP; 856 - if (flags & MIPI_DSI_MODE_VIDEO_HSA) 856 + if (flags & MIPI_DSI_MODE_VIDEO_NO_HSA) 857 857 data |= DSI_VID_CFG0_HSA_POWER_STOP; 858 858 /* Always set low power stop mode for BLLP 859 859 * to let command engine send packets ··· 908 908 DSI_T_CLK_PRE_EXTEND_INC_BY_2_BYTECLK); 909 909 910 910 data = 0; 911 - if (!(flags & MIPI_DSI_MODE_EOT_PACKET)) 911 + if (!(flags & MIPI_DSI_MODE_NO_EOT_PACKET)) 912 912 data |= DSI_EOT_PACKET_CTRL_TX_EOT_APPEND; 913 913 dsi_write(msm_host, REG_DSI_EOT_PACKET_CTRL, data); 914 914
+3
drivers/gpu/drm/mxsfb/mxsfb_drv.c
··· 51 51 .hs_wdth_mask = 0xff, 52 52 .hs_wdth_shift = 24, 53 53 .has_overlay = false, 54 + .has_ctrl2 = false, 54 55 }, 55 56 [MXSFB_V4] = { 56 57 .transfer_count = LCDC_V4_TRANSFER_COUNT, ··· 60 59 .hs_wdth_mask = 0x3fff, 61 60 .hs_wdth_shift = 18, 62 61 .has_overlay = false, 62 + .has_ctrl2 = true, 63 63 }, 64 64 [MXSFB_V6] = { 65 65 .transfer_count = LCDC_V4_TRANSFER_COUNT, ··· 69 67 .hs_wdth_mask = 0x3fff, 70 68 .hs_wdth_shift = 18, 71 69 .has_overlay = true, 70 + .has_ctrl2 = true, 72 71 }, 73 72 }; 74 73
+1
drivers/gpu/drm/mxsfb/mxsfb_drv.h
··· 22 22 unsigned int hs_wdth_mask; 23 23 unsigned int hs_wdth_shift; 24 24 bool has_overlay; 25 + bool has_ctrl2; 25 26 }; 26 27 27 28 struct mxsfb_drm_private {
+64 -8
drivers/gpu/drm/mxsfb/mxsfb_kms.c
··· 47 47 * Setup the MXSFB registers for decoding the pixels out of the framebuffer and 48 48 * outputting them on the bus. 49 49 */ 50 - static void mxsfb_set_formats(struct mxsfb_drm_private *mxsfb) 50 + static void mxsfb_set_formats(struct mxsfb_drm_private *mxsfb, 51 + const u32 bus_format) 51 52 { 52 53 struct drm_device *drm = mxsfb->drm; 53 54 const u32 format = mxsfb->crtc.primary->state->fb->format->format; 54 - u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24; 55 55 u32 ctrl, ctrl1; 56 - 57 - if (mxsfb->connector->display_info.num_bus_formats) 58 - bus_format = mxsfb->connector->display_info.bus_formats[0]; 59 56 60 57 DRM_DEV_DEBUG_DRIVER(drm->dev, "Using bus_format: 0x%08X\n", 61 58 bus_format); ··· 104 107 clk_prepare_enable(mxsfb->clk_disp_axi); 105 108 clk_prepare_enable(mxsfb->clk); 106 109 110 + /* Increase number of outstanding requests on all supported IPs */ 111 + if (mxsfb->devdata->has_ctrl2) { 112 + reg = readl(mxsfb->base + LCDC_V4_CTRL2); 113 + reg &= ~CTRL2_SET_OUTSTANDING_REQS_MASK; 114 + reg |= CTRL2_SET_OUTSTANDING_REQS_16; 115 + writel(reg, mxsfb->base + LCDC_V4_CTRL2); 116 + } 117 + 107 118 /* If it was disabled, re-enable the mode again */ 108 119 writel(CTRL_DOTCLK_MODE, mxsfb->base + LCDC_CTRL + REG_SET); 109 120 ··· 119 114 reg = readl(mxsfb->base + LCDC_VDCTRL4); 120 115 reg |= VDCTRL4_SYNC_SIGNALS_ON; 121 116 writel(reg, mxsfb->base + LCDC_VDCTRL4); 117 + 118 + /* 119 + * Enable recovery on underflow. 120 + * 121 + * There is some sort of corner case behavior of the controller, 122 + * which could rarely be triggered at least on i.MX6SX connected 123 + * to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS 124 + * bridged 1920x1080 panel (and likely on other setups too), where 125 + * the image on the panel shifts to the right and wraps around. 126 + * This happens either when the controller is enabled on boot or 127 + * even later during run time. The condition does not correct 128 + * itself automatically, i.e. the display image remains shifted. 129 + * 130 + * It seems this problem is known and is due to sporadic underflows 131 + * of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow 132 + * IRQs, neither of the IRQs trigger and neither IRQ status bit is 133 + * asserted when this condition occurs. 134 + * 135 + * All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW 136 + * bit, which is described in the reference manual since i.MX23 as 137 + * " 138 + * Set this bit to enable the LCDIF block to recover in the next 139 + * field/frame if there was an underflow in the current field/frame. 140 + * " 141 + * Enable this bit to mitigate the sporadic underflows. 142 + */ 143 + reg = readl(mxsfb->base + LCDC_CTRL1); 144 + reg |= CTRL1_RECOVER_ON_UNDERFLOW; 145 + writel(reg, mxsfb->base + LCDC_CTRL1); 122 146 123 147 writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET); 124 148 } ··· 219 185 return gem->paddr; 220 186 } 221 187 222 - static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) 188 + static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb, 189 + const u32 bus_format) 223 190 { 224 191 struct drm_device *drm = mxsfb->crtc.dev; 225 192 struct drm_display_mode *m = &mxsfb->crtc.state->adjusted_mode; ··· 241 206 242 207 /* Clear the FIFOs */ 243 208 writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET); 209 + readl(mxsfb->base + LCDC_CTRL1); 210 + writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_CLR); 211 + readl(mxsfb->base + LCDC_CTRL1); 244 212 245 213 if (mxsfb->devdata->has_overlay) 246 214 writel(0, mxsfb->base + LCDC_AS_CTRL); 247 215 248 - mxsfb_set_formats(mxsfb); 216 + mxsfb_set_formats(mxsfb, bus_format); 249 217 250 218 clk_set_rate(mxsfb->clk, m->crtc_clock * 1000); 251 219 ··· 346 308 struct drm_atomic_state *state) 347 309 { 348 310 struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(crtc->dev); 311 + struct drm_bridge_state *bridge_state; 349 312 struct drm_device *drm = mxsfb->drm; 313 + u32 bus_format = 0; 350 314 dma_addr_t paddr; 351 315 352 316 pm_runtime_get_sync(drm->dev); ··· 356 316 357 317 drm_crtc_vblank_on(crtc); 358 318 359 - mxsfb_crtc_mode_set_nofb(mxsfb); 319 + /* If there is a bridge attached to the LCDIF, use its bus format */ 320 + if (mxsfb->bridge) { 321 + bridge_state = 322 + drm_atomic_get_new_bridge_state(state, 323 + mxsfb->bridge); 324 + bus_format = bridge_state->input_bus_cfg.format; 325 + } 326 + 327 + /* If there is no bridge, use bus format from connector */ 328 + if (!bus_format && mxsfb->connector->display_info.num_bus_formats) 329 + bus_format = mxsfb->connector->display_info.bus_formats[0]; 330 + 331 + /* If all else fails, default to RGB888_1X24 */ 332 + if (!bus_format) 333 + bus_format = MEDIA_BUS_FMT_RGB888_1X24; 334 + 335 + mxsfb_crtc_mode_set_nofb(mxsfb, bus_format); 360 336 361 337 /* Write cur_buf as well to avoid an initial corrupt frame */ 362 338 paddr = mxsfb_get_fb_paddr(crtc->primary);
+9
drivers/gpu/drm/mxsfb/mxsfb_regs.h
··· 15 15 #define LCDC_CTRL 0x00 16 16 #define LCDC_CTRL1 0x10 17 17 #define LCDC_V3_TRANSFER_COUNT 0x20 18 + #define LCDC_V4_CTRL2 0x20 18 19 #define LCDC_V4_TRANSFER_COUNT 0x30 19 20 #define LCDC_V4_CUR_BUF 0x40 20 21 #define LCDC_V4_NEXT_BUF 0x50 ··· 55 54 #define CTRL_DF24 BIT(1) 56 55 #define CTRL_RUN BIT(0) 57 56 57 + #define CTRL1_RECOVER_ON_UNDERFLOW BIT(24) 58 58 #define CTRL1_FIFO_CLEAR BIT(21) 59 59 #define CTRL1_SET_BYTE_PACKAGING(x) (((x) & 0xf) << 16) 60 60 #define CTRL1_GET_BYTE_PACKAGING(x) (((x) >> 16) & 0xf) 61 61 #define CTRL1_CUR_FRAME_DONE_IRQ_EN BIT(13) 62 62 #define CTRL1_CUR_FRAME_DONE_IRQ BIT(9) 63 + 64 + #define CTRL2_SET_OUTSTANDING_REQS_1 0 65 + #define CTRL2_SET_OUTSTANDING_REQS_2 (0x1 << 21) 66 + #define CTRL2_SET_OUTSTANDING_REQS_4 (0x2 << 21) 67 + #define CTRL2_SET_OUTSTANDING_REQS_8 (0x3 << 21) 68 + #define CTRL2_SET_OUTSTANDING_REQS_16 (0x4 << 21) 69 + #define CTRL2_SET_OUTSTANDING_REQS_MASK (0x7 << 21) 63 70 64 71 #define TRANSFER_COUNT_SET_VCOUNT(x) (((x) & 0xffff) << 16) 65 72 #define TRANSFER_COUNT_GET_VCOUNT(x) (((x) >> 16) & 0xffff)
+1 -1
drivers/gpu/drm/panel/panel-asus-z00t-tm5p5-n35596.c
··· 302 302 dsi->lanes = 4; 303 303 dsi->format = MIPI_DSI_FMT_RGB888; 304 304 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 305 - MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_EOT_PACKET | 305 + MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_NO_EOT_PACKET | 306 306 MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM; 307 307 308 308 drm_panel_init(&ctx->panel, dev, &tm5p5_nt35596_panel_funcs,
+1 -1
drivers/gpu/drm/panel/panel-dsi-cm.c
··· 574 574 dsi->lanes = 2; 575 575 dsi->format = MIPI_DSI_FMT_RGB888; 576 576 dsi->mode_flags = MIPI_DSI_CLOCK_NON_CONTINUOUS | 577 - MIPI_DSI_MODE_EOT_PACKET; 577 + MIPI_DSI_MODE_NO_EOT_PACKET; 578 578 dsi->hs_rate = ddata->panel_data->max_hs_rate; 579 579 dsi->lp_rate = ddata->panel_data->max_lp_rate; 580 580
+1 -1
drivers/gpu/drm/panel/panel-elida-kd35t133.c
··· 273 273 dsi->lanes = 1; 274 274 dsi->format = MIPI_DSI_FMT_RGB888; 275 275 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 276 - MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET | 276 + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET | 277 277 MIPI_DSI_CLOCK_NON_CONTINUOUS; 278 278 279 279 drm_panel_init(&ctx->panel, &dsi->dev, &kd35t133_funcs,
+1 -1
drivers/gpu/drm/panel/panel-khadas-ts050.c
··· 809 809 dsi->lanes = 4; 810 810 dsi->format = MIPI_DSI_FMT_RGB888; 811 811 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 812 - MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET; 812 + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET; 813 813 814 814 khadas_ts050 = devm_kzalloc(&dsi->dev, sizeof(*khadas_ts050), 815 815 GFP_KERNEL);
+1 -1
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
··· 593 593 dsi->lanes = 4; 594 594 dsi->format = MIPI_DSI_FMT_RGB888; 595 595 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 596 - MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET; 596 + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET; 597 597 598 598 drm_panel_init(&ctx->panel, &dsi->dev, &ltk050h3146w_funcs, 599 599 DRM_MODE_CONNECTOR_DSI);
+1 -1
drivers/gpu/drm/panel/panel-leadtek-ltk500hd1829.c
··· 442 442 dsi->lanes = 4; 443 443 dsi->format = MIPI_DSI_FMT_RGB888; 444 444 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 445 - MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET; 445 + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET; 446 446 447 447 drm_panel_init(&ctx->panel, &dsi->dev, &ltk500hd1829_funcs, 448 448 DRM_MODE_CONNECTOR_DSI);
+1 -1
drivers/gpu/drm/panel/panel-osd-osd101t2587-53ts.c
··· 184 184 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | 185 185 MIPI_DSI_MODE_VIDEO_BURST | 186 186 MIPI_DSI_MODE_VIDEO_SYNC_PULSE | 187 - MIPI_DSI_MODE_EOT_PACKET; 187 + MIPI_DSI_MODE_NO_EOT_PACKET; 188 188 189 189 osd101t2587 = devm_kzalloc(&dsi->dev, sizeof(*osd101t2587), GFP_KERNEL); 190 190 if (!osd101t2587)
+1 -1
drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
··· 446 446 447 447 dsi->lanes = 1; 448 448 dsi->format = MIPI_DSI_FMT_RGB888; 449 - dsi->mode_flags = MIPI_DSI_MODE_EOT_PACKET; 449 + dsi->mode_flags = MIPI_DSI_MODE_NO_EOT_PACKET; 450 450 451 451 ctx->supplies[0].supply = "vdd3"; 452 452 ctx->supplies[1].supply = "vci";
+2 -2
drivers/gpu/drm/panel/panel-samsung-s6e8aa0.c
··· 990 990 dsi->lanes = 4; 991 991 dsi->format = MIPI_DSI_FMT_RGB888; 992 992 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST 993 - | MIPI_DSI_MODE_VIDEO_HFP | MIPI_DSI_MODE_VIDEO_HBP 994 - | MIPI_DSI_MODE_VIDEO_HSA | MIPI_DSI_MODE_EOT_PACKET 993 + | MIPI_DSI_MODE_VIDEO_NO_HFP | MIPI_DSI_MODE_VIDEO_NO_HBP 994 + | MIPI_DSI_MODE_VIDEO_NO_HSA | MIPI_DSI_MODE_NO_EOT_PACKET 995 995 | MIPI_DSI_MODE_VSYNC_FLUSH | MIPI_DSI_MODE_VIDEO_AUTO_VERT; 996 996 997 997 ret = s6e8aa0_parse_dt(ctx);
+1 -1
drivers/gpu/drm/panel/panel-sharp-ls043t1le01.c
··· 282 282 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | 283 283 MIPI_DSI_MODE_VIDEO_HSE | 284 284 MIPI_DSI_CLOCK_NON_CONTINUOUS | 285 - MIPI_DSI_MODE_EOT_PACKET; 285 + MIPI_DSI_MODE_NO_EOT_PACKET; 286 286 287 287 sharp_nt = devm_kzalloc(&dsi->dev, sizeof(*sharp_nt), GFP_KERNEL); 288 288 if (!sharp_nt)
+67 -1
drivers/gpu/drm/panel/panel-simple.c
··· 1122 1122 }, 1123 1123 }; 1124 1124 1125 + static const struct drm_display_mode auo_b133han05_mode = { 1126 + .clock = 142600, 1127 + .hdisplay = 1920, 1128 + .hsync_start = 1920 + 58, 1129 + .hsync_end = 1920 + 58 + 42, 1130 + .htotal = 1920 + 58 + 42 + 60, 1131 + .vdisplay = 1080, 1132 + .vsync_start = 1080 + 3, 1133 + .vsync_end = 1080 + 3 + 5, 1134 + .vtotal = 1080 + 3 + 5 + 54, 1135 + }; 1136 + 1137 + static const struct panel_desc auo_b133han05 = { 1138 + .modes = &auo_b133han05_mode, 1139 + .num_modes = 1, 1140 + .bpc = 8, 1141 + .size = { 1142 + .width = 293, 1143 + .height = 165, 1144 + }, 1145 + .delay = { 1146 + .prepare = 100, 1147 + .enable = 20, 1148 + .unprepare = 50, 1149 + }, 1150 + .bus_format = MEDIA_BUS_FMT_RGB888_1X24, 1151 + .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB, 1152 + .connector_type = DRM_MODE_CONNECTOR_eDP, 1153 + }; 1154 + 1125 1155 static const struct drm_display_mode auo_b133htn01_mode = { 1126 1156 .clock = 150660, 1127 1157 .hdisplay = 1920, ··· 1177 1147 .enable = 20, 1178 1148 .unprepare = 50, 1179 1149 }, 1150 + }; 1151 + 1152 + static const struct drm_display_mode auo_b140han06_mode = { 1153 + .clock = 141000, 1154 + .hdisplay = 1920, 1155 + .hsync_start = 1920 + 16, 1156 + .hsync_end = 1920 + 16 + 16, 1157 + .htotal = 1920 + 16 + 16 + 152, 1158 + .vdisplay = 1080, 1159 + .vsync_start = 1080 + 3, 1160 + .vsync_end = 1080 + 3 + 14, 1161 + .vtotal = 1080 + 3 + 14 + 19, 1162 + }; 1163 + 1164 + static const struct panel_desc auo_b140han06 = { 1165 + .modes = &auo_b140han06_mode, 1166 + .num_modes = 1, 1167 + .bpc = 8, 1168 + .size = { 1169 + .width = 309, 1170 + .height = 174, 1171 + }, 1172 + .delay = { 1173 + .prepare = 100, 1174 + .enable = 20, 1175 + .unprepare = 50, 1176 + }, 1177 + .bus_format = MEDIA_BUS_FMT_RGB888_1X24, 1178 + .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB, 1179 + .connector_type = DRM_MODE_CONNECTOR_eDP, 1180 1180 }; 1181 1181 1182 1182 static const struct display_timing auo_g070vvn01_timings = { ··· 4424 4364 .compatible = "auo,b116xw03", 4425 4365 .data = &auo_b116xw03, 4426 4366 }, { 4367 + .compatible = "auo,b133han05", 4368 + .data = &auo_b133han05, 4369 + }, { 4427 4370 .compatible = "auo,b133htn01", 4428 4371 .data = &auo_b133htn01, 4372 + }, { 4373 + .compatible = "auo,b140han06", 4374 + .data = &auo_b140han06, 4429 4375 }, { 4430 4376 .compatible = "auo,b133xtn01", 4431 4377 .data = &auo_b133xtn01, ··· 5072 5006 }, 5073 5007 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 5074 5008 MIPI_DSI_MODE_VIDEO_SYNC_PULSE | 5075 - MIPI_DSI_MODE_EOT_PACKET, 5009 + MIPI_DSI_MODE_NO_EOT_PACKET, 5076 5010 .format = MIPI_DSI_FMT_RGB888, 5077 5011 .lanes = 4, 5078 5012 };
+26 -56
drivers/gpu/drm/panel/panel-sony-acx424akp.c
··· 40 40 struct acx424akp { 41 41 struct drm_panel panel; 42 42 struct device *dev; 43 - struct backlight_device *bl; 44 43 struct regulator *supply; 45 44 struct gpio_desc *reset_gpio; 46 45 bool video_mode; ··· 100 101 u8 pwm_div; 101 102 u8 par; 102 103 int ret; 104 + 105 + if (backlight_is_blank(bl)) { 106 + /* Disable backlight */ 107 + par = 0x00; 108 + ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 109 + &par, 1); 110 + if (ret) { 111 + dev_err(acx->dev, "failed to disable display backlight (%d)\n", ret); 112 + return ret; 113 + } 114 + return 0; 115 + } 103 116 104 117 /* Calculate the PWM duty cycle in n/256's */ 105 118 pwm_ratio = max(((duty_ns * 256) / period_ns) - 1, 1); ··· 181 170 182 171 static const struct backlight_ops acx424akp_bl_ops = { 183 172 .update_status = acx424akp_set_brightness, 173 + }; 174 + 175 + static const struct backlight_properties acx424akp_bl_props = { 176 + .type = BACKLIGHT_RAW, 177 + .brightness = 512, 178 + .max_brightness = 1023, 184 179 }; 185 180 186 181 static int acx424akp_read_id(struct acx424akp *acx) ··· 327 310 } 328 311 } 329 312 330 - acx->bl->props.power = FB_BLANK_NORMAL; 331 - 332 313 return 0; 333 314 334 315 err_power_off: ··· 338 323 { 339 324 struct acx424akp *acx = panel_to_acx424akp(panel); 340 325 struct mipi_dsi_device *dsi = to_mipi_dsi_device(acx->dev); 341 - u8 par; 342 326 int ret; 343 - 344 - /* Disable backlight */ 345 - par = 0x00; 346 - ret = mipi_dsi_dcs_write(dsi, MIPI_DCS_WRITE_CONTROL_DISPLAY, 347 - &par, 1); 348 - if (ret) { 349 - dev_err(acx->dev, "failed to disable display backlight (%d)\n", ret); 350 - return ret; 351 - } 352 327 353 328 ret = mipi_dsi_dcs_set_display_off(dsi); 354 329 if (ret) { ··· 355 350 msleep(85); 356 351 357 352 acx424akp_power_off(acx); 358 - acx->bl->props.power = FB_BLANK_POWERDOWN; 359 353 360 354 return 0; 361 355 } 362 356 363 - static int acx424akp_enable(struct drm_panel *panel) 364 - { 365 - struct acx424akp *acx = panel_to_acx424akp(panel); 366 - 367 - /* 368 - * The backlight is on as long as the display is on 369 - * so no use to call backlight_enable() here. 370 - */ 371 - acx->bl->props.power = FB_BLANK_UNBLANK; 372 - 373 - return 0; 374 - } 375 - 376 - static int acx424akp_disable(struct drm_panel *panel) 377 - { 378 - struct acx424akp *acx = panel_to_acx424akp(panel); 379 - 380 - /* 381 - * The backlight is on as long as the display is on 382 - * so no use to call backlight_disable() here. 383 - */ 384 - acx->bl->props.power = FB_BLANK_NORMAL; 385 - 386 - return 0; 387 - } 388 357 389 358 static int acx424akp_get_modes(struct drm_panel *panel, 390 359 struct drm_connector *connector) ··· 388 409 } 389 410 390 411 static const struct drm_panel_funcs acx424akp_drm_funcs = { 391 - .disable = acx424akp_disable, 392 412 .unprepare = acx424akp_unprepare, 393 413 .prepare = acx424akp_prepare, 394 - .enable = acx424akp_enable, 395 414 .get_modes = acx424akp_get_modes, 396 415 }; 397 416 ··· 435 458 /* This asserts RESET by default */ 436 459 acx->reset_gpio = devm_gpiod_get_optional(dev, "reset", 437 460 GPIOD_OUT_HIGH); 438 - if (IS_ERR(acx->reset_gpio)) { 439 - ret = PTR_ERR(acx->reset_gpio); 440 - if (ret != -EPROBE_DEFER) 441 - dev_err(dev, "failed to request GPIO (%d)\n", ret); 442 - return ret; 443 - } 461 + if (IS_ERR(acx->reset_gpio)) 462 + return dev_err_probe(dev, PTR_ERR(acx->reset_gpio), 463 + "failed to request GPIO\n"); 444 464 445 465 drm_panel_init(&acx->panel, dev, &acx424akp_drm_funcs, 446 466 DRM_MODE_CONNECTOR_DSI); 447 467 448 - acx->bl = devm_backlight_device_register(dev, "acx424akp", dev, acx, 449 - &acx424akp_bl_ops, NULL); 450 - if (IS_ERR(acx->bl)) { 451 - dev_err(dev, "failed to register backlight device\n"); 452 - return PTR_ERR(acx->bl); 453 - } 454 - acx->bl->props.max_brightness = 1023; 455 - acx->bl->props.brightness = 512; 456 - acx->bl->props.power = FB_BLANK_POWERDOWN; 468 + acx->panel.backlight = devm_backlight_device_register(dev, "acx424akp", dev, acx, 469 + &acx424akp_bl_ops, &acx424akp_bl_props); 470 + if (IS_ERR(acx->panel.backlight)) 471 + return dev_err_probe(dev, PTR_ERR(acx->panel.backlight), 472 + "failed to register backlight device\n"); 457 473 458 474 drm_panel_add(&acx->panel); 459 475
+1 -1
drivers/gpu/drm/panel/panel-xinpeng-xpp055c272.c
··· 311 311 dsi->lanes = 4; 312 312 dsi->format = MIPI_DSI_FMT_RGB888; 313 313 dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST | 314 - MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_EOT_PACKET; 314 + MIPI_DSI_MODE_LPM | MIPI_DSI_MODE_NO_EOT_PACKET; 315 315 316 316 drm_panel_init(&ctx->panel, &dsi->dev, &xpp055c272_funcs, 317 317 DRM_MODE_CONNECTOR_DSI);
+2 -1
drivers/gpu/drm/panfrost/panfrost_devfreq.c
··· 106 106 if (ret) { 107 107 /* Continue if the optional regulator is missing */ 108 108 if (ret != -ENODEV) { 109 - DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); 109 + if (ret != -EPROBE_DEFER) 110 + DRM_DEV_ERROR(dev, "Couldn't set OPP regulators\n"); 110 111 return ret; 111 112 } 112 113 }
+2
drivers/gpu/drm/rockchip/Kconfig
··· 10 10 select DRM_DW_HDMI if ROCKCHIP_DW_HDMI 11 11 select DRM_DW_MIPI_DSI if ROCKCHIP_DW_MIPI_DSI 12 12 select DRM_RGB if ROCKCHIP_RGB 13 + select GENERIC_PHY if ROCKCHIP_DW_MIPI_DSI 14 + select GENERIC_PHY_MIPI_DPHY if ROCKCHIP_DW_MIPI_DSI 13 15 select SND_SOC_HDMI_CODEC if ROCKCHIP_CDN_DP && SND_SOC 14 16 help 15 17 Choose this option if you have a Rockchip soc chipset.
+349
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
··· 14 14 #include <linux/of_device.h> 15 15 #include <linux/phy/phy.h> 16 16 #include <linux/pm_runtime.h> 17 + #include <linux/phy/phy.h> 17 18 #include <linux/regmap.h> 18 19 19 20 #include <video/mipi_display.h> ··· 126 125 #define BANDGAP_AND_BIAS_CONTROL 0x20 127 126 #define TERMINATION_RESISTER_CONTROL 0x21 128 127 #define AFE_BIAS_BANDGAP_ANALOG_PROGRAMMABILITY 0x22 128 + #define HS_RX_CONTROL_OF_LANE_CLK 0x34 129 129 #define HS_RX_CONTROL_OF_LANE_0 0x44 130 + #define HS_RX_CONTROL_OF_LANE_1 0x54 130 131 #define HS_TX_CLOCK_LANE_REQUEST_STATE_TIME_CONTROL 0x60 131 132 #define HS_TX_CLOCK_LANE_PREPARE_STATE_TIME_CONTROL 0x61 132 133 #define HS_TX_CLOCK_LANE_HS_ZERO_STATE_TIME_CONTROL 0x62 ··· 140 137 #define HS_TX_DATA_LANE_HS_ZERO_STATE_TIME_CONTROL 0x72 141 138 #define HS_TX_DATA_LANE_TRAIL_STATE_TIME_CONTROL 0x73 142 139 #define HS_TX_DATA_LANE_EXIT_STATE_TIME_CONTROL 0x74 140 + #define HS_RX_DATA_LANE_THS_SETTLE_CONTROL 0x75 141 + #define HS_RX_CONTROL_OF_LANE_2 0x84 142 + #define HS_RX_CONTROL_OF_LANE_3 0x94 143 143 144 144 #define DW_MIPI_NEEDS_PHY_CFG_CLK BIT(0) 145 145 #define DW_MIPI_NEEDS_GRF_CLK BIT(1) ··· 177 171 #define RK3399_TXRX_MASTERSLAVEZ BIT(7) 178 172 #define RK3399_TXRX_ENABLECLK BIT(6) 179 173 #define RK3399_TXRX_BASEDIR BIT(5) 174 + #define RK3399_TXRX_SRC_SEL_ISP0 BIT(4) 175 + #define RK3399_TXRX_TURNREQUEST GENMASK(3, 0) 180 176 181 177 #define HIWORD_UPDATE(val, mask) (val | (mask) << 16) 182 178 183 179 #define to_dsi(nm) container_of(nm, struct dw_mipi_dsi_rockchip, nm) 180 + 181 + enum { 182 + DW_DSI_USAGE_IDLE, 183 + DW_DSI_USAGE_DSI, 184 + DW_DSI_USAGE_PHY, 185 + }; 184 186 185 187 enum { 186 188 BANDGAP_97_07, ··· 227 213 u32 lanecfg2_grf_reg; 228 214 u32 lanecfg2; 229 215 216 + int (*dphy_rx_init)(struct phy *phy); 217 + int (*dphy_rx_power_on)(struct phy *phy); 218 + int (*dphy_rx_power_off)(struct phy *phy); 219 + 230 220 unsigned int flags; 231 221 unsigned int max_data_lanes; 232 222 }; ··· 241 223 void __iomem *base; 242 224 243 225 struct regmap *grf_regmap; 226 + struct clk *pclk; 244 227 struct clk *pllref_clk; 245 228 struct clk *grf_clk; 246 229 struct clk *phy_cfg_clk; ··· 253 234 /* optional external dphy */ 254 235 struct phy *phy; 255 236 union phy_configure_opts phy_opts; 237 + 238 + /* being a phy for other mipi hosts */ 239 + unsigned int usage_mode; 240 + struct mutex usage_mutex; 241 + struct phy *dphy; 242 + struct phy_configure_opts_mipi_dphy dphy_config; 256 243 257 244 unsigned int lane_mbps; /* per lane */ 258 245 u16 input_div; ··· 1003 978 struct device *second; 1004 979 int ret; 1005 980 981 + mutex_lock(&dsi->usage_mutex); 982 + 983 + if (dsi->usage_mode != DW_DSI_USAGE_IDLE) { 984 + DRM_DEV_ERROR(dsi->dev, "dsi controller already in use\n"); 985 + mutex_unlock(&dsi->usage_mutex); 986 + return -EBUSY; 987 + } 988 + 989 + dsi->usage_mode = DW_DSI_USAGE_DSI; 990 + mutex_unlock(&dsi->usage_mutex); 991 + 1006 992 ret = component_add(dsi->dev, &dw_mipi_dsi_rockchip_ops); 1007 993 if (ret) { 1008 994 DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n", ··· 1049 1013 1050 1014 component_del(dsi->dev, &dw_mipi_dsi_rockchip_ops); 1051 1015 1016 + mutex_lock(&dsi->usage_mutex); 1017 + dsi->usage_mode = DW_DSI_USAGE_IDLE; 1018 + mutex_unlock(&dsi->usage_mutex); 1019 + 1052 1020 return 0; 1053 1021 } 1054 1022 ··· 1061 1021 .detach = dw_mipi_dsi_rockchip_host_detach, 1062 1022 }; 1063 1023 1024 + static int dw_mipi_dsi_rockchip_dphy_bind(struct device *dev, 1025 + struct device *master, 1026 + void *data) 1027 + { 1028 + /* 1029 + * Nothing to do when used as a dphy. 1030 + * Just make the rest of Rockchip-DRM happy 1031 + * by being here. 1032 + */ 1033 + 1034 + return 0; 1035 + } 1036 + 1037 + static void dw_mipi_dsi_rockchip_dphy_unbind(struct device *dev, 1038 + struct device *master, 1039 + void *data) 1040 + { 1041 + /* Nothing to do when used as a dphy. */ 1042 + } 1043 + 1044 + static const struct component_ops dw_mipi_dsi_rockchip_dphy_ops = { 1045 + .bind = dw_mipi_dsi_rockchip_dphy_bind, 1046 + .unbind = dw_mipi_dsi_rockchip_dphy_unbind, 1047 + }; 1048 + 1049 + static int dw_mipi_dsi_dphy_init(struct phy *phy) 1050 + { 1051 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1052 + int ret; 1053 + 1054 + mutex_lock(&dsi->usage_mutex); 1055 + 1056 + if (dsi->usage_mode != DW_DSI_USAGE_IDLE) { 1057 + DRM_DEV_ERROR(dsi->dev, "dsi controller already in use\n"); 1058 + mutex_unlock(&dsi->usage_mutex); 1059 + return -EBUSY; 1060 + } 1061 + 1062 + dsi->usage_mode = DW_DSI_USAGE_PHY; 1063 + mutex_unlock(&dsi->usage_mutex); 1064 + 1065 + ret = component_add(dsi->dev, &dw_mipi_dsi_rockchip_dphy_ops); 1066 + if (ret < 0) 1067 + goto err_graph; 1068 + 1069 + if (dsi->cdata->dphy_rx_init) { 1070 + ret = clk_prepare_enable(dsi->pclk); 1071 + if (ret < 0) 1072 + goto err_init; 1073 + 1074 + ret = clk_prepare_enable(dsi->grf_clk); 1075 + if (ret) { 1076 + clk_disable_unprepare(dsi->pclk); 1077 + goto err_init; 1078 + } 1079 + 1080 + ret = dsi->cdata->dphy_rx_init(phy); 1081 + clk_disable_unprepare(dsi->grf_clk); 1082 + clk_disable_unprepare(dsi->pclk); 1083 + if (ret < 0) 1084 + goto err_init; 1085 + } 1086 + 1087 + return 0; 1088 + 1089 + err_init: 1090 + component_del(dsi->dev, &dw_mipi_dsi_rockchip_dphy_ops); 1091 + err_graph: 1092 + mutex_lock(&dsi->usage_mutex); 1093 + dsi->usage_mode = DW_DSI_USAGE_IDLE; 1094 + mutex_unlock(&dsi->usage_mutex); 1095 + 1096 + return ret; 1097 + } 1098 + 1099 + static int dw_mipi_dsi_dphy_exit(struct phy *phy) 1100 + { 1101 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1102 + 1103 + component_del(dsi->dev, &dw_mipi_dsi_rockchip_dphy_ops); 1104 + 1105 + mutex_lock(&dsi->usage_mutex); 1106 + dsi->usage_mode = DW_DSI_USAGE_IDLE; 1107 + mutex_unlock(&dsi->usage_mutex); 1108 + 1109 + return 0; 1110 + } 1111 + 1112 + static int dw_mipi_dsi_dphy_configure(struct phy *phy, union phy_configure_opts *opts) 1113 + { 1114 + struct phy_configure_opts_mipi_dphy *config = &opts->mipi_dphy; 1115 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1116 + int ret; 1117 + 1118 + ret = phy_mipi_dphy_config_validate(&opts->mipi_dphy); 1119 + if (ret) 1120 + return ret; 1121 + 1122 + dsi->dphy_config = *config; 1123 + dsi->lane_mbps = div_u64(config->hs_clk_rate, 1000 * 1000 * 1); 1124 + 1125 + return 0; 1126 + } 1127 + 1128 + static int dw_mipi_dsi_dphy_power_on(struct phy *phy) 1129 + { 1130 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1131 + int i, ret; 1132 + 1133 + DRM_DEV_DEBUG(dsi->dev, "lanes %d - data_rate_mbps %u\n", 1134 + dsi->dphy_config.lanes, dsi->lane_mbps); 1135 + 1136 + i = max_mbps_to_parameter(dsi->lane_mbps); 1137 + if (i < 0) { 1138 + DRM_DEV_ERROR(dsi->dev, "failed to get parameter for %dmbps clock\n", 1139 + dsi->lane_mbps); 1140 + return i; 1141 + } 1142 + 1143 + ret = pm_runtime_get_sync(dsi->dev); 1144 + if (ret < 0) { 1145 + DRM_DEV_ERROR(dsi->dev, "failed to enable device: %d\n", ret); 1146 + return ret; 1147 + } 1148 + 1149 + ret = clk_prepare_enable(dsi->pclk); 1150 + if (ret) { 1151 + DRM_DEV_ERROR(dsi->dev, "Failed to enable pclk: %d\n", ret); 1152 + goto err_pclk; 1153 + } 1154 + 1155 + ret = clk_prepare_enable(dsi->grf_clk); 1156 + if (ret) { 1157 + DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); 1158 + goto err_grf_clk; 1159 + } 1160 + 1161 + ret = clk_prepare_enable(dsi->phy_cfg_clk); 1162 + if (ret) { 1163 + DRM_DEV_ERROR(dsi->dev, "Failed to enable phy_cfg_clk: %d\n", ret); 1164 + goto err_phy_cfg_clk; 1165 + } 1166 + 1167 + /* do soc-variant specific init */ 1168 + if (dsi->cdata->dphy_rx_power_on) { 1169 + ret = dsi->cdata->dphy_rx_power_on(phy); 1170 + if (ret < 0) { 1171 + DRM_DEV_ERROR(dsi->dev, "hardware-specific phy bringup failed: %d\n", ret); 1172 + goto err_pwr_on; 1173 + } 1174 + } 1175 + 1176 + /* 1177 + * Configure hsfreqrange according to frequency values 1178 + * Set clock lane and hsfreqrange by lane0(test code 0x44) 1179 + */ 1180 + dw_mipi_dsi_phy_write(dsi, HS_RX_CONTROL_OF_LANE_CLK, 0); 1181 + dw_mipi_dsi_phy_write(dsi, HS_RX_CONTROL_OF_LANE_0, 1182 + HSFREQRANGE_SEL(dppa_map[i].hsfreqrange)); 1183 + dw_mipi_dsi_phy_write(dsi, HS_RX_CONTROL_OF_LANE_1, 0); 1184 + dw_mipi_dsi_phy_write(dsi, HS_RX_CONTROL_OF_LANE_2, 0); 1185 + dw_mipi_dsi_phy_write(dsi, HS_RX_CONTROL_OF_LANE_3, 0); 1186 + 1187 + /* Normal operation */ 1188 + dw_mipi_dsi_phy_write(dsi, 0x0, 0); 1189 + 1190 + clk_disable_unprepare(dsi->phy_cfg_clk); 1191 + clk_disable_unprepare(dsi->grf_clk); 1192 + 1193 + return ret; 1194 + 1195 + err_pwr_on: 1196 + clk_disable_unprepare(dsi->phy_cfg_clk); 1197 + err_phy_cfg_clk: 1198 + clk_disable_unprepare(dsi->grf_clk); 1199 + err_grf_clk: 1200 + clk_disable_unprepare(dsi->pclk); 1201 + err_pclk: 1202 + pm_runtime_put(dsi->dev); 1203 + return ret; 1204 + } 1205 + 1206 + static int dw_mipi_dsi_dphy_power_off(struct phy *phy) 1207 + { 1208 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1209 + int ret; 1210 + 1211 + ret = clk_prepare_enable(dsi->grf_clk); 1212 + if (ret) { 1213 + DRM_DEV_ERROR(dsi->dev, "Failed to enable grf_clk: %d\n", ret); 1214 + return ret; 1215 + } 1216 + 1217 + if (dsi->cdata->dphy_rx_power_off) { 1218 + ret = dsi->cdata->dphy_rx_power_off(phy); 1219 + if (ret < 0) 1220 + DRM_DEV_ERROR(dsi->dev, "hardware-specific phy shutdown failed: %d\n", ret); 1221 + } 1222 + 1223 + clk_disable_unprepare(dsi->grf_clk); 1224 + clk_disable_unprepare(dsi->pclk); 1225 + 1226 + pm_runtime_put(dsi->dev); 1227 + 1228 + return ret; 1229 + } 1230 + 1231 + static const struct phy_ops dw_mipi_dsi_dphy_ops = { 1232 + .configure = dw_mipi_dsi_dphy_configure, 1233 + .power_on = dw_mipi_dsi_dphy_power_on, 1234 + .power_off = dw_mipi_dsi_dphy_power_off, 1235 + .init = dw_mipi_dsi_dphy_init, 1236 + .exit = dw_mipi_dsi_dphy_exit, 1237 + }; 1238 + 1064 1239 static int dw_mipi_dsi_rockchip_probe(struct platform_device *pdev) 1065 1240 { 1066 1241 struct device *dev = &pdev->dev; 1067 1242 struct device_node *np = dev->of_node; 1068 1243 struct dw_mipi_dsi_rockchip *dsi; 1244 + struct phy_provider *phy_provider; 1069 1245 struct resource *res; 1070 1246 const struct rockchip_dw_dsi_chip_data *cdata = 1071 1247 of_device_get_match_data(dev); ··· 1318 1062 if (IS_ERR(dsi->phy)) { 1319 1063 ret = PTR_ERR(dsi->phy); 1320 1064 DRM_DEV_ERROR(dev, "failed to get mipi dphy: %d\n", ret); 1065 + return ret; 1066 + } 1067 + 1068 + dsi->pclk = devm_clk_get(dev, "pclk"); 1069 + if (IS_ERR(dsi->pclk)) { 1070 + ret = PTR_ERR(dsi->pclk); 1071 + DRM_DEV_ERROR(dev, "Unable to get pclk: %d\n", ret); 1321 1072 return ret; 1322 1073 } 1323 1074 ··· 1377 1114 dsi->pdata.host_ops = &dw_mipi_dsi_rockchip_host_ops; 1378 1115 dsi->pdata.priv_data = dsi; 1379 1116 platform_set_drvdata(pdev, dsi); 1117 + 1118 + mutex_init(&dsi->usage_mutex); 1119 + 1120 + dsi->dphy = devm_phy_create(dev, NULL, &dw_mipi_dsi_dphy_ops); 1121 + if (IS_ERR(dsi->dphy)) { 1122 + DRM_DEV_ERROR(&pdev->dev, "failed to create PHY\n"); 1123 + return PTR_ERR(dsi->dphy); 1124 + } 1125 + 1126 + phy_set_drvdata(dsi->dphy, dsi); 1127 + phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); 1128 + if (IS_ERR(phy_provider)) 1129 + return PTR_ERR(phy_provider); 1380 1130 1381 1131 dsi->dmd = dw_mipi_dsi_probe(pdev, &dsi->pdata); 1382 1132 if (IS_ERR(dsi->dmd)) { ··· 1454 1178 { /* sentinel */ } 1455 1179 }; 1456 1180 1181 + static int rk3399_dphy_tx1rx1_init(struct phy *phy) 1182 + { 1183 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1184 + 1185 + /* 1186 + * Set TX1RX1 source to isp1. 1187 + * Assume ISP0 is supplied by the RX0 dphy. 1188 + */ 1189 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON24, 1190 + HIWORD_UPDATE(0, RK3399_TXRX_SRC_SEL_ISP0)); 1191 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON24, 1192 + HIWORD_UPDATE(0, RK3399_TXRX_MASTERSLAVEZ)); 1193 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON24, 1194 + HIWORD_UPDATE(0, RK3399_TXRX_BASEDIR)); 1195 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON23, 1196 + HIWORD_UPDATE(0, RK3399_DSI1_ENABLE)); 1197 + 1198 + return 0; 1199 + } 1200 + 1201 + static int rk3399_dphy_tx1rx1_power_on(struct phy *phy) 1202 + { 1203 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1204 + 1205 + /* tester reset pulse */ 1206 + dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_TESTCLK | PHY_TESTCLR); 1207 + usleep_range(100, 150); 1208 + 1209 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON24, 1210 + HIWORD_UPDATE(0, RK3399_TXRX_MASTERSLAVEZ)); 1211 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON24, 1212 + HIWORD_UPDATE(RK3399_TXRX_BASEDIR, RK3399_TXRX_BASEDIR)); 1213 + 1214 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON23, 1215 + HIWORD_UPDATE(0, RK3399_DSI1_FORCERXMODE)); 1216 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON23, 1217 + HIWORD_UPDATE(0, RK3399_DSI1_FORCETXSTOPMODE)); 1218 + 1219 + /* Disable lane turn around, which is ignored in receive mode */ 1220 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON24, 1221 + HIWORD_UPDATE(0, RK3399_TXRX_TURNREQUEST)); 1222 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON23, 1223 + HIWORD_UPDATE(RK3399_DSI1_TURNDISABLE, 1224 + RK3399_DSI1_TURNDISABLE)); 1225 + usleep_range(100, 150); 1226 + 1227 + dsi_write(dsi, DSI_PHY_TST_CTRL0, PHY_TESTCLK | PHY_UNTESTCLR); 1228 + usleep_range(100, 150); 1229 + 1230 + /* Enable dphy lanes */ 1231 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON23, 1232 + HIWORD_UPDATE(GENMASK(dsi->dphy_config.lanes - 1, 0), 1233 + RK3399_DSI1_ENABLE)); 1234 + 1235 + usleep_range(100, 150); 1236 + 1237 + return 0; 1238 + } 1239 + 1240 + static int rk3399_dphy_tx1rx1_power_off(struct phy *phy) 1241 + { 1242 + struct dw_mipi_dsi_rockchip *dsi = phy_get_drvdata(phy); 1243 + 1244 + regmap_write(dsi->grf_regmap, RK3399_GRF_SOC_CON23, 1245 + HIWORD_UPDATE(0, RK3399_DSI1_ENABLE)); 1246 + 1247 + return 0; 1248 + } 1249 + 1457 1250 static const struct rockchip_dw_dsi_chip_data rk3399_chip_data[] = { 1458 1251 { 1459 1252 .reg = 0xff960000, ··· 1565 1220 1566 1221 .flags = DW_MIPI_NEEDS_PHY_CFG_CLK | DW_MIPI_NEEDS_GRF_CLK, 1567 1222 .max_data_lanes = 4, 1223 + 1224 + .dphy_rx_init = rk3399_dphy_tx1rx1_init, 1225 + .dphy_rx_power_on = rk3399_dphy_tx1rx1_power_on, 1226 + .dphy_rx_power_off = rk3399_dphy_tx1rx1_power_off, 1568 1227 }, 1569 1228 { /* sentinel */ } 1570 1229 };
+9 -5
drivers/gpu/drm/shmobile/shmob_drm_drv.c
··· 18 18 #include <drm/drm_crtc_helper.h> 19 19 #include <drm/drm_drv.h> 20 20 #include <drm/drm_gem_cma_helper.h> 21 - #include <drm/drm_irq.h> 22 21 #include <drm/drm_probe_helper.h> 23 22 #include <drm/drm_vblank.h> 24 23 ··· 129 130 130 131 static const struct drm_driver shmob_drm_driver = { 131 132 .driver_features = DRIVER_GEM | DRIVER_MODESET, 132 - .irq_handler = shmob_drm_irq, 133 133 DRM_GEM_CMA_DRIVER_OPS, 134 134 .fops = &shmob_drm_fops, 135 135 .name = "shmob-drm", ··· 181 183 182 184 drm_dev_unregister(ddev); 183 185 drm_kms_helper_poll_fini(ddev); 184 - drm_irq_uninstall(ddev); 186 + free_irq(sdev->irq, ddev); 185 187 drm_dev_put(ddev); 186 188 187 189 return 0; ··· 256 258 goto err_modeset_cleanup; 257 259 } 258 260 259 - ret = drm_irq_install(ddev, platform_get_irq(pdev, 0)); 261 + ret = platform_get_irq(pdev, 0); 262 + if (ret < 0) 263 + goto err_modeset_cleanup; 264 + sdev->irq = ret; 265 + 266 + ret = request_irq(sdev->irq, shmob_drm_irq, 0, ddev->driver->name, 267 + ddev); 260 268 if (ret < 0) { 261 269 dev_err(&pdev->dev, "failed to install IRQ handler\n"); 262 270 goto err_modeset_cleanup; ··· 279 275 return 0; 280 276 281 277 err_irq_uninstall: 282 - drm_irq_uninstall(ddev); 278 + free_irq(sdev->irq, ddev); 283 279 err_modeset_cleanup: 284 280 drm_kms_helper_poll_fini(ddev); 285 281 err_free_drm_dev:
+1
drivers/gpu/drm/shmobile/shmob_drm_drv.h
··· 29 29 u32 lddckr; 30 30 u32 ldmt1r; 31 31 32 + unsigned int irq; 32 33 spinlock_t irq_lock; /* Protects hardware LDINTR register */ 33 34 34 35 struct drm_device *ddev;
+5 -14
drivers/gpu/drm/tiny/gm12u320.c
··· 3 3 * Copyright 2019 Hans de Goede <hdegoede@redhat.com> 4 4 */ 5 5 6 - #include <linux/dma-buf.h> 7 6 #include <linux/module.h> 8 7 #include <linux/usb.h> 9 8 ··· 267 268 y2 = gm12u320->fb_update.rect.y2; 268 269 vaddr = gm12u320->fb_update.src_map.vaddr; /* TODO: Use mapping abstraction properly */ 269 270 270 - if (fb->obj[0]->import_attach) { 271 - ret = dma_buf_begin_cpu_access( 272 - fb->obj[0]->import_attach->dmabuf, DMA_FROM_DEVICE); 273 - if (ret) { 274 - GM12U320_ERR("dma_buf_begin_cpu_access err: %d\n", ret); 275 - goto put_fb; 276 - } 271 + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); 272 + if (ret) { 273 + GM12U320_ERR("drm_gem_fb_begin_cpu_access err: %d\n", ret); 274 + goto put_fb; 277 275 } 278 276 279 277 src = vaddr + y1 * fb->pitches[0] + x1 * 4; ··· 307 311 src += fb->pitches[0]; 308 312 } 309 313 310 - if (fb->obj[0]->import_attach) { 311 - ret = dma_buf_end_cpu_access(fb->obj[0]->import_attach->dmabuf, 312 - DMA_FROM_DEVICE); 313 - if (ret) 314 - GM12U320_ERR("dma_buf_end_cpu_access err: %d\n", ret); 315 - } 314 + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); 316 315 put_fb: 317 316 drm_framebuffer_put(fb); 318 317 gm12u320->fb_update.fb = NULL;
+4 -14
drivers/gpu/drm/tiny/repaper.c
··· 14 14 */ 15 15 16 16 #include <linux/delay.h> 17 - #include <linux/dma-buf.h> 18 17 #include <linux/gpio/consumer.h> 19 18 #include <linux/module.h> 20 19 #include <linux/property.h> ··· 531 532 static int repaper_fb_dirty(struct drm_framebuffer *fb) 532 533 { 533 534 struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); 534 - struct dma_buf_attachment *import_attach = cma_obj->base.import_attach; 535 535 struct repaper_epd *epd = drm_to_epd(fb->dev); 536 536 struct drm_rect clip; 537 537 int idx, ret = 0; ··· 556 558 goto out_exit; 557 559 } 558 560 559 - if (import_attach) { 560 - ret = dma_buf_begin_cpu_access(import_attach->dmabuf, 561 - DMA_FROM_DEVICE); 562 - if (ret) 563 - goto out_free; 564 - } 561 + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); 562 + if (ret) 563 + goto out_free; 565 564 566 565 drm_fb_xrgb8888_to_gray8(buf, cma_obj->vaddr, fb, &clip); 567 566 568 - if (import_attach) { 569 - ret = dma_buf_end_cpu_access(import_attach->dmabuf, 570 - DMA_FROM_DEVICE); 571 - if (ret) 572 - goto out_free; 573 - } 567 + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); 574 568 575 569 repaper_gray8_to_mono_reversed(buf, fb->width, fb->height); 576 570
+6 -12
drivers/gpu/drm/tiny/st7586.c
··· 6 6 */ 7 7 8 8 #include <linux/delay.h> 9 - #include <linux/dma-buf.h> 10 9 #include <linux/gpio/consumer.h> 11 10 #include <linux/module.h> 12 11 #include <linux/property.h> ··· 20 21 #include <drm/drm_format_helper.h> 21 22 #include <drm/drm_gem_atomic_helper.h> 22 23 #include <drm/drm_gem_cma_helper.h> 24 + #include <drm/drm_gem_framebuffer_helper.h> 23 25 #include <drm/drm_managed.h> 24 26 #include <drm/drm_mipi_dbi.h> 25 27 #include <drm/drm_rect.h> ··· 92 92 struct drm_rect *clip) 93 93 { 94 94 struct drm_gem_cma_object *cma_obj = drm_fb_cma_get_gem_obj(fb, 0); 95 - struct dma_buf_attachment *import_attach = cma_obj->base.import_attach; 96 95 void *src = cma_obj->vaddr; 97 96 int ret = 0; 98 97 99 - if (import_attach) { 100 - ret = dma_buf_begin_cpu_access(import_attach->dmabuf, 101 - DMA_FROM_DEVICE); 102 - if (ret) 103 - return ret; 104 - } 98 + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); 99 + if (ret) 100 + return ret; 105 101 106 102 st7586_xrgb8888_to_gray332(dst, src, fb, clip); 107 103 108 - if (import_attach) 109 - ret = dma_buf_end_cpu_access(import_attach->dmabuf, 110 - DMA_FROM_DEVICE); 104 + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); 111 105 112 - return ret; 106 + return 0; 113 107 } 114 108 115 109 static void st7586_fb_dirty(struct drm_framebuffer *fb, struct drm_rect *rect)
+8 -21
drivers/gpu/drm/udl/udl_modeset.c
··· 6 6 * Copyright (C) 2009 Roberto De Ioris <roberto@unbit.it> 7 7 * Copyright (C) 2009 Jaya Kumar <jayakumar.lkml@gmail.com> 8 8 * Copyright (C) 2009 Bernie Thompson <bernie@plugable.com> 9 - 10 9 */ 11 - 12 - #include <linux/dma-buf.h> 13 10 14 11 #include <drm/drm_atomic_helper.h> 15 12 #include <drm/drm_crtc_helper.h> ··· 268 271 int x, int y, int width, int height) 269 272 { 270 273 struct drm_device *dev = fb->dev; 271 - struct dma_buf_attachment *import_attach = fb->obj[0]->import_attach; 272 274 void *vaddr = map->vaddr; /* TODO: Use mapping abstraction properly */ 273 - int i, ret, tmp_ret; 275 + int i, ret; 274 276 char *cmd; 275 277 struct urb *urb; 276 278 struct drm_rect clip; ··· 286 290 else if ((clip.x2 > fb->width) || (clip.y2 > fb->height)) 287 291 return -EINVAL; 288 292 289 - if (import_attach) { 290 - ret = dma_buf_begin_cpu_access(import_attach->dmabuf, 291 - DMA_FROM_DEVICE); 292 - if (ret) 293 - return ret; 294 - } 293 + ret = drm_gem_fb_begin_cpu_access(fb, DMA_FROM_DEVICE); 294 + if (ret) 295 + return ret; 295 296 296 297 urb = udl_get_urb(dev); 297 298 if (!urb) { 298 299 ret = -ENOMEM; 299 - goto out_dma_buf_end_cpu_access; 300 + goto out_drm_gem_fb_end_cpu_access; 300 301 } 301 302 cmd = urb->transfer_buffer; 302 303 ··· 306 313 &cmd, byte_offset, dev_byte_offset, 307 314 byte_width); 308 315 if (ret) 309 - goto out_dma_buf_end_cpu_access; 316 + goto out_drm_gem_fb_end_cpu_access; 310 317 } 311 318 312 319 if (cmd > (char *)urb->transfer_buffer) { ··· 322 329 323 330 ret = 0; 324 331 325 - out_dma_buf_end_cpu_access: 326 - if (import_attach) { 327 - tmp_ret = dma_buf_end_cpu_access(import_attach->dmabuf, 328 - DMA_FROM_DEVICE); 329 - if (tmp_ret && !ret) 330 - ret = tmp_ret; /* only update ret if not set yet */ 331 - } 332 - 332 + out_drm_gem_fb_end_cpu_access: 333 + drm_gem_fb_end_cpu_access(fb, DMA_FROM_DEVICE); 333 334 return ret; 334 335 } 335 336
+12 -26
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 1184 1184 } 1185 1185 1186 1186 /* HDMI audio codec callbacks */ 1187 - static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi) 1187 + static void vc4_hdmi_audio_set_mai_clock(struct vc4_hdmi *vc4_hdmi, 1188 + unsigned int samplerate) 1188 1189 { 1189 1190 u32 hsm_clock = clk_get_rate(vc4_hdmi->audio_clock); 1190 1191 unsigned long n, m; 1191 1192 1192 - rational_best_approximation(hsm_clock, vc4_hdmi->audio.samplerate, 1193 + rational_best_approximation(hsm_clock, samplerate, 1193 1194 VC4_HD_MAI_SMP_N_MASK >> 1194 1195 VC4_HD_MAI_SMP_N_SHIFT, 1195 1196 (VC4_HD_MAI_SMP_M_MASK >> ··· 1202 1201 VC4_SET_FIELD(m - 1, VC4_HD_MAI_SMP_M)); 1203 1202 } 1204 1203 1205 - static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi) 1204 + static void vc4_hdmi_set_n_cts(struct vc4_hdmi *vc4_hdmi, unsigned int samplerate) 1206 1205 { 1207 1206 struct drm_connector *connector = &vc4_hdmi->connector; 1208 1207 struct drm_crtc *crtc = connector->state->crtc; 1209 1208 const struct drm_display_mode *mode = &crtc->state->adjusted_mode; 1210 - u32 samplerate = vc4_hdmi->audio.samplerate; 1211 1209 u32 n, cts; 1212 1210 u64 tmp; 1213 1211 ··· 1340 1340 { 1341 1341 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); 1342 1342 struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base; 1343 + unsigned int sample_rate = params->sample_rate; 1344 + unsigned int channels = params->channels; 1343 1345 u32 audio_packet_config, channel_mask; 1344 1346 u32 channel_map; 1345 1347 u32 mai_audio_format; 1346 1348 u32 mai_sample_rate; 1347 1349 1348 1350 dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__, 1349 - params->sample_rate, params->sample_width, 1350 - params->channels); 1351 - 1352 - vc4_hdmi->audio.channels = params->channels; 1353 - vc4_hdmi->audio.samplerate = params->sample_rate; 1351 + sample_rate, params->sample_width, channels); 1354 1352 1355 1353 HDMI_WRITE(HDMI_MAI_CTL, 1356 - VC4_SET_FIELD(params->channels, VC4_HD_MAI_CTL_CHNUM) | 1354 + VC4_SET_FIELD(channels, VC4_HD_MAI_CTL_CHNUM) | 1357 1355 VC4_HD_MAI_CTL_WHOLSMP | 1358 1356 VC4_HD_MAI_CTL_CHALIGN | 1359 1357 VC4_HD_MAI_CTL_ENABLE); 1360 1358 1361 - vc4_hdmi_audio_set_mai_clock(vc4_hdmi); 1359 + vc4_hdmi_audio_set_mai_clock(vc4_hdmi, sample_rate); 1362 1360 1363 - mai_sample_rate = sample_rate_to_mai_fmt(vc4_hdmi->audio.samplerate); 1361 + mai_sample_rate = sample_rate_to_mai_fmt(sample_rate); 1364 1362 if (params->iec.status[0] & IEC958_AES0_NONAUDIO && 1365 1363 params->channels == 8) 1366 1364 mai_audio_format = VC4_HDMI_MAI_FORMAT_HBR; ··· 1376 1378 VC4_HDMI_AUDIO_PACKET_ZERO_DATA_ON_INACTIVE_CHANNELS | 1377 1379 VC4_SET_FIELD(0x8, VC4_HDMI_AUDIO_PACKET_B_FRAME_IDENTIFIER); 1378 1380 1379 - channel_mask = GENMASK(vc4_hdmi->audio.channels - 1, 0); 1381 + channel_mask = GENMASK(channels - 1, 0); 1380 1382 audio_packet_config |= VC4_SET_FIELD(channel_mask, 1381 1383 VC4_HDMI_AUDIO_PACKET_CEA_MASK); 1382 1384 ··· 1395 1397 channel_map = vc4_hdmi->variant->channel_map(vc4_hdmi, channel_mask); 1396 1398 HDMI_WRITE(HDMI_MAI_CHANNEL_MAP, channel_map); 1397 1399 HDMI_WRITE(HDMI_AUDIO_PACKET_CONFIG, audio_packet_config); 1398 - vc4_hdmi_set_n_cts(vc4_hdmi); 1400 + vc4_hdmi_set_n_cts(vc4_hdmi, sample_rate); 1399 1401 1400 1402 memcpy(&vc4_hdmi->audio.infoframe, &params->cea, sizeof(params->cea)); 1401 1403 vc4_hdmi_set_audio_infoframe(encoder); ··· 1409 1411 1410 1412 static const struct snd_soc_dapm_route vc4_hdmi_audio_routes[] = { 1411 1413 { "TX", NULL, "Playback" }, 1412 - }; 1413 - 1414 - static const struct snd_soc_component_driver vc4_hdmi_audio_component_drv = { 1415 - .name = "vc4-hdmi-codec-dai-component", 1416 - .dapm_widgets = vc4_hdmi_audio_widgets, 1417 - .num_dapm_widgets = ARRAY_SIZE(vc4_hdmi_audio_widgets), 1418 - .dapm_routes = vc4_hdmi_audio_routes, 1419 - .num_dapm_routes = ARRAY_SIZE(vc4_hdmi_audio_routes), 1420 - .idle_bias_on = 1, 1421 - .use_pmdown_time = 1, 1422 - .endianness = 1, 1423 - .non_legacy_dai_naming = 1, 1424 1414 }; 1425 1415 1426 1416 static const struct snd_soc_component_driver vc4_hdmi_audio_cpu_dai_comp = {
-2
drivers/gpu/drm/vc4/vc4_hdmi.h
··· 111 111 struct snd_soc_dai_link_component cpu; 112 112 struct snd_soc_dai_link_component codec; 113 113 struct snd_soc_dai_link_component platform; 114 - int samplerate; 115 - int channels; 116 114 struct snd_dmaengine_dai_dma_data dma_data; 117 115 struct hdmi_audio_infoframe infoframe; 118 116 bool streaming;
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_cmd.c
··· 140 140 min = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_MIN); 141 141 fifo->capabilities = vmw_fifo_mem_read(dev_priv, SVGA_FIFO_CAPABILITIES); 142 142 143 - DRM_INFO("Fifo max 0x%08x min 0x%08x cap 0x%08x\n", 143 + drm_info(&dev_priv->drm, 144 + "Fifo max 0x%08x min 0x%08x cap 0x%08x\n", 144 145 (unsigned int) max, 145 146 (unsigned int) min, 146 147 (unsigned int) fifo->capabilities);
+2 -1
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
··· 1272 1272 * submissions to be able to free up space. 1273 1273 */ 1274 1274 man->default_size = VMW_CMDBUF_INLINE_SIZE; 1275 - DRM_INFO("Using command buffers with %s pool.\n", 1275 + drm_info(&dev_priv->drm, 1276 + "Using command buffers with %s pool.\n", 1276 1277 (man->using_mob) ? "MOB" : "DMA"); 1277 1278 1278 1279 return 0;
+223 -182
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
··· 160 160 struct drm_vmw_mksstat_remove_arg) 161 161 162 162 /* 163 - * The core DRM version of this macro doesn't account for 164 - * DRM_COMMAND_BASE. 165 - */ 166 - 167 - #define VMW_IOCTL_DEF(ioctl, func, flags) \ 168 - [DRM_IOCTL_NR(DRM_IOCTL_##ioctl) - DRM_COMMAND_BASE] = {DRM_IOCTL_##ioctl, flags, func} 169 - 170 - /* 171 163 * Ioctl definitions. 172 164 */ 173 165 174 166 static const struct drm_ioctl_desc vmw_ioctls[] = { 175 - VMW_IOCTL_DEF(VMW_GET_PARAM, vmw_getparam_ioctl, 176 - DRM_RENDER_ALLOW), 177 - VMW_IOCTL_DEF(VMW_ALLOC_DMABUF, vmw_bo_alloc_ioctl, 178 - DRM_RENDER_ALLOW), 179 - VMW_IOCTL_DEF(VMW_UNREF_DMABUF, vmw_bo_unref_ioctl, 180 - DRM_RENDER_ALLOW), 181 - VMW_IOCTL_DEF(VMW_CURSOR_BYPASS, 182 - vmw_kms_cursor_bypass_ioctl, 183 - DRM_MASTER), 167 + DRM_IOCTL_DEF_DRV(VMW_GET_PARAM, vmw_getparam_ioctl, 168 + DRM_RENDER_ALLOW), 169 + DRM_IOCTL_DEF_DRV(VMW_ALLOC_DMABUF, vmw_bo_alloc_ioctl, 170 + DRM_RENDER_ALLOW), 171 + DRM_IOCTL_DEF_DRV(VMW_UNREF_DMABUF, vmw_bo_unref_ioctl, 172 + DRM_RENDER_ALLOW), 173 + DRM_IOCTL_DEF_DRV(VMW_CURSOR_BYPASS, 174 + vmw_kms_cursor_bypass_ioctl, 175 + DRM_MASTER), 184 176 185 - VMW_IOCTL_DEF(VMW_CONTROL_STREAM, vmw_overlay_ioctl, 186 - DRM_MASTER), 187 - VMW_IOCTL_DEF(VMW_CLAIM_STREAM, vmw_stream_claim_ioctl, 188 - DRM_MASTER), 189 - VMW_IOCTL_DEF(VMW_UNREF_STREAM, vmw_stream_unref_ioctl, 190 - DRM_MASTER), 177 + DRM_IOCTL_DEF_DRV(VMW_CONTROL_STREAM, vmw_overlay_ioctl, 178 + DRM_MASTER), 179 + DRM_IOCTL_DEF_DRV(VMW_CLAIM_STREAM, vmw_stream_claim_ioctl, 180 + DRM_MASTER), 181 + DRM_IOCTL_DEF_DRV(VMW_UNREF_STREAM, vmw_stream_unref_ioctl, 182 + DRM_MASTER), 191 183 192 - VMW_IOCTL_DEF(VMW_CREATE_CONTEXT, vmw_context_define_ioctl, 193 - DRM_RENDER_ALLOW), 194 - VMW_IOCTL_DEF(VMW_UNREF_CONTEXT, vmw_context_destroy_ioctl, 195 - DRM_RENDER_ALLOW), 196 - VMW_IOCTL_DEF(VMW_CREATE_SURFACE, vmw_surface_define_ioctl, 197 - DRM_RENDER_ALLOW), 198 - VMW_IOCTL_DEF(VMW_UNREF_SURFACE, vmw_surface_destroy_ioctl, 199 - DRM_RENDER_ALLOW), 200 - VMW_IOCTL_DEF(VMW_REF_SURFACE, vmw_surface_reference_ioctl, 201 - DRM_RENDER_ALLOW), 202 - VMW_IOCTL_DEF(VMW_EXECBUF, vmw_execbuf_ioctl, 203 - DRM_RENDER_ALLOW), 204 - VMW_IOCTL_DEF(VMW_FENCE_WAIT, vmw_fence_obj_wait_ioctl, 205 - DRM_RENDER_ALLOW), 206 - VMW_IOCTL_DEF(VMW_FENCE_SIGNALED, 207 - vmw_fence_obj_signaled_ioctl, 208 - DRM_RENDER_ALLOW), 209 - VMW_IOCTL_DEF(VMW_FENCE_UNREF, vmw_fence_obj_unref_ioctl, 210 - DRM_RENDER_ALLOW), 211 - VMW_IOCTL_DEF(VMW_FENCE_EVENT, vmw_fence_event_ioctl, 212 - DRM_RENDER_ALLOW), 213 - VMW_IOCTL_DEF(VMW_GET_3D_CAP, vmw_get_cap_3d_ioctl, 214 - DRM_RENDER_ALLOW), 184 + DRM_IOCTL_DEF_DRV(VMW_CREATE_CONTEXT, vmw_context_define_ioctl, 185 + DRM_RENDER_ALLOW), 186 + DRM_IOCTL_DEF_DRV(VMW_UNREF_CONTEXT, vmw_context_destroy_ioctl, 187 + DRM_RENDER_ALLOW), 188 + DRM_IOCTL_DEF_DRV(VMW_CREATE_SURFACE, vmw_surface_define_ioctl, 189 + DRM_RENDER_ALLOW), 190 + DRM_IOCTL_DEF_DRV(VMW_UNREF_SURFACE, vmw_surface_destroy_ioctl, 191 + DRM_RENDER_ALLOW), 192 + DRM_IOCTL_DEF_DRV(VMW_REF_SURFACE, vmw_surface_reference_ioctl, 193 + DRM_RENDER_ALLOW), 194 + DRM_IOCTL_DEF_DRV(VMW_EXECBUF, vmw_execbuf_ioctl, 195 + DRM_RENDER_ALLOW), 196 + DRM_IOCTL_DEF_DRV(VMW_FENCE_WAIT, vmw_fence_obj_wait_ioctl, 197 + DRM_RENDER_ALLOW), 198 + DRM_IOCTL_DEF_DRV(VMW_FENCE_SIGNALED, 199 + vmw_fence_obj_signaled_ioctl, 200 + DRM_RENDER_ALLOW), 201 + DRM_IOCTL_DEF_DRV(VMW_FENCE_UNREF, vmw_fence_obj_unref_ioctl, 202 + DRM_RENDER_ALLOW), 203 + DRM_IOCTL_DEF_DRV(VMW_FENCE_EVENT, vmw_fence_event_ioctl, 204 + DRM_RENDER_ALLOW), 205 + DRM_IOCTL_DEF_DRV(VMW_GET_3D_CAP, vmw_get_cap_3d_ioctl, 206 + DRM_RENDER_ALLOW), 215 207 216 208 /* these allow direct access to the framebuffers mark as master only */ 217 - VMW_IOCTL_DEF(VMW_PRESENT, vmw_present_ioctl, 218 - DRM_MASTER | DRM_AUTH), 219 - VMW_IOCTL_DEF(VMW_PRESENT_READBACK, 220 - vmw_present_readback_ioctl, 221 - DRM_MASTER | DRM_AUTH), 209 + DRM_IOCTL_DEF_DRV(VMW_PRESENT, vmw_present_ioctl, 210 + DRM_MASTER | DRM_AUTH), 211 + DRM_IOCTL_DEF_DRV(VMW_PRESENT_READBACK, 212 + vmw_present_readback_ioctl, 213 + DRM_MASTER | DRM_AUTH), 222 214 /* 223 215 * The permissions of the below ioctl are overridden in 224 216 * vmw_generic_ioctl(). We require either 225 217 * DRM_MASTER or capable(CAP_SYS_ADMIN). 226 218 */ 227 - VMW_IOCTL_DEF(VMW_UPDATE_LAYOUT, 228 - vmw_kms_update_layout_ioctl, 229 - DRM_RENDER_ALLOW), 230 - VMW_IOCTL_DEF(VMW_CREATE_SHADER, 231 - vmw_shader_define_ioctl, 232 - DRM_RENDER_ALLOW), 233 - VMW_IOCTL_DEF(VMW_UNREF_SHADER, 234 - vmw_shader_destroy_ioctl, 235 - DRM_RENDER_ALLOW), 236 - VMW_IOCTL_DEF(VMW_GB_SURFACE_CREATE, 237 - vmw_gb_surface_define_ioctl, 238 - DRM_RENDER_ALLOW), 239 - VMW_IOCTL_DEF(VMW_GB_SURFACE_REF, 240 - vmw_gb_surface_reference_ioctl, 241 - DRM_RENDER_ALLOW), 242 - VMW_IOCTL_DEF(VMW_SYNCCPU, 243 - vmw_user_bo_synccpu_ioctl, 244 - DRM_RENDER_ALLOW), 245 - VMW_IOCTL_DEF(VMW_CREATE_EXTENDED_CONTEXT, 246 - vmw_extended_context_define_ioctl, 247 - DRM_RENDER_ALLOW), 248 - VMW_IOCTL_DEF(VMW_GB_SURFACE_CREATE_EXT, 249 - vmw_gb_surface_define_ext_ioctl, 250 - DRM_RENDER_ALLOW), 251 - VMW_IOCTL_DEF(VMW_GB_SURFACE_REF_EXT, 252 - vmw_gb_surface_reference_ext_ioctl, 253 - DRM_RENDER_ALLOW), 254 - VMW_IOCTL_DEF(VMW_MSG, 255 - vmw_msg_ioctl, 256 - DRM_RENDER_ALLOW), 257 - VMW_IOCTL_DEF(VMW_MKSSTAT_RESET, 258 - vmw_mksstat_reset_ioctl, 259 - DRM_RENDER_ALLOW), 260 - VMW_IOCTL_DEF(VMW_MKSSTAT_ADD, 261 - vmw_mksstat_add_ioctl, 262 - DRM_RENDER_ALLOW), 263 - VMW_IOCTL_DEF(VMW_MKSSTAT_REMOVE, 264 - vmw_mksstat_remove_ioctl, 265 - DRM_RENDER_ALLOW), 219 + DRM_IOCTL_DEF_DRV(VMW_UPDATE_LAYOUT, 220 + vmw_kms_update_layout_ioctl, 221 + DRM_RENDER_ALLOW), 222 + DRM_IOCTL_DEF_DRV(VMW_CREATE_SHADER, 223 + vmw_shader_define_ioctl, 224 + DRM_RENDER_ALLOW), 225 + DRM_IOCTL_DEF_DRV(VMW_UNREF_SHADER, 226 + vmw_shader_destroy_ioctl, 227 + DRM_RENDER_ALLOW), 228 + DRM_IOCTL_DEF_DRV(VMW_GB_SURFACE_CREATE, 229 + vmw_gb_surface_define_ioctl, 230 + DRM_RENDER_ALLOW), 231 + DRM_IOCTL_DEF_DRV(VMW_GB_SURFACE_REF, 232 + vmw_gb_surface_reference_ioctl, 233 + DRM_RENDER_ALLOW), 234 + DRM_IOCTL_DEF_DRV(VMW_SYNCCPU, 235 + vmw_user_bo_synccpu_ioctl, 236 + DRM_RENDER_ALLOW), 237 + DRM_IOCTL_DEF_DRV(VMW_CREATE_EXTENDED_CONTEXT, 238 + vmw_extended_context_define_ioctl, 239 + DRM_RENDER_ALLOW), 240 + DRM_IOCTL_DEF_DRV(VMW_GB_SURFACE_CREATE_EXT, 241 + vmw_gb_surface_define_ext_ioctl, 242 + DRM_RENDER_ALLOW), 243 + DRM_IOCTL_DEF_DRV(VMW_GB_SURFACE_REF_EXT, 244 + vmw_gb_surface_reference_ext_ioctl, 245 + DRM_RENDER_ALLOW), 246 + DRM_IOCTL_DEF_DRV(VMW_MSG, 247 + vmw_msg_ioctl, 248 + DRM_RENDER_ALLOW), 249 + DRM_IOCTL_DEF_DRV(VMW_MKSSTAT_RESET, 250 + vmw_mksstat_reset_ioctl, 251 + DRM_RENDER_ALLOW), 252 + DRM_IOCTL_DEF_DRV(VMW_MKSSTAT_ADD, 253 + vmw_mksstat_add_ioctl, 254 + DRM_RENDER_ALLOW), 255 + DRM_IOCTL_DEF_DRV(VMW_MKSSTAT_REMOVE, 256 + vmw_mksstat_remove_ioctl, 257 + DRM_RENDER_ALLOW), 266 258 }; 267 259 268 260 static const struct pci_device_id vmw_pci_id_list[] = { ··· 286 294 module_param_named(assume_16bpp, vmw_assume_16bpp, int, 0600); 287 295 288 296 289 - static void vmw_print_capabilities2(uint32_t capabilities2) 297 + struct bitmap_name { 298 + uint32 value; 299 + const char *name; 300 + }; 301 + 302 + static const struct bitmap_name cap1_names[] = { 303 + { SVGA_CAP_RECT_COPY, "rect copy" }, 304 + { SVGA_CAP_CURSOR, "cursor" }, 305 + { SVGA_CAP_CURSOR_BYPASS, "cursor bypass" }, 306 + { SVGA_CAP_CURSOR_BYPASS_2, "cursor bypass 2" }, 307 + { SVGA_CAP_8BIT_EMULATION, "8bit emulation" }, 308 + { SVGA_CAP_ALPHA_CURSOR, "alpha cursor" }, 309 + { SVGA_CAP_3D, "3D" }, 310 + { SVGA_CAP_EXTENDED_FIFO, "extended fifo" }, 311 + { SVGA_CAP_MULTIMON, "multimon" }, 312 + { SVGA_CAP_PITCHLOCK, "pitchlock" }, 313 + { SVGA_CAP_IRQMASK, "irq mask" }, 314 + { SVGA_CAP_DISPLAY_TOPOLOGY, "display topology" }, 315 + { SVGA_CAP_GMR, "gmr" }, 316 + { SVGA_CAP_TRACES, "traces" }, 317 + { SVGA_CAP_GMR2, "gmr2" }, 318 + { SVGA_CAP_SCREEN_OBJECT_2, "screen object 2" }, 319 + { SVGA_CAP_COMMAND_BUFFERS, "command buffers" }, 320 + { SVGA_CAP_CMD_BUFFERS_2, "command buffers 2" }, 321 + { SVGA_CAP_GBOBJECTS, "gbobject" }, 322 + { SVGA_CAP_DX, "dx" }, 323 + { SVGA_CAP_HP_CMD_QUEUE, "hp cmd queue" }, 324 + { SVGA_CAP_NO_BB_RESTRICTION, "no bb restriction" }, 325 + { SVGA_CAP_CAP2_REGISTER, "cap2 register" }, 326 + }; 327 + 328 + 329 + static const struct bitmap_name cap2_names[] = { 330 + { SVGA_CAP2_GROW_OTABLE, "grow otable" }, 331 + { SVGA_CAP2_INTRA_SURFACE_COPY, "intra surface copy" }, 332 + { SVGA_CAP2_DX2, "dx2" }, 333 + { SVGA_CAP2_GB_MEMSIZE_2, "gb memsize 2" }, 334 + { SVGA_CAP2_SCREENDMA_REG, "screendma reg" }, 335 + { SVGA_CAP2_OTABLE_PTDEPTH_2, "otable ptdepth2" }, 336 + { SVGA_CAP2_NON_MS_TO_MS_STRETCHBLT, "non ms to ms stretchblt" }, 337 + { SVGA_CAP2_CURSOR_MOB, "cursor mob" }, 338 + { SVGA_CAP2_MSHINT, "mshint" }, 339 + { SVGA_CAP2_CB_MAX_SIZE_4MB, "cb max size 4mb" }, 340 + { SVGA_CAP2_DX3, "dx3" }, 341 + { SVGA_CAP2_FRAME_TYPE, "frame type" }, 342 + { SVGA_CAP2_COTABLE_COPY, "cotable copy" }, 343 + { SVGA_CAP2_TRACE_FULL_FB, "trace full fb" }, 344 + { SVGA_CAP2_EXTRA_REGS, "extra regs" }, 345 + { SVGA_CAP2_LO_STAGING, "lo staging" }, 346 + }; 347 + 348 + static void vmw_print_bitmap(struct drm_device *drm, 349 + const char *prefix, uint32_t bitmap, 350 + const struct bitmap_name *bnames, 351 + uint32_t num_names) 290 352 { 291 - DRM_INFO("Capabilities2:\n"); 292 - if (capabilities2 & SVGA_CAP2_GROW_OTABLE) 293 - DRM_INFO(" Grow oTable.\n"); 294 - if (capabilities2 & SVGA_CAP2_INTRA_SURFACE_COPY) 295 - DRM_INFO(" IntraSurface copy.\n"); 296 - if (capabilities2 & SVGA_CAP2_DX3) 297 - DRM_INFO(" DX3.\n"); 353 + char buf[512]; 354 + uint32_t i; 355 + uint32_t offset = 0; 356 + for (i = 0; i < num_names; ++i) { 357 + if ((bitmap & bnames[i].value) != 0) { 358 + offset += snprintf(buf + offset, 359 + ARRAY_SIZE(buf) - offset, 360 + "%s, ", bnames[i].name); 361 + bitmap &= ~bnames[i].value; 362 + } 363 + } 364 + 365 + drm_info(drm, "%s: %s\n", prefix, buf); 366 + if (bitmap != 0) 367 + drm_dbg(drm, "%s: unknown enums: %x\n", prefix, bitmap); 298 368 } 299 369 300 - static void vmw_print_capabilities(uint32_t capabilities) 370 + 371 + static void vmw_print_sm_type(struct vmw_private *dev_priv) 301 372 { 302 - DRM_INFO("Capabilities:\n"); 303 - if (capabilities & SVGA_CAP_RECT_COPY) 304 - DRM_INFO(" Rect copy.\n"); 305 - if (capabilities & SVGA_CAP_CURSOR) 306 - DRM_INFO(" Cursor.\n"); 307 - if (capabilities & SVGA_CAP_CURSOR_BYPASS) 308 - DRM_INFO(" Cursor bypass.\n"); 309 - if (capabilities & SVGA_CAP_CURSOR_BYPASS_2) 310 - DRM_INFO(" Cursor bypass 2.\n"); 311 - if (capabilities & SVGA_CAP_8BIT_EMULATION) 312 - DRM_INFO(" 8bit emulation.\n"); 313 - if (capabilities & SVGA_CAP_ALPHA_CURSOR) 314 - DRM_INFO(" Alpha cursor.\n"); 315 - if (capabilities & SVGA_CAP_3D) 316 - DRM_INFO(" 3D.\n"); 317 - if (capabilities & SVGA_CAP_EXTENDED_FIFO) 318 - DRM_INFO(" Extended Fifo.\n"); 319 - if (capabilities & SVGA_CAP_MULTIMON) 320 - DRM_INFO(" Multimon.\n"); 321 - if (capabilities & SVGA_CAP_PITCHLOCK) 322 - DRM_INFO(" Pitchlock.\n"); 323 - if (capabilities & SVGA_CAP_IRQMASK) 324 - DRM_INFO(" Irq mask.\n"); 325 - if (capabilities & SVGA_CAP_DISPLAY_TOPOLOGY) 326 - DRM_INFO(" Display Topology.\n"); 327 - if (capabilities & SVGA_CAP_GMR) 328 - DRM_INFO(" GMR.\n"); 329 - if (capabilities & SVGA_CAP_TRACES) 330 - DRM_INFO(" Traces.\n"); 331 - if (capabilities & SVGA_CAP_GMR2) 332 - DRM_INFO(" GMR2.\n"); 333 - if (capabilities & SVGA_CAP_SCREEN_OBJECT_2) 334 - DRM_INFO(" Screen Object 2.\n"); 335 - if (capabilities & SVGA_CAP_COMMAND_BUFFERS) 336 - DRM_INFO(" Command Buffers.\n"); 337 - if (capabilities & SVGA_CAP_CMD_BUFFERS_2) 338 - DRM_INFO(" Command Buffers 2.\n"); 339 - if (capabilities & SVGA_CAP_GBOBJECTS) 340 - DRM_INFO(" Guest Backed Resources.\n"); 341 - if (capabilities & SVGA_CAP_DX) 342 - DRM_INFO(" DX Features.\n"); 343 - if (capabilities & SVGA_CAP_HP_CMD_QUEUE) 344 - DRM_INFO(" HP Command Queue.\n"); 373 + static const char *names[] = { 374 + [VMW_SM_LEGACY] = "Legacy", 375 + [VMW_SM_4] = "SM4", 376 + [VMW_SM_4_1] = "SM4_1", 377 + [VMW_SM_5] = "SM_5", 378 + [VMW_SM_MAX] = "Invalid" 379 + }; 380 + BUILD_BUG_ON(ARRAY_SIZE(names) != (VMW_SM_MAX + 1)); 381 + drm_info(&dev_priv->drm, "Available shader model: %s.\n", 382 + names[dev_priv->sm_type]); 345 383 } 346 384 347 385 /** ··· 437 415 static int vmw_device_init(struct vmw_private *dev_priv) 438 416 { 439 417 bool uses_fb_traces = false; 440 - 441 - DRM_INFO("width %d\n", vmw_read(dev_priv, SVGA_REG_WIDTH)); 442 - DRM_INFO("height %d\n", vmw_read(dev_priv, SVGA_REG_HEIGHT)); 443 - DRM_INFO("bpp %d\n", vmw_read(dev_priv, SVGA_REG_BITS_PER_PIXEL)); 444 418 445 419 dev_priv->enable_state = vmw_read(dev_priv, SVGA_REG_ENABLE); 446 420 dev_priv->config_done_state = vmw_read(dev_priv, SVGA_REG_CONFIG_DONE); ··· 676 658 else 677 659 dev_priv->map_mode = vmw_dma_map_populate; 678 660 679 - DRM_INFO("DMA map mode: %s\n", names[dev_priv->map_mode]); 661 + drm_info(&dev_priv->drm, 662 + "DMA map mode: %s\n", names[dev_priv->map_mode]); 680 663 return 0; 681 664 } 682 665 ··· 696 677 697 678 ret = dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(64)); 698 679 if (sizeof(unsigned long) == 4 || vmw_restrict_dma_mask) { 699 - DRM_INFO("Restricting DMA addresses to 44 bits.\n"); 680 + drm_info(&dev_priv->drm, 681 + "Restricting DMA addresses to 44 bits.\n"); 700 682 return dma_set_mask_and_coherent(dev->dev, DMA_BIT_MASK(44)); 701 683 } 702 684 ··· 749 729 dev->vram_start = pci_resource_start(pdev, 2); 750 730 dev->vram_size = pci_resource_len(pdev, 2); 751 731 752 - DRM_INFO("Register MMIO at 0x%pa size is %llu kiB\n", 732 + drm_info(&dev->drm, 733 + "Register MMIO at 0x%pa size is %llu kiB\n", 753 734 &rmmio_start, (uint64_t)rmmio_size / 1024); 754 735 dev->rmmio = devm_ioremap(dev->drm.dev, 755 736 rmmio_start, 756 737 rmmio_size); 757 738 if (!dev->rmmio) { 758 - DRM_ERROR("Failed mapping registers mmio memory.\n"); 739 + drm_err(&dev->drm, 740 + "Failed mapping registers mmio memory.\n"); 759 741 pci_release_regions(pdev); 760 742 return -ENOMEM; 761 743 } ··· 768 746 fifo_start = pci_resource_start(pdev, 2); 769 747 fifo_size = pci_resource_len(pdev, 2); 770 748 771 - DRM_INFO("FIFO at %pa size is %llu kiB\n", 749 + drm_info(&dev->drm, 750 + "FIFO at %pa size is %llu kiB\n", 772 751 &fifo_start, (uint64_t)fifo_size / 1024); 773 752 dev->fifo_mem = devm_memremap(dev->drm.dev, 774 753 fifo_start, ··· 777 754 MEMREMAP_WB); 778 755 779 756 if (IS_ERR(dev->fifo_mem)) { 780 - DRM_ERROR("Failed mapping FIFO memory.\n"); 757 + drm_err(&dev->drm, 758 + "Failed mapping FIFO memory.\n"); 781 759 pci_release_regions(pdev); 782 760 return PTR_ERR(dev->fifo_mem); 783 761 } ··· 793 769 * size will be equal to or bigger than the size reported by 794 770 * SVGA_REG_VRAM_SIZE. 795 771 */ 796 - DRM_INFO("VRAM at %pa size is %llu kiB\n", 772 + drm_info(&dev->drm, 773 + "VRAM at %pa size is %llu kiB\n", 797 774 &dev->vram_start, (uint64_t)dev->vram_size / 1024); 798 775 799 776 return 0; ··· 808 783 SVGA_ID_3 : SVGA_ID_2); 809 784 svga_id = vmw_read(dev, SVGA_REG_ID); 810 785 if (svga_id != SVGA_ID_2 && svga_id != SVGA_ID_3) { 811 - DRM_ERROR("Unsupported SVGA ID 0x%x on chipset 0x%x\n", 812 - svga_id, dev->pci_id); 786 + drm_err(&dev->drm, 787 + "Unsupported SVGA ID 0x%x on chipset 0x%x\n", 788 + svga_id, dev->pci_id); 813 789 return -ENOSYS; 814 790 } 815 791 BUG_ON(vmw_is_svga_v3(dev) && (svga_id != SVGA_ID_3)); 816 - DRM_INFO("Running on SVGA version %d.\n", (svga_id & 0xff)); 792 + drm_info(&dev->drm, 793 + "Running on SVGA version %d.\n", (svga_id & 0xff)); 817 794 return 0; 818 795 } 819 796 ··· 869 842 870 843 ret = vmw_dma_select_mode(dev_priv); 871 844 if (unlikely(ret != 0)) { 872 - DRM_INFO("Restricting capabilities since DMA not available.\n"); 845 + drm_info(&dev_priv->drm, 846 + "Restricting capabilities since DMA not available.\n"); 873 847 refuse_dma = true; 874 848 if (dev_priv->capabilities & SVGA_CAP_GBOBJECTS) 875 - DRM_INFO("Disabling 3D acceleration.\n"); 849 + drm_info(&dev_priv->drm, 850 + "Disabling 3D acceleration.\n"); 876 851 } 877 852 878 853 dev_priv->vram_size = vmw_read(dev_priv, SVGA_REG_VRAM_SIZE); ··· 942 913 dev_priv->texture_max_height = 8192; 943 914 dev_priv->max_primary_mem = dev_priv->vram_size; 944 915 } 916 + drm_info(&dev_priv->drm, 917 + "Legacy memory limits: VRAM = %llu kB, FIFO = %llu kB, surface = %u kB\n", 918 + (u64)dev_priv->vram_size / 1024, 919 + (u64)dev_priv->fifo_mem_size / 1024, 920 + dev_priv->memory_size / 1024); 945 921 946 - vmw_print_capabilities(dev_priv->capabilities); 922 + drm_info(&dev_priv->drm, 923 + "MOB limits: max mob size = %u kB, max mob pages = %u\n", 924 + dev_priv->max_mob_size / 1024, dev_priv->max_mob_pages); 925 + 926 + vmw_print_bitmap(&dev_priv->drm, "Capabilities", 927 + dev_priv->capabilities, 928 + cap1_names, ARRAY_SIZE(cap1_names)); 947 929 if (dev_priv->capabilities & SVGA_CAP_CAP2_REGISTER) 948 - vmw_print_capabilities2(dev_priv->capabilities2); 949 - DRM_INFO("Supports command queues = %d\n", 950 - vmw_cmd_supported((dev_priv))); 930 + vmw_print_bitmap(&dev_priv->drm, "Capabilities2", 931 + dev_priv->capabilities2, 932 + cap2_names, ARRAY_SIZE(cap2_names)); 951 933 952 934 ret = vmw_dma_masks(dev_priv); 953 935 if (unlikely(ret != 0)) ··· 967 927 dma_set_max_seg_size(dev_priv->drm.dev, U32_MAX); 968 928 969 929 if (dev_priv->capabilities & SVGA_CAP_GMR2) { 970 - DRM_INFO("Max GMR ids is %u\n", 930 + drm_info(&dev_priv->drm, 931 + "Max GMR ids is %u\n", 971 932 (unsigned)dev_priv->max_gmr_ids); 972 - DRM_INFO("Max number of GMR pages is %u\n", 933 + drm_info(&dev_priv->drm, 934 + "Max number of GMR pages is %u\n", 973 935 (unsigned)dev_priv->max_gmr_pages); 974 - DRM_INFO("Max dedicated hypervisor surface memory is %u kiB\n", 975 - (unsigned)dev_priv->memory_size / 1024); 976 936 } 977 - DRM_INFO("Maximum display memory size is %llu kiB\n", 937 + drm_info(&dev_priv->drm, 938 + "Maximum display memory size is %llu kiB\n", 978 939 (uint64_t)dev_priv->max_primary_mem / 1024); 979 940 980 941 /* Need mmio memory to check for fifo pitchlock cap. */ ··· 991 950 &vmw_prime_dmabuf_ops); 992 951 993 952 if (unlikely(dev_priv->tdev == NULL)) { 994 - DRM_ERROR("Unable to initialize TTM object management.\n"); 953 + drm_err(&dev_priv->drm, 954 + "Unable to initialize TTM object management.\n"); 995 955 ret = -ENOMEM; 996 956 goto out_err0; 997 957 } ··· 1000 958 if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { 1001 959 ret = vmw_irq_install(&dev_priv->drm, pdev->irq); 1002 960 if (ret != 0) { 1003 - DRM_ERROR("Failed installing irq: %d\n", ret); 961 + drm_err(&dev_priv->drm, 962 + "Failed installing irq: %d\n", ret); 1004 963 goto out_no_irq; 1005 964 } 1006 965 } ··· 1022 979 dev_priv->map_mode == vmw_dma_alloc_coherent, 1023 980 false); 1024 981 if (unlikely(ret != 0)) { 1025 - DRM_ERROR("Failed initializing TTM buffer object driver.\n"); 982 + drm_err(&dev_priv->drm, 983 + "Failed initializing TTM buffer object driver.\n"); 1026 984 goto out_no_bdev; 1027 985 } 1028 986 ··· 1034 990 1035 991 ret = vmw_vram_manager_init(dev_priv); 1036 992 if (unlikely(ret != 0)) { 1037 - DRM_ERROR("Failed initializing memory manager for VRAM.\n"); 993 + drm_err(&dev_priv->drm, 994 + "Failed initializing memory manager for VRAM.\n"); 1038 995 goto out_no_vram; 1039 996 } 1040 997 1041 998 ret = vmw_devcaps_create(dev_priv); 1042 999 if (unlikely(ret != 0)) { 1043 - DRM_ERROR("Failed initializing device caps.\n"); 1000 + drm_err(&dev_priv->drm, 1001 + "Failed initializing device caps.\n"); 1044 1002 goto out_no_vram; 1045 1003 } 1046 1004 ··· 1056 1010 if (((dev_priv->capabilities & (SVGA_CAP_GMR | SVGA_CAP_GMR2)) == 0) || 1057 1011 refuse_dma || 1058 1012 vmw_gmrid_man_init(dev_priv, VMW_PL_GMR) != 0) { 1059 - DRM_INFO("No GMR memory available. " 1013 + drm_info(&dev_priv->drm, 1014 + "No GMR memory available. " 1060 1015 "Graphics memory resources are very limited.\n"); 1061 1016 dev_priv->has_gmr = false; 1062 1017 } ··· 1066 1019 dev_priv->has_mob = true; 1067 1020 1068 1021 if (vmw_gmrid_man_init(dev_priv, VMW_PL_MOB) != 0) { 1069 - DRM_INFO("No MOB memory available. " 1022 + drm_info(&dev_priv->drm, 1023 + "No MOB memory available. " 1070 1024 "3D will be disabled.\n"); 1071 1025 dev_priv->has_mob = false; 1072 1026 } ··· 1101 1053 if (ret) 1102 1054 goto out_no_fifo; 1103 1055 1104 - if (dev_priv->sm_type == VMW_SM_5) 1105 - DRM_INFO("SM5 support available.\n"); 1106 - if (dev_priv->sm_type == VMW_SM_4_1) 1107 - DRM_INFO("SM4_1 support available.\n"); 1108 - if (dev_priv->sm_type == VMW_SM_4) 1109 - DRM_INFO("SM4 support available.\n"); 1110 - DRM_INFO("Running without reservation semaphore\n"); 1111 - 1056 + vmw_print_sm_type(dev_priv); 1112 1057 vmw_host_printf("vmwgfx: Module Version: %d.%d.%d (kernel: %s)", 1113 1058 VMWGFX_DRIVER_MAJOR, VMWGFX_DRIVER_MINOR, 1114 1059 VMWGFX_DRIVER_PATCHLEVEL, UTS_RELEASE);
+5 -4
drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
··· 54 54 55 55 56 56 #define VMWGFX_DRIVER_NAME "vmwgfx" 57 - #define VMWGFX_DRIVER_DATE "20210218" 57 + #define VMWGFX_DRIVER_DATE "20210722" 58 58 #define VMWGFX_DRIVER_MAJOR 2 59 - #define VMWGFX_DRIVER_MINOR 18 60 - #define VMWGFX_DRIVER_PATCHLEVEL 1 59 + #define VMWGFX_DRIVER_MINOR 19 60 + #define VMWGFX_DRIVER_PATCHLEVEL 0 61 61 #define VMWGFX_FIFO_STATIC_SIZE (1024*1024) 62 62 #define VMWGFX_MAX_RELOCATIONS 2048 63 63 #define VMWGFX_MAX_VALIDATIONS 2048 ··· 367 367 vmw_du_invalid = 0, 368 368 vmw_du_legacy, 369 369 vmw_du_screen_object, 370 - vmw_du_screen_target 370 + vmw_du_screen_target, 371 + vmw_du_max 371 372 }; 372 373 373 374 struct vmw_validation_context;
+34 -2
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
··· 71 71 72 72 if (gman->max_gmr_pages > 0) { 73 73 gman->used_gmr_pages += (*res)->num_pages; 74 - if (unlikely(gman->used_gmr_pages > gman->max_gmr_pages)) 75 - goto nospace; 74 + /* 75 + * Because the graphics memory is a soft limit we can try to 76 + * expand it instead of letting the userspace apps crash. 77 + * We're just going to have a sane limit (half of RAM) 78 + * on the number of MOB's that we create and will try to keep 79 + * the system running until we reach that. 80 + */ 81 + if (unlikely(gman->used_gmr_pages > gman->max_gmr_pages)) { 82 + const unsigned long max_graphics_pages = totalram_pages() / 2; 83 + uint32_t new_max_pages = 0; 84 + 85 + DRM_WARN("vmwgfx: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n"); 86 + vmw_host_printf("vmwgfx, warning: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n"); 87 + 88 + if (gman->max_gmr_pages > (max_graphics_pages / 2)) { 89 + DRM_WARN("vmwgfx: guest requires more than half of RAM for graphics.\n"); 90 + new_max_pages = max_graphics_pages; 91 + } else 92 + new_max_pages = gman->max_gmr_pages * 2; 93 + if (new_max_pages > gman->max_gmr_pages && new_max_pages >= gman->used_gmr_pages) { 94 + DRM_WARN("vmwgfx: increasing guest mob limits to %u kB.\n", 95 + ((new_max_pages) << (PAGE_SHIFT - 10))); 96 + 97 + gman->max_gmr_pages = new_max_pages; 98 + } else { 99 + char buf[256]; 100 + snprintf(buf, sizeof(buf), 101 + "vmwgfx, error: guest graphics is out of memory (mob limit at: %ukB).\n", 102 + ((gman->max_gmr_pages) << (PAGE_SHIFT - 10))); 103 + vmw_host_printf(buf); 104 + DRM_WARN("%s", buf); 105 + goto nospace; 106 + } 107 + } 76 108 } 77 109 78 110 (*res)->start = id;
+10
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
··· 1793 1793 { 1794 1794 struct drm_device *dev = &dev_priv->drm; 1795 1795 int ret; 1796 + static const char *display_unit_names[] = { 1797 + "Invalid", 1798 + "Legacy", 1799 + "Screen Object", 1800 + "Screen Target", 1801 + "Invalid (max)" 1802 + }; 1796 1803 1797 1804 drm_mode_config_init(dev); 1798 1805 dev->mode_config.funcs = &vmw_kms_funcs; ··· 1817 1810 if (ret) /* Fallback */ 1818 1811 ret = vmw_kms_ldu_init_display(dev_priv); 1819 1812 } 1813 + BUILD_BUG_ON(ARRAY_SIZE(display_unit_names) != (vmw_du_max + 1)); 1814 + drm_info(&dev_priv->drm, "%s display unit initialized\n", 1815 + display_unit_names[dev_priv->active_display_unit]); 1820 1816 1821 1817 return ret; 1822 1818 }
+1 -4
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
··· 493 493 struct drm_device *dev = &dev_priv->drm; 494 494 int i, ret; 495 495 496 - if (dev_priv->ldu_priv) { 497 - DRM_INFO("ldu system already on\n"); 496 + if (unlikely(dev_priv->ldu_priv)) { 498 497 return -EINVAL; 499 498 } 500 499 ··· 525 526 dev_priv->active_display_unit = vmw_du_legacy; 526 527 527 528 drm_mode_config_reset(dev); 528 - 529 - DRM_INFO("Legacy Display Unit initialized\n"); 530 529 531 530 return 0; 532 531
-4
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
··· 954 954 int i, ret; 955 955 956 956 if (!(dev_priv->capabilities & SVGA_CAP_SCREEN_OBJECT_2)) { 957 - DRM_INFO("Not using screen objects," 958 - " missing cap SCREEN_OBJECT_2\n"); 959 957 return -ENOSYS; 960 958 } 961 959 ··· 969 971 dev_priv->active_display_unit = vmw_du_screen_object; 970 972 971 973 drm_mode_config_reset(dev); 972 - 973 - DRM_INFO("Screen Objects Display Unit initialized\n"); 974 974 975 975 return 0; 976 976 }
+2 -3
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
··· 1889 1889 ret = vmw_stdu_init(dev_priv, i); 1890 1890 1891 1891 if (unlikely(ret != 0)) { 1892 - DRM_ERROR("Failed to initialize STDU %d", i); 1892 + drm_err(&dev_priv->drm, 1893 + "Failed to initialize STDU %d", i); 1893 1894 return ret; 1894 1895 } 1895 1896 } 1896 1897 1897 1898 drm_mode_config_reset(dev); 1898 - 1899 - DRM_INFO("Screen Target Display device initialized\n"); 1900 1899 1901 1900 return 0; 1902 1901 }
+3
drivers/video/fbdev/asiliantfb.c
··· 227 227 { 228 228 unsigned long Ftarget, ratio, remainder; 229 229 230 + if (!var->pixclock) 231 + return -EINVAL; 232 + 230 233 ratio = 1000000 / var->pixclock; 231 234 remainder = 1000000 % var->pixclock; 232 235 Ftarget = 1000000 * ratio + (1000000 * remainder) / var->pixclock;
+2 -2
drivers/video/fbdev/ep93xx-fb.c
··· 548 548 } 549 549 550 550 ep93xxfb_set_par(info); 551 - clk_enable(fbi->clk); 551 + clk_prepare_enable(fbi->clk); 552 552 553 553 err = register_framebuffer(info); 554 554 if (err) ··· 577 577 struct ep93xx_fbi *fbi = info->par; 578 578 579 579 unregister_framebuffer(info); 580 - clk_disable(fbi->clk); 580 + clk_disable_unprepare(fbi->clk); 581 581 ep93xxfb_dealloc_videomem(info); 582 582 fb_dealloc_cmap(&info->cmap); 583 583
+3
drivers/video/fbdev/kyro/fbdev.c
··· 399 399 { 400 400 struct kyrofb_info *par = info->par; 401 401 402 + if (!var->pixclock) 403 + return -EINVAL; 404 + 402 405 if (var->bits_per_pixel != 16 && var->bits_per_pixel != 32) { 403 406 printk(KERN_WARNING "kyrofb: depth not supported: %u\n", var->bits_per_pixel); 404 407 return -EINVAL;
+3
drivers/video/fbdev/riva/fbdev.c
··· 1084 1084 int mode_valid = 0; 1085 1085 1086 1086 NVTRACE_ENTER(); 1087 + if (!var->pixclock) 1088 + return -EINVAL; 1089 + 1087 1090 switch (var->bits_per_pixel) { 1088 1091 case 1 ... 8: 1089 1092 var->red.offset = var->green.offset = var->blue.offset = 0;
+105 -48
drivers/video/fbdev/ssd1307fb.c
··· 82 82 struct regulator *vbat_reg; 83 83 u32 vcomh; 84 84 u32 width; 85 + /* Cached address ranges */ 86 + u8 col_start; 87 + u8 col_end; 88 + u8 page_start; 89 + u8 page_end; 85 90 }; 86 91 87 92 struct ssd1307fb_array { ··· 157 152 return ret; 158 153 } 159 154 160 - static void ssd1307fb_update_display(struct ssd1307fb_par *par) 155 + static int ssd1307fb_set_col_range(struct ssd1307fb_par *par, u8 col_start, 156 + u8 cols) 157 + { 158 + u8 col_end = col_start + cols - 1; 159 + int ret; 160 + 161 + if (col_start == par->col_start && col_end == par->col_end) 162 + return 0; 163 + 164 + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_COL_RANGE); 165 + if (ret < 0) 166 + return ret; 167 + 168 + ret = ssd1307fb_write_cmd(par->client, col_start); 169 + if (ret < 0) 170 + return ret; 171 + 172 + ret = ssd1307fb_write_cmd(par->client, col_end); 173 + if (ret < 0) 174 + return ret; 175 + 176 + par->col_start = col_start; 177 + par->col_end = col_end; 178 + return 0; 179 + } 180 + 181 + static int ssd1307fb_set_page_range(struct ssd1307fb_par *par, u8 page_start, 182 + u8 pages) 183 + { 184 + u8 page_end = page_start + pages - 1; 185 + int ret; 186 + 187 + if (page_start == par->page_start && page_end == par->page_end) 188 + return 0; 189 + 190 + ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PAGE_RANGE); 191 + if (ret < 0) 192 + return ret; 193 + 194 + ret = ssd1307fb_write_cmd(par->client, page_start); 195 + if (ret < 0) 196 + return ret; 197 + 198 + ret = ssd1307fb_write_cmd(par->client, page_end); 199 + if (ret < 0) 200 + return ret; 201 + 202 + par->page_start = page_start; 203 + par->page_end = page_end; 204 + return 0; 205 + } 206 + 207 + static int ssd1307fb_update_rect(struct ssd1307fb_par *par, unsigned int x, 208 + unsigned int y, unsigned int width, 209 + unsigned int height) 161 210 { 162 211 struct ssd1307fb_array *array; 163 212 u8 *vmem = par->info->screen_buffer; 164 213 unsigned int line_length = par->info->fix.line_length; 165 - unsigned int pages = DIV_ROUND_UP(par->height, 8); 166 - int i, j, k; 214 + unsigned int pages = DIV_ROUND_UP(y % 8 + height, 8); 215 + u32 array_idx = 0; 216 + int ret, i, j, k; 167 217 168 - array = ssd1307fb_alloc_array(par->width * pages, SSD1307FB_DATA); 218 + array = ssd1307fb_alloc_array(width * pages, SSD1307FB_DATA); 169 219 if (!array) 170 - return; 220 + return -ENOMEM; 171 221 172 222 /* 173 223 * The screen is divided in pages, each having a height of 8 ··· 253 193 * (5) A4 B4 C4 D4 E4 F4 G4 H4 254 194 */ 255 195 256 - for (i = 0; i < pages; i++) { 257 - for (j = 0; j < par->width; j++) { 258 - int m = 8; 259 - u32 array_idx = i * par->width + j; 260 - array->data[array_idx] = 0; 261 - /* Last page may be partial */ 262 - if (i + 1 == pages && par->height % 8) 263 - m = par->height % 8; 196 + ret = ssd1307fb_set_col_range(par, par->col_offset + x, width); 197 + if (ret < 0) 198 + goto out_free; 199 + 200 + ret = ssd1307fb_set_page_range(par, par->page_offset + y / 8, pages); 201 + if (ret < 0) 202 + goto out_free; 203 + 204 + for (i = y / 8; i < y / 8 + pages; i++) { 205 + int m = 8; 206 + 207 + /* Last page may be partial */ 208 + if (8 * (i + 1) > par->height) 209 + m = par->height % 8; 210 + for (j = x; j < x + width; j++) { 211 + u8 data = 0; 212 + 264 213 for (k = 0; k < m; k++) { 265 214 u8 byte = vmem[(8 * i + k) * line_length + 266 215 j / 8]; 267 216 u8 bit = (byte >> (j % 8)) & 1; 268 - array->data[array_idx] |= bit << k; 217 + data |= bit << k; 269 218 } 219 + array->data[array_idx++] = data; 270 220 } 271 221 } 272 222 273 - ssd1307fb_write_array(par->client, array, par->width * pages); 223 + ret = ssd1307fb_write_array(par->client, array, width * pages); 224 + 225 + out_free: 274 226 kfree(array); 227 + return ret; 275 228 } 276 229 230 + static int ssd1307fb_update_display(struct ssd1307fb_par *par) 231 + { 232 + return ssd1307fb_update_rect(par, 0, 0, par->width, par->height); 233 + } 277 234 278 235 static ssize_t ssd1307fb_write(struct fb_info *info, const char __user *buf, 279 236 size_t count, loff_t *ppos) ··· 299 222 unsigned long total_size; 300 223 unsigned long p = *ppos; 301 224 void *dst; 225 + int ret; 302 226 303 227 total_size = info->fix.smem_len; 304 228 ··· 317 239 if (copy_from_user(dst, buf, count)) 318 240 return -EFAULT; 319 241 320 - ssd1307fb_update_display(par); 242 + ret = ssd1307fb_update_display(par); 243 + if (ret < 0) 244 + return ret; 321 245 322 246 *ppos += count; 323 247 ··· 340 260 { 341 261 struct ssd1307fb_par *par = info->par; 342 262 sys_fillrect(info, rect); 343 - ssd1307fb_update_display(par); 263 + ssd1307fb_update_rect(par, rect->dx, rect->dy, rect->width, 264 + rect->height); 344 265 } 345 266 346 267 static void ssd1307fb_copyarea(struct fb_info *info, const struct fb_copyarea *area) 347 268 { 348 269 struct ssd1307fb_par *par = info->par; 349 270 sys_copyarea(info, area); 350 - ssd1307fb_update_display(par); 271 + ssd1307fb_update_rect(par, area->dx, area->dy, area->width, 272 + area->height); 351 273 } 352 274 353 275 static void ssd1307fb_imageblit(struct fb_info *info, const struct fb_image *image) 354 276 { 355 277 struct ssd1307fb_par *par = info->par; 356 278 sys_imageblit(info, image); 357 - ssd1307fb_update_display(par); 279 + ssd1307fb_update_rect(par, image->dx, image->dy, image->width, 280 + image->height); 358 281 } 359 282 360 283 static const struct fb_ops ssd1307fb_ops = { ··· 537 454 if (ret < 0) 538 455 return ret; 539 456 540 - /* Set column range */ 541 - ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_COL_RANGE); 542 - if (ret < 0) 543 - return ret; 544 - 545 - ret = ssd1307fb_write_cmd(par->client, par->col_offset); 546 - if (ret < 0) 547 - return ret; 548 - 549 - ret = ssd1307fb_write_cmd(par->client, par->col_offset + par->width - 1); 550 - if (ret < 0) 551 - return ret; 552 - 553 - /* Set page range */ 554 - ret = ssd1307fb_write_cmd(par->client, SSD1307FB_SET_PAGE_RANGE); 555 - if (ret < 0) 556 - return ret; 557 - 558 - ret = ssd1307fb_write_cmd(par->client, par->page_offset); 559 - if (ret < 0) 560 - return ret; 561 - 562 - ret = ssd1307fb_write_cmd(par->client, 563 - par->page_offset + 564 - DIV_ROUND_UP(par->height, 8) - 1); 565 - if (ret < 0) 566 - return ret; 567 - 568 457 /* Clear the screen */ 569 - ssd1307fb_update_display(par); 458 + ret = ssd1307fb_update_display(par); 459 + if (ret < 0) 460 + return ret; 570 461 571 462 /* Turn on the display */ 572 463 ret = ssd1307fb_write_cmd(par->client, SSD1307FB_DISPLAY_ON);
+56 -11
include/drm/drm_auth.h
··· 58 58 * @refcount: Refcount for this master object. 59 59 * @dev: Link back to the DRM device 60 60 * @driver_priv: Pointer to driver-private information. 61 - * @lessor: Lease holder 62 - * @lessee_id: id for lessees. Owners always have id 0 63 - * @lessee_list: other lessees of the same master 64 - * @lessees: drm_masters leasing from this one 65 - * @leases: Objects leased to this drm_master. 66 - * @lessee_idr: All lessees under this owner (only used where lessor == NULL) 67 61 * 68 62 * Note that master structures are only relevant for the legacy/primary device 69 63 * nodes, hence there can only be one per device, not one per drm_minor. ··· 82 88 struct idr magic_map; 83 89 void *driver_priv; 84 90 85 - /* Tree of display resource leases, each of which is a drm_master struct 86 - * All of these get activated simultaneously, so drm_device master points 87 - * at the top of the tree (for which lessor is NULL). Protected by 88 - * &drm_device.mode_config.idr_mutex. 91 + /** 92 + * @lessor: 93 + * 94 + * Lease grantor, only set if this &struct drm_master represents a 95 + * lessee holding a lease of objects from @lessor. Full owners of the 96 + * device have this set to NULL. 97 + * 98 + * The lessor does not change once it's set in drm_lease_create(), and 99 + * each lessee holds a reference to its lessor that it releases upon 100 + * being destroyed in drm_lease_destroy(). 101 + * 102 + * See also the :ref:`section on display resource leasing 103 + * <drm_leasing>`. 89 104 */ 90 - 91 105 struct drm_master *lessor; 106 + 107 + /** 108 + * @lessee_id: 109 + * 110 + * ID for lessees. Owners (i.e. @lessor is NULL) always have ID 0. 111 + * Protected by &drm_device.mode_config's &drm_mode_config.idr_mutex. 112 + */ 92 113 int lessee_id; 114 + 115 + /** 116 + * @lessee_list: 117 + * 118 + * List entry of lessees of @lessor, where they are linked to @lessees. 119 + * Not used for owners. Protected by &drm_device.mode_config's 120 + * &drm_mode_config.idr_mutex. 121 + */ 93 122 struct list_head lessee_list; 123 + 124 + /** 125 + * @lessees: 126 + * 127 + * List of drm_masters leasing from this one. Protected by 128 + * &drm_device.mode_config's &drm_mode_config.idr_mutex. 129 + * 130 + * This list is empty if no leases have been granted, or if all lessees 131 + * have been destroyed. Since lessors are referenced by all their 132 + * lessees, this master cannot be destroyed unless the list is empty. 133 + */ 94 134 struct list_head lessees; 135 + 136 + /** 137 + * @leases: 138 + * 139 + * Objects leased to this drm_master. Protected by 140 + * &drm_device.mode_config's &drm_mode_config.idr_mutex. 141 + * 142 + * Objects are leased all together in drm_lease_create(), and are 143 + * removed all together when the lease is revoked. 144 + */ 95 145 struct idr leases; 146 + 147 + /** 148 + * @lessee_idr: 149 + * 150 + * All lessees under this owner (only used where @lessor is NULL). 151 + * Protected by &drm_device.mode_config's &drm_mode_config.idr_mutex. 152 + */ 96 153 struct idr lessee_idr; 97 154 /* private: */ 98 155 #if IS_ENABLED(CONFIG_DRM_LEGACY)
-18
include/drm/drm_damage_helper.h
··· 64 64 bool full_update; 65 65 }; 66 66 67 - void drm_plane_enable_fb_damage_clips(struct drm_plane *plane); 68 67 void drm_atomic_helper_check_plane_damage(struct drm_atomic_state *state, 69 68 struct drm_plane_state *plane_state); 70 69 int drm_atomic_helper_dirtyfb(struct drm_framebuffer *fb, ··· 80 81 bool drm_atomic_helper_damage_merged(const struct drm_plane_state *old_state, 81 82 struct drm_plane_state *state, 82 83 struct drm_rect *rect); 83 - 84 - /** 85 - * drm_helper_get_plane_damage_clips - Returns damage clips in &drm_rect. 86 - * @state: Plane state. 87 - * 88 - * Returns plane damage rectangles in internal &drm_rect. Currently &drm_rect 89 - * can be obtained by simply typecasting &drm_mode_rect. This is because both 90 - * are signed 32 and during drm_atomic_check_only() it is verified that damage 91 - * clips are inside fb. 92 - * 93 - * Return: Clips in plane fb_damage_clips blob property. 94 - */ 95 - static inline struct drm_rect * 96 - drm_helper_get_plane_damage_clips(const struct drm_plane_state *state) 97 - { 98 - return (struct drm_rect *)drm_plane_get_damage_clips(state); 99 - } 100 84 101 85 #endif
+6
include/drm/drm_gem_framebuffer_helper.h
··· 1 1 #ifndef __DRM_GEM_FB_HELPER_H__ 2 2 #define __DRM_GEM_FB_HELPER_H__ 3 3 4 + #include <linux/dma-buf.h> 5 + #include <linux/dma-buf-map.h> 6 + 4 7 struct drm_afbc_framebuffer; 5 8 struct drm_device; 6 9 struct drm_fb_helper_surface_size; ··· 36 33 struct drm_framebuffer * 37 34 drm_gem_fb_create_with_dirty(struct drm_device *dev, struct drm_file *file, 38 35 const struct drm_mode_fb_cmd2 *mode_cmd); 36 + 37 + int drm_gem_fb_begin_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir); 38 + void drm_gem_fb_end_cpu_access(struct drm_framebuffer *fb, enum dma_data_direction dir); 39 39 40 40 #define drm_is_afbc(modifier) \ 41 41 (((modifier) & AFBC_VENDOR_AND_TYPE_MASK) == DRM_FORMAT_MOD_ARM_AFBC(0))
+4 -4
include/drm/drm_mipi_dsi.h
··· 124 124 /* enable hsync-end packets in vsync-pulse and v-porch area */ 125 125 #define MIPI_DSI_MODE_VIDEO_HSE BIT(4) 126 126 /* disable hfront-porch area */ 127 - #define MIPI_DSI_MODE_VIDEO_HFP BIT(5) 127 + #define MIPI_DSI_MODE_VIDEO_NO_HFP BIT(5) 128 128 /* disable hback-porch area */ 129 - #define MIPI_DSI_MODE_VIDEO_HBP BIT(6) 129 + #define MIPI_DSI_MODE_VIDEO_NO_HBP BIT(6) 130 130 /* disable hsync-active area */ 131 - #define MIPI_DSI_MODE_VIDEO_HSA BIT(7) 131 + #define MIPI_DSI_MODE_VIDEO_NO_HSA BIT(7) 132 132 /* flush display FIFO on vsync pulse */ 133 133 #define MIPI_DSI_MODE_VSYNC_FLUSH BIT(8) 134 134 /* disable EoT packets in HS mode */ 135 - #define MIPI_DSI_MODE_EOT_PACKET BIT(9) 135 + #define MIPI_DSI_MODE_NO_EOT_PACKET BIT(9) 136 136 /* device supports non-continuous clock behavior (DSI spec 5.6.1) */ 137 137 #define MIPI_DSI_CLOCK_NON_CONTINUOUS BIT(10) 138 138 /* transmit data in low power */
+8 -31
include/drm/drm_plane.h
··· 186 186 * since last plane update) as an array of &drm_mode_rect in framebuffer 187 187 * coodinates of the attached framebuffer. Note that unlike plane src, 188 188 * damage clips are not in 16.16 fixed point. 189 + * 190 + * See drm_plane_get_damage_clips() and 191 + * drm_plane_get_damage_clips_count() for accessing these. 189 192 */ 190 193 struct drm_property_blob *fb_damage_clips; 191 194 ··· 897 894 898 895 bool drm_any_plane_has_format(struct drm_device *dev, 899 896 u32 format, u64 modifier); 900 - /** 901 - * drm_plane_get_damage_clips_count - Returns damage clips count. 902 - * @state: Plane state. 903 - * 904 - * Simple helper to get the number of &drm_mode_rect clips set by user-space 905 - * during plane update. 906 - * 907 - * Return: Number of clips in plane fb_damage_clips blob property. 908 - */ 909 - static inline unsigned int 910 - drm_plane_get_damage_clips_count(const struct drm_plane_state *state) 911 - { 912 - return (state && state->fb_damage_clips) ? 913 - state->fb_damage_clips->length/sizeof(struct drm_mode_rect) : 0; 914 - } 915 897 916 - /** 917 - * drm_plane_get_damage_clips - Returns damage clips. 918 - * @state: Plane state. 919 - * 920 - * Note that this function returns uapi type &drm_mode_rect. Drivers might 921 - * instead be interested in internal &drm_rect which can be obtained by calling 922 - * drm_helper_get_plane_damage_clips(). 923 - * 924 - * Return: Damage clips in plane fb_damage_clips blob property. 925 - */ 926 - static inline struct drm_mode_rect * 927 - drm_plane_get_damage_clips(const struct drm_plane_state *state) 928 - { 929 - return (struct drm_mode_rect *)((state && state->fb_damage_clips) ? 930 - state->fb_damage_clips->data : NULL); 931 - } 898 + void drm_plane_enable_fb_damage_clips(struct drm_plane *plane); 899 + unsigned int 900 + drm_plane_get_damage_clips_count(const struct drm_plane_state *state); 901 + struct drm_mode_rect * 902 + drm_plane_get_damage_clips(const struct drm_plane_state *state); 932 903 933 904 int drm_plane_create_scaling_filter_property(struct drm_plane *plane, 934 905 unsigned int supported_filters);
+8 -1
include/drm/drm_property.h
··· 31 31 32 32 /** 33 33 * struct drm_property_enum - symbolic values for enumerations 34 - * @value: numeric property value for this enum entry 35 34 * @head: list of enum values, linked to &drm_property.enum_list 36 35 * @name: symbolic name for the enum 37 36 * ··· 38 39 * decoding for each value. This is used for example for the rotation property. 39 40 */ 40 41 struct drm_property_enum { 42 + /** 43 + * @value: numeric property value for this enum entry 44 + * 45 + * If the property has the type &DRM_MODE_PROP_BITMASK, @value stores a 46 + * bitshift, not a bitmask. In other words, the enum entry is enabled 47 + * if the bit number @value is set in the property's value. This enum 48 + * entry has the bitmask ``1 << value``. 49 + */ 41 50 uint64_t value; 42 51 struct list_head head; 43 52 char name[DRM_PROP_NAME_LEN];
+3
include/drm/drm_rect.h
··· 39 39 * @x2: horizontal ending coordinate (exclusive) 40 40 * @y1: vertical starting coordinate (inclusive) 41 41 * @y2: vertical ending coordinate (exclusive) 42 + * 43 + * Note that this must match the layout of struct drm_mode_rect or the damage 44 + * helpers like drm_atomic_helper_damage_iter_init() break. 42 45 */ 43 46 struct drm_rect { 44 47 int x1, y1, x2, y2;
+10
include/uapi/drm/drm.h
··· 1050 1050 #define DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, struct drm_mode_get_blob) 1051 1051 #define DRM_IOCTL_MODE_GETFB DRM_IOWR(0xAD, struct drm_mode_fb_cmd) 1052 1052 #define DRM_IOCTL_MODE_ADDFB DRM_IOWR(0xAE, struct drm_mode_fb_cmd) 1053 + /** 1054 + * DRM_IOCTL_MODE_RMFB - Remove a framebuffer. 1055 + * 1056 + * This removes a framebuffer previously added via ADDFB/ADDFB2. The IOCTL 1057 + * argument is a framebuffer object ID. 1058 + * 1059 + * Warning: removing a framebuffer currently in-use on an enabled plane will 1060 + * disable that plane. The CRTC the plane is linked to may also be disabled 1061 + * (depending on driver capabilities). 1062 + */ 1053 1063 #define DRM_IOCTL_MODE_RMFB DRM_IOWR(0xAF, unsigned int) 1054 1064 #define DRM_IOCTL_MODE_PAGE_FLIP DRM_IOWR(0xB0, struct drm_mode_crtc_page_flip) 1055 1065 #define DRM_IOCTL_MODE_DIRTYFB DRM_IOWR(0xB1, struct drm_mode_fb_dirty_cmd)
+106 -3
include/uapi/drm/drm_fourcc.h
··· 900 900 901 901 /* 902 902 * The top 4 bits (out of the 56 bits alloted for specifying vendor specific 903 - * modifiers) denote the category for modifiers. Currently we have only two 904 - * categories of modifiers ie AFBC and MISC. We can have a maximum of sixteen 905 - * different categories. 903 + * modifiers) denote the category for modifiers. Currently we have three 904 + * categories of modifiers ie AFBC, MISC and AFRC. We can have a maximum of 905 + * sixteen different categories. 906 906 */ 907 907 #define DRM_FORMAT_MOD_ARM_CODE(__type, __val) \ 908 908 fourcc_mod_code(ARM, ((__u64)(__type) << 52) | ((__val) & 0x000fffffffffffffULL)) ··· 1016 1016 * superblocks, USM just guarantees it for all. 1017 1017 */ 1018 1018 #define AFBC_FORMAT_MOD_USM (1ULL << 12) 1019 + 1020 + /* 1021 + * Arm Fixed-Rate Compression (AFRC) modifiers 1022 + * 1023 + * AFRC is a proprietary fixed rate image compression protocol and format, 1024 + * designed to provide guaranteed bandwidth and memory footprint 1025 + * reductions in graphics and media use-cases. 1026 + * 1027 + * AFRC buffers consist of one or more planes, with the same components 1028 + * and meaning as an uncompressed buffer using the same pixel format. 1029 + * 1030 + * Within each plane, the pixel/luma/chroma values are grouped into 1031 + * "coding unit" blocks which are individually compressed to a 1032 + * fixed size (in bytes). All coding units within a given plane of a buffer 1033 + * store the same number of values, and have the same compressed size. 1034 + * 1035 + * The coding unit size is configurable, allowing different rates of compression. 1036 + * 1037 + * The start of each AFRC buffer plane must be aligned to an alignment granule which 1038 + * depends on the coding unit size. 1039 + * 1040 + * Coding Unit Size Plane Alignment 1041 + * ---------------- --------------- 1042 + * 16 bytes 1024 bytes 1043 + * 24 bytes 512 bytes 1044 + * 32 bytes 2048 bytes 1045 + * 1046 + * Coding units are grouped into paging tiles. AFRC buffer dimensions must be aligned 1047 + * to a multiple of the paging tile dimensions. 1048 + * The dimensions of each paging tile depend on whether the buffer is optimised for 1049 + * scanline (SCAN layout) or rotated (ROT layout) access. 1050 + * 1051 + * Layout Paging Tile Width Paging Tile Height 1052 + * ------ ----------------- ------------------ 1053 + * SCAN 16 coding units 4 coding units 1054 + * ROT 8 coding units 8 coding units 1055 + * 1056 + * The dimensions of each coding unit depend on the number of components 1057 + * in the compressed plane and whether the buffer is optimised for 1058 + * scanline (SCAN layout) or rotated (ROT layout) access. 1059 + * 1060 + * Number of Components in Plane Layout Coding Unit Width Coding Unit Height 1061 + * ----------------------------- --------- ----------------- ------------------ 1062 + * 1 SCAN 16 samples 4 samples 1063 + * Example: 16x4 luma samples in a 'Y' plane 1064 + * 16x4 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer 1065 + * ----------------------------- --------- ----------------- ------------------ 1066 + * 1 ROT 8 samples 8 samples 1067 + * Example: 8x8 luma samples in a 'Y' plane 1068 + * 8x8 chroma 'V' values, in the 'V' plane of a fully-planar YUV buffer 1069 + * ----------------------------- --------- ----------------- ------------------ 1070 + * 2 DONT CARE 8 samples 4 samples 1071 + * Example: 8x4 chroma pairs in the 'UV' plane of a semi-planar YUV buffer 1072 + * ----------------------------- --------- ----------------- ------------------ 1073 + * 3 DONT CARE 4 samples 4 samples 1074 + * Example: 4x4 pixels in an RGB buffer without alpha 1075 + * ----------------------------- --------- ----------------- ------------------ 1076 + * 4 DONT CARE 4 samples 4 samples 1077 + * Example: 4x4 pixels in an RGB buffer with alpha 1078 + */ 1079 + 1080 + #define DRM_FORMAT_MOD_ARM_TYPE_AFRC 0x02 1081 + 1082 + #define DRM_FORMAT_MOD_ARM_AFRC(__afrc_mode) \ 1083 + DRM_FORMAT_MOD_ARM_CODE(DRM_FORMAT_MOD_ARM_TYPE_AFRC, __afrc_mode) 1084 + 1085 + /* 1086 + * AFRC coding unit size modifier. 1087 + * 1088 + * Indicates the number of bytes used to store each compressed coding unit for 1089 + * one or more planes in an AFRC encoded buffer. The coding unit size for chrominance 1090 + * is the same for both Cb and Cr, which may be stored in separate planes. 1091 + * 1092 + * AFRC_FORMAT_MOD_CU_SIZE_P0 indicates the number of bytes used to store 1093 + * each compressed coding unit in the first plane of the buffer. For RGBA buffers 1094 + * this is the only plane, while for semi-planar and fully-planar YUV buffers, 1095 + * this corresponds to the luma plane. 1096 + * 1097 + * AFRC_FORMAT_MOD_CU_SIZE_P12 indicates the number of bytes used to store 1098 + * each compressed coding unit in the second and third planes in the buffer. 1099 + * For semi-planar and fully-planar YUV buffers, this corresponds to the chroma plane(s). 1100 + * 1101 + * For single-plane buffers, AFRC_FORMAT_MOD_CU_SIZE_P0 must be specified 1102 + * and AFRC_FORMAT_MOD_CU_SIZE_P12 must be zero. 1103 + * For semi-planar and fully-planar buffers, both AFRC_FORMAT_MOD_CU_SIZE_P0 and 1104 + * AFRC_FORMAT_MOD_CU_SIZE_P12 must be specified. 1105 + */ 1106 + #define AFRC_FORMAT_MOD_CU_SIZE_MASK 0xf 1107 + #define AFRC_FORMAT_MOD_CU_SIZE_16 (1ULL) 1108 + #define AFRC_FORMAT_MOD_CU_SIZE_24 (2ULL) 1109 + #define AFRC_FORMAT_MOD_CU_SIZE_32 (3ULL) 1110 + 1111 + #define AFRC_FORMAT_MOD_CU_SIZE_P0(__afrc_cu_size) (__afrc_cu_size) 1112 + #define AFRC_FORMAT_MOD_CU_SIZE_P12(__afrc_cu_size) ((__afrc_cu_size) << 4) 1113 + 1114 + /* 1115 + * AFRC scanline memory layout. 1116 + * 1117 + * Indicates if the buffer uses the scanline-optimised layout 1118 + * for an AFRC encoded buffer, otherwise, it uses the rotation-optimised layout. 1119 + * The memory layout is the same for all planes. 1120 + */ 1121 + #define AFRC_FORMAT_MOD_LAYOUT_SCAN (1ULL << 8) 1019 1122 1020 1123 /* 1021 1124 * Arm 16x16 Block U-Interleaved modifier