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-06-26' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for v5.9:

Cross-subsystem Changes:
- Improve dma-buf docs.

Core Changes:
- Add NV15, Q410, Q401 yuv formats.
- Add uncompressed AFBC modifier.
- Add DP helepr for reading Ignore MSA from DPCD.
- Add missing panel type for some panels
- Optimize drm/mm hole handling.
- Constify connector to infoframe functions.
- Add debugfs for VRR monitor range.

Driver Changes:
- Assorted small bugfixes in panfrost, malidp, panel/otm8009a.
- Convert tfp410 dt bindings to yaml, and rework time calculations.
- Add support for a few more simple panels.
- Cleanups and optimizations for ast.
- Allow adv7511 and simple-bridge to be used without connector creation.
- Cleanups to dw-hdmi function prototypes.
- Remove enabled bool from tiny/repaper and mipi-dbi, atomic handles it.
- Remove unused header file from dw-mipi-dsi
- Begin removing ttm_bo->offset.

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

From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/b1e53620-7937-895c-bfcf-ed208be59c7c@linux.intel.com

+1007 -676
-66
Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt
··· 1 - TFP410 DPI to DVI encoder 2 - ========================= 3 - 4 - Required properties: 5 - - compatible: "ti,tfp410" 6 - 7 - Optional properties: 8 - - powerdown-gpios: power-down gpio 9 - - reg: I2C address. If and only if present the device node should be placed 10 - into the I2C controller node where the TFP410 I2C is connected to. 11 - - ti,deskew: data de-skew in 350ps increments, from -4 to +3, as configured 12 - through th DK[3:1] pins. This property shall be present only if the TFP410 13 - is not connected through I2C. 14 - 15 - Required nodes: 16 - 17 - This device has two video ports. Their connections are modeled using the OF 18 - graph bindings specified in [1]. Each port node shall have a single endpoint. 19 - 20 - - Port 0 is the DPI input port. Its endpoint subnode shall contain a 21 - pclk-sample and bus-width property and a remote-endpoint property as specified 22 - in [1]. 23 - - If pclk-sample is not defined, pclk-sample = 0 should be assumed for 24 - backward compatibility. 25 - - If bus-width is not defined then bus-width = 24 should be assumed for 26 - backward compatibility. 27 - bus-width = 24: 24 data lines are connected and single-edge mode 28 - bus-width = 12: 12 data lines are connected and dual-edge mode 29 - 30 - - Port 1 is the DVI output port. Its endpoint subnode shall contain a 31 - remote-endpoint property is specified in [1]. 32 - 33 - [1] Documentation/devicetree/bindings/media/video-interfaces.txt 34 - 35 - 36 - Example 37 - ------- 38 - 39 - tfp410: encoder@0 { 40 - compatible = "ti,tfp410"; 41 - powerdown-gpios = <&twl_gpio 2 GPIO_ACTIVE_LOW>; 42 - ti,deskew = <4>; 43 - 44 - ports { 45 - #address-cells = <1>; 46 - #size-cells = <0>; 47 - 48 - port@0 { 49 - reg = <0>; 50 - 51 - tfp410_in: endpoint@0 { 52 - pclk-sample = <1>; 53 - bus-width = <24>; 54 - remote-endpoint = <&dpi_out>; 55 - }; 56 - }; 57 - 58 - port@1 { 59 - reg = <1>; 60 - 61 - tfp410_out: endpoint@0 { 62 - remote-endpoint = <&dvi_connector_in>; 63 - }; 64 - }; 65 - }; 66 - };
+131
Documentation/devicetree/bindings/display/bridge/ti,tfp410.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/display/bridge/ti,tfp410.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: TFP410 DPI to DVI encoder 8 + 9 + maintainers: 10 + - Tomi Valkeinen <tomi.valkeinen@ti.com> 11 + - Jyri Sarha <jsarha@ti.com> 12 + 13 + properties: 14 + compatible: 15 + const: ti,tfp410 16 + 17 + reg: 18 + description: I2C address of the device. 19 + maxItems: 1 20 + 21 + powerdown-gpios: 22 + maxItems: 1 23 + 24 + ti,deskew: 25 + description: 26 + Data de-skew value in 350ps increments, from 0 to 7, as configured 27 + through the DK[3:1] pins. The de-skew multiplier is computed as 28 + (DK[3:1] - 4), so it ranges from -4 to 3. 29 + $ref: /schemas/types.yaml#/definitions/uint32 30 + minimum: 0 31 + maximum: 7 32 + 33 + ports: 34 + description: 35 + A node containing input and output port nodes with endpoint 36 + definitions as documented in 37 + Documentation/devicetree/bindings/media/video-interfaces.txt 38 + type: object 39 + 40 + properties: 41 + port@0: 42 + description: DPI input port. 43 + type: object 44 + 45 + properties: 46 + reg: 47 + const: 0 48 + 49 + endpoint: 50 + type: object 51 + 52 + properties: 53 + pclk-sample: 54 + description: 55 + Endpoint sampling edge. 56 + enum: 57 + - 0 # Falling edge 58 + - 1 # Rising edge 59 + default: 0 60 + 61 + bus-width: 62 + description: 63 + Endpoint bus width. 64 + enum: 65 + - 12 # 12 data lines connected and dual-edge mode 66 + - 24 # 24 data lines connected and single-edge mode 67 + default: 24 68 + 69 + port@1: 70 + description: DVI output port. 71 + type: object 72 + 73 + properties: 74 + reg: 75 + const: 1 76 + 77 + endpoint: 78 + type: object 79 + 80 + required: 81 + - port@0 82 + - port@1 83 + 84 + required: 85 + - compatible 86 + - ports 87 + 88 + if: 89 + required: 90 + - reg 91 + then: 92 + properties: 93 + ti,deskew: false 94 + else: 95 + required: 96 + - ti,deskew 97 + 98 + additionalProperties: false 99 + 100 + examples: 101 + - | 102 + #include <dt-bindings/gpio/gpio.h> 103 + 104 + tfp410: encoder { 105 + compatible = "ti,tfp410"; 106 + powerdown-gpios = <&twl_gpio 2 GPIO_ACTIVE_LOW>; 107 + ti,deskew = <3>; 108 + 109 + ports { 110 + #address-cells = <1>; 111 + #size-cells = <0>; 112 + 113 + port@0 { 114 + reg = <0>; 115 + tfp410_in: endpoint { 116 + pclk-sample = <1>; 117 + bus-width = <24>; 118 + remote-endpoint = <&dpi_out>; 119 + }; 120 + }; 121 + 122 + port@1 { 123 + reg = <1>; 124 + tfp410_out: endpoint { 125 + remote-endpoint = <&dvi_connector_in>; 126 + }; 127 + }; 128 + }; 129 + }; 130 + 131 + ...
+6
Documentation/devicetree/bindings/display/panel/panel-simple.yaml
··· 81 81 - boe,nv140fhmn49 82 82 # CDTech(H.K.) Electronics Limited 4.3" 480x272 color TFT-LCD panel 83 83 - cdtech,s043wq26h-ct7 84 + # CDTech(H.K.) Electronics Limited 7" WSVGA (1024x600) TFT LCD Panel 85 + - cdtech,s070pws19hp-fc21 86 + # CDTech(H.K.) Electronics Limited 7" WVGA (800x480) TFT LCD Panel 87 + - cdtech,s070swv29hg-dc44 84 88 # CDTech(H.K.) Electronics Limited 7" 800x480 color TFT-LCD panel 85 89 - cdtech,s070wv95-ct16 86 90 # Chunghwa Picture Tubes Ltd. 7" WXGA TFT LCD panel ··· 251 247 - starry,kr122ea0sra 252 248 # Tianma Micro-electronics TM070JDHG30 7.0" WXGA TFT LCD panel 253 249 - tianma,tm070jdhg30 250 + # Tianma Micro-electronics TM070JVHG33 7.0" WXGA TFT LCD panel 251 + - tianma,tm070jvhg33 254 252 # Tianma Micro-electronics TM070RVHG71 7.0" WXGA TFT LCD panel 255 253 - tianma,tm070rvhg71 256 254 # Toshiba 8.9" WXGA (1280x768) TFT LCD panel
+3 -3
Documentation/driver-api/dma-buf.rst
··· 100 100 .. kernel-doc:: drivers/dma-buf/dma-buf.c 101 101 :doc: cpu access 102 102 103 - Fence Poll Support 104 - ~~~~~~~~~~~~~~~~~~ 103 + Implicit Fence Poll Support 104 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ 105 105 106 106 .. kernel-doc:: drivers/dma-buf/dma-buf.c 107 - :doc: fence polling 107 + :doc: implicit fence polling 108 108 109 109 Kernel Functions and Structures Reference 110 110 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+3 -3
drivers/dma-buf/dma-buf.c
··· 161 161 } 162 162 163 163 /** 164 - * DOC: fence polling 164 + * DOC: implicit fence polling 165 165 * 166 166 * To support cross-device and cross-driver synchronization of buffer access 167 - * implicit fences (represented internally in the kernel with &struct fence) can 168 - * be attached to a &dma_buf. The glue for that and a few related things are 167 + * implicit fences (represented internally in the kernel with &struct dma_fence) 168 + * can be attached to a &dma_buf. The glue for that and a few related things are 169 169 * provided in the &dma_resv structure. 170 170 * 171 171 * Userspace can query the state of these implicitly tracked fences using poll()
+21 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
··· 918 918 bo->pin_count++; 919 919 920 920 if (max_offset != 0) { 921 - u64 domain_start = bo->tbo.bdev->man[mem_type].gpu_offset; 921 + u64 domain_start = amdgpu_ttm_domain_start(adev, 922 + mem_type); 922 923 WARN_ON_ONCE(max_offset < 923 924 (amdgpu_bo_gpu_offset(bo) - domain_start)); 924 925 } ··· 1485 1484 WARN_ON_ONCE(bo->tbo.mem.mem_type == TTM_PL_VRAM && 1486 1485 !(bo->flags & AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS)); 1487 1486 1488 - return amdgpu_gmc_sign_extend(bo->tbo.offset); 1487 + return amdgpu_bo_gpu_offset_no_check(bo); 1488 + } 1489 + 1490 + /** 1491 + * amdgpu_bo_gpu_offset_no_check - return GPU offset of bo 1492 + * @bo: amdgpu object for which we query the offset 1493 + * 1494 + * Returns: 1495 + * current GPU offset of the object without raising warnings. 1496 + */ 1497 + u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo) 1498 + { 1499 + struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); 1500 + uint64_t offset; 1501 + 1502 + offset = (bo->tbo.mem.start << PAGE_SHIFT) + 1503 + amdgpu_ttm_domain_start(adev, bo->tbo.mem.mem_type); 1504 + 1505 + return amdgpu_gmc_sign_extend(offset); 1489 1506 } 1490 1507 1491 1508 /**
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_object.h
··· 293 293 bool intr); 294 294 int amdgpu_bo_sync_wait(struct amdgpu_bo *bo, void *owner, bool intr); 295 295 u64 amdgpu_bo_gpu_offset(struct amdgpu_bo *bo); 296 + u64 amdgpu_bo_gpu_offset_no_check(struct amdgpu_bo *bo); 296 297 int amdgpu_bo_validate(struct amdgpu_bo *bo); 297 298 int amdgpu_bo_restore_shadow(struct amdgpu_bo *shadow, 298 299 struct dma_fence **fence);
+23 -7
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
··· 91 91 case TTM_PL_TT: 92 92 /* GTT memory */ 93 93 man->func = &amdgpu_gtt_mgr_func; 94 - man->gpu_offset = adev->gmc.gart_start; 95 94 man->available_caching = TTM_PL_MASK_CACHING; 96 95 man->default_caching = TTM_PL_FLAG_CACHED; 97 96 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA; ··· 98 99 case TTM_PL_VRAM: 99 100 /* "On-card" video ram */ 100 101 man->func = &amdgpu_vram_mgr_func; 101 - man->gpu_offset = adev->gmc.vram_start; 102 102 man->flags = TTM_MEMTYPE_FLAG_FIXED | 103 103 TTM_MEMTYPE_FLAG_MAPPABLE; 104 104 man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC; ··· 108 110 case AMDGPU_PL_OA: 109 111 /* On-chip GDS memory*/ 110 112 man->func = &ttm_bo_manager_func; 111 - man->gpu_offset = 0; 112 113 man->flags = TTM_MEMTYPE_FLAG_FIXED | TTM_MEMTYPE_FLAG_CMA; 113 114 man->available_caching = TTM_PL_FLAG_UNCACHED; 114 115 man->default_caching = TTM_PL_FLAG_UNCACHED; ··· 255 258 256 259 if (mm_node->start != AMDGPU_BO_INVALID_OFFSET) { 257 260 addr = mm_node->start << PAGE_SHIFT; 258 - addr += bo->bdev->man[mem->mem_type].gpu_offset; 261 + addr += amdgpu_ttm_domain_start(amdgpu_ttm_adev(bo->bdev), 262 + mem->mem_type); 259 263 } 260 264 return addr; 261 265 } ··· 841 843 (offset >> PAGE_SHIFT); 842 844 } 843 845 846 + /** 847 + * amdgpu_ttm_domain_start - Returns GPU start address 848 + * @adev: amdgpu device object 849 + * @type: type of the memory 850 + * 851 + * Returns: 852 + * GPU start address of a memory domain 853 + */ 854 + 855 + uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type) 856 + { 857 + switch (type) { 858 + case TTM_PL_TT: 859 + return adev->gmc.gart_start; 860 + case TTM_PL_VRAM: 861 + return adev->gmc.vram_start; 862 + } 863 + 864 + return 0; 865 + } 866 + 844 867 /* 845 868 * TTM backend functions. 846 869 */ ··· 1257 1238 ttm_bo_mem_put(bo, &bo->mem); 1258 1239 bo->mem = tmp; 1259 1240 } 1260 - 1261 - bo->offset = (bo->mem.start << PAGE_SHIFT) + 1262 - bo->bdev->man[bo->mem.mem_type].gpu_offset; 1263 1241 1264 1242 return 0; 1265 1243 }
+1
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.h
··· 112 112 int amdgpu_mmap(struct file *filp, struct vm_area_struct *vma); 113 113 int amdgpu_ttm_alloc_gart(struct ttm_buffer_object *bo); 114 114 int amdgpu_ttm_recover_gart(struct ttm_buffer_object *tbo); 115 + uint64_t amdgpu_ttm_domain_start(struct amdgpu_device *adev, uint32_t type); 115 116 116 117 #if IS_ENABLED(CONFIG_DRM_AMDGPU_USERPTR) 117 118 int amdgpu_ttm_tt_get_user_pages(struct amdgpu_bo *bo, struct page **pages);
+2 -2
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
··· 144 144 145 145 src += p->num_dw_left * 4; 146 146 147 - pe += amdgpu_gmc_sign_extend(bo->tbo.offset); 147 + pe += amdgpu_bo_gpu_offset_no_check(bo); 148 148 trace_amdgpu_vm_copy_ptes(pe, src, count, p->immediate); 149 149 150 150 amdgpu_vm_copy_pte(p->adev, ib, pe, src, count); ··· 171 171 { 172 172 struct amdgpu_ib *ib = p->job->ibs; 173 173 174 - pe += amdgpu_gmc_sign_extend(bo->tbo.offset); 174 + pe += amdgpu_bo_gpu_offset_no_check(bo); 175 175 trace_amdgpu_vm_set_ptes(pe, addr, count, incr, flags, p->immediate); 176 176 if (count < 3) { 177 177 amdgpu_vm_write_pte(p->adev, ib, pe, addr | flags,
+1 -1
drivers/gpu/drm/arm/malidp_planes.c
··· 928 928 const struct malidp_hw_regmap *map = &malidp->dev->hw->map; 929 929 struct malidp_plane *plane = NULL; 930 930 enum drm_plane_type plane_type; 931 - unsigned long crtcs = 1 << drm->mode_config.num_crtc; 931 + unsigned long crtcs = BIT(drm->mode_config.num_crtc); 932 932 unsigned long flags = DRM_MODE_ROTATE_0 | DRM_MODE_ROTATE_90 | DRM_MODE_ROTATE_180 | 933 933 DRM_MODE_ROTATE_270 | DRM_MODE_REFLECT_X | DRM_MODE_REFLECT_Y; 934 934 unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) |
+12 -12
drivers/gpu/drm/ast/ast_dp501.c
··· 10 10 11 11 static int ast_load_dp501_microcode(struct drm_device *dev) 12 12 { 13 - struct ast_private *ast = dev->dev_private; 13 + struct ast_private *ast = to_ast_private(dev); 14 14 15 15 return request_firmware(&ast->dp501_fw, "ast_dp501_fw.bin", dev->dev); 16 16 } ··· 93 93 94 94 static bool ast_write_cmd(struct drm_device *dev, u8 data) 95 95 { 96 - struct ast_private *ast = dev->dev_private; 96 + struct ast_private *ast = to_ast_private(dev); 97 97 int retry = 0; 98 98 if (wait_nack(ast)) { 99 99 send_nack(ast); ··· 115 115 116 116 static bool ast_write_data(struct drm_device *dev, u8 data) 117 117 { 118 - struct ast_private *ast = dev->dev_private; 118 + struct ast_private *ast = to_ast_private(dev); 119 119 120 120 if (wait_nack(ast)) { 121 121 send_nack(ast); ··· 133 133 #if 0 134 134 static bool ast_read_data(struct drm_device *dev, u8 *data) 135 135 { 136 - struct ast_private *ast = dev->dev_private; 136 + struct ast_private *ast = to_ast_private(dev); 137 137 u8 tmp; 138 138 139 139 *data = 0; ··· 172 172 173 173 bool ast_backup_fw(struct drm_device *dev, u8 *addr, u32 size) 174 174 { 175 - struct ast_private *ast = dev->dev_private; 175 + struct ast_private *ast = to_ast_private(dev); 176 176 u32 i, data; 177 177 u32 boot_address; 178 178 ··· 188 188 189 189 static bool ast_launch_m68k(struct drm_device *dev) 190 190 { 191 - struct ast_private *ast = dev->dev_private; 191 + struct ast_private *ast = to_ast_private(dev); 192 192 u32 i, data, len = 0; 193 193 u32 boot_address; 194 194 u8 *fw_addr = NULL; ··· 255 255 256 256 u8 ast_get_dp501_max_clk(struct drm_device *dev) 257 257 { 258 - struct ast_private *ast = dev->dev_private; 258 + struct ast_private *ast = to_ast_private(dev); 259 259 u32 boot_address, offset, data; 260 260 u8 linkcap[4], linkrate, linklanes, maxclk = 0xff; 261 261 ··· 283 283 284 284 bool ast_dp501_read_edid(struct drm_device *dev, u8 *ediddata) 285 285 { 286 - struct ast_private *ast = dev->dev_private; 286 + struct ast_private *ast = to_ast_private(dev); 287 287 u32 i, boot_address, offset, data; 288 288 289 289 boot_address = get_fw_base(ast); ··· 312 312 313 313 static bool ast_init_dvo(struct drm_device *dev) 314 314 { 315 - struct ast_private *ast = dev->dev_private; 315 + struct ast_private *ast = to_ast_private(dev); 316 316 u8 jreg; 317 317 u32 data; 318 318 ast_write32(ast, 0xf004, 0x1e6e0000); ··· 385 385 386 386 static void ast_init_analog(struct drm_device *dev) 387 387 { 388 - struct ast_private *ast = dev->dev_private; 388 + struct ast_private *ast = to_ast_private(dev); 389 389 u32 data; 390 390 391 391 /* ··· 412 412 413 413 void ast_init_3rdtx(struct drm_device *dev) 414 414 { 415 - struct ast_private *ast = dev->dev_private; 415 + struct ast_private *ast = to_ast_private(dev); 416 416 u8 jreg; 417 417 418 418 if (ast->chip == AST2300 || ast->chip == AST2400) { ··· 438 438 439 439 void ast_release_firmware(struct drm_device *dev) 440 440 { 441 - struct ast_private *ast = dev->dev_private; 441 + struct ast_private *ast = to_ast_private(dev); 442 442 443 443 release_firmware(ast->dp501_fw); 444 444 ast->dp501_fw = NULL;
-4
drivers/gpu/drm/ast/ast_drv.c
··· 59 59 static const struct pci_device_id pciidlist[] = { 60 60 AST_VGA_DEVICE(PCI_CHIP_AST2000, NULL), 61 61 AST_VGA_DEVICE(PCI_CHIP_AST2100, NULL), 62 - /* AST_VGA_DEVICE(PCI_CHIP_AST1180, NULL), - don't bind to 1180 for now */ 63 62 {0, 0, 0}, 64 63 }; 65 64 ··· 188 189 { 189 190 struct pci_dev *pdev = to_pci_dev(dev); 190 191 struct drm_device *ddev = pci_get_drvdata(pdev); 191 - 192 - if (!ddev || !ddev->dev_private) 193 - return -ENODEV; 194 192 return ast_drm_freeze(ddev); 195 193 } 196 194
+5 -2
drivers/gpu/drm/ast/ast_drv.h
··· 52 52 53 53 #define PCI_CHIP_AST2000 0x2000 54 54 #define PCI_CHIP_AST2100 0x2010 55 - #define PCI_CHIP_AST1180 0x1180 56 55 57 56 58 57 enum ast_chip { ··· 63 64 AST2300, 64 65 AST2400, 65 66 AST2500, 66 - AST1180, 67 67 }; 68 68 69 69 enum ast_tx_chip { ··· 135 137 u8 *dp501_fw_addr; 136 138 const struct firmware *dp501_fw; /* dp501 fw */ 137 139 }; 140 + 141 + static inline struct ast_private *to_ast_private(struct drm_device *dev) 142 + { 143 + return dev->dev_private; 144 + } 138 145 139 146 int ast_driver_load(struct drm_device *dev, unsigned long flags); 140 147 void ast_driver_unload(struct drm_device *dev);
+52 -63
drivers/gpu/drm/ast/ast_main.c
··· 67 67 static void ast_detect_config_mode(struct drm_device *dev, u32 *scu_rev) 68 68 { 69 69 struct device_node *np = dev->pdev->dev.of_node; 70 - struct ast_private *ast = dev->dev_private; 70 + struct ast_private *ast = to_ast_private(dev); 71 71 uint32_t data, jregd0, jregd1; 72 72 73 73 /* Defaults */ ··· 79 79 scu_rev)) { 80 80 /* We do, disable P2A access */ 81 81 ast->config_mode = ast_use_dt; 82 - DRM_INFO("Using device-tree for configuration\n"); 82 + drm_info(dev, "Using device-tree for configuration\n"); 83 83 return; 84 84 } 85 85 ··· 101 101 /* P2A works, grab silicon revision */ 102 102 ast->config_mode = ast_use_p2a; 103 103 104 - DRM_INFO("Using P2A bridge for configuration\n"); 104 + drm_info(dev, "Using P2A bridge for configuration\n"); 105 105 106 106 /* Read SCU7c (silicon revision register) */ 107 107 ast_write32(ast, 0xf004, 0x1e6e0000); ··· 112 112 } 113 113 114 114 /* We have a P2A bridge but it's disabled */ 115 - DRM_INFO("P2A bridge disabled, using default configuration\n"); 115 + drm_info(dev, "P2A bridge disabled, using default configuration\n"); 116 116 } 117 117 118 118 static int ast_detect_chip(struct drm_device *dev, bool *need_post) 119 119 { 120 - struct ast_private *ast = dev->dev_private; 120 + struct ast_private *ast = to_ast_private(dev); 121 121 uint32_t jreg, scu_rev; 122 122 123 123 /* ··· 128 128 */ 129 129 if (!ast_is_vga_enabled(dev)) { 130 130 ast_enable_vga(dev); 131 - DRM_INFO("VGA not enabled on entry, requesting chip POST\n"); 131 + drm_info(dev, "VGA not enabled on entry, requesting chip POST\n"); 132 132 *need_post = true; 133 133 } else 134 134 *need_post = false; ··· 142 142 ast_detect_config_mode(dev, &scu_rev); 143 143 144 144 /* Identify chipset */ 145 - if (dev->pdev->device == PCI_CHIP_AST1180) { 146 - ast->chip = AST1100; 147 - DRM_INFO("AST 1180 detected\n"); 148 - } else { 149 - if (dev->pdev->revision >= 0x40) { 150 - ast->chip = AST2500; 151 - DRM_INFO("AST 2500 detected\n"); 152 - } else if (dev->pdev->revision >= 0x30) { 153 - ast->chip = AST2400; 154 - DRM_INFO("AST 2400 detected\n"); 155 - } else if (dev->pdev->revision >= 0x20) { 156 - ast->chip = AST2300; 157 - DRM_INFO("AST 2300 detected\n"); 158 - } else if (dev->pdev->revision >= 0x10) { 159 - switch (scu_rev & 0x0300) { 160 - case 0x0200: 161 - ast->chip = AST1100; 162 - DRM_INFO("AST 1100 detected\n"); 163 - break; 164 - case 0x0100: 165 - ast->chip = AST2200; 166 - DRM_INFO("AST 2200 detected\n"); 167 - break; 168 - case 0x0000: 169 - ast->chip = AST2150; 170 - DRM_INFO("AST 2150 detected\n"); 171 - break; 172 - default: 173 - ast->chip = AST2100; 174 - DRM_INFO("AST 2100 detected\n"); 175 - break; 176 - } 177 - ast->vga2_clone = false; 178 - } else { 179 - ast->chip = AST2000; 180 - DRM_INFO("AST 2000 detected\n"); 145 + if (dev->pdev->revision >= 0x40) { 146 + ast->chip = AST2500; 147 + drm_info(dev, "AST 2500 detected\n"); 148 + } else if (dev->pdev->revision >= 0x30) { 149 + ast->chip = AST2400; 150 + drm_info(dev, "AST 2400 detected\n"); 151 + } else if (dev->pdev->revision >= 0x20) { 152 + ast->chip = AST2300; 153 + drm_info(dev, "AST 2300 detected\n"); 154 + } else if (dev->pdev->revision >= 0x10) { 155 + switch (scu_rev & 0x0300) { 156 + case 0x0200: 157 + ast->chip = AST1100; 158 + drm_info(dev, "AST 1100 detected\n"); 159 + break; 160 + case 0x0100: 161 + ast->chip = AST2200; 162 + drm_info(dev, "AST 2200 detected\n"); 163 + break; 164 + case 0x0000: 165 + ast->chip = AST2150; 166 + drm_info(dev, "AST 2150 detected\n"); 167 + break; 168 + default: 169 + ast->chip = AST2100; 170 + drm_info(dev, "AST 2100 detected\n"); 171 + break; 181 172 } 173 + ast->vga2_clone = false; 174 + } else { 175 + ast->chip = AST2000; 176 + drm_info(dev, "AST 2000 detected\n"); 182 177 } 183 178 184 179 /* Check if we support wide screen */ 185 180 switch (ast->chip) { 186 - case AST1180: 187 - ast->support_wide_screen = true; 188 - break; 189 181 case AST2000: 190 182 ast->support_wide_screen = false; 191 183 break; ··· 248 256 /* Print stuff for diagnostic purposes */ 249 257 switch(ast->tx_chip_type) { 250 258 case AST_TX_SIL164: 251 - DRM_INFO("Using Sil164 TMDS transmitter\n"); 259 + drm_info(dev, "Using Sil164 TMDS transmitter\n"); 252 260 break; 253 261 case AST_TX_DP501: 254 - DRM_INFO("Using DP501 DisplayPort transmitter\n"); 262 + drm_info(dev, "Using DP501 DisplayPort transmitter\n"); 255 263 break; 256 264 default: 257 - DRM_INFO("Analog VGA only\n"); 265 + drm_info(dev, "Analog VGA only\n"); 258 266 } 259 267 return 0; 260 268 } ··· 262 270 static int ast_get_dram_info(struct drm_device *dev) 263 271 { 264 272 struct device_node *np = dev->pdev->dev.of_node; 265 - struct ast_private *ast = dev->dev_private; 273 + struct ast_private *ast = to_ast_private(dev); 266 274 uint32_t mcr_cfg, mcr_scu_mpll, mcr_scu_strap; 267 275 uint32_t denum, num, div, ref_pll, dsel; 268 276 ··· 388 396 389 397 static u32 ast_get_vram_info(struct drm_device *dev) 390 398 { 391 - struct ast_private *ast = dev->dev_private; 399 + struct ast_private *ast = to_ast_private(dev); 392 400 u8 jreg; 393 401 u32 vram_size; 394 402 ast_open_key(ast); ··· 443 451 * and higher). 444 452 */ 445 453 if (!(pci_resource_flags(dev->pdev, 2) & IORESOURCE_IO)) { 446 - DRM_INFO("platform has no IO space, trying MMIO\n"); 454 + drm_info(dev, "platform has no IO space, trying MMIO\n"); 447 455 ast->ioregs = ast->regs + AST_IO_MM_OFFSET; 448 456 } 449 457 ··· 461 469 if (need_post) 462 470 ast_post_gpu(dev); 463 471 464 - if (ast->chip != AST1180) { 465 - ret = ast_get_dram_info(dev); 466 - if (ret) 467 - goto out_free; 468 - ast->vram_size = ast_get_vram_info(dev); 469 - DRM_INFO("dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", 470 - ast->mclk, ast->dram_type, 471 - ast->dram_bus_width, ast->vram_size); 472 - } 472 + ret = ast_get_dram_info(dev); 473 + if (ret) 474 + goto out_free; 475 + ast->vram_size = ast_get_vram_info(dev); 476 + drm_info(dev, "dram MCLK=%u Mhz type=%d bus_width=%d size=%08x\n", 477 + ast->mclk, ast->dram_type, 478 + ast->dram_bus_width, ast->vram_size); 473 479 474 480 ret = ast_mm_init(ast); 475 481 if (ret) ··· 486 496 ast->chip == AST2200 || 487 497 ast->chip == AST2300 || 488 498 ast->chip == AST2400 || 489 - ast->chip == AST2500 || 490 - ast->chip == AST1180) { 499 + ast->chip == AST2500) { 491 500 dev->mode_config.max_width = 1920; 492 501 dev->mode_config.max_height = 2048; 493 502 } else { ··· 509 520 510 521 void ast_driver_unload(struct drm_device *dev) 511 522 { 512 - struct ast_private *ast = dev->dev_private; 523 + struct ast_private *ast = to_ast_private(dev); 513 524 514 525 /* enable standard VGA decode */ 515 526 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
+34 -39
drivers/gpu/drm/ast/ast_mode.c
··· 566 566 ast_primary_plane_helper_atomic_update(struct drm_plane *plane, 567 567 struct drm_plane_state *old_state) 568 568 { 569 - struct ast_private *ast = plane->dev->dev_private; 569 + struct drm_device *dev = plane->dev; 570 + struct ast_private *ast = to_ast_private(dev); 570 571 struct drm_plane_state *state = plane->state; 571 572 struct drm_gem_vram_object *gbo; 572 573 s64 gpu_addr; 573 574 574 575 gbo = drm_gem_vram_of_gem(state->fb->obj[0]); 575 576 gpu_addr = drm_gem_vram_offset(gbo); 576 - if (WARN_ON_ONCE(gpu_addr < 0)) 577 + if (drm_WARN_ON_ONCE(dev, gpu_addr < 0)) 577 578 return; /* Bug: we didn't pin the BO to VRAM in prepare_fb. */ 578 579 579 580 ast_set_offset_reg(ast, state->fb); ··· 587 586 ast_primary_plane_helper_atomic_disable(struct drm_plane *plane, 588 587 struct drm_plane_state *old_state) 589 588 { 590 - struct ast_private *ast = plane->dev->dev_private; 589 + struct ast_private *ast = to_ast_private(plane->dev); 591 590 592 591 ast_set_index_reg_mask(ast, AST_IO_SEQ_PORT, 0x1, 0xdf, 0x20); 593 592 } ··· 621 620 ast_cursor_plane_helper_prepare_fb(struct drm_plane *plane, 622 621 struct drm_plane_state *new_state) 623 622 { 623 + struct drm_device *dev = plane->dev; 624 624 struct drm_framebuffer *fb = new_state->fb; 625 625 struct drm_crtc *crtc = new_state->crtc; 626 626 struct drm_gem_vram_object *gbo; ··· 632 630 if (!crtc || !fb) 633 631 return 0; 634 632 635 - if (WARN_ON_ONCE(fb->width > AST_MAX_HWC_WIDTH) || 636 - WARN_ON_ONCE(fb->height > AST_MAX_HWC_HEIGHT)) 633 + if (drm_WARN_ON_ONCE(dev, fb->width > AST_MAX_HWC_WIDTH) || 634 + drm_WARN_ON_ONCE(dev, fb->height > AST_MAX_HWC_HEIGHT)) 637 635 return -EINVAL; /* BUG: didn't test in atomic_check() */ 638 636 639 - ast = crtc->dev->dev_private; 637 + ast = to_ast_private(dev); 640 638 641 639 gbo = drm_gem_vram_of_gem(fb->obj[0]); 642 640 src = drm_gem_vram_vmap(gbo); ··· 705 703 ast_cursor_plane_helper_atomic_update(struct drm_plane *plane, 706 704 struct drm_plane_state *old_state) 707 705 { 706 + struct drm_device *dev = plane->dev; 708 707 struct drm_plane_state *state = plane->state; 709 708 struct drm_crtc *crtc = state->crtc; 710 709 struct drm_framebuffer *fb = state->fb; 711 - struct ast_private *ast = plane->dev->dev_private; 710 + struct ast_private *ast = to_ast_private(plane->dev); 712 711 struct ast_crtc *ast_crtc = to_ast_crtc(crtc); 713 712 struct drm_gem_vram_object *gbo; 714 713 s64 off; ··· 722 719 /* A new cursor image was installed. */ 723 720 gbo = ast->cursor.gbo[ast->cursor.next_index]; 724 721 off = drm_gem_vram_offset(gbo); 725 - if (WARN_ON_ONCE(off < 0)) 722 + if (drm_WARN_ON_ONCE(dev, off < 0)) 726 723 return; /* Bug: we didn't pin cursor HW BO to VRAM. */ 727 724 ast_cursor_set_base(ast, off); 728 725 ··· 742 739 ast_cursor_plane_helper_atomic_disable(struct drm_plane *plane, 743 740 struct drm_plane_state *old_state) 744 741 { 745 - struct ast_private *ast = plane->dev->dev_private; 742 + struct ast_private *ast = to_ast_private(plane->dev); 746 743 747 744 ast_set_index_reg_mask(ast, AST_IO_CRTC_PORT, 0xcb, 0xfc, 0x00); 748 745 } ··· 770 767 771 768 static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) 772 769 { 773 - struct ast_private *ast = crtc->dev->dev_private; 774 - 775 - if (ast->chip == AST1180) 776 - return; 770 + struct ast_private *ast = to_ast_private(crtc->dev); 777 771 778 772 /* TODO: Maybe control display signal generation with 779 773 * Sync Enable (bit CR17.7). ··· 793 793 static int ast_crtc_helper_atomic_check(struct drm_crtc *crtc, 794 794 struct drm_crtc_state *state) 795 795 { 796 - struct ast_private *ast = crtc->dev->dev_private; 797 796 struct ast_crtc_state *ast_state; 798 797 const struct drm_format_info *format; 799 798 bool succ; 800 - 801 - if (ast->chip == AST1180) { 802 - DRM_ERROR("AST 1180 modesetting not supported\n"); 803 - return -EINVAL; 804 - } 805 799 806 800 if (!state->enable) 807 801 return 0; /* no mode checks if CRTC is being disabled */ ··· 818 824 static void ast_crtc_helper_atomic_begin(struct drm_crtc *crtc, 819 825 struct drm_crtc_state *old_crtc_state) 820 826 { 821 - struct ast_private *ast = crtc->dev->dev_private; 827 + struct ast_private *ast = to_ast_private(crtc->dev); 822 828 823 829 ast_open_key(ast); 824 830 } ··· 827 833 struct drm_crtc_state *old_crtc_state) 828 834 { 829 835 struct drm_device *dev = crtc->dev; 830 - struct ast_private *ast = dev->dev_private; 836 + struct ast_private *ast = to_ast_private(dev); 831 837 struct ast_crtc_state *ast_state; 832 838 const struct drm_format_info *format; 833 839 struct ast_vbios_mode_info *vbios_mode_info; ··· 901 907 ast_crtc_atomic_duplicate_state(struct drm_crtc *crtc) 902 908 { 903 909 struct ast_crtc_state *new_ast_state, *ast_state; 910 + struct drm_device *dev = crtc->dev; 904 911 905 - if (WARN_ON(!crtc->state)) 912 + if (drm_WARN_ON(dev, !crtc->state)) 906 913 return NULL; 907 914 908 915 new_ast_state = kmalloc(sizeof(*new_ast_state), GFP_KERNEL); ··· 941 946 942 947 static int ast_crtc_init(struct drm_device *dev) 943 948 { 944 - struct ast_private *ast = dev->dev_private; 949 + struct ast_private *ast = to_ast_private(dev); 945 950 struct ast_crtc *crtc; 946 951 int ret; 947 952 ··· 970 975 971 976 static int ast_encoder_init(struct drm_device *dev) 972 977 { 973 - struct ast_private *ast = dev->dev_private; 978 + struct ast_private *ast = to_ast_private(dev); 974 979 struct drm_encoder *encoder = &ast->encoder; 975 980 int ret; 976 981 ··· 990 995 static int ast_get_modes(struct drm_connector *connector) 991 996 { 992 997 struct ast_connector *ast_connector = to_ast_connector(connector); 993 - struct ast_private *ast = connector->dev->dev_private; 998 + struct ast_private *ast = to_ast_private(connector->dev); 994 999 struct edid *edid; 995 1000 int ret; 996 1001 bool flags = false; ··· 1021 1026 static enum drm_mode_status ast_mode_valid(struct drm_connector *connector, 1022 1027 struct drm_display_mode *mode) 1023 1028 { 1024 - struct ast_private *ast = connector->dev->dev_private; 1029 + struct ast_private *ast = to_ast_private(connector->dev); 1025 1030 int flags = MODE_NOMODE; 1026 1031 uint32_t jtemp; 1027 1032 ··· 1039 1044 1040 1045 if ((ast->chip == AST2100) || (ast->chip == AST2200) || 1041 1046 (ast->chip == AST2300) || (ast->chip == AST2400) || 1042 - (ast->chip == AST2500) || (ast->chip == AST1180)) { 1047 + (ast->chip == AST2500)) { 1043 1048 if ((mode->hdisplay == 1920) && (mode->vdisplay == 1080)) 1044 1049 return MODE_OK; 1045 1050 ··· 1109 1114 connector = &ast_connector->base; 1110 1115 ast_connector->i2c = ast_i2c_create(dev); 1111 1116 if (!ast_connector->i2c) 1112 - DRM_ERROR("failed to add ddc bus for connector\n"); 1117 + drm_err(dev, "failed to add ddc bus for connector\n"); 1113 1118 1114 1119 drm_connector_init_with_ddc(dev, connector, 1115 1120 &ast_connector_funcs, ··· 1132 1137 /* allocate cursor cache and pin at start of VRAM */ 1133 1138 static int ast_cursor_init(struct drm_device *dev) 1134 1139 { 1135 - struct ast_private *ast = dev->dev_private; 1140 + struct ast_private *ast = to_ast_private(dev); 1136 1141 size_t size, i; 1137 1142 struct drm_gem_vram_object *gbo; 1138 1143 int ret; ··· 1170 1175 1171 1176 static void ast_cursor_fini(struct drm_device *dev) 1172 1177 { 1173 - struct ast_private *ast = dev->dev_private; 1178 + struct ast_private *ast = to_ast_private(dev); 1174 1179 size_t i; 1175 1180 struct drm_gem_vram_object *gbo; 1176 1181 ··· 1183 1188 1184 1189 int ast_mode_init(struct drm_device *dev) 1185 1190 { 1186 - struct ast_private *ast = dev->dev_private; 1191 + struct ast_private *ast = to_ast_private(dev); 1187 1192 int ret; 1188 1193 1189 1194 memset(&ast->primary_plane, 0, sizeof(ast->primary_plane)); ··· 1193 1198 ARRAY_SIZE(ast_primary_plane_formats), 1194 1199 NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 1195 1200 if (ret) { 1196 - DRM_ERROR("ast: drm_universal_plane_init() failed: %d\n", ret); 1201 + drm_err(dev, "ast: drm_universal_plane_init() failed: %d\n", ret); 1197 1202 return ret; 1198 1203 } 1199 1204 drm_plane_helper_add(&ast->primary_plane, ··· 1205 1210 ARRAY_SIZE(ast_cursor_plane_formats), 1206 1211 NULL, DRM_PLANE_TYPE_CURSOR, NULL); 1207 1212 if (ret) { 1208 - DRM_ERROR("drm_universal_plane_failed(): %d\n", ret); 1213 + drm_err(dev, "drm_universal_plane_failed(): %d\n", ret); 1209 1214 return ret; 1210 1215 } 1211 1216 drm_plane_helper_add(&ast->cursor_plane, ··· 1227 1232 static int get_clock(void *i2c_priv) 1228 1233 { 1229 1234 struct ast_i2c_chan *i2c = i2c_priv; 1230 - struct ast_private *ast = i2c->dev->dev_private; 1235 + struct ast_private *ast = to_ast_private(i2c->dev); 1231 1236 uint32_t val, val2, count, pass; 1232 1237 1233 1238 count = 0; ··· 1249 1254 static int get_data(void *i2c_priv) 1250 1255 { 1251 1256 struct ast_i2c_chan *i2c = i2c_priv; 1252 - struct ast_private *ast = i2c->dev->dev_private; 1257 + struct ast_private *ast = to_ast_private(i2c->dev); 1253 1258 uint32_t val, val2, count, pass; 1254 1259 1255 1260 count = 0; ··· 1271 1276 static void set_clock(void *i2c_priv, int clock) 1272 1277 { 1273 1278 struct ast_i2c_chan *i2c = i2c_priv; 1274 - struct ast_private *ast = i2c->dev->dev_private; 1279 + struct ast_private *ast = to_ast_private(i2c->dev); 1275 1280 int i; 1276 1281 u8 ujcrb7, jtemp; 1277 1282 ··· 1287 1292 static void set_data(void *i2c_priv, int data) 1288 1293 { 1289 1294 struct ast_i2c_chan *i2c = i2c_priv; 1290 - struct ast_private *ast = i2c->dev->dev_private; 1295 + struct ast_private *ast = to_ast_private(i2c->dev); 1291 1296 int i; 1292 1297 u8 ujcrb7, jtemp; 1293 1298 ··· 1327 1332 i2c->bit.getscl = get_clock; 1328 1333 ret = i2c_bit_add_bus(&i2c->adapter); 1329 1334 if (ret) { 1330 - DRM_ERROR("Failed to register bit i2c\n"); 1335 + drm_err(dev, "Failed to register bit i2c\n"); 1331 1336 goto out_free; 1332 1337 } 1333 1338 ··· 1435 1440 int x, int y) 1436 1441 { 1437 1442 struct ast_crtc *ast_crtc = to_ast_crtc(crtc); 1438 - struct ast_private *ast = crtc->dev->dev_private; 1443 + struct ast_private *ast = to_ast_private(crtc->dev); 1439 1444 struct drm_gem_vram_object *gbo; 1440 1445 int x_offset, y_offset; 1441 1446 u8 *dst, *sig;
+12 -16
drivers/gpu/drm/ast/ast_post.c
··· 39 39 40 40 void ast_enable_vga(struct drm_device *dev) 41 41 { 42 - struct ast_private *ast = dev->dev_private; 42 + struct ast_private *ast = to_ast_private(dev); 43 43 44 44 ast_io_write8(ast, AST_IO_VGA_ENABLE_PORT, 0x01); 45 45 ast_io_write8(ast, AST_IO_MISC_PORT_WRITE, 0x01); ··· 47 47 48 48 void ast_enable_mmio(struct drm_device *dev) 49 49 { 50 - struct ast_private *ast = dev->dev_private; 50 + struct ast_private *ast = to_ast_private(dev); 51 51 52 52 ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x06); 53 53 } ··· 55 55 56 56 bool ast_is_vga_enabled(struct drm_device *dev) 57 57 { 58 - struct ast_private *ast = dev->dev_private; 58 + struct ast_private *ast = to_ast_private(dev); 59 59 u8 ch; 60 60 61 - if (ast->chip == AST1180) { 62 - /* TODO 1180 */ 63 - } else { 64 - ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); 65 - return !!(ch & 0x01); 66 - } 67 - return false; 61 + ch = ast_io_read8(ast, AST_IO_VGA_ENABLE_PORT); 62 + 63 + return !!(ch & 0x01); 68 64 } 69 65 70 66 static const u8 extreginfo[] = { 0x0f, 0x04, 0x1c, 0xff }; ··· 70 74 static void 71 75 ast_set_def_ext_reg(struct drm_device *dev) 72 76 { 73 - struct ast_private *ast = dev->dev_private; 77 + struct ast_private *ast = to_ast_private(dev); 74 78 u8 i, index, reg; 75 79 const u8 *ext_reg_info; 76 80 ··· 272 276 273 277 static void ast_init_dram_reg(struct drm_device *dev) 274 278 { 275 - struct ast_private *ast = dev->dev_private; 279 + struct ast_private *ast = to_ast_private(dev); 276 280 u8 j; 277 281 u32 data, temp, i; 278 282 const struct ast_dramstruct *dram_reg_info; ··· 366 370 void ast_post_gpu(struct drm_device *dev) 367 371 { 368 372 u32 reg; 369 - struct ast_private *ast = dev->dev_private; 373 + struct ast_private *ast = to_ast_private(dev); 370 374 371 375 pci_read_config_dword(ast->dev->pdev, 0x04, &reg); 372 376 reg |= 0x3; ··· 1596 1600 1597 1601 static void ast_post_chip_2300(struct drm_device *dev) 1598 1602 { 1599 - struct ast_private *ast = dev->dev_private; 1603 + struct ast_private *ast = to_ast_private(dev); 1600 1604 struct ast2300_dram_param param; 1601 1605 u32 temp; 1602 1606 u8 reg; ··· 2028 2032 2029 2033 void ast_post_chip_2500(struct drm_device *dev) 2030 2034 { 2031 - struct ast_private *ast = dev->dev_private; 2035 + struct ast_private *ast = to_ast_private(dev); 2032 2036 u32 temp; 2033 2037 u8 reg; 2034 2038 ··· 2067 2071 } 2068 2072 2069 2073 if (!ast_dram_init_2500(ast)) 2070 - DRM_ERROR("DRAM init failed !\n"); 2074 + drm_err(dev, "DRAM init failed !\n"); 2071 2075 2072 2076 temp = ast_mindwm(ast, 0x1e6e2040); 2073 2077 ast_moutdwm(ast, 0x1e6e2040, temp | 0x40);
+1 -1
drivers/gpu/drm/ast/ast_ttm.c
··· 44 44 ast->vram_size); 45 45 if (IS_ERR(vmm)) { 46 46 ret = PTR_ERR(vmm); 47 - DRM_ERROR("Error initializing VRAM MM; %d\n", ret); 47 + drm_err(dev, "Error initializing VRAM MM; %d\n", ret); 48 48 return ret; 49 49 } 50 50
+6 -1
drivers/gpu/drm/bochs/bochs_kms.c
··· 29 29 struct drm_plane_state *state) 30 30 { 31 31 struct drm_gem_vram_object *gbo; 32 + s64 gpu_addr; 32 33 33 34 if (!state->fb || !bochs->stride) 34 35 return; 35 36 36 37 gbo = drm_gem_vram_of_gem(state->fb->obj[0]); 38 + gpu_addr = drm_gem_vram_offset(gbo); 39 + if (WARN_ON_ONCE(gpu_addr < 0)) 40 + return; /* Bug: we didn't pin the BO to VRAM in prepare_fb. */ 41 + 37 42 bochs_hw_setbase(bochs, 38 43 state->crtc_x, 39 44 state->crtc_y, 40 45 state->fb->pitches[0], 41 - state->fb->offsets[0] + gbo->bo.offset); 46 + state->fb->offsets[0] + gpu_addr); 42 47 bochs_hw_setformat(bochs, state->fb->format); 43 48 } 44 49
+98 -39
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
··· 443 443 444 444 if (adv7511->connector.status != status) { 445 445 adv7511->connector.status = status; 446 - if (status == connector_status_disconnected) 447 - cec_phys_addr_invalidate(adv7511->cec_adap); 448 - drm_kms_helper_hotplug_event(adv7511->connector.dev); 446 + 447 + if (adv7511->connector.dev) { 448 + if (status == connector_status_disconnected) 449 + cec_phys_addr_invalidate(adv7511->cec_adap); 450 + drm_kms_helper_hotplug_event(adv7511->connector.dev); 451 + } else { 452 + drm_bridge_hpd_notify(&adv7511->bridge, status); 453 + } 449 454 } 450 455 } 451 456 ··· 594 589 * ADV75xx helpers 595 590 */ 596 591 597 - static int adv7511_get_modes(struct adv7511 *adv7511, 598 - struct drm_connector *connector) 592 + static struct edid *adv7511_get_edid(struct adv7511 *adv7511, 593 + struct drm_connector *connector) 599 594 { 600 595 struct edid *edid; 601 - unsigned int count; 602 596 603 597 /* Reading the EDID only works if the device is powered */ 604 598 if (!adv7511->powered) { ··· 616 612 if (!adv7511->powered) 617 613 __adv7511_power_off(adv7511); 618 614 619 - 620 - drm_connector_update_edid_property(connector, edid); 621 - count = drm_add_edid_modes(connector, edid); 622 - 623 615 adv7511_set_config_csc(adv7511, connector, adv7511->rgb, 624 616 drm_detect_hdmi_monitor(edid)); 625 617 626 618 cec_s_phys_addr_from_edid(adv7511->cec_adap, edid); 619 + 620 + return edid; 621 + } 622 + 623 + static int adv7511_get_modes(struct adv7511 *adv7511, 624 + struct drm_connector *connector) 625 + { 626 + struct edid *edid; 627 + unsigned int count; 628 + 629 + edid = adv7511_get_edid(adv7511, connector); 630 + 631 + drm_connector_update_edid_property(connector, edid); 632 + count = drm_add_edid_modes(connector, edid); 627 633 628 634 kfree(edid); 629 635 ··· 666 652 if (status == connector_status_connected && hpd && adv7511->powered) { 667 653 regcache_mark_dirty(adv7511->regmap); 668 654 adv7511_power_on(adv7511); 669 - adv7511_get_modes(adv7511, connector); 655 + if (connector) 656 + adv7511_get_modes(adv7511, connector); 670 657 if (adv7511->status == connector_status_connected) 671 658 status = connector_status_disconnected; 672 659 } else { ··· 789 774 adv7511->f_tmds = mode->clock; 790 775 } 791 776 792 - /* Connector funcs */ 777 + /* ----------------------------------------------------------------------------- 778 + * DRM Connector Operations 779 + */ 780 + 793 781 static struct adv7511 *connector_to_adv7511(struct drm_connector *connector) 794 782 { 795 783 return container_of(connector, struct adv7511, connector); ··· 836 818 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 837 819 }; 838 820 839 - /* Bridge funcs */ 821 + static int adv7511_connector_init(struct adv7511 *adv) 822 + { 823 + struct drm_bridge *bridge = &adv->bridge; 824 + int ret; 825 + 826 + if (!bridge->encoder) { 827 + DRM_ERROR("Parent encoder object not found"); 828 + return -ENODEV; 829 + } 830 + 831 + if (adv->i2c_main->irq) 832 + adv->connector.polled = DRM_CONNECTOR_POLL_HPD; 833 + else 834 + adv->connector.polled = DRM_CONNECTOR_POLL_CONNECT | 835 + DRM_CONNECTOR_POLL_DISCONNECT; 836 + 837 + ret = drm_connector_init(bridge->dev, &adv->connector, 838 + &adv7511_connector_funcs, 839 + DRM_MODE_CONNECTOR_HDMIA); 840 + if (ret < 0) { 841 + DRM_ERROR("Failed to initialize connector with drm\n"); 842 + return ret; 843 + } 844 + drm_connector_helper_add(&adv->connector, 845 + &adv7511_connector_helper_funcs); 846 + drm_connector_attach_encoder(&adv->connector, bridge->encoder); 847 + 848 + return 0; 849 + } 850 + 851 + /* ----------------------------------------------------------------------------- 852 + * DRM Bridge Operations 853 + */ 854 + 840 855 static struct adv7511 *bridge_to_adv7511(struct drm_bridge *bridge) 841 856 { 842 857 return container_of(bridge, struct adv7511, bridge); ··· 902 851 enum drm_bridge_attach_flags flags) 903 852 { 904 853 struct adv7511 *adv = bridge_to_adv7511(bridge); 905 - int ret; 854 + int ret = 0; 906 855 907 - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { 908 - DRM_ERROR("Fix bridge driver to make connector optional!"); 909 - return -EINVAL; 856 + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { 857 + ret = adv7511_connector_init(adv); 858 + if (ret < 0) 859 + return ret; 910 860 } 911 - 912 - if (!bridge->encoder) { 913 - DRM_ERROR("Parent encoder object not found"); 914 - return -ENODEV; 915 - } 916 - 917 - if (adv->i2c_main->irq) 918 - adv->connector.polled = DRM_CONNECTOR_POLL_HPD; 919 - else 920 - adv->connector.polled = DRM_CONNECTOR_POLL_CONNECT | 921 - DRM_CONNECTOR_POLL_DISCONNECT; 922 - 923 - ret = drm_connector_init(bridge->dev, &adv->connector, 924 - &adv7511_connector_funcs, 925 - DRM_MODE_CONNECTOR_HDMIA); 926 - if (ret) { 927 - DRM_ERROR("Failed to initialize connector with drm\n"); 928 - return ret; 929 - } 930 - drm_connector_helper_add(&adv->connector, 931 - &adv7511_connector_helper_funcs); 932 - drm_connector_attach_encoder(&adv->connector, bridge->encoder); 933 861 934 862 if (adv->type == ADV7533 || adv->type == ADV7535) 935 863 ret = adv7533_attach_dsi(adv); ··· 920 890 return ret; 921 891 } 922 892 893 + static enum drm_connector_status adv7511_bridge_detect(struct drm_bridge *bridge) 894 + { 895 + struct adv7511 *adv = bridge_to_adv7511(bridge); 896 + 897 + return adv7511_detect(adv, NULL); 898 + } 899 + 900 + static struct edid *adv7511_bridge_get_edid(struct drm_bridge *bridge, 901 + struct drm_connector *connector) 902 + { 903 + struct adv7511 *adv = bridge_to_adv7511(bridge); 904 + 905 + return adv7511_get_edid(adv, connector); 906 + } 907 + 908 + static void adv7511_bridge_hpd_notify(struct drm_bridge *bridge, 909 + enum drm_connector_status status) 910 + { 911 + struct adv7511 *adv = bridge_to_adv7511(bridge); 912 + 913 + if (status == connector_status_disconnected) 914 + cec_phys_addr_invalidate(adv->cec_adap); 915 + } 916 + 923 917 static const struct drm_bridge_funcs adv7511_bridge_funcs = { 924 918 .enable = adv7511_bridge_enable, 925 919 .disable = adv7511_bridge_disable, 926 920 .mode_set = adv7511_bridge_mode_set, 927 921 .attach = adv7511_bridge_attach, 922 + .detect = adv7511_bridge_detect, 923 + .get_edid = adv7511_bridge_get_edid, 924 + .hpd_notify = adv7511_bridge_hpd_notify, 928 925 }; 929 926 930 927 /* ----------------------------------------------------------------------------- ··· 1280 1223 goto err_unregister_cec; 1281 1224 1282 1225 adv7511->bridge.funcs = &adv7511_bridge_funcs; 1226 + adv7511->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID 1227 + | DRM_BRIDGE_OP_HPD; 1283 1228 adv7511->bridge.of_node = dev->of_node; 1284 1229 1285 1230 drm_bridge_add(&adv7511->bridge);
+1
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
··· 588 588 589 589 static enum drm_mode_status 590 590 anx6345_bridge_mode_valid(struct drm_bridge *bridge, 591 + const struct drm_display_info *info, 591 592 const struct drm_display_mode *mode) 592 593 { 593 594 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+1
drivers/gpu/drm/bridge/analogix/analogix-anx78xx.c
··· 944 944 945 945 static enum drm_mode_status 946 946 anx78xx_bridge_mode_valid(struct drm_bridge *bridge, 947 + const struct drm_display_info *info, 947 948 const struct drm_display_mode *mode) 948 949 { 949 950 if (mode->flags & DRM_MODE_FLAG_INTERLACE)
+1
drivers/gpu/drm/bridge/cdns-dsi.c
··· 663 663 664 664 static enum drm_mode_status 665 665 cdns_dsi_bridge_mode_valid(struct drm_bridge *bridge, 666 + const struct drm_display_info *info, 666 667 const struct drm_display_mode *mode) 667 668 { 668 669 struct cdns_dsi_input *input = bridge_to_cdns_dsi_input(bridge);
+1
drivers/gpu/drm/bridge/chrontel-ch7033.c
··· 317 317 } 318 318 319 319 static enum drm_mode_status ch7033_bridge_mode_valid(struct drm_bridge *bridge, 320 + const struct drm_display_info *info, 320 321 const struct drm_display_mode *mode) 321 322 { 322 323 if (mode->clock > 165000)
+1
drivers/gpu/drm/bridge/nwl-dsi.c
··· 818 818 819 819 static enum drm_mode_status 820 820 nwl_dsi_bridge_mode_valid(struct drm_bridge *bridge, 821 + const struct drm_display_info *info, 821 822 const struct drm_display_mode *mode) 822 823 { 823 824 struct nwl_dsi *dsi = bridge_to_dsi(bridge);
+1
drivers/gpu/drm/bridge/sii9234.c
··· 873 873 } 874 874 875 875 static enum drm_mode_status sii9234_mode_valid(struct drm_bridge *bridge, 876 + const struct drm_display_info *info, 876 877 const struct drm_display_mode *mode) 877 878 { 878 879 if (mode->clock > MHL1_MAX_CLK)
+1
drivers/gpu/drm/bridge/sil-sii8620.c
··· 2244 2244 } 2245 2245 2246 2246 static enum drm_mode_status sii8620_mode_valid(struct drm_bridge *bridge, 2247 + const struct drm_display_info *info, 2247 2248 const struct drm_display_mode *mode) 2248 2249 { 2249 2250 struct sii8620 *ctx = bridge_to_sii8620(bridge);
+42 -71
drivers/gpu/drm/bridge/simple-bridge.c
··· 29 29 30 30 const struct simple_bridge_info *info; 31 31 32 - struct i2c_adapter *ddc; 32 + struct drm_bridge *next_bridge; 33 33 struct regulator *vdd; 34 34 struct gpio_desc *enable; 35 35 }; ··· 52 52 struct edid *edid; 53 53 int ret; 54 54 55 - if (!sbridge->ddc) 56 - goto fallback; 55 + if (sbridge->next_bridge->ops & DRM_BRIDGE_OP_EDID) { 56 + edid = drm_bridge_get_edid(sbridge->next_bridge, connector); 57 + if (!edid) 58 + DRM_INFO("EDID read failed. Fallback to standard modes\n"); 59 + } else { 60 + edid = NULL; 61 + } 57 62 58 - edid = drm_get_edid(connector, sbridge->ddc); 59 63 if (!edid) { 60 - DRM_INFO("EDID readout failed, falling back to standard modes\n"); 61 - goto fallback; 64 + /* 65 + * In case we cannot retrieve the EDIDs (missing or broken DDC 66 + * bus from the next bridge), fallback on the XGA standards and 67 + * prefer a mode pretty much anyone can handle. 68 + */ 69 + ret = drm_add_modes_noedid(connector, 1920, 1200); 70 + drm_set_preferred_mode(connector, 1024, 768); 71 + return ret; 62 72 } 63 73 64 74 drm_connector_update_edid_property(connector, edid); 65 75 ret = drm_add_edid_modes(connector, edid); 66 76 kfree(edid); 67 - return ret; 68 - 69 - fallback: 70 - /* 71 - * In case we cannot retrieve the EDIDs (broken or missing i2c 72 - * bus), fallback on the XGA standards 73 - */ 74 - ret = drm_add_modes_noedid(connector, 1920, 1200); 75 - 76 - /* And prefer a mode pretty much anyone can handle */ 77 - drm_set_preferred_mode(connector, 1024, 768); 78 77 79 78 return ret; 80 79 } ··· 87 88 { 88 89 struct simple_bridge *sbridge = drm_connector_to_simple_bridge(connector); 89 90 90 - /* 91 - * Even if we have an I2C bus, we can't assume that the cable 92 - * is disconnected if drm_probe_ddc fails. Some cables don't 93 - * wire the DDC pins, or the I2C bus might not be working at 94 - * all. 95 - */ 96 - if (sbridge->ddc && drm_probe_ddc(sbridge->ddc)) 97 - return connector_status_connected; 98 - 99 - return connector_status_unknown; 91 + return drm_bridge_detect(sbridge->next_bridge); 100 92 } 101 93 102 94 static const struct drm_connector_funcs simple_bridge_con_funcs = { ··· 105 115 struct simple_bridge *sbridge = drm_bridge_to_simple_bridge(bridge); 106 116 int ret; 107 117 108 - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { 109 - DRM_ERROR("Fix bridge driver to make connector optional!"); 110 - return -EINVAL; 111 - } 118 + ret = drm_bridge_attach(bridge->encoder, sbridge->next_bridge, bridge, 119 + DRM_BRIDGE_ATTACH_NO_CONNECTOR); 120 + if (ret < 0) 121 + return ret; 122 + 123 + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) 124 + return 0; 112 125 113 126 if (!bridge->encoder) { 114 127 DRM_ERROR("Missing encoder\n"); ··· 123 130 ret = drm_connector_init_with_ddc(bridge->dev, &sbridge->connector, 124 131 &simple_bridge_con_funcs, 125 132 sbridge->info->connector_type, 126 - sbridge->ddc); 133 + sbridge->next_bridge->ddc); 127 134 if (ret) { 128 135 DRM_ERROR("Failed to initialize connector\n"); 129 136 return ret; 130 137 } 131 138 132 - drm_connector_attach_encoder(&sbridge->connector, 133 - bridge->encoder); 139 + drm_connector_attach_encoder(&sbridge->connector, bridge->encoder); 134 140 135 141 return 0; 136 142 } ··· 164 172 .disable = simple_bridge_disable, 165 173 }; 166 174 167 - static struct i2c_adapter *simple_bridge_retrieve_ddc(struct device *dev) 168 - { 169 - struct device_node *phandle, *remote; 170 - struct i2c_adapter *ddc; 171 - 172 - remote = of_graph_get_remote_node(dev->of_node, 1, -1); 173 - if (!remote) 174 - return ERR_PTR(-EINVAL); 175 - 176 - phandle = of_parse_phandle(remote, "ddc-i2c-bus", 0); 177 - of_node_put(remote); 178 - if (!phandle) 179 - return ERR_PTR(-ENODEV); 180 - 181 - ddc = of_get_i2c_adapter_by_node(phandle); 182 - of_node_put(phandle); 183 - if (!ddc) 184 - return ERR_PTR(-EPROBE_DEFER); 185 - 186 - return ddc; 187 - } 188 - 189 175 static int simple_bridge_probe(struct platform_device *pdev) 190 176 { 191 177 struct simple_bridge *sbridge; 178 + struct device_node *remote; 192 179 193 180 sbridge = devm_kzalloc(&pdev->dev, sizeof(*sbridge), GFP_KERNEL); 194 181 if (!sbridge) ··· 176 205 177 206 sbridge->info = of_device_get_match_data(&pdev->dev); 178 207 208 + /* Get the next bridge in the pipeline. */ 209 + remote = of_graph_get_remote_node(pdev->dev.of_node, 1, -1); 210 + if (!remote) 211 + return -EINVAL; 212 + 213 + sbridge->next_bridge = of_drm_find_bridge(remote); 214 + of_node_put(remote); 215 + 216 + if (!sbridge->next_bridge) { 217 + dev_dbg(&pdev->dev, "Next bridge not found, deferring probe\n"); 218 + return -EPROBE_DEFER; 219 + } 220 + 221 + /* Get the regulator and GPIO resources. */ 179 222 sbridge->vdd = devm_regulator_get_optional(&pdev->dev, "vdd"); 180 223 if (IS_ERR(sbridge->vdd)) { 181 224 int ret = PTR_ERR(sbridge->vdd); ··· 207 222 return PTR_ERR(sbridge->enable); 208 223 } 209 224 210 - sbridge->ddc = simple_bridge_retrieve_ddc(&pdev->dev); 211 - if (IS_ERR(sbridge->ddc)) { 212 - if (PTR_ERR(sbridge->ddc) == -ENODEV) { 213 - dev_dbg(&pdev->dev, 214 - "No i2c bus specified. Disabling EDID readout\n"); 215 - sbridge->ddc = NULL; 216 - } else { 217 - dev_err(&pdev->dev, "Couldn't retrieve i2c bus\n"); 218 - return PTR_ERR(sbridge->ddc); 219 - } 220 - } 221 - 225 + /* Register the bridge. */ 222 226 sbridge->bridge.funcs = &simple_bridge_bridge_funcs; 223 227 sbridge->bridge.of_node = pdev->dev.of_node; 224 228 sbridge->bridge.timings = sbridge->info->timings; ··· 222 248 struct simple_bridge *sbridge = platform_get_drvdata(pdev); 223 249 224 250 drm_bridge_remove(&sbridge->bridge); 225 - 226 - if (sbridge->ddc) 227 - i2c_put_adapter(sbridge->ddc); 228 251 229 252 return 0; 230 253 }
+195 -112
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
··· 181 181 182 182 struct mutex mutex; /* for state below and previous_mode */ 183 183 enum drm_connector_force force; /* mutex-protected force state */ 184 + struct drm_connector *curr_conn;/* current connector (only valid when !disabled) */ 184 185 bool disabled; /* DRM has disabled our bridge */ 185 186 bool bridge_is_on; /* indicates the bridge is on */ 186 187 bool rxsense; /* rxsense state */ ··· 1242 1241 EXPORT_SYMBOL_GPL(dw_hdmi_phy_i2c_write); 1243 1242 1244 1243 /* Filter out invalid setups to avoid configuring SCDC and scrambling */ 1245 - static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi) 1244 + static bool dw_hdmi_support_scdc(struct dw_hdmi *hdmi, 1245 + const struct drm_display_info *display) 1246 1246 { 1247 - struct drm_display_info *display = &hdmi->connector.display_info; 1248 - 1249 1247 /* Completely disable SCDC support for older controllers */ 1250 1248 if (hdmi->version < 0x200a) 1251 1249 return false; ··· 1282 1282 * helper should called right before enabling the TMDS Clock and Data in 1283 1283 * the PHY configuration callback. 1284 1284 */ 1285 - void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi) 1285 + void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi, 1286 + const struct drm_display_info *display) 1286 1287 { 1287 1288 unsigned long mtmdsclock = hdmi->hdmi_data.video_mode.mtmdsclock; 1288 1289 1289 1290 /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */ 1290 - if (dw_hdmi_support_scdc(hdmi)) { 1291 + if (dw_hdmi_support_scdc(hdmi, display)) { 1291 1292 if (mtmdsclock > HDMI14_MAX_TMDSCLK) 1292 1293 drm_scdc_set_high_tmds_clock_ratio(hdmi->ddc, 1); 1293 1294 else ··· 1491 1490 return 0; 1492 1491 } 1493 1492 1494 - static int hdmi_phy_configure(struct dw_hdmi *hdmi) 1493 + static int hdmi_phy_configure(struct dw_hdmi *hdmi, 1494 + const struct drm_display_info *display) 1495 1495 { 1496 1496 const struct dw_hdmi_phy_data *phy = hdmi->phy.data; 1497 1497 const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; ··· 1502 1500 1503 1501 dw_hdmi_phy_power_off(hdmi); 1504 1502 1505 - dw_hdmi_set_high_tmds_clock_ratio(hdmi); 1503 + dw_hdmi_set_high_tmds_clock_ratio(hdmi, display); 1506 1504 1507 1505 /* Leave low power consumption mode by asserting SVSRET. */ 1508 1506 if (phy->has_svsret) ··· 1516 1514 1517 1515 /* Write to the PHY as configured by the platform */ 1518 1516 if (pdata->configure_phy) 1519 - ret = pdata->configure_phy(hdmi, pdata, mpixelclock); 1517 + ret = pdata->configure_phy(hdmi, pdata->priv_data, mpixelclock); 1520 1518 else 1521 1519 ret = phy->configure(hdmi, pdata, mpixelclock); 1522 1520 if (ret) { ··· 1533 1531 } 1534 1532 1535 1533 static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, 1536 - struct drm_display_mode *mode) 1534 + const struct drm_display_info *display, 1535 + const struct drm_display_mode *mode) 1537 1536 { 1538 1537 int i, ret; 1539 1538 ··· 1543 1540 dw_hdmi_phy_sel_data_en_pol(hdmi, 1); 1544 1541 dw_hdmi_phy_sel_interface_control(hdmi, 0); 1545 1542 1546 - ret = hdmi_phy_configure(hdmi); 1543 + ret = hdmi_phy_configure(hdmi, display); 1547 1544 if (ret) 1548 1545 return ret; 1549 1546 } ··· 1631 1628 HDMI_A_HDCPCFG1_ENCRYPTIONDISABLE_MASK, HDMI_A_HDCPCFG1); 1632 1629 } 1633 1630 1634 - static void hdmi_config_AVI(struct dw_hdmi *hdmi, struct drm_display_mode *mode) 1631 + static void hdmi_config_AVI(struct dw_hdmi *hdmi, 1632 + const struct drm_connector *connector, 1633 + const struct drm_display_mode *mode) 1635 1634 { 1636 1635 struct hdmi_avi_infoframe frame; 1637 1636 u8 val; 1638 1637 1639 1638 /* Initialise info frame from DRM mode */ 1640 - drm_hdmi_avi_infoframe_from_display_mode(&frame, 1641 - &hdmi->connector, mode); 1639 + drm_hdmi_avi_infoframe_from_display_mode(&frame, connector, mode); 1642 1640 1643 1641 if (hdmi_bus_fmt_is_rgb(hdmi->hdmi_data.enc_out_bus_format)) { 1644 - drm_hdmi_avi_infoframe_quant_range(&frame, &hdmi->connector, 1645 - mode, 1642 + drm_hdmi_avi_infoframe_quant_range(&frame, connector, mode, 1646 1643 hdmi->hdmi_data.rgb_limited_range ? 1647 1644 HDMI_QUANTIZATION_RANGE_LIMITED : 1648 1645 HDMI_QUANTIZATION_RANGE_FULL); ··· 1759 1756 } 1760 1757 1761 1758 static void hdmi_config_vendor_specific_infoframe(struct dw_hdmi *hdmi, 1762 - struct drm_display_mode *mode) 1759 + const struct drm_connector *connector, 1760 + const struct drm_display_mode *mode) 1763 1761 { 1764 1762 struct hdmi_vendor_infoframe frame; 1765 1763 u8 buffer[10]; 1766 1764 ssize_t err; 1767 1765 1768 - err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, 1769 - &hdmi->connector, 1766 + err = drm_hdmi_vendor_infoframe_from_display_mode(&frame, connector, 1770 1767 mode); 1771 1768 if (err < 0) 1772 1769 /* ··· 1812 1809 HDMI_FC_DATAUTO0_VSD_MASK); 1813 1810 } 1814 1811 1815 - static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi) 1812 + static void hdmi_config_drm_infoframe(struct dw_hdmi *hdmi, 1813 + const struct drm_connector *connector) 1816 1814 { 1817 - const struct drm_connector_state *conn_state = hdmi->connector.state; 1815 + const struct drm_connector_state *conn_state = connector->state; 1818 1816 struct hdmi_drm_infoframe frame; 1819 1817 u8 buffer[30]; 1820 1818 ssize_t err; ··· 1849 1845 } 1850 1846 1851 1847 static void hdmi_av_composer(struct dw_hdmi *hdmi, 1848 + const struct drm_display_info *display, 1852 1849 const struct drm_display_mode *mode) 1853 1850 { 1854 1851 u8 inv_val, bytes; 1855 - struct drm_hdmi_info *hdmi_info = &hdmi->connector.display_info.hdmi; 1852 + const struct drm_hdmi_info *hdmi_info = &display->hdmi; 1856 1853 struct hdmi_vmode *vmode = &hdmi->hdmi_data.video_mode; 1857 1854 int hblank, vblank, h_de_hs, v_de_vs, hsync_len, vsync_len; 1858 1855 unsigned int vdisplay, hdisplay; ··· 1886 1881 1887 1882 /* Set up HDMI_FC_INVIDCONF */ 1888 1883 inv_val = (hdmi->hdmi_data.hdcp_enable || 1889 - (dw_hdmi_support_scdc(hdmi) && 1884 + (dw_hdmi_support_scdc(hdmi, display) && 1890 1885 (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || 1891 1886 hdmi_info->scdc.scrambling.low_rates)) ? 1892 1887 HDMI_FC_INVIDCONF_HDCP_KEEPOUT_ACTIVE : ··· 1954 1949 } 1955 1950 1956 1951 /* Scrambling Control */ 1957 - if (dw_hdmi_support_scdc(hdmi)) { 1952 + if (dw_hdmi_support_scdc(hdmi, display)) { 1958 1953 if (vmode->mtmdsclock > HDMI14_MAX_TMDSCLK || 1959 1954 hdmi_info->scdc.scrambling.low_rates) { 1960 1955 /* ··· 2117 2112 HDMI_IH_MUTE_FC_STAT2); 2118 2113 } 2119 2114 2120 - static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode) 2115 + static int dw_hdmi_setup(struct dw_hdmi *hdmi, 2116 + const struct drm_connector *connector, 2117 + const struct drm_display_mode *mode) 2121 2118 { 2122 2119 int ret; 2123 2120 ··· 2144 2137 hdmi->hdmi_data.video_mode.mpixelrepetitionoutput = 0; 2145 2138 hdmi->hdmi_data.video_mode.mpixelrepetitioninput = 0; 2146 2139 2147 - if (hdmi->plat_data->input_bus_format) 2148 - hdmi->hdmi_data.enc_in_bus_format = 2149 - hdmi->plat_data->input_bus_format; 2150 - else if (hdmi->hdmi_data.enc_in_bus_format == MEDIA_BUS_FMT_FIXED) 2140 + if (hdmi->hdmi_data.enc_in_bus_format == MEDIA_BUS_FMT_FIXED) 2151 2141 hdmi->hdmi_data.enc_in_bus_format = MEDIA_BUS_FMT_RGB888_1X24; 2152 2142 2153 2143 /* TOFIX: Get input encoding from plat data or fallback to none */ ··· 2166 2162 hdmi->hdmi_data.video_mode.mdataenablepolarity = true; 2167 2163 2168 2164 /* HDMI Initialization Step B.1 */ 2169 - hdmi_av_composer(hdmi, mode); 2165 + hdmi_av_composer(hdmi, &connector->display_info, mode); 2170 2166 2171 2167 /* HDMI Initializateion Step B.2 */ 2172 - ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, &hdmi->previous_mode); 2168 + ret = hdmi->phy.ops->init(hdmi, hdmi->phy.data, 2169 + &connector->display_info, 2170 + &hdmi->previous_mode); 2173 2171 if (ret) 2174 2172 return ret; 2175 2173 hdmi->phy.enabled = true; ··· 2192 2186 dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__); 2193 2187 2194 2188 /* HDMI Initialization Step F - Configure AVI InfoFrame */ 2195 - hdmi_config_AVI(hdmi, mode); 2196 - hdmi_config_vendor_specific_infoframe(hdmi, mode); 2197 - hdmi_config_drm_infoframe(hdmi); 2189 + hdmi_config_AVI(hdmi, connector, mode); 2190 + hdmi_config_vendor_specific_infoframe(hdmi, connector, mode); 2191 + hdmi_config_drm_infoframe(hdmi, connector); 2198 2192 } else { 2199 2193 dev_dbg(hdmi->dev, "%s DVI mode\n", __func__); 2200 2194 } ··· 2263 2257 static void dw_hdmi_poweron(struct dw_hdmi *hdmi) 2264 2258 { 2265 2259 hdmi->bridge_is_on = true; 2266 - dw_hdmi_setup(hdmi, &hdmi->previous_mode); 2260 + 2261 + /* 2262 + * The curr_conn field is guaranteed to be valid here, as this function 2263 + * is only be called when !hdmi->disabled. 2264 + */ 2265 + dw_hdmi_setup(hdmi, hdmi->curr_conn, &hdmi->previous_mode); 2267 2266 } 2268 2267 2269 2268 static void dw_hdmi_poweroff(struct dw_hdmi *hdmi) ··· 2323 2312 hdmi->rxsense); 2324 2313 } 2325 2314 2326 - static enum drm_connector_status 2327 - dw_hdmi_connector_detect(struct drm_connector *connector, bool force) 2315 + static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi) 2328 2316 { 2329 - struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, 2330 - connector); 2331 2317 enum drm_connector_status result; 2332 2318 2333 2319 mutex_lock(&hdmi->mutex); ··· 2347 2339 return result; 2348 2340 } 2349 2341 2342 + static struct edid *dw_hdmi_get_edid(struct dw_hdmi *hdmi, 2343 + struct drm_connector *connector) 2344 + { 2345 + struct edid *edid; 2346 + 2347 + if (!hdmi->ddc) 2348 + return NULL; 2349 + 2350 + edid = drm_get_edid(connector, hdmi->ddc); 2351 + if (!edid) { 2352 + dev_dbg(hdmi->dev, "failed to get edid\n"); 2353 + return NULL; 2354 + } 2355 + 2356 + dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", 2357 + edid->width_cm, edid->height_cm); 2358 + 2359 + hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); 2360 + hdmi->sink_has_audio = drm_detect_monitor_audio(edid); 2361 + 2362 + return edid; 2363 + } 2364 + 2365 + /* ----------------------------------------------------------------------------- 2366 + * DRM Connector Operations 2367 + */ 2368 + 2369 + static enum drm_connector_status 2370 + dw_hdmi_connector_detect(struct drm_connector *connector, bool force) 2371 + { 2372 + struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, 2373 + connector); 2374 + return dw_hdmi_detect(hdmi); 2375 + } 2376 + 2350 2377 static int dw_hdmi_connector_get_modes(struct drm_connector *connector) 2351 2378 { 2352 2379 struct dw_hdmi *hdmi = container_of(connector, struct dw_hdmi, 2353 2380 connector); 2354 2381 struct edid *edid; 2355 - int ret = 0; 2382 + int ret; 2356 2383 2357 - if (!hdmi->ddc) 2384 + edid = dw_hdmi_get_edid(hdmi, connector); 2385 + if (!edid) 2358 2386 return 0; 2359 2387 2360 - edid = drm_get_edid(connector, hdmi->ddc); 2361 - if (edid) { 2362 - dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", 2363 - edid->width_cm, edid->height_cm); 2364 - 2365 - hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); 2366 - hdmi->sink_has_audio = drm_detect_monitor_audio(edid); 2367 - drm_connector_update_edid_property(connector, edid); 2368 - cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); 2369 - ret = drm_add_edid_modes(connector, edid); 2370 - kfree(edid); 2371 - } else { 2372 - dev_dbg(hdmi->dev, "failed to get edid\n"); 2373 - } 2388 + drm_connector_update_edid_property(connector, edid); 2389 + cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); 2390 + ret = drm_add_edid_modes(connector, edid); 2391 + kfree(edid); 2374 2392 2375 2393 return ret; 2376 2394 } ··· 2466 2432 .get_modes = dw_hdmi_connector_get_modes, 2467 2433 .atomic_check = dw_hdmi_connector_atomic_check, 2468 2434 }; 2435 + 2436 + static int dw_hdmi_connector_create(struct dw_hdmi *hdmi) 2437 + { 2438 + struct drm_connector *connector = &hdmi->connector; 2439 + struct cec_connector_info conn_info; 2440 + struct cec_notifier *notifier; 2441 + 2442 + if (hdmi->version >= 0x200a) 2443 + connector->ycbcr_420_allowed = 2444 + hdmi->plat_data->ycbcr_420_allowed; 2445 + else 2446 + connector->ycbcr_420_allowed = false; 2447 + 2448 + connector->interlace_allowed = 1; 2449 + connector->polled = DRM_CONNECTOR_POLL_HPD; 2450 + 2451 + drm_connector_helper_add(connector, &dw_hdmi_connector_helper_funcs); 2452 + 2453 + drm_connector_init_with_ddc(hdmi->bridge.dev, connector, 2454 + &dw_hdmi_connector_funcs, 2455 + DRM_MODE_CONNECTOR_HDMIA, 2456 + hdmi->ddc); 2457 + 2458 + /* 2459 + * drm_connector_attach_max_bpc_property() requires the 2460 + * connector to have a state. 2461 + */ 2462 + drm_atomic_helper_connector_reset(connector); 2463 + 2464 + drm_connector_attach_max_bpc_property(connector, 8, 16); 2465 + 2466 + if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) 2467 + drm_object_attach_property(&connector->base, 2468 + connector->dev->mode_config.hdr_output_metadata_property, 0); 2469 + 2470 + drm_connector_attach_encoder(connector, hdmi->bridge.encoder); 2471 + 2472 + cec_fill_conn_info_from_drm(&conn_info, connector); 2473 + 2474 + notifier = cec_notifier_conn_register(hdmi->dev, NULL, &conn_info); 2475 + if (!notifier) 2476 + return -ENOMEM; 2477 + 2478 + mutex_lock(&hdmi->cec_notifier_mutex); 2479 + hdmi->cec_notifier = notifier; 2480 + mutex_unlock(&hdmi->cec_notifier_mutex); 2481 + 2482 + return 0; 2483 + } 2484 + 2485 + /* ----------------------------------------------------------------------------- 2486 + * DRM Bridge Operations 2487 + */ 2469 2488 2470 2489 /* 2471 2490 * Possible output formats : ··· 2795 2708 enum drm_bridge_attach_flags flags) 2796 2709 { 2797 2710 struct dw_hdmi *hdmi = bridge->driver_private; 2798 - struct drm_encoder *encoder = bridge->encoder; 2799 - struct drm_connector *connector = &hdmi->connector; 2800 - struct cec_connector_info conn_info; 2801 - struct cec_notifier *notifier; 2802 2711 2803 - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { 2804 - DRM_ERROR("Fix bridge driver to make connector optional!"); 2805 - return -EINVAL; 2806 - } 2712 + if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) 2713 + return 0; 2807 2714 2808 - connector->interlace_allowed = 1; 2809 - connector->polled = DRM_CONNECTOR_POLL_HPD; 2810 - 2811 - drm_connector_helper_add(connector, &dw_hdmi_connector_helper_funcs); 2812 - 2813 - drm_connector_init_with_ddc(bridge->dev, connector, 2814 - &dw_hdmi_connector_funcs, 2815 - DRM_MODE_CONNECTOR_HDMIA, 2816 - hdmi->ddc); 2817 - 2818 - /* 2819 - * drm_connector_attach_max_bpc_property() requires the 2820 - * connector to have a state. 2821 - */ 2822 - drm_atomic_helper_connector_reset(connector); 2823 - 2824 - drm_connector_attach_max_bpc_property(connector, 8, 16); 2825 - 2826 - if (hdmi->version >= 0x200a && hdmi->plat_data->use_drm_infoframe) 2827 - drm_object_attach_property(&connector->base, 2828 - connector->dev->mode_config.hdr_output_metadata_property, 0); 2829 - 2830 - drm_connector_attach_encoder(connector, encoder); 2831 - 2832 - cec_fill_conn_info_from_drm(&conn_info, connector); 2833 - 2834 - notifier = cec_notifier_conn_register(hdmi->dev, NULL, &conn_info); 2835 - if (!notifier) 2836 - return -ENOMEM; 2837 - 2838 - mutex_lock(&hdmi->cec_notifier_mutex); 2839 - hdmi->cec_notifier = notifier; 2840 - mutex_unlock(&hdmi->cec_notifier_mutex); 2841 - 2842 - return 0; 2715 + return dw_hdmi_connector_create(hdmi); 2843 2716 } 2844 2717 2845 2718 static void dw_hdmi_bridge_detach(struct drm_bridge *bridge) ··· 2814 2767 2815 2768 static enum drm_mode_status 2816 2769 dw_hdmi_bridge_mode_valid(struct drm_bridge *bridge, 2770 + const struct drm_display_info *info, 2817 2771 const struct drm_display_mode *mode) 2818 2772 { 2819 2773 struct dw_hdmi *hdmi = bridge->driver_private; 2820 - struct drm_connector *connector = &hdmi->connector; 2774 + const struct dw_hdmi_plat_data *pdata = hdmi->plat_data; 2821 2775 enum drm_mode_status mode_status = MODE_OK; 2822 2776 2823 2777 /* We don't support double-clocked modes */ 2824 2778 if (mode->flags & DRM_MODE_FLAG_DBLCLK) 2825 2779 return MODE_BAD; 2826 2780 2827 - if (hdmi->plat_data->mode_valid) 2828 - mode_status = hdmi->plat_data->mode_valid(connector, mode); 2781 + if (pdata->mode_valid) 2782 + mode_status = pdata->mode_valid(hdmi, pdata->priv_data, info, 2783 + mode); 2829 2784 2830 2785 return mode_status; 2831 2786 } ··· 2846 2797 mutex_unlock(&hdmi->mutex); 2847 2798 } 2848 2799 2849 - static void dw_hdmi_bridge_disable(struct drm_bridge *bridge) 2800 + static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge, 2801 + struct drm_bridge_state *old_state) 2850 2802 { 2851 2803 struct dw_hdmi *hdmi = bridge->driver_private; 2852 2804 2853 2805 mutex_lock(&hdmi->mutex); 2854 2806 hdmi->disabled = true; 2807 + hdmi->curr_conn = NULL; 2855 2808 dw_hdmi_update_power(hdmi); 2856 2809 dw_hdmi_update_phy_mask(hdmi); 2857 2810 mutex_unlock(&hdmi->mutex); 2858 2811 } 2859 2812 2860 - static void dw_hdmi_bridge_enable(struct drm_bridge *bridge) 2813 + static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, 2814 + struct drm_bridge_state *old_state) 2861 2815 { 2862 2816 struct dw_hdmi *hdmi = bridge->driver_private; 2817 + struct drm_atomic_state *state = old_state->base.state; 2818 + struct drm_connector *connector; 2819 + 2820 + connector = drm_atomic_get_new_connector_for_encoder(state, 2821 + bridge->encoder); 2863 2822 2864 2823 mutex_lock(&hdmi->mutex); 2865 2824 hdmi->disabled = false; 2825 + hdmi->curr_conn = connector; 2866 2826 dw_hdmi_update_power(hdmi); 2867 2827 dw_hdmi_update_phy_mask(hdmi); 2868 2828 mutex_unlock(&hdmi->mutex); 2829 + } 2830 + 2831 + static enum drm_connector_status dw_hdmi_bridge_detect(struct drm_bridge *bridge) 2832 + { 2833 + struct dw_hdmi *hdmi = bridge->driver_private; 2834 + 2835 + return dw_hdmi_detect(hdmi); 2836 + } 2837 + 2838 + static struct edid *dw_hdmi_bridge_get_edid(struct drm_bridge *bridge, 2839 + struct drm_connector *connector) 2840 + { 2841 + struct dw_hdmi *hdmi = bridge->driver_private; 2842 + 2843 + return dw_hdmi_get_edid(hdmi, connector); 2869 2844 } 2870 2845 2871 2846 static const struct drm_bridge_funcs dw_hdmi_bridge_funcs = { ··· 2901 2828 .atomic_check = dw_hdmi_bridge_atomic_check, 2902 2829 .atomic_get_output_bus_fmts = dw_hdmi_bridge_atomic_get_output_bus_fmts, 2903 2830 .atomic_get_input_bus_fmts = dw_hdmi_bridge_atomic_get_input_bus_fmts, 2904 - .enable = dw_hdmi_bridge_enable, 2905 - .disable = dw_hdmi_bridge_disable, 2831 + .atomic_enable = dw_hdmi_bridge_atomic_enable, 2832 + .atomic_disable = dw_hdmi_bridge_atomic_disable, 2906 2833 .mode_set = dw_hdmi_bridge_mode_set, 2907 2834 .mode_valid = dw_hdmi_bridge_mode_valid, 2835 + .detect = dw_hdmi_bridge_detect, 2836 + .get_edid = dw_hdmi_bridge_get_edid, 2908 2837 }; 2838 + 2839 + /* ----------------------------------------------------------------------------- 2840 + * IRQ Handling 2841 + */ 2909 2842 2910 2843 static irqreturn_t dw_hdmi_i2c_irq(struct dw_hdmi *hdmi) 2911 2844 { ··· 3022 2943 } 3023 2944 3024 2945 if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { 2946 + enum drm_connector_status status = phy_int_pol & HDMI_PHY_HPD 2947 + ? connector_status_connected 2948 + : connector_status_disconnected; 2949 + 3025 2950 dev_dbg(hdmi->dev, "EVENT=%s\n", 3026 - phy_int_pol & HDMI_PHY_HPD ? "plugin" : "plugout"); 3027 - if (hdmi->bridge.dev) 2951 + status == connector_status_connected ? 2952 + "plugin" : "plugout"); 2953 + 2954 + if (hdmi->bridge.dev) { 3028 2955 drm_helper_hpd_irq_event(hdmi->bridge.dev); 2956 + drm_bridge_hpd_notify(&hdmi->bridge, status); 2957 + } 3029 2958 } 3030 2959 3031 2960 hdmi_writeb(hdmi, intr_stat, HDMI_IH_PHY_STAT0); ··· 3379 3292 3380 3293 hdmi->bridge.driver_private = hdmi; 3381 3294 hdmi->bridge.funcs = &dw_hdmi_bridge_funcs; 3295 + hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID 3296 + | DRM_BRIDGE_OP_HPD; 3382 3297 #ifdef CONFIG_OF 3383 3298 hdmi->bridge.of_node = pdev->dev.of_node; 3384 3299 #endif 3385 - 3386 - if (hdmi->version >= 0x200a) 3387 - hdmi->connector.ycbcr_420_allowed = 3388 - hdmi->plat_data->ycbcr_420_allowed; 3389 - else 3390 - hdmi->connector.ycbcr_420_allowed = false; 3391 3300 3392 3301 memset(&pdevinfo, 0, sizeof(pdevinfo)); 3393 3302 pdevinfo.parent = dev;
+1 -1
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
··· 27 27 #include <drm/drm_modes.h> 28 28 #include <drm/drm_of.h> 29 29 #include <drm/drm_print.h> 30 - #include <drm/drm_probe_helper.h> 31 30 32 31 #define HWVER_131 0x31333100 /* IP version 1.31 */ 33 32 ··· 923 924 924 925 static enum drm_mode_status 925 926 dw_mipi_dsi_bridge_mode_valid(struct drm_bridge *bridge, 927 + const struct drm_display_info *info, 926 928 const struct drm_display_mode *mode) 927 929 { 928 930 struct dw_mipi_dsi *dsi = bridge_to_dsi(bridge);
+1
drivers/gpu/drm/bridge/tc358767.c
··· 1306 1306 } 1307 1307 1308 1308 static enum drm_mode_status tc_mode_valid(struct drm_bridge *bridge, 1309 + const struct drm_display_info *info, 1309 1310 const struct drm_display_mode *mode) 1310 1311 { 1311 1312 struct tc_data *tc = bridge_to_tc(bridge);
+1
drivers/gpu/drm/bridge/tc358768.c
··· 529 529 530 530 static enum drm_mode_status 531 531 tc358768_bridge_mode_valid(struct drm_bridge *bridge, 532 + const struct drm_display_info *info, 532 533 const struct drm_display_mode *mode) 533 534 { 534 535 struct tc358768_priv *priv = bridge_to_tc358768(bridge);
+1
drivers/gpu/drm/bridge/thc63lvd1024.c
··· 51 51 } 52 52 53 53 static enum drm_mode_status thc63_mode_valid(struct drm_bridge *bridge, 54 + const struct drm_display_info *info, 54 55 const struct drm_display_mode *mode) 55 56 { 56 57 struct thc63_dev *thc63 = to_thc63(bridge);
+13 -8
drivers/gpu/drm/bridge/ti-tfp410.c
··· 51 51 struct edid *edid; 52 52 int ret; 53 53 54 - edid = drm_bridge_get_edid(dvi->next_bridge, connector); 55 - if (IS_ERR_OR_NULL(edid)) { 56 - if (edid != ERR_PTR(-ENOTSUPP)) 54 + if (dvi->next_bridge->ops & DRM_BRIDGE_OP_EDID) { 55 + edid = drm_bridge_get_edid(dvi->next_bridge, connector); 56 + if (!edid) 57 57 DRM_INFO("EDID read failed. Fallback to standard modes\n"); 58 + } else { 59 + edid = NULL; 60 + } 58 61 62 + if (!edid) { 59 63 /* 60 64 * No EDID, fallback on the XGA standard modes and prefer a mode 61 65 * pretty much anything can handle. ··· 192 188 } 193 189 194 190 static enum drm_mode_status tfp410_mode_valid(struct drm_bridge *bridge, 191 + const struct drm_display_info *info, 195 192 const struct drm_display_mode *mode) 196 193 { 197 194 if (mode->clock < 25000) ··· 225 220 struct device_node *ep; 226 221 u32 pclk_sample = 0; 227 222 u32 bus_width = 24; 228 - s32 deskew = 0; 223 + u32 deskew = 0; 229 224 230 225 /* Start with defaults. */ 231 226 *timings = tfp410_default_timings; ··· 279 274 } 280 275 281 276 /* Get the setup and hold time from vendor-specific properties. */ 282 - of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew); 283 - if (deskew < -4 || deskew > 3) 277 + of_property_read_u32(dvi->dev->of_node, "ti,deskew", &deskew); 278 + if (deskew > 7) 284 279 return -EINVAL; 285 280 286 - timings->setup_time_ps = min(0, 1200 - 350 * deskew); 287 - timings->hold_time_ps = min(0, 1300 + 350 * deskew); 281 + timings->setup_time_ps = 1200 - 350 * ((s32)deskew - 4); 282 + timings->hold_time_ps = max(0, 1300 + 350 * ((s32)deskew - 4)); 288 283 289 284 return 0; 290 285 }
+2 -1
drivers/gpu/drm/drm_atomic_helper.c
··· 506 506 } 507 507 508 508 bridge = drm_bridge_chain_get_first_bridge(encoder); 509 - ret = drm_bridge_chain_mode_valid(bridge, mode); 509 + ret = drm_bridge_chain_mode_valid(bridge, &connector->display_info, 510 + mode); 510 511 if (ret != MODE_OK) { 511 512 DRM_DEBUG_ATOMIC("[BRIDGE] mode_valid() failed\n"); 512 513 return ret;
+6 -4
drivers/gpu/drm/drm_bridge.c
··· 377 377 * drm_bridge_chain_mode_valid - validate the mode against all bridges in the 378 378 * encoder chain. 379 379 * @bridge: bridge control structure 380 + * @info: display info against which the mode shall be validated 380 381 * @mode: desired mode to be validated 381 382 * 382 383 * Calls &drm_bridge_funcs.mode_valid for all the bridges in the encoder ··· 391 390 */ 392 391 enum drm_mode_status 393 392 drm_bridge_chain_mode_valid(struct drm_bridge *bridge, 393 + const struct drm_display_info *info, 394 394 const struct drm_display_mode *mode) 395 395 { 396 396 struct drm_encoder *encoder; ··· 406 404 if (!bridge->funcs->mode_valid) 407 405 continue; 408 406 409 - ret = bridge->funcs->mode_valid(bridge, mode); 407 + ret = bridge->funcs->mode_valid(bridge, info, mode); 410 408 if (ret != MODE_OK) 411 409 return ret; 412 410 } ··· 1088 1086 * 1089 1087 * If the bridge supports output EDID retrieval, as reported by the 1090 1088 * DRM_BRIDGE_OP_EDID bridge ops flag, call &drm_bridge_funcs.get_edid to 1091 - * get the EDID and return it. Otherwise return ERR_PTR(-ENOTSUPP). 1089 + * get the EDID and return it. Otherwise return NULL. 1092 1090 * 1093 1091 * RETURNS: 1094 - * The retrieved EDID on success, or an error pointer otherwise. 1092 + * The retrieved EDID on success, or NULL otherwise. 1095 1093 */ 1096 1094 struct edid *drm_bridge_get_edid(struct drm_bridge *bridge, 1097 1095 struct drm_connector *connector) 1098 1096 { 1099 1097 if (!(bridge->ops & DRM_BRIDGE_OP_EDID)) 1100 - return ERR_PTR(-ENOTSUPP); 1098 + return NULL; 1101 1099 1102 1100 return bridge->funcs->get_edid(bridge, connector); 1103 1101 }
+22
drivers/gpu/drm/drm_debugfs.c
··· 376 376 return (ret) ? ret : len; 377 377 } 378 378 379 + /* 380 + * Returns the min and max vrr vfreq through the connector's debugfs file. 381 + * Example usage: cat /sys/kernel/debug/dri/0/DP-1/vrr_range 382 + */ 383 + static int vrr_range_show(struct seq_file *m, void *data) 384 + { 385 + struct drm_connector *connector = m->private; 386 + 387 + if (connector->status != connector_status_connected) 388 + return -ENODEV; 389 + 390 + seq_printf(m, "Min: %u\n", (u8)connector->display_info.monitor_range.min_vfreq); 391 + seq_printf(m, "Max: %u\n", (u8)connector->display_info.monitor_range.max_vfreq); 392 + 393 + return 0; 394 + } 395 + DEFINE_SHOW_ATTRIBUTE(vrr_range); 396 + 379 397 static const struct file_operations drm_edid_fops = { 380 398 .owner = THIS_MODULE, 381 399 .open = edid_open, ··· 431 413 /* edid */ 432 414 debugfs_create_file("edid_override", S_IRUGO | S_IWUSR, root, connector, 433 415 &drm_edid_fops); 416 + 417 + /* vrr range */ 418 + debugfs_create_file("vrr_range", S_IRUGO, root, connector, 419 + &vrr_range_fops); 434 420 } 435 421 436 422 void drm_debugfs_connector_remove(struct drm_connector *connector)
+6 -6
drivers/gpu/drm/drm_edid.c
··· 5360 5360 } 5361 5361 EXPORT_SYMBOL(drm_set_preferred_mode); 5362 5362 5363 - static bool is_hdmi2_sink(struct drm_connector *connector) 5363 + static bool is_hdmi2_sink(const struct drm_connector *connector) 5364 5364 { 5365 5365 /* 5366 5366 * FIXME: sil-sii8620 doesn't have a connector around when ··· 5445 5445 } 5446 5446 EXPORT_SYMBOL(drm_hdmi_infoframe_set_hdr_metadata); 5447 5447 5448 - static u8 drm_mode_hdmi_vic(struct drm_connector *connector, 5448 + static u8 drm_mode_hdmi_vic(const struct drm_connector *connector, 5449 5449 const struct drm_display_mode *mode) 5450 5450 { 5451 5451 bool has_hdmi_infoframe = connector ? ··· 5461 5461 return drm_match_hdmi_mode(mode); 5462 5462 } 5463 5463 5464 - static u8 drm_mode_cea_vic(struct drm_connector *connector, 5464 + static u8 drm_mode_cea_vic(const struct drm_connector *connector, 5465 5465 const struct drm_display_mode *mode) 5466 5466 { 5467 5467 u8 vic; ··· 5499 5499 */ 5500 5500 int 5501 5501 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, 5502 - struct drm_connector *connector, 5502 + const struct drm_connector *connector, 5503 5503 const struct drm_display_mode *mode) 5504 5504 { 5505 5505 enum hdmi_picture_aspect picture_aspect; ··· 5646 5646 */ 5647 5647 void 5648 5648 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, 5649 - struct drm_connector *connector, 5649 + const struct drm_connector *connector, 5650 5650 const struct drm_display_mode *mode, 5651 5651 enum hdmi_quantization_range rgb_quant_range) 5652 5652 { ··· 5750 5750 */ 5751 5751 int 5752 5752 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 5753 - struct drm_connector *connector, 5753 + const struct drm_connector *connector, 5754 5754 const struct drm_display_mode *mode) 5755 5755 { 5756 5756 /*
+12
drivers/gpu/drm/drm_fourcc.c
··· 274 274 { .format = DRM_FORMAT_YUV420_10BIT, .depth = 0, 275 275 .num_planes = 1, .cpp = { 0, 0, 0 }, .hsub = 2, .vsub = 2, 276 276 .is_yuv = true }, 277 + { .format = DRM_FORMAT_NV15, .depth = 0, 278 + .num_planes = 2, .char_per_block = { 5, 5, 0 }, 279 + .block_w = { 4, 2, 0 }, .block_h = { 1, 1, 0 }, .hsub = 2, 280 + .vsub = 2, .is_yuv = true }, 281 + { .format = DRM_FORMAT_Q410, .depth = 0, 282 + .num_planes = 3, .char_per_block = { 2, 2, 2 }, 283 + .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, 284 + .vsub = 0, .is_yuv = true }, 285 + { .format = DRM_FORMAT_Q401, .depth = 0, 286 + .num_planes = 3, .char_per_block = { 2, 2, 2 }, 287 + .block_w = { 1, 1, 1 }, .block_h = { 1, 1, 1 }, .hsub = 0, 288 + .vsub = 0, .is_yuv = true }, 277 289 }; 278 290 279 291 unsigned int i;
+10 -1
drivers/gpu/drm/drm_gem_vram_helper.c
··· 281 281 } 282 282 EXPORT_SYMBOL(drm_gem_vram_mmap_offset); 283 283 284 + static u64 drm_gem_vram_pg_offset(struct drm_gem_vram_object *gbo) 285 + { 286 + /* Keep TTM behavior for now, remove when drivers are audited */ 287 + if (WARN_ON_ONCE(!gbo->bo.mem.mm_node)) 288 + return 0; 289 + 290 + return gbo->bo.mem.start; 291 + } 292 + 284 293 /** 285 294 * drm_gem_vram_offset() - \ 286 295 Returns a GEM VRAM object's offset in video memory ··· 306 297 { 307 298 if (WARN_ON_ONCE(!gbo->pin_count)) 308 299 return (s64)-ENODEV; 309 - return gbo->bo.offset; 300 + return drm_gem_vram_pg_offset(gbo) << PAGE_SHIFT; 310 301 } 311 302 EXPORT_SYMBOL(drm_gem_vram_offset); 312 303
+6 -10
drivers/gpu/drm/drm_mipi_dbi.c
··· 268 268 bool full; 269 269 void *tr; 270 270 271 - if (!dbidev->enabled) 271 + if (WARN_ON(!fb)) 272 272 return; 273 273 274 274 if (!drm_dev_enter(fb->dev, &idx)) ··· 314 314 struct drm_plane_state *state = pipe->plane.state; 315 315 struct drm_rect rect; 316 316 317 + if (!pipe->crtc.state->active) 318 + return; 319 + 317 320 if (drm_atomic_helper_damage_merged(old_state, state, &rect)) 318 321 mipi_dbi_fb_dirty(state->fb, &rect); 319 322 } ··· 328 325 * @crtc_state: CRTC state 329 326 * @plane_state: Plane state 330 327 * 331 - * This function sets &mipi_dbi->enabled, flushes the whole framebuffer and 332 - * enables the backlight. Drivers can use this in their 333 - * &drm_simple_display_pipe_funcs->enable callback. 328 + * Flushes the whole framebuffer and enables the backlight. Drivers can use this 329 + * in their &drm_simple_display_pipe_funcs->enable callback. 334 330 * 335 331 * Note: Drivers which don't use mipi_dbi_pipe_update() because they have custom 336 332 * framebuffer flushing, can't use this function since they both use the same ··· 351 349 if (!drm_dev_enter(&dbidev->drm, &idx)) 352 350 return; 353 351 354 - dbidev->enabled = true; 355 352 mipi_dbi_fb_dirty(fb, &rect); 356 353 backlight_enable(dbidev->backlight); 357 354 ··· 391 390 { 392 391 struct mipi_dbi_dev *dbidev = drm_to_mipi_dbi_dev(pipe->crtc.dev); 393 392 394 - if (!dbidev->enabled) 395 - return; 396 - 397 393 DRM_DEBUG_KMS("\n"); 398 - 399 - dbidev->enabled = false; 400 394 401 395 if (dbidev->backlight) 402 396 backlight_disable(dbidev->backlight);
+40 -80
drivers/gpu/drm/drm_mm.c
··· 305 305 return rb_entry_safe(rb, struct drm_mm_node, rb_hole_addr); 306 306 } 307 307 308 - static inline u64 rb_hole_size(struct rb_node *rb) 309 - { 310 - return rb_entry(rb, struct drm_mm_node, rb_hole_size)->hole_size; 311 - } 312 - 313 308 static struct drm_mm_node *best_hole(struct drm_mm *mm, u64 size) 314 309 { 315 310 struct rb_node *rb = mm->holes_size.rb_root.rb_node; ··· 325 330 return best; 326 331 } 327 332 328 - static struct drm_mm_node *find_hole(struct drm_mm *mm, u64 addr) 333 + static bool usable_hole_addr(struct rb_node *rb, u64 size) 334 + { 335 + return rb && rb_hole_addr_to_node(rb)->subtree_max_hole >= size; 336 + } 337 + 338 + static struct drm_mm_node *find_hole_addr(struct drm_mm *mm, u64 addr, u64 size) 329 339 { 330 340 struct rb_node *rb = mm->holes_addr.rb_node; 331 341 struct drm_mm_node *node = NULL; 332 342 333 343 while (rb) { 334 344 u64 hole_start; 345 + 346 + if (!usable_hole_addr(rb, size)) 347 + break; 335 348 336 349 node = rb_hole_addr_to_node(rb); 337 350 hole_start = __drm_mm_hole_node_start(node); ··· 366 363 return best_hole(mm, size); 367 364 368 365 case DRM_MM_INSERT_LOW: 369 - return find_hole(mm, start); 366 + return find_hole_addr(mm, start, size); 370 367 371 368 case DRM_MM_INSERT_HIGH: 372 - return find_hole(mm, end); 369 + return find_hole_addr(mm, end, size); 373 370 374 371 case DRM_MM_INSERT_EVICT: 375 372 return list_first_entry_or_null(&mm->hole_stack, ··· 379 376 } 380 377 381 378 /** 382 - * next_hole_high_addr - returns next hole for a DRM_MM_INSERT_HIGH mode request 383 - * @entry: previously selected drm_mm_node 384 - * @size: size of the a hole needed for the request 379 + * DECLARE_NEXT_HOLE_ADDR - macro to declare next hole functions 380 + * @name: name of function to declare 381 + * @first: first rb member to traverse (either rb_left or rb_right). 382 + * @last: last rb member to traverse (either rb_right or rb_left). 385 383 * 386 - * This function will verify whether left subtree of @entry has hole big enough 387 - * to fit the requtested size. If so, it will return previous node of @entry or 388 - * else it will return parent node of @entry 389 - * 390 - * It will also skip the complete left subtree if subtree_max_hole of that 391 - * subtree is same as the subtree_max_hole of the @entry. 392 - * 393 - * Returns: 394 - * previous node of @entry if left subtree of @entry can serve the request or 395 - * else return parent of @entry 384 + * This macro declares a function to return the next hole of the addr rb tree. 385 + * While traversing the tree we take the searched size into account and only 386 + * visit branches with potential big enough holes. 396 387 */ 397 - static struct drm_mm_node * 398 - next_hole_high_addr(struct drm_mm_node *entry, u64 size) 399 - { 400 - struct rb_node *rb_node, *left_rb_node, *parent_rb_node; 401 - struct drm_mm_node *left_node; 402 388 403 - if (!entry) 404 - return NULL; 405 - 406 - rb_node = &entry->rb_hole_addr; 407 - if (rb_node->rb_left) { 408 - left_rb_node = rb_node->rb_left; 409 - parent_rb_node = rb_parent(rb_node); 410 - left_node = rb_entry(left_rb_node, 411 - struct drm_mm_node, rb_hole_addr); 412 - if (left_node->subtree_max_hole < size && 413 - parent_rb_node && parent_rb_node->rb_left != rb_node) 414 - return rb_hole_addr_to_node(parent_rb_node); 415 - } 416 - 417 - return rb_hole_addr_to_node(rb_prev(rb_node)); 389 + #define DECLARE_NEXT_HOLE_ADDR(name, first, last) \ 390 + static struct drm_mm_node *name(struct drm_mm_node *entry, u64 size) \ 391 + { \ 392 + struct rb_node *parent, *node = &entry->rb_hole_addr; \ 393 + \ 394 + if (!entry || RB_EMPTY_NODE(node)) \ 395 + return NULL; \ 396 + \ 397 + if (usable_hole_addr(node->first, size)) { \ 398 + node = node->first; \ 399 + while (usable_hole_addr(node->last, size)) \ 400 + node = node->last; \ 401 + return rb_hole_addr_to_node(node); \ 402 + } \ 403 + \ 404 + while ((parent = rb_parent(node)) && node == parent->first) \ 405 + node = parent; \ 406 + \ 407 + return rb_hole_addr_to_node(parent); \ 418 408 } 419 409 420 - /** 421 - * next_hole_low_addr - returns next hole for a DRM_MM_INSERT_LOW mode request 422 - * @entry: previously selected drm_mm_node 423 - * @size: size of the a hole needed for the request 424 - * 425 - * This function will verify whether right subtree of @entry has hole big enough 426 - * to fit the requtested size. If so, it will return next node of @entry or 427 - * else it will return parent node of @entry 428 - * 429 - * It will also skip the complete right subtree if subtree_max_hole of that 430 - * subtree is same as the subtree_max_hole of the @entry. 431 - * 432 - * Returns: 433 - * next node of @entry if right subtree of @entry can serve the request or 434 - * else return parent of @entry 435 - */ 436 - static struct drm_mm_node * 437 - next_hole_low_addr(struct drm_mm_node *entry, u64 size) 438 - { 439 - struct rb_node *rb_node, *right_rb_node, *parent_rb_node; 440 - struct drm_mm_node *right_node; 441 - 442 - if (!entry) 443 - return NULL; 444 - 445 - rb_node = &entry->rb_hole_addr; 446 - if (rb_node->rb_right) { 447 - right_rb_node = rb_node->rb_right; 448 - parent_rb_node = rb_parent(rb_node); 449 - right_node = rb_entry(right_rb_node, 450 - struct drm_mm_node, rb_hole_addr); 451 - if (right_node->subtree_max_hole < size && 452 - parent_rb_node && parent_rb_node->rb_right != rb_node) 453 - return rb_hole_addr_to_node(parent_rb_node); 454 - } 455 - 456 - return rb_hole_addr_to_node(rb_next(rb_node)); 457 - } 410 + DECLARE_NEXT_HOLE_ADDR(next_hole_high_addr, rb_left, rb_right) 411 + DECLARE_NEXT_HOLE_ADDR(next_hole_low_addr, rb_right, rb_left) 458 412 459 413 static struct drm_mm_node * 460 414 next_hole(struct drm_mm *mm, ··· 462 502 return -ENOSPC; 463 503 464 504 /* Find the relevant hole to add our node to */ 465 - hole = find_hole(mm, node->start); 505 + hole = find_hole_addr(mm, node->start, 0); 466 506 if (!hole) 467 507 return -ENOSPC; 468 508
+3 -1
drivers/gpu/drm/drm_probe_helper.c
··· 114 114 } 115 115 116 116 bridge = drm_bridge_chain_get_first_bridge(encoder); 117 - ret = drm_bridge_chain_mode_valid(bridge, mode); 117 + ret = drm_bridge_chain_mode_valid(bridge, 118 + &connector->display_info, 119 + mode); 118 120 if (ret != MODE_OK) { 119 121 /* There is also no point in continuing for crtc check 120 122 * here. */
+1
drivers/gpu/drm/i2c/tda998x_drv.c
··· 1379 1379 } 1380 1380 1381 1381 static enum drm_mode_status tda998x_bridge_mode_valid(struct drm_bridge *bridge, 1382 + const struct drm_display_info *info, 1382 1383 const struct drm_display_mode *mode) 1383 1384 { 1384 1385 /* TDA19988 dotclock can go up to 165MHz */
+4 -2
drivers/gpu/drm/imx/dw_hdmi-imx.c
··· 145 145 }; 146 146 147 147 static enum drm_mode_status 148 - imx6q_hdmi_mode_valid(struct drm_connector *con, 148 + imx6q_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, 149 + const struct drm_display_info *info, 149 150 const struct drm_display_mode *mode) 150 151 { 151 152 if (mode->clock < 13500) ··· 159 158 } 160 159 161 160 static enum drm_mode_status 162 - imx6dl_hdmi_mode_valid(struct drm_connector *con, 161 + imx6dl_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, 162 + const struct drm_display_info *info, 163 163 const struct drm_display_mode *mode) 164 164 { 165 165 if (mode->clock < 13500)
+19 -15
drivers/gpu/drm/meson/meson_dw_hdmi.c
··· 297 297 298 298 /* Setup PHY bandwidth modes */ 299 299 static void meson_hdmi_phy_setup_mode(struct meson_dw_hdmi *dw_hdmi, 300 - struct drm_display_mode *mode) 300 + const struct drm_display_mode *mode) 301 301 { 302 302 struct meson_drm *priv = dw_hdmi->priv; 303 303 unsigned int pixel_clock = mode->clock; ··· 427 427 } 428 428 429 429 static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, 430 - struct drm_display_mode *mode) 430 + const struct drm_display_info *display, 431 + const struct drm_display_mode *mode) 431 432 { 432 433 struct meson_dw_hdmi *dw_hdmi = (struct meson_dw_hdmi *)data; 433 434 struct meson_drm *priv = dw_hdmi->priv; ··· 497 496 /* Disable clock, fifo, fifo_wr */ 498 497 regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0); 499 498 500 - dw_hdmi_set_high_tmds_clock_ratio(hdmi); 499 + dw_hdmi_set_high_tmds_clock_ratio(hdmi, display); 501 500 502 501 msleep(100); 503 502 ··· 631 630 } 632 631 633 632 static enum drm_mode_status 634 - dw_hdmi_mode_valid(struct drm_connector *connector, 633 + dw_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, 634 + const struct drm_display_info *display_info, 635 635 const struct drm_display_mode *mode) 636 636 { 637 - struct meson_drm *priv = connector->dev->dev_private; 638 - bool is_hdmi2_sink = connector->display_info.hdmi.scdc.supported; 637 + struct meson_dw_hdmi *dw_hdmi = data; 638 + struct meson_drm *priv = dw_hdmi->priv; 639 + bool is_hdmi2_sink = display_info->hdmi.scdc.supported; 639 640 unsigned int phy_freq; 640 641 unsigned int vclk_freq; 641 642 unsigned int venc_freq; ··· 648 645 DRM_DEBUG_DRIVER("Modeline " DRM_MODE_FMT "\n", DRM_MODE_ARG(mode)); 649 646 650 647 /* If sink does not support 540MHz, reject the non-420 HDMI2 modes */ 651 - if (connector->display_info.max_tmds_clock && 652 - mode->clock > connector->display_info.max_tmds_clock && 653 - !drm_mode_is_420_only(&connector->display_info, mode) && 654 - !drm_mode_is_420_also(&connector->display_info, mode)) 648 + if (display_info->max_tmds_clock && 649 + mode->clock > display_info->max_tmds_clock && 650 + !drm_mode_is_420_only(display_info, mode) && 651 + !drm_mode_is_420_also(display_info, mode)) 655 652 return MODE_BAD; 656 653 657 654 /* Check against non-VIC supported modes */ ··· 668 665 vclk_freq = mode->clock; 669 666 670 667 /* For 420, pixel clock is half unlike venc clock */ 671 - if (drm_mode_is_420_only(&connector->display_info, mode) || 668 + if (drm_mode_is_420_only(display_info, mode) || 672 669 (!is_hdmi2_sink && 673 - drm_mode_is_420_also(&connector->display_info, mode))) 670 + drm_mode_is_420_also(display_info, mode))) 674 671 vclk_freq /= 2; 675 672 676 673 /* TMDS clock is pixel_clock * 10 */ ··· 685 682 686 683 /* VENC double pixels for 1080i, 720p and YUV420 modes */ 687 684 if (meson_venc_hdmi_venc_repeat(vic) || 688 - drm_mode_is_420_only(&connector->display_info, mode) || 685 + drm_mode_is_420_only(display_info, mode) || 689 686 (!is_hdmi2_sink && 690 - drm_mode_is_420_also(&connector->display_info, mode))) 687 + drm_mode_is_420_also(display_info, mode))) 691 688 venc_freq *= 2; 692 689 693 690 vclk_freq = max(venc_freq, hdmi_freq); ··· 695 692 if (mode->flags & DRM_MODE_FLAG_DBLCLK) 696 693 venc_freq /= 2; 697 694 698 - dev_dbg(connector->dev->dev, "%s: vclk:%d phy=%d venc=%d hdmi=%d\n", 695 + dev_dbg(dw_hdmi->dev, "%s: vclk:%d phy=%d venc=%d hdmi=%d\n", 699 696 __func__, phy_freq, vclk_freq, venc_freq, hdmi_freq); 700 697 701 698 return meson_vclk_vic_supported_freq(priv, phy_freq, vclk_freq); ··· 1068 1065 1069 1066 /* Bridge / Connector */ 1070 1067 1068 + dw_plat_data->priv_data = meson_dw_hdmi; 1071 1069 dw_plat_data->mode_valid = dw_hdmi_mode_valid; 1072 1070 dw_plat_data->phy_ops = &meson_dw_hdmi_phy_ops; 1073 1071 dw_plat_data->phy_name = "meson_dw_hdmi_phy";
+1
drivers/gpu/drm/omapdrm/dss/dpi.c
··· 434 434 435 435 static enum drm_mode_status 436 436 dpi_bridge_mode_valid(struct drm_bridge *bridge, 437 + const struct drm_display_info *info, 437 438 const struct drm_display_mode *mode) 438 439 { 439 440 struct dpi_data *dpi = drm_bridge_to_dpi(bridge);
+1
drivers/gpu/drm/omapdrm/dss/sdi.c
··· 140 140 141 141 static enum drm_mode_status 142 142 sdi_bridge_mode_valid(struct drm_bridge *bridge, 143 + const struct drm_display_info *info, 143 144 const struct drm_display_mode *mode) 144 145 { 145 146 struct sdi_device *sdi = drm_bridge_to_sdi(bridge);
+1
drivers/gpu/drm/omapdrm/dss/venc.c
··· 548 548 549 549 static enum drm_mode_status 550 550 venc_bridge_mode_valid(struct drm_bridge *bridge, 551 + const struct drm_display_info *info, 551 552 const struct drm_display_mode *mode) 552 553 { 553 554 switch (venc_get_videomode(mode)) {
-1
drivers/gpu/drm/panel/panel-orisetech-otm8009a.c
··· 479 479 if (ret < 0) { 480 480 dev_err(dev, "mipi_dsi_attach failed. Is host ready?\n"); 481 481 drm_panel_remove(&ctx->panel); 482 - backlight_device_unregister(ctx->bl_dev); 483 482 return ret; 484 483 } 485 484
+82
drivers/gpu/drm/panel/panel-simple.c
··· 687 687 .width = 223, 688 688 .height = 125, 689 689 }, 690 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 690 691 }; 691 692 692 693 static const struct display_timing auo_b101ean01_timing = { ··· 1297 1296 .bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE, 1298 1297 }; 1299 1298 1299 + /* S070PWS19HP-FC21 2017/04/22 */ 1300 + static const struct drm_display_mode cdtech_s070pws19hp_fc21_mode = { 1301 + .clock = 51200, 1302 + .hdisplay = 1024, 1303 + .hsync_start = 1024 + 160, 1304 + .hsync_end = 1024 + 160 + 20, 1305 + .htotal = 1024 + 160 + 20 + 140, 1306 + .vdisplay = 600, 1307 + .vsync_start = 600 + 12, 1308 + .vsync_end = 600 + 12 + 3, 1309 + .vtotal = 600 + 12 + 3 + 20, 1310 + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, 1311 + }; 1312 + 1313 + static const struct panel_desc cdtech_s070pws19hp_fc21 = { 1314 + .modes = &cdtech_s070pws19hp_fc21_mode, 1315 + .num_modes = 1, 1316 + .bpc = 6, 1317 + .size = { 1318 + .width = 154, 1319 + .height = 86, 1320 + }, 1321 + .bus_format = MEDIA_BUS_FMT_RGB666_1X18, 1322 + .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE, 1323 + .connector_type = DRM_MODE_CONNECTOR_DPI, 1324 + }; 1325 + 1326 + /* S070SWV29HG-DC44 2017/09/21 */ 1327 + static const struct drm_display_mode cdtech_s070swv29hg_dc44_mode = { 1328 + .clock = 33300, 1329 + .hdisplay = 800, 1330 + .hsync_start = 800 + 210, 1331 + .hsync_end = 800 + 210 + 2, 1332 + .htotal = 800 + 210 + 2 + 44, 1333 + .vdisplay = 480, 1334 + .vsync_start = 480 + 22, 1335 + .vsync_end = 480 + 22 + 2, 1336 + .vtotal = 480 + 22 + 2 + 21, 1337 + .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC, 1338 + }; 1339 + 1340 + static const struct panel_desc cdtech_s070swv29hg_dc44 = { 1341 + .modes = &cdtech_s070swv29hg_dc44_mode, 1342 + .num_modes = 1, 1343 + .bpc = 6, 1344 + .size = { 1345 + .width = 154, 1346 + .height = 86, 1347 + }, 1348 + .bus_format = MEDIA_BUS_FMT_RGB666_1X18, 1349 + .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE, 1350 + .connector_type = DRM_MODE_CONNECTOR_DPI, 1351 + }; 1352 + 1300 1353 static const struct drm_display_mode cdtech_s070wv95_ct16_mode = { 1301 1354 .clock = 35000, 1302 1355 .hdisplay = 800, ··· 1395 1340 .width = 94, 1396 1341 .height = 150, 1397 1342 }, 1343 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 1398 1344 }; 1399 1345 1400 1346 static const struct drm_display_mode chunghwa_claa101wa01a_mode = { ··· 1418 1362 .width = 220, 1419 1363 .height = 120, 1420 1364 }, 1365 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 1421 1366 }; 1422 1367 1423 1368 static const struct drm_display_mode chunghwa_claa101wb01_mode = { ··· 1441 1384 .width = 223, 1442 1385 .height = 125, 1443 1386 }, 1387 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 1444 1388 }; 1445 1389 1446 1390 static const struct drm_display_mode dataimage_scf0700c48ggu18_mode = { ··· 1631 1573 }, 1632 1574 .bus_format = MEDIA_BUS_FMT_RGB666_1X18, 1633 1575 .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE, 1576 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 1634 1577 }; 1635 1578 1636 1579 static const struct drm_display_mode edt_etm0700g0dh6_mode = { ··· 2114 2055 .width = 344, 2115 2056 .height = 193, 2116 2057 }, 2058 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 2117 2059 }; 2118 2060 2119 2061 static const struct drm_display_mode innolux_p120zdg_bf1_mode = { ··· 3061 3001 .width = 223, 3062 3002 .height = 125, 3063 3003 }, 3004 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 3064 3005 }; 3065 3006 3066 3007 static const struct drm_display_mode samsung_ltn140at29_301_mode = { ··· 3382 3321 .size = { 3383 3322 .width = 151, 3384 3323 .height = 95, 3324 + }, 3325 + .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 3326 + .connector_type = DRM_MODE_CONNECTOR_LVDS, 3327 + }; 3328 + 3329 + static const struct panel_desc tianma_tm070jvhg33 = { 3330 + .timings = &tianma_tm070jdhg30_timing, 3331 + .num_timings = 1, 3332 + .bpc = 8, 3333 + .size = { 3334 + .width = 150, 3335 + .height = 94, 3385 3336 }, 3386 3337 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG, 3387 3338 .connector_type = DRM_MODE_CONNECTOR_LVDS, ··· 3748 3675 .compatible = "cdtech,s043wq26h-ct7", 3749 3676 .data = &cdtech_s043wq26h_ct7, 3750 3677 }, { 3678 + .compatible = "cdtech,s070pws19hp-fc21", 3679 + .data = &cdtech_s070pws19hp_fc21, 3680 + }, { 3681 + .compatible = "cdtech,s070swv29hg-dc44", 3682 + .data = &cdtech_s070swv29hg_dc44, 3683 + }, { 3751 3684 .compatible = "cdtech,s070wv95-ct16", 3752 3685 .data = &cdtech_s070wv95_ct16, 3753 3686 }, { ··· 4002 3923 }, { 4003 3924 .compatible = "tianma,tm070jdhg30", 4004 3925 .data = &tianma_tm070jdhg30, 3926 + }, { 3927 + .compatible = "tianma,tm070jvhg33", 3928 + .data = &tianma_tm070jvhg33, 4005 3929 }, { 4006 3930 .compatible = "tianma,tm070rvhg71", 4007 3931 .data = &tianma_tm070rvhg71,
+2 -4
drivers/gpu/drm/qxl/qxl_drv.h
··· 134 134 uint64_t start_phys_addr; 135 135 uint64_t size; 136 136 uint64_t high_bits; 137 - uint64_t gpu_offset; 138 137 }; 139 138 140 139 enum { ··· 306 307 (bo->tbo.mem.mem_type == TTM_PL_VRAM) 307 308 ? &qdev->main_slot : &qdev->surfaces_slot; 308 309 309 - WARN_ON_ONCE((bo->tbo.offset & slot->gpu_offset) != slot->gpu_offset); 310 + /* TODO - need to hold one of the locks to read bo->tbo.mem.start */ 310 311 311 - /* TODO - need to hold one of the locks to read tbo.offset */ 312 - return slot->high_bits | (bo->tbo.offset - slot->gpu_offset + offset); 312 + return slot->high_bits | ((bo->tbo.mem.start << PAGE_SHIFT) + offset); 313 313 } 314 314 315 315 /* qxl_display.c */
+2 -3
drivers/gpu/drm/qxl/qxl_kms.c
··· 87 87 high_bits <<= (64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits)); 88 88 slot->high_bits = high_bits; 89 89 90 - DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx, gpu_offset 0x%lx\n", 90 + DRM_INFO("slot %d (%s): base 0x%08lx, size 0x%08lx\n", 91 91 slot->index, slot->name, 92 92 (unsigned long)slot->start_phys_addr, 93 - (unsigned long)slot->size, 94 - (unsigned long)slot->gpu_offset); 93 + (unsigned long)slot->size); 95 94 } 96 95 97 96 void qxl_reinit_memslots(struct qxl_device *qdev)
-5
drivers/gpu/drm/qxl/qxl_object.h
··· 48 48 ttm_bo_unreserve(&bo->tbo); 49 49 } 50 50 51 - static inline u64 qxl_bo_gpu_offset(struct qxl_bo *bo) 52 - { 53 - return bo->tbo.offset; 54 - } 55 - 56 51 static inline unsigned long qxl_bo_size(struct qxl_bo *bo) 57 52 { 58 53 return bo->tbo.num_pages << PAGE_SHIFT;
-9
drivers/gpu/drm/qxl/qxl_ttm.c
··· 51 51 static int qxl_init_mem_type(struct ttm_bo_device *bdev, uint32_t type, 52 52 struct ttm_mem_type_manager *man) 53 53 { 54 - struct qxl_device *qdev = qxl_get_qdev(bdev); 55 - unsigned int gpu_offset_shift = 56 - 64 - (qdev->rom->slot_gen_bits + qdev->rom->slot_id_bits + 8); 57 - struct qxl_memslot *slot; 58 - 59 54 switch (type) { 60 55 case TTM_PL_SYSTEM: 61 56 /* System memory */ ··· 61 66 case TTM_PL_VRAM: 62 67 case TTM_PL_PRIV: 63 68 /* "On-card" video ram */ 64 - slot = (type == TTM_PL_VRAM) ? 65 - &qdev->main_slot : &qdev->surfaces_slot; 66 - slot->gpu_offset = (uint64_t)type << gpu_offset_shift; 67 69 man->func = &ttm_bo_manager_func; 68 - man->gpu_offset = slot->gpu_offset; 69 70 man->flags = TTM_MEMTYPE_FLAG_FIXED | 70 71 TTM_MEMTYPE_FLAG_MAPPABLE; 71 72 man->available_caching = TTM_PL_MASK_CACHING;
+1
drivers/gpu/drm/radeon/radeon.h
··· 2828 2828 extern void radeon_program_register_sequence(struct radeon_device *rdev, 2829 2829 const u32 *registers, 2830 2830 const u32 array_size); 2831 + struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev); 2831 2832 2832 2833 /* 2833 2834 * vm
+15 -1
drivers/gpu/drm/radeon/radeon_object.h
··· 90 90 */ 91 91 static inline u64 radeon_bo_gpu_offset(struct radeon_bo *bo) 92 92 { 93 - return bo->tbo.offset; 93 + struct radeon_device *rdev; 94 + u64 start = 0; 95 + 96 + rdev = radeon_get_rdev(bo->tbo.bdev); 97 + 98 + switch (bo->tbo.mem.mem_type) { 99 + case TTM_PL_TT: 100 + start = rdev->mc.gtt_start; 101 + break; 102 + case TTM_PL_VRAM: 103 + start = rdev->mc.vram_start; 104 + break; 105 + } 106 + 107 + return (bo->tbo.mem.start << PAGE_SHIFT) + start; 94 108 } 95 109 96 110 static inline unsigned long radeon_bo_size(struct radeon_bo *bo)
+1 -3
drivers/gpu/drm/radeon/radeon_ttm.c
··· 56 56 static int radeon_ttm_debugfs_init(struct radeon_device *rdev); 57 57 static void radeon_ttm_debugfs_fini(struct radeon_device *rdev); 58 58 59 - static struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev) 59 + struct radeon_device *radeon_get_rdev(struct ttm_bo_device *bdev) 60 60 { 61 61 struct radeon_mman *mman; 62 62 struct radeon_device *rdev; ··· 82 82 break; 83 83 case TTM_PL_TT: 84 84 man->func = &ttm_bo_manager_func; 85 - man->gpu_offset = rdev->mc.gtt_start; 86 85 man->available_caching = TTM_PL_MASK_CACHING; 87 86 man->default_caching = TTM_PL_FLAG_CACHED; 88 87 man->flags = TTM_MEMTYPE_FLAG_MAPPABLE | TTM_MEMTYPE_FLAG_CMA; ··· 103 104 case TTM_PL_VRAM: 104 105 /* "On-card" video ram */ 105 106 man->func = &ttm_bo_manager_func; 106 - man->gpu_offset = rdev->mc.vram_start; 107 107 man->flags = TTM_MEMTYPE_FLAG_FIXED | 108 108 TTM_MEMTYPE_FLAG_MAPPABLE; 109 109 man->available_caching = TTM_PL_FLAG_UNCACHED | TTM_PL_FLAG_WC;
+3 -3
drivers/gpu/drm/rcar-du/rcar_dw_hdmi.c
··· 38 38 }; 39 39 40 40 static enum drm_mode_status 41 - rcar_hdmi_mode_valid(struct drm_connector *connector, 41 + rcar_hdmi_mode_valid(struct dw_hdmi *hdmi, void *data, 42 + const struct drm_display_info *info, 42 43 const struct drm_display_mode *mode) 43 44 { 44 45 /* ··· 52 51 return MODE_OK; 53 52 } 54 53 55 - static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, 56 - const struct dw_hdmi_plat_data *pdata, 54 + static int rcar_hdmi_phy_configure(struct dw_hdmi *hdmi, void *data, 57 55 unsigned long mpixelclock) 58 56 { 59 57 const struct rcar_hdmi_phy_params *params = rcar_hdmi_phy_params;
+4 -2
drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
··· 220 220 } 221 221 222 222 static enum drm_mode_status 223 - dw_hdmi_rockchip_mode_valid(struct drm_connector *connector, 223 + dw_hdmi_rockchip_mode_valid(struct dw_hdmi *hdmi, void *data, 224 + const struct drm_display_info *info, 224 225 const struct drm_display_mode *mode) 225 226 { 226 227 const struct dw_hdmi_mpll_config *mpll_cfg = rockchip_mpll_cfg; ··· 312 311 }; 313 312 314 313 static int dw_hdmi_rockchip_genphy_init(struct dw_hdmi *dw_hdmi, void *data, 315 - struct drm_display_mode *mode) 314 + const struct drm_display_info *display, 315 + const struct drm_display_mode *mode) 316 316 { 317 317 struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data; 318 318
+7 -25
drivers/gpu/drm/selftests/test-drm_mm.c
··· 1041 1041 { 1042 1042 unsigned int size = 4096; 1043 1043 unsigned int i; 1044 - u64 ret = -EINVAL; 1045 1044 1046 1045 for (i = 0; i < num_insert; i++) { 1047 1046 if (!expect_insert(mm, &nodes[i], size, 0, i, 1048 1047 mode) != 0) { 1049 1048 pr_err("%s insert failed\n", mode->name); 1050 - goto out; 1049 + return -EINVAL; 1051 1050 } 1052 1051 } 1053 1052 ··· 1056 1057 drm_mm_remove_node(&nodes[i]); 1057 1058 } 1058 1059 1059 - out: 1060 - return ret; 1060 + return 0; 1061 1061 1062 1062 } 1063 1063 ··· 1068 1070 unsigned int size = 8192; 1069 1071 ktime_t start; 1070 1072 unsigned int i; 1071 - u64 ret = -EINVAL; 1072 1073 1073 1074 start = ktime_get(); 1074 1075 for (i = 0; i < num_insert; i++) { 1075 1076 if (!expect_insert(mm, &nodes[i], size, 0, i, mode) != 0) { 1076 1077 pr_err("%s insert failed\n", mode->name); 1077 - goto out; 1078 + return 0; 1078 1079 } 1079 1080 } 1080 1081 1081 - ret = ktime_to_ns(ktime_sub(ktime_get(), start)); 1082 - 1083 - out: 1084 - return ret; 1085 - 1082 + return ktime_to_ns(ktime_sub(ktime_get(), start)); 1086 1083 } 1087 1084 1088 1085 static int igt_frag(void *ignored) ··· 1112 1119 continue; 1113 1120 1114 1121 ret = prepare_igt_frag(&mm, nodes, insert_size, mode); 1115 - if (!ret) 1122 + if (ret) 1116 1123 goto err; 1117 1124 1118 1125 insert_time1 = get_insert_time(&mm, insert_size, 1119 1126 nodes + insert_size, mode); 1120 - if (insert_time1 < 0) 1127 + if (insert_time1 == 0) 1121 1128 goto err; 1122 1129 1123 1130 insert_time2 = get_insert_time(&mm, (insert_size * 2), 1124 1131 nodes + insert_size * 2, mode); 1125 - if (insert_time2 < 0) 1132 + if (insert_time2 == 0) 1126 1133 goto err; 1127 1134 1128 1135 pr_info("%s fragmented insert of %u and %u insertions took %llu and %llu nsecs\n", ··· 1974 1981 } 1975 1982 1976 1983 memset(&node, 0, sizeof(node)); 1977 - err = drm_mm_insert_node_generic(&mm, &node, 1978 - 2, 0, 0, 1979 - mode | DRM_MM_INSERT_ONCE); 1980 - if (!err) { 1981 - pr_err("Unexpectedly inserted the node into the wrong hole: node.start=%llx\n", 1982 - node.start); 1983 - err = -EINVAL; 1984 - goto err_node; 1985 - } 1986 - 1987 1984 err = drm_mm_insert_node_generic(&mm, &node, 2, 0, 0, mode); 1988 1985 if (err) { 1989 1986 pr_err("Could not insert the node into the available hole!\n"); ··· 1981 1998 goto err_hi; 1982 1999 } 1983 2000 1984 - err_node: 1985 2001 drm_mm_remove_node(&node); 1986 2002 err_hi: 1987 2003 drm_mm_remove_node(&rsvd_hi);
+4 -2
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c
··· 31 31 }; 32 32 33 33 static enum drm_mode_status 34 - sun8i_dw_hdmi_mode_valid_a83t(struct drm_connector *connector, 34 + sun8i_dw_hdmi_mode_valid_a83t(struct dw_hdmi *hdmi, void *data, 35 + const struct drm_display_info *info, 35 36 const struct drm_display_mode *mode) 36 37 { 37 38 if (mode->clock > 297000) ··· 42 41 } 43 42 44 43 static enum drm_mode_status 45 - sun8i_dw_hdmi_mode_valid_h6(struct drm_connector *connector, 44 + sun8i_dw_hdmi_mode_valid_h6(struct dw_hdmi *hdmi, void *data, 45 + const struct drm_display_info *info, 46 46 const struct drm_display_mode *mode) 47 47 { 48 48 /*
+2 -1
drivers/gpu/drm/sun4i/sun8i_dw_hdmi.h
··· 176 176 }; 177 177 178 178 struct sun8i_dw_hdmi_quirks { 179 - enum drm_mode_status (*mode_valid)(struct drm_connector *connector, 179 + enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data, 180 + const struct drm_display_info *info, 180 181 const struct drm_display_mode *mode); 181 182 unsigned int set_rate : 1; 182 183 unsigned int use_drm_infoframe : 1;
+2 -1
drivers/gpu/drm/sun4i/sun8i_hdmi_phy.c
··· 341 341 } 342 342 343 343 static int sun8i_hdmi_phy_config(struct dw_hdmi *hdmi, void *data, 344 - struct drm_display_mode *mode) 344 + const struct drm_display_info *display, 345 + const struct drm_display_mode *mode) 345 346 { 346 347 struct sun8i_hdmi_phy *phy = (struct sun8i_hdmi_phy *)data; 347 348 u32 val = 0;
+3 -9
drivers/gpu/drm/tiny/ili9225.c
··· 89 89 bool full; 90 90 void *tr; 91 91 92 - if (!dbidev->enabled) 93 - return; 94 - 95 92 if (!drm_dev_enter(fb->dev, &idx)) 96 93 return; 97 94 ··· 163 166 { 164 167 struct drm_plane_state *state = pipe->plane.state; 165 168 struct drm_rect rect; 169 + 170 + if (!pipe->crtc.state->active) 171 + return; 166 172 167 173 if (drm_atomic_helper_damage_merged(old_state, state, &rect)) 168 174 ili9225_fb_dirty(state->fb, &rect); ··· 275 275 276 276 ili9225_command(dbi, ILI9225_DISPLAY_CONTROL_1, 0x1017); 277 277 278 - dbidev->enabled = true; 279 278 ili9225_fb_dirty(fb, &rect); 280 279 out_exit: 281 280 drm_dev_exit(idx); ··· 294 295 * unplug. 295 296 */ 296 297 297 - if (!dbidev->enabled) 298 - return; 299 - 300 298 ili9225_command(dbi, ILI9225_DISPLAY_CONTROL_1, 0x0000); 301 299 msleep(50); 302 300 ili9225_command(dbi, ILI9225_POWER_CONTROL_2, 0x0007); 303 301 msleep(50); 304 302 ili9225_command(dbi, ILI9225_POWER_CONTROL_1, 0x0a02); 305 - 306 - dbidev->enabled = false; 307 303 } 308 304 309 305 static int ili9225_dbi_command(struct mipi_dbi *dbi, u8 *cmd, u8 *par,
+3 -10
drivers/gpu/drm/tiny/repaper.c
··· 88 88 u8 *line_buffer; 89 89 void *current_frame; 90 90 91 - bool enabled; 92 91 bool cleared; 93 92 bool partial; 94 93 }; ··· 537 538 int idx, ret = 0; 538 539 u8 *buf = NULL; 539 540 540 - if (!epd->enabled) 541 - return 0; 542 - 543 541 if (!drm_dev_enter(fb->dev, &idx)) 544 542 return -ENODEV; 545 543 ··· 782 786 */ 783 787 repaper_write_val(spi, 0x02, 0x04); 784 788 785 - epd->enabled = true; 786 789 epd->partial = false; 787 790 out_exit: 788 791 drm_dev_exit(idx); ··· 800 805 * unplug. 801 806 */ 802 807 803 - if (!epd->enabled) 804 - return; 805 - 806 808 DRM_DEBUG_DRIVER("\n"); 807 - 808 - epd->enabled = false; 809 809 810 810 /* Nothing frame */ 811 811 for (line = 0; line < epd->height; line++) ··· 848 858 { 849 859 struct drm_plane_state *state = pipe->plane.state; 850 860 struct drm_rect rect; 861 + 862 + if (!pipe->crtc.state->active) 863 + return; 851 864 852 865 if (drm_atomic_helper_damage_merged(old_state, state, &rect)) 853 866 repaper_fb_dirty(state->fb);
+3 -8
drivers/gpu/drm/tiny/st7586.c
··· 118 118 struct mipi_dbi *dbi = &dbidev->dbi; 119 119 int start, end, idx, ret = 0; 120 120 121 - if (!dbidev->enabled) 122 - return; 123 - 124 121 if (!drm_dev_enter(fb->dev, &idx)) 125 122 return; 126 123 ··· 157 160 { 158 161 struct drm_plane_state *state = pipe->plane.state; 159 162 struct drm_rect rect; 163 + 164 + if (!pipe->crtc.state->active) 165 + return; 160 166 161 167 if (drm_atomic_helper_damage_merged(old_state, state, &rect)) 162 168 st7586_fb_dirty(state->fb, &rect); ··· 237 237 238 238 msleep(100); 239 239 240 - dbidev->enabled = true; 241 240 st7586_fb_dirty(fb, &rect); 242 241 243 242 mipi_dbi_command(dbi, MIPI_DCS_SET_DISPLAY_ON); ··· 257 258 258 259 DRM_DEBUG_KMS("\n"); 259 260 260 - if (!dbidev->enabled) 261 - return; 262 - 263 261 mipi_dbi_command(&dbidev->dbi, MIPI_DCS_SET_DISPLAY_OFF); 264 - dbidev->enabled = false; 265 262 } 266 263 267 264 static const u32 st7586_formats[] = {
+18 -8
include/drm/bridge/dw_hdmi.h
··· 8 8 9 9 #include <sound/hdmi-codec.h> 10 10 11 - struct drm_connector; 11 + struct drm_display_info; 12 12 struct drm_display_mode; 13 13 struct drm_encoder; 14 14 struct dw_hdmi; ··· 114 114 115 115 struct dw_hdmi_phy_ops { 116 116 int (*init)(struct dw_hdmi *hdmi, void *data, 117 - struct drm_display_mode *mode); 117 + const struct drm_display_info *display, 118 + const struct drm_display_mode *mode); 118 119 void (*disable)(struct dw_hdmi *hdmi, void *data); 119 120 enum drm_connector_status (*read_hpd)(struct dw_hdmi *hdmi, void *data); 120 121 void (*update_hpd)(struct dw_hdmi *hdmi, void *data, ··· 125 124 126 125 struct dw_hdmi_plat_data { 127 126 struct regmap *regm; 128 - enum drm_mode_status (*mode_valid)(struct drm_connector *connector, 129 - const struct drm_display_mode *mode); 130 - unsigned long input_bus_format; 127 + 131 128 unsigned long input_bus_encoding; 132 129 bool use_drm_infoframe; 133 130 bool ycbcr_420_allowed; 131 + 132 + /* 133 + * Private data passed to all the .mode_valid() and .configure_phy() 134 + * callback functions. 135 + */ 136 + void *priv_data; 137 + 138 + /* Platform-specific mode validation (optional). */ 139 + enum drm_mode_status (*mode_valid)(struct dw_hdmi *hdmi, void *data, 140 + const struct drm_display_info *info, 141 + const struct drm_display_mode *mode); 134 142 135 143 /* Vendor PHY support */ 136 144 const struct dw_hdmi_phy_ops *phy_ops; ··· 151 141 const struct dw_hdmi_mpll_config *mpll_cfg; 152 142 const struct dw_hdmi_curr_ctrl *cur_ctr; 153 143 const struct dw_hdmi_phy_config *phy_config; 154 - int (*configure_phy)(struct dw_hdmi *hdmi, 155 - const struct dw_hdmi_plat_data *pdata, 144 + int (*configure_phy)(struct dw_hdmi *hdmi, void *data, 156 145 unsigned long mpixelclock); 157 146 }; 158 147 ··· 175 166 void dw_hdmi_set_channel_allocation(struct dw_hdmi *hdmi, unsigned int ca); 176 167 void dw_hdmi_audio_enable(struct dw_hdmi *hdmi); 177 168 void dw_hdmi_audio_disable(struct dw_hdmi *hdmi); 178 - void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi); 169 + void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi, 170 + const struct drm_display_info *display); 179 171 180 172 /* PHY configuration */ 181 173 void dw_hdmi_phy_i2c_set_addr(struct dw_hdmi *hdmi, u8 address);
+3
include/drm/drm_bridge.h
··· 35 35 struct drm_bridge; 36 36 struct drm_bridge_timings; 37 37 struct drm_connector; 38 + struct drm_display_info; 38 39 struct drm_panel; 39 40 struct edid; 40 41 struct i2c_adapter; ··· 113 112 * drm_mode_status Enum 114 113 */ 115 114 enum drm_mode_status (*mode_valid)(struct drm_bridge *bridge, 115 + const struct drm_display_info *info, 116 116 const struct drm_display_mode *mode); 117 117 118 118 /** ··· 838 836 struct drm_display_mode *adjusted_mode); 839 837 enum drm_mode_status 840 838 drm_bridge_chain_mode_valid(struct drm_bridge *bridge, 839 + const struct drm_display_info *info, 841 840 const struct drm_display_mode *mode); 842 841 void drm_bridge_chain_disable(struct drm_bridge *bridge); 843 842 void drm_bridge_chain_post_disable(struct drm_bridge *bridge);
+8
include/drm/drm_dp_helper.h
··· 1457 1457 DP_ALTERNATE_SCRAMBLER_RESET_CAP; 1458 1458 } 1459 1459 1460 + /* Ignore MSA timing for Adaptive Sync support on DP 1.4 */ 1461 + static inline bool 1462 + drm_dp_sink_can_do_video_without_timing_msa(const u8 dpcd[DP_RECEIVER_CAP_SIZE]) 1463 + { 1464 + return dpcd[DP_DOWN_STREAM_PORT_COUNT] & 1465 + DP_MSA_TIMING_PAR_IGNORED; 1466 + } 1467 + 1460 1468 /* 1461 1469 * DisplayPort AUX channel 1462 1470 */
+3 -3
include/drm/drm_edid.h
··· 361 361 362 362 int 363 363 drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, 364 - struct drm_connector *connector, 364 + const struct drm_connector *connector, 365 365 const struct drm_display_mode *mode); 366 366 int 367 367 drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, 368 - struct drm_connector *connector, 368 + const struct drm_connector *connector, 369 369 const struct drm_display_mode *mode); 370 370 371 371 void ··· 378 378 379 379 void 380 380 drm_hdmi_avi_infoframe_quant_range(struct hdmi_avi_infoframe *frame, 381 - struct drm_connector *connector, 381 + const struct drm_connector *connector, 382 382 const struct drm_display_mode *mode, 383 383 enum hdmi_quantization_range rgb_quant_range); 384 384
-5
include/drm/drm_mipi_dbi.h
··· 95 95 struct drm_display_mode mode; 96 96 97 97 /** 98 - * @enabled: Pipeline is enabled 99 - */ 100 - bool enabled; 101 - 102 - /** 103 98 * @tx_buf: Buffer used for transfer (copy clip rect area) 104 99 */ 105 100 u16 *tx_buf;
+34
include/uapi/drm/drm_fourcc.h
··· 236 236 #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ 237 237 #define DRM_FORMAT_NV24 fourcc_code('N', 'V', '2', '4') /* non-subsampled Cr:Cb plane */ 238 238 #define DRM_FORMAT_NV42 fourcc_code('N', 'V', '4', '2') /* non-subsampled Cb:Cr plane */ 239 + /* 240 + * 2 plane YCbCr 241 + * index 0 = Y plane, [39:0] Y3:Y2:Y1:Y0 little endian 242 + * index 1 = Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian 243 + */ 244 + #define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled Cr:Cb plane */ 239 245 240 246 /* 241 247 * 2 plane YCbCr MSB aligned ··· 270 264 * index 1 = Cr:Cb plane, [31:0] Cr:Cb [16:16] little endian 271 265 */ 272 266 #define DRM_FORMAT_P016 fourcc_code('P', '0', '1', '6') /* 2x2 subsampled Cr:Cb plane 16 bits per channel */ 267 + 268 + /* 3 plane non-subsampled (444) YCbCr 269 + * 16 bits per component, but only 10 bits are used and 6 bits are padded 270 + * index 0: Y plane, [15:0] Y:x [10:6] little endian 271 + * index 1: Cb plane, [15:0] Cb:x [10:6] little endian 272 + * index 2: Cr plane, [15:0] Cr:x [10:6] little endian 273 + */ 274 + #define DRM_FORMAT_Q410 fourcc_code('Q', '4', '1', '0') 275 + 276 + /* 3 plane non-subsampled (444) YCrCb 277 + * 16 bits per component, but only 10 bits are used and 6 bits are padded 278 + * index 0: Y plane, [15:0] Y:x [10:6] little endian 279 + * index 1: Cr plane, [15:0] Cr:x [10:6] little endian 280 + * index 2: Cb plane, [15:0] Cb:x [10:6] little endian 281 + */ 282 + #define DRM_FORMAT_Q401 fourcc_code('Q', '4', '0', '1') 273 283 274 284 /* 275 285 * 3 plane YCbCr ··· 913 891 * Indicates that the buffer includes per-superblock content hints. 914 892 */ 915 893 #define AFBC_FORMAT_MOD_BCH (1ULL << 11) 894 + 895 + /* AFBC uncompressed storage mode 896 + * 897 + * Indicates that the buffer is using AFBC uncompressed storage mode. 898 + * In this mode all superblock payloads in the buffer use the uncompressed 899 + * storage mode, which is usually only used for data which cannot be compressed. 900 + * The buffer layout is the same as for AFBC buffers without USM set, this only 901 + * affects the storage mode of the individual superblocks. Note that even a 902 + * buffer without USM set may use uncompressed storage mode for some or all 903 + * superblocks, USM just guarantees it for all. 904 + */ 905 + #define AFBC_FORMAT_MOD_USM (1ULL << 12) 916 906 917 907 /* 918 908 * Arm 16x16 Block U-Interleaved modifier