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

Merge tag 'drm-misc-next-2020-01-02' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v5.6:

UAPI Changes:
- Commandline parser: Add support for panel orientation, and per-mode options.
- Fix IOCTL naming for dma-buf heaps.

Cross-subsystem Changes:
- Rename DMA_HEAP_IOC_ALLOC to DMA_HEAP_IOCTL_ALLOC before it becomes abi.
- Change DMA-BUF system-heap's name to system.
- Fix leak in error handling in dma_heap_ioctl(), and make a symbol static.
- Fix udma-buf cpu access.
- Fix ti devicetree bindings.

Core Changes:
- Add CTA-861-G modes with VIC >= 193.
- Change error handling and remove bug_on in *drm_dev_init.
- Export drm_panel_of_backlight() correctly once more.
- Add support for lvds decoders.
- Convert drm/client and drm/(gem-,)fb-helper to drm-device based logging and update logging todo.

Driver Changes:
- Add support for dsi/px30 to rockchip.
- Add fb damage support to virtio.
- Use dma_resv locking wrappers in vc4, msm, etnaviv.
- Make functions in virtio static, and perform some simplifications.
- Add suspend support to sun4i.
- Add A64 mipi dsi support to sun4i.
- Add runtime pm suspend to komeda.
- Associated driver fixes.

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

From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/efc11139-1653-86bc-1b0f-0aefde219850@linux.intel.com

+1645 -824
+31 -2
Documentation/devicetree/bindings/display/allwinner,sun6i-a31-mipi-dsi.yaml
··· 15 15 "#size-cells": true 16 16 17 17 compatible: 18 - const: allwinner,sun6i-a31-mipi-dsi 18 + enum: 19 + - allwinner,sun6i-a31-mipi-dsi 20 + - allwinner,sun50i-a64-mipi-dsi 19 21 20 22 reg: 21 23 maxItems: 1 ··· 26 24 maxItems: 1 27 25 28 26 clocks: 27 + minItems: 1 28 + maxItems: 2 29 29 items: 30 30 - description: Bus Clock 31 31 - description: Module Clock ··· 67 63 - reg 68 64 - interrupts 69 65 - clocks 70 - - clock-names 71 66 - phys 72 67 - phy-names 73 68 - resets 74 69 - vcc-dsi-supply 75 70 - port 71 + 72 + allOf: 73 + - if: 74 + properties: 75 + compatible: 76 + contains: 77 + const: allwinner,sun6i-a31-mipi-dsi 78 + 79 + then: 80 + properties: 81 + clocks: 82 + minItems: 2 83 + 84 + required: 85 + - clock-names 86 + 87 + - if: 88 + properties: 89 + compatible: 90 + contains: 91 + const: allwinner,sun50i-a64-mipi-dsi 92 + 93 + then: 94 + properties: 95 + clocks: 96 + minItems: 1 76 97 77 98 additionalProperties: false 78 99
+131
Documentation/devicetree/bindings/display/bridge/lvds-codec.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/display/bridge/lvds-codec.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Transparent LVDS encoders and decoders 8 + 9 + maintainers: 10 + - Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> 11 + 12 + description: | 13 + This binding supports transparent LVDS encoders and decoders that don't 14 + require any configuration. 15 + 16 + LVDS is a physical layer specification defined in ANSI/TIA/EIA-644-A. Multiple 17 + incompatible data link layers have been used over time to transmit image data 18 + to LVDS panels. This binding targets devices compatible with the following 19 + specifications only. 20 + 21 + [JEIDA] "Digital Interface Standards for Monitor", JEIDA-59-1999, February 22 + 1999 (Version 1.0), Japan Electronic Industry Development Association (JEIDA) 23 + [LDI] "Open LVDS Display Interface", May 1999 (Version 0.95), National 24 + Semiconductor 25 + [VESA] "VESA Notebook Panel Standard", October 2007 (Version 1.0), Video 26 + Electronics Standards Association (VESA) 27 + 28 + Those devices have been marketed under the FPD-Link and FlatLink brand names 29 + among others. 30 + 31 + properties: 32 + compatible: 33 + oneOf: 34 + - items: 35 + - enum: 36 + - ti,ds90c185 # For the TI DS90C185 FPD-Link Serializer 37 + - ti,ds90c187 # For the TI DS90C187 FPD-Link Serializer 38 + - ti,sn75lvds83 # For the TI SN75LVDS83 FlatLink transmitter 39 + - const: lvds-encoder # Generic LVDS encoder compatible fallback 40 + - items: 41 + - enum: 42 + - ti,ds90cf384a # For the DS90CF384A FPD-Link LVDS Receiver 43 + - const: lvds-decoder # Generic LVDS decoders compatible fallback 44 + - enum: 45 + - thine,thc63lvdm83d # For the THC63LVDM83D LVDS serializer 46 + 47 + ports: 48 + type: object 49 + description: | 50 + This device has two video ports. Their connections are modeled using the 51 + OF graph bindings specified in Documentation/devicetree/bindings/graph.txt 52 + properties: 53 + port@0: 54 + type: object 55 + description: | 56 + For LVDS encoders, port 0 is the parallel input 57 + For LVDS decoders, port 0 is the LVDS input 58 + 59 + port@1: 60 + type: object 61 + description: | 62 + For LVDS encoders, port 1 is the LVDS output 63 + For LVDS decoders, port 1 is the parallel output 64 + 65 + required: 66 + - port@0 67 + - port@1 68 + 69 + powerdown-gpios: 70 + description: 71 + The GPIO used to control the power down line of this device. 72 + maxItems: 1 73 + 74 + required: 75 + - compatible 76 + - ports 77 + 78 + examples: 79 + - | 80 + lvds-encoder { 81 + compatible = "ti,ds90c185", "lvds-encoder"; 82 + 83 + ports { 84 + #address-cells = <1>; 85 + #size-cells = <0>; 86 + 87 + port@0 { 88 + reg = <0>; 89 + 90 + lvds_enc_in: endpoint { 91 + remote-endpoint = <&display_out_rgb>; 92 + }; 93 + }; 94 + 95 + port@1 { 96 + reg = <1>; 97 + 98 + lvds_enc_out: endpoint { 99 + remote-endpoint = <&lvds_panel_in>; 100 + }; 101 + }; 102 + }; 103 + }; 104 + 105 + - | 106 + lvds-decoder { 107 + compatible = "ti,ds90cf384a", "lvds-decoder"; 108 + 109 + ports { 110 + #address-cells = <1>; 111 + #size-cells = <0>; 112 + 113 + port@0 { 114 + reg = <0>; 115 + 116 + lvds_dec_in: endpoint { 117 + remote-endpoint = <&display_out_lvds>; 118 + }; 119 + }; 120 + 121 + port@1 { 122 + reg = <1>; 123 + 124 + lvds_dec_out: endpoint { 125 + remote-endpoint = <&rgb_panel_in>; 126 + }; 127 + }; 128 + }; 129 + }; 130 + 131 + ...
-66
Documentation/devicetree/bindings/display/bridge/lvds-transmitter.txt
··· 1 - Parallel to LVDS Encoder 2 - ------------------------ 3 - 4 - This binding supports the parallel to LVDS encoders that don't require any 5 - configuration. 6 - 7 - LVDS is a physical layer specification defined in ANSI/TIA/EIA-644-A. Multiple 8 - incompatible data link layers have been used over time to transmit image data 9 - to LVDS panels. This binding targets devices compatible with the following 10 - specifications only. 11 - 12 - [JEIDA] "Digital Interface Standards for Monitor", JEIDA-59-1999, February 13 - 1999 (Version 1.0), Japan Electronic Industry Development Association (JEIDA) 14 - [LDI] "Open LVDS Display Interface", May 1999 (Version 0.95), National 15 - Semiconductor 16 - [VESA] "VESA Notebook Panel Standard", October 2007 (Version 1.0), Video 17 - Electronics Standards Association (VESA) 18 - 19 - Those devices have been marketed under the FPD-Link and FlatLink brand names 20 - among others. 21 - 22 - 23 - Required properties: 24 - 25 - - compatible: Must be "lvds-encoder" 26 - 27 - Any encoder compatible with this generic binding, but with additional 28 - properties not listed here, must list a device specific compatible first 29 - followed by this generic compatible. 30 - 31 - Required nodes: 32 - 33 - This device has two video ports. Their connections are modeled using the OF 34 - graph bindings specified in Documentation/devicetree/bindings/graph.txt. 35 - 36 - - Video port 0 for parallel input 37 - - Video port 1 for LVDS output 38 - 39 - 40 - Example 41 - ------- 42 - 43 - lvds-encoder { 44 - compatible = "lvds-encoder"; 45 - 46 - ports { 47 - #address-cells = <1>; 48 - #size-cells = <0>; 49 - 50 - port@0 { 51 - reg = <0>; 52 - 53 - lvds_enc_in: endpoint { 54 - remote-endpoint = <&display_out_rgb>; 55 - }; 56 - }; 57 - 58 - port@1 { 59 - reg = <1>; 60 - 61 - lvds_enc_out: endpoint { 62 - remote-endpoint = <&lvds_panel_in>; 63 - }; 64 - }; 65 - }; 66 - };
-50
Documentation/devicetree/bindings/display/bridge/thine,thc63lvdm83d.txt
··· 1 - THine Electronics THC63LVDM83D LVDS serializer 2 - ---------------------------------------------- 3 - 4 - The THC63LVDM83D is an LVDS serializer designed to support pixel data 5 - transmission between a host and a flat panel. 6 - 7 - Required properties: 8 - 9 - - compatible: Should be "thine,thc63lvdm83d" 10 - 11 - Optional properties: 12 - 13 - - powerdown-gpios: Power down control GPIO (the /PWDN pin, active low). 14 - 15 - Required nodes: 16 - 17 - The THC63LVDM83D has two video ports. Their connections are modeled using the 18 - OFgraph bindings specified in Documentation/devicetree/bindings/graph.txt. 19 - 20 - - Video port 0 for CMOS/TTL input 21 - - Video port 1 for LVDS output 22 - 23 - 24 - Example 25 - ------- 26 - 27 - lvds_enc: encoder@0 { 28 - compatible = "thine,thc63lvdm83d"; 29 - 30 - ports { 31 - #address-cells = <1>; 32 - #size-cells = <0>; 33 - 34 - port@0 { 35 - reg = <0>; 36 - 37 - lvds_enc_in: endpoint@0 { 38 - remote-endpoint = <&rgb_out>; 39 - }; 40 - }; 41 - 42 - port@1 { 43 - reg = <1>; 44 - 45 - lvds_enc_out: endpoint@0 { 46 - remote-endpoint = <&panel_in>; 47 - }; 48 - }; 49 - }; 50 - };
-55
Documentation/devicetree/bindings/display/bridge/ti,ds90c185.txt
··· 1 - Texas Instruments FPD-Link (LVDS) Serializer 2 - -------------------------------------------- 3 - 4 - The DS90C185 and DS90C187 are low-power serializers for portable 5 - battery-powered applications that reduces the size of the RGB 6 - interface between the host GPU and the display. 7 - 8 - Required properties: 9 - 10 - - compatible: Should be 11 - "ti,ds90c185", "lvds-encoder" for the TI DS90C185 FPD-Link Serializer 12 - "ti,ds90c187", "lvds-encoder" for the TI DS90C187 FPD-Link Serializer 13 - 14 - Optional properties: 15 - 16 - - powerdown-gpios: Power down control GPIO (the PDB pin, active-low) 17 - 18 - Required nodes: 19 - 20 - The devices have two video ports. Their connections are modeled using the OF 21 - graph bindings specified in Documentation/devicetree/bindings/graph.txt. 22 - 23 - - Video port 0 for parallel input 24 - - Video port 1 for LVDS output 25 - 26 - 27 - Example 28 - ------- 29 - 30 - lvds-encoder { 31 - compatible = "ti,ds90c185", "lvds-encoder"; 32 - 33 - powerdown-gpios = <&gpio 17 GPIO_ACTIVE_LOW>; 34 - 35 - ports { 36 - #address-cells = <1>; 37 - #size-cells = <0>; 38 - 39 - port@0 { 40 - reg = <0>; 41 - 42 - lvds_enc_in: endpoint { 43 - remote-endpoint = <&lcdc_out_rgb>; 44 - }; 45 - }; 46 - 47 - port@1 { 48 - reg = <1>; 49 - 50 - lvds_enc_out: endpoint { 51 - remote-endpoint = <&lvds_panel_in>; 52 - }; 53 - }; 54 - }; 55 - };
+9 -4
Documentation/devicetree/bindings/display/rockchip/dw_mipi_dsi_rockchip.txt
··· 4 4 Required properties: 5 5 - #address-cells: Should be <1>. 6 6 - #size-cells: Should be <0>. 7 - - compatible: "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi". 8 - "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi". 7 + - compatible: one of 8 + "rockchip,px30-mipi-dsi", "snps,dw-mipi-dsi" 9 + "rockchip,rk3288-mipi-dsi", "snps,dw-mipi-dsi" 10 + "rockchip,rk3399-mipi-dsi", "snps,dw-mipi-dsi" 9 11 - reg: Represent the physical address range of the controller. 10 12 - interrupts: Represent the controller's interrupt to the CPU(s). 11 13 - clocks, clock-names: Phandles to the controller's pll reference 12 - clock(ref) and APB clock(pclk). For RK3399, a phy config clock 13 - (phy_cfg) and a grf clock(grf) are required. As described in [1]. 14 + clock(ref) when using an internal dphy and APB clock(pclk). 15 + For RK3399, a phy config clock (phy_cfg) and a grf clock(grf) 16 + are required. As described in [1]. 14 17 - rockchip,grf: this soc should set GRF regs to mux vopl/vopb. 15 18 - ports: contain a port node with endpoint definitions as defined in [2]. 16 19 For vopb,set the reg = <0> and set the reg = <1> for vopl. ··· 21 18 - video port 1 for either a panel or subsequent encoder 22 19 23 20 Optional properties: 21 + - phys: from general PHY binding: the phandle for the PHY device. 22 + - phy-names: Should be "dphy" if phys references an external phy. 24 23 - power-domains: a phandle to mipi dsi power domain node. 25 24 - resets: list of phandle + reset specifier pairs, as described in [3]. 26 25 - reset-names: string reset name, must be "apb".
+5 -1
Documentation/devicetree/bindings/phy/allwinner,sun6i-a31-mipi-dphy.yaml
··· 15 15 const: 0 16 16 17 17 compatible: 18 - const: allwinner,sun6i-a31-mipi-dphy 18 + oneOf: 19 + - const: allwinner,sun6i-a31-mipi-dphy 20 + - items: 21 + - const: allwinner,sun50i-a64-mipi-dphy 22 + - const: allwinner,sun6i-a31-mipi-dphy 19 23 20 24 reg: 21 25 maxItems: 1
+3
Documentation/fb/modedb.rst
··· 65 65 - reflect_y (boolean): Perform an axial symmetry on the Y axis 66 66 - rotate (integer): Rotate the initial framebuffer by x 67 67 degrees. Valid values are 0, 90, 180 and 270. 68 + - panel_orientation, one of "normal", "upside_down", "left_side_up", or 69 + "right_side_up". For KMS drivers only, this sets the "panel orientation" 70 + property on the kms connector as hint for kms users. 68 71 69 72 70 73 -----------------------------------------------------------------------------
+4 -4
Documentation/gpu/todo.rst
··· 142 142 143 143 Level: Advanced 144 144 145 - Convert instances of dev_info/dev_err/dev_warn to their DRM_DEV_* equivalent 146 - ---------------------------------------------------------------------------- 145 + Convert logging to drm_* functions with drm_device paramater 146 + ------------------------------------------------------------ 147 147 148 148 For drivers which could have multiple instances, it is necessary to 149 149 differentiate between which is which in the logs. Since DRM_INFO/WARN/ERROR 150 150 don't do this, drivers used dev_info/warn/err to make this differentiation. We 151 - now have DRM_DEV_* variants of the drm print macros, so we can start to convert 152 - those drivers back to using drm-formwatted specific log messages. 151 + now have drm_* variants of the drm print functions, so we can start to convert 152 + those drivers back to using drm-formatted specific log messages. 153 153 154 154 Before you start this conversion please contact the relevant maintainers to make 155 155 sure your work will be merged - not everyone agrees that the DRM dmesg macros
+5 -4
drivers/dma-buf/dma-heap.c
··· 106 106 return 0; 107 107 } 108 108 109 - unsigned int dma_heap_ioctl_cmds[] = { 110 - DMA_HEAP_IOC_ALLOC, 109 + static unsigned int dma_heap_ioctl_cmds[] = { 110 + DMA_HEAP_IOCTL_ALLOC, 111 111 }; 112 112 113 113 static long dma_heap_ioctl(struct file *file, unsigned int ucmd, ··· 153 153 memset(kdata + in_size, 0, ksize - in_size); 154 154 155 155 switch (kcmd) { 156 - case DMA_HEAP_IOC_ALLOC: 156 + case DMA_HEAP_IOCTL_ALLOC: 157 157 ret = dma_heap_ioctl_allocate(file, kdata); 158 158 break; 159 159 default: 160 - return -ENOTTY; 160 + ret = -ENOTTY; 161 + goto err; 161 162 } 162 163 163 164 if (copy_to_user((void __user *)arg, kdata, out_size) != 0)
+1 -1
drivers/dma-buf/heaps/system_heap.c
··· 109 109 struct dma_heap_export_info exp_info; 110 110 int ret = 0; 111 111 112 - exp_info.name = "system_heap"; 112 + exp_info.name = "system"; 113 113 exp_info.ops = &system_heap_ops; 114 114 exp_info.priv = NULL; 115 115
+3 -4
drivers/dma-buf/udmabuf.c
··· 122 122 if (IS_ERR(ubuf->sg)) 123 123 return PTR_ERR(ubuf->sg); 124 124 } else { 125 - dma_sync_sg_for_device(dev, ubuf->sg->sgl, 126 - ubuf->sg->nents, 127 - direction); 125 + dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, 126 + direction); 128 127 } 129 128 130 129 return 0; ··· 138 139 if (!ubuf->sg) 139 140 return -EINVAL; 140 141 141 - dma_sync_sg_for_cpu(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); 142 + dma_sync_sg_for_device(dev, ubuf->sg->sgl, ubuf->sg->nents, direction); 142 143 return 0; 143 144 } 144 145
+12 -1
drivers/gpu/drm/arm/display/komeda/d71/d71_dev.c
··· 20 20 evts |= KOMEDA_EVENT_IBSY; 21 21 if (raw_status & LPU_IRQ_EOW) 22 22 evts |= KOMEDA_EVENT_EOW; 23 + if (raw_status & LPU_IRQ_OVR) 24 + evts |= KOMEDA_EVENT_OVR; 23 25 24 - if (raw_status & (LPU_IRQ_ERR | LPU_IRQ_IBSY)) { 26 + if (raw_status & (LPU_IRQ_ERR | LPU_IRQ_IBSY | LPU_IRQ_OVR)) { 25 27 u32 restore = 0, tbu_status; 26 28 /* Check error of LPU status */ 27 29 status = malidp_read32(reg, BLK_STATUS); ··· 47 45 restore |= LPU_STATUS_ACE3; 48 46 evts |= KOMEDA_ERR_ACE3; 49 47 } 48 + if (status & LPU_STATUS_FEMPTY) { 49 + restore |= LPU_STATUS_FEMPTY; 50 + evts |= KOMEDA_EVENT_EMPTY; 51 + } 52 + if (status & LPU_STATUS_FFULL) { 53 + restore |= LPU_STATUS_FFULL; 54 + evts |= KOMEDA_EVENT_FULL; 55 + } 56 + 50 57 if (restore != 0) 51 58 malidp_write32_mask(reg, BLK_STATUS, restore, 0); 52 59
+3
drivers/gpu/drm/arm/display/komeda/d71/d71_regs.h
··· 175 175 #define TBU_DOUTSTDCAPB_MASK 0x3F 176 176 177 177 /* LPU_IRQ_BITS */ 178 + #define LPU_IRQ_OVR BIT(9) 178 179 #define LPU_IRQ_IBSY BIT(10) 179 180 #define LPU_IRQ_ERR BIT(11) 180 181 #define LPU_IRQ_EOW BIT(12) ··· 186 185 #define LPU_STATUS_AXIE BIT(4) 187 186 #define LPU_STATUS_AXIRP BIT(5) 188 187 #define LPU_STATUS_AXIWP BIT(6) 188 + #define LPU_STATUS_FEMPTY BIT(11) 189 + #define LPU_STATUS_FFULL BIT(14) 189 190 #define LPU_STATUS_ACE0 BIT(16) 190 191 #define LPU_STATUS_ACE1 BIT(17) 191 192 #define LPU_STATUS_ACE2 BIT(18)
+3
drivers/gpu/drm/arm/display/komeda/komeda_crtc.c
··· 5 5 * 6 6 */ 7 7 #include <linux/clk.h> 8 + #include <linux/pm_runtime.h> 8 9 #include <linux/spinlock.h> 9 10 10 11 #include <drm/drm_atomic.h> ··· 275 274 komeda_crtc_atomic_enable(struct drm_crtc *crtc, 276 275 struct drm_crtc_state *old) 277 276 { 277 + pm_runtime_get_sync(crtc->dev->dev); 278 278 komeda_crtc_prepare(to_kcrtc(crtc)); 279 279 drm_crtc_vblank_on(crtc); 280 280 WARN_ON(drm_crtc_vblank_get(crtc)); ··· 374 372 drm_crtc_vblank_put(crtc); 375 373 drm_crtc_vblank_off(crtc); 376 374 komeda_crtc_unprepare(kcrtc); 375 + pm_runtime_put(crtc->dev->dev); 377 376 } 378 377 379 378 static void
+14 -41
drivers/gpu/drm/arm/display/komeda/komeda_dev.c
··· 10 10 #include <linux/of_graph.h> 11 11 #include <linux/of_reserved_mem.h> 12 12 #include <linux/platform_device.h> 13 + #include <linux/pm_runtime.h> 13 14 #include <linux/dma-mapping.h> 14 15 #ifdef CONFIG_DEBUG_FS 15 16 #include <linux/debugfs.h> ··· 28 27 29 28 seq_puts(sf, "\n====== Komeda register dump =========\n"); 30 29 30 + pm_runtime_get_sync(mdev->dev); 31 + 31 32 if (mdev->funcs->dump_register) 32 33 mdev->funcs->dump_register(mdev, sf); 33 34 34 35 for (i = 0; i < mdev->n_pipelines; i++) 35 36 komeda_pipeline_dump_register(mdev->pipelines[i], sf); 37 + 38 + pm_runtime_put(mdev->dev); 36 39 37 40 return 0; 38 41 } ··· 268 263 if (!mdev->iommu) 269 264 DRM_INFO("continue without IOMMU support!\n"); 270 265 271 - if (mdev->iommu && mdev->funcs->connect_iommu) { 272 - err = mdev->funcs->connect_iommu(mdev); 273 - if (err) { 274 - DRM_ERROR("connect iommu failed.\n"); 275 - mdev->iommu = NULL; 276 - goto disable_clk; 277 - } 278 - } 279 - 280 266 clk_disable_unprepare(mdev->aclk); 281 267 282 268 err = sysfs_create_group(&dev->kobj, &komeda_sysfs_attr_group); ··· 306 310 if (mdev->aclk) 307 311 clk_prepare_enable(mdev->aclk); 308 312 309 - if (mdev->iommu && mdev->funcs->disconnect_iommu) 310 - if (mdev->funcs->disconnect_iommu(mdev)) 311 - DRM_ERROR("disconnect iommu failed.\n"); 312 - mdev->iommu = NULL; 313 - 314 313 for (i = 0; i < mdev->n_pipelines; i++) { 315 314 komeda_pipeline_destroy(mdev, mdev->pipelines[i]); 316 315 mdev->pipelines[i] = NULL; ··· 334 343 335 344 int komeda_dev_resume(struct komeda_dev *mdev) 336 345 { 337 - int ret = 0; 338 - 339 346 clk_prepare_enable(mdev->aclk); 340 347 341 - if (mdev->iommu && mdev->funcs->connect_iommu) { 342 - ret = mdev->funcs->connect_iommu(mdev); 343 - if (ret < 0) { 348 + mdev->funcs->enable_irq(mdev); 349 + 350 + if (mdev->iommu && mdev->funcs->connect_iommu) 351 + if (mdev->funcs->connect_iommu(mdev)) 344 352 DRM_ERROR("connect iommu failed.\n"); 345 - goto disable_clk; 346 - } 347 - } 348 353 349 - ret = mdev->funcs->enable_irq(mdev); 350 - 351 - disable_clk: 352 - clk_disable_unprepare(mdev->aclk); 353 - 354 - return ret; 354 + return 0; 355 355 } 356 356 357 357 int komeda_dev_suspend(struct komeda_dev *mdev) 358 358 { 359 - int ret = 0; 360 - 361 - clk_prepare_enable(mdev->aclk); 362 - 363 - if (mdev->iommu && mdev->funcs->disconnect_iommu) { 364 - ret = mdev->funcs->disconnect_iommu(mdev); 365 - if (ret < 0) { 359 + if (mdev->iommu && mdev->funcs->disconnect_iommu) 360 + if (mdev->funcs->disconnect_iommu(mdev)) 366 361 DRM_ERROR("disconnect iommu failed.\n"); 367 - goto disable_clk; 368 - } 369 - } 370 362 371 - ret = mdev->funcs->disable_irq(mdev); 363 + mdev->funcs->disable_irq(mdev); 372 364 373 - disable_clk: 374 365 clk_disable_unprepare(mdev->aclk); 375 366 376 - return ret; 367 + return 0; 377 368 }
+4 -1
drivers/gpu/drm/arm/display/komeda/komeda_dev.h
··· 20 20 #define KOMEDA_EVENT_OVR BIT_ULL(4) 21 21 #define KOMEDA_EVENT_EOW BIT_ULL(5) 22 22 #define KOMEDA_EVENT_MODE BIT_ULL(6) 23 + #define KOMEDA_EVENT_FULL BIT_ULL(7) 24 + #define KOMEDA_EVENT_EMPTY BIT_ULL(8) 23 25 24 26 #define KOMEDA_ERR_TETO BIT_ULL(14) 25 27 #define KOMEDA_ERR_TEMR BIT_ULL(15) ··· 51 49 KOMEDA_ERR_ZME | KOMEDA_ERR_MERR | KOMEDA_ERR_TCF |\ 52 50 KOMEDA_ERR_TTNG | KOMEDA_ERR_TTF) 53 51 54 - #define KOMEDA_WARN_EVENTS KOMEDA_ERR_CSCE 52 + #define KOMEDA_WARN_EVENTS \ 53 + (KOMEDA_ERR_CSCE | KOMEDA_EVENT_FULL | KOMEDA_EVENT_EMPTY) 55 54 56 55 #define KOMEDA_INFO_EVENTS (0 \ 57 56 | KOMEDA_EVENT_VSYNC \
+36 -6
drivers/gpu/drm/arm/display/komeda/komeda_drv.c
··· 33 33 return; 34 34 35 35 komeda_kms_detach(mdrv->kms); 36 + 37 + if (pm_runtime_enabled(dev)) 38 + pm_runtime_disable(dev); 39 + else 40 + komeda_dev_suspend(mdrv->mdev); 41 + 36 42 komeda_dev_destroy(mdrv->mdev); 37 43 38 44 dev_set_drvdata(dev, NULL); ··· 60 54 goto free_mdrv; 61 55 } 62 56 57 + pm_runtime_enable(dev); 58 + if (!pm_runtime_enabled(dev)) 59 + komeda_dev_resume(mdrv->mdev); 60 + 63 61 mdrv->kms = komeda_kms_attach(mdrv->mdev); 64 62 if (IS_ERR(mdrv->kms)) { 65 63 err = PTR_ERR(mdrv->kms); ··· 75 65 return 0; 76 66 77 67 destroy_mdev: 68 + if (pm_runtime_enabled(dev)) 69 + pm_runtime_disable(dev); 70 + else 71 + komeda_dev_suspend(mdrv->mdev); 72 + 78 73 komeda_dev_destroy(mdrv->mdev); 79 74 80 75 free_mdrv: ··· 146 131 147 132 MODULE_DEVICE_TABLE(of, komeda_of_match); 148 133 134 + static int komeda_rt_pm_suspend(struct device *dev) 135 + { 136 + struct komeda_drv *mdrv = dev_get_drvdata(dev); 137 + 138 + return komeda_dev_suspend(mdrv->mdev); 139 + } 140 + 141 + static int komeda_rt_pm_resume(struct device *dev) 142 + { 143 + struct komeda_drv *mdrv = dev_get_drvdata(dev); 144 + 145 + return komeda_dev_resume(mdrv->mdev); 146 + } 147 + 149 148 static int __maybe_unused komeda_pm_suspend(struct device *dev) 150 149 { 151 150 struct komeda_drv *mdrv = dev_get_drvdata(dev); 152 - struct drm_device *drm = &mdrv->kms->base; 153 151 int res; 154 152 155 - res = drm_mode_config_helper_suspend(drm); 153 + res = drm_mode_config_helper_suspend(&mdrv->kms->base); 156 154 157 - komeda_dev_suspend(mdrv->mdev); 155 + if (!pm_runtime_status_suspended(dev)) 156 + komeda_dev_suspend(mdrv->mdev); 158 157 159 158 return res; 160 159 } ··· 176 147 static int __maybe_unused komeda_pm_resume(struct device *dev) 177 148 { 178 149 struct komeda_drv *mdrv = dev_get_drvdata(dev); 179 - struct drm_device *drm = &mdrv->kms->base; 180 150 181 - komeda_dev_resume(mdrv->mdev); 151 + if (!pm_runtime_status_suspended(dev)) 152 + komeda_dev_resume(mdrv->mdev); 182 153 183 - return drm_mode_config_helper_resume(drm); 154 + return drm_mode_config_helper_resume(&mdrv->kms->base); 184 155 } 185 156 186 157 static const struct dev_pm_ops komeda_pm_ops = { 187 158 SET_SYSTEM_SLEEP_PM_OPS(komeda_pm_suspend, komeda_pm_resume) 159 + SET_RUNTIME_PM_OPS(komeda_rt_pm_suspend, komeda_rt_pm_resume, NULL) 188 160 }; 189 161 190 162 static struct platform_driver komeda_platform_driver = {
+2
drivers/gpu/drm/arm/display/komeda/komeda_event.c
··· 78 78 79 79 /* LPU errors or events */ 80 80 evt_sprintf(str, events & KOMEDA_EVENT_IBSY, "IBSY|"); 81 + evt_sprintf(str, events & KOMEDA_EVENT_EMPTY, "EMPTY|"); 82 + evt_sprintf(str, events & KOMEDA_EVENT_FULL, "FULL|"); 81 83 evt_sprintf(str, events & KOMEDA_ERR_AXIE, "AXIE|"); 82 84 evt_sprintf(str, events & KOMEDA_ERR_ACE0, "ACE0|"); 83 85 evt_sprintf(str, events & KOMEDA_ERR_ACE1, "ACE1|");
-6
drivers/gpu/drm/arm/display/komeda/komeda_kms.c
··· 308 308 if (err) 309 309 goto free_component_binding; 310 310 311 - err = mdev->funcs->enable_irq(mdev); 312 - if (err) 313 - goto free_component_binding; 314 - 315 311 drm->irq_enabled = true; 316 312 317 313 drm_kms_helper_poll_init(drm); ··· 321 325 free_interrupts: 322 326 drm_kms_helper_poll_fini(drm); 323 327 drm->irq_enabled = false; 324 - mdev->funcs->disable_irq(mdev); 325 328 free_component_binding: 326 329 component_unbind_all(mdev->dev, drm); 327 330 cleanup_mode_config: ··· 342 347 drm_kms_helper_poll_fini(drm); 343 348 drm_atomic_helper_shutdown(drm); 344 349 drm->irq_enabled = false; 345 - mdev->funcs->disable_irq(mdev); 346 350 component_unbind_all(mdev->dev, drm); 347 351 drm_mode_config_cleanup(drm); 348 352 komeda_kms_cleanup_private_objs(kms);
+1 -1
drivers/gpu/drm/arm/malidp_planes.c
··· 512 512 int i, ret; 513 513 unsigned int block_w, block_h; 514 514 515 - if (!state->crtc || !state->fb) 515 + if (!state->crtc || WARN_ON(!state->fb)) 516 516 return 0; 517 517 518 518 fb = state->fb;
+1 -1
drivers/gpu/drm/bochs/bochs_hw.c
··· 255 255 DRM_ERROR("%s: Huh? Got framebuffer format 0x%x", 256 256 __func__, format->format); 257 257 break; 258 - }; 258 + } 259 259 } 260 260 261 261 void bochs_hw_setbase(struct bochs_device *bochs,
+4 -4
drivers/gpu/drm/bridge/Kconfig
··· 35 35 Support for non-programmable RGB to VGA DAC bridges, such as ADI 36 36 ADV7123, TI THS8134 and THS8135 or passive resistor ladder DACs. 37 37 38 - config DRM_LVDS_ENCODER 39 - tristate "Transparent parallel to LVDS encoder support" 38 + config DRM_LVDS_CODEC 39 + tristate "Transparent LVDS encoders and decoders support" 40 40 depends on OF 41 41 select DRM_KMS_HELPER 42 42 select DRM_PANEL_BRIDGE 43 43 help 44 - Support for transparent parallel to LVDS encoders that don't require 45 - any configuration. 44 + Support for transparent LVDS encoders and decoders that don't 45 + require any configuration. 46 46 47 47 config DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW 48 48 tristate "MegaChips stdp4028-ge-b850v3-fw and stdp2690-ge-b850v3-fw"
+1 -1
drivers/gpu/drm/bridge/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 2 obj-$(CONFIG_DRM_CDNS_DSI) += cdns-dsi.o 3 3 obj-$(CONFIG_DRM_DUMB_VGA_DAC) += dumb-vga-dac.o 4 - obj-$(CONFIG_DRM_LVDS_ENCODER) += lvds-encoder.o 4 + obj-$(CONFIG_DRM_LVDS_CODEC) += lvds-codec.o 5 5 obj-$(CONFIG_DRM_MEGACHIPS_STDPXXXX_GE_B850V3_FW) += megachips-stdpxxxx-ge-b850v3-fw.o 6 6 obj-$(CONFIG_DRM_NXP_PTN3460) += nxp-ptn3460.o 7 7 obj-$(CONFIG_DRM_PARADE_PS8622) += parade-ps8622.o
+151
drivers/gpu/drm/bridge/lvds-codec.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-or-later 2 + /* 3 + * Copyright (C) 2019 Renesas Electronics Corporation 4 + * Copyright (C) 2016 Laurent Pinchart <laurent.pinchart@ideasonboard.com> 5 + */ 6 + 7 + #include <linux/gpio/consumer.h> 8 + #include <linux/module.h> 9 + #include <linux/of.h> 10 + #include <linux/of_device.h> 11 + #include <linux/of_graph.h> 12 + #include <linux/platform_device.h> 13 + 14 + #include <drm/drm_bridge.h> 15 + #include <drm/drm_panel.h> 16 + 17 + struct lvds_codec { 18 + struct drm_bridge bridge; 19 + struct drm_bridge *panel_bridge; 20 + struct gpio_desc *powerdown_gpio; 21 + u32 connector_type; 22 + }; 23 + 24 + static int lvds_codec_attach(struct drm_bridge *bridge) 25 + { 26 + struct lvds_codec *lvds_codec = container_of(bridge, 27 + struct lvds_codec, bridge); 28 + 29 + return drm_bridge_attach(bridge->encoder, lvds_codec->panel_bridge, 30 + bridge); 31 + } 32 + 33 + static void lvds_codec_enable(struct drm_bridge *bridge) 34 + { 35 + struct lvds_codec *lvds_codec = container_of(bridge, 36 + struct lvds_codec, bridge); 37 + 38 + if (lvds_codec->powerdown_gpio) 39 + gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 0); 40 + } 41 + 42 + static void lvds_codec_disable(struct drm_bridge *bridge) 43 + { 44 + struct lvds_codec *lvds_codec = container_of(bridge, 45 + struct lvds_codec, bridge); 46 + 47 + if (lvds_codec->powerdown_gpio) 48 + gpiod_set_value_cansleep(lvds_codec->powerdown_gpio, 1); 49 + } 50 + 51 + static struct drm_bridge_funcs funcs = { 52 + .attach = lvds_codec_attach, 53 + .enable = lvds_codec_enable, 54 + .disable = lvds_codec_disable, 55 + }; 56 + 57 + static int lvds_codec_probe(struct platform_device *pdev) 58 + { 59 + struct device *dev = &pdev->dev; 60 + struct device_node *panel_node; 61 + struct drm_panel *panel; 62 + struct lvds_codec *lvds_codec; 63 + 64 + lvds_codec = devm_kzalloc(dev, sizeof(*lvds_codec), GFP_KERNEL); 65 + if (!lvds_codec) 66 + return -ENOMEM; 67 + 68 + lvds_codec->connector_type = (uintptr_t)of_device_get_match_data(dev); 69 + lvds_codec->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown", 70 + GPIOD_OUT_HIGH); 71 + if (IS_ERR(lvds_codec->powerdown_gpio)) { 72 + int err = PTR_ERR(lvds_codec->powerdown_gpio); 73 + 74 + if (err != -EPROBE_DEFER) 75 + dev_err(dev, "powerdown GPIO failure: %d\n", err); 76 + return err; 77 + } 78 + 79 + /* Locate the panel DT node. */ 80 + panel_node = of_graph_get_remote_node(dev->of_node, 1, 0); 81 + if (!panel_node) { 82 + dev_dbg(dev, "panel DT node not found\n"); 83 + return -ENXIO; 84 + } 85 + 86 + panel = of_drm_find_panel(panel_node); 87 + of_node_put(panel_node); 88 + if (IS_ERR(panel)) { 89 + dev_dbg(dev, "panel not found, deferring probe\n"); 90 + return PTR_ERR(panel); 91 + } 92 + 93 + lvds_codec->panel_bridge = 94 + devm_drm_panel_bridge_add_typed(dev, panel, 95 + lvds_codec->connector_type); 96 + if (IS_ERR(lvds_codec->panel_bridge)) 97 + return PTR_ERR(lvds_codec->panel_bridge); 98 + 99 + /* 100 + * The panel_bridge bridge is attached to the panel's of_node, 101 + * but we need a bridge attached to our of_node for our user 102 + * to look up. 103 + */ 104 + lvds_codec->bridge.of_node = dev->of_node; 105 + lvds_codec->bridge.funcs = &funcs; 106 + drm_bridge_add(&lvds_codec->bridge); 107 + 108 + platform_set_drvdata(pdev, lvds_codec); 109 + 110 + return 0; 111 + } 112 + 113 + static int lvds_codec_remove(struct platform_device *pdev) 114 + { 115 + struct lvds_codec *lvds_codec = platform_get_drvdata(pdev); 116 + 117 + drm_bridge_remove(&lvds_codec->bridge); 118 + 119 + return 0; 120 + } 121 + 122 + static const struct of_device_id lvds_codec_match[] = { 123 + { 124 + .compatible = "lvds-decoder", 125 + .data = (void *)DRM_MODE_CONNECTOR_DPI, 126 + }, 127 + { 128 + .compatible = "lvds-encoder", 129 + .data = (void *)DRM_MODE_CONNECTOR_LVDS, 130 + }, 131 + { 132 + .compatible = "thine,thc63lvdm83d", 133 + .data = (void *)DRM_MODE_CONNECTOR_LVDS, 134 + }, 135 + {}, 136 + }; 137 + MODULE_DEVICE_TABLE(of, lvds_codec_match); 138 + 139 + static struct platform_driver lvds_codec_driver = { 140 + .probe = lvds_codec_probe, 141 + .remove = lvds_codec_remove, 142 + .driver = { 143 + .name = "lvds-codec", 144 + .of_match_table = lvds_codec_match, 145 + }, 146 + }; 147 + module_platform_driver(lvds_codec_driver); 148 + 149 + MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>"); 150 + MODULE_DESCRIPTION("LVDS encoders and decoders"); 151 + MODULE_LICENSE("GPL");
-155
drivers/gpu/drm/bridge/lvds-encoder.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-or-later 2 - /* 3 - * Copyright (C) 2016 Laurent Pinchart <laurent.pinchart@ideasonboard.com> 4 - */ 5 - 6 - #include <linux/gpio/consumer.h> 7 - #include <linux/module.h> 8 - #include <linux/of.h> 9 - #include <linux/of_graph.h> 10 - #include <linux/platform_device.h> 11 - 12 - #include <drm/drm_bridge.h> 13 - #include <drm/drm_panel.h> 14 - 15 - struct lvds_encoder { 16 - struct drm_bridge bridge; 17 - struct drm_bridge *panel_bridge; 18 - struct gpio_desc *powerdown_gpio; 19 - }; 20 - 21 - static int lvds_encoder_attach(struct drm_bridge *bridge) 22 - { 23 - struct lvds_encoder *lvds_encoder = container_of(bridge, 24 - struct lvds_encoder, 25 - bridge); 26 - 27 - return drm_bridge_attach(bridge->encoder, lvds_encoder->panel_bridge, 28 - bridge); 29 - } 30 - 31 - static void lvds_encoder_enable(struct drm_bridge *bridge) 32 - { 33 - struct lvds_encoder *lvds_encoder = container_of(bridge, 34 - struct lvds_encoder, 35 - bridge); 36 - 37 - if (lvds_encoder->powerdown_gpio) 38 - gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 0); 39 - } 40 - 41 - static void lvds_encoder_disable(struct drm_bridge *bridge) 42 - { 43 - struct lvds_encoder *lvds_encoder = container_of(bridge, 44 - struct lvds_encoder, 45 - bridge); 46 - 47 - if (lvds_encoder->powerdown_gpio) 48 - gpiod_set_value_cansleep(lvds_encoder->powerdown_gpio, 1); 49 - } 50 - 51 - static struct drm_bridge_funcs funcs = { 52 - .attach = lvds_encoder_attach, 53 - .enable = lvds_encoder_enable, 54 - .disable = lvds_encoder_disable, 55 - }; 56 - 57 - static int lvds_encoder_probe(struct platform_device *pdev) 58 - { 59 - struct device *dev = &pdev->dev; 60 - struct device_node *port; 61 - struct device_node *endpoint; 62 - struct device_node *panel_node; 63 - struct drm_panel *panel; 64 - struct lvds_encoder *lvds_encoder; 65 - 66 - lvds_encoder = devm_kzalloc(dev, sizeof(*lvds_encoder), GFP_KERNEL); 67 - if (!lvds_encoder) 68 - return -ENOMEM; 69 - 70 - lvds_encoder->powerdown_gpio = devm_gpiod_get_optional(dev, "powerdown", 71 - GPIOD_OUT_HIGH); 72 - if (IS_ERR(lvds_encoder->powerdown_gpio)) { 73 - int err = PTR_ERR(lvds_encoder->powerdown_gpio); 74 - 75 - if (err != -EPROBE_DEFER) 76 - dev_err(dev, "powerdown GPIO failure: %d\n", err); 77 - return err; 78 - } 79 - 80 - /* Locate the panel DT node. */ 81 - port = of_graph_get_port_by_id(dev->of_node, 1); 82 - if (!port) { 83 - dev_dbg(dev, "port 1 not found\n"); 84 - return -ENXIO; 85 - } 86 - 87 - endpoint = of_get_child_by_name(port, "endpoint"); 88 - of_node_put(port); 89 - if (!endpoint) { 90 - dev_dbg(dev, "no endpoint for port 1\n"); 91 - return -ENXIO; 92 - } 93 - 94 - panel_node = of_graph_get_remote_port_parent(endpoint); 95 - of_node_put(endpoint); 96 - if (!panel_node) { 97 - dev_dbg(dev, "no remote endpoint for port 1\n"); 98 - return -ENXIO; 99 - } 100 - 101 - panel = of_drm_find_panel(panel_node); 102 - of_node_put(panel_node); 103 - if (IS_ERR(panel)) { 104 - dev_dbg(dev, "panel not found, deferring probe\n"); 105 - return PTR_ERR(panel); 106 - } 107 - 108 - lvds_encoder->panel_bridge = 109 - devm_drm_panel_bridge_add_typed(dev, panel, 110 - DRM_MODE_CONNECTOR_LVDS); 111 - if (IS_ERR(lvds_encoder->panel_bridge)) 112 - return PTR_ERR(lvds_encoder->panel_bridge); 113 - 114 - /* The panel_bridge bridge is attached to the panel's of_node, 115 - * but we need a bridge attached to our of_node for our user 116 - * to look up. 117 - */ 118 - lvds_encoder->bridge.of_node = dev->of_node; 119 - lvds_encoder->bridge.funcs = &funcs; 120 - drm_bridge_add(&lvds_encoder->bridge); 121 - 122 - platform_set_drvdata(pdev, lvds_encoder); 123 - 124 - return 0; 125 - } 126 - 127 - static int lvds_encoder_remove(struct platform_device *pdev) 128 - { 129 - struct lvds_encoder *lvds_encoder = platform_get_drvdata(pdev); 130 - 131 - drm_bridge_remove(&lvds_encoder->bridge); 132 - 133 - return 0; 134 - } 135 - 136 - static const struct of_device_id lvds_encoder_match[] = { 137 - { .compatible = "lvds-encoder" }, 138 - { .compatible = "thine,thc63lvdm83d" }, 139 - {}, 140 - }; 141 - MODULE_DEVICE_TABLE(of, lvds_encoder_match); 142 - 143 - static struct platform_driver lvds_encoder_driver = { 144 - .probe = lvds_encoder_probe, 145 - .remove = lvds_encoder_remove, 146 - .driver = { 147 - .name = "lvds-encoder", 148 - .of_match_table = lvds_encoder_match, 149 - }, 150 - }; 151 - module_platform_driver(lvds_encoder_driver); 152 - 153 - MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>"); 154 - MODULE_DESCRIPTION("Transparent parallel to LVDS encoder"); 155 - MODULE_LICENSE("GPL");
+26 -14
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
··· 719 719 720 720 static void dw_mipi_dsi_dphy_timing_config(struct dw_mipi_dsi *dsi) 721 721 { 722 + const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; 723 + struct dw_mipi_dsi_dphy_timing timing; 722 724 u32 hw_version; 725 + int ret; 726 + 727 + ret = phy_ops->get_timing(dsi->plat_data->priv_data, 728 + dsi->lane_mbps, &timing); 729 + if (ret) 730 + DRM_DEV_ERROR(dsi->dev, "Retrieving phy timings failed\n"); 723 731 724 732 /* 725 733 * TODO dw drv improvements ··· 740 732 hw_version = dsi_read(dsi, DSI_VERSION) & VERSION; 741 733 742 734 if (hw_version >= HWVER_131) { 743 - dsi_write(dsi, DSI_PHY_TMR_CFG, PHY_HS2LP_TIME_V131(0x40) | 744 - PHY_LP2HS_TIME_V131(0x40)); 735 + dsi_write(dsi, DSI_PHY_TMR_CFG, 736 + PHY_HS2LP_TIME_V131(timing.data_hs2lp) | 737 + PHY_LP2HS_TIME_V131(timing.data_lp2hs)); 745 738 dsi_write(dsi, DSI_PHY_TMR_RD_CFG, MAX_RD_TIME_V131(10000)); 746 739 } else { 747 - dsi_write(dsi, DSI_PHY_TMR_CFG, PHY_HS2LP_TIME(0x40) | 748 - PHY_LP2HS_TIME(0x40) | MAX_RD_TIME(10000)); 740 + dsi_write(dsi, DSI_PHY_TMR_CFG, 741 + PHY_HS2LP_TIME(timing.data_hs2lp) | 742 + PHY_LP2HS_TIME(timing.data_lp2hs) | 743 + MAX_RD_TIME(10000)); 749 744 } 750 745 751 - dsi_write(dsi, DSI_PHY_TMR_LPCLK_CFG, PHY_CLKHS2LP_TIME(0x40) 752 - | PHY_CLKLP2HS_TIME(0x40)); 746 + dsi_write(dsi, DSI_PHY_TMR_LPCLK_CFG, 747 + PHY_CLKHS2LP_TIME(timing.clk_hs2lp) | 748 + PHY_CLKLP2HS_TIME(timing.clk_lp2hs)); 753 749 } 754 750 755 751 static void dw_mipi_dsi_dphy_interface_config(struct dw_mipi_dsi *dsi) ··· 810 798 struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); 811 799 const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; 812 800 813 - if (phy_ops->power_off) 814 - phy_ops->power_off(dsi->plat_data->priv_data); 815 - 816 801 /* 817 802 * Switch to command mode before panel-bridge post_disable & 818 803 * panel unprepare. ··· 825 816 * needs to be updated to manage our own call chains... 826 817 */ 827 818 dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge); 819 + 820 + if (phy_ops->power_off) 821 + phy_ops->power_off(dsi->plat_data->priv_data); 828 822 829 823 if (dsi->slave) { 830 824 dw_mipi_dsi_disable(dsi->slave); ··· 895 883 896 884 /* Switch to cmd mode for panel-bridge pre_enable & panel prepare */ 897 885 dw_mipi_dsi_set_mode(dsi, 0); 886 + 887 + if (phy_ops->power_on) 888 + phy_ops->power_on(dsi->plat_data->priv_data); 898 889 } 899 890 900 891 static void dw_mipi_dsi_bridge_mode_set(struct drm_bridge *bridge, ··· 914 899 static void dw_mipi_dsi_bridge_enable(struct drm_bridge *bridge) 915 900 { 916 901 struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge); 917 - const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops; 918 902 919 903 /* Switch to video mode for panel-bridge enable & panel enable */ 920 904 dw_mipi_dsi_set_mode(dsi, MIPI_DSI_MODE_VIDEO); 921 905 if (dsi->slave) 922 906 dw_mipi_dsi_set_mode(dsi->slave, MIPI_DSI_MODE_VIDEO); 923 - 924 - if (phy_ops->power_on) 925 - phy_ops->power_on(dsi->plat_data->priv_data); 926 907 } 927 908 928 909 static enum drm_mode_status ··· 1002 991 dsi->dev = dev; 1003 992 dsi->plat_data = plat_data; 1004 993 1005 - if (!plat_data->phy_ops->init || !plat_data->phy_ops->get_lane_mbps) { 994 + if (!plat_data->phy_ops->init || !plat_data->phy_ops->get_lane_mbps || 995 + !plat_data->phy_ops->get_timing) { 1006 996 DRM_ERROR("Phy not properly configured\n"); 1007 997 return ERR_PTR(-ENODEV); 1008 998 }
+10 -10
drivers/gpu/drm/drm_atomic.c
··· 251 251 * @ref: This atomic state to deallocate 252 252 * 253 253 * This frees all memory associated with an atomic state, including all the 254 - * per-object state for planes, crtcs and connectors. 254 + * per-object state for planes, CRTCs and connectors. 255 255 */ 256 256 void __drm_atomic_state_free(struct kref *ref) 257 257 { ··· 272 272 EXPORT_SYMBOL(__drm_atomic_state_free); 273 273 274 274 /** 275 - * drm_atomic_get_crtc_state - get crtc state 275 + * drm_atomic_get_crtc_state - get CRTC state 276 276 * @state: global atomic state object 277 - * @crtc: crtc to get state object for 277 + * @crtc: CRTC to get state object for 278 278 * 279 - * This function returns the crtc state for the given crtc, allocating it if 280 - * needed. It will also grab the relevant crtc lock to make sure that the state 279 + * This function returns the CRTC state for the given CRTC, allocating it if 280 + * needed. It will also grab the relevant CRTC lock to make sure that the state 281 281 * is consistent. 282 282 * 283 283 * Returns: ··· 1018 1018 } 1019 1019 1020 1020 /** 1021 - * drm_atomic_add_affected_connectors - add connectors for crtc 1021 + * drm_atomic_add_affected_connectors - add connectors for CRTC 1022 1022 * @state: atomic state 1023 - * @crtc: DRM crtc 1023 + * @crtc: DRM CRTC 1024 1024 * 1025 1025 * This function walks the current configuration and adds all connectors 1026 1026 * currently using @crtc to the atomic configuration @state. Note that this 1027 1027 * function must acquire the connection mutex. This can potentially cause 1028 - * unneeded seralization if the update is just for the planes on one crtc. Hence 1028 + * unneeded seralization if the update is just for the planes on one CRTC. Hence 1029 1029 * drivers and helpers should only call this when really needed (e.g. when a 1030 1030 * full modeset needs to happen due to some change). 1031 1031 * ··· 1078 1078 EXPORT_SYMBOL(drm_atomic_add_affected_connectors); 1079 1079 1080 1080 /** 1081 - * drm_atomic_add_affected_planes - add planes for crtc 1081 + * drm_atomic_add_affected_planes - add planes for CRTC 1082 1082 * @state: atomic state 1083 - * @crtc: DRM crtc 1083 + * @crtc: DRM CRTC 1084 1084 * 1085 1085 * This function walks the current configuration and adds all planes 1086 1086 * currently used by @crtc to the atomic configuration @state. This is useful
+38 -38
drivers/gpu/drm/drm_atomic_helper.c
··· 150 150 * is not set, an error is returned. Userspace can provide a solution 151 151 * through the atomic ioctl. 152 152 * 153 - * If the flag is set conflicting connectors are removed from the crtc 154 - * and the crtc is disabled if no encoder is left. This preserves 153 + * If the flag is set conflicting connectors are removed from the CRTC 154 + * and the CRTC is disabled if no encoder is left. This preserves 155 155 * compatibility with the legacy set_config behavior. 156 156 */ 157 157 drm_connector_list_iter_begin(state->dev, &conn_iter); ··· 220 220 crtc = conn_state->connector->state->crtc; 221 221 222 222 /* A NULL crtc is an error here because we should have 223 - * duplicated a NULL best_encoder when crtc was NULL. 223 + * duplicated a NULL best_encoder when crtc was NULL. 224 224 * As an exception restoring duplicated atomic state 225 225 * during resume is allowed, so don't warn when 226 226 * best_encoder is equal to encoder we intend to set. ··· 561 561 * @state: the driver state object 562 562 * 563 563 * Check the state object to see if the requested state is physically possible. 564 - * This does all the crtc and connector related computations for an atomic 564 + * This does all the CRTC and connector related computations for an atomic 565 565 * update and adds any additional connectors needed for full modesets. It calls 566 566 * the various per-object callbacks in the follow order: 567 567 * 568 568 * 1. &drm_connector_helper_funcs.atomic_best_encoder for determining the new encoder. 569 569 * 2. &drm_connector_helper_funcs.atomic_check to validate the connector state. 570 - * 3. If it's determined a modeset is needed then all connectors on the affected crtc 571 - * crtc are added and &drm_connector_helper_funcs.atomic_check is run on them. 570 + * 3. If it's determined a modeset is needed then all connectors on the affected 571 + * CRTC are added and &drm_connector_helper_funcs.atomic_check is run on them. 572 572 * 4. &drm_encoder_helper_funcs.mode_valid, &drm_bridge_funcs.mode_valid and 573 573 * &drm_crtc_helper_funcs.mode_valid are called on the affected components. 574 574 * 5. &drm_bridge_funcs.mode_fixup is called on all encoder bridges. 575 575 * 6. &drm_encoder_helper_funcs.atomic_check is called to validate any encoder state. 576 - * This function is only called when the encoder will be part of a configured crtc, 576 + * This function is only called when the encoder will be part of a configured CRTC, 577 577 * it must not be used for implementing connector property validation. 578 578 * If this function is NULL, &drm_atomic_encoder_helper_funcs.mode_fixup is called 579 579 * instead. 580 - * 7. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with crtc constraints. 580 + * 7. &drm_crtc_helper_funcs.mode_fixup is called last, to fix up the mode with CRTC constraints. 581 581 * 582 582 * &drm_crtc_state.mode_changed is set when the input mode is changed. 583 583 * &drm_crtc_state.connectors_changed is set when a connector is added or 584 - * removed from the crtc. &drm_crtc_state.active_changed is set when 584 + * removed from the CRTC. &drm_crtc_state.active_changed is set when 585 585 * &drm_crtc_state.active changes, which is used for DPMS. 586 586 * See also: drm_atomic_crtc_needs_modeset() 587 587 * ··· 692 692 693 693 /* 694 694 * After all the routing has been prepared we need to add in any 695 - * connector which is itself unchanged, but whose crtc changes its 695 + * connector which is itself unchanged, but whose CRTC changes its 696 696 * configuration. This must be done before calling mode_fixup in case a 697 697 * crtc only changed its mode but has the same set of connectors. 698 698 */ ··· 741 741 /** 742 742 * drm_atomic_helper_check_plane_state() - Check plane state for validity 743 743 * @plane_state: plane state to check 744 - * @crtc_state: crtc state to check 744 + * @crtc_state: CRTC state to check 745 745 * @min_scale: minimum @src:@dest scaling factor in 16.16 fixed point 746 746 * @max_scale: maximum @src:@dest scaling factor in 16.16 fixed point 747 747 * @can_position: is it legal to position the plane such that it 748 - * doesn't cover the entire crtc? This will generally 748 + * doesn't cover the entire CRTC? This will generally 749 749 * only be false for primary planes. 750 - * @can_update_disabled: can the plane be updated while the crtc 750 + * @can_update_disabled: can the plane be updated while the CRTC 751 751 * is disabled? 752 752 * 753 753 * Checks that a desired plane update is valid, and updates various ··· 844 844 * &drm_crtc_helper_funcs.atomic_check and &drm_plane_helper_funcs.atomic_check 845 845 * hooks provided by the driver. 846 846 * 847 - * It also sets &drm_crtc_state.planes_changed to indicate that a crtc has 847 + * It also sets &drm_crtc_state.planes_changed to indicate that a CRTC has 848 848 * updated planes. 849 849 * 850 850 * RETURNS: ··· 908 908 * @state: the driver state object 909 909 * 910 910 * Check the state object to see if the requested state is physically possible. 911 - * Only crtcs and planes have check callbacks, so for any additional (global) 911 + * Only CRTCs and planes have check callbacks, so for any additional (global) 912 912 * checking that a driver needs it can simply wrap that around this function. 913 913 * Drivers without such needs can directly use this as their 914 914 * &drm_mode_config_funcs.atomic_check callback. ··· 961 961 struct drm_crtc_state *new_state) 962 962 { 963 963 /* 964 - * No new_state means the crtc is off, so the only criteria is whether 964 + * No new_state means the CRTC is off, so the only criteria is whether 965 965 * it's currently active or in self refresh mode. 966 966 */ 967 967 if (!new_state) 968 968 return drm_atomic_crtc_effectively_active(old_state); 969 969 970 970 /* 971 - * We need to run through the crtc_funcs->disable() function if the crtc 971 + * We need to run through the crtc_funcs->disable() function if the CRTC 972 972 * is currently on, if it's transitioning to self refresh mode, or if 973 973 * it's in self refresh mode and needs to be fully disabled. 974 974 */ ··· 1087 1087 * @old_state: atomic state object with old state structures 1088 1088 * 1089 1089 * This function updates all the various legacy modeset state pointers in 1090 - * connectors, encoders and crtcs. It also updates the timestamping constants 1090 + * connectors, encoders and CRTCs. It also updates the timestamping constants 1091 1091 * used for precise vblank timestamps by calling 1092 1092 * drm_calc_timestamping_constants(). 1093 1093 * ··· 1236 1236 * This function shuts down all the outputs that need to be shut down and 1237 1237 * prepares them (if required) with the new mode. 1238 1238 * 1239 - * For compatibility with legacy crtc helpers this should be called before 1239 + * For compatibility with legacy CRTC helpers this should be called before 1240 1240 * drm_atomic_helper_commit_planes(), which is what the default commit function 1241 1241 * does. But drivers with different needs can group the modeset commits together 1242 1242 * and do the plane commits at the end. This is useful for drivers doing runtime ··· 1282 1282 * This function enables all the outputs with the new configuration which had to 1283 1283 * be turned off for the update. 1284 1284 * 1285 - * For compatibility with legacy crtc helpers this should be called after 1285 + * For compatibility with legacy CRTC helpers this should be called after 1286 1286 * drm_atomic_helper_commit_planes(), which is what the default commit function 1287 1287 * does. But drivers with different needs can group the modeset commits together 1288 1288 * and do the plane commits at the end. This is useful for drivers doing runtime ··· 1414 1414 EXPORT_SYMBOL(drm_atomic_helper_wait_for_fences); 1415 1415 1416 1416 /** 1417 - * drm_atomic_helper_wait_for_vblanks - wait for vblank on crtcs 1417 + * drm_atomic_helper_wait_for_vblanks - wait for vblank on CRTCs 1418 1418 * @dev: DRM device 1419 1419 * @old_state: atomic state object with old state structures 1420 1420 * 1421 - * Helper to, after atomic commit, wait for vblanks on all effected 1422 - * crtcs (ie. before cleaning up old framebuffers using 1421 + * Helper to, after atomic commit, wait for vblanks on all affected 1422 + * CRTCs (ie. before cleaning up old framebuffers using 1423 1423 * drm_atomic_helper_cleanup_planes()). It will only wait on CRTCs where the 1424 1424 * framebuffers have actually changed to optimize for the legacy cursor and 1425 1425 * plane update use-case. ··· 1478 1478 * @dev: DRM device 1479 1479 * @old_state: atomic state object with old state structures 1480 1480 * 1481 - * Helper to, after atomic commit, wait for page flips on all effected 1481 + * Helper to, after atomic commit, wait for page flips on all affected 1482 1482 * crtcs (ie. before cleaning up old framebuffers using 1483 1483 * drm_atomic_helper_cleanup_planes()). Compared to 1484 - * drm_atomic_helper_wait_for_vblanks() this waits for the completion of on all 1484 + * drm_atomic_helper_wait_for_vblanks() this waits for the completion on all 1485 1485 * CRTCs, assuming that cursors-only updates are signalling their completion 1486 1486 * immediately (or using a different path). 1487 1487 * ··· 2208 2208 * drm_atomic_helper_fake_vblank - fake VBLANK events if needed 2209 2209 * @old_state: atomic state object with old state structures 2210 2210 * 2211 - * This function walks all CRTCs and fake VBLANK events on those with 2211 + * This function walks all CRTCs and fakes VBLANK events on those with 2212 2212 * &drm_crtc_state.no_vblank set to true and &drm_crtc_state.event != NULL. 2213 2213 * The primary use of this function is writeback connectors working in oneshot 2214 2214 * mode and faking VBLANK events. In this case they only fake the VBLANK event ··· 2404 2404 * @flags: flags for committing plane state 2405 2405 * 2406 2406 * This function commits the new plane state using the plane and atomic helper 2407 - * functions for planes and crtcs. It assumes that the atomic state has already 2407 + * functions for planes and CRTCs. It assumes that the atomic state has already 2408 2408 * been pushed into the relevant object state pointers, since this step can no 2409 2409 * longer fail. 2410 2410 * ··· 2525 2525 EXPORT_SYMBOL(drm_atomic_helper_commit_planes); 2526 2526 2527 2527 /** 2528 - * drm_atomic_helper_commit_planes_on_crtc - commit plane state for a crtc 2529 - * @old_crtc_state: atomic state object with the old crtc state 2528 + * drm_atomic_helper_commit_planes_on_crtc - commit plane state for a CRTC 2529 + * @old_crtc_state: atomic state object with the old CRTC state 2530 2530 * 2531 2531 * This function commits the new plane state using the plane and atomic helper 2532 - * functions for planes on the specific crtc. It assumes that the atomic state 2532 + * functions for planes on the specific CRTC. It assumes that the atomic state 2533 2533 * has already been pushed into the relevant object state pointers, since this 2534 2534 * step can no longer fail. 2535 2535 * 2536 - * This function is useful when plane updates should be done crtc-by-crtc 2536 + * This function is useful when plane updates should be done CRTC-by-CRTC 2537 2537 * instead of one global step like drm_atomic_helper_commit_planes() does. 2538 2538 * 2539 2539 * This function can only be savely used when planes are not allowed to move ··· 2823 2823 * @plane: plane object to update 2824 2824 * @crtc: owning CRTC of owning plane 2825 2825 * @fb: framebuffer to flip onto plane 2826 - * @crtc_x: x offset of primary plane on crtc 2827 - * @crtc_y: y offset of primary plane on crtc 2828 - * @crtc_w: width of primary plane rectangle on crtc 2829 - * @crtc_h: height of primary plane rectangle on crtc 2826 + * @crtc_x: x offset of primary plane on @crtc 2827 + * @crtc_y: y offset of primary plane on @crtc 2828 + * @crtc_w: width of primary plane rectangle on @crtc 2829 + * @crtc_h: height of primary plane rectangle on @crtc 2830 2830 * @src_x: x offset of @fb for panning 2831 2831 * @src_y: y offset of @fb for panning 2832 2832 * @src_w: width of source rectangle in @fb ··· 2932 2932 * @set: mode set configuration 2933 2933 * @ctx: lock acquisition context 2934 2934 * 2935 - * Provides a default crtc set_config handler using the atomic driver interface. 2935 + * Provides a default CRTC set_config handler using the atomic driver interface. 2936 2936 * 2937 2937 * NOTE: For backwards compatibility with old userspace this automatically 2938 2938 * resets the "link-status" property to GOOD, to force any link ··· 3345 3345 3346 3346 /** 3347 3347 * drm_atomic_helper_page_flip - execute a legacy page flip 3348 - * @crtc: DRM crtc 3348 + * @crtc: DRM CRTC 3349 3349 * @fb: DRM framebuffer 3350 3350 * @event: optional DRM event to signal upon completion 3351 3351 * @flags: flip flags for non-vblank sync'ed updates ··· 3389 3389 3390 3390 /** 3391 3391 * drm_atomic_helper_page_flip_target - do page flip on target vblank period. 3392 - * @crtc: DRM crtc 3392 + * @crtc: DRM CRTC 3393 3393 * @fb: DRM framebuffer 3394 3394 * @event: optional DRM event to signal upon completion 3395 3395 * @flags: flip flags for non-vblank sync'ed updates
+8 -8
drivers/gpu/drm/drm_atomic_uapi.c
··· 160 160 EXPORT_SYMBOL(drm_atomic_set_mode_prop_for_crtc); 161 161 162 162 /** 163 - * drm_atomic_set_crtc_for_plane - set crtc for plane 163 + * drm_atomic_set_crtc_for_plane - set CRTC for plane 164 164 * @plane_state: the plane whose incoming state to update 165 - * @crtc: crtc to use for the plane 165 + * @crtc: CRTC to use for the plane 166 166 * 167 - * Changing the assigned crtc for a plane requires us to grab the lock and state 168 - * for the new crtc, as needed. This function takes care of all these details 167 + * Changing the assigned CRTC for a plane requires us to grab the lock and state 168 + * for the new CRTC, as needed. This function takes care of all these details 169 169 * besides updating the pointer in the state object itself. 170 170 * 171 171 * Returns: ··· 279 279 EXPORT_SYMBOL(drm_atomic_set_fence_for_plane); 280 280 281 281 /** 282 - * drm_atomic_set_crtc_for_connector - set crtc for connector 282 + * drm_atomic_set_crtc_for_connector - set CRTC for connector 283 283 * @conn_state: atomic state object for the connector 284 - * @crtc: crtc to use for the connector 284 + * @crtc: CRTC to use for the connector 285 285 * 286 - * Changing the assigned crtc for a connector requires us to grab the lock and 287 - * state for the new crtc, as needed. This function takes care of all these 286 + * Changing the assigned CRTC for a connector requires us to grab the lock and 287 + * state for the new CRTC, as needed. This function takes care of all these 288 288 * details besides updating the pointer in the state object itself. 289 289 * 290 290 * Returns:
+5 -5
drivers/gpu/drm/drm_client.c
··· 150 150 { 151 151 struct drm_device *dev = client->dev; 152 152 153 - DRM_DEV_DEBUG_KMS(dev->dev, "%s\n", client->name); 153 + drm_dbg_kms(dev, "%s\n", client->name); 154 154 155 155 drm_client_modeset_free(client); 156 156 drm_client_close(client); ··· 203 203 continue; 204 204 205 205 ret = client->funcs->hotplug(client); 206 - DRM_DEV_DEBUG_KMS(dev->dev, "%s: ret=%d\n", client->name, ret); 206 + drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); 207 207 } 208 208 mutex_unlock(&dev->clientlist_mutex); 209 209 } ··· 223 223 continue; 224 224 225 225 ret = client->funcs->restore(client); 226 - DRM_DEV_DEBUG_KMS(dev->dev, "%s: ret=%d\n", client->name, ret); 226 + drm_dbg_kms(dev, "%s: ret=%d\n", client->name, ret); 227 227 if (!ret) /* The first one to return zero gets the privilege to restore */ 228 228 break; 229 229 } ··· 351 351 352 352 ret = drm_mode_rmfb(buffer->client->dev, buffer->fb->base.id, buffer->client->file); 353 353 if (ret) 354 - DRM_DEV_ERROR(buffer->client->dev->dev, 355 - "Error removing FB:%u (%d)\n", buffer->fb->base.id, ret); 354 + drm_err(buffer->client->dev, 355 + "Error removing FB:%u (%d)\n", buffer->fb->base.id, ret); 356 356 357 357 buffer->fb = NULL; 358 358 }
+3 -2
drivers/gpu/drm/drm_drv.c
··· 622 622 return -ENODEV; 623 623 } 624 624 625 - BUG_ON(!parent); 625 + if (WARN_ON(!parent)) 626 + return -EINVAL; 626 627 627 628 kref_init(&dev->ref); 628 629 dev->dev = get_device(parent); ··· 726 725 { 727 726 int ret; 728 727 729 - if (WARN_ON(!parent || !driver->release)) 728 + if (WARN_ON(!driver->release)) 730 729 return -EINVAL; 731 730 732 731 ret = drm_dev_init(dev, driver, parent);
+194 -25
drivers/gpu/drm/drm_edid.c
··· 710 710 }; 711 711 712 712 /* 713 - * Probably taken from CEA-861 spec. 714 - * This table is converted from xorg's hw/xfree86/modes/xf86EdidModes.c. 713 + * From CEA/CTA-861 spec. 715 714 * 716 - * Index using the VIC. 715 + * Do not access directly, instead always use cea_mode_for_vic(). 717 716 */ 718 - static const struct drm_display_mode edid_cea_modes[] = { 719 - /* 0 - dummy, VICs start at 1 */ 720 - { }, 717 + static const struct drm_display_mode edid_cea_modes_1[] = { 721 718 /* 1 - 640x480@60Hz 4:3 */ 722 719 { DRM_MODE("640x480", DRM_MODE_TYPE_DRIVER, 25175, 640, 656, 723 720 752, 800, 0, 480, 490, 492, 525, 0, ··· 1375 1378 6304, 6600, 0, 2160, 2168, 2178, 2250, 0, 1376 1379 DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1377 1380 .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1381 + }; 1382 + 1383 + /* 1384 + * From CEA/CTA-861 spec. 1385 + * 1386 + * Do not access directly, instead always use cea_mode_for_vic(). 1387 + */ 1388 + static const struct drm_display_mode edid_cea_modes_193[] = { 1389 + /* 193 - 5120x2160@120Hz 64:27 */ 1390 + { DRM_MODE("5120x2160", DRM_MODE_TYPE_DRIVER, 1485000, 5120, 5284, 1391 + 5372, 5500, 0, 2160, 2168, 2178, 2250, 0, 1392 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1393 + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1394 + /* 194 - 7680x4320@24Hz 16:9 */ 1395 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10232, 1396 + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, 1397 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1398 + .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1399 + /* 195 - 7680x4320@25Hz 16:9 */ 1400 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10032, 1401 + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, 1402 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1403 + .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1404 + /* 196 - 7680x4320@30Hz 16:9 */ 1405 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 8232, 1406 + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, 1407 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1408 + .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1409 + /* 197 - 7680x4320@48Hz 16:9 */ 1410 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10232, 1411 + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, 1412 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1413 + .vrefresh = 48, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1414 + /* 198 - 7680x4320@50Hz 16:9 */ 1415 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10032, 1416 + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, 1417 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1418 + .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1419 + /* 199 - 7680x4320@60Hz 16:9 */ 1420 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 8232, 1421 + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, 1422 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1423 + .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1424 + /* 200 - 7680x4320@100Hz 16:9 */ 1425 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 9792, 1426 + 9968, 10560, 0, 4320, 4336, 4356, 4500, 0, 1427 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1428 + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1429 + /* 201 - 7680x4320@120Hz 16:9 */ 1430 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 8032, 1431 + 8208, 8800, 0, 4320, 4336, 4356, 4500, 0, 1432 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1433 + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_16_9, }, 1434 + /* 202 - 7680x4320@24Hz 64:27 */ 1435 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10232, 1436 + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, 1437 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1438 + .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1439 + /* 203 - 7680x4320@25Hz 64:27 */ 1440 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 10032, 1441 + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, 1442 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1443 + .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1444 + /* 204 - 7680x4320@30Hz 64:27 */ 1445 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 1188000, 7680, 8232, 1446 + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, 1447 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1448 + .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1449 + /* 205 - 7680x4320@48Hz 64:27 */ 1450 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10232, 1451 + 10408, 11000, 0, 4320, 4336, 4356, 4500, 0, 1452 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1453 + .vrefresh = 48, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1454 + /* 206 - 7680x4320@50Hz 64:27 */ 1455 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 10032, 1456 + 10208, 10800, 0, 4320, 4336, 4356, 4400, 0, 1457 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1458 + .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1459 + /* 207 - 7680x4320@60Hz 64:27 */ 1460 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 2376000, 7680, 8232, 1461 + 8408, 9000, 0, 4320, 4336, 4356, 4400, 0, 1462 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1463 + .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1464 + /* 208 - 7680x4320@100Hz 64:27 */ 1465 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 9792, 1466 + 9968, 10560, 0, 4320, 4336, 4356, 4500, 0, 1467 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1468 + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1469 + /* 209 - 7680x4320@120Hz 64:27 */ 1470 + { DRM_MODE("7680x4320", DRM_MODE_TYPE_DRIVER, 4752000, 7680, 8032, 1471 + 8208, 8800, 0, 4320, 4336, 4356, 4500, 0, 1472 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1473 + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1474 + /* 210 - 10240x4320@24Hz 64:27 */ 1475 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 1485000, 10240, 11732, 1476 + 11908, 12500, 0, 4320, 4336, 4356, 4950, 0, 1477 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1478 + .vrefresh = 24, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1479 + /* 211 - 10240x4320@25Hz 64:27 */ 1480 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 1485000, 10240, 12732, 1481 + 12908, 13500, 0, 4320, 4336, 4356, 4400, 0, 1482 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1483 + .vrefresh = 25, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1484 + /* 212 - 10240x4320@30Hz 64:27 */ 1485 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 1485000, 10240, 10528, 1486 + 10704, 11000, 0, 4320, 4336, 4356, 4500, 0, 1487 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1488 + .vrefresh = 30, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1489 + /* 213 - 10240x4320@48Hz 64:27 */ 1490 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 2970000, 10240, 11732, 1491 + 11908, 12500, 0, 4320, 4336, 4356, 4950, 0, 1492 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1493 + .vrefresh = 48, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1494 + /* 214 - 10240x4320@50Hz 64:27 */ 1495 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 2970000, 10240, 12732, 1496 + 12908, 13500, 0, 4320, 4336, 4356, 4400, 0, 1497 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1498 + .vrefresh = 50, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1499 + /* 215 - 10240x4320@60Hz 64:27 */ 1500 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 2970000, 10240, 10528, 1501 + 10704, 11000, 0, 4320, 4336, 4356, 4500, 0, 1502 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1503 + .vrefresh = 60, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1504 + /* 216 - 10240x4320@100Hz 64:27 */ 1505 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 5940000, 10240, 12432, 1506 + 12608, 13200, 0, 4320, 4336, 4356, 4500, 0, 1507 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1508 + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1509 + /* 217 - 10240x4320@120Hz 64:27 */ 1510 + { DRM_MODE("10240x4320", DRM_MODE_TYPE_DRIVER, 5940000, 10240, 10528, 1511 + 10704, 11000, 0, 4320, 4336, 4356, 4500, 0, 1512 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1513 + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_64_27, }, 1514 + /* 218 - 4096x2160@100Hz 256:135 */ 1515 + { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 1188000, 4096, 4896, 1516 + 4984, 5280, 0, 2160, 2168, 2178, 2250, 0, 1517 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1518 + .vrefresh = 100, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135, }, 1519 + /* 219 - 4096x2160@120Hz 256:135 */ 1520 + { DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 1188000, 4096, 4184, 1521 + 4272, 4400, 0, 2160, 2168, 2178, 2250, 0, 1522 + DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC), 1523 + .vrefresh = 120, .picture_aspect_ratio = HDMI_PICTURE_ASPECT_256_135, }, 1378 1524 }; 1379 1525 1380 1526 /* ··· 3211 3071 return cea; 3212 3072 } 3213 3073 3074 + static const struct drm_display_mode *cea_mode_for_vic(u8 vic) 3075 + { 3076 + BUILD_BUG_ON(1 + ARRAY_SIZE(edid_cea_modes_1) - 1 != 127); 3077 + BUILD_BUG_ON(193 + ARRAY_SIZE(edid_cea_modes_193) - 1 != 219); 3078 + 3079 + if (vic >= 1 && vic < 1 + ARRAY_SIZE(edid_cea_modes_1)) 3080 + return &edid_cea_modes_1[vic - 1]; 3081 + if (vic >= 193 && vic < 193 + ARRAY_SIZE(edid_cea_modes_193)) 3082 + return &edid_cea_modes_193[vic - 193]; 3083 + return NULL; 3084 + } 3085 + 3086 + static u8 cea_num_vics(void) 3087 + { 3088 + return 193 + ARRAY_SIZE(edid_cea_modes_193); 3089 + } 3090 + 3091 + static u8 cea_next_vic(u8 vic) 3092 + { 3093 + if (++vic == 1 + ARRAY_SIZE(edid_cea_modes_1)) 3094 + vic = 193; 3095 + return vic; 3096 + } 3097 + 3214 3098 /* 3215 3099 * Calculate the alternate clock for the CEA mode 3216 3100 * (60Hz vs. 59.94Hz etc.) ··· 3272 3108 * get the other variants by simply increasing the 3273 3109 * vertical front porch length. 3274 3110 */ 3275 - BUILD_BUG_ON(edid_cea_modes[8].vtotal != 262 || 3276 - edid_cea_modes[9].vtotal != 262 || 3277 - edid_cea_modes[12].vtotal != 262 || 3278 - edid_cea_modes[13].vtotal != 262 || 3279 - edid_cea_modes[23].vtotal != 312 || 3280 - edid_cea_modes[24].vtotal != 312 || 3281 - edid_cea_modes[27].vtotal != 312 || 3282 - edid_cea_modes[28].vtotal != 312); 3111 + BUILD_BUG_ON(cea_mode_for_vic(8)->vtotal != 262 || 3112 + cea_mode_for_vic(9)->vtotal != 262 || 3113 + cea_mode_for_vic(12)->vtotal != 262 || 3114 + cea_mode_for_vic(13)->vtotal != 262 || 3115 + cea_mode_for_vic(23)->vtotal != 312 || 3116 + cea_mode_for_vic(24)->vtotal != 312 || 3117 + cea_mode_for_vic(27)->vtotal != 312 || 3118 + cea_mode_for_vic(28)->vtotal != 312); 3283 3119 3284 3120 if (((vic == 8 || vic == 9 || 3285 3121 vic == 12 || vic == 13) && mode->vtotal < 263) || ··· 3307 3143 if (to_match->picture_aspect_ratio) 3308 3144 match_flags |= DRM_MODE_MATCH_ASPECT_RATIO; 3309 3145 3310 - for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) { 3311 - struct drm_display_mode cea_mode = edid_cea_modes[vic]; 3146 + for (vic = 1; vic < cea_num_vics(); vic = cea_next_vic(vic)) { 3147 + struct drm_display_mode cea_mode = *cea_mode_for_vic(vic); 3312 3148 unsigned int clock1, clock2; 3313 3149 3314 3150 /* Check both 60Hz and 59.94Hz */ ··· 3346 3182 if (to_match->picture_aspect_ratio) 3347 3183 match_flags |= DRM_MODE_MATCH_ASPECT_RATIO; 3348 3184 3349 - for (vic = 1; vic < ARRAY_SIZE(edid_cea_modes); vic++) { 3350 - struct drm_display_mode cea_mode = edid_cea_modes[vic]; 3185 + for (vic = 1; vic < cea_num_vics(); vic = cea_next_vic(vic)) { 3186 + struct drm_display_mode cea_mode = *cea_mode_for_vic(vic); 3351 3187 unsigned int clock1, clock2; 3352 3188 3353 3189 /* Check both 60Hz and 59.94Hz */ ··· 3370 3206 3371 3207 static bool drm_valid_cea_vic(u8 vic) 3372 3208 { 3373 - return vic > 0 && vic < ARRAY_SIZE(edid_cea_modes); 3209 + return cea_mode_for_vic(vic) != NULL; 3374 3210 } 3375 3211 3376 3212 static enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code) 3377 3213 { 3378 - return edid_cea_modes[video_code].picture_aspect_ratio; 3214 + const struct drm_display_mode *mode = cea_mode_for_vic(video_code); 3215 + 3216 + if (mode) 3217 + return mode->picture_aspect_ratio; 3218 + 3219 + return HDMI_PICTURE_ASPECT_NONE; 3379 3220 } 3380 3221 3381 3222 static enum hdmi_picture_aspect drm_get_hdmi_aspect_ratio(const u8 video_code) ··· 3492 3323 unsigned int clock1, clock2; 3493 3324 3494 3325 if (drm_valid_cea_vic(vic)) { 3495 - cea_mode = &edid_cea_modes[vic]; 3326 + cea_mode = cea_mode_for_vic(vic); 3496 3327 clock2 = cea_mode_alternate_clock(cea_mode); 3497 3328 } else { 3498 3329 vic = drm_match_hdmi_mode(mode); ··· 3567 3398 if (!drm_valid_cea_vic(vic)) 3568 3399 return NULL; 3569 3400 3570 - newmode = drm_mode_duplicate(dev, &edid_cea_modes[vic]); 3401 + newmode = drm_mode_duplicate(dev, cea_mode_for_vic(vic)); 3571 3402 if (!newmode) 3572 3403 return NULL; 3573 3404 ··· 3601 3432 if (!drm_valid_cea_vic(vic)) 3602 3433 continue; 3603 3434 3604 - newmode = drm_mode_duplicate(dev, &edid_cea_modes[vic]); 3435 + newmode = drm_mode_duplicate(dev, cea_mode_for_vic(vic)); 3605 3436 if (!newmode) 3606 3437 break; 3607 3438 bitmap_set(hdmi->y420_vdb_modes, vic, 1); ··· 4170 4001 vic = drm_match_cea_mode_clock_tolerance(mode, 5); 4171 4002 if (drm_valid_cea_vic(vic)) { 4172 4003 type = "CEA"; 4173 - cea_mode = &edid_cea_modes[vic]; 4004 + cea_mode = cea_mode_for_vic(vic); 4174 4005 clock1 = cea_mode->clock; 4175 4006 clock2 = cea_mode_alternate_clock(cea_mode); 4176 4007 } else { ··· 4746 4577 if (scdc->supported) { 4747 4578 scdc->scrambling.supported = true; 4748 4579 4749 - /* Few sinks support scrambling for cloks < 340M */ 4580 + /* Few sinks support scrambling for clocks < 340M */ 4750 4581 if ((hf_vsdb[6] & 0x8)) 4751 4582 scdc->scrambling.low_rates = true; 4752 4583 }
+20 -16
drivers/gpu/drm/drm_fb_helper.c
··· 191 191 { 192 192 struct drm_fb_helper *helper = info->par; 193 193 struct drm_client_dev *client = &helper->client; 194 + struct drm_device *dev = helper->dev; 194 195 struct drm_crtc *crtc; 195 196 const struct drm_crtc_helper_funcs *funcs; 196 197 struct drm_mode_set *mode_set; ··· 210 209 continue; 211 210 212 211 if (!fb) { 213 - DRM_ERROR("no fb to restore??\n"); 212 + drm_err(dev, "no fb to restore?\n"); 214 213 continue; 215 214 } 216 215 ··· 1249 1248 { 1250 1249 struct drm_fb_helper *fb_helper = info->par; 1251 1250 struct drm_framebuffer *fb = fb_helper->fb; 1251 + struct drm_device *dev = fb_helper->dev; 1252 1252 1253 1253 if (in_dbg_master()) 1254 1254 return -EINVAL; 1255 1255 1256 1256 if (var->pixclock != 0) { 1257 - DRM_DEBUG("fbdev emulation doesn't support changing the pixel clock, value of pixclock is ignored\n"); 1257 + drm_dbg_kms(dev, "fbdev emulation doesn't support changing the pixel clock, value of pixclock is ignored\n"); 1258 1258 var->pixclock = 0; 1259 1259 } 1260 1260 ··· 1270 1268 if (var->bits_per_pixel != fb->format->cpp[0] * 8 || 1271 1269 var->xres > fb->width || var->yres > fb->height || 1272 1270 var->xres_virtual > fb->width || var->yres_virtual > fb->height) { 1273 - DRM_DEBUG("fb requested width/height/bpp can't fit in current fb " 1271 + drm_dbg_kms(dev, "fb requested width/height/bpp can't fit in current fb " 1274 1272 "request %dx%d-%d (virtual %dx%d) > %dx%d-%d\n", 1275 1273 var->xres, var->yres, var->bits_per_pixel, 1276 1274 var->xres_virtual, var->yres_virtual, ··· 1297 1295 * so reject all pixel format changing requests. 1298 1296 */ 1299 1297 if (!drm_fb_pixel_format_equal(var, &info->var)) { 1300 - DRM_DEBUG("fbdev emulation doesn't support changing the pixel format\n"); 1298 + drm_dbg_kms(dev, "fbdev emulation doesn't support changing the pixel format\n"); 1301 1299 return -EINVAL; 1302 1300 } 1303 1301 ··· 1322 1320 return -EBUSY; 1323 1321 1324 1322 if (var->pixclock != 0) { 1325 - DRM_ERROR("PIXEL CLOCK SET\n"); 1323 + drm_err(fb_helper->dev, "PIXEL CLOCK SET\n"); 1326 1324 return -EINVAL; 1327 1325 } 1328 1326 ··· 1432 1430 int preferred_bpp) 1433 1431 { 1434 1432 struct drm_client_dev *client = &fb_helper->client; 1433 + struct drm_device *dev = fb_helper->dev; 1435 1434 int ret = 0; 1436 1435 int crtc_count = 0; 1437 1436 struct drm_connector_list_iter conn_iter; ··· 1496 1493 struct drm_plane *plane = crtc->primary; 1497 1494 int j; 1498 1495 1499 - DRM_DEBUG("test CRTC %u primary plane\n", drm_crtc_index(crtc)); 1496 + drm_dbg_kms(dev, "test CRTC %u primary plane\n", drm_crtc_index(crtc)); 1500 1497 1501 1498 for (j = 0; j < plane->format_count; j++) { 1502 1499 const struct drm_format_info *fmt; ··· 1529 1526 } 1530 1527 } 1531 1528 if (sizes.surface_depth != best_depth && best_depth) { 1532 - DRM_INFO("requested bpp %d, scaled depth down to %d", 1529 + drm_info(dev, "requested bpp %d, scaled depth down to %d", 1533 1530 sizes.surface_bpp, best_depth); 1534 1531 sizes.surface_depth = best_depth; 1535 1532 } ··· 1577 1574 mutex_unlock(&client->modeset_mutex); 1578 1575 1579 1576 if (crtc_count == 0 || sizes.fb_width == -1 || sizes.fb_height == -1) { 1580 - DRM_INFO("Cannot find any crtc or sizes\n"); 1577 + drm_info(dev, "Cannot find any crtc or sizes\n"); 1581 1578 1582 1579 /* First time: disable all crtc's.. */ 1583 1580 if (!fb_helper->deferred_setup) ··· 1892 1889 1893 1890 drm_master_internal_release(fb_helper->dev); 1894 1891 1895 - DRM_DEBUG_KMS("\n"); 1892 + drm_dbg_kms(fb_helper->dev, "\n"); 1896 1893 1897 1894 drm_client_modeset_probe(&fb_helper->client, fb_helper->fb->width, fb_helper->fb->height); 1898 1895 drm_setup_crtcs_fb(fb_helper); ··· 2029 2026 struct drm_fb_helper_surface_size *sizes) 2030 2027 { 2031 2028 struct drm_client_dev *client = &fb_helper->client; 2029 + struct drm_device *dev = fb_helper->dev; 2032 2030 struct drm_client_buffer *buffer; 2033 2031 struct drm_framebuffer *fb; 2034 2032 struct fb_info *fbi; 2035 2033 u32 format; 2036 2034 void *vaddr; 2037 2035 2038 - DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d)\n", 2039 - sizes->surface_width, sizes->surface_height, 2040 - sizes->surface_bpp); 2036 + drm_dbg_kms(dev, "surface width(%d), height(%d) and bpp(%d)\n", 2037 + sizes->surface_width, sizes->surface_height, 2038 + sizes->surface_bpp); 2041 2039 2042 2040 format = drm_mode_legacy_fb_format(sizes->surface_bpp, sizes->surface_depth); 2043 2041 buffer = drm_client_framebuffer_create(client, sizes->surface_width, ··· 2122 2118 return drm_fb_helper_hotplug_event(dev->fb_helper); 2123 2119 2124 2120 if (!dev->mode_config.num_connector) { 2125 - DRM_DEV_DEBUG(dev->dev, "No connectors found, will not create framebuffer!\n"); 2121 + drm_dbg_kms(dev, "No connectors found, will not create framebuffer!\n"); 2126 2122 return 0; 2127 2123 } 2128 2124 ··· 2147 2143 fb_helper->dev = NULL; 2148 2144 fb_helper->fbdev = NULL; 2149 2145 2150 - DRM_DEV_ERROR(dev->dev, "fbdev: Failed to setup generic emulation (ret=%d)\n", ret); 2146 + drm_err(dev, "fbdev: Failed to setup generic emulation (ret=%d)\n", ret); 2151 2147 2152 2148 return ret; 2153 2149 } ··· 2204 2200 ret = drm_client_init(dev, &fb_helper->client, "fbdev", &drm_fbdev_client_funcs); 2205 2201 if (ret) { 2206 2202 kfree(fb_helper); 2207 - DRM_DEV_ERROR(dev->dev, "Failed to register client: %d\n", ret); 2203 + drm_err(dev, "Failed to register client: %d\n", ret); 2208 2204 return ret; 2209 2205 } 2210 2206 ··· 2216 2212 2217 2213 ret = drm_fbdev_client_hotplug(&fb_helper->client); 2218 2214 if (ret) 2219 - DRM_DEV_DEBUG(dev->dev, "client hotplug ret=%d\n", ret); 2215 + drm_dbg_kms(dev, "client hotplug ret=%d\n", ret); 2220 2216 2221 2217 drm_client_register(&fb_helper->client); 2222 2218
+2 -3
drivers/gpu/drm/drm_gem_framebuffer_helper.c
··· 74 74 75 75 ret = drm_framebuffer_init(dev, fb, funcs); 76 76 if (ret) { 77 - DRM_DEV_ERROR(dev->dev, "Failed to init framebuffer: %d\n", 78 - ret); 77 + drm_err(dev, "Failed to init framebuffer: %d\n", ret); 79 78 kfree(fb); 80 79 return ERR_PTR(ret); 81 80 } ··· 159 160 160 161 objs[i] = drm_gem_object_lookup(file, mode_cmd->handles[i]); 161 162 if (!objs[i]) { 162 - DRM_DEBUG_KMS("Failed to lookup GEM object\n"); 163 + drm_dbg_kms(dev, "Failed to lookup GEM object\n"); 163 164 ret = -ENOENT; 164 165 goto err_gem_object_put; 165 166 }
+123 -123
drivers/gpu/drm/drm_modes.c
··· 1568 1568 return 0; 1569 1569 } 1570 1570 1571 - static int drm_mode_parse_cmdline_options(char *str, size_t len, 1571 + static int drm_mode_parse_cmdline_int(const char *delim, unsigned int *int_ret) 1572 + { 1573 + const char *value; 1574 + char *endp; 1575 + 1576 + /* 1577 + * delim must point to the '=', otherwise it is a syntax error and 1578 + * if delim points to the terminating zero, then delim + 1 wil point 1579 + * past the end of the string. 1580 + */ 1581 + if (*delim != '=') 1582 + return -EINVAL; 1583 + 1584 + value = delim + 1; 1585 + *int_ret = simple_strtol(value, &endp, 10); 1586 + 1587 + /* Make sure we have parsed something */ 1588 + if (endp == value) 1589 + return -EINVAL; 1590 + 1591 + return 0; 1592 + } 1593 + 1594 + static int drm_mode_parse_panel_orientation(const char *delim, 1595 + struct drm_cmdline_mode *mode) 1596 + { 1597 + const char *value; 1598 + 1599 + if (*delim != '=') 1600 + return -EINVAL; 1601 + 1602 + value = delim + 1; 1603 + delim = strchr(value, ','); 1604 + if (!delim) 1605 + delim = value + strlen(value); 1606 + 1607 + if (!strncmp(value, "normal", delim - value)) 1608 + mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL; 1609 + else if (!strncmp(value, "upside_down", delim - value)) 1610 + mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP; 1611 + else if (!strncmp(value, "left_side_up", delim - value)) 1612 + mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP; 1613 + else if (!strncmp(value, "right_side_up", delim - value)) 1614 + mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP; 1615 + else 1616 + return -EINVAL; 1617 + 1618 + return 0; 1619 + } 1620 + 1621 + static int drm_mode_parse_cmdline_options(const char *str, 1622 + bool freestanding, 1572 1623 const struct drm_connector *connector, 1573 1624 struct drm_cmdline_mode *mode) 1574 1625 { 1575 - unsigned int rotation = 0; 1576 - char *sep = str; 1626 + unsigned int deg, margin, rotation = 0; 1627 + const char *delim, *option, *sep; 1577 1628 1578 - while ((sep = strchr(sep, ','))) { 1579 - char *delim, *option; 1580 - 1581 - option = sep + 1; 1629 + option = str; 1630 + do { 1582 1631 delim = strchr(option, '='); 1583 1632 if (!delim) { 1584 1633 delim = strchr(option, ','); 1585 1634 1586 1635 if (!delim) 1587 - delim = str + len; 1636 + delim = option + strlen(option); 1588 1637 } 1589 1638 1590 1639 if (!strncmp(option, "rotate", delim - option)) { 1591 - const char *value = delim + 1; 1592 - unsigned int deg; 1593 - 1594 - deg = simple_strtol(value, &sep, 10); 1595 - 1596 - /* Make sure we have parsed something */ 1597 - if (sep == value) 1640 + if (drm_mode_parse_cmdline_int(delim, &deg)) 1598 1641 return -EINVAL; 1599 1642 1600 1643 switch (deg) { ··· 1662 1619 } 1663 1620 } else if (!strncmp(option, "reflect_x", delim - option)) { 1664 1621 rotation |= DRM_MODE_REFLECT_X; 1665 - sep = delim; 1666 1622 } else if (!strncmp(option, "reflect_y", delim - option)) { 1667 1623 rotation |= DRM_MODE_REFLECT_Y; 1668 - sep = delim; 1669 1624 } else if (!strncmp(option, "margin_right", delim - option)) { 1670 - const char *value = delim + 1; 1671 - unsigned int margin; 1672 - 1673 - margin = simple_strtol(value, &sep, 10); 1674 - 1675 - /* Make sure we have parsed something */ 1676 - if (sep == value) 1625 + if (drm_mode_parse_cmdline_int(delim, &margin)) 1677 1626 return -EINVAL; 1678 1627 1679 1628 mode->tv_margins.right = margin; 1680 1629 } else if (!strncmp(option, "margin_left", delim - option)) { 1681 - const char *value = delim + 1; 1682 - unsigned int margin; 1683 - 1684 - margin = simple_strtol(value, &sep, 10); 1685 - 1686 - /* Make sure we have parsed something */ 1687 - if (sep == value) 1630 + if (drm_mode_parse_cmdline_int(delim, &margin)) 1688 1631 return -EINVAL; 1689 1632 1690 1633 mode->tv_margins.left = margin; 1691 1634 } else if (!strncmp(option, "margin_top", delim - option)) { 1692 - const char *value = delim + 1; 1693 - unsigned int margin; 1694 - 1695 - margin = simple_strtol(value, &sep, 10); 1696 - 1697 - /* Make sure we have parsed something */ 1698 - if (sep == value) 1635 + if (drm_mode_parse_cmdline_int(delim, &margin)) 1699 1636 return -EINVAL; 1700 1637 1701 1638 mode->tv_margins.top = margin; 1702 1639 } else if (!strncmp(option, "margin_bottom", delim - option)) { 1703 - const char *value = delim + 1; 1704 - unsigned int margin; 1705 - 1706 - margin = simple_strtol(value, &sep, 10); 1707 - 1708 - /* Make sure we have parsed something */ 1709 - if (sep == value) 1640 + if (drm_mode_parse_cmdline_int(delim, &margin)) 1710 1641 return -EINVAL; 1711 1642 1712 1643 mode->tv_margins.bottom = margin; 1644 + } else if (!strncmp(option, "panel_orientation", delim - option)) { 1645 + if (drm_mode_parse_panel_orientation(delim, mode)) 1646 + return -EINVAL; 1713 1647 } else { 1714 1648 return -EINVAL; 1715 1649 } 1716 - } 1650 + sep = strchr(delim, ','); 1651 + option = sep + 1; 1652 + } while (sep); 1653 + 1654 + if (rotation && freestanding) 1655 + return -EINVAL; 1717 1656 1718 1657 mode->rotation_reflection = rotation; 1719 1658 ··· 1706 1681 "NTSC", 1707 1682 "PAL", 1708 1683 }; 1709 - 1710 - static bool drm_named_mode_is_in_whitelist(const char *mode, unsigned int size) 1711 - { 1712 - int i; 1713 - 1714 - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) 1715 - if (!strncmp(mode, drm_named_modes_whitelist[i], size)) 1716 - return true; 1717 - 1718 - return false; 1719 - } 1720 1684 1721 1685 /** 1722 1686 * drm_mode_parse_command_line_for_connector - parse command line modeline for connector ··· 1737 1723 struct drm_cmdline_mode *mode) 1738 1724 { 1739 1725 const char *name; 1740 - bool named_mode = false, parse_extras = false; 1726 + bool freestanding = false, parse_extras = false; 1741 1727 unsigned int bpp_off = 0, refresh_off = 0, options_off = 0; 1742 1728 unsigned int mode_end = 0; 1743 - char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL; 1744 - char *options_ptr = NULL; 1729 + const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL; 1730 + const char *options_ptr = NULL; 1745 1731 char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL; 1746 - int ret; 1732 + int i, len, ret; 1747 1733 1748 - #ifdef CONFIG_FB 1734 + memset(mode, 0, sizeof(*mode)); 1735 + mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; 1736 + 1749 1737 if (!mode_option) 1750 - mode_option = fb_mode_option; 1751 - #endif 1752 - 1753 - if (!mode_option) { 1754 - mode->specified = false; 1755 1738 return false; 1756 - } 1757 1739 1758 1740 name = mode_option; 1759 1741 1760 - /* 1761 - * This is a bit convoluted. To differentiate between the 1762 - * named modes and poorly formatted resolutions, we need a 1763 - * bunch of things: 1764 - * - We need to make sure that the first character (which 1765 - * would be our resolution in X) is a digit. 1766 - * - If not, then it's either a named mode or a force on/off. 1767 - * To distinguish between the two, we need to run the 1768 - * extra parsing function, and if not, then we consider it 1769 - * a named mode. 1770 - * 1771 - * If this isn't enough, we should add more heuristics here, 1772 - * and matching unit-tests. 1773 - */ 1774 - if (!isdigit(name[0]) && name[0] != 'x') { 1775 - unsigned int namelen = strlen(name); 1776 - 1777 - /* 1778 - * Only the force on/off options can be in that case, 1779 - * and they all take a single character. 1780 - */ 1781 - if (namelen == 1) { 1782 - ret = drm_mode_parse_cmdline_extra(name, namelen, true, 1783 - connector, mode); 1784 - if (!ret) 1785 - return true; 1786 - } 1787 - 1788 - named_mode = true; 1789 - } 1790 - 1791 1742 /* Try to locate the bpp and refresh specifiers, if any */ 1792 1743 bpp_ptr = strchr(name, '-'); 1793 - if (bpp_ptr) { 1744 + if (bpp_ptr) 1794 1745 bpp_off = bpp_ptr - name; 1795 - mode->bpp_specified = true; 1796 - } 1797 1746 1798 1747 refresh_ptr = strchr(name, '@'); 1799 - if (refresh_ptr) { 1800 - if (named_mode) 1801 - return false; 1802 - 1748 + if (refresh_ptr) 1803 1749 refresh_off = refresh_ptr - name; 1804 - mode->refresh_specified = true; 1805 - } 1806 1750 1807 1751 /* Locate the start of named options */ 1808 1752 options_ptr = strchr(name, ','); ··· 1774 1802 mode_end = refresh_off; 1775 1803 } else if (options_ptr) { 1776 1804 mode_end = options_off; 1805 + parse_extras = true; 1777 1806 } else { 1778 1807 mode_end = strlen(name); 1779 1808 parse_extras = true; 1780 1809 } 1781 1810 1782 - if (named_mode) { 1783 - if (mode_end + 1 > DRM_DISPLAY_MODE_LEN) 1784 - return false; 1811 + /* First check for a named mode */ 1812 + for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { 1813 + ret = str_has_prefix(name, drm_named_modes_whitelist[i]); 1814 + if (ret == mode_end) { 1815 + if (refresh_ptr) 1816 + return false; /* named + refresh is invalid */ 1785 1817 1786 - if (!drm_named_mode_is_in_whitelist(name, mode_end)) 1787 - return false; 1818 + strcpy(mode->name, drm_named_modes_whitelist[i]); 1819 + mode->specified = true; 1820 + break; 1821 + } 1822 + } 1788 1823 1789 - strscpy(mode->name, name, mode_end + 1); 1790 - } else { 1824 + /* No named mode? Check for a normal mode argument, e.g. 1024x768 */ 1825 + if (!mode->specified && isdigit(name[0])) { 1791 1826 ret = drm_mode_parse_cmdline_res_mode(name, mode_end, 1792 1827 parse_extras, 1793 1828 connector, 1794 1829 mode); 1795 1830 if (ret) 1796 1831 return false; 1832 + 1833 + mode->specified = true; 1797 1834 } 1798 - mode->specified = true; 1835 + 1836 + /* No mode? Check for freestanding extras and/or options */ 1837 + if (!mode->specified) { 1838 + unsigned int len = strlen(mode_option); 1839 + 1840 + if (bpp_ptr || refresh_ptr) 1841 + return false; /* syntax error */ 1842 + 1843 + if (len == 1 || (len >= 2 && mode_option[1] == ',')) 1844 + extra_ptr = mode_option; 1845 + else 1846 + options_ptr = mode_option - 1; 1847 + 1848 + freestanding = true; 1849 + } 1799 1850 1800 1851 if (bpp_ptr) { 1801 1852 ret = drm_mode_parse_cmdline_bpp(bpp_ptr, &bpp_end_ptr, mode); 1802 1853 if (ret) 1803 1854 return false; 1855 + 1856 + mode->bpp_specified = true; 1804 1857 } 1805 1858 1806 1859 if (refresh_ptr) { ··· 1833 1836 &refresh_end_ptr, mode); 1834 1837 if (ret) 1835 1838 return false; 1839 + 1840 + mode->refresh_specified = true; 1836 1841 } 1837 1842 1838 1843 /* ··· 1848 1849 else if (refresh_ptr) 1849 1850 extra_ptr = refresh_end_ptr; 1850 1851 1851 - if (extra_ptr && 1852 - extra_ptr != options_ptr) { 1853 - int len = strlen(name) - (extra_ptr - name); 1852 + if (extra_ptr) { 1853 + if (options_ptr) 1854 + len = options_ptr - extra_ptr; 1855 + else 1856 + len = strlen(extra_ptr); 1854 1857 1855 - ret = drm_mode_parse_cmdline_extra(extra_ptr, len, false, 1858 + ret = drm_mode_parse_cmdline_extra(extra_ptr, len, freestanding, 1856 1859 connector, mode); 1857 1860 if (ret) 1858 1861 return false; 1859 1862 } 1860 1863 1861 1864 if (options_ptr) { 1862 - int len = strlen(name) - (options_ptr - name); 1863 - 1864 - ret = drm_mode_parse_cmdline_options(options_ptr, len, 1865 + ret = drm_mode_parse_cmdline_options(options_ptr + 1, 1866 + freestanding, 1865 1867 connector, mode); 1866 1868 if (ret) 1867 1869 return false;
+1 -1
drivers/gpu/drm/drm_panel.c
··· 302 302 EXPORT_SYMBOL(of_drm_find_panel); 303 303 #endif 304 304 305 - #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) 305 + #if IS_REACHABLE(CONFIG_BACKLIGHT_CLASS_DEVICE) 306 306 /** 307 307 * drm_panel_of_backlight - use backlight device node for backlight 308 308 * @panel: DRM panel
+3 -5
drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
··· 113 113 if (submit->bos[i].flags & BO_LOCKED) { 114 114 struct drm_gem_object *obj = &submit->bos[i].obj->base; 115 115 116 - ww_mutex_unlock(&obj->resv->lock); 116 + dma_resv_unlock(obj->resv); 117 117 submit->bos[i].flags &= ~BO_LOCKED; 118 118 } 119 119 } ··· 133 133 contended = i; 134 134 135 135 if (!(submit->bos[i].flags & BO_LOCKED)) { 136 - ret = ww_mutex_lock_interruptible(&obj->resv->lock, 137 - ticket); 136 + ret = dma_resv_lock_interruptible(obj->resv, ticket); 138 137 if (ret == -EALREADY) 139 138 DRM_ERROR("BO at index %u already on submit list\n", 140 139 i); ··· 160 161 obj = &submit->bos[contended].obj->base; 161 162 162 163 /* we lost out in a seqno race, lock and retry.. */ 163 - ret = ww_mutex_lock_slow_interruptible(&obj->resv->lock, 164 - ticket); 164 + ret = dma_resv_lock_slow_interruptible(obj->resv, ticket); 165 165 if (!ret) { 166 166 submit->bos[contended].flags |= BO_LOCKED; 167 167 slow_locked = contended;
+4 -2
drivers/gpu/drm/gma500/accel_2d.c
··· 228 228 { 229 229 struct drm_fb_helper *fb_helper = info->par; 230 230 struct drm_framebuffer *fb = fb_helper->fb; 231 - struct drm_device *dev = fb->dev; 232 - struct drm_psb_private *dev_priv = dev->dev_private; 231 + struct drm_device *dev; 232 + struct drm_psb_private *dev_priv; 233 233 uint32_t offset; 234 234 uint32_t stride; 235 235 uint32_t src_format; ··· 238 238 if (!fb) 239 239 return; 240 240 241 + dev = fb->dev; 242 + dev_priv = dev->dev_private; 241 243 offset = to_gtt_range(fb->obj[0])->offset; 242 244 stride = fb->pitches[0]; 243 245
+191 -48
drivers/gpu/drm/mcde/mcde_dsi.c
··· 388 388 static void mcde_dsi_setup_video_mode(struct mcde_dsi *d, 389 389 const struct drm_display_mode *mode) 390 390 { 391 - u8 bpp = mipi_dsi_pixel_format_to_bpp(d->mdsi->format); 391 + /* cpp, characters per pixel, number of bytes per pixel */ 392 + u8 cpp = mipi_dsi_pixel_format_to_bpp(d->mdsi->format) / 8; 393 + u64 pclk; 392 394 u64 bpl; 393 - u32 hfp; 394 - u32 hbp; 395 - u32 hsa; 395 + int hfp; 396 + int hbp; 397 + int hsa; 396 398 u32 blkline_pck, line_duration; 397 - u32 blkeol_pck, blkeol_duration; 398 399 u32 val; 399 400 400 401 val = 0; ··· 432 431 return; 433 432 } 434 433 435 - /* TODO: TVG could be enabled here */ 434 + /* TODO: TVG (test video generator) could be enabled here */ 436 435 437 - /* Send blanking packet */ 436 + /* 437 + * During vertical blanking: go to LP mode 438 + * Like with the EOL setting, if this is not set, the EOL area will be 439 + * filled with NULL or blanking packets in the vblank area. 440 + * FIXME: some Samsung phones and display panels such as s6e63m0 use 441 + * DSI_VID_MAIN_CTL_REG_BLKLINE_MODE_BLANKING here instead, 442 + * figure out how to properly configure that from the panel. 443 + */ 438 444 val |= DSI_VID_MAIN_CTL_REG_BLKLINE_MODE_LP_0; 439 - /* Send EOL packet */ 445 + /* 446 + * During EOL: go to LP mode. If this is not set, the EOL area will be 447 + * filled with NULL or blanking packets. 448 + */ 440 449 val |= DSI_VID_MAIN_CTL_REG_BLKEOL_MODE_LP_0; 441 450 /* Recovery mode 1 */ 442 451 val |= 1 << DSI_VID_MAIN_CTL_RECOVERY_MODE_SHIFT; ··· 454 443 writel(val, d->regs + DSI_VID_MAIN_CTL); 455 444 456 445 /* Vertical frame parameters are pretty straight-forward */ 457 - val = mode->vdisplay << DSI_VID_VSIZE_VSA_LENGTH_SHIFT; 446 + val = mode->vdisplay << DSI_VID_VSIZE_VACT_LENGTH_SHIFT; 458 447 /* vertical front porch */ 459 448 val |= (mode->vsync_start - mode->vdisplay) 460 449 << DSI_VID_VSIZE_VFP_LENGTH_SHIFT; 461 450 /* vertical sync active */ 462 451 val |= (mode->vsync_end - mode->vsync_start) 463 - << DSI_VID_VSIZE_VACT_LENGTH_SHIFT; 452 + << DSI_VID_VSIZE_VSA_LENGTH_SHIFT; 464 453 /* vertical back porch */ 465 454 val |= (mode->vtotal - mode->vsync_end) 466 455 << DSI_VID_VSIZE_VBP_LENGTH_SHIFT; ··· 468 457 469 458 /* 470 459 * Horizontal frame parameters: 471 - * horizontal resolution is given in pixels and must be re-calculated 472 - * into bytes since this is what the hardware expects. 460 + * horizontal resolution is given in pixels but must be re-calculated 461 + * into bytes since this is what the hardware expects, these registers 462 + * define the payload size of the packet. 463 + * 464 + * hfp = horizontal front porch in bytes 465 + * hbp = horizontal back porch in bytes 466 + * hsa = horizontal sync active in bytes 473 467 * 474 468 * 6 + 2 is HFP header + checksum 475 469 */ 476 - hfp = (mode->hsync_start - mode->hdisplay) * bpp - 6 - 2; 470 + hfp = (mode->hsync_start - mode->hdisplay) * cpp - 6 - 2; 477 471 if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) { 478 472 /* 473 + * Use sync pulse for sync: explicit HSA time 479 474 * 6 is HBP header + checksum 480 475 * 4 is RGB header + checksum 481 476 */ 482 - hbp = (mode->htotal - mode->hsync_end) * bpp - 4 - 6; 477 + hbp = (mode->htotal - mode->hsync_end) * cpp - 4 - 6; 483 478 /* 484 479 * 6 is HBP header + checksum 485 480 * 4 is HSW packet bytes 486 481 * 4 is RGB header + checksum 487 482 */ 488 - hsa = (mode->hsync_end - mode->hsync_start) * bpp - 4 - 4 - 6; 483 + hsa = (mode->hsync_end - mode->hsync_start) * cpp - 4 - 4 - 6; 489 484 } else { 490 485 /* 491 - * HBP includes both back porch and sync 486 + * Use event for sync: HBP includes both back porch and sync 492 487 * 6 is HBP header + checksum 493 488 * 4 is HSW packet bytes 494 489 * 4 is RGB header + checksum 495 490 */ 496 - hbp = (mode->htotal - mode->hsync_start) * bpp - 4 - 4 - 6; 497 - /* HSA is not considered in this mode and set to 0 */ 491 + hbp = (mode->htotal - mode->hsync_start) * cpp - 4 - 4 - 6; 492 + /* HSA is not present in this mode and set to 0 */ 498 493 hsa = 0; 499 494 } 500 - dev_dbg(d->dev, "hfp: %u, hbp: %u, hsa: %u\n", 495 + if (hfp < 0) { 496 + dev_info(d->dev, "hfp negative, set to 0\n"); 497 + hfp = 0; 498 + } 499 + if (hbp < 0) { 500 + dev_info(d->dev, "hbp negative, set to 0\n"); 501 + hbp = 0; 502 + } 503 + if (hsa < 0) { 504 + dev_info(d->dev, "hsa negative, set to 0\n"); 505 + hsa = 0; 506 + } 507 + dev_dbg(d->dev, "hfp: %u, hbp: %u, hsa: %u bytes\n", 501 508 hfp, hbp, hsa); 502 509 503 510 /* Frame parameters: horizontal sync active */ ··· 526 497 val |= hfp << DSI_VID_HSIZE1_HFP_LENGTH_SHIFT; 527 498 writel(val, d->regs + DSI_VID_HSIZE1); 528 499 529 - /* RGB data length (bytes on one scanline) */ 530 - val = mode->hdisplay * (bpp / 8); 500 + /* RGB data length (visible bytes on one scanline) */ 501 + val = mode->hdisplay * cpp; 531 502 writel(val, d->regs + DSI_VID_HSIZE2); 532 - 533 - /* TODO: further adjustments for TVG mode here */ 503 + dev_dbg(d->dev, "RGB length, visible area on a line: %u bytes\n", val); 534 504 535 505 /* 536 - * EOL packet length from bits per line calculations: pixel clock 537 - * is given in kHz, calculate the time between two pixels in 538 - * picoseconds. 506 + * Calculate the time between two pixels in picoseconds using 507 + * the supplied refresh rate and total resolution including 508 + * porches and sync. 539 509 */ 540 - bpl = mode->clock * mode->htotal; 541 - bpl *= (d->hs_freq / 8); 542 - do_div(bpl, 1000000); /* microseconds */ 543 - do_div(bpl, 1000000); /* seconds */ 510 + /* (ps/s) / (pixels/s) = ps/pixels */ 511 + pclk = DIV_ROUND_UP_ULL(1000000000000, 512 + (mode->vrefresh * mode->htotal * mode->vtotal)); 513 + dev_dbg(d->dev, "picoseconds between two pixels: %llu\n", 514 + pclk); 515 + 516 + /* 517 + * How many bytes per line will this update frequency yield? 518 + * 519 + * Calculate the number of picoseconds for one scanline (1), then 520 + * divide by 1000000000000 (2) to get in pixels per second we 521 + * want to output. 522 + * 523 + * Multiply with number of bytes per second at this video display 524 + * frequency (3) to get number of bytes transferred during this 525 + * time. Notice that we use the frequency the display wants, 526 + * not what we actually get from the DSI PLL, which is hs_freq. 527 + * 528 + * These arithmetics are done in a different order to avoid 529 + * overflow. 530 + */ 531 + bpl = pclk * mode->htotal; /* (1) picoseconds per line */ 532 + dev_dbg(d->dev, "picoseconds per line: %llu\n", bpl); 533 + /* Multiply with bytes per second (3) */ 534 + bpl *= (d->mdsi->hs_rate / 8); 535 + /* Pixels per second (2) */ 536 + bpl = DIV_ROUND_DOWN_ULL(bpl, 1000000); /* microseconds */ 537 + bpl = DIV_ROUND_DOWN_ULL(bpl, 1000000); /* seconds */ 538 + /* parallel transactions in all lanes */ 544 539 bpl *= d->mdsi->lanes; 545 - dev_dbg(d->dev, "calculated bytes per line: %llu\n", bpl); 540 + dev_dbg(d->dev, 541 + "calculated bytes per line: %llu @ %d Hz with HS %lu Hz\n", 542 + bpl, mode->vrefresh, d->mdsi->hs_rate); 543 + 546 544 /* 547 545 * 6 is header + checksum, header = 4 bytes, checksum = 2 bytes 548 546 * 4 is short packet for vsync/hsync 549 547 */ 550 548 if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_SYNC_PULSE) { 551 - /* Fixme: isn't the hsync width in pixels? */ 549 + /* Set the event packet size to 0 (not used) */ 550 + writel(0, d->regs + DSI_VID_BLKSIZE1); 551 + /* 552 + * FIXME: isn't the hsync width in pixels? The porch and 553 + * sync area size is in pixels here, but this -6 554 + * seems to be for bytes. It looks like this in the vendor 555 + * code though. Is it completely untested? 556 + */ 552 557 blkline_pck = bpl - (mode->hsync_end - mode->hsync_start) - 6; 553 558 val = blkline_pck << DSI_VID_BLKSIZE2_BLKLINE_PULSE_PCK_SHIFT; 554 559 writel(val, d->regs + DSI_VID_BLKSIZE2); 555 560 } else { 561 + /* Set the sync pulse packet size to 0 (not used) */ 562 + writel(0, d->regs + DSI_VID_BLKSIZE2); 563 + /* Specifying payload size in bytes (-4-6 from manual) */ 556 564 blkline_pck = bpl - 4 - 6; 565 + if (blkline_pck > 0x1FFF) 566 + dev_err(d->dev, "blkline_pck too big %d bytes\n", 567 + blkline_pck); 557 568 val = blkline_pck << DSI_VID_BLKSIZE1_BLKLINE_EVENT_PCK_SHIFT; 569 + val &= DSI_VID_BLKSIZE1_BLKLINE_EVENT_PCK_MASK; 558 570 writel(val, d->regs + DSI_VID_BLKSIZE1); 559 571 } 560 572 561 - line_duration = (blkline_pck + 6) / d->mdsi->lanes; 562 - dev_dbg(d->dev, "line duration %u\n", line_duration); 573 + /* 574 + * The line duration is used to scale back the frequency from 575 + * the max frequency supported by the HS clock to the desired 576 + * update frequency in vrefresh. 577 + */ 578 + line_duration = blkline_pck + 6; 579 + /* 580 + * The datasheet contains this complex condition to decreasing 581 + * the line duration by 1 under very specific circumstances. 582 + * Here we also imply that LP is used during burst EOL. 583 + */ 584 + if (d->mdsi->lanes == 2 && (hsa & 0x01) && (hfp & 0x01) 585 + && (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST)) 586 + line_duration--; 587 + line_duration = DIV_ROUND_CLOSEST(line_duration, d->mdsi->lanes); 588 + dev_dbg(d->dev, "line duration %u bytes\n", line_duration); 563 589 val = line_duration << DSI_VID_DPHY_TIME_REG_LINE_DURATION_SHIFT; 564 590 /* 565 591 * This is the time to perform LP->HS on D-PHY 566 592 * FIXME: nowhere to get this from: DT property on the DSI? 593 + * The manual says this is "system dependent". 594 + * values like 48 and 72 seen in the vendor code. 567 595 */ 568 - val |= 0 << DSI_VID_DPHY_TIME_REG_WAKEUP_TIME_SHIFT; 596 + val |= 48 << DSI_VID_DPHY_TIME_REG_WAKEUP_TIME_SHIFT; 569 597 writel(val, d->regs + DSI_VID_DPHY_TIME); 570 598 571 - /* Calculate block end of line */ 572 - blkeol_pck = bpl - mode->hdisplay * bpp - 6; 573 - blkeol_duration = (blkeol_pck + 6) / d->mdsi->lanes; 574 - dev_dbg(d->dev, "blkeol pck: %u, duration: %u\n", 575 - blkeol_pck, blkeol_duration); 576 - 599 + /* 600 + * See the manual figure 657 page 2203 for understanding the impact 601 + * of the different burst mode settings. 602 + */ 577 603 if (d->mdsi->mode_flags & MIPI_DSI_MODE_VIDEO_BURST) { 578 - /* Set up EOL clock for burst mode */ 604 + int blkeol_pck, blkeol_duration; 605 + /* 606 + * Packet size at EOL for burst mode, this is only used 607 + * if DSI_VID_MAIN_CTL_REG_BLKEOL_MODE_LP_0 is NOT set, 608 + * but we instead send NULL or blanking packets at EOL. 609 + * This is given in number of bytes. 610 + * 611 + * See the manual page 2198 for the 13 reg_blkeol_pck bits. 612 + */ 613 + blkeol_pck = bpl - (mode->htotal * cpp) - 6; 614 + if (blkeol_pck < 0) { 615 + dev_err(d->dev, "video block does not fit on line!\n"); 616 + dev_err(d->dev, 617 + "calculated bytes per line: %llu @ %d Hz\n", 618 + bpl, mode->vrefresh); 619 + dev_err(d->dev, 620 + "bytes per line (blkline_pck) %u bytes\n", 621 + blkline_pck); 622 + dev_err(d->dev, 623 + "blkeol_pck becomes %d bytes\n", blkeol_pck); 624 + return; 625 + } 626 + dev_dbg(d->dev, "BLKEOL packet: %d bytes\n", blkeol_pck); 627 + 579 628 val = readl(d->regs + DSI_VID_BLKSIZE1); 629 + val &= ~DSI_VID_BLKSIZE1_BLKEOL_PCK_MASK; 580 630 val |= blkeol_pck << DSI_VID_BLKSIZE1_BLKEOL_PCK_SHIFT; 581 631 writel(val, d->regs + DSI_VID_BLKSIZE1); 582 - writel(blkeol_pck, d->regs + DSI_VID_VCA_SETTING2); 632 + /* Use the same value for exact burst limit */ 633 + val = blkeol_pck << 634 + DSI_VID_VCA_SETTING2_EXACT_BURST_LIMIT_SHIFT; 635 + val &= DSI_VID_VCA_SETTING2_EXACT_BURST_LIMIT_MASK; 636 + writel(val, d->regs + DSI_VID_VCA_SETTING2); 637 + /* 638 + * This BLKEOL duration is claimed to be the duration in clock 639 + * cycles of the BLLP end-of-line (EOL) period for each line if 640 + * DSI_VID_MAIN_CTL_REG_BLKEOL_MODE_LP_0 is set. 641 + * 642 + * It is hard to trust the manuals' claim that this is in clock 643 + * cycles as we mimic the behaviour of the vendor code, which 644 + * appears to write a number of bytes that would have been 645 + * transferred on a single lane. 646 + * 647 + * See the manual figure 657 page 2203 and page 2198 for the 13 648 + * reg_blkeol_duration bits. 649 + * 650 + * FIXME: should this also be set up also for non-burst mode 651 + * according to figure 565 page 2202? 652 + */ 653 + blkeol_duration = DIV_ROUND_CLOSEST(blkeol_pck + 6, 654 + d->mdsi->lanes); 655 + dev_dbg(d->dev, "BLKEOL duration: %d clock cycles\n", 656 + blkeol_duration); 583 657 584 - writel(blkeol_duration, d->regs + DSI_VID_PCK_TIME); 585 - writel(blkeol_duration - 6, d->regs + DSI_VID_VCA_SETTING1); 658 + val = readl(d->regs + DSI_VID_PCK_TIME); 659 + val &= ~DSI_VID_PCK_TIME_BLKEOL_DURATION_MASK; 660 + val |= blkeol_duration << 661 + DSI_VID_PCK_TIME_BLKEOL_DURATION_SHIFT; 662 + writel(val, d->regs + DSI_VID_PCK_TIME); 663 + 664 + /* Max burst limit, this is given in bytes */ 665 + val = readl(d->regs + DSI_VID_VCA_SETTING1); 666 + val &= ~DSI_VID_VCA_SETTING1_MAX_BURST_LIMIT_MASK; 667 + val |= (blkeol_pck - 6) << 668 + DSI_VID_VCA_SETTING1_MAX_BURST_LIMIT_SHIFT; 669 + writel(val, d->regs + DSI_VID_VCA_SETTING1); 586 670 } 587 671 588 672 /* Maximum line limit */ 589 673 val = readl(d->regs + DSI_VID_VCA_SETTING2); 590 - val |= blkline_pck << 591 - DSI_VID_VCA_SETTING2_EXACT_BURST_LIMIT_SHIFT; 674 + val &= ~DSI_VID_VCA_SETTING2_MAX_LINE_LIMIT_MASK; 675 + val |= (blkline_pck - 6) << 676 + DSI_VID_VCA_SETTING2_MAX_LINE_LIMIT_SHIFT; 592 677 writel(val, d->regs + DSI_VID_VCA_SETTING2); 593 - 678 + dev_dbg(d->dev, "blkline pck: %d bytes\n", blkline_pck - 6); 594 679 } 595 680 596 681 static void mcde_dsi_start(struct mcde_dsi *d)
+1
drivers/gpu/drm/mcde/mcde_dsi_regs.h
··· 228 228 229 229 #define DSI_VID_PCK_TIME 0x000000A8 230 230 #define DSI_VID_PCK_TIME_BLKEOL_DURATION_SHIFT 0 231 + #define DSI_VID_PCK_TIME_BLKEOL_DURATION_MASK 0x00000FFF 231 232 232 233 #define DSI_VID_DPHY_TIME 0x000000AC 233 234 #define DSI_VID_DPHY_TIME_REG_LINE_DURATION_SHIFT 0
+1 -1
drivers/gpu/drm/mediatek/mtk_drm_plane.c
··· 94 94 if (!fb) 95 95 return 0; 96 96 97 - if (!state->crtc) 97 + if (WARN_ON(!state->crtc)) 98 98 return 0; 99 99 100 100 ret = mtk_drm_crtc_plane_check(state->crtc, plane,
+5 -5
drivers/gpu/drm/msm/msm_gem_submit.c
··· 157 157 msm_gem_unpin_iova(&msm_obj->base, submit->aspace); 158 158 159 159 if (submit->bos[i].flags & BO_LOCKED) 160 - ww_mutex_unlock(&msm_obj->base.resv->lock); 160 + dma_resv_unlock(msm_obj->base.resv); 161 161 162 162 if (backoff && !(submit->bos[i].flags & BO_VALID)) 163 163 submit->bos[i].iova = 0; ··· 180 180 contended = i; 181 181 182 182 if (!(submit->bos[i].flags & BO_LOCKED)) { 183 - ret = ww_mutex_lock_interruptible(&msm_obj->base.resv->lock, 184 - &submit->ticket); 183 + ret = dma_resv_lock_interruptible(msm_obj->base.resv, 184 + &submit->ticket); 185 185 if (ret) 186 186 goto fail; 187 187 submit->bos[i].flags |= BO_LOCKED; ··· 202 202 if (ret == -EDEADLK) { 203 203 struct msm_gem_object *msm_obj = submit->bos[contended].obj; 204 204 /* we lost out in a seqno race, lock and retry.. */ 205 - ret = ww_mutex_lock_slow_interruptible(&msm_obj->base.resv->lock, 206 - &submit->ticket); 205 + ret = dma_resv_lock_slow_interruptible(msm_obj->base.resv, 206 + &submit->ticket); 207 207 if (!ret) { 208 208 submit->bos[contended].flags |= BO_LOCKED; 209 209 slow_locked = contended;
+1 -1
drivers/gpu/drm/panel/panel-lg-lg4573.c
··· 42 42 struct spi_transfer xfer = { 43 43 .len = 2, 44 44 }; 45 - u16 temp = cpu_to_be16(data); 45 + __be16 temp = cpu_to_be16(data); 46 46 struct spi_message msg; 47 47 48 48 dev_dbg(ctx->panel.dev, "writing data: %x\n", data);
+1
drivers/gpu/drm/rockchip/Kconfig
··· 46 46 47 47 config ROCKCHIP_DW_MIPI_DSI 48 48 bool "Rockchip specific extensions for Synopsys DW MIPI DSI" 49 + select GENERIC_PHY_MIPI_DPHY 49 50 help 50 51 This selects support for Rockchip SoC specific extensions 51 52 for the Synopsys DesignWare HDMI driver. If you want to
+169 -4
drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c
··· 12 12 #include <linux/mfd/syscon.h> 13 13 #include <linux/module.h> 14 14 #include <linux/of_device.h> 15 + #include <linux/phy/phy.h> 15 16 #include <linux/pm_runtime.h> 16 17 #include <linux/regmap.h> 17 18 ··· 140 139 #define DW_MIPI_NEEDS_PHY_CFG_CLK BIT(0) 141 140 #define DW_MIPI_NEEDS_GRF_CLK BIT(1) 142 141 142 + #define PX30_GRF_PD_VO_CON1 0x0438 143 + #define PX30_DSI_FORCETXSTOPMODE (0xf << 7) 144 + #define PX30_DSI_FORCERXMODE BIT(6) 145 + #define PX30_DSI_TURNDISABLE BIT(5) 146 + #define PX30_DSI_LCDC_SEL BIT(0) 147 + 143 148 #define RK3288_GRF_SOC_CON6 0x025c 144 149 #define RK3288_DSI0_LCDC_SEL BIT(6) 145 150 #define RK3288_DSI1_LCDC_SEL BIT(9) ··· 229 222 /* dual-channel */ 230 223 bool is_slave; 231 224 struct dw_mipi_dsi_rockchip *slave; 225 + 226 + /* optional external dphy */ 227 + struct phy *phy; 228 + union phy_configure_opts phy_opts; 232 229 233 230 unsigned int lane_mbps; /* per lane */ 234 231 u16 input_div; ··· 370 359 struct dw_mipi_dsi_rockchip *dsi = priv_data; 371 360 int ret, i, vco; 372 361 362 + if (dsi->phy) 363 + return 0; 364 + 373 365 /* 374 366 * Get vco from frequency(lane_mbps) 375 367 * vco frequency table ··· 481 467 return ret; 482 468 } 483 469 470 + static void dw_mipi_dsi_phy_power_on(void *priv_data) 471 + { 472 + struct dw_mipi_dsi_rockchip *dsi = priv_data; 473 + int ret; 474 + 475 + ret = phy_set_mode(dsi->phy, PHY_MODE_MIPI_DPHY); 476 + if (ret) { 477 + DRM_DEV_ERROR(dsi->dev, "failed to set phy mode: %d\n", ret); 478 + return; 479 + } 480 + 481 + phy_configure(dsi->phy, &dsi->phy_opts); 482 + phy_power_on(dsi->phy); 483 + } 484 + 485 + static void dw_mipi_dsi_phy_power_off(void *priv_data) 486 + { 487 + struct dw_mipi_dsi_rockchip *dsi = priv_data; 488 + 489 + phy_power_off(dsi->phy); 490 + } 491 + 484 492 static int 485 493 dw_mipi_dsi_get_lane_mbps(void *priv_data, const struct drm_display_mode *mode, 486 494 unsigned long mode_flags, u32 lanes, u32 format, ··· 538 502 else 539 503 DRM_DEV_ERROR(dsi->dev, 540 504 "DPHY clock frequency is out of range\n"); 505 + } 506 + 507 + /* for external phy only a the mipi_dphy_config is necessary */ 508 + if (dsi->phy) { 509 + phy_mipi_dphy_get_default_config(mode->clock * 1000 * 10 / 8, 510 + bpp, lanes, 511 + &dsi->phy_opts.mipi_dphy); 512 + dsi->lane_mbps = target_mbps; 513 + *lane_mbps = dsi->lane_mbps; 514 + 515 + return 0; 541 516 } 542 517 543 518 fin = clk_get_rate(dsi->pllref_clk); ··· 606 559 return 0; 607 560 } 608 561 562 + struct hstt { 563 + unsigned int maxfreq; 564 + struct dw_mipi_dsi_dphy_timing timing; 565 + }; 566 + 567 + #define HSTT(_maxfreq, _c_lp2hs, _c_hs2lp, _d_lp2hs, _d_hs2lp) \ 568 + { \ 569 + .maxfreq = _maxfreq, \ 570 + .timing = { \ 571 + .clk_lp2hs = _c_lp2hs, \ 572 + .clk_hs2lp = _c_hs2lp, \ 573 + .data_lp2hs = _d_lp2hs, \ 574 + .data_hs2lp = _d_hs2lp, \ 575 + } \ 576 + } 577 + 578 + /* Table A-3 High-Speed Transition Times */ 579 + struct hstt hstt_table[] = { 580 + HSTT( 90, 32, 20, 26, 13), 581 + HSTT( 100, 35, 23, 28, 14), 582 + HSTT( 110, 32, 22, 26, 13), 583 + HSTT( 130, 31, 20, 27, 13), 584 + HSTT( 140, 33, 22, 26, 14), 585 + HSTT( 150, 33, 21, 26, 14), 586 + HSTT( 170, 32, 20, 27, 13), 587 + HSTT( 180, 36, 23, 30, 15), 588 + HSTT( 200, 40, 22, 33, 15), 589 + HSTT( 220, 40, 22, 33, 15), 590 + HSTT( 240, 44, 24, 36, 16), 591 + HSTT( 250, 48, 24, 38, 17), 592 + HSTT( 270, 48, 24, 38, 17), 593 + HSTT( 300, 50, 27, 41, 18), 594 + HSTT( 330, 56, 28, 45, 18), 595 + HSTT( 360, 59, 28, 48, 19), 596 + HSTT( 400, 61, 30, 50, 20), 597 + HSTT( 450, 67, 31, 55, 21), 598 + HSTT( 500, 73, 31, 59, 22), 599 + HSTT( 550, 79, 36, 63, 24), 600 + HSTT( 600, 83, 37, 68, 25), 601 + HSTT( 650, 90, 38, 73, 27), 602 + HSTT( 700, 95, 40, 77, 28), 603 + HSTT( 750, 102, 40, 84, 28), 604 + HSTT( 800, 106, 42, 87, 30), 605 + HSTT( 850, 113, 44, 93, 31), 606 + HSTT( 900, 118, 47, 98, 32), 607 + HSTT( 950, 124, 47, 102, 34), 608 + HSTT(1000, 130, 49, 107, 35), 609 + HSTT(1050, 135, 51, 111, 37), 610 + HSTT(1100, 139, 51, 114, 38), 611 + HSTT(1150, 146, 54, 120, 40), 612 + HSTT(1200, 153, 57, 125, 41), 613 + HSTT(1250, 158, 58, 130, 42), 614 + HSTT(1300, 163, 58, 135, 44), 615 + HSTT(1350, 168, 60, 140, 45), 616 + HSTT(1400, 172, 64, 144, 47), 617 + HSTT(1450, 176, 65, 148, 48), 618 + HSTT(1500, 181, 66, 153, 50) 619 + }; 620 + 621 + static int 622 + dw_mipi_dsi_phy_get_timing(void *priv_data, unsigned int lane_mbps, 623 + struct dw_mipi_dsi_dphy_timing *timing) 624 + { 625 + int i; 626 + 627 + for (i = 0; i < ARRAY_SIZE(hstt_table); i++) 628 + if (lane_mbps < hstt_table[i].maxfreq) 629 + break; 630 + 631 + if (i == ARRAY_SIZE(hstt_table)) 632 + i--; 633 + 634 + *timing = hstt_table[i].timing; 635 + 636 + return 0; 637 + } 638 + 609 639 static const struct dw_mipi_dsi_phy_ops dw_mipi_dsi_rockchip_phy_ops = { 610 640 .init = dw_mipi_dsi_phy_init, 641 + .power_on = dw_mipi_dsi_phy_power_on, 642 + .power_off = dw_mipi_dsi_phy_power_off, 611 643 .get_lane_mbps = dw_mipi_dsi_get_lane_mbps, 644 + .get_timing = dw_mipi_dsi_phy_get_timing, 612 645 }; 613 646 614 647 static void dw_mipi_dsi_rockchip_config(struct dw_mipi_dsi_rockchip *dsi, ··· 1047 920 return -EINVAL; 1048 921 } 1049 922 923 + /* try to get a possible external dphy */ 924 + dsi->phy = devm_phy_optional_get(dev, "dphy"); 925 + if (IS_ERR(dsi->phy)) { 926 + ret = PTR_ERR(dsi->phy); 927 + DRM_DEV_ERROR(dev, "failed to get mipi dphy: %d\n", ret); 928 + return ret; 929 + } 930 + 1050 931 dsi->pllref_clk = devm_clk_get(dev, "ref"); 1051 932 if (IS_ERR(dsi->pllref_clk)) { 1052 - ret = PTR_ERR(dsi->pllref_clk); 1053 - DRM_DEV_ERROR(dev, 1054 - "Unable to get pll reference clock: %d\n", ret); 1055 - return ret; 933 + if (dsi->phy) { 934 + /* 935 + * if external phy is present, pll will be 936 + * generated there. 937 + */ 938 + dsi->pllref_clk = NULL; 939 + } else { 940 + ret = PTR_ERR(dsi->pllref_clk); 941 + DRM_DEV_ERROR(dev, 942 + "Unable to get pll reference clock: %d\n", 943 + ret); 944 + return ret; 945 + } 1056 946 } 1057 947 1058 948 if (dsi->cdata->flags & DW_MIPI_NEEDS_PHY_CFG_CLK) { ··· 1132 988 1133 989 return 0; 1134 990 } 991 + 992 + static const struct rockchip_dw_dsi_chip_data px30_chip_data[] = { 993 + { 994 + .reg = 0xff450000, 995 + .lcdsel_grf_reg = PX30_GRF_PD_VO_CON1, 996 + .lcdsel_big = HIWORD_UPDATE(0, PX30_DSI_LCDC_SEL), 997 + .lcdsel_lit = HIWORD_UPDATE(PX30_DSI_LCDC_SEL, 998 + PX30_DSI_LCDC_SEL), 999 + 1000 + .lanecfg1_grf_reg = PX30_GRF_PD_VO_CON1, 1001 + .lanecfg1 = HIWORD_UPDATE(0, PX30_DSI_TURNDISABLE | 1002 + PX30_DSI_FORCERXMODE | 1003 + PX30_DSI_FORCETXSTOPMODE), 1004 + 1005 + .max_data_lanes = 4, 1006 + }, 1007 + { /* sentinel */ } 1008 + }; 1135 1009 1136 1010 static const struct rockchip_dw_dsi_chip_data rk3288_chip_data[] = { 1137 1011 { ··· 1219 1057 1220 1058 static const struct of_device_id dw_mipi_dsi_rockchip_dt_ids[] = { 1221 1059 { 1060 + .compatible = "rockchip,px30-mipi-dsi", 1061 + .data = &px30_chip_data, 1062 + }, { 1222 1063 .compatible = "rockchip,rk3288-mipi-dsi", 1223 1064 .data = &rk3288_chip_data, 1224 1065 }, {
+5
drivers/gpu/drm/selftests/drm_cmdline_selftests.h
··· 60 60 cmdline_test(drm_cmdline_test_margin_options) 61 61 cmdline_test(drm_cmdline_test_multiple_options) 62 62 cmdline_test(drm_cmdline_test_invalid_option) 63 + cmdline_test(drm_cmdline_test_bpp_extra_and_option) 64 + cmdline_test(drm_cmdline_test_extra_and_option) 65 + cmdline_test(drm_cmdline_test_freestanding_options) 66 + cmdline_test(drm_cmdline_test_freestanding_force_e_and_options) 67 + cmdline_test(drm_cmdline_test_panel_orientation)
+122
drivers/gpu/drm/selftests/test-drm_cmdline_parser.c
··· 992 992 return 0; 993 993 } 994 994 995 + static int drm_cmdline_test_bpp_extra_and_option(void *ignored) 996 + { 997 + struct drm_cmdline_mode mode = { }; 998 + 999 + FAIL_ON(!drm_mode_parse_command_line_for_connector("720x480-24e,rotate=180", 1000 + &no_connector, 1001 + &mode)); 1002 + FAIL_ON(!mode.specified); 1003 + FAIL_ON(mode.xres != 720); 1004 + FAIL_ON(mode.yres != 480); 1005 + FAIL_ON(mode.rotation_reflection != DRM_MODE_ROTATE_180); 1006 + 1007 + FAIL_ON(mode.refresh_specified); 1008 + 1009 + FAIL_ON(!mode.bpp_specified); 1010 + FAIL_ON(mode.bpp != 24); 1011 + 1012 + FAIL_ON(mode.rb); 1013 + FAIL_ON(mode.cvt); 1014 + FAIL_ON(mode.interlace); 1015 + FAIL_ON(mode.margins); 1016 + FAIL_ON(mode.force != DRM_FORCE_ON); 1017 + 1018 + return 0; 1019 + } 1020 + 1021 + static int drm_cmdline_test_extra_and_option(void *ignored) 1022 + { 1023 + struct drm_cmdline_mode mode = { }; 1024 + 1025 + FAIL_ON(!drm_mode_parse_command_line_for_connector("720x480e,rotate=180", 1026 + &no_connector, 1027 + &mode)); 1028 + FAIL_ON(!mode.specified); 1029 + FAIL_ON(mode.xres != 720); 1030 + FAIL_ON(mode.yres != 480); 1031 + FAIL_ON(mode.rotation_reflection != DRM_MODE_ROTATE_180); 1032 + 1033 + FAIL_ON(mode.refresh_specified); 1034 + FAIL_ON(mode.bpp_specified); 1035 + 1036 + FAIL_ON(mode.rb); 1037 + FAIL_ON(mode.cvt); 1038 + FAIL_ON(mode.interlace); 1039 + FAIL_ON(mode.margins); 1040 + FAIL_ON(mode.force != DRM_FORCE_ON); 1041 + 1042 + return 0; 1043 + } 1044 + 1045 + static int drm_cmdline_test_freestanding_options(void *ignored) 1046 + { 1047 + struct drm_cmdline_mode mode = { }; 1048 + 1049 + FAIL_ON(!drm_mode_parse_command_line_for_connector("margin_right=14,margin_left=24,margin_bottom=36,margin_top=42", 1050 + &no_connector, 1051 + &mode)); 1052 + FAIL_ON(mode.specified); 1053 + FAIL_ON(mode.refresh_specified); 1054 + FAIL_ON(mode.bpp_specified); 1055 + 1056 + FAIL_ON(mode.tv_margins.right != 14); 1057 + FAIL_ON(mode.tv_margins.left != 24); 1058 + FAIL_ON(mode.tv_margins.bottom != 36); 1059 + FAIL_ON(mode.tv_margins.top != 42); 1060 + 1061 + FAIL_ON(mode.rb); 1062 + FAIL_ON(mode.cvt); 1063 + FAIL_ON(mode.interlace); 1064 + FAIL_ON(mode.margins); 1065 + FAIL_ON(mode.force != DRM_FORCE_UNSPECIFIED); 1066 + 1067 + return 0; 1068 + } 1069 + 1070 + static int drm_cmdline_test_freestanding_force_e_and_options(void *ignored) 1071 + { 1072 + struct drm_cmdline_mode mode = { }; 1073 + 1074 + FAIL_ON(!drm_mode_parse_command_line_for_connector("e,margin_right=14,margin_left=24,margin_bottom=36,margin_top=42", 1075 + &no_connector, 1076 + &mode)); 1077 + FAIL_ON(mode.specified); 1078 + FAIL_ON(mode.refresh_specified); 1079 + FAIL_ON(mode.bpp_specified); 1080 + 1081 + FAIL_ON(mode.tv_margins.right != 14); 1082 + FAIL_ON(mode.tv_margins.left != 24); 1083 + FAIL_ON(mode.tv_margins.bottom != 36); 1084 + FAIL_ON(mode.tv_margins.top != 42); 1085 + 1086 + FAIL_ON(mode.rb); 1087 + FAIL_ON(mode.cvt); 1088 + FAIL_ON(mode.interlace); 1089 + FAIL_ON(mode.margins); 1090 + FAIL_ON(mode.force != DRM_FORCE_ON); 1091 + 1092 + return 0; 1093 + } 1094 + 1095 + static int drm_cmdline_test_panel_orientation(void *ignored) 1096 + { 1097 + struct drm_cmdline_mode mode = { }; 1098 + 1099 + FAIL_ON(!drm_mode_parse_command_line_for_connector("panel_orientation=upside_down", 1100 + &no_connector, 1101 + &mode)); 1102 + FAIL_ON(mode.specified); 1103 + FAIL_ON(mode.refresh_specified); 1104 + FAIL_ON(mode.bpp_specified); 1105 + 1106 + FAIL_ON(mode.panel_orientation != DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP); 1107 + 1108 + FAIL_ON(mode.rb); 1109 + FAIL_ON(mode.cvt); 1110 + FAIL_ON(mode.interlace); 1111 + FAIL_ON(mode.margins); 1112 + FAIL_ON(mode.force != DRM_FORCE_UNSPECIFIED); 1113 + 1114 + return 0; 1115 + } 1116 + 995 1117 #include "drm_selftest.c" 996 1118 997 1119 static int __init test_drm_cmdline_init(void)
+13
drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
··· 309 309 return 0; 310 310 } 311 311 312 + static int 313 + dw_mipi_dsi_phy_get_timing(void *priv_data, unsigned int lane_mbps, 314 + struct dw_mipi_dsi_dphy_timing *timing) 315 + { 316 + timing->clk_hs2lp = 0x40; 317 + timing->clk_lp2hs = 0x40; 318 + timing->data_hs2lp = 0x40; 319 + timing->data_lp2hs = 0x40; 320 + 321 + return 0; 322 + } 323 + 312 324 static const struct dw_mipi_dsi_phy_ops dw_mipi_dsi_stm_phy_ops = { 313 325 .init = dw_mipi_dsi_phy_init, 314 326 .power_on = dw_mipi_dsi_phy_power_on, 315 327 .power_off = dw_mipi_dsi_phy_power_off, 316 328 .get_lane_mbps = dw_mipi_dsi_get_lane_mbps, 329 + .get_timing = dw_mipi_dsi_phy_get_timing, 317 330 }; 318 331 319 332 static struct dw_mipi_dsi_plat_data dw_mipi_dsi_stm_plat_data = {
+18 -6
drivers/gpu/drm/stm/ltdc.c
··· 437 437 /* Commit shadow registers = update planes at next vblank */ 438 438 reg_set(ldev->regs, LTDC_SRCR, SRCR_VBR); 439 439 440 - /* Enable LTDC */ 441 - reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); 442 - 443 440 drm_crtc_vblank_on(crtc); 444 441 } 445 442 ··· 449 452 DRM_DEBUG_DRIVER("\n"); 450 453 451 454 drm_crtc_vblank_off(crtc); 452 - 453 - /* disable LTDC */ 454 - reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); 455 455 456 456 /* disable IRQ */ 457 457 reg_clear(ldev->regs, LTDC_IER, IER_RRIE | IER_FUIE | IER_TERRIE); ··· 1038 1044 static void ltdc_encoder_disable(struct drm_encoder *encoder) 1039 1045 { 1040 1046 struct drm_device *ddev = encoder->dev; 1047 + struct ltdc_device *ldev = ddev->dev_private; 1041 1048 1042 1049 DRM_DEBUG_DRIVER("\n"); 1050 + 1051 + /* Disable LTDC */ 1052 + reg_clear(ldev->regs, LTDC_GCR, GCR_LTDCEN); 1043 1053 1044 1054 /* Set to sleep state the pinctrl whatever type of encoder */ 1045 1055 pinctrl_pm_select_sleep_state(ddev->dev); 1046 1056 } 1047 1057 1048 1058 static void ltdc_encoder_enable(struct drm_encoder *encoder) 1059 + { 1060 + struct drm_device *ddev = encoder->dev; 1061 + struct ltdc_device *ldev = ddev->dev_private; 1062 + 1063 + DRM_DEBUG_DRIVER("\n"); 1064 + 1065 + /* Enable LTDC */ 1066 + reg_set(ldev->regs, LTDC_GCR, GCR_LTDCEN); 1067 + } 1068 + 1069 + static void ltdc_encoder_mode_set(struct drm_encoder *encoder, 1070 + struct drm_display_mode *mode, 1071 + struct drm_display_mode *adjusted_mode) 1049 1072 { 1050 1073 struct drm_device *ddev = encoder->dev; 1051 1074 ··· 1080 1069 static const struct drm_encoder_helper_funcs ltdc_encoder_helper_funcs = { 1081 1070 .disable = ltdc_encoder_disable, 1082 1071 .enable = ltdc_encoder_enable, 1072 + .mode_set = ltdc_encoder_mode_set, 1083 1073 }; 1084 1074 1085 1075 static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
+22
drivers/gpu/drm/sun4i/sun4i_drv.c
··· 346 346 return count; 347 347 } 348 348 349 + #ifdef CONFIG_PM_SLEEP 350 + static int sun4i_drv_drm_sys_suspend(struct device *dev) 351 + { 352 + struct drm_device *drm = dev_get_drvdata(dev); 353 + 354 + return drm_mode_config_helper_suspend(drm); 355 + } 356 + 357 + static int sun4i_drv_drm_sys_resume(struct device *dev) 358 + { 359 + struct drm_device *drm = dev_get_drvdata(dev); 360 + 361 + return drm_mode_config_helper_resume(drm); 362 + } 363 + #endif 364 + 365 + static const struct dev_pm_ops sun4i_drv_drm_pm_ops = { 366 + SET_SYSTEM_SLEEP_PM_OPS(sun4i_drv_drm_sys_suspend, 367 + sun4i_drv_drm_sys_resume) 368 + }; 369 + 349 370 static int sun4i_drv_probe(struct platform_device *pdev) 350 371 { 351 372 struct component_match *match = NULL; ··· 439 418 .driver = { 440 419 .name = "sun4i-drm", 441 420 .of_match_table = sun4i_drv_of_table, 421 + .pm = &sun4i_drv_drm_pm_ops, 442 422 }, 443 423 }; 444 424 module_platform_driver(sun4i_drv_platform_driver);
+36 -11
drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c
··· 1081 1081 static int sun6i_dsi_probe(struct platform_device *pdev) 1082 1082 { 1083 1083 struct device *dev = &pdev->dev; 1084 + const char *bus_clk_name = NULL; 1084 1085 struct sun6i_dsi *dsi; 1085 1086 struct resource *res; 1086 1087 void __iomem *base; ··· 1094 1093 dsi->dev = dev; 1095 1094 dsi->host.ops = &sun6i_dsi_host_ops; 1096 1095 dsi->host.dev = dev; 1096 + 1097 + if (of_device_is_compatible(dev->of_node, 1098 + "allwinner,sun6i-a31-mipi-dsi")) 1099 + bus_clk_name = "bus"; 1097 1100 1098 1101 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1099 1102 base = devm_ioremap_resource(dev, res); ··· 1112 1107 return PTR_ERR(dsi->regulator); 1113 1108 } 1114 1109 1115 - dsi->regs = devm_regmap_init_mmio_clk(dev, "bus", base, 1116 - &sun6i_dsi_regmap_config); 1117 - if (IS_ERR(dsi->regs)) { 1118 - dev_err(dev, "Couldn't create the DSI encoder regmap\n"); 1119 - return PTR_ERR(dsi->regs); 1120 - } 1121 - 1122 1110 dsi->reset = devm_reset_control_get_shared(dev, NULL); 1123 1111 if (IS_ERR(dsi->reset)) { 1124 1112 dev_err(dev, "Couldn't get our reset line\n"); 1125 1113 return PTR_ERR(dsi->reset); 1126 1114 } 1127 1115 1128 - dsi->mod_clk = devm_clk_get(dev, "mod"); 1129 - if (IS_ERR(dsi->mod_clk)) { 1130 - dev_err(dev, "Couldn't get the DSI mod clock\n"); 1131 - return PTR_ERR(dsi->mod_clk); 1116 + dsi->regs = devm_regmap_init_mmio(dev, base, &sun6i_dsi_regmap_config); 1117 + if (IS_ERR(dsi->regs)) { 1118 + dev_err(dev, "Couldn't init regmap\n"); 1119 + return PTR_ERR(dsi->regs); 1120 + } 1121 + 1122 + dsi->bus_clk = devm_clk_get(dev, bus_clk_name); 1123 + if (IS_ERR(dsi->bus_clk)) { 1124 + dev_err(dev, "Couldn't get the DSI bus clock\n"); 1125 + return PTR_ERR(dsi->bus_clk); 1126 + } 1127 + 1128 + ret = regmap_mmio_attach_clk(dsi->regs, dsi->bus_clk); 1129 + if (ret) 1130 + return ret; 1131 + 1132 + if (of_device_is_compatible(dev->of_node, 1133 + "allwinner,sun6i-a31-mipi-dsi")) { 1134 + dsi->mod_clk = devm_clk_get(dev, "mod"); 1135 + if (IS_ERR(dsi->mod_clk)) { 1136 + dev_err(dev, "Couldn't get the DSI mod clock\n"); 1137 + ret = PTR_ERR(dsi->mod_clk); 1138 + goto err_attach_clk; 1139 + } 1132 1140 } 1133 1141 1134 1142 /* ··· 1179 1161 pm_runtime_disable(dev); 1180 1162 err_unprotect_clk: 1181 1163 clk_rate_exclusive_put(dsi->mod_clk); 1164 + err_attach_clk: 1165 + if (!IS_ERR(dsi->bus_clk)) 1166 + regmap_mmio_detach_clk(dsi->regs); 1182 1167 return ret; 1183 1168 } 1184 1169 ··· 1194 1173 mipi_dsi_host_unregister(&dsi->host); 1195 1174 pm_runtime_disable(dev); 1196 1175 clk_rate_exclusive_put(dsi->mod_clk); 1176 + 1177 + if (!IS_ERR(dsi->bus_clk)) 1178 + regmap_mmio_detach_clk(dsi->regs); 1197 1179 1198 1180 return 0; 1199 1181 } ··· 1256 1232 1257 1233 static const struct of_device_id sun6i_dsi_of_table[] = { 1258 1234 { .compatible = "allwinner,sun6i-a31-mipi-dsi" }, 1235 + { .compatible = "allwinner,sun50i-a64-mipi-dsi" }, 1259 1236 { } 1260 1237 }; 1261 1238 MODULE_DEVICE_TABLE(of, sun6i_dsi_of_table);
+5 -6
drivers/gpu/drm/vc4/vc4_gem.c
··· 568 568 for (i = 0; i < exec->bo_count; i++) { 569 569 struct drm_gem_object *bo = &exec->bo[i]->base; 570 570 571 - ww_mutex_unlock(&bo->resv->lock); 571 + dma_resv_unlock(bo->resv); 572 572 } 573 573 574 574 ww_acquire_fini(acquire_ctx); ··· 595 595 retry: 596 596 if (contended_lock != -1) { 597 597 bo = &exec->bo[contended_lock]->base; 598 - ret = ww_mutex_lock_slow_interruptible(&bo->resv->lock, 599 - acquire_ctx); 598 + ret = dma_resv_lock_slow_interruptible(bo->resv, acquire_ctx); 600 599 if (ret) { 601 600 ww_acquire_done(acquire_ctx); 602 601 return ret; ··· 608 609 609 610 bo = &exec->bo[i]->base; 610 611 611 - ret = ww_mutex_lock_interruptible(&bo->resv->lock, acquire_ctx); 612 + ret = dma_resv_lock_interruptible(bo->resv, acquire_ctx); 612 613 if (ret) { 613 614 int j; 614 615 615 616 for (j = 0; j < i; j++) { 616 617 bo = &exec->bo[j]->base; 617 - ww_mutex_unlock(&bo->resv->lock); 618 + dma_resv_unlock(bo->resv); 618 619 } 619 620 620 621 if (contended_lock != -1 && contended_lock >= i) { 621 622 bo = &exec->bo[contended_lock]->base; 622 623 623 - ww_mutex_unlock(&bo->resv->lock); 624 + dma_resv_unlock(bo->resv); 624 625 } 625 626 626 627 if (ret == -EDEADLK) {
+4 -1
drivers/gpu/drm/virtio/virtgpu_display.c
··· 43 43 #define XRES_MAX 8192 44 44 #define YRES_MAX 8192 45 45 46 + #define drm_connector_to_virtio_gpu_output(x) \ 47 + container_of(x, struct virtio_gpu_output, conn) 48 + 46 49 static const struct drm_crtc_funcs virtio_gpu_crtc_funcs = { 47 50 .set_config = drm_atomic_helper_set_config, 48 51 .destroy = drm_crtc_cleanup, ··· 62 59 .dirty = drm_atomic_helper_dirtyfb, 63 60 }; 64 61 65 - int 62 + static int 66 63 virtio_gpu_framebuffer_init(struct drm_device *dev, 67 64 struct virtio_gpu_framebuffer *vgfb, 68 65 const struct drm_mode_fb_cmd2 *mode_cmd,
+7 -18
drivers/gpu/drm/virtio/virtgpu_drv.h
··· 103 103 struct virtio_gpu_fence_driver *drv; 104 104 struct list_head node; 105 105 }; 106 - #define to_virtio_fence(x) \ 107 - container_of(x, struct virtio_gpu_fence, f) 108 106 109 107 struct virtio_gpu_vbuffer { 110 108 char *buf; ··· 133 135 }; 134 136 #define drm_crtc_to_virtio_gpu_output(x) \ 135 137 container_of(x, struct virtio_gpu_output, crtc) 136 - #define drm_connector_to_virtio_gpu_output(x) \ 137 - container_of(x, struct virtio_gpu_output, conn) 138 - #define drm_encoder_to_virtio_gpu_output(x) \ 139 - container_of(x, struct virtio_gpu_output, enc) 140 138 141 139 struct virtio_gpu_framebuffer { 142 140 struct drm_framebuffer base; ··· 176 182 struct virtio_gpu_queue cursorq; 177 183 struct kmem_cache *vbufs; 178 184 bool vqs_ready; 185 + 186 + bool disable_notify; 187 + bool pending_notify; 179 188 180 189 struct ida resource_ida; 181 190 ··· 332 335 void virtio_gpu_dequeue_cursor_func(struct work_struct *work); 333 336 void virtio_gpu_dequeue_fence_func(struct work_struct *work); 334 337 338 + void virtio_gpu_disable_notify(struct virtio_gpu_device *vgdev); 339 + void virtio_gpu_enable_notify(struct virtio_gpu_device *vgdev); 340 + 335 341 /* virtio_gpu_display.c */ 336 - int virtio_gpu_framebuffer_init(struct drm_device *dev, 337 - struct virtio_gpu_framebuffer *vgfb, 338 - const struct drm_mode_fb_cmd2 *mode_cmd, 339 - struct drm_gem_object *obj); 340 342 void virtio_gpu_modeset_init(struct virtio_gpu_device *vgdev); 341 343 void virtio_gpu_modeset_fini(struct virtio_gpu_device *vgdev); 342 344 ··· 346 350 int index); 347 351 348 352 /* virtio_gpu_fence.c */ 349 - bool virtio_fence_signaled(struct dma_fence *f); 350 353 struct virtio_gpu_fence *virtio_gpu_fence_alloc( 351 354 struct virtio_gpu_device *vgdev); 352 355 void virtio_gpu_fence_emit(struct virtio_gpu_device *vgdev, ··· 361 366 struct virtio_gpu_object_params *params, 362 367 struct virtio_gpu_object **bo_ptr, 363 368 struct virtio_gpu_fence *fence); 364 - 365 369 /* virtgpu_prime.c */ 366 370 struct drm_gem_object *virtgpu_gem_prime_import_sg_table( 367 371 struct drm_device *dev, struct dma_buf_attachment *attach, 368 372 struct sg_table *sgt); 369 373 370 - static inline u64 virtio_gpu_object_mmap_offset(struct virtio_gpu_object *bo) 371 - { 372 - return drm_vma_node_offset_addr(&bo->base.base.vma_node); 373 - } 374 - 375 - /* virgl debufs */ 374 + /* virgl debugfs */ 376 375 int virtio_gpu_debugfs_init(struct drm_minor *minor); 377 376 378 377 #endif
+4 -1
drivers/gpu/drm/virtio/virtgpu_fence.c
··· 27 27 28 28 #include "virtgpu_drv.h" 29 29 30 + #define to_virtio_fence(x) \ 31 + container_of(x, struct virtio_gpu_fence, f) 32 + 30 33 static const char *virtio_get_driver_name(struct dma_fence *f) 31 34 { 32 35 return "virtio_gpu"; ··· 40 37 return "controlq"; 41 38 } 42 39 43 - bool virtio_fence_signaled(struct dma_fence *f) 40 + static bool virtio_fence_signaled(struct dma_fence *f) 44 41 { 45 42 struct virtio_gpu_fence *fence = to_virtio_fence(f); 46 43
+1 -3
drivers/gpu/drm/virtio/virtgpu_gem.c
··· 96 96 uint32_t handle, uint64_t *offset_p) 97 97 { 98 98 struct drm_gem_object *gobj; 99 - struct virtio_gpu_object *obj; 100 99 101 100 BUG_ON(!offset_p); 102 101 gobj = drm_gem_object_lookup(file_priv, handle); 103 102 if (gobj == NULL) 104 103 return -ENOENT; 105 - obj = gem_to_virtio_gpu_obj(gobj); 106 - *offset_p = virtio_gpu_object_mmap_offset(obj); 104 + *offset_p = drm_vma_node_offset_addr(&gobj->vma_node); 107 105 drm_gem_object_put_unlocked(gobj); 108 106 return 0; 109 107 }
+51 -33
drivers/gpu/drm/virtio/virtgpu_plane.c
··· 24 24 */ 25 25 26 26 #include <drm/drm_atomic_helper.h> 27 + #include <drm/drm_damage_helper.h> 27 28 #include <drm/drm_fourcc.h> 28 29 #include <drm/drm_plane_helper.h> 29 30 ··· 89 88 struct drm_crtc_state *crtc_state; 90 89 int ret; 91 90 92 - if (!state->fb || !state->crtc) 91 + if (!state->fb || WARN_ON(!state->crtc)) 93 92 return 0; 94 93 95 94 crtc_state = drm_atomic_get_crtc_state(state->state, state->crtc); ··· 104 103 } 105 104 106 105 static void virtio_gpu_update_dumb_bo(struct virtio_gpu_device *vgdev, 107 - struct virtio_gpu_object *bo, 108 - struct drm_plane_state *state) 106 + struct drm_plane_state *state, 107 + struct drm_rect *rect) 109 108 { 109 + struct virtio_gpu_object *bo = 110 + gem_to_virtio_gpu_obj(state->fb->obj[0]); 110 111 struct virtio_gpu_object_array *objs; 112 + uint32_t w = rect->x2 - rect->x1; 113 + uint32_t h = rect->y2 - rect->y1; 114 + uint32_t x = rect->x1; 115 + uint32_t y = rect->y1; 116 + uint32_t off = x * state->fb->format->cpp[0] + 117 + y * state->fb->pitches[0]; 111 118 112 119 objs = virtio_gpu_array_alloc(1); 113 120 if (!objs) 114 121 return; 115 122 virtio_gpu_array_add_obj(objs, &bo->base.base); 116 - virtio_gpu_cmd_transfer_to_host_2d 117 - (vgdev, 0, 118 - state->src_w >> 16, 119 - state->src_h >> 16, 120 - state->src_x >> 16, 121 - state->src_y >> 16, 122 - objs, NULL); 123 + 124 + virtio_gpu_cmd_transfer_to_host_2d(vgdev, off, w, h, x, y, 125 + objs, NULL); 123 126 } 124 127 125 128 static void virtio_gpu_primary_plane_update(struct drm_plane *plane, ··· 132 127 struct drm_device *dev = plane->dev; 133 128 struct virtio_gpu_device *vgdev = dev->dev_private; 134 129 struct virtio_gpu_output *output = NULL; 135 - struct virtio_gpu_framebuffer *vgfb; 136 130 struct virtio_gpu_object *bo; 131 + struct drm_rect rect; 137 132 138 133 if (plane->state->crtc) 139 134 output = drm_crtc_to_virtio_gpu_output(plane->state->crtc); ··· 151 146 return; 152 147 } 153 148 154 - vgfb = to_virtio_gpu_framebuffer(plane->state->fb); 155 - bo = gem_to_virtio_gpu_obj(vgfb->base.obj[0]); 156 - if (bo->dumb) 157 - virtio_gpu_update_dumb_bo(vgdev, bo, plane->state); 149 + if (!drm_atomic_helper_damage_merged(old_state, plane->state, &rect)) 150 + return; 158 151 159 - DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", 160 - bo->hw_res_handle, 161 - plane->state->crtc_w, plane->state->crtc_h, 162 - plane->state->crtc_x, plane->state->crtc_y, 163 - plane->state->src_w >> 16, 164 - plane->state->src_h >> 16, 165 - plane->state->src_x >> 16, 166 - plane->state->src_y >> 16); 167 - virtio_gpu_cmd_set_scanout(vgdev, output->index, 168 - bo->hw_res_handle, 169 - plane->state->src_w >> 16, 170 - plane->state->src_h >> 16, 171 - plane->state->src_x >> 16, 172 - plane->state->src_y >> 16); 152 + virtio_gpu_disable_notify(vgdev); 153 + 154 + bo = gem_to_virtio_gpu_obj(plane->state->fb->obj[0]); 155 + if (bo->dumb) 156 + virtio_gpu_update_dumb_bo(vgdev, plane->state, &rect); 157 + 158 + if (plane->state->fb != old_state->fb || 159 + plane->state->src_w != old_state->src_w || 160 + plane->state->src_h != old_state->src_h || 161 + plane->state->src_x != old_state->src_x || 162 + plane->state->src_y != old_state->src_y) { 163 + DRM_DEBUG("handle 0x%x, crtc %dx%d+%d+%d, src %dx%d+%d+%d\n", 164 + bo->hw_res_handle, 165 + plane->state->crtc_w, plane->state->crtc_h, 166 + plane->state->crtc_x, plane->state->crtc_y, 167 + plane->state->src_w >> 16, 168 + plane->state->src_h >> 16, 169 + plane->state->src_x >> 16, 170 + plane->state->src_y >> 16); 171 + virtio_gpu_cmd_set_scanout(vgdev, output->index, 172 + bo->hw_res_handle, 173 + plane->state->src_w >> 16, 174 + plane->state->src_h >> 16, 175 + plane->state->src_x >> 16, 176 + plane->state->src_y >> 16); 177 + } 178 + 173 179 virtio_gpu_cmd_resource_flush(vgdev, bo->hw_res_handle, 174 - plane->state->src_x >> 16, 175 - plane->state->src_y >> 16, 176 - plane->state->src_w >> 16, 177 - plane->state->src_h >> 16); 180 + rect.x1, 181 + rect.y1, 182 + rect.x2 - rect.x1, 183 + rect.y2 - rect.y1); 184 + 185 + virtio_gpu_enable_notify(vgdev); 178 186 } 179 187 180 188 static int virtio_gpu_cursor_prepare_fb(struct drm_plane *plane,
+21 -2
drivers/gpu/drm/virtio/virtgpu_vq.c
··· 404 404 } 405 405 notify = virtio_gpu_queue_ctrl_buffer_locked(vgdev, vbuf, vout); 406 406 spin_unlock(&vgdev->ctrlq.qlock); 407 - if (notify) 408 - virtqueue_notify(vgdev->ctrlq.vq); 407 + if (notify) { 408 + if (vgdev->disable_notify) 409 + vgdev->pending_notify = true; 410 + else 411 + virtqueue_notify(vgdev->ctrlq.vq); 412 + } 409 413 410 414 if (sgt) { 411 415 sg_free_table(sgt); 412 416 kfree(sgt); 413 417 } 418 + } 419 + 420 + void virtio_gpu_disable_notify(struct virtio_gpu_device *vgdev) 421 + { 422 + vgdev->disable_notify = true; 423 + } 424 + 425 + void virtio_gpu_enable_notify(struct virtio_gpu_device *vgdev) 426 + { 427 + vgdev->disable_notify = false; 428 + 429 + if (!vgdev->pending_notify) 430 + return; 431 + vgdev->pending_notify = false; 432 + virtqueue_notify(vgdev->ctrlq.vq); 414 433 } 415 434 416 435 static void virtio_gpu_queue_ctrl_buffer(struct virtio_gpu_device *vgdev,
+9
include/drm/bridge/dw_mipi_dsi.h
··· 19 19 struct mipi_dsi_device; 20 20 struct platform_device; 21 21 22 + struct dw_mipi_dsi_dphy_timing { 23 + u16 data_hs2lp; 24 + u16 data_lp2hs; 25 + u16 clk_hs2lp; 26 + u16 clk_lp2hs; 27 + }; 28 + 22 29 struct dw_mipi_dsi_phy_ops { 23 30 int (*init)(void *priv_data); 24 31 void (*power_on)(void *priv_data); ··· 34 27 const struct drm_display_mode *mode, 35 28 unsigned long mode_flags, u32 lanes, u32 format, 36 29 unsigned int *lane_mbps); 30 + int (*get_timing)(void *priv_data, unsigned int lane_mbps, 31 + struct dw_mipi_dsi_dphy_timing *timing); 37 32 }; 38 33 39 34 struct dw_mipi_dsi_host_ops {
+16 -16
include/drm/drm_atomic.h
··· 35 35 * struct drm_crtc_commit - track modeset commits on a CRTC 36 36 * 37 37 * This structure is used to track pending modeset changes and atomic commit on 38 - * a per-CRTC basis. Since updating the list should never block this structure 38 + * a per-CRTC basis. Since updating the list should never block, this structure 39 39 * is reference counted to allow waiters to safely wait on an event to complete, 40 40 * without holding any locks. 41 41 * ··· 363 363 * When a connector or plane is not bound to any CRTC, it's still important 364 364 * to preserve linearity to prevent the atomic states from being freed to early. 365 365 * 366 - * This commit (if set) is not bound to any crtc, but will be completed when 366 + * This commit (if set) is not bound to any CRTC, but will be completed when 367 367 * drm_atomic_helper_commit_hw_done() is called. 368 368 */ 369 369 struct drm_crtc_commit *fake_commit; ··· 476 476 struct drm_encoder *encoder); 477 477 478 478 /** 479 - * drm_atomic_get_existing_crtc_state - get crtc state, if it exists 479 + * drm_atomic_get_existing_crtc_state - get CRTC state, if it exists 480 480 * @state: global atomic state object 481 - * @crtc: crtc to grab 481 + * @crtc: CRTC to grab 482 482 * 483 - * This function returns the crtc state for the given crtc, or NULL 484 - * if the crtc is not part of the global atomic state. 483 + * This function returns the CRTC state for the given CRTC, or NULL 484 + * if the CRTC is not part of the global atomic state. 485 485 * 486 486 * This function is deprecated, @drm_atomic_get_old_crtc_state or 487 487 * @drm_atomic_get_new_crtc_state should be used instead. ··· 494 494 } 495 495 496 496 /** 497 - * drm_atomic_get_old_crtc_state - get old crtc state, if it exists 497 + * drm_atomic_get_old_crtc_state - get old CRTC state, if it exists 498 498 * @state: global atomic state object 499 - * @crtc: crtc to grab 499 + * @crtc: CRTC to grab 500 500 * 501 - * This function returns the old crtc state for the given crtc, or 502 - * NULL if the crtc is not part of the global atomic state. 501 + * This function returns the old CRTC state for the given CRTC, or 502 + * NULL if the CRTC is not part of the global atomic state. 503 503 */ 504 504 static inline struct drm_crtc_state * 505 505 drm_atomic_get_old_crtc_state(struct drm_atomic_state *state, ··· 508 508 return state->crtcs[drm_crtc_index(crtc)].old_state; 509 509 } 510 510 /** 511 - * drm_atomic_get_new_crtc_state - get new crtc state, if it exists 511 + * drm_atomic_get_new_crtc_state - get new CRTC state, if it exists 512 512 * @state: global atomic state object 513 - * @crtc: crtc to grab 513 + * @crtc: CRTC to grab 514 514 * 515 - * This function returns the new crtc state for the given crtc, or 516 - * NULL if the crtc is not part of the global atomic state. 515 + * This function returns the new CRTC state for the given CRTC, or 516 + * NULL if the CRTC is not part of the global atomic state. 517 517 */ 518 518 static inline struct drm_crtc_state * 519 519 drm_atomic_get_new_crtc_state(struct drm_atomic_state *state, ··· 978 978 } 979 979 980 980 /** 981 - * drm_atomic_crtc_effectively_active - compute whether crtc is actually active 981 + * drm_atomic_crtc_effectively_active - compute whether CRTC is actually active 982 982 * @state: &drm_crtc_state for the CRTC 983 983 * 984 984 * When in self refresh mode, the crtc_state->active value will be false, since 985 - * the crtc is off. However in some cases we're interested in whether the crtc 985 + * the CRTC is off. However in some cases we're interested in whether the CRTC 986 986 * is active, or effectively active (ie: it's connected to an active display). 987 987 * In these cases, use this function instead of just checking active. 988 988 */
+4 -4
include/drm/drm_atomic_helper.h
··· 152 152 /** 153 153 * drm_atomic_crtc_for_each_plane - iterate over planes currently attached to CRTC 154 154 * @plane: the loop cursor 155 - * @crtc: the crtc whose planes are iterated 155 + * @crtc: the CRTC whose planes are iterated 156 156 * 157 157 * This iterates over the current state, useful (for example) when applying 158 158 * atomic state after it has been checked and swapped. To iterate over the ··· 166 166 /** 167 167 * drm_crtc_atomic_state_for_each_plane - iterate over attached planes in new state 168 168 * @plane: the loop cursor 169 - * @crtc_state: the incoming crtc-state 169 + * @crtc_state: the incoming CRTC state 170 170 * 171 171 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be 172 172 * attached if the specified state is applied. Useful during for example ··· 180 180 * drm_crtc_atomic_state_for_each_plane_state - iterate over attached planes in new state 181 181 * @plane: the loop cursor 182 182 * @plane_state: loop cursor for the plane's state, must be const 183 - * @crtc_state: the incoming crtc-state 183 + * @crtc_state: the incoming CRTC state 184 184 * 185 185 * Similar to drm_crtc_for_each_plane(), but iterates the planes that will be 186 186 * attached if the specified state is applied. Useful during for example ··· 189 189 * 190 190 * Compared to just drm_atomic_crtc_state_for_each_plane() this also fills in a 191 191 * const plane_state. This is useful when a driver just wants to peek at other 192 - * active planes on this crtc, but does not need to change it. 192 + * active planes on this CRTC, but does not need to change it. 193 193 */ 194 194 #define drm_atomic_crtc_state_for_each_plane_state(plane, plane_state, crtc_state) \ 195 195 drm_for_each_plane_mask(plane, (crtc_state)->state->dev, (crtc_state)->plane_mask) \
+8
include/drm/drm_connector.h
··· 1070 1070 unsigned int rotation_reflection; 1071 1071 1072 1072 /** 1073 + * @panel_orientation: 1074 + * 1075 + * drm-connector "panel orientation" property override value, 1076 + * DRM_MODE_PANEL_ORIENTATION_UNKNOWN if not set. 1077 + */ 1078 + enum drm_panel_orientation panel_orientation; 1079 + 1080 + /** 1073 1081 * @tv_margins: TV margins to apply to the mode. 1074 1082 */ 1075 1083 struct drm_connector_tv_margins tv_margins;
+1 -1
include/drm/drm_panel.h
··· 198 198 } 199 199 #endif 200 200 201 - #if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE) 201 + #if IS_REACHABLE(CONFIG_BACKLIGHT_CLASS_DEVICE) 202 202 int drm_panel_of_backlight(struct drm_panel *panel); 203 203 #else 204 204 static inline int drm_panel_of_backlight(struct drm_panel *panel)
+65
include/drm/drm_print.h
··· 322 322 323 323 /* 324 324 * struct device based logging 325 + * 326 + * Prefer drm_device based logging over device or prink based logging. 325 327 */ 326 328 327 329 __printf(3, 4) ··· 420 418 fmt, ##__VA_ARGS__) 421 419 422 420 /* 421 + * struct drm_device based logging 422 + * 423 + * Prefer drm_device based logging over device or prink based logging. 424 + */ 425 + 426 + /* Helper for struct drm_device based logging. */ 427 + #define __drm_printk(drm, level, type, fmt, ...) \ 428 + dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__) 429 + 430 + 431 + #define drm_info(drm, fmt, ...) \ 432 + __drm_printk((drm), info,, fmt, ##__VA_ARGS__) 433 + 434 + #define drm_notice(drm, fmt, ...) \ 435 + __drm_printk((drm), notice,, fmt, ##__VA_ARGS__) 436 + 437 + #define drm_warn(drm, fmt, ...) \ 438 + __drm_printk((drm), warn,, fmt, ##__VA_ARGS__) 439 + 440 + #define drm_err(drm, fmt, ...) \ 441 + __drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__) 442 + 443 + 444 + #define drm_info_once(drm, fmt, ...) \ 445 + __drm_printk((drm), info, _once, fmt, ##__VA_ARGS__) 446 + 447 + #define drm_notice_once(drm, fmt, ...) \ 448 + __drm_printk((drm), notice, _once, fmt, ##__VA_ARGS__) 449 + 450 + #define drm_warn_once(drm, fmt, ...) \ 451 + __drm_printk((drm), warn, _once, fmt, ##__VA_ARGS__) 452 + 453 + #define drm_err_once(drm, fmt, ...) \ 454 + __drm_printk((drm), err, _once, "*ERROR* " fmt, ##__VA_ARGS__) 455 + 456 + 457 + #define drm_err_ratelimited(drm, fmt, ...) \ 458 + __drm_printk((drm), err, _ratelimited, "*ERROR* " fmt, ##__VA_ARGS__) 459 + 460 + 461 + #define drm_dbg_core(drm, fmt, ...) \ 462 + drm_dev_dbg((drm)->dev, DRM_UT_CORE, fmt, ##__VA_ARGS__) 463 + #define drm_dbg(drm, fmt, ...) \ 464 + drm_dev_dbg((drm)->dev, DRM_UT_DRIVER, fmt, ##__VA_ARGS__) 465 + #define drm_dbg_kms(drm, fmt, ...) \ 466 + drm_dev_dbg((drm)->dev, DRM_UT_KMS, fmt, ##__VA_ARGS__) 467 + #define drm_dbg_prime(drm, fmt, ...) \ 468 + drm_dev_dbg((drm)->dev, DRM_UT_PRIME, fmt, ##__VA_ARGS__) 469 + #define drm_dbg_atomic(drm, fmt, ...) \ 470 + drm_dev_dbg((drm)->dev, DRM_UT_ATOMIC, fmt, ##__VA_ARGS__) 471 + #define drm_dbg_vbl(drm, fmt, ...) \ 472 + drm_dev_dbg((drm)->dev, DRM_UT_VBL, fmt, ##__VA_ARGS__) 473 + #define drm_dbg_state(drm, fmt, ...) \ 474 + drm_dev_dbg((drm)->dev, DRM_UT_STATE, fmt, ##__VA_ARGS__) 475 + #define drm_dbg_lease(drm, fmt, ...) \ 476 + drm_dev_dbg((drm)->dev, DRM_UT_LEASE, fmt, ##__VA_ARGS__) 477 + #define drm_dbg_dp(drm, fmt, ...) \ 478 + drm_dev_dbg((drm)->dev, DRM_UT_DP, fmt, ##__VA_ARGS__) 479 + 480 + 481 + /* 423 482 * printk based logging 483 + * 484 + * Prefer drm_device based logging over device or prink based logging. 424 485 */ 425 486 426 487 __printf(2, 3)
+2 -2
include/uapi/linux/dma-heap.h
··· 42 42 #define DMA_HEAP_IOC_MAGIC 'H' 43 43 44 44 /** 45 - * DOC: DMA_HEAP_IOC_ALLOC - allocate memory from pool 45 + * DOC: DMA_HEAP_IOCTL_ALLOC - allocate memory from pool 46 46 * 47 47 * Takes a dma_heap_allocation_data struct and returns it with the fd field 48 48 * populated with the dmabuf handle of the allocation. 49 49 */ 50 - #define DMA_HEAP_IOC_ALLOC _IOWR(DMA_HEAP_IOC_MAGIC, 0x0,\ 50 + #define DMA_HEAP_IOCTL_ALLOC _IOWR(DMA_HEAP_IOC_MAGIC, 0x0,\ 51 51 struct dma_heap_allocation_data) 52 52 53 53 #endif /* _UAPI_LINUX_DMABUF_POOL_H */
+1 -1
tools/testing/selftests/dmabuf-heaps/dmabuf-heap.c
··· 116 116 if (!dmabuf_fd) 117 117 return -EINVAL; 118 118 119 - ret = ioctl(fd, DMA_HEAP_IOC_ALLOC, &data); 119 + ret = ioctl(fd, DMA_HEAP_IOCTL_ALLOC, &data); 120 120 if (ret < 0) 121 121 return ret; 122 122 *dmabuf_fd = (int)data.fd;