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

Merge tag 'drm-misc-next-2017-08-08' of git://anongit.freedesktop.org/git/drm-misc into drm-next

UAPI Changes:
- vc4: Add ioctl to allow attaching a label to a bo (Eric)
- Add new format/modifier blob plane property (Ben)
- armada: Use __u32/__u64 instead of uint32_t/uint64_t (Mikko)
- [kinda uapi] fb_helper: Expose display_info size via fb_info (David)

Core Changes:
- Default gem_dumb_[map_offset|destroy] as mmap/destroy implementations (Noralf)
- Simplify atomic properties by removing the helpers and handling in core (Daniel)

Driver Changes:
- stm: Add STM32 DSI controller driver (Phillipe)
- vc4: Add HDMI CEC support (Hans)
- rockchip: Refactor register init & soc version handling (Mark)
- misc: Remove .load_lut, .gamma_set, .gamma_get dead code (Peter)
- dw-hdmi: Add HDMI CEC support (Russell)

Cc: Philippe CORNU <philippe.cornu@st.com>
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Mark yao <mark.yao@rock-chips.com>
Cc: Peter Rosin <peda@axentia.se>
Cc: Russell King <rmk+kernel@armlinux.org.uk>
Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
Cc: David Lechner <david@lechnology.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

* tag 'drm-misc-next-2017-08-08' of git://anongit.freedesktop.org/git/drm-misc: (107 commits)
drm: Nuke drm_atomic_legacy_backoff
drm: Nuke drm_atomic_helper_connector_dpms
drm: Nuke drm_atomic_helper_connector_set_property
drm: Nuke drm_atomic_helper_plane_set_property
drm: Nuke drm_atomic_helper_crtc_set_property
drm: Handle properties in the core for atomic drivers
drm: Don't update property values for atomic drivers
drm/omap: Rework the rotation-on-crtc hack
drm/radeon: Use the drm_driver.dumb_destroy default
drm/i915: Use the drm_driver.dumb_destroy default
drm/sti: Use .dumb_map_offset and .dumb_destroy defaults
drm: bridge: synopsys/dw-hdmi: Provide default configuration function for HDMI 2.0 PHY
drm/fb-helper: pass physical dimensions to fbdev
uapi drm/armada_drm.h: use __u32 and __u64 instead of uint32_t and uint64_t
drm/bridge: dw-hdmi: remove CEC engine register definitions
drm/bridge: dw-hdmi: add cec driver
drm/bridge: dw-hdmi: add missing cec_notifier_put
drm: remove unused and redundant callbacks
staging: vboxvideo: remove dead gamma lut code
drm: dw-hdmi-i2s: add missing company name on Copyright
...

+3842 -2300
+4
Documentation/devicetree/bindings/display/rockchip/rockchip-vop.txt
··· 8 8 - compatible: value should be one of the following 9 9 "rockchip,rk3036-vop"; 10 10 "rockchip,rk3288-vop"; 11 + "rockchip,rk3368-vop"; 12 + "rockchip,rk3366-vop"; 11 13 "rockchip,rk3399-vop-big"; 12 14 "rockchip,rk3399-vop-lit"; 15 + "rockchip,rk3228-vop"; 16 + "rockchip,rk3328-vop"; 13 17 14 18 - interrupts: should contain a list of all VOP IP block interrupts in the 15 19 order: VSYNC, LCD_SYSTEM. The interrupt specifier
+103 -2
Documentation/devicetree/bindings/display/st,stm32-ltdc.txt
··· 1 1 * STMicroelectronics STM32 lcd-tft display controller 2 2 3 3 - ltdc: lcd-tft display controller host 4 - must be a sub-node of st-display-subsystem 5 4 Required properties: 6 5 - compatible: "st,stm32-ltdc" 7 6 - reg: Physical base address of the IP registers and length of memory mapped region. ··· 12 13 Required nodes: 13 14 - Video port for RGB output. 14 15 15 - Example: 16 + * STMicroelectronics STM32 DSI controller specific extensions to Synopsys 17 + DesignWare MIPI DSI host controller 16 18 19 + The STMicroelectronics STM32 DSI controller uses the Synopsys DesignWare MIPI 20 + DSI host controller. For all mandatory properties & nodes, please refer 21 + to the related documentation in [5]. 22 + 23 + Mandatory properties specific to STM32 DSI: 24 + - #address-cells: Should be <1>. 25 + - #size-cells: Should be <0>. 26 + - compatible: "st,stm32-dsi". 27 + - clock-names: 28 + - phy pll reference clock string name, must be "ref". 29 + - resets: see [5]. 30 + - reset-names: see [5]. 31 + 32 + Mandatory nodes specific to STM32 DSI: 33 + - ports: A node containing DSI input & output port nodes with endpoint 34 + definitions as documented in [3] & [4]. 35 + - port@0: DSI input port node, connected to the ltdc rgb output port. 36 + - port@1: DSI output port node, connected to a panel or a bridge input port. 37 + - panel or bridge node: A node containing the panel or bridge description as 38 + documented in [6]. 39 + - port: panel or bridge port node, connected to the DSI output port (port@1). 40 + 41 + Note: You can find more documentation in the following references 42 + [1] Documentation/devicetree/bindings/clock/clock-bindings.txt 43 + [2] Documentation/devicetree/bindings/reset/reset.txt 44 + [3] Documentation/devicetree/bindings/media/video-interfaces.txt 45 + [4] Documentation/devicetree/bindings/graph.txt 46 + [5] Documentation/devicetree/bindings/display/bridge/dw_mipi_dsi.txt 47 + [6] Documentation/devicetree/bindings/display/mipi-dsi-bus.txt 48 + 49 + Example 1: RGB panel 17 50 / { 18 51 ... 19 52 soc { ··· 63 32 }; 64 33 }; 65 34 }; 35 + }; 36 + }; 37 + 38 + Example 2: DSI panel 39 + 40 + / { 41 + ... 42 + soc { 43 + ... 44 + ltdc: display-controller@40016800 { 45 + compatible = "st,stm32-ltdc"; 46 + reg = <0x40016800 0x200>; 47 + interrupts = <88>, <89>; 48 + resets = <&rcc STM32F4_APB2_RESET(LTDC)>; 49 + clocks = <&rcc 1 CLK_LCD>; 50 + clock-names = "lcd"; 51 + 52 + port { 53 + ltdc_out_dsi: endpoint { 54 + remote-endpoint = <&dsi_in>; 55 + }; 56 + }; 57 + }; 58 + 59 + 60 + dsi: dsi@40016c00 { 61 + #address-cells = <1>; 62 + #size-cells = <0>; 63 + compatible = "st,stm32-dsi"; 64 + reg = <0x40016c00 0x800>; 65 + clocks = <&rcc 1 CLK_F469_DSI>, <&clk_hse>; 66 + clock-names = "ref", "pclk"; 67 + resets = <&rcc STM32F4_APB2_RESET(DSI)>; 68 + reset-names = "apb"; 69 + 70 + ports { 71 + #address-cells = <1>; 72 + #size-cells = <0>; 73 + 74 + port@0 { 75 + reg = <0>; 76 + dsi_in: endpoint { 77 + remote-endpoint = <&ltdc_out_dsi>; 78 + }; 79 + }; 80 + 81 + port@1 { 82 + reg = <1>; 83 + dsi_out: endpoint { 84 + remote-endpoint = <&dsi_in_panel>; 85 + }; 86 + }; 87 + 88 + }; 89 + 90 + panel-dsi@0 { 91 + reg = <0>; /* dsi virtual channel (0..3) */ 92 + compatible = ...; 93 + enable-gpios = ...; 94 + 95 + port { 96 + dsi_in_panel: endpoint { 97 + remote-endpoint = <&dsi_out>; 98 + }; 99 + }; 100 + 101 + }; 102 + 103 + }; 104 + 66 105 }; 67 106 };
+2 -2
Documentation/gpu/todo.rst
··· 108 108 crtc state, clear that to the max values, x/y = 0 and w/h = MAX_INT, in 109 109 __drm_atomic_helper_crtc_duplicate_state(). 110 110 111 - - Move tinydrm_merge_clips into drm_framebuffer.c, dropping the tinydrm_ 112 - prefix ofc and using drm_fb_. drm_framebuffer.c makes sense since this 111 + - Move tinydrm_merge_clips into drm_framebuffer.c, dropping the tinydrm\_ 112 + prefix ofc and using drm_fb\_. drm_framebuffer.c makes sense since this 113 113 is a function useful to implement the fb->dirty function. 114 114 115 115 - Create a new drm_fb_dirty function which does essentially what e.g.
+101 -91
drivers/dma-buf/sw_sync.c
··· 125 125 kref_put(&obj->kref, sync_timeline_free); 126 126 } 127 127 128 - /** 129 - * sync_timeline_signal() - signal a status change on a sync_timeline 130 - * @obj: sync_timeline to signal 131 - * @inc: num to increment on timeline->value 132 - * 133 - * A sync implementation should call this any time one of it's fences 134 - * has signaled or has an error condition. 135 - */ 136 - static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) 137 - { 138 - struct sync_pt *pt, *next; 139 - 140 - trace_sync_timeline(obj); 141 - 142 - spin_lock_irq(&obj->lock); 143 - 144 - obj->value += inc; 145 - 146 - list_for_each_entry_safe(pt, next, &obj->pt_list, link) { 147 - if (!dma_fence_is_signaled_locked(&pt->base)) 148 - break; 149 - 150 - list_del_init(&pt->link); 151 - rb_erase(&pt->node, &obj->pt_tree); 152 - } 153 - 154 - spin_unlock_irq(&obj->lock); 155 - } 156 - 157 - /** 158 - * sync_pt_create() - creates a sync pt 159 - * @parent: fence's parent sync_timeline 160 - * @inc: value of the fence 161 - * 162 - * Creates a new sync_pt as a child of @parent. @size bytes will be 163 - * allocated allowing for implementation specific data to be kept after 164 - * the generic sync_timeline struct. Returns the sync_pt object or 165 - * NULL in case of error. 166 - */ 167 - static struct sync_pt *sync_pt_create(struct sync_timeline *obj, 168 - unsigned int value) 169 - { 170 - struct sync_pt *pt; 171 - 172 - pt = kzalloc(sizeof(*pt), GFP_KERNEL); 173 - if (!pt) 174 - return NULL; 175 - 176 - sync_timeline_get(obj); 177 - dma_fence_init(&pt->base, &timeline_fence_ops, &obj->lock, 178 - obj->context, value); 179 - INIT_LIST_HEAD(&pt->link); 180 - 181 - spin_lock_irq(&obj->lock); 182 - if (!dma_fence_is_signaled_locked(&pt->base)) { 183 - struct rb_node **p = &obj->pt_tree.rb_node; 184 - struct rb_node *parent = NULL; 185 - 186 - while (*p) { 187 - struct sync_pt *other; 188 - int cmp; 189 - 190 - parent = *p; 191 - other = rb_entry(parent, typeof(*pt), node); 192 - cmp = value - other->base.seqno; 193 - if (cmp > 0) { 194 - p = &parent->rb_right; 195 - } else if (cmp < 0) { 196 - p = &parent->rb_left; 197 - } else { 198 - if (dma_fence_get_rcu(&other->base)) { 199 - dma_fence_put(&pt->base); 200 - pt = other; 201 - goto unlock; 202 - } 203 - p = &parent->rb_left; 204 - } 205 - } 206 - rb_link_node(&pt->node, parent, p); 207 - rb_insert_color(&pt->node, &obj->pt_tree); 208 - 209 - parent = rb_next(&pt->node); 210 - list_add_tail(&pt->link, 211 - parent ? &rb_entry(parent, typeof(*pt), node)->link : &obj->pt_list); 212 - } 213 - unlock: 214 - spin_unlock_irq(&obj->lock); 215 - 216 - return pt; 217 - } 218 - 219 128 static const char *timeline_fence_get_driver_name(struct dma_fence *fence) 220 129 { 221 130 return "sw_sync"; ··· 193 284 .fence_value_str = timeline_fence_value_str, 194 285 .timeline_value_str = timeline_fence_timeline_value_str, 195 286 }; 287 + 288 + /** 289 + * sync_timeline_signal() - signal a status change on a sync_timeline 290 + * @obj: sync_timeline to signal 291 + * @inc: num to increment on timeline->value 292 + * 293 + * A sync implementation should call this any time one of it's fences 294 + * has signaled or has an error condition. 295 + */ 296 + static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) 297 + { 298 + struct sync_pt *pt, *next; 299 + 300 + trace_sync_timeline(obj); 301 + 302 + spin_lock_irq(&obj->lock); 303 + 304 + obj->value += inc; 305 + 306 + list_for_each_entry_safe(pt, next, &obj->pt_list, link) { 307 + if (!timeline_fence_signaled(&pt->base)) 308 + break; 309 + 310 + list_del_init(&pt->link); 311 + rb_erase(&pt->node, &obj->pt_tree); 312 + 313 + /* 314 + * A signal callback may release the last reference to this 315 + * fence, causing it to be freed. That operation has to be 316 + * last to avoid a use after free inside this loop, and must 317 + * be after we remove the fence from the timeline in order to 318 + * prevent deadlocking on timeline->lock inside 319 + * timeline_fence_release(). 320 + */ 321 + dma_fence_signal_locked(&pt->base); 322 + } 323 + 324 + spin_unlock_irq(&obj->lock); 325 + } 326 + 327 + /** 328 + * sync_pt_create() - creates a sync pt 329 + * @parent: fence's parent sync_timeline 330 + * @inc: value of the fence 331 + * 332 + * Creates a new sync_pt as a child of @parent. @size bytes will be 333 + * allocated allowing for implementation specific data to be kept after 334 + * the generic sync_timeline struct. Returns the sync_pt object or 335 + * NULL in case of error. 336 + */ 337 + static struct sync_pt *sync_pt_create(struct sync_timeline *obj, 338 + unsigned int value) 339 + { 340 + struct sync_pt *pt; 341 + 342 + pt = kzalloc(sizeof(*pt), GFP_KERNEL); 343 + if (!pt) 344 + return NULL; 345 + 346 + sync_timeline_get(obj); 347 + dma_fence_init(&pt->base, &timeline_fence_ops, &obj->lock, 348 + obj->context, value); 349 + INIT_LIST_HEAD(&pt->link); 350 + 351 + spin_lock_irq(&obj->lock); 352 + if (!dma_fence_is_signaled_locked(&pt->base)) { 353 + struct rb_node **p = &obj->pt_tree.rb_node; 354 + struct rb_node *parent = NULL; 355 + 356 + while (*p) { 357 + struct sync_pt *other; 358 + int cmp; 359 + 360 + parent = *p; 361 + other = rb_entry(parent, typeof(*pt), node); 362 + cmp = value - other->base.seqno; 363 + if (cmp > 0) { 364 + p = &parent->rb_right; 365 + } else if (cmp < 0) { 366 + p = &parent->rb_left; 367 + } else { 368 + if (dma_fence_get_rcu(&other->base)) { 369 + dma_fence_put(&pt->base); 370 + pt = other; 371 + goto unlock; 372 + } 373 + p = &parent->rb_left; 374 + } 375 + } 376 + rb_link_node(&pt->node, parent, p); 377 + rb_insert_color(&pt->node, &obj->pt_tree); 378 + 379 + parent = rb_next(&pt->node); 380 + list_add_tail(&pt->link, 381 + parent ? &rb_entry(parent, typeof(*pt), node)->link : &obj->pt_list); 382 + } 383 + unlock: 384 + spin_unlock_irq(&obj->lock); 385 + 386 + return pt; 387 + } 196 388 197 389 /* 198 390 * *WARNING*
+3 -2
drivers/dma-buf/sync_file.c
··· 304 304 { 305 305 struct sync_file *sync_file = file->private_data; 306 306 307 - if (test_bit(POLL_ENABLED, &sync_file->fence->flags)) 307 + if (test_bit(POLL_ENABLED, &sync_file->flags)) 308 308 dma_fence_remove_callback(sync_file->fence, &sync_file->cb); 309 309 dma_fence_put(sync_file->fence); 310 310 kfree(sync_file); ··· 318 318 319 319 poll_wait(file, &sync_file->wq, wait); 320 320 321 - if (!test_and_set_bit(POLL_ENABLED, &sync_file->fence->flags)) { 321 + if (list_empty(&sync_file->cb.node) && 322 + !test_and_set_bit(POLL_ENABLED, &sync_file->flags)) { 322 323 if (dma_fence_add_callback(sync_file->fence, &sync_file->cb, 323 324 fence_check_cb_func) < 0) 324 325 wake_up_all(&sync_file->wq);
-1
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
··· 834 834 .gem_close_object = amdgpu_gem_object_close, 835 835 .dumb_create = amdgpu_mode_dumb_create, 836 836 .dumb_map_offset = amdgpu_mode_dumb_mmap, 837 - .dumb_destroy = drm_gem_dumb_destroy, 838 837 .fops = &amdgpu_driver_kms_fops, 839 838 840 839 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-24
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c
··· 311 311 return 0; 312 312 } 313 313 314 - /** Sets the color ramps on behalf of fbcon */ 315 - static void amdgpu_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 316 - u16 blue, int regno) 317 - { 318 - struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 319 - 320 - amdgpu_crtc->lut_r[regno] = red >> 6; 321 - amdgpu_crtc->lut_g[regno] = green >> 6; 322 - amdgpu_crtc->lut_b[regno] = blue >> 6; 323 - } 324 - 325 - /** Gets the color ramps on behalf of fbcon */ 326 - static void amdgpu_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 327 - u16 *blue, int regno) 328 - { 329 - struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 330 - 331 - *red = amdgpu_crtc->lut_r[regno] << 6; 332 - *green = amdgpu_crtc->lut_g[regno] << 6; 333 - *blue = amdgpu_crtc->lut_b[regno] << 6; 334 - } 335 - 336 314 static const struct drm_fb_helper_funcs amdgpu_fb_helper_funcs = { 337 - .gamma_set = amdgpu_crtc_fb_gamma_set, 338 - .gamma_get = amdgpu_crtc_fb_gamma_get, 339 315 .fb_probe = amdgpufb_create, 340 316 }; 341 317
-1
drivers/gpu/drm/amd/amdgpu/amdgpu_mode.h
··· 357 357 struct amdgpu_crtc { 358 358 struct drm_crtc base; 359 359 int crtc_id; 360 - u16 lut_r[256], lut_g[256], lut_b[256]; 361 360 bool enabled; 362 361 bool can_tile; 363 362 uint32_t crtc_offset;
+7 -20
drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
··· 2139 2139 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2140 2140 struct drm_device *dev = crtc->dev; 2141 2141 struct amdgpu_device *adev = dev->dev_private; 2142 + u16 *r, *g, *b; 2142 2143 int i; 2143 2144 u32 tmp; 2144 2145 ··· 2177 2176 WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); 2178 2177 2179 2178 WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); 2179 + r = crtc->gamma_store; 2180 + g = r + crtc->gamma_size; 2181 + b = g + crtc->gamma_size; 2180 2182 for (i = 0; i < 256; i++) { 2181 2183 WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, 2182 - (amdgpu_crtc->lut_r[i] << 20) | 2183 - (amdgpu_crtc->lut_g[i] << 10) | 2184 - (amdgpu_crtc->lut_b[i] << 0)); 2184 + ((*r++ & 0xffc0) << 14) | 2185 + ((*g++ & 0xffc0) << 4) | 2186 + (*b++ >> 6)); 2185 2187 } 2186 2188 2187 2189 tmp = RREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset); ··· 2500 2496 u16 *blue, uint32_t size, 2501 2497 struct drm_modeset_acquire_ctx *ctx) 2502 2498 { 2503 - struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2504 - int i; 2505 - 2506 - /* userspace palettes are always correct as is */ 2507 - for (i = 0; i < size; i++) { 2508 - amdgpu_crtc->lut_r[i] = red[i] >> 6; 2509 - amdgpu_crtc->lut_g[i] = green[i] >> 6; 2510 - amdgpu_crtc->lut_b[i] = blue[i] >> 6; 2511 - } 2512 2499 dce_v10_0_crtc_load_lut(crtc); 2513 2500 2514 2501 return 0; ··· 2711 2716 .mode_set_base_atomic = dce_v10_0_crtc_set_base_atomic, 2712 2717 .prepare = dce_v10_0_crtc_prepare, 2713 2718 .commit = dce_v10_0_crtc_commit, 2714 - .load_lut = dce_v10_0_crtc_load_lut, 2715 2719 .disable = dce_v10_0_crtc_disable, 2716 2720 }; 2717 2721 2718 2722 static int dce_v10_0_crtc_init(struct amdgpu_device *adev, int index) 2719 2723 { 2720 2724 struct amdgpu_crtc *amdgpu_crtc; 2721 - int i; 2722 2725 2723 2726 amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + 2724 2727 (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); ··· 2733 2740 amdgpu_crtc->max_cursor_height = 128; 2734 2741 adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; 2735 2742 adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; 2736 - 2737 - for (i = 0; i < 256; i++) { 2738 - amdgpu_crtc->lut_r[i] = i << 2; 2739 - amdgpu_crtc->lut_g[i] = i << 2; 2740 - amdgpu_crtc->lut_b[i] = i << 2; 2741 - } 2742 2743 2743 2744 switch (amdgpu_crtc->crtc_id) { 2744 2745 case 0:
+7 -20
drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
··· 2178 2178 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2179 2179 struct drm_device *dev = crtc->dev; 2180 2180 struct amdgpu_device *adev = dev->dev_private; 2181 + u16 *r, *g, *b; 2181 2182 int i; 2182 2183 u32 tmp; 2183 2184 ··· 2210 2209 WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); 2211 2210 2212 2211 WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); 2212 + r = crtc->gamma_store; 2213 + g = r + crtc->gamma_size; 2214 + b = g + crtc->gamma_size; 2213 2215 for (i = 0; i < 256; i++) { 2214 2216 WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, 2215 - (amdgpu_crtc->lut_r[i] << 20) | 2216 - (amdgpu_crtc->lut_g[i] << 10) | 2217 - (amdgpu_crtc->lut_b[i] << 0)); 2217 + ((*r++ & 0xffc0) << 14) | 2218 + ((*g++ & 0xffc0) << 4) | 2219 + (*b++ >> 6)); 2218 2220 } 2219 2221 2220 2222 tmp = RREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset); ··· 2575 2571 u16 *blue, uint32_t size, 2576 2572 struct drm_modeset_acquire_ctx *ctx) 2577 2573 { 2578 - struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2579 - int i; 2580 - 2581 - /* userspace palettes are always correct as is */ 2582 - for (i = 0; i < size; i++) { 2583 - amdgpu_crtc->lut_r[i] = red[i] >> 6; 2584 - amdgpu_crtc->lut_g[i] = green[i] >> 6; 2585 - amdgpu_crtc->lut_b[i] = blue[i] >> 6; 2586 - } 2587 2574 dce_v11_0_crtc_load_lut(crtc); 2588 2575 2589 2576 return 0; ··· 2814 2819 .mode_set_base_atomic = dce_v11_0_crtc_set_base_atomic, 2815 2820 .prepare = dce_v11_0_crtc_prepare, 2816 2821 .commit = dce_v11_0_crtc_commit, 2817 - .load_lut = dce_v11_0_crtc_load_lut, 2818 2822 .disable = dce_v11_0_crtc_disable, 2819 2823 }; 2820 2824 2821 2825 static int dce_v11_0_crtc_init(struct amdgpu_device *adev, int index) 2822 2826 { 2823 2827 struct amdgpu_crtc *amdgpu_crtc; 2824 - int i; 2825 2828 2826 2829 amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + 2827 2830 (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); ··· 2836 2843 amdgpu_crtc->max_cursor_height = 128; 2837 2844 adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; 2838 2845 adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; 2839 - 2840 - for (i = 0; i < 256; i++) { 2841 - amdgpu_crtc->lut_r[i] = i << 2; 2842 - amdgpu_crtc->lut_g[i] = i << 2; 2843 - amdgpu_crtc->lut_b[i] = i << 2; 2844 - } 2845 2846 2846 2847 switch (amdgpu_crtc->crtc_id) { 2847 2848 case 0:
+7 -20
drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
··· 2071 2071 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2072 2072 struct drm_device *dev = crtc->dev; 2073 2073 struct amdgpu_device *adev = dev->dev_private; 2074 + u16 *r, *g, *b; 2074 2075 int i; 2075 2076 2076 2077 DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id); ··· 2101 2100 WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); 2102 2101 2103 2102 WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); 2103 + r = crtc->gamma_store; 2104 + g = r + crtc->gamma_size; 2105 + b = g + crtc->gamma_size; 2104 2106 for (i = 0; i < 256; i++) { 2105 2107 WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, 2106 - (amdgpu_crtc->lut_r[i] << 20) | 2107 - (amdgpu_crtc->lut_g[i] << 10) | 2108 - (amdgpu_crtc->lut_b[i] << 0)); 2108 + ((*r++ & 0xffc0) << 14) | 2109 + ((*g++ & 0xffc0) << 4) | 2110 + (*b++ >> 6)); 2109 2111 } 2110 2112 2111 2113 WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset, ··· 2389 2385 u16 *blue, uint32_t size, 2390 2386 struct drm_modeset_acquire_ctx *ctx) 2391 2387 { 2392 - struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2393 - int i; 2394 - 2395 - /* userspace palettes are always correct as is */ 2396 - for (i = 0; i < size; i++) { 2397 - amdgpu_crtc->lut_r[i] = red[i] >> 6; 2398 - amdgpu_crtc->lut_g[i] = green[i] >> 6; 2399 - amdgpu_crtc->lut_b[i] = blue[i] >> 6; 2400 - } 2401 2388 dce_v6_0_crtc_load_lut(crtc); 2402 2389 2403 2390 return 0; ··· 2596 2601 .mode_set_base_atomic = dce_v6_0_crtc_set_base_atomic, 2597 2602 .prepare = dce_v6_0_crtc_prepare, 2598 2603 .commit = dce_v6_0_crtc_commit, 2599 - .load_lut = dce_v6_0_crtc_load_lut, 2600 2604 .disable = dce_v6_0_crtc_disable, 2601 2605 }; 2602 2606 2603 2607 static int dce_v6_0_crtc_init(struct amdgpu_device *adev, int index) 2604 2608 { 2605 2609 struct amdgpu_crtc *amdgpu_crtc; 2606 - int i; 2607 2610 2608 2611 amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + 2609 2612 (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); ··· 2618 2625 amdgpu_crtc->max_cursor_height = CURSOR_HEIGHT; 2619 2626 adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; 2620 2627 adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; 2621 - 2622 - for (i = 0; i < 256; i++) { 2623 - amdgpu_crtc->lut_r[i] = i << 2; 2624 - amdgpu_crtc->lut_g[i] = i << 2; 2625 - amdgpu_crtc->lut_b[i] = i << 2; 2626 - } 2627 2628 2628 2629 amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id]; 2629 2630
+7 -20
drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
··· 2049 2049 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2050 2050 struct drm_device *dev = crtc->dev; 2051 2051 struct amdgpu_device *adev = dev->dev_private; 2052 + u16 *r, *g, *b; 2052 2053 int i; 2053 2054 2054 2055 DRM_DEBUG_KMS("%d\n", amdgpu_crtc->crtc_id); ··· 2079 2078 WREG32(mmDC_LUT_WRITE_EN_MASK + amdgpu_crtc->crtc_offset, 0x00000007); 2080 2079 2081 2080 WREG32(mmDC_LUT_RW_INDEX + amdgpu_crtc->crtc_offset, 0); 2081 + r = crtc->gamma_store; 2082 + g = r + crtc->gamma_size; 2083 + b = g + crtc->gamma_size; 2082 2084 for (i = 0; i < 256; i++) { 2083 2085 WREG32(mmDC_LUT_30_COLOR + amdgpu_crtc->crtc_offset, 2084 - (amdgpu_crtc->lut_r[i] << 20) | 2085 - (amdgpu_crtc->lut_g[i] << 10) | 2086 - (amdgpu_crtc->lut_b[i] << 0)); 2086 + ((*r++ & 0xffc0) << 14) | 2087 + ((*g++ & 0xffc0) << 4) | 2088 + (*b++ >> 6)); 2087 2089 } 2088 2090 2089 2091 WREG32(mmDEGAMMA_CONTROL + amdgpu_crtc->crtc_offset, ··· 2404 2400 u16 *blue, uint32_t size, 2405 2401 struct drm_modeset_acquire_ctx *ctx) 2406 2402 { 2407 - struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 2408 - int i; 2409 - 2410 - /* userspace palettes are always correct as is */ 2411 - for (i = 0; i < size; i++) { 2412 - amdgpu_crtc->lut_r[i] = red[i] >> 6; 2413 - amdgpu_crtc->lut_g[i] = green[i] >> 6; 2414 - amdgpu_crtc->lut_b[i] = blue[i] >> 6; 2415 - } 2416 2403 dce_v8_0_crtc_load_lut(crtc); 2417 2404 2418 2405 return 0; ··· 2622 2627 .mode_set_base_atomic = dce_v8_0_crtc_set_base_atomic, 2623 2628 .prepare = dce_v8_0_crtc_prepare, 2624 2629 .commit = dce_v8_0_crtc_commit, 2625 - .load_lut = dce_v8_0_crtc_load_lut, 2626 2630 .disable = dce_v8_0_crtc_disable, 2627 2631 }; 2628 2632 2629 2633 static int dce_v8_0_crtc_init(struct amdgpu_device *adev, int index) 2630 2634 { 2631 2635 struct amdgpu_crtc *amdgpu_crtc; 2632 - int i; 2633 2636 2634 2637 amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + 2635 2638 (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); ··· 2644 2651 amdgpu_crtc->max_cursor_height = CIK_CURSOR_HEIGHT; 2645 2652 adev->ddev->mode_config.cursor_width = amdgpu_crtc->max_cursor_width; 2646 2653 adev->ddev->mode_config.cursor_height = amdgpu_crtc->max_cursor_height; 2647 - 2648 - for (i = 0; i < 256; i++) { 2649 - amdgpu_crtc->lut_r[i] = i << 2; 2650 - amdgpu_crtc->lut_g[i] = i << 2; 2651 - amdgpu_crtc->lut_b[i] = i << 2; 2652 - } 2653 2654 2654 2655 amdgpu_crtc->crtc_offset = crtc_offsets[amdgpu_crtc->crtc_id]; 2655 2656
-23
drivers/gpu/drm/amd/amdgpu/dce_virtual.c
··· 112 112 u16 *green, u16 *blue, uint32_t size, 113 113 struct drm_modeset_acquire_ctx *ctx) 114 114 { 115 - struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); 116 - int i; 117 - 118 - /* userspace palettes are always correct as is */ 119 - for (i = 0; i < size; i++) { 120 - amdgpu_crtc->lut_r[i] = red[i] >> 6; 121 - amdgpu_crtc->lut_g[i] = green[i] >> 6; 122 - amdgpu_crtc->lut_b[i] = blue[i] >> 6; 123 - } 124 - 125 115 return 0; 126 116 } 127 117 ··· 223 233 return 0; 224 234 } 225 235 226 - static void dce_virtual_crtc_load_lut(struct drm_crtc *crtc) 227 - { 228 - return; 229 - } 230 - 231 236 static int dce_virtual_crtc_set_base_atomic(struct drm_crtc *crtc, 232 237 struct drm_framebuffer *fb, 233 238 int x, int y, enum mode_set_atomic state) ··· 238 253 .mode_set_base_atomic = dce_virtual_crtc_set_base_atomic, 239 254 .prepare = dce_virtual_crtc_prepare, 240 255 .commit = dce_virtual_crtc_commit, 241 - .load_lut = dce_virtual_crtc_load_lut, 242 256 .disable = dce_virtual_crtc_disable, 243 257 }; 244 258 245 259 static int dce_virtual_crtc_init(struct amdgpu_device *adev, int index) 246 260 { 247 261 struct amdgpu_crtc *amdgpu_crtc; 248 - int i; 249 262 250 263 amdgpu_crtc = kzalloc(sizeof(struct amdgpu_crtc) + 251 264 (AMDGPUFB_CONN_LIMIT * sizeof(struct drm_connector *)), GFP_KERNEL); ··· 255 272 drm_mode_crtc_set_gamma_size(&amdgpu_crtc->base, 256); 256 273 amdgpu_crtc->crtc_id = index; 257 274 adev->mode_info.crtcs[index] = amdgpu_crtc; 258 - 259 - for (i = 0; i < 256; i++) { 260 - amdgpu_crtc->lut_r[i] = i << 2; 261 - amdgpu_crtc->lut_g[i] = i << 2; 262 - amdgpu_crtc->lut_b[i] = i << 2; 263 - } 264 275 265 276 amdgpu_crtc->pll_id = ATOM_PPLL_INVALID; 266 277 amdgpu_crtc->encoder = NULL;
+1
drivers/gpu/drm/arc/arcpgu_crtc.c
··· 218 218 219 219 ret = drm_universal_plane_init(drm, plane, 0xff, &arc_pgu_plane_funcs, 220 220 formats, ARRAY_SIZE(formats), 221 + NULL, 221 222 DRM_PLANE_TYPE_PRIMARY, NULL); 222 223 if (ret) 223 224 return ERR_PTR(ret);
-2
drivers/gpu/drm/arc/arcpgu_drv.c
··· 176 176 .patchlevel = 0, 177 177 .fops = &arcpgu_drm_ops, 178 178 .dumb_create = drm_gem_cma_dumb_create, 179 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 180 - .dumb_destroy = drm_gem_dumb_destroy, 181 179 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 182 180 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 183 181 .gem_free_object_unlocked = drm_gem_cma_free_object,
+1
drivers/gpu/drm/arm/hdlcd_crtc.c
··· 315 315 316 316 ret = drm_universal_plane_init(drm, plane, 0xff, &hdlcd_plane_funcs, 317 317 formats, ARRAY_SIZE(formats), 318 + NULL, 318 319 DRM_PLANE_TYPE_PRIMARY, NULL); 319 320 if (ret) { 320 321 return ERR_PTR(ret);
-2
drivers/gpu/drm/arm/hdlcd_drv.c
··· 253 253 .gem_free_object_unlocked = drm_gem_cma_free_object, 254 254 .gem_vm_ops = &drm_gem_cma_vm_ops, 255 255 .dumb_create = drm_gem_cma_dumb_create, 256 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 257 - .dumb_destroy = drm_gem_dumb_destroy, 258 256 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 259 257 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 260 258 .gem_prime_export = drm_gem_prime_export,
-2
drivers/gpu/drm/arm/malidp_drv.c
··· 331 331 .gem_free_object_unlocked = drm_gem_cma_free_object, 332 332 .gem_vm_ops = &drm_gem_cma_vm_ops, 333 333 .dumb_create = drm_gem_cma_dumb_create, 334 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 335 - .dumb_destroy = drm_gem_dumb_destroy, 336 334 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 337 335 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 338 336 .gem_prime_export = drm_gem_prime_export,
+1 -2
drivers/gpu/drm/arm/malidp_planes.c
··· 128 128 static const struct drm_plane_funcs malidp_de_plane_funcs = { 129 129 .update_plane = drm_atomic_helper_update_plane, 130 130 .disable_plane = drm_atomic_helper_disable_plane, 131 - .set_property = drm_atomic_helper_plane_set_property, 132 131 .destroy = malidp_de_plane_destroy, 133 132 .reset = malidp_plane_reset, 134 133 .atomic_duplicate_state = malidp_duplicate_plane_state, ··· 397 398 DRM_PLANE_TYPE_OVERLAY; 398 399 ret = drm_universal_plane_init(drm, &plane->base, crtcs, 399 400 &malidp_de_plane_funcs, formats, 400 - n, plane_type, NULL); 401 + n, NULL, plane_type, NULL); 401 402 if (ret < 0) 402 403 goto cleanup; 403 404
+1 -10
drivers/gpu/drm/armada/armada_crtc.c
··· 334 334 armada_drm_plane_work_run(dcrtc, dcrtc->crtc.primary); 335 335 } 336 336 337 - void armada_drm_crtc_gamma_set(struct drm_crtc *crtc, u16 r, u16 g, u16 b, 338 - int idx) 339 - { 340 - } 341 - 342 - void armada_drm_crtc_gamma_get(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 343 - int idx) 344 - { 345 - } 346 - 347 337 /* The mode_config.mutex will be held for this call */ 348 338 static void armada_drm_crtc_dpms(struct drm_crtc *crtc, int dpms) 349 339 { ··· 1259 1269 &armada_primary_plane_funcs, 1260 1270 armada_primary_formats, 1261 1271 ARRAY_SIZE(armada_primary_formats), 1272 + NULL, 1262 1273 DRM_PLANE_TYPE_PRIMARY, NULL); 1263 1274 if (ret) { 1264 1275 kfree(primary);
-2
drivers/gpu/drm/armada/armada_crtc.h
··· 102 102 }; 103 103 #define drm_to_armada_crtc(c) container_of(c, struct armada_crtc, crtc) 104 104 105 - void armada_drm_crtc_gamma_set(struct drm_crtc *, u16, u16, u16, int); 106 - void armada_drm_crtc_gamma_get(struct drm_crtc *, u16 *, u16 *, u16 *, int); 107 105 void armada_drm_crtc_update_regs(struct armada_crtc *, struct armada_regs *); 108 106 109 107 void armada_drm_crtc_plane_disable(struct armada_crtc *dcrtc,
-2
drivers/gpu/drm/armada/armada_fbdev.c
··· 117 117 } 118 118 119 119 static const struct drm_fb_helper_funcs armada_fb_helper_funcs = { 120 - .gamma_set = armada_drm_crtc_gamma_set, 121 - .gamma_get = armada_drm_crtc_gamma_get, 122 120 .fb_probe = armada_fb_probe, 123 121 }; 124 122
+1
drivers/gpu/drm/armada/armada_overlay.c
··· 460 460 &armada_ovl_plane_funcs, 461 461 armada_ovl_formats, 462 462 ARRAY_SIZE(armada_ovl_formats), 463 + NULL, 463 464 DRM_PLANE_TYPE_OVERLAY, NULL); 464 465 if (ret) { 465 466 kfree(dplane);
-1
drivers/gpu/drm/ast/ast_drv.h
··· 245 245 246 246 struct ast_crtc { 247 247 struct drm_crtc base; 248 - u8 lut_r[256], lut_g[256], lut_b[256]; 249 248 struct drm_gem_object *cursor_bo; 250 249 uint64_t cursor_addr; 251 250 int cursor_width, cursor_height;
-20
drivers/gpu/drm/ast/ast_fb.c
··· 254 254 return ret; 255 255 } 256 256 257 - static void ast_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 258 - u16 blue, int regno) 259 - { 260 - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); 261 - ast_crtc->lut_r[regno] = red >> 8; 262 - ast_crtc->lut_g[regno] = green >> 8; 263 - ast_crtc->lut_b[regno] = blue >> 8; 264 - } 265 - 266 - static void ast_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 267 - u16 *blue, int regno) 268 - { 269 - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); 270 - *red = ast_crtc->lut_r[regno] << 8; 271 - *green = ast_crtc->lut_g[regno] << 8; 272 - *blue = ast_crtc->lut_b[regno] << 8; 273 - } 274 - 275 257 static const struct drm_fb_helper_funcs ast_fb_helper_funcs = { 276 - .gamma_set = ast_fb_gamma_set, 277 - .gamma_get = ast_fb_gamma_get, 278 258 .fb_probe = astfb_create, 279 259 }; 280 260
+6 -20
drivers/gpu/drm/ast/ast_mode.c
··· 63 63 static void ast_crtc_load_lut(struct drm_crtc *crtc) 64 64 { 65 65 struct ast_private *ast = crtc->dev->dev_private; 66 - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); 66 + u16 *r, *g, *b; 67 67 int i; 68 68 69 69 if (!crtc->enabled) 70 70 return; 71 71 72 + r = crtc->gamma_store; 73 + g = r + crtc->gamma_size; 74 + b = g + crtc->gamma_size; 75 + 72 76 for (i = 0; i < 256; i++) 73 - ast_load_palette_index(ast, i, ast_crtc->lut_r[i], 74 - ast_crtc->lut_g[i], ast_crtc->lut_b[i]); 77 + ast_load_palette_index(ast, i, *r++ >> 8, *g++ >> 8, *b++ >> 8); 75 78 } 76 79 77 80 static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mode *mode, ··· 652 649 .mode_set = ast_crtc_mode_set, 653 650 .mode_set_base = ast_crtc_mode_set_base, 654 651 .disable = ast_crtc_disable, 655 - .load_lut = ast_crtc_load_lut, 656 652 .prepare = ast_crtc_prepare, 657 653 .commit = ast_crtc_commit, 658 654 ··· 666 664 u16 *blue, uint32_t size, 667 665 struct drm_modeset_acquire_ctx *ctx) 668 666 { 669 - struct ast_crtc *ast_crtc = to_ast_crtc(crtc); 670 - int i; 671 - 672 - /* userspace palettes are always correct as is */ 673 - for (i = 0; i < size; i++) { 674 - ast_crtc->lut_r[i] = red[i] >> 8; 675 - ast_crtc->lut_g[i] = green[i] >> 8; 676 - ast_crtc->lut_b[i] = blue[i] >> 8; 677 - } 678 667 ast_crtc_load_lut(crtc); 679 668 680 669 return 0; ··· 690 697 static int ast_crtc_init(struct drm_device *dev) 691 698 { 692 699 struct ast_crtc *crtc; 693 - int i; 694 700 695 701 crtc = kzalloc(sizeof(struct ast_crtc), GFP_KERNEL); 696 702 if (!crtc) ··· 698 706 drm_crtc_init(dev, &crtc->base, &ast_crtc_funcs); 699 707 drm_mode_crtc_set_gamma_size(&crtc->base, 256); 700 708 drm_crtc_helper_add(&crtc->base, &ast_crtc_helper_funcs); 701 - 702 - for (i = 0; i < 256; i++) { 703 - crtc->lut_r[i] = i; 704 - crtc->lut_g[i] = i; 705 - crtc->lut_b[i] = i; 706 - } 707 709 return 0; 708 710 } 709 711
-1
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c
··· 431 431 .atomic_destroy_state = atmel_hlcdc_crtc_destroy_state, 432 432 .enable_vblank = atmel_hlcdc_crtc_enable_vblank, 433 433 .disable_vblank = atmel_hlcdc_crtc_disable_vblank, 434 - .set_property = drm_atomic_helper_crtc_set_property, 435 434 .gamma_set = drm_atomic_helper_legacy_gamma_set, 436 435 }; 437 436
-2
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
··· 761 761 .gem_prime_vunmap = drm_gem_cma_prime_vunmap, 762 762 .gem_prime_mmap = drm_gem_cma_prime_mmap, 763 763 .dumb_create = drm_gem_cma_dumb_create, 764 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 765 - .dumb_destroy = drm_gem_dumb_destroy, 766 764 .fops = &fops, 767 765 .name = "atmel-hlcdc", 768 766 .desc = "Atmel HLCD Controller DRM",
+8 -8
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_plane.c
··· 838 838 struct atmel_hlcdc_plane *plane = drm_plane_to_atmel_hlcdc_plane(p); 839 839 840 840 if (plane->base.fb) 841 - drm_framebuffer_unreference(plane->base.fb); 841 + drm_framebuffer_put(plane->base.fb); 842 842 843 843 drm_plane_cleanup(p); 844 844 } ··· 940 940 desc->name); 941 941 } 942 942 943 - static struct drm_plane_helper_funcs atmel_hlcdc_layer_plane_helper_funcs = { 943 + static const struct drm_plane_helper_funcs atmel_hlcdc_layer_plane_helper_funcs = { 944 944 .atomic_check = atmel_hlcdc_plane_atomic_check, 945 945 .atomic_update = atmel_hlcdc_plane_atomic_update, 946 946 .atomic_disable = atmel_hlcdc_plane_atomic_disable, ··· 987 987 state = drm_plane_state_to_atmel_hlcdc_plane_state(p->state); 988 988 989 989 if (state->base.fb) 990 - drm_framebuffer_unreference(state->base.fb); 990 + drm_framebuffer_put(state->base.fb); 991 991 992 992 kfree(state); 993 993 p->state = NULL; ··· 1025 1025 } 1026 1026 1027 1027 if (copy->base.fb) 1028 - drm_framebuffer_reference(copy->base.fb); 1028 + drm_framebuffer_get(copy->base.fb); 1029 1029 1030 1030 return &copy->base; 1031 1031 } ··· 1044 1044 } 1045 1045 1046 1046 if (s->fb) 1047 - drm_framebuffer_unreference(s->fb); 1047 + drm_framebuffer_put(s->fb); 1048 1048 1049 1049 kfree(state); 1050 1050 } 1051 1051 1052 - static struct drm_plane_funcs layer_plane_funcs = { 1052 + static const struct drm_plane_funcs layer_plane_funcs = { 1053 1053 .update_plane = drm_atomic_helper_update_plane, 1054 1054 .disable_plane = drm_atomic_helper_disable_plane, 1055 - .set_property = drm_atomic_helper_plane_set_property, 1056 1055 .destroy = atmel_hlcdc_plane_destroy, 1057 1056 .reset = atmel_hlcdc_plane_reset, 1058 1057 .atomic_duplicate_state = atmel_hlcdc_plane_atomic_duplicate_state, ··· 1086 1087 ret = drm_universal_plane_init(dev, &plane->base, 0, 1087 1088 &layer_plane_funcs, 1088 1089 desc->formats->formats, 1089 - desc->formats->nformats, type, NULL); 1090 + desc->formats->nformats, 1091 + NULL, type, NULL); 1090 1092 if (ret) 1091 1093 return ret; 1092 1094
-1
drivers/gpu/drm/bridge/adv7511/adv7511_drv.c
··· 786 786 } 787 787 788 788 static struct drm_connector_funcs adv7511_connector_funcs = { 789 - .dpms = drm_atomic_helper_connector_dpms, 790 789 .fill_modes = drm_helper_probe_single_connector_modes, 791 790 .detect = adv7511_connector_detect, 792 791 .destroy = drm_connector_cleanup,
-1
drivers/gpu/drm/bridge/analogix-anx78xx.c
··· 1002 1002 } 1003 1003 1004 1004 static const struct drm_connector_funcs anx78xx_connector_funcs = { 1005 - .dpms = drm_atomic_helper_connector_dpms, 1006 1005 .fill_modes = drm_helper_probe_single_connector_modes, 1007 1006 .detect = anx78xx_detect, 1008 1007 .destroy = drm_connector_cleanup,
-1
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
··· 1005 1005 } 1006 1006 1007 1007 static const struct drm_connector_funcs analogix_dp_connector_funcs = { 1008 - .dpms = drm_atomic_helper_connector_dpms, 1009 1008 .fill_modes = drm_helper_probe_single_connector_modes, 1010 1009 .detect = analogix_dp_detect, 1011 1010 .destroy = drm_connector_cleanup,
-1
drivers/gpu/drm/bridge/dumb-vga-dac.c
··· 92 92 } 93 93 94 94 static const struct drm_connector_funcs dumb_vga_con_funcs = { 95 - .dpms = drm_atomic_helper_connector_dpms, 96 95 .detect = dumb_vga_connector_detect, 97 96 .fill_modes = drm_helper_probe_single_connector_modes, 98 97 .destroy = drm_connector_cleanup,
-1
drivers/gpu/drm/bridge/megachips-stdpxxxx-ge-b850v3-fw.c
··· 193 193 } 194 194 195 195 static const struct drm_connector_funcs ge_b850v3_lvds_connector_funcs = { 196 - .dpms = drm_atomic_helper_connector_dpms, 197 196 .fill_modes = drm_helper_probe_single_connector_modes, 198 197 .detect = ge_b850v3_lvds_detect, 199 198 .destroy = drm_connector_cleanup,
-1
drivers/gpu/drm/bridge/nxp-ptn3460.c
··· 238 238 }; 239 239 240 240 static const struct drm_connector_funcs ptn3460_connector_funcs = { 241 - .dpms = drm_atomic_helper_connector_dpms, 242 241 .fill_modes = drm_helper_probe_single_connector_modes, 243 242 .destroy = drm_connector_cleanup, 244 243 .reset = drm_atomic_helper_connector_reset,
+30 -1
drivers/gpu/drm/bridge/panel.c
··· 50 50 }; 51 51 52 52 static const struct drm_connector_funcs panel_bridge_connector_funcs = { 53 - .dpms = drm_atomic_helper_connector_dpms, 54 53 .reset = drm_atomic_helper_connector_reset, 55 54 .fill_modes = drm_helper_probe_single_connector_modes, 56 55 .destroy = drm_connector_cleanup, ··· 194 195 devm_kfree(panel_bridge->panel->dev, bridge); 195 196 } 196 197 EXPORT_SYMBOL(drm_panel_bridge_remove); 198 + 199 + static void devm_drm_panel_bridge_release(struct device *dev, void *res) 200 + { 201 + struct drm_bridge **bridge = res; 202 + 203 + drm_panel_bridge_remove(*bridge); 204 + } 205 + 206 + struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, 207 + struct drm_panel *panel, 208 + u32 connector_type) 209 + { 210 + struct drm_bridge **ptr, *bridge; 211 + 212 + ptr = devres_alloc(devm_drm_panel_bridge_release, sizeof(*ptr), 213 + GFP_KERNEL); 214 + if (!ptr) 215 + return ERR_PTR(-ENOMEM); 216 + 217 + bridge = drm_panel_bridge_add(panel, connector_type); 218 + if (!IS_ERR(bridge)) { 219 + *ptr = bridge; 220 + devres_add(dev, ptr); 221 + } else { 222 + devres_free(ptr); 223 + } 224 + 225 + return bridge; 226 + } 227 + EXPORT_SYMBOL(devm_drm_panel_bridge_add);
-1
drivers/gpu/drm/bridge/parade-ps8622.c
··· 476 476 }; 477 477 478 478 static const struct drm_connector_funcs ps8622_connector_funcs = { 479 - .dpms = drm_atomic_helper_connector_dpms, 480 479 .fill_modes = drm_helper_probe_single_connector_modes, 481 480 .destroy = drm_connector_cleanup, 482 481 .reset = drm_atomic_helper_connector_reset,
-1
drivers/gpu/drm/bridge/sii902x.c
··· 124 124 } 125 125 126 126 static const struct drm_connector_funcs sii902x_connector_funcs = { 127 - .dpms = drm_atomic_helper_connector_dpms, 128 127 .detect = sii902x_connector_detect, 129 128 .fill_modes = drm_helper_probe_single_connector_modes, 130 129 .destroy = drm_connector_cleanup,
+10
drivers/gpu/drm/bridge/synopsys/Kconfig
··· 2 2 tristate 3 3 select DRM_KMS_HELPER 4 4 select REGMAP_MMIO 5 + select CEC_CORE if CEC_NOTIFIER 5 6 6 7 config DRM_DW_HDMI_AHB_AUDIO 7 8 tristate "Synopsys Designware AHB Audio interface" ··· 22 21 select SND_SOC_HDMI_CODEC 23 22 help 24 23 Support the I2S Audio interface which is part of the Synopsys 24 + Designware HDMI block. 25 + 26 + config DRM_DW_HDMI_CEC 27 + tristate "Synopsis Designware CEC interface" 28 + depends on DRM_DW_HDMI 29 + select CEC_CORE 30 + select CEC_NOTIFIER 31 + help 32 + Support the CE interface which is part of the Synopsys 25 33 Designware HDMI block. 26 34 27 35 config DRM_DW_MIPI_DSI
+1
drivers/gpu/drm/bridge/synopsys/Makefile
··· 3 3 obj-$(CONFIG_DRM_DW_HDMI) += dw-hdmi.o 4 4 obj-$(CONFIG_DRM_DW_HDMI_AHB_AUDIO) += dw-hdmi-ahb-audio.o 5 5 obj-$(CONFIG_DRM_DW_HDMI_I2S_AUDIO) += dw-hdmi-i2s-audio.o 6 + obj-$(CONFIG_DRM_DW_HDMI_CEC) += dw-hdmi-cec.o 6 7 7 8 obj-$(CONFIG_DRM_DW_MIPI_DSI) += dw-mipi-dsi.o
+327
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.c
··· 1 + /* 2 + * Designware HDMI CEC driver 3 + * 4 + * Copyright (C) 2015-2017 Russell King. 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + */ 10 + #include <linux/interrupt.h> 11 + #include <linux/io.h> 12 + #include <linux/module.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/sched.h> 15 + #include <linux/slab.h> 16 + 17 + #include <drm/drm_edid.h> 18 + 19 + #include <media/cec.h> 20 + #include <media/cec-notifier.h> 21 + 22 + #include "dw-hdmi-cec.h" 23 + 24 + enum { 25 + HDMI_IH_CEC_STAT0 = 0x0106, 26 + HDMI_IH_MUTE_CEC_STAT0 = 0x0186, 27 + 28 + HDMI_CEC_CTRL = 0x7d00, 29 + CEC_CTRL_START = BIT(0), 30 + CEC_CTRL_FRAME_TYP = 3 << 1, 31 + CEC_CTRL_RETRY = 0 << 1, 32 + CEC_CTRL_NORMAL = 1 << 1, 33 + CEC_CTRL_IMMED = 2 << 1, 34 + 35 + HDMI_CEC_STAT = 0x7d01, 36 + CEC_STAT_DONE = BIT(0), 37 + CEC_STAT_EOM = BIT(1), 38 + CEC_STAT_NACK = BIT(2), 39 + CEC_STAT_ARBLOST = BIT(3), 40 + CEC_STAT_ERROR_INIT = BIT(4), 41 + CEC_STAT_ERROR_FOLL = BIT(5), 42 + CEC_STAT_WAKEUP = BIT(6), 43 + 44 + HDMI_CEC_MASK = 0x7d02, 45 + HDMI_CEC_POLARITY = 0x7d03, 46 + HDMI_CEC_INT = 0x7d04, 47 + HDMI_CEC_ADDR_L = 0x7d05, 48 + HDMI_CEC_ADDR_H = 0x7d06, 49 + HDMI_CEC_TX_CNT = 0x7d07, 50 + HDMI_CEC_RX_CNT = 0x7d08, 51 + HDMI_CEC_TX_DATA0 = 0x7d10, 52 + HDMI_CEC_RX_DATA0 = 0x7d20, 53 + HDMI_CEC_LOCK = 0x7d30, 54 + HDMI_CEC_WKUPCTRL = 0x7d31, 55 + }; 56 + 57 + struct dw_hdmi_cec { 58 + struct dw_hdmi *hdmi; 59 + const struct dw_hdmi_cec_ops *ops; 60 + u32 addresses; 61 + struct cec_adapter *adap; 62 + struct cec_msg rx_msg; 63 + unsigned int tx_status; 64 + bool tx_done; 65 + bool rx_done; 66 + struct cec_notifier *notify; 67 + int irq; 68 + }; 69 + 70 + static void dw_hdmi_write(struct dw_hdmi_cec *cec, u8 val, int offset) 71 + { 72 + cec->ops->write(cec->hdmi, val, offset); 73 + } 74 + 75 + static u8 dw_hdmi_read(struct dw_hdmi_cec *cec, int offset) 76 + { 77 + return cec->ops->read(cec->hdmi, offset); 78 + } 79 + 80 + static int dw_hdmi_cec_log_addr(struct cec_adapter *adap, u8 logical_addr) 81 + { 82 + struct dw_hdmi_cec *cec = cec_get_drvdata(adap); 83 + 84 + if (logical_addr == CEC_LOG_ADDR_INVALID) 85 + cec->addresses = 0; 86 + else 87 + cec->addresses |= BIT(logical_addr) | BIT(15); 88 + 89 + dw_hdmi_write(cec, cec->addresses & 255, HDMI_CEC_ADDR_L); 90 + dw_hdmi_write(cec, cec->addresses >> 8, HDMI_CEC_ADDR_H); 91 + 92 + return 0; 93 + } 94 + 95 + static int dw_hdmi_cec_transmit(struct cec_adapter *adap, u8 attempts, 96 + u32 signal_free_time, struct cec_msg *msg) 97 + { 98 + struct dw_hdmi_cec *cec = cec_get_drvdata(adap); 99 + unsigned int i, ctrl; 100 + 101 + switch (signal_free_time) { 102 + case CEC_SIGNAL_FREE_TIME_RETRY: 103 + ctrl = CEC_CTRL_RETRY; 104 + break; 105 + case CEC_SIGNAL_FREE_TIME_NEW_INITIATOR: 106 + default: 107 + ctrl = CEC_CTRL_NORMAL; 108 + break; 109 + case CEC_SIGNAL_FREE_TIME_NEXT_XFER: 110 + ctrl = CEC_CTRL_IMMED; 111 + break; 112 + } 113 + 114 + for (i = 0; i < msg->len; i++) 115 + dw_hdmi_write(cec, msg->msg[i], HDMI_CEC_TX_DATA0 + i); 116 + 117 + dw_hdmi_write(cec, msg->len, HDMI_CEC_TX_CNT); 118 + dw_hdmi_write(cec, ctrl | CEC_CTRL_START, HDMI_CEC_CTRL); 119 + 120 + return 0; 121 + } 122 + 123 + static irqreturn_t dw_hdmi_cec_hardirq(int irq, void *data) 124 + { 125 + struct cec_adapter *adap = data; 126 + struct dw_hdmi_cec *cec = cec_get_drvdata(adap); 127 + unsigned int stat = dw_hdmi_read(cec, HDMI_IH_CEC_STAT0); 128 + irqreturn_t ret = IRQ_HANDLED; 129 + 130 + if (stat == 0) 131 + return IRQ_NONE; 132 + 133 + dw_hdmi_write(cec, stat, HDMI_IH_CEC_STAT0); 134 + 135 + if (stat & CEC_STAT_ERROR_INIT) { 136 + cec->tx_status = CEC_TX_STATUS_ERROR; 137 + cec->tx_done = true; 138 + ret = IRQ_WAKE_THREAD; 139 + } else if (stat & CEC_STAT_DONE) { 140 + cec->tx_status = CEC_TX_STATUS_OK; 141 + cec->tx_done = true; 142 + ret = IRQ_WAKE_THREAD; 143 + } else if (stat & CEC_STAT_NACK) { 144 + cec->tx_status = CEC_TX_STATUS_NACK; 145 + cec->tx_done = true; 146 + ret = IRQ_WAKE_THREAD; 147 + } 148 + 149 + if (stat & CEC_STAT_EOM) { 150 + unsigned int len, i; 151 + 152 + len = dw_hdmi_read(cec, HDMI_CEC_RX_CNT); 153 + if (len > sizeof(cec->rx_msg.msg)) 154 + len = sizeof(cec->rx_msg.msg); 155 + 156 + for (i = 0; i < len; i++) 157 + cec->rx_msg.msg[i] = 158 + dw_hdmi_read(cec, HDMI_CEC_RX_DATA0 + i); 159 + 160 + dw_hdmi_write(cec, 0, HDMI_CEC_LOCK); 161 + 162 + cec->rx_msg.len = len; 163 + smp_wmb(); 164 + cec->rx_done = true; 165 + 166 + ret = IRQ_WAKE_THREAD; 167 + } 168 + 169 + return ret; 170 + } 171 + 172 + static irqreturn_t dw_hdmi_cec_thread(int irq, void *data) 173 + { 174 + struct cec_adapter *adap = data; 175 + struct dw_hdmi_cec *cec = cec_get_drvdata(adap); 176 + 177 + if (cec->tx_done) { 178 + cec->tx_done = false; 179 + cec_transmit_attempt_done(adap, cec->tx_status); 180 + } 181 + if (cec->rx_done) { 182 + cec->rx_done = false; 183 + smp_rmb(); 184 + cec_received_msg(adap, &cec->rx_msg); 185 + } 186 + return IRQ_HANDLED; 187 + } 188 + 189 + static int dw_hdmi_cec_enable(struct cec_adapter *adap, bool enable) 190 + { 191 + struct dw_hdmi_cec *cec = cec_get_drvdata(adap); 192 + 193 + if (!enable) { 194 + dw_hdmi_write(cec, ~0, HDMI_CEC_MASK); 195 + dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0); 196 + dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); 197 + 198 + cec->ops->disable(cec->hdmi); 199 + } else { 200 + unsigned int irqs; 201 + 202 + dw_hdmi_write(cec, 0, HDMI_CEC_CTRL); 203 + dw_hdmi_write(cec, ~0, HDMI_IH_CEC_STAT0); 204 + dw_hdmi_write(cec, 0, HDMI_CEC_LOCK); 205 + 206 + dw_hdmi_cec_log_addr(cec->adap, CEC_LOG_ADDR_INVALID); 207 + 208 + cec->ops->enable(cec->hdmi); 209 + 210 + irqs = CEC_STAT_ERROR_INIT | CEC_STAT_NACK | CEC_STAT_EOM | 211 + CEC_STAT_DONE; 212 + dw_hdmi_write(cec, irqs, HDMI_CEC_POLARITY); 213 + dw_hdmi_write(cec, ~irqs, HDMI_CEC_MASK); 214 + dw_hdmi_write(cec, ~irqs, HDMI_IH_MUTE_CEC_STAT0); 215 + } 216 + return 0; 217 + } 218 + 219 + static const struct cec_adap_ops dw_hdmi_cec_ops = { 220 + .adap_enable = dw_hdmi_cec_enable, 221 + .adap_log_addr = dw_hdmi_cec_log_addr, 222 + .adap_transmit = dw_hdmi_cec_transmit, 223 + }; 224 + 225 + static void dw_hdmi_cec_del(void *data) 226 + { 227 + struct dw_hdmi_cec *cec = data; 228 + 229 + cec_delete_adapter(cec->adap); 230 + } 231 + 232 + static int dw_hdmi_cec_probe(struct platform_device *pdev) 233 + { 234 + struct dw_hdmi_cec_data *data = dev_get_platdata(&pdev->dev); 235 + struct dw_hdmi_cec *cec; 236 + int ret; 237 + 238 + if (!data) 239 + return -ENXIO; 240 + 241 + /* 242 + * Our device is just a convenience - we want to link to the real 243 + * hardware device here, so that userspace can see the association 244 + * between the HDMI hardware and its associated CEC chardev. 245 + */ 246 + cec = devm_kzalloc(&pdev->dev, sizeof(*cec), GFP_KERNEL); 247 + if (!cec) 248 + return -ENOMEM; 249 + 250 + cec->irq = data->irq; 251 + cec->ops = data->ops; 252 + cec->hdmi = data->hdmi; 253 + 254 + platform_set_drvdata(pdev, cec); 255 + 256 + dw_hdmi_write(cec, 0, HDMI_CEC_TX_CNT); 257 + dw_hdmi_write(cec, ~0, HDMI_CEC_MASK); 258 + dw_hdmi_write(cec, ~0, HDMI_IH_MUTE_CEC_STAT0); 259 + dw_hdmi_write(cec, 0, HDMI_CEC_POLARITY); 260 + 261 + cec->adap = cec_allocate_adapter(&dw_hdmi_cec_ops, cec, "dw_hdmi", 262 + CEC_CAP_LOG_ADDRS | CEC_CAP_TRANSMIT | 263 + CEC_CAP_RC | CEC_CAP_PASSTHROUGH, 264 + CEC_MAX_LOG_ADDRS); 265 + if (IS_ERR(cec->adap)) 266 + return PTR_ERR(cec->adap); 267 + 268 + /* override the module pointer */ 269 + cec->adap->owner = THIS_MODULE; 270 + 271 + ret = devm_add_action(&pdev->dev, dw_hdmi_cec_del, cec); 272 + if (ret) { 273 + cec_delete_adapter(cec->adap); 274 + return ret; 275 + } 276 + 277 + ret = devm_request_threaded_irq(&pdev->dev, cec->irq, 278 + dw_hdmi_cec_hardirq, 279 + dw_hdmi_cec_thread, IRQF_SHARED, 280 + "dw-hdmi-cec", cec->adap); 281 + if (ret < 0) 282 + return ret; 283 + 284 + cec->notify = cec_notifier_get(pdev->dev.parent); 285 + if (!cec->notify) 286 + return -ENOMEM; 287 + 288 + ret = cec_register_adapter(cec->adap, pdev->dev.parent); 289 + if (ret < 0) { 290 + cec_notifier_put(cec->notify); 291 + return ret; 292 + } 293 + 294 + /* 295 + * CEC documentation says we must not call cec_delete_adapter 296 + * after a successful call to cec_register_adapter(). 297 + */ 298 + devm_remove_action(&pdev->dev, dw_hdmi_cec_del, cec); 299 + 300 + cec_register_cec_notifier(cec->adap, cec->notify); 301 + 302 + return 0; 303 + } 304 + 305 + static int dw_hdmi_cec_remove(struct platform_device *pdev) 306 + { 307 + struct dw_hdmi_cec *cec = platform_get_drvdata(pdev); 308 + 309 + cec_unregister_adapter(cec->adap); 310 + cec_notifier_put(cec->notify); 311 + 312 + return 0; 313 + } 314 + 315 + static struct platform_driver dw_hdmi_cec_driver = { 316 + .probe = dw_hdmi_cec_probe, 317 + .remove = dw_hdmi_cec_remove, 318 + .driver = { 319 + .name = "dw-hdmi-cec", 320 + }, 321 + }; 322 + module_platform_driver(dw_hdmi_cec_driver); 323 + 324 + MODULE_AUTHOR("Russell King <rmk+kernel@armlinux.org.uk>"); 325 + MODULE_DESCRIPTION("Synopsys Designware HDMI CEC driver for i.MX"); 326 + MODULE_LICENSE("GPL"); 327 + MODULE_ALIAS(PLATFORM_MODULE_PREFIX "dw-hdmi-cec");
+19
drivers/gpu/drm/bridge/synopsys/dw-hdmi-cec.h
··· 1 + #ifndef DW_HDMI_CEC_H 2 + #define DW_HDMI_CEC_H 3 + 4 + struct dw_hdmi; 5 + 6 + struct dw_hdmi_cec_ops { 7 + void (*write)(struct dw_hdmi *hdmi, u8 val, int offset); 8 + u8 (*read)(struct dw_hdmi *hdmi, int offset); 9 + void (*enable)(struct dw_hdmi *hdmi); 10 + void (*disable)(struct dw_hdmi *hdmi); 11 + }; 12 + 13 + struct dw_hdmi_cec_data { 14 + struct dw_hdmi *hdmi; 15 + const struct dw_hdmi_cec_ops *ops; 16 + int irq; 17 + }; 18 + 19 + #endif
+2 -1
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
··· 1 1 /* 2 2 * dw-hdmi-i2s-audio.c 3 3 * 4 - * Copyright (c) 2016 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 4 + * Copyright (c) 2017 Renesas Solutions Corp. 5 + * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 5 6 * 6 7 * This program is free software; you can redistribute it and/or modify 7 8 * it under the terms of the GNU General Public License version 2 as
+84 -14
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
··· 35 35 36 36 #include "dw-hdmi.h" 37 37 #include "dw-hdmi-audio.h" 38 + #include "dw-hdmi-cec.h" 39 + 40 + #include <media/cec-notifier.h> 38 41 39 42 #define DDC_SEGMENT_ADDR 0x30 43 + 40 44 #define HDMI_EDID_LEN 512 41 45 42 46 enum hdmi_datamap { ··· 134 130 unsigned int version; 135 131 136 132 struct platform_device *audio; 133 + struct platform_device *cec; 137 134 struct device *dev; 138 135 struct clk *isfr_clk; 139 136 struct clk *iahb_clk; ··· 168 163 bool bridge_is_on; /* indicates the bridge is on */ 169 164 bool rxsense; /* rxsense state */ 170 165 u8 phy_mask; /* desired phy int mask settings */ 166 + u8 mc_clkdis; /* clock disable register */ 171 167 172 168 spinlock_t audio_lock; 173 169 struct mutex audio_mutex; ··· 181 175 struct regmap *regm; 182 176 void (*enable_audio)(struct dw_hdmi *hdmi); 183 177 void (*disable_audio)(struct dw_hdmi *hdmi); 178 + 179 + struct cec_notifier *cec_notifier; 184 180 }; 185 181 186 182 #define HDMI_IH_PHY_STAT0_RX_SENSE \ ··· 554 546 555 547 static void hdmi_enable_audio_clk(struct dw_hdmi *hdmi, bool enable) 556 548 { 557 - hdmi_modb(hdmi, enable ? 0 : HDMI_MC_CLKDIS_AUDCLK_DISABLE, 558 - HDMI_MC_CLKDIS_AUDCLK_DISABLE, HDMI_MC_CLKDIS); 549 + if (enable) 550 + hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_AUDCLK_DISABLE; 551 + else 552 + hdmi->mc_clkdis |= HDMI_MC_CLKDIS_AUDCLK_DISABLE; 553 + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); 559 554 } 560 555 561 556 static void dw_hdmi_ahb_audio_enable(struct dw_hdmi *hdmi) ··· 1580 1569 /* HDMI Initialization Step B.4 */ 1581 1570 static void dw_hdmi_enable_video_path(struct dw_hdmi *hdmi) 1582 1571 { 1583 - u8 clkdis; 1584 - 1585 1572 /* control period minimum duration */ 1586 1573 hdmi_writeb(hdmi, 12, HDMI_FC_CTRLDUR); 1587 1574 hdmi_writeb(hdmi, 32, HDMI_FC_EXCTRLDUR); ··· 1591 1582 hdmi_writeb(hdmi, 0x21, HDMI_FC_CH2PREAM); 1592 1583 1593 1584 /* Enable pixel clock and tmds data path */ 1594 - clkdis = 0x7F; 1595 - clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE; 1596 - hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); 1585 + hdmi->mc_clkdis |= HDMI_MC_CLKDIS_HDCPCLK_DISABLE | 1586 + HDMI_MC_CLKDIS_CSCCLK_DISABLE | 1587 + HDMI_MC_CLKDIS_AUDCLK_DISABLE | 1588 + HDMI_MC_CLKDIS_PREPCLK_DISABLE | 1589 + HDMI_MC_CLKDIS_TMDSCLK_DISABLE; 1590 + hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_PIXELCLK_DISABLE; 1591 + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); 1597 1592 1598 - clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE; 1599 - hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); 1593 + hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_TMDSCLK_DISABLE; 1594 + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); 1600 1595 1601 1596 /* Enable csc path */ 1602 1597 if (is_color_space_conversion(hdmi)) { 1603 - clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE; 1604 - hdmi_writeb(hdmi, clkdis, HDMI_MC_CLKDIS); 1598 + hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CSCCLK_DISABLE; 1599 + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); 1605 1600 } 1606 1601 1607 1602 /* Enable color space conversion if needed */ ··· 1796 1783 hdmi_writeb(hdmi, 0xff, HDMI_AUD_HBR_MASK); 1797 1784 hdmi_writeb(hdmi, 0xff, HDMI_GP_MASK); 1798 1785 hdmi_writeb(hdmi, 0xff, HDMI_A_APIINTMSK); 1799 - hdmi_writeb(hdmi, 0xff, HDMI_CEC_MASK); 1800 1786 hdmi_writeb(hdmi, 0xff, HDMI_I2CM_INT); 1801 1787 hdmi_writeb(hdmi, 0xff, HDMI_I2CM_CTLINT); 1802 1788 ··· 1908 1896 hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid); 1909 1897 hdmi->sink_has_audio = drm_detect_monitor_audio(edid); 1910 1898 drm_mode_connector_update_edid_property(connector, edid); 1899 + cec_notifier_set_phys_addr_from_edid(hdmi->cec_notifier, edid); 1911 1900 ret = drm_add_edid_modes(connector, edid); 1912 1901 /* Store the ELD */ 1913 1902 drm_edid_to_eld(connector, edid); ··· 1933 1920 } 1934 1921 1935 1922 static const struct drm_connector_funcs dw_hdmi_connector_funcs = { 1936 - .dpms = drm_atomic_helper_connector_dpms, 1937 1923 .fill_modes = drm_helper_probe_single_connector_modes, 1938 1924 .detect = dw_hdmi_connector_detect, 1939 1925 .destroy = drm_connector_cleanup, ··· 2131 2119 * ask the source to re-read the EDID. 2132 2120 */ 2133 2121 if (intr_stat & 2134 - (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) 2122 + (HDMI_IH_PHY_STAT0_RX_SENSE | HDMI_IH_PHY_STAT0_HPD)) { 2135 2123 __dw_hdmi_setup_rx_sense(hdmi, 2136 2124 phy_stat & HDMI_PHY_HPD, 2137 2125 phy_stat & HDMI_PHY_RX_SENSE); 2126 + 2127 + if ((phy_stat & (HDMI_PHY_RX_SENSE | HDMI_PHY_HPD)) == 0) 2128 + cec_notifier_set_phys_addr(hdmi->cec_notifier, 2129 + CEC_PHYS_ADDR_INVALID); 2130 + } 2138 2131 2139 2132 if (intr_stat & HDMI_IH_PHY_STAT0_HPD) { 2140 2133 dev_dbg(hdmi->dev, "EVENT=%s\n", ··· 2187 2170 .name = "DWC HDMI 2.0 TX PHY", 2188 2171 .gen = 2, 2189 2172 .has_svsret = true, 2173 + .configure = hdmi_phy_configure_dwc_hdmi_3d_tx, 2190 2174 }, { 2191 2175 .type = DW_HDMI_PHY_VENDOR_PHY, 2192 2176 .name = "Vendor PHY", ··· 2237 2219 return -ENODEV; 2238 2220 } 2239 2221 2222 + static void dw_hdmi_cec_enable(struct dw_hdmi *hdmi) 2223 + { 2224 + mutex_lock(&hdmi->mutex); 2225 + hdmi->mc_clkdis &= ~HDMI_MC_CLKDIS_CECCLK_DISABLE; 2226 + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); 2227 + mutex_unlock(&hdmi->mutex); 2228 + } 2229 + 2230 + static void dw_hdmi_cec_disable(struct dw_hdmi *hdmi) 2231 + { 2232 + mutex_lock(&hdmi->mutex); 2233 + hdmi->mc_clkdis |= HDMI_MC_CLKDIS_CECCLK_DISABLE; 2234 + hdmi_writeb(hdmi, hdmi->mc_clkdis, HDMI_MC_CLKDIS); 2235 + mutex_unlock(&hdmi->mutex); 2236 + } 2237 + 2238 + static const struct dw_hdmi_cec_ops dw_hdmi_cec_ops = { 2239 + .write = hdmi_writeb, 2240 + .read = hdmi_readb, 2241 + .enable = dw_hdmi_cec_enable, 2242 + .disable = dw_hdmi_cec_disable, 2243 + }; 2244 + 2240 2245 static const struct regmap_config hdmi_regmap_8bit_config = { 2241 2246 .reg_bits = 32, 2242 2247 .val_bits = 8, ··· 2282 2241 struct device_node *np = dev->of_node; 2283 2242 struct platform_device_info pdevinfo; 2284 2243 struct device_node *ddc_node; 2244 + struct dw_hdmi_cec_data cec; 2285 2245 struct dw_hdmi *hdmi; 2286 2246 struct resource *iores = NULL; 2287 2247 int irq; ··· 2303 2261 hdmi->disabled = true; 2304 2262 hdmi->rxsense = true; 2305 2263 hdmi->phy_mask = (u8)~(HDMI_PHY_HPD | HDMI_PHY_RX_SENSE); 2264 + hdmi->mc_clkdis = 0x7f; 2306 2265 2307 2266 mutex_init(&hdmi->mutex); 2308 2267 mutex_init(&hdmi->audio_mutex); ··· 2419 2376 if (ret) 2420 2377 goto err_iahb; 2421 2378 2379 + hdmi->cec_notifier = cec_notifier_get(dev); 2380 + if (!hdmi->cec_notifier) { 2381 + ret = -ENOMEM; 2382 + goto err_iahb; 2383 + } 2384 + 2422 2385 /* 2423 2386 * To prevent overflows in HDMI_IH_FC_STAT2, set the clk regenerator 2424 2387 * N and cts values before enabling phy ··· 2487 2438 hdmi->audio = platform_device_register_full(&pdevinfo); 2488 2439 } 2489 2440 2441 + if (config0 & HDMI_CONFIG0_CEC) { 2442 + cec.hdmi = hdmi; 2443 + cec.ops = &dw_hdmi_cec_ops; 2444 + cec.irq = irq; 2445 + 2446 + pdevinfo.name = "dw-hdmi-cec"; 2447 + pdevinfo.data = &cec; 2448 + pdevinfo.size_data = sizeof(cec); 2449 + pdevinfo.dma_mask = 0; 2450 + 2451 + hdmi->cec = platform_device_register_full(&pdevinfo); 2452 + } 2453 + 2490 2454 /* Reset HDMI DDC I2C master controller and mute I2CM interrupts */ 2491 2455 if (hdmi->i2c) 2492 2456 dw_hdmi_i2c_init(hdmi); ··· 2514 2452 hdmi->ddc = NULL; 2515 2453 } 2516 2454 2455 + if (hdmi->cec_notifier) 2456 + cec_notifier_put(hdmi->cec_notifier); 2457 + 2517 2458 clk_disable_unprepare(hdmi->iahb_clk); 2518 2459 err_isfr: 2519 2460 clk_disable_unprepare(hdmi->isfr_clk); ··· 2530 2465 { 2531 2466 if (hdmi->audio && !IS_ERR(hdmi->audio)) 2532 2467 platform_device_unregister(hdmi->audio); 2468 + if (!IS_ERR(hdmi->cec)) 2469 + platform_device_unregister(hdmi->cec); 2533 2470 2534 2471 /* Disable all interrupts */ 2535 2472 hdmi_writeb(hdmi, ~0, HDMI_IH_MUTE_PHY_STAT0); 2473 + 2474 + if (hdmi->cec_notifier) 2475 + cec_notifier_put(hdmi->cec_notifier); 2536 2476 2537 2477 clk_disable_unprepare(hdmi->iahb_clk); 2538 2478 clk_disable_unprepare(hdmi->isfr_clk);
+1 -45
drivers/gpu/drm/bridge/synopsys/dw-hdmi.h
··· 478 478 #define HDMI_A_PRESETUP 0x501A 479 479 #define HDMI_A_SRM_BASE 0x5020 480 480 481 - /* CEC Engine Registers */ 482 - #define HDMI_CEC_CTRL 0x7D00 483 - #define HDMI_CEC_STAT 0x7D01 484 - #define HDMI_CEC_MASK 0x7D02 485 - #define HDMI_CEC_POLARITY 0x7D03 486 - #define HDMI_CEC_INT 0x7D04 487 - #define HDMI_CEC_ADDR_L 0x7D05 488 - #define HDMI_CEC_ADDR_H 0x7D06 489 - #define HDMI_CEC_TX_CNT 0x7D07 490 - #define HDMI_CEC_RX_CNT 0x7D08 491 - #define HDMI_CEC_TX_DATA0 0x7D10 492 - #define HDMI_CEC_TX_DATA1 0x7D11 493 - #define HDMI_CEC_TX_DATA2 0x7D12 494 - #define HDMI_CEC_TX_DATA3 0x7D13 495 - #define HDMI_CEC_TX_DATA4 0x7D14 496 - #define HDMI_CEC_TX_DATA5 0x7D15 497 - #define HDMI_CEC_TX_DATA6 0x7D16 498 - #define HDMI_CEC_TX_DATA7 0x7D17 499 - #define HDMI_CEC_TX_DATA8 0x7D18 500 - #define HDMI_CEC_TX_DATA9 0x7D19 501 - #define HDMI_CEC_TX_DATA10 0x7D1a 502 - #define HDMI_CEC_TX_DATA11 0x7D1b 503 - #define HDMI_CEC_TX_DATA12 0x7D1c 504 - #define HDMI_CEC_TX_DATA13 0x7D1d 505 - #define HDMI_CEC_TX_DATA14 0x7D1e 506 - #define HDMI_CEC_TX_DATA15 0x7D1f 507 - #define HDMI_CEC_RX_DATA0 0x7D20 508 - #define HDMI_CEC_RX_DATA1 0x7D21 509 - #define HDMI_CEC_RX_DATA2 0x7D22 510 - #define HDMI_CEC_RX_DATA3 0x7D23 511 - #define HDMI_CEC_RX_DATA4 0x7D24 512 - #define HDMI_CEC_RX_DATA5 0x7D25 513 - #define HDMI_CEC_RX_DATA6 0x7D26 514 - #define HDMI_CEC_RX_DATA7 0x7D27 515 - #define HDMI_CEC_RX_DATA8 0x7D28 516 - #define HDMI_CEC_RX_DATA9 0x7D29 517 - #define HDMI_CEC_RX_DATA10 0x7D2a 518 - #define HDMI_CEC_RX_DATA11 0x7D2b 519 - #define HDMI_CEC_RX_DATA12 0x7D2c 520 - #define HDMI_CEC_RX_DATA13 0x7D2d 521 - #define HDMI_CEC_RX_DATA14 0x7D2e 522 - #define HDMI_CEC_RX_DATA15 0x7D2f 523 - #define HDMI_CEC_LOCK 0x7D30 524 - #define HDMI_CEC_WKUPCTRL 0x7D31 525 - 526 481 /* I2C Master Registers (E-DDC) */ 527 482 #define HDMI_I2CM_SLAVE 0x7E00 528 483 #define HDMI_I2CM_ADDRESS 0x7E01 ··· 510 555 511 556 /* CONFIG0_ID field values */ 512 557 HDMI_CONFIG0_I2S = 0x10, 558 + HDMI_CONFIG0_CEC = 0x02, 513 559 514 560 /* CONFIG1_ID field values */ 515 561 HDMI_CONFIG1_AHB = 0x01,
-1
drivers/gpu/drm/bridge/tc358767.c
··· 1160 1160 }; 1161 1161 1162 1162 static const struct drm_connector_funcs tc_connector_funcs = { 1163 - .dpms = drm_atomic_helper_connector_dpms, 1164 1163 .fill_modes = drm_helper_probe_single_connector_modes, 1165 1164 .destroy = drm_connector_cleanup, 1166 1165 .reset = drm_atomic_helper_connector_reset,
-1
drivers/gpu/drm/bridge/ti-tfp410.c
··· 102 102 } 103 103 104 104 static const struct drm_connector_funcs tfp410_con_funcs = { 105 - .dpms = drm_atomic_helper_connector_dpms, 106 105 .detect = tfp410_connector_detect, 107 106 .fill_modes = drm_helper_probe_single_connector_modes, 108 107 .destroy = drm_connector_cleanup,
-8
drivers/gpu/drm/cirrus/cirrus_drv.h
··· 96 96 97 97 struct cirrus_crtc { 98 98 struct drm_crtc base; 99 - u8 lut_r[256], lut_g[256], lut_b[256]; 100 99 int last_dpms; 101 100 bool enabled; 102 101 }; ··· 178 179 179 180 #define to_cirrus_obj(x) container_of(x, struct cirrus_gem_object, base) 180 181 #define DRM_FILE_PAGE_OFFSET (0x100000000ULL >> PAGE_SHIFT) 181 - 182 - /* cirrus_mode.c */ 183 - void cirrus_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 184 - u16 blue, int regno); 185 - void cirrus_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 186 - u16 *blue, int regno); 187 - 188 182 189 183 /* cirrus_main.c */ 190 184 int cirrus_device_init(struct cirrus_device *cdev,
-2
drivers/gpu/drm/cirrus/cirrus_fbdev.c
··· 264 264 } 265 265 266 266 static const struct drm_fb_helper_funcs cirrus_fb_helper_funcs = { 267 - .gamma_set = cirrus_crtc_fb_gamma_set, 268 - .gamma_get = cirrus_crtc_fb_gamma_get, 269 267 .fb_probe = cirrusfb_create, 270 268 }; 271 269
+16 -55
drivers/gpu/drm/cirrus/cirrus_mode.c
··· 31 31 * This file contains setup code for the CRTC. 32 32 */ 33 33 34 - static void cirrus_crtc_load_lut(struct drm_crtc *crtc) 35 - { 36 - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); 37 - struct drm_device *dev = crtc->dev; 38 - struct cirrus_device *cdev = dev->dev_private; 39 - int i; 40 - 41 - if (!crtc->enabled) 42 - return; 43 - 44 - for (i = 0; i < CIRRUS_LUT_SIZE; i++) { 45 - /* VGA registers */ 46 - WREG8(PALETTE_INDEX, i); 47 - WREG8(PALETTE_DATA, cirrus_crtc->lut_r[i]); 48 - WREG8(PALETTE_DATA, cirrus_crtc->lut_g[i]); 49 - WREG8(PALETTE_DATA, cirrus_crtc->lut_b[i]); 50 - } 51 - } 52 - 53 34 /* 54 35 * The DRM core requires DPMS functions, but they make little sense in our 55 36 * case and so are just stubs ··· 311 330 u16 *blue, uint32_t size, 312 331 struct drm_modeset_acquire_ctx *ctx) 313 332 { 314 - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); 333 + struct drm_device *dev = crtc->dev; 334 + struct cirrus_device *cdev = dev->dev_private; 335 + u16 *r, *g, *b; 315 336 int i; 316 337 317 - for (i = 0; i < size; i++) { 318 - cirrus_crtc->lut_r[i] = red[i]; 319 - cirrus_crtc->lut_g[i] = green[i]; 320 - cirrus_crtc->lut_b[i] = blue[i]; 338 + if (!crtc->enabled) 339 + return 0; 340 + 341 + r = crtc->gamma_store; 342 + g = r + crtc->gamma_size; 343 + b = g + crtc->gamma_size; 344 + 345 + for (i = 0; i < CIRRUS_LUT_SIZE; i++) { 346 + /* VGA registers */ 347 + WREG8(PALETTE_INDEX, i); 348 + WREG8(PALETTE_DATA, *r++ >> 8); 349 + WREG8(PALETTE_DATA, *g++ >> 8); 350 + WREG8(PALETTE_DATA, *b++ >> 8); 321 351 } 322 - cirrus_crtc_load_lut(crtc); 323 352 324 353 return 0; 325 354 } ··· 356 365 .mode_set_base = cirrus_crtc_mode_set_base, 357 366 .prepare = cirrus_crtc_prepare, 358 367 .commit = cirrus_crtc_commit, 359 - .load_lut = cirrus_crtc_load_lut, 360 368 }; 361 369 362 370 /* CRTC setup */ ··· 363 373 { 364 374 struct cirrus_device *cdev = dev->dev_private; 365 375 struct cirrus_crtc *cirrus_crtc; 366 - int i; 367 376 368 377 cirrus_crtc = kzalloc(sizeof(struct cirrus_crtc) + 369 378 (CIRRUSFB_CONN_LIMIT * sizeof(struct drm_connector *)), ··· 376 387 drm_mode_crtc_set_gamma_size(&cirrus_crtc->base, CIRRUS_LUT_SIZE); 377 388 cdev->mode_info.crtc = cirrus_crtc; 378 389 379 - for (i = 0; i < CIRRUS_LUT_SIZE; i++) { 380 - cirrus_crtc->lut_r[i] = i; 381 - cirrus_crtc->lut_g[i] = i; 382 - cirrus_crtc->lut_b[i] = i; 383 - } 384 - 385 390 drm_crtc_helper_add(&cirrus_crtc->base, &cirrus_helper_funcs); 386 - } 387 - 388 - /** Sets the color ramps on behalf of fbcon */ 389 - void cirrus_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 390 - u16 blue, int regno) 391 - { 392 - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); 393 - 394 - cirrus_crtc->lut_r[regno] = red; 395 - cirrus_crtc->lut_g[regno] = green; 396 - cirrus_crtc->lut_b[regno] = blue; 397 - } 398 - 399 - /** Gets the color ramps on behalf of fbcon */ 400 - void cirrus_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 401 - u16 *blue, int regno) 402 - { 403 - struct cirrus_crtc *cirrus_crtc = to_cirrus_crtc(crtc); 404 - 405 - *red = cirrus_crtc->lut_r[regno]; 406 - *green = cirrus_crtc->lut_g[regno]; 407 - *blue = cirrus_crtc->lut_b[regno]; 408 391 } 409 392 410 393 static void cirrus_encoder_mode_set(struct drm_encoder *encoder,
+58 -40
drivers/gpu/drm/drm_atomic.c
··· 713 713 * RETURNS: 714 714 * Zero on success, error code on failure 715 715 */ 716 - int drm_atomic_plane_set_property(struct drm_plane *plane, 716 + static int drm_atomic_plane_set_property(struct drm_plane *plane, 717 717 struct drm_plane_state *state, struct drm_property *property, 718 718 uint64_t val) 719 719 { ··· 770 770 771 771 return 0; 772 772 } 773 - EXPORT_SYMBOL(drm_atomic_plane_set_property); 774 773 775 774 /** 776 775 * drm_atomic_plane_get_property - get property value from plane state ··· 1144 1145 * RETURNS: 1145 1146 * Zero on success, error code on failure 1146 1147 */ 1147 - int drm_atomic_connector_set_property(struct drm_connector *connector, 1148 + static int drm_atomic_connector_set_property(struct drm_connector *connector, 1148 1149 struct drm_connector_state *state, struct drm_property *property, 1149 1150 uint64_t val) 1150 1151 { ··· 1211 1212 1212 1213 return 0; 1213 1214 } 1214 - EXPORT_SYMBOL(drm_atomic_connector_set_property); 1215 1215 1216 1216 static void drm_atomic_connector_print_state(struct drm_printer *p, 1217 1217 const struct drm_connector_state *state) ··· 1588 1590 EXPORT_SYMBOL(drm_atomic_add_affected_planes); 1589 1591 1590 1592 /** 1591 - * drm_atomic_legacy_backoff - locking backoff for legacy ioctls 1592 - * @state: atomic state 1593 - * 1594 - * This function should be used by legacy entry points which don't understand 1595 - * -EDEADLK semantics. For simplicity this one will grab all modeset locks after 1596 - * the slowpath completed. 1597 - */ 1598 - void drm_atomic_legacy_backoff(struct drm_atomic_state *state) 1599 - { 1600 - struct drm_device *dev = state->dev; 1601 - int ret; 1602 - bool global = false; 1603 - 1604 - if (WARN_ON(dev->mode_config.acquire_ctx == state->acquire_ctx)) { 1605 - global = true; 1606 - 1607 - dev->mode_config.acquire_ctx = NULL; 1608 - } 1609 - 1610 - retry: 1611 - drm_modeset_backoff(state->acquire_ctx); 1612 - 1613 - ret = drm_modeset_lock_all_ctx(dev, state->acquire_ctx); 1614 - if (ret) 1615 - goto retry; 1616 - 1617 - if (global) 1618 - dev->mode_config.acquire_ctx = state->acquire_ctx; 1619 - } 1620 - EXPORT_SYMBOL(drm_atomic_legacy_backoff); 1621 - 1622 - /** 1623 1593 * drm_atomic_check_only - check whether a given config would work 1624 1594 * @state: atomic configuration to check 1625 1595 * ··· 1830 1864 return e; 1831 1865 } 1832 1866 1833 - static int atomic_set_prop(struct drm_atomic_state *state, 1834 - struct drm_mode_object *obj, struct drm_property *prop, 1835 - uint64_t prop_value) 1867 + int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state, 1868 + struct drm_connector *connector, 1869 + int mode) 1870 + { 1871 + struct drm_connector *tmp_connector; 1872 + struct drm_connector_state *new_conn_state; 1873 + struct drm_crtc *crtc; 1874 + struct drm_crtc_state *crtc_state; 1875 + int i, ret, old_mode = connector->dpms; 1876 + bool active = false; 1877 + 1878 + ret = drm_modeset_lock(&state->dev->mode_config.connection_mutex, 1879 + state->acquire_ctx); 1880 + if (ret) 1881 + return ret; 1882 + 1883 + if (mode != DRM_MODE_DPMS_ON) 1884 + mode = DRM_MODE_DPMS_OFF; 1885 + connector->dpms = mode; 1886 + 1887 + crtc = connector->state->crtc; 1888 + if (!crtc) 1889 + goto out; 1890 + ret = drm_atomic_add_affected_connectors(state, crtc); 1891 + if (ret) 1892 + goto out; 1893 + 1894 + crtc_state = drm_atomic_get_crtc_state(state, crtc); 1895 + if (IS_ERR(crtc_state)) { 1896 + ret = PTR_ERR(crtc_state); 1897 + goto out; 1898 + } 1899 + 1900 + for_each_new_connector_in_state(state, tmp_connector, new_conn_state, i) { 1901 + if (new_conn_state->crtc != crtc) 1902 + continue; 1903 + if (tmp_connector->dpms == DRM_MODE_DPMS_ON) { 1904 + active = true; 1905 + break; 1906 + } 1907 + } 1908 + 1909 + crtc_state->active = active; 1910 + ret = drm_atomic_commit(state); 1911 + out: 1912 + if (ret != 0) 1913 + connector->dpms = old_mode; 1914 + return ret; 1915 + } 1916 + 1917 + int drm_atomic_set_property(struct drm_atomic_state *state, 1918 + struct drm_mode_object *obj, 1919 + struct drm_property *prop, 1920 + uint64_t prop_value) 1836 1921 { 1837 1922 struct drm_mode_object *ref; 1838 1923 int ret; ··· 2303 2286 goto out; 2304 2287 } 2305 2288 2306 - ret = atomic_set_prop(state, obj, prop, prop_value); 2289 + ret = drm_atomic_set_property(state, obj, prop, 2290 + prop_value); 2307 2291 if (ret) { 2308 2292 drm_mode_object_put(obj); 2309 2293 goto out;
+1 -249
drivers/gpu/drm/drm_atomic_helper.c
··· 921 921 crtc = new_conn_state->crtc; 922 922 if ((!crtc && old_conn_state->crtc) || 923 923 (crtc && drm_atomic_crtc_needs_modeset(crtc->state))) { 924 - struct drm_property *dpms_prop = 925 - dev->mode_config.dpms_property; 926 924 int mode = DRM_MODE_DPMS_OFF; 927 925 928 926 if (crtc && crtc->state->active) 929 927 mode = DRM_MODE_DPMS_ON; 930 928 931 929 connector->dpms = mode; 932 - drm_object_property_set_value(&connector->base, 933 - dpms_prop, mode); 934 930 } 935 931 } 936 932 ··· 1266 1270 struct drm_crtc *crtc; 1267 1271 int i; 1268 1272 1269 - for_each_crtc_in_state(old_state, crtc, unused, i) { 1273 + for_each_new_crtc_in_state(old_state, crtc, unused, i) { 1270 1274 struct drm_crtc_commit *commit = old_state->crtcs[i].commit; 1271 1275 int ret; 1272 1276 ··· 2953 2957 } 2954 2958 EXPORT_SYMBOL(drm_atomic_helper_resume); 2955 2959 2956 - /** 2957 - * drm_atomic_helper_crtc_set_property - helper for crtc properties 2958 - * @crtc: DRM crtc 2959 - * @property: DRM property 2960 - * @val: value of property 2961 - * 2962 - * Provides a default crtc set_property handler using the atomic driver 2963 - * interface. 2964 - * 2965 - * RETURNS: 2966 - * Zero on success, error code on failure 2967 - */ 2968 - int 2969 - drm_atomic_helper_crtc_set_property(struct drm_crtc *crtc, 2970 - struct drm_property *property, 2971 - uint64_t val) 2972 - { 2973 - struct drm_atomic_state *state; 2974 - struct drm_crtc_state *crtc_state; 2975 - int ret = 0; 2976 - 2977 - state = drm_atomic_state_alloc(crtc->dev); 2978 - if (!state) 2979 - return -ENOMEM; 2980 - 2981 - /* ->set_property is always called with all locks held. */ 2982 - state->acquire_ctx = crtc->dev->mode_config.acquire_ctx; 2983 - retry: 2984 - crtc_state = drm_atomic_get_crtc_state(state, crtc); 2985 - if (IS_ERR(crtc_state)) { 2986 - ret = PTR_ERR(crtc_state); 2987 - goto fail; 2988 - } 2989 - 2990 - ret = drm_atomic_crtc_set_property(crtc, crtc_state, 2991 - property, val); 2992 - if (ret) 2993 - goto fail; 2994 - 2995 - ret = drm_atomic_commit(state); 2996 - fail: 2997 - if (ret == -EDEADLK) 2998 - goto backoff; 2999 - 3000 - drm_atomic_state_put(state); 3001 - return ret; 3002 - 3003 - backoff: 3004 - drm_atomic_state_clear(state); 3005 - drm_atomic_legacy_backoff(state); 3006 - 3007 - goto retry; 3008 - } 3009 - EXPORT_SYMBOL(drm_atomic_helper_crtc_set_property); 3010 - 3011 - /** 3012 - * drm_atomic_helper_plane_set_property - helper for plane properties 3013 - * @plane: DRM plane 3014 - * @property: DRM property 3015 - * @val: value of property 3016 - * 3017 - * Provides a default plane set_property handler using the atomic driver 3018 - * interface. 3019 - * 3020 - * RETURNS: 3021 - * Zero on success, error code on failure 3022 - */ 3023 - int 3024 - drm_atomic_helper_plane_set_property(struct drm_plane *plane, 3025 - struct drm_property *property, 3026 - uint64_t val) 3027 - { 3028 - struct drm_atomic_state *state; 3029 - struct drm_plane_state *plane_state; 3030 - int ret = 0; 3031 - 3032 - state = drm_atomic_state_alloc(plane->dev); 3033 - if (!state) 3034 - return -ENOMEM; 3035 - 3036 - /* ->set_property is always called with all locks held. */ 3037 - state->acquire_ctx = plane->dev->mode_config.acquire_ctx; 3038 - retry: 3039 - plane_state = drm_atomic_get_plane_state(state, plane); 3040 - if (IS_ERR(plane_state)) { 3041 - ret = PTR_ERR(plane_state); 3042 - goto fail; 3043 - } 3044 - 3045 - ret = drm_atomic_plane_set_property(plane, plane_state, 3046 - property, val); 3047 - if (ret) 3048 - goto fail; 3049 - 3050 - ret = drm_atomic_commit(state); 3051 - fail: 3052 - if (ret == -EDEADLK) 3053 - goto backoff; 3054 - 3055 - drm_atomic_state_put(state); 3056 - return ret; 3057 - 3058 - backoff: 3059 - drm_atomic_state_clear(state); 3060 - drm_atomic_legacy_backoff(state); 3061 - 3062 - goto retry; 3063 - } 3064 - EXPORT_SYMBOL(drm_atomic_helper_plane_set_property); 3065 - 3066 - /** 3067 - * drm_atomic_helper_connector_set_property - helper for connector properties 3068 - * @connector: DRM connector 3069 - * @property: DRM property 3070 - * @val: value of property 3071 - * 3072 - * Provides a default connector set_property handler using the atomic driver 3073 - * interface. 3074 - * 3075 - * RETURNS: 3076 - * Zero on success, error code on failure 3077 - */ 3078 - int 3079 - drm_atomic_helper_connector_set_property(struct drm_connector *connector, 3080 - struct drm_property *property, 3081 - uint64_t val) 3082 - { 3083 - struct drm_atomic_state *state; 3084 - struct drm_connector_state *connector_state; 3085 - int ret = 0; 3086 - 3087 - state = drm_atomic_state_alloc(connector->dev); 3088 - if (!state) 3089 - return -ENOMEM; 3090 - 3091 - /* ->set_property is always called with all locks held. */ 3092 - state->acquire_ctx = connector->dev->mode_config.acquire_ctx; 3093 - retry: 3094 - connector_state = drm_atomic_get_connector_state(state, connector); 3095 - if (IS_ERR(connector_state)) { 3096 - ret = PTR_ERR(connector_state); 3097 - goto fail; 3098 - } 3099 - 3100 - ret = drm_atomic_connector_set_property(connector, connector_state, 3101 - property, val); 3102 - if (ret) 3103 - goto fail; 3104 - 3105 - ret = drm_atomic_commit(state); 3106 - fail: 3107 - if (ret == -EDEADLK) 3108 - goto backoff; 3109 - 3110 - drm_atomic_state_put(state); 3111 - return ret; 3112 - 3113 - backoff: 3114 - drm_atomic_state_clear(state); 3115 - drm_atomic_legacy_backoff(state); 3116 - 3117 - goto retry; 3118 - } 3119 - EXPORT_SYMBOL(drm_atomic_helper_connector_set_property); 3120 - 3121 2960 static int page_flip_common(struct drm_atomic_state *state, 3122 2961 struct drm_crtc *crtc, 3123 2962 struct drm_framebuffer *fb, ··· 3086 3255 return ret; 3087 3256 } 3088 3257 EXPORT_SYMBOL(drm_atomic_helper_page_flip_target); 3089 - 3090 - /** 3091 - * drm_atomic_helper_connector_dpms() - connector dpms helper implementation 3092 - * @connector: affected connector 3093 - * @mode: DPMS mode 3094 - * 3095 - * This is the main helper function provided by the atomic helper framework for 3096 - * implementing the legacy DPMS connector interface. It computes the new desired 3097 - * &drm_crtc_state.active state for the corresponding CRTC (if the connector is 3098 - * enabled) and updates it. 3099 - * 3100 - * Returns: 3101 - * Returns 0 on success, negative errno numbers on failure. 3102 - */ 3103 - int drm_atomic_helper_connector_dpms(struct drm_connector *connector, 3104 - int mode) 3105 - { 3106 - struct drm_mode_config *config = &connector->dev->mode_config; 3107 - struct drm_atomic_state *state; 3108 - struct drm_crtc_state *crtc_state; 3109 - struct drm_crtc *crtc; 3110 - struct drm_connector *tmp_connector; 3111 - struct drm_connector_list_iter conn_iter; 3112 - int ret; 3113 - bool active = false; 3114 - int old_mode = connector->dpms; 3115 - 3116 - if (mode != DRM_MODE_DPMS_ON) 3117 - mode = DRM_MODE_DPMS_OFF; 3118 - 3119 - connector->dpms = mode; 3120 - crtc = connector->state->crtc; 3121 - 3122 - if (!crtc) 3123 - return 0; 3124 - 3125 - state = drm_atomic_state_alloc(connector->dev); 3126 - if (!state) 3127 - return -ENOMEM; 3128 - 3129 - state->acquire_ctx = crtc->dev->mode_config.acquire_ctx; 3130 - retry: 3131 - crtc_state = drm_atomic_get_crtc_state(state, crtc); 3132 - if (IS_ERR(crtc_state)) { 3133 - ret = PTR_ERR(crtc_state); 3134 - goto fail; 3135 - } 3136 - 3137 - WARN_ON(!drm_modeset_is_locked(&config->connection_mutex)); 3138 - 3139 - drm_connector_list_iter_begin(connector->dev, &conn_iter); 3140 - drm_for_each_connector_iter(tmp_connector, &conn_iter) { 3141 - if (tmp_connector->state->crtc != crtc) 3142 - continue; 3143 - 3144 - if (tmp_connector->dpms == DRM_MODE_DPMS_ON) { 3145 - active = true; 3146 - break; 3147 - } 3148 - } 3149 - drm_connector_list_iter_end(&conn_iter); 3150 - crtc_state->active = active; 3151 - 3152 - ret = drm_atomic_commit(state); 3153 - fail: 3154 - if (ret == -EDEADLK) 3155 - goto backoff; 3156 - if (ret != 0) 3157 - connector->dpms = old_mode; 3158 - drm_atomic_state_put(state); 3159 - return ret; 3160 - 3161 - backoff: 3162 - drm_atomic_state_clear(state); 3163 - drm_atomic_legacy_backoff(state); 3164 - 3165 - goto retry; 3166 - } 3167 - EXPORT_SYMBOL(drm_atomic_helper_connector_dpms); 3168 3258 3169 3259 /** 3170 3260 * drm_atomic_helper_best_encoder - Helper for
+3 -4
drivers/gpu/drm/drm_connector.c
··· 717 717 * drivers, it remaps to controlling the "ACTIVE" property on the CRTC the 718 718 * connector is linked to. Drivers should never set this property directly, 719 719 * it is handled by the DRM core by calling the &drm_connector_funcs.dpms 720 - * callback. Atomic drivers should implement this hook using 721 - * drm_atomic_helper_connector_dpms(). This is the only property standard 722 - * connector property that userspace can change. 720 + * callback. For atomic drivers the remapping to the "ACTIVE" property is 721 + * implemented in the DRM core. This is the only standard connector 722 + * property that userspace can change. 723 723 * PATH: 724 724 * Connector path property to identify how this sink is physically 725 725 * connected. Used by DP MST. This should be set by calling ··· 1225 1225 } else if (connector->funcs->set_property) 1226 1226 ret = connector->funcs->set_property(connector, property, value); 1227 1227 1228 - /* store the property value if successful */ 1229 1228 if (!ret) 1230 1229 drm_object_property_set_value(&connector->base, property, value); 1231 1230 return ret;
+1 -2
drivers/gpu/drm/drm_crtc_helper.c
··· 863 863 * provided by the driver. 864 864 * 865 865 * This function is deprecated. New drivers must implement atomic modeset 866 - * support, for which this function is unsuitable. Instead drivers should use 867 - * drm_atomic_helper_connector_dpms(). 866 + * support, where DPMS is handled in the DRM core. 868 867 * 869 868 * Returns: 870 869 * Always returns 0.
+7
drivers/gpu/drm/drm_crtc_internal.h
··· 178 178 int drm_atomic_debugfs_init(struct drm_minor *minor); 179 179 #endif 180 180 181 + int drm_atomic_connector_commit_dpms(struct drm_atomic_state *state, 182 + struct drm_connector *connector, 183 + int mode); 184 + int drm_atomic_set_property(struct drm_atomic_state *state, 185 + struct drm_mode_object *obj, 186 + struct drm_property *prop, 187 + uint64_t prop_value); 181 188 int drm_atomic_get_property(struct drm_mode_object *obj, 182 189 struct drm_property *property, uint64_t *val); 183 190 int drm_mode_atomic_ioctl(struct drm_device *dev,
+18 -8
drivers/gpu/drm/drm_dumb_buffers.c
··· 24 24 */ 25 25 26 26 #include <drm/drmP.h> 27 + #include <drm/drm_gem.h> 27 28 28 29 #include "drm_crtc_internal.h" 29 30 ··· 43 42 * create dumb buffers suitable for scanout, which can then be used to create 44 43 * KMS frame buffers. 45 44 * 46 - * To support dumb objects drivers must implement the &drm_driver.dumb_create, 47 - * &drm_driver.dumb_destroy and &drm_driver.dumb_map_offset operations. See 48 - * there for further details. 45 + * To support dumb objects drivers must implement the &drm_driver.dumb_create 46 + * operation. &drm_driver.dumb_destroy defaults to drm_gem_dumb_destroy() if 47 + * not set and &drm_driver.dumb_map_offset defaults to 48 + * drm_gem_dumb_map_offset(). See the callbacks for further details. 49 49 * 50 50 * Note that dumb objects may not be used for gpu acceleration, as has been 51 51 * attempted on some ARM embedded platforms. Such drivers really must have ··· 110 108 { 111 109 struct drm_mode_map_dumb *args = data; 112 110 113 - /* call driver ioctl to get mmap offset */ 114 - if (!dev->driver->dumb_map_offset) 111 + if (!dev->driver->dumb_create) 115 112 return -ENOSYS; 116 113 117 - return dev->driver->dumb_map_offset(file_priv, dev, args->handle, &args->offset); 114 + if (dev->driver->dumb_map_offset) 115 + return dev->driver->dumb_map_offset(file_priv, dev, 116 + args->handle, 117 + &args->offset); 118 + else 119 + return drm_gem_dumb_map_offset(file_priv, dev, args->handle, 120 + &args->offset); 118 121 } 119 122 120 123 int drm_mode_destroy_dumb_ioctl(struct drm_device *dev, ··· 127 120 { 128 121 struct drm_mode_destroy_dumb *args = data; 129 122 130 - if (!dev->driver->dumb_destroy) 123 + if (!dev->driver->dumb_create) 131 124 return -ENOSYS; 132 125 133 - return dev->driver->dumb_destroy(file_priv, dev, args->handle); 126 + if (dev->driver->dumb_destroy) 127 + return dev->driver->dumb_destroy(file_priv, dev, args->handle); 128 + else 129 + return drm_gem_dumb_destroy(file_priv, dev, args->handle); 134 130 } 135 131
+34 -15
drivers/gpu/drm/drm_fb_helper.c
··· 1821 1821 if (ret < 0) 1822 1822 return ret; 1823 1823 1824 - /* 1825 - * Set the fb pointer - usually drm_setup_crtcs does this for hotplug 1826 - * events, but at init time drm_setup_crtcs needs to be called before 1827 - * the fb is allocated (since we need to figure out the desired size of 1828 - * the fb before we can allocate it ...). Hence we need to fix things up 1829 - * here again. 1830 - */ 1831 - for (i = 0; i < fb_helper->crtc_count; i++) 1832 - if (fb_helper->crtc_info[i].mode_set.num_connectors) 1833 - fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; 1834 - 1835 1824 return 0; 1836 1825 } 1837 1826 ··· 1882 1893 info->var.xoffset = 0; 1883 1894 info->var.yoffset = 0; 1884 1895 info->var.activate = FB_ACTIVATE_NOW; 1885 - info->var.height = -1; 1886 - info->var.width = -1; 1887 1896 1888 1897 switch (fb->format->depth) { 1889 1898 case 8: ··· 2397 2410 struct drm_display_mode *mode = modes[i]; 2398 2411 struct drm_fb_helper_crtc *fb_crtc = crtcs[i]; 2399 2412 struct drm_fb_offset *offset = &offsets[i]; 2400 - struct drm_mode_set *modeset = &fb_crtc->mode_set; 2401 2413 2402 2414 if (mode && fb_crtc) { 2415 + struct drm_mode_set *modeset = &fb_crtc->mode_set; 2403 2416 struct drm_connector *connector = 2404 2417 fb_helper->connector_info[i]->connector; 2405 2418 ··· 2413 2426 fb_crtc->desired_mode); 2414 2427 drm_connector_get(connector); 2415 2428 modeset->connectors[modeset->num_connectors++] = connector; 2416 - modeset->fb = fb_helper->fb; 2417 2429 modeset->x = offset->x; 2418 2430 modeset->y = offset->y; 2419 2431 } ··· 2422 2436 kfree(modes); 2423 2437 kfree(offsets); 2424 2438 kfree(enabled); 2439 + } 2440 + 2441 + /* 2442 + * This is a continuation of drm_setup_crtcs() that sets up anything related 2443 + * to the framebuffer. During initialization, drm_setup_crtcs() is called before 2444 + * the framebuffer has been allocated (fb_helper->fb and fb_helper->fbdev). 2445 + * So, any setup that touches those fields needs to be done here instead of in 2446 + * drm_setup_crtcs(). 2447 + */ 2448 + static void drm_setup_crtcs_fb(struct drm_fb_helper *fb_helper) 2449 + { 2450 + struct fb_info *info = fb_helper->fbdev; 2451 + int i; 2452 + 2453 + for (i = 0; i < fb_helper->crtc_count; i++) 2454 + if (fb_helper->crtc_info[i].mode_set.num_connectors) 2455 + fb_helper->crtc_info[i].mode_set.fb = fb_helper->fb; 2456 + 2457 + mutex_lock(&fb_helper->dev->mode_config.mutex); 2458 + drm_fb_helper_for_each_connector(fb_helper, i) { 2459 + struct drm_connector *connector = 2460 + fb_helper->connector_info[i]->connector; 2461 + 2462 + /* use first connected connector for the physical dimensions */ 2463 + if (connector->status == connector_status_connected) { 2464 + info->var.width = connector->display_info.width_mm; 2465 + info->var.height = connector->display_info.height_mm; 2466 + break; 2467 + } 2468 + } 2469 + mutex_unlock(&fb_helper->dev->mode_config.mutex); 2425 2470 } 2426 2471 2427 2472 /* Note: Drops fb_helper->lock before returning. */ ··· 2480 2463 2481 2464 return ret; 2482 2465 } 2466 + drm_setup_crtcs_fb(fb_helper); 2483 2467 2484 2468 fb_helper->deferred_setup = false; 2485 2469 ··· 2609 2591 DRM_DEBUG_KMS("\n"); 2610 2592 2611 2593 drm_setup_crtcs(fb_helper, fb_helper->fb->width, fb_helper->fb->height); 2594 + drm_setup_crtcs_fb(fb_helper); 2612 2595 mutex_unlock(&fb_helper->lock); 2613 2596 2614 2597 drm_fb_helper_set_par(fb_helper->fbdev);
+35
drivers/gpu/drm/drm_gem.c
··· 311 311 EXPORT_SYMBOL(drm_gem_handle_delete); 312 312 313 313 /** 314 + * drm_gem_dumb_map_offset - return the fake mmap offset for a gem object 315 + * @file: drm file-private structure containing the gem object 316 + * @dev: corresponding drm_device 317 + * @handle: gem object handle 318 + * @offset: return location for the fake mmap offset 319 + * 320 + * This implements the &drm_driver.dumb_map_offset kms driver callback for 321 + * drivers which use gem to manage their backing storage. 322 + * 323 + * Returns: 324 + * 0 on success or a negative error code on failure. 325 + */ 326 + int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, 327 + u32 handle, u64 *offset) 328 + { 329 + struct drm_gem_object *obj; 330 + int ret; 331 + 332 + obj = drm_gem_object_lookup(file, handle); 333 + if (!obj) 334 + return -ENOENT; 335 + 336 + ret = drm_gem_create_mmap_offset(obj); 337 + if (ret) 338 + goto out; 339 + 340 + *offset = drm_vma_node_offset_addr(&obj->vma_node); 341 + out: 342 + drm_gem_object_put_unlocked(obj); 343 + 344 + return ret; 345 + } 346 + EXPORT_SYMBOL_GPL(drm_gem_dumb_map_offset); 347 + 348 + /** 314 349 * drm_gem_dumb_destroy - dumb fb callback helper for gem based drivers 315 350 * @file: drm file-private structure to remove the dumb handle from 316 351 * @dev: corresponding drm_device
+7
drivers/gpu/drm/drm_mode_config.c
··· 337 337 return -ENOMEM; 338 338 dev->mode_config.gamma_lut_size_property = prop; 339 339 340 + prop = drm_property_create(dev, 341 + DRM_MODE_PROP_IMMUTABLE | DRM_MODE_PROP_BLOB, 342 + "IN_FORMATS", 0); 343 + if (!prop) 344 + return -ENOMEM; 345 + dev->mode_config.modifiers_property = prop; 346 + 340 347 return 0; 341 348 } 342 349
+113 -46
drivers/gpu/drm/drm_mode_object.c
··· 233 233 { 234 234 int i; 235 235 236 + WARN_ON(drm_drv_uses_atomic_modeset(property->dev) && 237 + !(property->flags & DRM_MODE_PROP_IMMUTABLE)); 238 + 236 239 for (i = 0; i < obj->properties->count; i++) { 237 240 if (obj->properties->properties[i] == property) { 238 241 obj->properties->values[i] = val; ··· 247 244 } 248 245 EXPORT_SYMBOL(drm_object_property_set_value); 249 246 250 - /** 251 - * drm_object_property_get_value - retrieve the value of a property 252 - * @obj: drm mode object to get property value from 253 - * @property: property to retrieve 254 - * @val: storage for the property value 255 - * 256 - * This function retrieves the softare state of the given property for the given 257 - * property. Since there is no driver callback to retrieve the current property 258 - * value this might be out of sync with the hardware, depending upon the driver 259 - * and property. 260 - * 261 - * Atomic drivers should never call this function directly, the core will read 262 - * out property values through the various ->atomic_get_property callbacks. 263 - * 264 - * Returns: 265 - * Zero on success, error code on failure. 266 - */ 267 - int drm_object_property_get_value(struct drm_mode_object *obj, 247 + int __drm_object_property_get_value(struct drm_mode_object *obj, 268 248 struct drm_property *property, uint64_t *val) 269 249 { 270 250 int i; ··· 270 284 271 285 return -EINVAL; 272 286 } 287 + 288 + /** 289 + * drm_object_property_get_value - retrieve the value of a property 290 + * @obj: drm mode object to get property value from 291 + * @property: property to retrieve 292 + * @val: storage for the property value 293 + * 294 + * This function retrieves the softare state of the given property for the given 295 + * property. Since there is no driver callback to retrieve the current property 296 + * value this might be out of sync with the hardware, depending upon the driver 297 + * and property. 298 + * 299 + * Atomic drivers should never call this function directly, the core will read 300 + * out property values through the various ->atomic_get_property callbacks. 301 + * 302 + * Returns: 303 + * Zero on success, error code on failure. 304 + */ 305 + int drm_object_property_get_value(struct drm_mode_object *obj, 306 + struct drm_property *property, uint64_t *val) 307 + { 308 + WARN_ON(drm_drv_uses_atomic_modeset(property->dev)); 309 + 310 + return __drm_object_property_get_value(obj, property, val); 311 + } 273 312 EXPORT_SYMBOL(drm_object_property_get_value); 274 313 275 314 /* helper for getconnector and getproperties ioctls */ ··· 313 302 continue; 314 303 315 304 if (*arg_count_props > count) { 316 - ret = drm_object_property_get_value(obj, prop, &val); 305 + ret = __drm_object_property_get_value(obj, prop, &val); 317 306 if (ret) 318 307 return ret; 319 308 ··· 392 381 return NULL; 393 382 } 394 383 384 + static int set_property_legacy(struct drm_mode_object *obj, 385 + struct drm_property *prop, 386 + uint64_t prop_value) 387 + { 388 + struct drm_device *dev = prop->dev; 389 + struct drm_mode_object *ref; 390 + int ret = -EINVAL; 391 + 392 + if (!drm_property_change_valid_get(prop, prop_value, &ref)) 393 + return -EINVAL; 394 + 395 + drm_modeset_lock_all(dev); 396 + switch (obj->type) { 397 + case DRM_MODE_OBJECT_CONNECTOR: 398 + ret = drm_mode_connector_set_obj_prop(obj, prop, 399 + prop_value); 400 + break; 401 + case DRM_MODE_OBJECT_CRTC: 402 + ret = drm_mode_crtc_set_obj_prop(obj, prop, prop_value); 403 + break; 404 + case DRM_MODE_OBJECT_PLANE: 405 + ret = drm_mode_plane_set_obj_prop(obj_to_plane(obj), 406 + prop, prop_value); 407 + break; 408 + } 409 + drm_property_change_valid_put(prop, ref); 410 + drm_modeset_unlock_all(dev); 411 + 412 + return ret; 413 + } 414 + 415 + static int set_property_atomic(struct drm_mode_object *obj, 416 + struct drm_property *prop, 417 + uint64_t prop_value) 418 + { 419 + struct drm_device *dev = prop->dev; 420 + struct drm_atomic_state *state; 421 + struct drm_modeset_acquire_ctx ctx; 422 + int ret; 423 + 424 + drm_modeset_acquire_init(&ctx, 0); 425 + 426 + state = drm_atomic_state_alloc(dev); 427 + if (!state) 428 + return -ENOMEM; 429 + state->acquire_ctx = &ctx; 430 + retry: 431 + if (prop == state->dev->mode_config.dpms_property) { 432 + if (obj->type != DRM_MODE_OBJECT_CONNECTOR) { 433 + ret = -EINVAL; 434 + goto out; 435 + } 436 + 437 + ret = drm_atomic_connector_commit_dpms(state, 438 + obj_to_connector(obj), 439 + prop_value); 440 + } else { 441 + ret = drm_atomic_set_property(state, obj, prop, prop_value); 442 + if (ret) 443 + goto out; 444 + ret = drm_atomic_commit(state); 445 + } 446 + out: 447 + if (ret == -EDEADLK) { 448 + drm_atomic_state_clear(state); 449 + drm_modeset_backoff(&ctx); 450 + goto retry; 451 + } 452 + 453 + drm_atomic_state_put(state); 454 + 455 + drm_modeset_drop_locks(&ctx); 456 + drm_modeset_acquire_fini(&ctx); 457 + 458 + return ret; 459 + } 460 + 395 461 int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data, 396 462 struct drm_file *file_priv) 397 463 { ··· 476 388 struct drm_mode_object *arg_obj; 477 389 struct drm_property *property; 478 390 int ret = -EINVAL; 479 - struct drm_mode_object *ref; 480 391 481 392 if (!drm_core_check_feature(dev, DRIVER_MODESET)) 482 393 return -EINVAL; 483 394 484 - drm_modeset_lock_all(dev); 485 - 486 395 arg_obj = drm_mode_object_find(dev, arg->obj_id, arg->obj_type); 487 - if (!arg_obj) { 488 - ret = -ENOENT; 489 - goto out; 490 - } 396 + if (!arg_obj) 397 + return -ENOENT; 491 398 492 399 if (!arg_obj->properties) 493 400 goto out_unref; ··· 491 408 if (!property) 492 409 goto out_unref; 493 410 494 - if (!drm_property_change_valid_get(property, arg->value, &ref)) 495 - goto out_unref; 496 - 497 - switch (arg_obj->type) { 498 - case DRM_MODE_OBJECT_CONNECTOR: 499 - ret = drm_mode_connector_set_obj_prop(arg_obj, property, 500 - arg->value); 501 - break; 502 - case DRM_MODE_OBJECT_CRTC: 503 - ret = drm_mode_crtc_set_obj_prop(arg_obj, property, arg->value); 504 - break; 505 - case DRM_MODE_OBJECT_PLANE: 506 - ret = drm_mode_plane_set_obj_prop(obj_to_plane(arg_obj), 507 - property, arg->value); 508 - break; 509 - } 510 - 511 - drm_property_change_valid_put(property, ref); 411 + if (drm_drv_uses_atomic_modeset(property->dev)) 412 + ret = set_property_atomic(arg_obj, property, arg->value); 413 + else 414 + ret = set_property_legacy(arg_obj, property, arg->value); 512 415 513 416 out_unref: 514 417 drm_mode_object_put(arg_obj); 515 - out: 516 - drm_modeset_unlock_all(dev); 517 418 return ret; 518 419 }
+1 -1
drivers/gpu/drm/drm_modes.c
··· 1610 1610 * drm_mode_is_420_only - if a given videomode can be only supported in YCBCR420 1611 1611 * output format 1612 1612 * 1613 - * @connector: drm connector under action. 1613 + * @display: display under action 1614 1614 * @mode: video mode to be tested. 1615 1615 * 1616 1616 * Returns:
+1
drivers/gpu/drm/drm_modeset_helper.c
··· 124 124 &drm_primary_helper_funcs, 125 125 safe_modeset_formats, 126 126 ARRAY_SIZE(safe_modeset_formats), 127 + NULL, 127 128 DRM_PLANE_TYPE_PRIMARY, NULL); 128 129 if (ret) { 129 130 kfree(primary);
+119 -1
drivers/gpu/drm/drm_plane.c
··· 62 62 return num; 63 63 } 64 64 65 + static inline u32 * 66 + formats_ptr(struct drm_format_modifier_blob *blob) 67 + { 68 + return (u32 *)(((char *)blob) + blob->formats_offset); 69 + } 70 + 71 + static inline struct drm_format_modifier * 72 + modifiers_ptr(struct drm_format_modifier_blob *blob) 73 + { 74 + return (struct drm_format_modifier *)(((char *)blob) + blob->modifiers_offset); 75 + } 76 + 77 + static int create_in_format_blob(struct drm_device *dev, struct drm_plane *plane) 78 + { 79 + const struct drm_mode_config *config = &dev->mode_config; 80 + struct drm_property_blob *blob; 81 + struct drm_format_modifier *mod; 82 + size_t blob_size, formats_size, modifiers_size; 83 + struct drm_format_modifier_blob *blob_data; 84 + unsigned int i, j; 85 + 86 + formats_size = sizeof(__u32) * plane->format_count; 87 + if (WARN_ON(!formats_size)) { 88 + /* 0 formats are never expected */ 89 + return 0; 90 + } 91 + 92 + modifiers_size = 93 + sizeof(struct drm_format_modifier) * plane->modifier_count; 94 + 95 + blob_size = sizeof(struct drm_format_modifier_blob); 96 + /* Modifiers offset is a pointer to a struct with a 64 bit field so it 97 + * should be naturally aligned to 8B. 98 + */ 99 + BUILD_BUG_ON(sizeof(struct drm_format_modifier_blob) % 8); 100 + blob_size += ALIGN(formats_size, 8); 101 + blob_size += modifiers_size; 102 + 103 + blob = drm_property_create_blob(dev, blob_size, NULL); 104 + if (IS_ERR(blob)) 105 + return -1; 106 + 107 + blob_data = (struct drm_format_modifier_blob *)blob->data; 108 + blob_data->version = FORMAT_BLOB_CURRENT; 109 + blob_data->count_formats = plane->format_count; 110 + blob_data->formats_offset = sizeof(struct drm_format_modifier_blob); 111 + blob_data->count_modifiers = plane->modifier_count; 112 + 113 + blob_data->modifiers_offset = 114 + ALIGN(blob_data->formats_offset + formats_size, 8); 115 + 116 + memcpy(formats_ptr(blob_data), plane->format_types, formats_size); 117 + 118 + /* If we can't determine support, just bail */ 119 + if (!plane->funcs->format_mod_supported) 120 + goto done; 121 + 122 + mod = modifiers_ptr(blob_data); 123 + for (i = 0; i < plane->modifier_count; i++) { 124 + for (j = 0; j < plane->format_count; j++) { 125 + if (plane->funcs->format_mod_supported(plane, 126 + plane->format_types[j], 127 + plane->modifiers[i])) { 128 + 129 + mod->formats |= 1 << j; 130 + } 131 + } 132 + 133 + mod->modifier = plane->modifiers[i]; 134 + mod->offset = 0; 135 + mod->pad = 0; 136 + mod++; 137 + } 138 + 139 + done: 140 + drm_object_attach_property(&plane->base, config->modifiers_property, 141 + blob->base.id); 142 + 143 + return 0; 144 + } 145 + 65 146 /** 66 147 * drm_universal_plane_init - Initialize a new universal plane object 67 148 * @dev: DRM device ··· 151 70 * @funcs: callbacks for the new plane 152 71 * @formats: array of supported formats (DRM_FORMAT\_\*) 153 72 * @format_count: number of elements in @formats 73 + * @format_modifiers: array of struct drm_format modifiers terminated by 74 + * DRM_FORMAT_MOD_INVALID 154 75 * @type: type of plane (overlay, primary, cursor) 155 76 * @name: printf style format string for the plane name, or NULL for default name 156 77 * ··· 165 82 uint32_t possible_crtcs, 166 83 const struct drm_plane_funcs *funcs, 167 84 const uint32_t *formats, unsigned int format_count, 85 + const uint64_t *format_modifiers, 168 86 enum drm_plane_type type, 169 87 const char *name, ...) 170 88 { 171 89 struct drm_mode_config *config = &dev->mode_config; 90 + unsigned int format_modifier_count = 0; 172 91 int ret; 173 92 174 93 ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE); ··· 190 105 return -ENOMEM; 191 106 } 192 107 108 + /* 109 + * First driver to need more than 64 formats needs to fix this. Each 110 + * format is encoded as a bit and the current code only supports a u64. 111 + */ 112 + if (WARN_ON(format_count > 64)) 113 + return -EINVAL; 114 + 115 + if (format_modifiers) { 116 + const uint64_t *temp_modifiers = format_modifiers; 117 + while (*temp_modifiers++ != DRM_FORMAT_MOD_INVALID) 118 + format_modifier_count++; 119 + } 120 + 121 + plane->modifier_count = format_modifier_count; 122 + plane->modifiers = kmalloc_array(format_modifier_count, 123 + sizeof(format_modifiers[0]), 124 + GFP_KERNEL); 125 + 126 + if (format_modifier_count && !plane->modifiers) { 127 + DRM_DEBUG_KMS("out of memory when allocating plane\n"); 128 + kfree(plane->format_types); 129 + drm_mode_object_unregister(dev, &plane->base); 130 + return -ENOMEM; 131 + } 132 + 193 133 if (name) { 194 134 va_list ap; 195 135 ··· 227 117 } 228 118 if (!plane->name) { 229 119 kfree(plane->format_types); 120 + kfree(plane->modifiers); 230 121 drm_mode_object_unregister(dev, &plane->base); 231 122 return -ENOMEM; 232 123 } 233 124 234 125 memcpy(plane->format_types, formats, format_count * sizeof(uint32_t)); 235 126 plane->format_count = format_count; 127 + memcpy(plane->modifiers, format_modifiers, 128 + format_modifier_count * sizeof(format_modifiers[0])); 236 129 plane->possible_crtcs = possible_crtcs; 237 130 plane->type = type; 238 131 ··· 261 148 drm_object_attach_property(&plane->base, config->prop_src_w, 0); 262 149 drm_object_attach_property(&plane->base, config->prop_src_h, 0); 263 150 } 151 + 152 + if (config->allow_fb_modifiers) 153 + create_in_format_blob(dev, plane); 264 154 265 155 return 0; 266 156 } ··· 321 205 322 206 type = is_primary ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; 323 207 return drm_universal_plane_init(dev, plane, possible_crtcs, funcs, 324 - formats, format_count, type, NULL); 208 + formats, format_count, 209 + NULL, type, NULL); 325 210 } 326 211 EXPORT_SYMBOL(drm_plane_init); 327 212 ··· 341 224 drm_modeset_lock_fini(&plane->mutex); 342 225 343 226 kfree(plane->format_types); 227 + kfree(plane->modifiers); 344 228 drm_mode_object_unregister(dev, &plane->base); 345 229 346 230 BUG_ON(list_empty(&plane->head));
+19 -12
drivers/gpu/drm/drm_scdc_helper.c
··· 194 194 * @adapter: I2C adapter for DDC channel 195 195 * @set: ret or reset the high clock ratio 196 196 * 197 - * TMDS clock ratio calculations go like this: 198 - * TMDS character = 10 bit TMDS encoded value 199 - * TMDS character rate = The rate at which TMDS characters are transmitted(Mcsc) 200 - * TMDS bit rate = 10x TMDS character rate 201 - * As per the spec: 202 - * TMDS clock rate for pixel clock < 340 MHz = 1x the character rate 203 - * = 1/10 pixel clock rate 204 - * TMDS clock rate for pixel clock > 340 MHz = 0.25x the character rate 205 - * = 1/40 pixel clock rate 206 197 * 207 - * Writes to the TMDS config register over SCDC channel, and: 208 - * sets TMDS clock ratio to 1/40 when set = 1 209 - * sets TMDS clock ratio to 1/10 when set = 0 198 + * TMDS clock ratio calculations go like this: 199 + * TMDS character = 10 bit TMDS encoded value 200 + * 201 + * TMDS character rate = The rate at which TMDS characters are 202 + * transmitted (Mcsc) 203 + * 204 + * TMDS bit rate = 10x TMDS character rate 205 + * 206 + * As per the spec: 207 + * TMDS clock rate for pixel clock < 340 MHz = 1x the character 208 + * rate = 1/10 pixel clock rate 209 + * 210 + * TMDS clock rate for pixel clock > 340 MHz = 0.25x the character 211 + * rate = 1/40 pixel clock rate 212 + * 213 + * Writes to the TMDS config register over SCDC channel, and: 214 + * sets TMDS clock ratio to 1/40 when set = 1 215 + * 216 + * sets TMDS clock ratio to 1/10 when set = 0 210 217 * 211 218 * Returns: 212 219 * True if write is successful, false otherwise.
+3
drivers/gpu/drm/drm_simple_kms_helper.c
··· 199 199 * @funcs: callbacks for the display pipe (optional) 200 200 * @formats: array of supported formats (DRM_FORMAT\_\*) 201 201 * @format_count: number of elements in @formats 202 + * @format_modifiers: array of formats modifiers 202 203 * @connector: connector to attach and register (optional) 203 204 * 204 205 * Sets up a display pipeline which consist of a really simple ··· 220 219 struct drm_simple_display_pipe *pipe, 221 220 const struct drm_simple_display_pipe_funcs *funcs, 222 221 const uint32_t *formats, unsigned int format_count, 222 + const uint64_t *format_modifiers, 223 223 struct drm_connector *connector) 224 224 { 225 225 struct drm_encoder *encoder = &pipe->encoder; ··· 235 233 ret = drm_universal_plane_init(dev, plane, 0, 236 234 &drm_simple_kms_plane_funcs, 237 235 formats, format_count, 236 + format_modifiers, 238 237 DRM_PLANE_TYPE_PRIMARY, NULL); 239 238 if (ret) 240 239 return ret;
-1
drivers/gpu/drm/exynos/exynos_drm_dpi.c
··· 59 59 } 60 60 61 61 static const struct drm_connector_funcs exynos_dpi_connector_funcs = { 62 - .dpms = drm_atomic_helper_connector_dpms, 63 62 .detect = exynos_dpi_detect, 64 63 .fill_modes = drm_helper_probe_single_connector_modes, 65 64 .destroy = exynos_dpi_connector_destroy,
-1
drivers/gpu/drm/exynos/exynos_drm_dsi.c
··· 1537 1537 } 1538 1538 1539 1539 static const struct drm_connector_funcs exynos_dsi_connector_funcs = { 1540 - .dpms = drm_atomic_helper_connector_dpms, 1541 1540 .detect = exynos_dsi_detect, 1542 1541 .fill_modes = drm_helper_probe_single_connector_modes, 1543 1542 .destroy = exynos_dsi_connector_destroy,
+1 -2
drivers/gpu/drm/exynos/exynos_drm_plane.c
··· 173 173 .update_plane = drm_atomic_helper_update_plane, 174 174 .disable_plane = drm_atomic_helper_disable_plane, 175 175 .destroy = drm_plane_cleanup, 176 - .set_property = drm_atomic_helper_plane_set_property, 177 176 .reset = exynos_drm_plane_reset, 178 177 .atomic_duplicate_state = exynos_drm_plane_duplicate_state, 179 178 .atomic_destroy_state = exynos_drm_plane_destroy_state, ··· 282 283 &exynos_plane_funcs, 283 284 config->pixel_formats, 284 285 config->num_pixel_formats, 285 - config->type, NULL); 286 + NULL, config->type, NULL); 286 287 if (err) { 287 288 DRM_ERROR("failed to initialize plane\n"); 288 289 return err;
-1
drivers/gpu/drm/exynos/exynos_drm_vidi.c
··· 289 289 } 290 290 291 291 static const struct drm_connector_funcs vidi_connector_funcs = { 292 - .dpms = drm_atomic_helper_connector_dpms, 293 292 .fill_modes = drm_helper_probe_single_connector_modes, 294 293 .detect = vidi_detect, 295 294 .destroy = vidi_connector_destroy,
-1
drivers/gpu/drm/exynos/exynos_hdmi.c
··· 835 835 } 836 836 837 837 static const struct drm_connector_funcs hdmi_connector_funcs = { 838 - .dpms = drm_atomic_helper_connector_dpms, 839 838 .fill_modes = drm_helper_probe_single_connector_modes, 840 839 .detect = hdmi_detect, 841 840 .destroy = hdmi_connector_destroy,
-2
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
··· 176 176 .gem_prime_vunmap = drm_gem_cma_prime_vunmap, 177 177 .gem_prime_mmap = drm_gem_cma_prime_mmap, 178 178 .dumb_create = drm_gem_cma_dumb_create, 179 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 180 - .dumb_destroy = drm_gem_dumb_destroy, 181 179 .fops = &fsl_dcu_drm_fops, 182 180 .name = "fsl-dcu-drm", 183 181 .desc = "Freescale DCU DRM",
+1 -1
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_plane.c
··· 224 224 &fsl_dcu_drm_plane_funcs, 225 225 fsl_dcu_drm_plane_formats, 226 226 ARRAY_SIZE(fsl_dcu_drm_plane_formats), 227 - DRM_PLANE_TYPE_PRIMARY, NULL); 227 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 228 228 if (ret) { 229 229 kfree(primary); 230 230 primary = NULL;
-1
drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_rgb.c
··· 63 63 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 64 64 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 65 65 .destroy = fsl_dcu_drm_connector_destroy, 66 - .dpms = drm_atomic_helper_connector_dpms, 67 66 .fill_modes = drm_helper_probe_single_connector_modes, 68 67 .reset = drm_atomic_helper_connector_reset, 69 68 };
-22
drivers/gpu/drm/gma500/framebuffer.c
··· 479 479 return psb_framebuffer_create(dev, cmd, r); 480 480 } 481 481 482 - static void psbfb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 483 - u16 blue, int regno) 484 - { 485 - struct gma_crtc *gma_crtc = to_gma_crtc(crtc); 486 - 487 - gma_crtc->lut_r[regno] = red >> 8; 488 - gma_crtc->lut_g[regno] = green >> 8; 489 - gma_crtc->lut_b[regno] = blue >> 8; 490 - } 491 - 492 - static void psbfb_gamma_get(struct drm_crtc *crtc, u16 *red, 493 - u16 *green, u16 *blue, int regno) 494 - { 495 - struct gma_crtc *gma_crtc = to_gma_crtc(crtc); 496 - 497 - *red = gma_crtc->lut_r[regno] << 8; 498 - *green = gma_crtc->lut_g[regno] << 8; 499 - *blue = gma_crtc->lut_b[regno] << 8; 500 - } 501 - 502 482 static int psbfb_probe(struct drm_fb_helper *helper, 503 483 struct drm_fb_helper_surface_size *sizes) 504 484 { ··· 505 525 } 506 526 507 527 static const struct drm_fb_helper_funcs psb_fb_helper_funcs = { 508 - .gamma_set = psbfb_gamma_set, 509 - .gamma_get = psbfb_gamma_get, 510 528 .fb_probe = psbfb_probe, 511 529 }; 512 530
+11 -21
drivers/gpu/drm/gma500/gma_display.c
··· 144 144 struct gma_crtc *gma_crtc = to_gma_crtc(crtc); 145 145 const struct psb_offset *map = &dev_priv->regmap[gma_crtc->pipe]; 146 146 int palreg = map->palette; 147 + u16 *r, *g, *b; 147 148 int i; 148 149 149 150 /* The clocks have to be on to load the palette. */ 150 151 if (!crtc->enabled) 151 152 return; 152 153 154 + r = crtc->gamma_store; 155 + g = r + crtc->gamma_size; 156 + b = g + crtc->gamma_size; 157 + 153 158 if (gma_power_begin(dev, false)) { 154 159 for (i = 0; i < 256; i++) { 155 160 REG_WRITE(palreg + 4 * i, 156 - ((gma_crtc->lut_r[i] + 157 - gma_crtc->lut_adj[i]) << 16) | 158 - ((gma_crtc->lut_g[i] + 159 - gma_crtc->lut_adj[i]) << 8) | 160 - (gma_crtc->lut_b[i] + 161 - gma_crtc->lut_adj[i])); 161 + (((*r++ >> 8) + gma_crtc->lut_adj[i]) << 16) | 162 + (((*g++ >> 8) + gma_crtc->lut_adj[i]) << 8) | 163 + ((*b++ >> 8) + gma_crtc->lut_adj[i])); 162 164 } 163 165 gma_power_end(dev); 164 166 } else { 165 167 for (i = 0; i < 256; i++) { 166 168 /* FIXME: Why pipe[0] and not pipe[..._crtc->pipe]? */ 167 169 dev_priv->regs.pipe[0].palette[i] = 168 - ((gma_crtc->lut_r[i] + 169 - gma_crtc->lut_adj[i]) << 16) | 170 - ((gma_crtc->lut_g[i] + 171 - gma_crtc->lut_adj[i]) << 8) | 172 - (gma_crtc->lut_b[i] + 173 - gma_crtc->lut_adj[i]); 170 + (((*r++ >> 8) + gma_crtc->lut_adj[i]) << 16) | 171 + (((*g++ >> 8) + gma_crtc->lut_adj[i]) << 8) | 172 + ((*b++ >> 8) + gma_crtc->lut_adj[i]); 174 173 } 175 174 176 175 } ··· 179 180 u32 size, 180 181 struct drm_modeset_acquire_ctx *ctx) 181 182 { 182 - struct gma_crtc *gma_crtc = to_gma_crtc(crtc); 183 - int i; 184 - 185 - for (i = 0; i < size; i++) { 186 - gma_crtc->lut_r[i] = red[i] >> 8; 187 - gma_crtc->lut_g[i] = green[i] >> 8; 188 - gma_crtc->lut_b[i] = blue[i] >> 8; 189 - } 190 - 191 183 gma_crtc_load_lut(crtc); 192 184 193 185 return 0;
+1 -6
drivers/gpu/drm/gma500/psb_intel_display.c
··· 518 518 gma_crtc->pipe = pipe; 519 519 gma_crtc->plane = pipe; 520 520 521 - for (i = 0; i < 256; i++) { 522 - gma_crtc->lut_r[i] = i; 523 - gma_crtc->lut_g[i] = i; 524 - gma_crtc->lut_b[i] = i; 525 - 521 + for (i = 0; i < 256; i++) 526 522 gma_crtc->lut_adj[i] = 0; 527 - } 528 523 529 524 gma_crtc->mode_dev = mode_dev; 530 525 gma_crtc->cursor_addr = 0;
-1
drivers/gpu/drm/gma500/psb_intel_drv.h
··· 172 172 int plane; 173 173 uint32_t cursor_addr; 174 174 struct gtt_range *cursor_gt; 175 - u8 lut_r[256], lut_g[256], lut_b[256]; 176 175 u8 lut_adj[256]; 177 176 struct psb_intel_framebuffer *fbdev_fb; 178 177 /* a mode_set for fbdev users on this crtc */
+1 -1
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_de.c
··· 150 150 static struct drm_plane_funcs hibmc_plane_funcs = { 151 151 .update_plane = drm_atomic_helper_update_plane, 152 152 .disable_plane = drm_atomic_helper_disable_plane, 153 - .set_property = drm_atomic_helper_plane_set_property, 154 153 .destroy = drm_plane_cleanup, 155 154 .reset = drm_atomic_helper_plane_reset, 156 155 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, ··· 180 181 ret = drm_universal_plane_init(dev, plane, 1, &hibmc_plane_funcs, 181 182 channel_formats1, 182 183 ARRAY_SIZE(channel_formats1), 184 + NULL, 183 185 DRM_PLANE_TYPE_PRIMARY, 184 186 NULL); 185 187 if (ret) {
-1
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
··· 67 67 .gem_free_object_unlocked = hibmc_gem_free_object, 68 68 .dumb_create = hibmc_dumb_create, 69 69 .dumb_map_offset = hibmc_dumb_mmap_offset, 70 - .dumb_destroy = drm_gem_dumb_destroy, 71 70 .irq_handler = hibmc_drm_interrupt, 72 71 }; 73 72
-1
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_vdac.c
··· 47 47 }; 48 48 49 49 static const struct drm_connector_funcs hibmc_connector_funcs = { 50 - .dpms = drm_atomic_helper_connector_dpms, 51 50 .fill_modes = drm_helper_probe_single_connector_modes, 52 51 .destroy = drm_connector_cleanup, 53 52 .reset = drm_atomic_helper_connector_reset,
+1 -3
drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
··· 567 567 .set_config = drm_atomic_helper_set_config, 568 568 .page_flip = drm_atomic_helper_page_flip, 569 569 .reset = drm_atomic_helper_crtc_reset, 570 - .set_property = drm_atomic_helper_crtc_set_property, 571 570 .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, 572 571 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, 573 572 .enable_vblank = ade_crtc_enable_vblank, ··· 889 890 static struct drm_plane_funcs ade_plane_funcs = { 890 891 .update_plane = drm_atomic_helper_update_plane, 891 892 .disable_plane = drm_atomic_helper_disable_plane, 892 - .set_property = drm_atomic_helper_plane_set_property, 893 893 .destroy = drm_plane_cleanup, 894 894 .reset = drm_atomic_helper_plane_reset, 895 895 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, ··· 908 910 return ret; 909 911 910 912 ret = drm_universal_plane_init(dev, &aplane->base, 1, &ade_plane_funcs, 911 - fmts, fmts_cnt, type, NULL); 913 + fmts, fmts_cnt, NULL, type, NULL); 912 914 if (ret) { 913 915 DRM_ERROR("fail to init plane, ch=%d\n", aplane->ch); 914 916 return ret;
+1 -9
drivers/gpu/drm/i2c/tda998x_drv.c
··· 969 969 970 970 /* DRM connector functions */ 971 971 972 - static int tda998x_connector_dpms(struct drm_connector *connector, int mode) 973 - { 974 - if (drm_core_check_feature(connector->dev, DRIVER_ATOMIC)) 975 - return drm_atomic_helper_connector_dpms(connector, mode); 976 - else 977 - return drm_helper_connector_dpms(connector, mode); 978 - } 979 - 980 972 static int tda998x_connector_fill_modes(struct drm_connector *connector, 981 973 uint32_t maxX, uint32_t maxY) 982 974 { ··· 1006 1014 } 1007 1015 1008 1016 static const struct drm_connector_funcs tda998x_connector_funcs = { 1009 - .dpms = tda998x_connector_dpms, 1017 + .dpms = drm_helper_connector_dpms, 1010 1018 .reset = drm_atomic_helper_connector_reset, 1011 1019 .fill_modes = tda998x_connector_fill_modes, 1012 1020 .detect = tda998x_connector_detect,
-1
drivers/gpu/drm/i915/i915_drv.c
··· 2755 2755 2756 2756 .dumb_create = i915_gem_dumb_create, 2757 2757 .dumb_map_offset = i915_gem_mmap_gtt, 2758 - .dumb_destroy = drm_gem_dumb_destroy, 2759 2758 .ioctls = i915_ioctls, 2760 2759 .num_ioctls = ARRAY_SIZE(i915_ioctls), 2761 2760 .fops = &i915_driver_fops,
-2
drivers/gpu/drm/i915/intel_crt.c
··· 802 802 */ 803 803 804 804 static const struct drm_connector_funcs intel_crt_connector_funcs = { 805 - .dpms = drm_atomic_helper_connector_dpms, 806 805 .fill_modes = drm_helper_probe_single_connector_modes, 807 806 .late_register = intel_connector_register, 808 807 .early_unregister = intel_connector_unregister, 809 808 .destroy = intel_crt_destroy, 810 - .set_property = drm_atomic_helper_connector_set_property, 811 809 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 812 810 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 813 811 };
+4 -4
drivers/gpu/drm/i915/intel_display.c
··· 13323 13323 static const struct drm_crtc_funcs intel_crtc_funcs = { 13324 13324 .gamma_set = drm_atomic_helper_legacy_gamma_set, 13325 13325 .set_config = drm_atomic_helper_set_config, 13326 - .set_property = drm_atomic_helper_crtc_set_property, 13327 13326 .destroy = intel_crtc_destroy, 13328 13327 .page_flip = drm_atomic_helper_page_flip, 13329 13328 .atomic_duplicate_state = intel_crtc_duplicate_state, ··· 13599 13600 .update_plane = drm_atomic_helper_update_plane, 13600 13601 .disable_plane = drm_atomic_helper_disable_plane, 13601 13602 .destroy = intel_plane_destroy, 13602 - .set_property = drm_atomic_helper_plane_set_property, 13603 13603 .atomic_get_property = intel_plane_atomic_get_property, 13604 13604 .atomic_set_property = intel_plane_atomic_set_property, 13605 13605 .atomic_duplicate_state = intel_plane_duplicate_state, ··· 13733 13735 .update_plane = intel_legacy_cursor_update, 13734 13736 .disable_plane = drm_atomic_helper_disable_plane, 13735 13737 .destroy = intel_plane_destroy, 13736 - .set_property = drm_atomic_helper_plane_set_property, 13737 13738 .atomic_get_property = intel_plane_atomic_get_property, 13738 13739 .atomic_set_property = intel_plane_atomic_set_property, 13739 13740 .atomic_duplicate_state = intel_plane_duplicate_state, ··· 13806 13809 ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 13807 13810 0, &intel_plane_funcs, 13808 13811 intel_primary_formats, num_formats, 13812 + NULL, 13809 13813 DRM_PLANE_TYPE_PRIMARY, 13810 13814 "plane 1%c", pipe_name(pipe)); 13811 13815 else if (INTEL_GEN(dev_priv) >= 5 || IS_G4X(dev_priv)) 13812 13816 ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 13813 13817 0, &intel_plane_funcs, 13814 13818 intel_primary_formats, num_formats, 13819 + NULL, 13815 13820 DRM_PLANE_TYPE_PRIMARY, 13816 13821 "primary %c", pipe_name(pipe)); 13817 13822 else 13818 13823 ret = drm_universal_plane_init(&dev_priv->drm, &primary->base, 13819 13824 0, &intel_plane_funcs, 13820 13825 intel_primary_formats, num_formats, 13826 + NULL, 13821 13827 DRM_PLANE_TYPE_PRIMARY, 13822 13828 "plane %c", plane_name(primary->plane)); 13823 13829 if (ret) ··· 13906 13906 0, &intel_cursor_plane_funcs, 13907 13907 intel_cursor_formats, 13908 13908 ARRAY_SIZE(intel_cursor_formats), 13909 - DRM_PLANE_TYPE_CURSOR, 13909 + NULL, DRM_PLANE_TYPE_CURSOR, 13910 13910 "cursor %c", pipe_name(pipe)); 13911 13911 if (ret) 13912 13912 goto fail;
-2
drivers/gpu/drm/i915/intel_dp.c
··· 5007 5007 } 5008 5008 5009 5009 static const struct drm_connector_funcs intel_dp_connector_funcs = { 5010 - .dpms = drm_atomic_helper_connector_dpms, 5011 5010 .force = intel_dp_force, 5012 5011 .fill_modes = drm_helper_probe_single_connector_modes, 5013 - .set_property = drm_atomic_helper_connector_set_property, 5014 5012 .atomic_get_property = intel_digital_connector_atomic_get_property, 5015 5013 .atomic_set_property = intel_digital_connector_atomic_set_property, 5016 5014 .late_register = intel_dp_connector_register,
-2
drivers/gpu/drm/i915/intel_dp_mst.c
··· 346 346 } 347 347 348 348 static const struct drm_connector_funcs intel_dp_mst_connector_funcs = { 349 - .dpms = drm_atomic_helper_connector_dpms, 350 349 .detect = intel_dp_mst_detect, 351 350 .fill_modes = drm_helper_probe_single_connector_modes, 352 - .set_property = drm_atomic_helper_connector_set_property, 353 351 .late_register = intel_connector_register, 354 352 .early_unregister = intel_connector_unregister, 355 353 .destroy = intel_dp_mst_connector_destroy,
-1
drivers/gpu/drm/i915/intel_drv.h
··· 786 786 struct drm_crtc base; 787 787 enum pipe pipe; 788 788 enum plane plane; 789 - u8 lut_r[256], lut_g[256], lut_b[256]; 790 789 /* 791 790 * Whether the crtc and the connected output pipeline is active. Implies 792 791 * that crtc->enabled is set, i.e. the current mode configuration has
-2
drivers/gpu/drm/i915/intel_dsi.c
··· 1653 1653 }; 1654 1654 1655 1655 static const struct drm_connector_funcs intel_dsi_connector_funcs = { 1656 - .dpms = drm_atomic_helper_connector_dpms, 1657 1656 .late_register = intel_connector_register, 1658 1657 .early_unregister = intel_connector_unregister, 1659 1658 .destroy = intel_dsi_connector_destroy, 1660 1659 .fill_modes = drm_helper_probe_single_connector_modes, 1661 - .set_property = drm_atomic_helper_connector_set_property, 1662 1660 .atomic_get_property = intel_digital_connector_atomic_get_property, 1663 1661 .atomic_set_property = intel_digital_connector_atomic_set_property, 1664 1662 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-2
drivers/gpu/drm/i915/intel_dvo.c
··· 344 344 } 345 345 346 346 static const struct drm_connector_funcs intel_dvo_connector_funcs = { 347 - .dpms = drm_atomic_helper_connector_dpms, 348 347 .detect = intel_dvo_detect, 349 348 .late_register = intel_connector_register, 350 349 .early_unregister = intel_connector_unregister, 351 350 .destroy = intel_dvo_destroy, 352 351 .fill_modes = drm_helper_probe_single_connector_modes, 353 - .set_property = drm_atomic_helper_connector_set_property, 354 352 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 355 353 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 356 354 };
-31
drivers/gpu/drm/i915/intel_fbdev.c
··· 280 280 return ret; 281 281 } 282 282 283 - /** Sets the color ramps on behalf of RandR */ 284 - static void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 285 - u16 blue, int regno) 286 - { 287 - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 288 - 289 - intel_crtc->lut_r[regno] = red >> 8; 290 - intel_crtc->lut_g[regno] = green >> 8; 291 - intel_crtc->lut_b[regno] = blue >> 8; 292 - } 293 - 294 - static void intel_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 295 - u16 *blue, int regno) 296 - { 297 - struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 298 - 299 - *red = intel_crtc->lut_r[regno] << 8; 300 - *green = intel_crtc->lut_g[regno] << 8; 301 - *blue = intel_crtc->lut_b[regno] << 8; 302 - } 303 - 304 283 static struct drm_fb_helper_crtc * 305 284 intel_fb_helper_crtc(struct drm_fb_helper *fb_helper, struct drm_crtc *crtc) 306 285 { ··· 354 375 struct drm_connector *connector; 355 376 struct drm_encoder *encoder; 356 377 struct drm_fb_helper_crtc *new_crtc; 357 - struct intel_crtc *intel_crtc; 358 378 359 379 fb_conn = fb_helper->connector_info[i]; 360 380 connector = fb_conn->connector; ··· 394 416 } 395 417 396 418 num_connectors_enabled++; 397 - 398 - intel_crtc = to_intel_crtc(connector->state->crtc); 399 - for (j = 0; j < 256; j++) { 400 - intel_crtc->lut_r[j] = j; 401 - intel_crtc->lut_g[j] = j; 402 - intel_crtc->lut_b[j] = j; 403 - } 404 419 405 420 new_crtc = intel_fb_helper_crtc(fb_helper, 406 421 connector->state->crtc); ··· 497 526 498 527 static const struct drm_fb_helper_funcs intel_fb_helper_funcs = { 499 528 .initial_config = intel_fb_initial_config, 500 - .gamma_set = intel_crtc_fb_gamma_set, 501 - .gamma_get = intel_crtc_fb_gamma_get, 502 529 .fb_probe = intelfb_create, 503 530 }; 504 531
-2
drivers/gpu/drm/i915/intel_hdmi.c
··· 1706 1706 } 1707 1707 1708 1708 static const struct drm_connector_funcs intel_hdmi_connector_funcs = { 1709 - .dpms = drm_atomic_helper_connector_dpms, 1710 1709 .detect = intel_hdmi_detect, 1711 1710 .force = intel_hdmi_force, 1712 1711 .fill_modes = drm_helper_probe_single_connector_modes, 1713 - .set_property = drm_atomic_helper_connector_set_property, 1714 1712 .atomic_get_property = intel_digital_connector_atomic_get_property, 1715 1713 .atomic_set_property = intel_digital_connector_atomic_set_property, 1716 1714 .late_register = intel_connector_register,
-2
drivers/gpu/drm/i915/intel_lvds.c
··· 595 595 }; 596 596 597 597 static const struct drm_connector_funcs intel_lvds_connector_funcs = { 598 - .dpms = drm_atomic_helper_connector_dpms, 599 598 .detect = intel_lvds_detect, 600 599 .fill_modes = drm_helper_probe_single_connector_modes, 601 - .set_property = drm_atomic_helper_connector_set_property, 602 600 .atomic_get_property = intel_digital_connector_atomic_get_property, 603 601 .atomic_set_property = intel_digital_connector_atomic_set_property, 604 602 .late_register = intel_connector_register,
-2
drivers/gpu/drm/i915/intel_sdvo.c
··· 2193 2193 } 2194 2194 2195 2195 static const struct drm_connector_funcs intel_sdvo_connector_funcs = { 2196 - .dpms = drm_atomic_helper_connector_dpms, 2197 2196 .detect = intel_sdvo_detect, 2198 2197 .fill_modes = drm_helper_probe_single_connector_modes, 2199 - .set_property = drm_atomic_helper_connector_set_property, 2200 2198 .atomic_get_property = intel_sdvo_connector_atomic_get_property, 2201 2199 .atomic_set_property = intel_sdvo_connector_atomic_set_property, 2202 2200 .late_register = intel_sdvo_connector_register,
+2 -2
drivers/gpu/drm/i915/intel_sprite.c
··· 1171 1171 ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, 1172 1172 possible_crtcs, &intel_plane_funcs, 1173 1173 plane_formats, num_plane_formats, 1174 - DRM_PLANE_TYPE_OVERLAY, 1174 + NULL, DRM_PLANE_TYPE_OVERLAY, 1175 1175 "plane %d%c", plane + 2, pipe_name(pipe)); 1176 1176 else 1177 1177 ret = drm_universal_plane_init(&dev_priv->drm, &intel_plane->base, 1178 1178 possible_crtcs, &intel_plane_funcs, 1179 1179 plane_formats, num_plane_formats, 1180 - DRM_PLANE_TYPE_OVERLAY, 1180 + NULL, DRM_PLANE_TYPE_OVERLAY, 1181 1181 "sprite %c", sprite_name(pipe, plane)); 1182 1182 if (ret) 1183 1183 goto fail;
-2
drivers/gpu/drm/i915/intel_tv.c
··· 1407 1407 } 1408 1408 1409 1409 static const struct drm_connector_funcs intel_tv_connector_funcs = { 1410 - .dpms = drm_atomic_helper_connector_dpms, 1411 1410 .late_register = intel_connector_register, 1412 1411 .early_unregister = intel_connector_unregister, 1413 1412 .destroy = intel_tv_destroy, 1414 - .set_property = drm_atomic_helper_connector_set_property, 1415 1413 .fill_modes = drm_helper_probe_single_connector_modes, 1416 1414 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, 1417 1415 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-2
drivers/gpu/drm/imx/imx-drm-core.c
··· 182 182 .gem_free_object_unlocked = drm_gem_cma_free_object, 183 183 .gem_vm_ops = &drm_gem_cma_vm_ops, 184 184 .dumb_create = drm_gem_cma_dumb_create, 185 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 186 - .dumb_destroy = drm_gem_dumb_destroy, 187 185 188 186 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 189 187 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-1
drivers/gpu/drm/imx/imx-ldb.c
··· 389 389 390 390 391 391 static const struct drm_connector_funcs imx_ldb_connector_funcs = { 392 - .dpms = drm_atomic_helper_connector_dpms, 393 392 .fill_modes = drm_helper_probe_single_connector_modes, 394 393 .destroy = imx_drm_connector_destroy, 395 394 .reset = drm_atomic_helper_connector_reset,
-1
drivers/gpu/drm/imx/imx-tve.c
··· 341 341 } 342 342 343 343 static const struct drm_connector_funcs imx_tve_connector_funcs = { 344 - .dpms = drm_atomic_helper_connector_dpms, 345 344 .fill_modes = drm_helper_probe_single_connector_modes, 346 345 .destroy = imx_drm_connector_destroy, 347 346 .reset = drm_atomic_helper_connector_reset,
+2 -2
drivers/gpu/drm/imx/ipuv3-plane.c
··· 718 718 719 719 ret = drm_universal_plane_init(dev, &ipu_plane->base, possible_crtcs, 720 720 &ipu_plane_funcs, ipu_plane_formats, 721 - ARRAY_SIZE(ipu_plane_formats), type, 722 - NULL); 721 + ARRAY_SIZE(ipu_plane_formats), 722 + NULL, type, NULL); 723 723 if (ret) { 724 724 DRM_ERROR("failed to initialize plane\n"); 725 725 kfree(ipu_plane);
-1
drivers/gpu/drm/imx/parallel-display.c
··· 135 135 } 136 136 137 137 static const struct drm_connector_funcs imx_pd_connector_funcs = { 138 - .dpms = drm_atomic_helper_connector_dpms, 139 138 .fill_modes = drm_helper_probe_single_connector_modes, 140 139 .destroy = imx_drm_connector_destroy, 141 140 .reset = drm_atomic_helper_connector_reset,
-2
drivers/gpu/drm/mediatek/mtk_drm_drv.c
··· 293 293 .gem_free_object_unlocked = mtk_drm_gem_free_object, 294 294 .gem_vm_ops = &drm_gem_cma_vm_ops, 295 295 .dumb_create = mtk_drm_gem_dumb_create, 296 - .dumb_map_offset = mtk_drm_gem_dumb_map_offset, 297 - .dumb_destroy = drm_gem_dumb_destroy, 298 296 299 297 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 300 298 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-25
drivers/gpu/drm/mediatek/mtk_drm_gem.c
··· 131 131 return ret; 132 132 } 133 133 134 - int mtk_drm_gem_dumb_map_offset(struct drm_file *file_priv, 135 - struct drm_device *dev, uint32_t handle, 136 - uint64_t *offset) 137 - { 138 - struct drm_gem_object *obj; 139 - int ret; 140 - 141 - obj = drm_gem_object_lookup(file_priv, handle); 142 - if (!obj) { 143 - DRM_ERROR("failed to lookup gem object.\n"); 144 - return -EINVAL; 145 - } 146 - 147 - ret = drm_gem_create_mmap_offset(obj); 148 - if (ret) 149 - goto out; 150 - 151 - *offset = drm_vma_node_offset_addr(&obj->vma_node); 152 - DRM_DEBUG_KMS("offset = 0x%llx\n", *offset); 153 - 154 - out: 155 - drm_gem_object_unreference_unlocked(obj); 156 - return ret; 157 - } 158 - 159 134 static int mtk_drm_gem_object_mmap(struct drm_gem_object *obj, 160 135 struct vm_area_struct *vma) 161 136
-3
drivers/gpu/drm/mediatek/mtk_drm_gem.h
··· 46 46 bool alloc_kmap); 47 47 int mtk_drm_gem_dumb_create(struct drm_file *file_priv, struct drm_device *dev, 48 48 struct drm_mode_create_dumb *args); 49 - int mtk_drm_gem_dumb_map_offset(struct drm_file *file_priv, 50 - struct drm_device *dev, uint32_t handle, 51 - uint64_t *offset); 52 49 int mtk_drm_gem_mmap(struct file *filp, struct vm_area_struct *vma); 53 50 int mtk_drm_gem_mmap_buf(struct drm_gem_object *obj, 54 51 struct vm_area_struct *vma);
+1 -1
drivers/gpu/drm/mediatek/mtk_drm_plane.c
··· 175 175 176 176 err = drm_universal_plane_init(dev, plane, possible_crtcs, 177 177 &mtk_plane_funcs, formats, 178 - ARRAY_SIZE(formats), type, NULL); 178 + ARRAY_SIZE(formats), NULL, type, NULL); 179 179 if (err) { 180 180 DRM_ERROR("failed to initialize plane\n"); 181 181 return err;
-1
drivers/gpu/drm/mediatek/mtk_dsi.c
··· 766 766 }; 767 767 768 768 static const struct drm_connector_funcs mtk_dsi_connector_funcs = { 769 - .dpms = drm_atomic_helper_connector_dpms, 770 769 .fill_modes = drm_helper_probe_single_connector_modes, 771 770 .destroy = drm_connector_cleanup, 772 771 .reset = drm_atomic_helper_connector_reset,
-1
drivers/gpu/drm/mediatek/mtk_hdmi.c
··· 1261 1261 } 1262 1262 1263 1263 static const struct drm_connector_funcs mtk_hdmi_connector_funcs = { 1264 - .dpms = drm_atomic_helper_connector_dpms, 1265 1264 .detect = hdmi_conn_detect, 1266 1265 .fill_modes = drm_helper_probe_single_connector_modes, 1267 1266 .destroy = hdmi_conn_destroy,
+1
drivers/gpu/drm/meson/meson_plane.c
··· 223 223 &meson_plane_funcs, 224 224 supported_drm_formats, 225 225 ARRAY_SIZE(supported_drm_formats), 226 + NULL, 226 227 DRM_PLANE_TYPE_PRIMARY, "meson_primary_plane"); 227 228 228 229 drm_plane_helper_add(plane, &meson_plane_helper_funcs);
-1
drivers/gpu/drm/meson/meson_venc_cvbs.c
··· 118 118 } 119 119 120 120 static const struct drm_connector_funcs meson_cvbs_connector_funcs = { 121 - .dpms = drm_atomic_helper_connector_dpms, 122 121 .detect = meson_cvbs_connector_detect, 123 122 .fill_modes = drm_helper_probe_single_connector_modes, 124 123 .destroy = meson_cvbs_connector_destroy,
-5
drivers/gpu/drm/mgag200/mgag200_drv.h
··· 237 237 { 238 238 return container_of(bo, struct mgag200_bo, bo); 239 239 } 240 - /* mgag200_crtc.c */ 241 - void mga_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 242 - u16 blue, int regno); 243 - void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 244 - u16 *blue, int regno); 245 240 246 241 /* mgag200_mode.c */ 247 242 int mgag200_modeset_init(struct mga_device *mdev);
-2
drivers/gpu/drm/mgag200/mgag200_fb.c
··· 257 257 } 258 258 259 259 static const struct drm_fb_helper_funcs mga_fb_helper_funcs = { 260 - .gamma_set = mga_crtc_fb_gamma_set, 261 - .gamma_get = mga_crtc_fb_gamma_get, 262 260 .fb_probe = mgag200fb_create, 263 261 }; 264 262
+15 -47
drivers/gpu/drm/mgag200/mgag200_mode.c
··· 27 27 28 28 static void mga_crtc_load_lut(struct drm_crtc *crtc) 29 29 { 30 - struct mga_crtc *mga_crtc = to_mga_crtc(crtc); 31 30 struct drm_device *dev = crtc->dev; 32 31 struct mga_device *mdev = dev->dev_private; 33 32 struct drm_framebuffer *fb = crtc->primary->fb; 33 + u16 *r_ptr, *g_ptr, *b_ptr; 34 34 int i; 35 35 36 36 if (!crtc->enabled) 37 37 return; 38 + 39 + r_ptr = crtc->gamma_store; 40 + g_ptr = r_ptr + crtc->gamma_size; 41 + b_ptr = g_ptr + crtc->gamma_size; 38 42 39 43 WREG8(DAC_INDEX + MGA1064_INDEX, 0); 40 44 ··· 50 46 if (i > (MGAG200_LUT_SIZE >> 1)) { 51 47 r = b = 0; 52 48 } else { 53 - r = mga_crtc->lut_r[i << 1]; 54 - b = mga_crtc->lut_b[i << 1]; 49 + r = *r_ptr++ >> 8; 50 + b = *b_ptr++ >> 8; 51 + r_ptr++; 52 + b_ptr++; 55 53 } 56 54 } else { 57 - r = mga_crtc->lut_r[i]; 58 - b = mga_crtc->lut_b[i]; 55 + r = *r_ptr++ >> 8; 56 + b = *b_ptr++ >> 8; 59 57 } 60 58 /* VGA registers */ 61 59 WREG8(DAC_INDEX + MGA1064_COL_PAL, r); 62 - WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]); 60 + WREG8(DAC_INDEX + MGA1064_COL_PAL, *g_ptr++ >> 8); 63 61 WREG8(DAC_INDEX + MGA1064_COL_PAL, b); 64 62 } 65 63 return; 66 64 } 67 65 for (i = 0; i < MGAG200_LUT_SIZE; i++) { 68 66 /* VGA registers */ 69 - WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_r[i]); 70 - WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_g[i]); 71 - WREG8(DAC_INDEX + MGA1064_COL_PAL, mga_crtc->lut_b[i]); 67 + WREG8(DAC_INDEX + MGA1064_COL_PAL, *r_ptr++ >> 8); 68 + WREG8(DAC_INDEX + MGA1064_COL_PAL, *g_ptr++ >> 8); 69 + WREG8(DAC_INDEX + MGA1064_COL_PAL, *b_ptr++ >> 8); 72 70 } 73 71 } 74 72 ··· 1405 1399 u16 *blue, uint32_t size, 1406 1400 struct drm_modeset_acquire_ctx *ctx) 1407 1401 { 1408 - struct mga_crtc *mga_crtc = to_mga_crtc(crtc); 1409 - int i; 1410 - 1411 - for (i = 0; i < size; i++) { 1412 - mga_crtc->lut_r[i] = red[i] >> 8; 1413 - mga_crtc->lut_g[i] = green[i] >> 8; 1414 - mga_crtc->lut_b[i] = blue[i] >> 8; 1415 - } 1416 1402 mga_crtc_load_lut(crtc); 1417 1403 1418 1404 return 0; ··· 1453 1455 .mode_set_base = mga_crtc_mode_set_base, 1454 1456 .prepare = mga_crtc_prepare, 1455 1457 .commit = mga_crtc_commit, 1456 - .load_lut = mga_crtc_load_lut, 1457 1458 }; 1458 1459 1459 1460 /* CRTC setup */ 1460 1461 static void mga_crtc_init(struct mga_device *mdev) 1461 1462 { 1462 1463 struct mga_crtc *mga_crtc; 1463 - int i; 1464 1464 1465 1465 mga_crtc = kzalloc(sizeof(struct mga_crtc) + 1466 1466 (MGAG200FB_CONN_LIMIT * sizeof(struct drm_connector *)), ··· 1472 1476 drm_mode_crtc_set_gamma_size(&mga_crtc->base, MGAG200_LUT_SIZE); 1473 1477 mdev->mode_info.crtc = mga_crtc; 1474 1478 1475 - for (i = 0; i < MGAG200_LUT_SIZE; i++) { 1476 - mga_crtc->lut_r[i] = i; 1477 - mga_crtc->lut_g[i] = i; 1478 - mga_crtc->lut_b[i] = i; 1479 - } 1480 - 1481 1479 drm_crtc_helper_add(&mga_crtc->base, &mga_helper_funcs); 1482 - } 1483 - 1484 - /** Sets the color ramps on behalf of fbcon */ 1485 - void mga_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 1486 - u16 blue, int regno) 1487 - { 1488 - struct mga_crtc *mga_crtc = to_mga_crtc(crtc); 1489 - 1490 - mga_crtc->lut_r[regno] = red >> 8; 1491 - mga_crtc->lut_g[regno] = green >> 8; 1492 - mga_crtc->lut_b[regno] = blue >> 8; 1493 - } 1494 - 1495 - /** Gets the color ramps on behalf of fbcon */ 1496 - void mga_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 1497 - u16 *blue, int regno) 1498 - { 1499 - struct mga_crtc *mga_crtc = to_mga_crtc(crtc); 1500 - 1501 - *red = (u16)mga_crtc->lut_r[regno] << 8; 1502 - *green = (u16)mga_crtc->lut_g[regno] << 8; 1503 - *blue = (u16)mga_crtc->lut_b[regno] << 8; 1504 1480 } 1505 1481 1506 1482 /*
-1
drivers/gpu/drm/msm/dsi/dsi_manager.c
··· 626 626 } 627 627 628 628 static const struct drm_connector_funcs dsi_mgr_connector_funcs = { 629 - .dpms = drm_atomic_helper_connector_dpms, 630 629 .detect = dsi_mgr_connector_detect, 631 630 .fill_modes = drm_helper_probe_single_connector_modes, 632 631 .destroy = dsi_mgr_connector_destroy,
-1
drivers/gpu/drm/msm/edp/edp_connector.c
··· 92 92 } 93 93 94 94 static const struct drm_connector_funcs edp_connector_funcs = { 95 - .dpms = drm_atomic_helper_connector_dpms, 96 95 .detect = edp_connector_detect, 97 96 .fill_modes = drm_helper_probe_single_connector_modes, 98 97 .destroy = edp_connector_destroy,
-1
drivers/gpu/drm/msm/hdmi/hdmi_connector.c
··· 407 407 } 408 408 409 409 static const struct drm_connector_funcs hdmi_connector_funcs = { 410 - .dpms = drm_atomic_helper_connector_dpms, 411 410 .detect = hdmi_connector_detect, 412 411 .fill_modes = drm_helper_probe_single_connector_modes, 413 412 .destroy = hdmi_connector_destroy,
-1
drivers/gpu/drm/msm/mdp/mdp4/mdp4_crtc.c
··· 484 484 .set_config = drm_atomic_helper_set_config, 485 485 .destroy = mdp4_crtc_destroy, 486 486 .page_flip = drm_atomic_helper_page_flip, 487 - .set_property = drm_atomic_helper_crtc_set_property, 488 487 .cursor_set = mdp4_crtc_cursor_set, 489 488 .cursor_move = mdp4_crtc_cursor_move, 490 489 .reset = drm_atomic_helper_crtc_reset,
+2 -2
drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
··· 114 114 mdp4_enable(mdp4_kms); 115 115 116 116 /* see 119ecb7fd */ 117 - for_each_crtc_in_state(state, crtc, crtc_state, i) 117 + for_each_new_crtc_in_state(state, crtc, crtc_state, i) 118 118 drm_crtc_vblank_get(crtc); 119 119 } 120 120 ··· 126 126 struct drm_crtc_state *crtc_state; 127 127 128 128 /* see 119ecb7fd */ 129 - for_each_crtc_in_state(state, crtc, crtc_state, i) 129 + for_each_new_crtc_in_state(state, crtc, crtc_state, i) 130 130 drm_crtc_vblank_put(crtc); 131 131 132 132 mdp4_disable(mdp4_kms);
-1
drivers/gpu/drm/msm/mdp/mdp4/mdp4_lvds_connector.c
··· 91 91 } 92 92 93 93 static const struct drm_connector_funcs mdp4_lvds_connector_funcs = { 94 - .dpms = drm_atomic_helper_connector_dpms, 95 94 .detect = mdp4_lvds_connector_detect, 96 95 .fill_modes = drm_helper_probe_single_connector_modes, 97 96 .destroy = mdp4_lvds_connector_destroy,
+1 -1
drivers/gpu/drm/msm/mdp/mdp4/mdp4_plane.c
··· 401 401 type = private_plane ? DRM_PLANE_TYPE_PRIMARY : DRM_PLANE_TYPE_OVERLAY; 402 402 ret = drm_universal_plane_init(dev, plane, 0xff, &mdp4_plane_funcs, 403 403 mdp4_plane->formats, mdp4_plane->nformats, 404 - type, NULL); 404 + NULL, type, NULL); 405 405 if (ret) 406 406 goto fail; 407 407
-2
drivers/gpu/drm/msm/mdp/mdp5/mdp5_crtc.c
··· 919 919 .set_config = drm_atomic_helper_set_config, 920 920 .destroy = mdp5_crtc_destroy, 921 921 .page_flip = drm_atomic_helper_page_flip, 922 - .set_property = drm_atomic_helper_crtc_set_property, 923 922 .reset = mdp5_crtc_reset, 924 923 .atomic_duplicate_state = mdp5_crtc_duplicate_state, 925 924 .atomic_destroy_state = mdp5_crtc_destroy_state, ··· 931 932 .set_config = drm_atomic_helper_set_config, 932 933 .destroy = mdp5_crtc_destroy, 933 934 .page_flip = drm_atomic_helper_page_flip, 934 - .set_property = drm_atomic_helper_crtc_set_property, 935 935 .reset = mdp5_crtc_reset, 936 936 .atomic_duplicate_state = mdp5_crtc_duplicate_state, 937 937 .atomic_destroy_state = mdp5_crtc_destroy_state,
+2 -4
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
··· 246 246 .update_plane = drm_atomic_helper_update_plane, 247 247 .disable_plane = drm_atomic_helper_disable_plane, 248 248 .destroy = mdp5_plane_destroy, 249 - .set_property = drm_atomic_helper_plane_set_property, 250 249 .atomic_set_property = mdp5_plane_atomic_set_property, 251 250 .atomic_get_property = mdp5_plane_atomic_get_property, 252 251 .reset = mdp5_plane_reset, ··· 258 259 .update_plane = mdp5_update_cursor_plane_legacy, 259 260 .disable_plane = drm_atomic_helper_disable_plane, 260 261 .destroy = mdp5_plane_destroy, 261 - .set_property = drm_atomic_helper_plane_set_property, 262 262 .atomic_set_property = mdp5_plane_atomic_set_property, 263 263 .atomic_get_property = mdp5_plane_atomic_get_property, 264 264 .reset = mdp5_plane_reset, ··· 1137 1139 ret = drm_universal_plane_init(dev, plane, 0xff, 1138 1140 &mdp5_cursor_plane_funcs, 1139 1141 mdp5_plane->formats, mdp5_plane->nformats, 1140 - type, NULL); 1142 + NULL, type, NULL); 1141 1143 else 1142 1144 ret = drm_universal_plane_init(dev, plane, 0xff, 1143 1145 &mdp5_plane_funcs, 1144 1146 mdp5_plane->formats, mdp5_plane->nformats, 1145 - type, NULL); 1147 + NULL, type, NULL); 1146 1148 if (ret) 1147 1149 goto fail; 1148 1150
+9 -9
drivers/gpu/drm/msm/msm_atomic.c
··· 84 84 struct drm_atomic_state *old_state) 85 85 { 86 86 struct drm_crtc *crtc; 87 - struct drm_crtc_state *crtc_state; 87 + struct drm_crtc_state *new_crtc_state; 88 88 struct msm_drm_private *priv = old_state->dev->dev_private; 89 89 struct msm_kms *kms = priv->kms; 90 90 int i; 91 91 92 - for_each_crtc_in_state(old_state, crtc, crtc_state, i) { 93 - if (!crtc->state->enable) 92 + for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { 93 + if (!new_crtc_state->active) 94 94 continue; 95 95 96 96 kms->funcs->wait_for_crtc_commit_done(kms, crtc); ··· 195 195 struct drm_crtc *crtc; 196 196 struct drm_crtc_state *crtc_state; 197 197 struct drm_plane *plane; 198 - struct drm_plane_state *plane_state; 198 + struct drm_plane_state *old_plane_state, *new_plane_state; 199 199 int i, ret; 200 200 201 201 ret = drm_atomic_helper_prepare_planes(dev, state); ··· 211 211 /* 212 212 * Figure out what crtcs we have: 213 213 */ 214 - for_each_crtc_in_state(state, crtc, crtc_state, i) 214 + for_each_new_crtc_in_state(state, crtc, crtc_state, i) 215 215 c->crtc_mask |= drm_crtc_mask(crtc); 216 216 217 217 /* 218 218 * Figure out what fence to wait for: 219 219 */ 220 - for_each_plane_in_state(state, plane, plane_state, i) { 221 - if ((plane->state->fb != plane_state->fb) && plane_state->fb) { 222 - struct drm_gem_object *obj = msm_framebuffer_bo(plane_state->fb, 0); 220 + for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { 221 + if ((new_plane_state->fb != old_plane_state->fb) && new_plane_state->fb) { 222 + struct drm_gem_object *obj = msm_framebuffer_bo(new_plane_state->fb, 0); 223 223 struct msm_gem_object *msm_obj = to_msm_bo(obj); 224 224 struct dma_fence *fence = reservation_object_get_excl_rcu(msm_obj->resv); 225 225 226 - drm_atomic_set_fence_for_plane(plane_state, fence); 226 + drm_atomic_set_fence_for_plane(new_plane_state, fence); 227 227 } 228 228 } 229 229
+1 -1
drivers/gpu/drm/mxsfb/mxsfb_drv.c
··· 190 190 } 191 191 192 192 ret = drm_simple_display_pipe_init(drm, &mxsfb->pipe, &mxsfb_funcs, 193 - mxsfb_formats, ARRAY_SIZE(mxsfb_formats), 193 + mxsfb_formats, ARRAY_SIZE(mxsfb_formats), NULL, 194 194 &mxsfb->connector); 195 195 if (ret < 0) { 196 196 dev_err(drm->dev, "Cannot setup simple display pipe\n");
-1
drivers/gpu/drm/mxsfb/mxsfb_out.c
··· 74 74 } 75 75 76 76 static const struct drm_connector_funcs mxsfb_panel_connector_funcs = { 77 - .dpms = drm_atomic_helper_connector_dpms, 78 77 .detect = mxsfb_panel_connector_detect, 79 78 .fill_modes = drm_helper_probe_single_connector_modes, 80 79 .destroy = mxsfb_panel_connector_destroy,
+9 -17
drivers/gpu/drm/nouveau/dispnv04/crtc.c
··· 764 764 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 765 765 struct drm_device *dev = nv_crtc->base.dev; 766 766 struct rgb { uint8_t r, g, b; } __attribute__((packed)) *rgbs; 767 + u16 *r, *g, *b; 767 768 int i; 768 769 769 770 rgbs = (struct rgb *)nv04_display(dev)->mode_reg.crtc_reg[nv_crtc->index].DAC; 771 + r = crtc->gamma_store; 772 + g = r + crtc->gamma_size; 773 + b = g + crtc->gamma_size; 774 + 770 775 for (i = 0; i < 256; i++) { 771 - rgbs[i].r = nv_crtc->lut.r[i] >> 8; 772 - rgbs[i].g = nv_crtc->lut.g[i] >> 8; 773 - rgbs[i].b = nv_crtc->lut.b[i] >> 8; 776 + rgbs[i].r = *r++ >> 8; 777 + rgbs[i].g = *g++ >> 8; 778 + rgbs[i].b = *b++ >> 8; 774 779 } 775 780 776 781 nouveau_hw_load_state_palette(dev, nv_crtc->index, &nv04_display(dev)->mode_reg); ··· 797 792 struct drm_modeset_acquire_ctx *ctx) 798 793 { 799 794 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 800 - int i; 801 - 802 - for (i = 0; i < size; i++) { 803 - nv_crtc->lut.r[i] = r[i]; 804 - nv_crtc->lut.g[i] = g[i]; 805 - nv_crtc->lut.b[i] = b[i]; 806 - } 807 795 808 796 /* We need to know the depth before we upload, but it's possible to 809 797 * get called before a framebuffer is bound. If this is the case, ··· 1093 1095 .mode_set = nv_crtc_mode_set, 1094 1096 .mode_set_base = nv04_crtc_mode_set_base, 1095 1097 .mode_set_base_atomic = nv04_crtc_mode_set_base_atomic, 1096 - .load_lut = nv_crtc_gamma_load, 1097 1098 .disable = nv_crtc_disable, 1098 1099 }; 1099 1100 ··· 1100 1103 nv04_crtc_create(struct drm_device *dev, int crtc_num) 1101 1104 { 1102 1105 struct nouveau_crtc *nv_crtc; 1103 - int ret, i; 1106 + int ret; 1104 1107 1105 1108 nv_crtc = kzalloc(sizeof(*nv_crtc), GFP_KERNEL); 1106 1109 if (!nv_crtc) 1107 1110 return -ENOMEM; 1108 1111 1109 - for (i = 0; i < 256; i++) { 1110 - nv_crtc->lut.r[i] = i << 8; 1111 - nv_crtc->lut.g[i] = i << 8; 1112 - nv_crtc->lut.b[i] = i << 8; 1113 - } 1114 1112 nv_crtc->lut.depth = 0; 1115 1113 1116 1114 nv_crtc->index = crtc_num;
+2 -13
drivers/gpu/drm/nouveau/nouveau_connector.c
··· 770 770 struct drm_encoder *encoder = to_drm_encoder(nv_encoder); 771 771 int ret; 772 772 773 - if (drm_drv_uses_atomic_modeset(connector->dev)) 774 - return drm_atomic_helper_connector_set_property(connector, property, value); 775 - 776 773 ret = connector->funcs->atomic_set_property(&nv_connector->base, 777 774 &asyc->state, 778 775 property, value); ··· 1072 1075 .best_encoder = nouveau_connector_best_encoder, 1073 1076 }; 1074 1077 1075 - static int 1076 - nouveau_connector_dpms(struct drm_connector *connector, int mode) 1077 - { 1078 - if (drm_drv_uses_atomic_modeset(connector->dev)) 1079 - return drm_atomic_helper_connector_dpms(connector, mode); 1080 - return drm_helper_connector_dpms(connector, mode); 1081 - } 1082 - 1083 1078 static const struct drm_connector_funcs 1084 1079 nouveau_connector_funcs = { 1085 - .dpms = nouveau_connector_dpms, 1080 + .dpms = drm_helper_connector_dpms, 1086 1081 .reset = nouveau_conn_reset, 1087 1082 .detect = nouveau_connector_detect, 1088 1083 .force = nouveau_connector_force, ··· 1089 1100 1090 1101 static const struct drm_connector_funcs 1091 1102 nouveau_connector_funcs_lvds = { 1092 - .dpms = nouveau_connector_dpms, 1103 + .dpms = drm_helper_connector_dpms, 1093 1104 .reset = nouveau_conn_reset, 1094 1105 .detect = nouveau_connector_detect_lvds, 1095 1106 .force = nouveau_connector_force,
-3
drivers/gpu/drm/nouveau/nouveau_crtc.h
··· 61 61 62 62 struct { 63 63 struct nouveau_bo *nvbo; 64 - uint16_t r[256]; 65 - uint16_t g[256]; 66 - uint16_t b[256]; 67 64 int depth; 68 65 } lut; 69 66
-1
drivers/gpu/drm/nouveau/nouveau_drm.c
··· 998 998 999 999 .dumb_create = nouveau_display_dumb_create, 1000 1000 .dumb_map_offset = nouveau_display_dumb_map_offset, 1001 - .dumb_destroy = drm_gem_dumb_destroy, 1002 1001 1003 1002 .name = DRIVER_NAME, 1004 1003 .desc = DRIVER_DESC,
-22
drivers/gpu/drm/nouveau/nouveau_fbcon.c
··· 278 278 info->fbops = &nouveau_fbcon_ops; 279 279 } 280 280 281 - static void nouveau_fbcon_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 282 - u16 blue, int regno) 283 - { 284 - struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 285 - 286 - nv_crtc->lut.r[regno] = red; 287 - nv_crtc->lut.g[regno] = green; 288 - nv_crtc->lut.b[regno] = blue; 289 - } 290 - 291 - static void nouveau_fbcon_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 292 - u16 *blue, int regno) 293 - { 294 - struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 295 - 296 - *red = nv_crtc->lut.r[regno]; 297 - *green = nv_crtc->lut.g[regno]; 298 - *blue = nv_crtc->lut.b[regno]; 299 - } 300 - 301 281 static void 302 282 nouveau_fbcon_zfill(struct drm_device *dev, struct nouveau_fbdev *fbcon) 303 283 { ··· 447 467 } 448 468 449 469 static const struct drm_fb_helper_funcs nouveau_fbcon_helper_funcs = { 450 - .gamma_set = nouveau_fbcon_gamma_set, 451 - .gamma_get = nouveau_fbcon_gamma_get, 452 470 .fb_probe = nouveau_fbcon_create, 453 471 }; 454 472
+53 -68
drivers/gpu/drm/nouveau/nv50_display.c
··· 1055 1055 .disable_plane = drm_atomic_helper_disable_plane, 1056 1056 .destroy = nv50_wndw_destroy, 1057 1057 .reset = nv50_wndw_reset, 1058 - .set_property = drm_atomic_helper_plane_set_property, 1059 1058 .atomic_duplicate_state = nv50_wndw_atomic_duplicate_state, 1060 1059 .atomic_destroy_state = nv50_wndw_atomic_destroy_state, 1061 1060 }; ··· 1082 1083 wndw->func = func; 1083 1084 wndw->dmac = dmac; 1084 1085 1085 - ret = drm_universal_plane_init(dev, &wndw->plane, 0, &nv50_wndw, format, 1086 - nformat, type, "%s-%d", name, index); 1086 + ret = drm_universal_plane_init(dev, &wndw->plane, 0, &nv50_wndw, 1087 + format, nformat, NULL, 1088 + type, "%s-%d", name, index); 1087 1089 if (ret) 1088 1090 return ret; 1089 1091 ··· 2103 2103 2104 2104 NV_ATOMIC(drm, "%s atomic_check %d\n", crtc->name, asyh->state.active); 2105 2105 if (asyh->state.active) { 2106 - for_each_connector_in_state(asyh->state.state, conn, conns, i) { 2106 + for_each_new_connector_in_state(asyh->state.state, conn, conns, i) { 2107 2107 if (conns->crtc == crtc) { 2108 2108 asyc = nouveau_conn_atom(conns); 2109 2109 break; ··· 2204 2204 struct nv50_disp *disp = nv50_disp(crtc->dev); 2205 2205 struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 2206 2206 void __iomem *lut = nvbo_kmap_obj_iovirtual(nv_crtc->lut.nvbo); 2207 + u16 *r, *g, *b; 2207 2208 int i; 2208 2209 2209 - for (i = 0; i < 256; i++) { 2210 - u16 r = nv_crtc->lut.r[i] >> 2; 2211 - u16 g = nv_crtc->lut.g[i] >> 2; 2212 - u16 b = nv_crtc->lut.b[i] >> 2; 2210 + r = crtc->gamma_store; 2211 + g = r + crtc->gamma_size; 2212 + b = g + crtc->gamma_size; 2213 2213 2214 + for (i = 0; i < 256; i++) { 2214 2215 if (disp->disp->oclass < GF110_DISP) { 2215 - writew(r + 0x0000, lut + (i * 0x08) + 0); 2216 - writew(g + 0x0000, lut + (i * 0x08) + 2); 2217 - writew(b + 0x0000, lut + (i * 0x08) + 4); 2216 + writew((*r++ >> 2) + 0x0000, lut + (i * 0x08) + 0); 2217 + writew((*g++ >> 2) + 0x0000, lut + (i * 0x08) + 2); 2218 + writew((*b++ >> 2) + 0x0000, lut + (i * 0x08) + 4); 2218 2219 } else { 2219 - writew(r + 0x6000, lut + (i * 0x20) + 0); 2220 - writew(g + 0x6000, lut + (i * 0x20) + 2); 2221 - writew(b + 0x6000, lut + (i * 0x20) + 4); 2220 + /* 0x6000 interferes with the 14-bit color??? */ 2221 + writew((*r++ >> 2) + 0x6000, lut + (i * 0x20) + 0); 2222 + writew((*g++ >> 2) + 0x6000, lut + (i * 0x20) + 2); 2223 + writew((*b++ >> 2) + 0x6000, lut + (i * 0x20) + 4); 2222 2224 } 2223 2225 } 2224 2226 } 2225 2227 2226 2228 static const struct drm_crtc_helper_funcs 2227 2229 nv50_head_help = { 2228 - .load_lut = nv50_head_lut_load, 2229 2230 .atomic_check = nv50_head_atomic_check, 2230 2231 }; 2231 2232 ··· 2235 2234 uint32_t size, 2236 2235 struct drm_modeset_acquire_ctx *ctx) 2237 2236 { 2238 - struct nouveau_crtc *nv_crtc = nouveau_crtc(crtc); 2239 - u32 i; 2240 - 2241 - for (i = 0; i < size; i++) { 2242 - nv_crtc->lut.r[i] = r[i]; 2243 - nv_crtc->lut.g[i] = g[i]; 2244 - nv_crtc->lut.b[i] = b[i]; 2245 - } 2246 - 2247 2237 nv50_head_lut_load(crtc); 2248 2238 return 0; 2249 2239 } ··· 2317 2325 .destroy = nv50_head_destroy, 2318 2326 .set_config = drm_atomic_helper_set_config, 2319 2327 .page_flip = drm_atomic_helper_page_flip, 2320 - .set_property = drm_atomic_helper_crtc_set_property, 2321 2328 .atomic_duplicate_state = nv50_head_atomic_duplicate_state, 2322 2329 .atomic_destroy_state = nv50_head_atomic_destroy_state, 2323 2330 }; ··· 2331 2340 struct nv50_base *base; 2332 2341 struct nv50_curs *curs; 2333 2342 struct drm_crtc *crtc; 2334 - int ret, i; 2343 + int ret; 2335 2344 2336 2345 head = kzalloc(sizeof(*head), GFP_KERNEL); 2337 2346 if (!head) 2338 2347 return -ENOMEM; 2339 2348 2340 2349 head->base.index = index; 2341 - for (i = 0; i < 256; i++) { 2342 - head->base.lut.r[i] = i << 8; 2343 - head->base.lut.g[i] = i << 8; 2344 - head->base.lut.b[i] = i << 8; 2345 - } 2346 - 2347 2350 ret = nv50_base_new(drm, head, &base); 2348 2351 if (ret == 0) 2349 2352 ret = nv50_curs_new(drm, head, &curs); ··· 3105 3120 3106 3121 static const struct drm_connector_funcs 3107 3122 nv50_mstc = { 3108 - .dpms = drm_atomic_helper_connector_dpms, 3109 3123 .reset = nouveau_conn_reset, 3110 3124 .detect = nv50_mstc_detect, 3111 3125 .fill_modes = drm_helper_probe_single_connector_modes, 3112 - .set_property = drm_atomic_helper_connector_set_property, 3113 3126 .destroy = nv50_mstc_destroy, 3114 3127 .atomic_duplicate_state = nouveau_conn_atomic_duplicate_state, 3115 3128 .atomic_destroy_state = nouveau_conn_atomic_destroy_state, ··· 3888 3905 nv50_disp_atomic_commit_tail(struct drm_atomic_state *state) 3889 3906 { 3890 3907 struct drm_device *dev = state->dev; 3891 - struct drm_crtc_state *crtc_state; 3908 + struct drm_crtc_state *new_crtc_state; 3892 3909 struct drm_crtc *crtc; 3893 - struct drm_plane_state *plane_state; 3910 + struct drm_plane_state *new_plane_state; 3894 3911 struct drm_plane *plane; 3895 3912 struct nouveau_drm *drm = nouveau_drm(dev); 3896 3913 struct nv50_disp *disp = nv50_disp(dev); ··· 3909 3926 mutex_lock(&disp->mutex); 3910 3927 3911 3928 /* Disable head(s). */ 3912 - for_each_crtc_in_state(state, crtc, crtc_state, i) { 3913 - struct nv50_head_atom *asyh = nv50_head_atom(crtc->state); 3929 + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { 3930 + struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state); 3914 3931 struct nv50_head *head = nv50_head(crtc); 3915 3932 3916 3933 NV_ATOMIC(drm, "%s: clr %04x (set %04x)\n", crtc->name, ··· 3923 3940 } 3924 3941 3925 3942 /* Disable plane(s). */ 3926 - for_each_plane_in_state(state, plane, plane_state, i) { 3927 - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state); 3943 + for_each_new_plane_in_state(state, plane, new_plane_state, i) { 3944 + struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state); 3928 3945 struct nv50_wndw *wndw = nv50_wndw(plane); 3929 3946 3930 3947 NV_ATOMIC(drm, "%s: clr %02x (set %02x)\n", plane->name, ··· 3989 4006 } 3990 4007 3991 4008 /* Update head(s). */ 3992 - for_each_crtc_in_state(state, crtc, crtc_state, i) { 3993 - struct nv50_head_atom *asyh = nv50_head_atom(crtc->state); 4009 + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { 4010 + struct nv50_head_atom *asyh = nv50_head_atom(new_crtc_state); 3994 4011 struct nv50_head *head = nv50_head(crtc); 3995 4012 3996 4013 NV_ATOMIC(drm, "%s: set %04x (clr %04x)\n", crtc->name, ··· 4002 4019 } 4003 4020 } 4004 4021 4005 - for_each_crtc_in_state(state, crtc, crtc_state, i) { 4006 - if (crtc->state->event) 4022 + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { 4023 + if (new_crtc_state->event) 4007 4024 drm_crtc_vblank_get(crtc); 4008 4025 } 4009 4026 4010 4027 /* Update plane(s). */ 4011 - for_each_plane_in_state(state, plane, plane_state, i) { 4012 - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state); 4028 + for_each_new_plane_in_state(state, plane, new_plane_state, i) { 4029 + struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state); 4013 4030 struct nv50_wndw *wndw = nv50_wndw(plane); 4014 4031 4015 4032 NV_ATOMIC(drm, "%s: set %02x (clr %02x)\n", plane->name, ··· 4039 4056 mutex_unlock(&disp->mutex); 4040 4057 4041 4058 /* Wait for HW to signal completion. */ 4042 - for_each_plane_in_state(state, plane, plane_state, i) { 4043 - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane->state); 4059 + for_each_new_plane_in_state(state, plane, new_plane_state, i) { 4060 + struct nv50_wndw_atom *asyw = nv50_wndw_atom(new_plane_state); 4044 4061 struct nv50_wndw *wndw = nv50_wndw(plane); 4045 4062 int ret = nv50_wndw_wait_armed(wndw, asyw); 4046 4063 if (ret) 4047 4064 NV_ERROR(drm, "%s: timeout\n", plane->name); 4048 4065 } 4049 4066 4050 - for_each_crtc_in_state(state, crtc, crtc_state, i) { 4051 - if (crtc->state->event) { 4067 + for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) { 4068 + if (new_crtc_state->event) { 4052 4069 unsigned long flags; 4053 4070 /* Get correct count/ts if racing with vblank irq */ 4054 4071 drm_crtc_accurate_vblank_count(crtc); 4055 4072 spin_lock_irqsave(&crtc->dev->event_lock, flags); 4056 - drm_crtc_send_vblank_event(crtc, crtc->state->event); 4073 + drm_crtc_send_vblank_event(crtc, new_crtc_state->event); 4057 4074 spin_unlock_irqrestore(&crtc->dev->event_lock, flags); 4058 - crtc->state->event = NULL; 4075 + new_crtc_state->event = NULL; 4059 4076 drm_crtc_vblank_put(crtc); 4060 4077 } 4061 4078 } ··· 4080 4097 { 4081 4098 struct nouveau_drm *drm = nouveau_drm(dev); 4082 4099 struct nv50_disp *disp = nv50_disp(dev); 4083 - struct drm_plane_state *plane_state; 4100 + struct drm_plane_state *old_plane_state; 4084 4101 struct drm_plane *plane; 4085 4102 struct drm_crtc *crtc; 4086 4103 bool active = false; ··· 4110 4127 if (ret) 4111 4128 goto err_cleanup; 4112 4129 4113 - for_each_plane_in_state(state, plane, plane_state, i) { 4114 - struct nv50_wndw_atom *asyw = nv50_wndw_atom(plane_state); 4130 + for_each_old_plane_in_state(state, plane, old_plane_state, i) { 4131 + struct nv50_wndw_atom *asyw = nv50_wndw_atom(old_plane_state); 4115 4132 struct nv50_wndw *wndw = nv50_wndw(plane); 4133 + 4116 4134 if (asyw->set.image) { 4117 4135 asyw->ntfy.handle = wndw->dmac->sync.handle; 4118 4136 asyw->ntfy.offset = wndw->ntfy; ··· 4176 4192 4177 4193 static int 4178 4194 nv50_disp_outp_atomic_check_clr(struct nv50_atom *atom, 4179 - struct drm_connector *connector) 4195 + struct drm_connector_state *old_connector_state) 4180 4196 { 4181 - struct drm_encoder *encoder = connector->state->best_encoder; 4182 - struct drm_crtc_state *crtc_state; 4197 + struct drm_encoder *encoder = old_connector_state->best_encoder; 4198 + struct drm_crtc_state *old_crtc_state, *new_crtc_state; 4183 4199 struct drm_crtc *crtc; 4184 4200 struct nv50_outp_atom *outp; 4185 4201 4186 - if (!(crtc = connector->state->crtc)) 4202 + if (!(crtc = old_connector_state->crtc)) 4187 4203 return 0; 4188 4204 4189 - crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc); 4190 - if (crtc->state->active && drm_atomic_crtc_needs_modeset(crtc_state)) { 4205 + old_crtc_state = drm_atomic_get_old_crtc_state(&atom->state, crtc); 4206 + new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc); 4207 + if (old_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) { 4191 4208 outp = nv50_disp_outp_atomic_add(atom, encoder); 4192 4209 if (IS_ERR(outp)) 4193 4210 return PTR_ERR(outp); ··· 4209 4224 struct drm_connector_state *connector_state) 4210 4225 { 4211 4226 struct drm_encoder *encoder = connector_state->best_encoder; 4212 - struct drm_crtc_state *crtc_state; 4227 + struct drm_crtc_state *new_crtc_state; 4213 4228 struct drm_crtc *crtc; 4214 4229 struct nv50_outp_atom *outp; 4215 4230 4216 4231 if (!(crtc = connector_state->crtc)) 4217 4232 return 0; 4218 4233 4219 - crtc_state = drm_atomic_get_existing_crtc_state(&atom->state, crtc); 4220 - if (crtc_state->active && drm_atomic_crtc_needs_modeset(crtc_state)) { 4234 + new_crtc_state = drm_atomic_get_new_crtc_state(&atom->state, crtc); 4235 + if (new_crtc_state->active && drm_atomic_crtc_needs_modeset(new_crtc_state)) { 4221 4236 outp = nv50_disp_outp_atomic_add(atom, encoder); 4222 4237 if (IS_ERR(outp)) 4223 4238 return PTR_ERR(outp); ··· 4233 4248 nv50_disp_atomic_check(struct drm_device *dev, struct drm_atomic_state *state) 4234 4249 { 4235 4250 struct nv50_atom *atom = nv50_atom(state); 4236 - struct drm_connector_state *connector_state; 4251 + struct drm_connector_state *old_connector_state, *new_connector_state; 4237 4252 struct drm_connector *connector; 4238 4253 int ret, i; 4239 4254 ··· 4241 4256 if (ret) 4242 4257 return ret; 4243 4258 4244 - for_each_connector_in_state(state, connector, connector_state, i) { 4245 - ret = nv50_disp_outp_atomic_check_clr(atom, connector); 4259 + for_each_oldnew_connector_in_state(state, connector, old_connector_state, new_connector_state, i) { 4260 + ret = nv50_disp_outp_atomic_check_clr(atom, old_connector_state); 4246 4261 if (ret) 4247 4262 return ret; 4248 4263 4249 - ret = nv50_disp_outp_atomic_check_set(atom, connector_state); 4264 + ret = nv50_disp_outp_atomic_check_set(atom, new_connector_state); 4250 4265 if (ret) 4251 4266 return ret; 4252 4267 }
-1
drivers/gpu/drm/omapdrm/omap_connector.c
··· 195 195 } 196 196 197 197 static const struct drm_connector_funcs omap_connector_funcs = { 198 - .dpms = drm_atomic_helper_connector_dpms, 199 198 .reset = drm_atomic_helper_connector_reset, 200 199 .detect = omap_connector_detect, 201 200 .fill_modes = drm_helper_probe_single_connector_modes,
+84 -39
drivers/gpu/drm/omapdrm/omap_crtc.c
··· 26 26 27 27 #include "omap_drv.h" 28 28 29 + #define to_omap_crtc_state(x) container_of(x, struct omap_crtc_state, base) 30 + 31 + struct omap_crtc_state { 32 + /* Must be first. */ 33 + struct drm_crtc_state base; 34 + /* Shadow values for legacy userspace support. */ 35 + unsigned int rotation; 36 + unsigned int zpos; 37 + }; 38 + 29 39 #define to_omap_crtc(x) container_of(x, struct omap_crtc, base) 30 40 31 41 struct omap_crtc { ··· 455 445 static int omap_crtc_atomic_check(struct drm_crtc *crtc, 456 446 struct drm_crtc_state *state) 457 447 { 448 + struct drm_plane_state *pri_state; 449 + 458 450 if (state->color_mgmt_changed && state->gamma_lut) { 459 451 uint length = state->gamma_lut->length / 460 452 sizeof(struct drm_color_lut); 461 453 462 454 if (length < 2) 463 455 return -EINVAL; 456 + } 457 + 458 + pri_state = drm_atomic_get_new_plane_state(state->state, crtc->primary); 459 + if (pri_state) { 460 + struct omap_crtc_state *omap_crtc_state = 461 + to_omap_crtc_state(state); 462 + 463 + /* Mirror new values for zpos and rotation in omap_crtc_state */ 464 + omap_crtc_state->zpos = pri_state->zpos; 465 + omap_crtc_state->rotation = pri_state->rotation; 464 466 } 465 467 466 468 return 0; ··· 520 498 spin_unlock_irq(&crtc->dev->event_lock); 521 499 } 522 500 523 - static bool omap_crtc_is_plane_prop(struct drm_crtc *crtc, 524 - struct drm_property *property) 525 - { 526 - struct drm_device *dev = crtc->dev; 527 - struct omap_drm_private *priv = dev->dev_private; 528 - 529 - return property == priv->zorder_prop || 530 - property == crtc->primary->rotation_property; 531 - } 532 - 533 501 static int omap_crtc_atomic_set_property(struct drm_crtc *crtc, 534 502 struct drm_crtc_state *state, 535 503 struct drm_property *property, 536 504 uint64_t val) 537 505 { 538 - if (omap_crtc_is_plane_prop(crtc, property)) { 539 - struct drm_plane_state *plane_state; 540 - struct drm_plane *plane = crtc->primary; 506 + struct omap_drm_private *priv = crtc->dev->dev_private; 507 + struct drm_plane_state *plane_state; 541 508 542 - /* 543 - * Delegate property set to the primary plane. Get the plane 544 - * state and set the property directly. 545 - */ 509 + /* 510 + * Delegate property set to the primary plane. Get the plane state and 511 + * set the property directly, the shadow copy will be assigned in the 512 + * omap_crtc_atomic_check callback. This way updates to plane state will 513 + * always be mirrored in the crtc state correctly. 514 + */ 515 + plane_state = drm_atomic_get_plane_state(state->state, crtc->primary); 516 + if (IS_ERR(plane_state)) 517 + return PTR_ERR(plane_state); 546 518 547 - plane_state = drm_atomic_get_plane_state(state->state, plane); 548 - if (IS_ERR(plane_state)) 549 - return PTR_ERR(plane_state); 519 + if (property == crtc->primary->rotation_property) 520 + plane_state->rotation = val; 521 + else if (property == priv->zorder_prop) 522 + plane_state->zpos = val; 523 + else 524 + return -EINVAL; 550 525 551 - return drm_atomic_plane_set_property(plane, plane_state, 552 - property, val); 553 - } 554 - 555 - return -EINVAL; 526 + return 0; 556 527 } 557 528 558 529 static int omap_crtc_atomic_get_property(struct drm_crtc *crtc, ··· 553 538 struct drm_property *property, 554 539 uint64_t *val) 555 540 { 556 - if (omap_crtc_is_plane_prop(crtc, property)) { 557 - /* 558 - * Delegate property get to the primary plane. The 559 - * drm_atomic_plane_get_property() function isn't exported, but 560 - * can be called through drm_object_property_get_value() as that 561 - * will call drm_atomic_get_property() for atomic drivers. 562 - */ 563 - return drm_object_property_get_value(&crtc->primary->base, 564 - property, val); 565 - } 541 + struct omap_drm_private *priv = crtc->dev->dev_private; 542 + struct omap_crtc_state *omap_state = to_omap_crtc_state(state); 566 543 567 - return -EINVAL; 544 + if (property == crtc->primary->rotation_property) 545 + *val = omap_state->rotation; 546 + else if (property == priv->zorder_prop) 547 + *val = omap_state->zpos; 548 + else 549 + return -EINVAL; 550 + 551 + return 0; 552 + } 553 + 554 + static void omap_crtc_reset(struct drm_crtc *crtc) 555 + { 556 + if (crtc->state) 557 + __drm_atomic_helper_crtc_destroy_state(crtc->state); 558 + 559 + kfree(crtc->state); 560 + crtc->state = kzalloc(sizeof(struct omap_crtc_state), GFP_KERNEL); 561 + 562 + if (crtc->state) 563 + crtc->state->crtc = crtc; 564 + } 565 + 566 + static struct drm_crtc_state * 567 + omap_crtc_duplicate_state(struct drm_crtc *crtc) 568 + { 569 + struct omap_crtc_state *state, *current_state; 570 + 571 + if (WARN_ON(!crtc->state)) 572 + return NULL; 573 + 574 + current_state = to_omap_crtc_state(crtc->state); 575 + 576 + state = kmalloc(sizeof(*state), GFP_KERNEL); 577 + if (state) 578 + __drm_atomic_helper_crtc_duplicate_state(crtc, &state->base); 579 + 580 + state->zpos = current_state->zpos; 581 + state->rotation = current_state->rotation; 582 + 583 + return &state->base; 568 584 } 569 585 570 586 static const struct drm_crtc_funcs omap_crtc_funcs = { 571 - .reset = drm_atomic_helper_crtc_reset, 587 + .reset = omap_crtc_reset, 572 588 .set_config = drm_atomic_helper_set_config, 573 589 .destroy = omap_crtc_destroy, 574 590 .page_flip = drm_atomic_helper_page_flip, 575 591 .gamma_set = drm_atomic_helper_legacy_gamma_set, 576 - .set_property = drm_atomic_helper_crtc_set_property, 577 - .atomic_duplicate_state = drm_atomic_helper_crtc_duplicate_state, 592 + .atomic_duplicate_state = omap_crtc_duplicate_state, 578 593 .atomic_destroy_state = drm_atomic_helper_crtc_destroy_state, 579 594 .atomic_set_property = omap_crtc_atomic_set_property, 580 595 .atomic_get_property = omap_crtc_atomic_get_property,
+3 -4
drivers/gpu/drm/omapdrm/omap_drv.c
··· 57 57 static void omap_atomic_wait_for_completion(struct drm_device *dev, 58 58 struct drm_atomic_state *old_state) 59 59 { 60 - struct drm_crtc_state *old_crtc_state; 60 + struct drm_crtc_state *new_crtc_state; 61 61 struct drm_crtc *crtc; 62 62 unsigned int i; 63 63 int ret; 64 64 65 - for_each_crtc_in_state(old_state, crtc, old_crtc_state, i) { 66 - if (!crtc->state->enable) 65 + for_each_new_crtc_in_state(old_state, crtc, new_crtc_state, i) { 66 + if (!new_crtc_state->active) 67 67 continue; 68 68 69 69 ret = omap_crtc_wait_pending(crtc); ··· 517 517 .gem_vm_ops = &omap_gem_vm_ops, 518 518 .dumb_create = omap_gem_dumb_create, 519 519 .dumb_map_offset = omap_gem_dumb_map_offset, 520 - .dumb_destroy = drm_gem_dumb_destroy, 521 520 .ioctls = ioctls, 522 521 .num_ioctls = DRM_OMAP_NUM_IOCTLS, 523 522 .fops = &omapdriver_fops,
+1 -2
drivers/gpu/drm/omapdrm/omap_plane.c
··· 235 235 .disable_plane = drm_atomic_helper_disable_plane, 236 236 .reset = omap_plane_reset, 237 237 .destroy = omap_plane_destroy, 238 - .set_property = drm_atomic_helper_plane_set_property, 239 238 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 240 239 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, 241 240 .atomic_set_property = omap_plane_atomic_set_property, ··· 290 291 291 292 ret = drm_universal_plane_init(dev, plane, possible_crtcs, 292 293 &omap_plane_funcs, formats, 293 - nformats, type, NULL); 294 + nformats, NULL, type, NULL); 294 295 if (ret < 0) 295 296 goto error; 296 297
-1
drivers/gpu/drm/pl111/pl111_connector.c
··· 69 69 .fill_modes = drm_helper_probe_single_connector_modes, 70 70 .destroy = pl111_connector_destroy, 71 71 .detect = pl111_connector_detect, 72 - .dpms = drm_atomic_helper_connector_dpms, 73 72 .reset = drm_atomic_helper_connector_reset, 74 73 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, 75 74 .atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
+1 -1
drivers/gpu/drm/pl111/pl111_display.c
··· 457 457 ret = drm_simple_display_pipe_init(drm, &priv->pipe, 458 458 &pl111_display_funcs, 459 459 formats, ARRAY_SIZE(formats), 460 - &priv->connector.connector); 460 + NULL, &priv->connector.connector); 461 461 if (ret) 462 462 return ret; 463 463
-2
drivers/gpu/drm/pl111/pl111_drv.c
··· 159 159 .minor = 0, 160 160 .patchlevel = 0, 161 161 .dumb_create = drm_gem_cma_dumb_create, 162 - .dumb_destroy = drm_gem_dumb_destroy, 163 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 164 162 .gem_free_object_unlocked = drm_gem_cma_free_object, 165 163 .gem_vm_ops = &drm_gem_cma_vm_ops, 166 164
+1 -1
drivers/gpu/drm/qxl/qxl_display.c
··· 784 784 785 785 err = drm_universal_plane_init(&qdev->ddev, plane, possible_crtcs, 786 786 funcs, formats, num_formats, 787 - type, NULL); 787 + NULL, type, NULL); 788 788 if (err) 789 789 goto free_plane; 790 790
-1
drivers/gpu/drm/radeon/atombios_crtc.c
··· 2217 2217 .mode_set_base_atomic = atombios_crtc_set_base_atomic, 2218 2218 .prepare = atombios_crtc_prepare, 2219 2219 .commit = atombios_crtc_commit, 2220 - .load_lut = radeon_crtc_load_lut, 2221 2220 .disable = atombios_crtc_disable, 2222 2221 }; 2223 2222
+5 -2
drivers/gpu/drm/radeon/radeon_connectors.c
··· 773 773 774 774 if (connector->encoder->crtc) { 775 775 struct drm_crtc *crtc = connector->encoder->crtc; 776 - const struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; 777 776 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 778 777 779 778 radeon_crtc->output_csc = radeon_encoder->output_csc; 780 779 781 - (*crtc_funcs->load_lut)(crtc); 780 + /* 781 + * Our .gamma_set assumes the .gamma_store has been 782 + * prefilled and don't care about its arguments. 783 + */ 784 + crtc->funcs->gamma_set(crtc, NULL, NULL, NULL, 0, NULL); 782 785 } 783 786 } 784 787
+28 -43
drivers/gpu/drm/radeon/radeon_display.c
··· 42 42 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 43 43 struct drm_device *dev = crtc->dev; 44 44 struct radeon_device *rdev = dev->dev_private; 45 + u16 *r, *g, *b; 45 46 int i; 46 47 47 48 DRM_DEBUG_KMS("%d\n", radeon_crtc->crtc_id); ··· 61 60 WREG32(AVIVO_DC_LUT_WRITE_EN_MASK, 0x0000003f); 62 61 63 62 WREG8(AVIVO_DC_LUT_RW_INDEX, 0); 63 + r = crtc->gamma_store; 64 + g = r + crtc->gamma_size; 65 + b = g + crtc->gamma_size; 64 66 for (i = 0; i < 256; i++) { 65 67 WREG32(AVIVO_DC_LUT_30_COLOR, 66 - (radeon_crtc->lut_r[i] << 20) | 67 - (radeon_crtc->lut_g[i] << 10) | 68 - (radeon_crtc->lut_b[i] << 0)); 68 + ((*r++ & 0xffc0) << 14) | 69 + ((*g++ & 0xffc0) << 4) | 70 + (*b++ >> 6)); 69 71 } 70 72 71 73 /* Only change bit 0 of LUT_SEL, other bits are set elsewhere */ ··· 80 76 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 81 77 struct drm_device *dev = crtc->dev; 82 78 struct radeon_device *rdev = dev->dev_private; 79 + u16 *r, *g, *b; 83 80 int i; 84 81 85 82 DRM_DEBUG_KMS("%d\n", radeon_crtc->crtc_id); ··· 98 93 WREG32(EVERGREEN_DC_LUT_WRITE_EN_MASK + radeon_crtc->crtc_offset, 0x00000007); 99 94 100 95 WREG32(EVERGREEN_DC_LUT_RW_INDEX + radeon_crtc->crtc_offset, 0); 96 + r = crtc->gamma_store; 97 + g = r + crtc->gamma_size; 98 + b = g + crtc->gamma_size; 101 99 for (i = 0; i < 256; i++) { 102 100 WREG32(EVERGREEN_DC_LUT_30_COLOR + radeon_crtc->crtc_offset, 103 - (radeon_crtc->lut_r[i] << 20) | 104 - (radeon_crtc->lut_g[i] << 10) | 105 - (radeon_crtc->lut_b[i] << 0)); 101 + ((*r++ & 0xffc0) << 14) | 102 + ((*g++ & 0xffc0) << 4) | 103 + (*b++ >> 6)); 106 104 } 107 105 } 108 106 ··· 114 106 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 115 107 struct drm_device *dev = crtc->dev; 116 108 struct radeon_device *rdev = dev->dev_private; 109 + u16 *r, *g, *b; 117 110 int i; 118 111 119 112 DRM_DEBUG_KMS("%d\n", radeon_crtc->crtc_id); ··· 144 135 WREG32(EVERGREEN_DC_LUT_WRITE_EN_MASK + radeon_crtc->crtc_offset, 0x00000007); 145 136 146 137 WREG32(EVERGREEN_DC_LUT_RW_INDEX + radeon_crtc->crtc_offset, 0); 138 + r = crtc->gamma_store; 139 + g = r + crtc->gamma_size; 140 + b = g + crtc->gamma_size; 147 141 for (i = 0; i < 256; i++) { 148 142 WREG32(EVERGREEN_DC_LUT_30_COLOR + radeon_crtc->crtc_offset, 149 - (radeon_crtc->lut_r[i] << 20) | 150 - (radeon_crtc->lut_g[i] << 10) | 151 - (radeon_crtc->lut_b[i] << 0)); 143 + ((*r++ & 0xffc0) << 14) | 144 + ((*g++ & 0xffc0) << 4) | 145 + (*b++ >> 6)); 152 146 } 153 147 154 148 WREG32(NI_DEGAMMA_CONTROL + radeon_crtc->crtc_offset, ··· 184 172 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 185 173 struct drm_device *dev = crtc->dev; 186 174 struct radeon_device *rdev = dev->dev_private; 175 + u16 *r, *g, *b; 187 176 int i; 188 177 uint32_t dac2_cntl; 189 178 ··· 196 183 WREG32(RADEON_DAC_CNTL2, dac2_cntl); 197 184 198 185 WREG8(RADEON_PALETTE_INDEX, 0); 186 + r = crtc->gamma_store; 187 + g = r + crtc->gamma_size; 188 + b = g + crtc->gamma_size; 199 189 for (i = 0; i < 256; i++) { 200 190 WREG32(RADEON_PALETTE_30_DATA, 201 - (radeon_crtc->lut_r[i] << 20) | 202 - (radeon_crtc->lut_g[i] << 10) | 203 - (radeon_crtc->lut_b[i] << 0)); 191 + ((*r++ & 0xffc0) << 14) | 192 + ((*g++ & 0xffc0) << 4) | 193 + (*b++ >> 6)); 204 194 } 205 195 } 206 196 ··· 225 209 legacy_crtc_load_lut(crtc); 226 210 } 227 211 228 - /** Sets the color ramps on behalf of fbcon */ 229 - void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 230 - u16 blue, int regno) 231 - { 232 - struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 233 - 234 - radeon_crtc->lut_r[regno] = red >> 6; 235 - radeon_crtc->lut_g[regno] = green >> 6; 236 - radeon_crtc->lut_b[regno] = blue >> 6; 237 - } 238 - 239 - /** Gets the color ramps on behalf of fbcon */ 240 - void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 241 - u16 *blue, int regno) 242 - { 243 - struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 244 - 245 - *red = radeon_crtc->lut_r[regno] << 6; 246 - *green = radeon_crtc->lut_g[regno] << 6; 247 - *blue = radeon_crtc->lut_b[regno] << 6; 248 - } 249 - 250 212 static int radeon_crtc_gamma_set(struct drm_crtc *crtc, u16 *red, u16 *green, 251 213 u16 *blue, uint32_t size, 252 214 struct drm_modeset_acquire_ctx *ctx) 253 215 { 254 - struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc); 255 - int i; 256 - 257 - /* userspace palettes are always correct as is */ 258 - for (i = 0; i < size; i++) { 259 - radeon_crtc->lut_r[i] = red[i] >> 6; 260 - radeon_crtc->lut_g[i] = green[i] >> 6; 261 - radeon_crtc->lut_b[i] = blue[i] >> 6; 262 - } 263 216 radeon_crtc_load_lut(crtc); 264 217 265 218 return 0;
-1
drivers/gpu/drm/radeon/radeon_drv.c
··· 583 583 .gem_close_object = radeon_gem_object_close, 584 584 .dumb_create = radeon_mode_dumb_create, 585 585 .dumb_map_offset = radeon_mode_dumb_mmap, 586 - .dumb_destroy = drm_gem_dumb_destroy, 587 586 .fops = &radeon_driver_kms_fops, 588 587 589 588 .prime_handle_to_fd = drm_gem_prime_handle_to_fd,
-2
drivers/gpu/drm/radeon/radeon_fb.c
··· 331 331 } 332 332 333 333 static const struct drm_fb_helper_funcs radeon_fb_helper_funcs = { 334 - .gamma_set = radeon_crtc_fb_gamma_set, 335 - .gamma_get = radeon_crtc_fb_gamma_get, 336 334 .fb_probe = radeonfb_create, 337 335 }; 338 336
-1
drivers/gpu/drm/radeon/radeon_legacy_crtc.c
··· 1116 1116 .mode_set_base_atomic = radeon_crtc_set_base_atomic, 1117 1117 .prepare = radeon_crtc_prepare, 1118 1118 .commit = radeon_crtc_commit, 1119 - .load_lut = radeon_crtc_load_lut, 1120 1119 .disable = radeon_crtc_disable 1121 1120 }; 1122 1121
-4
drivers/gpu/drm/radeon/radeon_mode.h
··· 935 935 radeon_combios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc); 936 936 extern void 937 937 radeon_combios_encoder_dpms_scratch_regs(struct drm_encoder *encoder, bool on); 938 - extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 939 - u16 blue, int regno); 940 - extern void radeon_crtc_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 941 - u16 *blue, int regno); 942 938 int radeon_framebuffer_init(struct drm_device *dev, 943 939 struct radeon_framebuffer *rfb, 944 940 const struct drm_mode_fb_cmd2 *mode_cmd,
-2
drivers/gpu/drm/rcar-du/rcar_du_drv.c
··· 249 249 .gem_prime_vunmap = drm_gem_cma_prime_vunmap, 250 250 .gem_prime_mmap = drm_gem_cma_prime_mmap, 251 251 .dumb_create = rcar_du_dumb_create, 252 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 253 - .dumb_destroy = drm_gem_dumb_destroy, 254 252 .fops = &rcar_du_fops, 255 253 .name = "rcar-du", 256 254 .desc = "Renesas R-Car Display Unit",
-1
drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c
··· 46 46 } 47 47 48 48 static const struct drm_connector_funcs connector_funcs = { 49 - .dpms = drm_atomic_helper_connector_dpms, 50 49 .reset = drm_atomic_helper_connector_reset, 51 50 .fill_modes = drm_helper_probe_single_connector_modes, 52 51 .destroy = rcar_du_lvds_connector_destroy,
+2 -3
drivers/gpu/drm/rcar-du/rcar_du_plane.c
··· 715 715 .update_plane = drm_atomic_helper_update_plane, 716 716 .disable_plane = drm_atomic_helper_disable_plane, 717 717 .reset = rcar_du_plane_reset, 718 - .set_property = drm_atomic_helper_plane_set_property, 719 718 .destroy = drm_plane_cleanup, 720 719 .atomic_duplicate_state = rcar_du_plane_atomic_duplicate_state, 721 720 .atomic_destroy_state = rcar_du_plane_atomic_destroy_state, ··· 760 761 761 762 ret = drm_universal_plane_init(rcdu->ddev, &plane->plane, crtcs, 762 763 &rcar_du_plane_funcs, formats, 763 - ARRAY_SIZE(formats), type, 764 - NULL); 764 + ARRAY_SIZE(formats), 765 + NULL, type, NULL); 765 766 if (ret < 0) 766 767 return ret; 767 768
+2 -3
drivers/gpu/drm/rcar-du/rcar_du_vsp.c
··· 393 393 .update_plane = drm_atomic_helper_update_plane, 394 394 .disable_plane = drm_atomic_helper_disable_plane, 395 395 .reset = rcar_du_vsp_plane_reset, 396 - .set_property = drm_atomic_helper_plane_set_property, 397 396 .destroy = drm_plane_cleanup, 398 397 .atomic_duplicate_state = rcar_du_vsp_plane_atomic_duplicate_state, 399 398 .atomic_destroy_state = rcar_du_vsp_plane_atomic_destroy_state, ··· 443 444 ret = drm_universal_plane_init(rcdu->ddev, &plane->plane, crtcs, 444 445 &rcar_du_vsp_plane_funcs, 445 446 formats_kms, 446 - ARRAY_SIZE(formats_kms), type, 447 - NULL); 447 + ARRAY_SIZE(formats_kms), 448 + NULL, type, NULL); 448 449 if (ret < 0) 449 450 return ret; 450 451
-1
drivers/gpu/drm/rockchip/cdn-dp-core.c
··· 254 254 } 255 255 256 256 static const struct drm_connector_funcs cdn_dp_atomic_connector_funcs = { 257 - .dpms = drm_atomic_helper_connector_dpms, 258 257 .detect = cdn_dp_connector_detect, 259 258 .destroy = cdn_dp_connector_destroy, 260 259 .fill_modes = drm_helper_probe_single_connector_modes,
-1
drivers/gpu/drm/rockchip/dw-mipi-dsi.c
··· 1080 1080 } 1081 1081 1082 1082 static const struct drm_connector_funcs dw_mipi_dsi_atomic_connector_funcs = { 1083 - .dpms = drm_atomic_helper_connector_dpms, 1084 1083 .fill_modes = drm_helper_probe_single_connector_modes, 1085 1084 .destroy = dw_mipi_dsi_drm_connector_destroy, 1086 1085 .reset = drm_atomic_helper_connector_reset,
-1
drivers/gpu/drm/rockchip/inno_hdmi.c
··· 593 593 } 594 594 595 595 static struct drm_connector_funcs inno_hdmi_connector_funcs = { 596 - .dpms = drm_atomic_helper_connector_dpms, 597 596 .fill_modes = inno_hdmi_probe_single_connector_modes, 598 597 .detect = inno_hdmi_connector_detect, 599 598 .destroy = inno_hdmi_connector_destroy,
+6 -9
drivers/gpu/drm/rockchip/rockchip_drm_drv.c
··· 161 161 */ 162 162 drm_dev->irq_enabled = true; 163 163 164 + ret = rockchip_drm_fbdev_init(drm_dev); 165 + if (ret) 166 + goto err_unbind_all; 167 + 164 168 /* init kms poll for handling hpd */ 165 169 drm_kms_helper_poll_init(drm_dev); 166 170 167 - ret = rockchip_drm_fbdev_init(drm_dev); 171 + ret = drm_dev_register(drm_dev, 0); 168 172 if (ret) 169 173 goto err_kms_helper_poll_fini; 170 174 171 - ret = drm_dev_register(drm_dev, 0); 172 - if (ret) 173 - goto err_fbdev_fini; 174 - 175 175 return 0; 176 - err_fbdev_fini: 177 - rockchip_drm_fbdev_fini(drm_dev); 178 176 err_kms_helper_poll_fini: 179 177 drm_kms_helper_poll_fini(drm_dev); 178 + rockchip_drm_fbdev_fini(drm_dev); 180 179 err_unbind_all: 181 180 component_unbind_all(dev, drm_dev); 182 181 err_mode_config_cleanup: ··· 232 233 .gem_vm_ops = &drm_gem_cma_vm_ops, 233 234 .gem_free_object_unlocked = rockchip_gem_free_object, 234 235 .dumb_create = rockchip_gem_dumb_create, 235 - .dumb_map_offset = rockchip_gem_dumb_map_offset, 236 - .dumb_destroy = drm_gem_dumb_destroy, 237 236 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 238 237 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 239 238 .gem_prime_import = drm_gem_prime_import,
-26
drivers/gpu/drm/rockchip/rockchip_drm_gem.c
··· 393 393 return ERR_PTR(ret); 394 394 } 395 395 396 - int rockchip_gem_dumb_map_offset(struct drm_file *file_priv, 397 - struct drm_device *dev, uint32_t handle, 398 - uint64_t *offset) 399 - { 400 - struct drm_gem_object *obj; 401 - int ret; 402 - 403 - obj = drm_gem_object_lookup(file_priv, handle); 404 - if (!obj) { 405 - DRM_ERROR("failed to lookup gem object.\n"); 406 - return -EINVAL; 407 - } 408 - 409 - ret = drm_gem_create_mmap_offset(obj); 410 - if (ret) 411 - goto out; 412 - 413 - *offset = drm_vma_node_offset_addr(&obj->vma_node); 414 - DRM_DEBUG_KMS("offset = 0x%llx\n", *offset); 415 - 416 - out: 417 - drm_gem_object_unreference_unlocked(obj); 418 - 419 - return 0; 420 - } 421 - 422 396 /* 423 397 * rockchip_gem_dumb_create - (struct drm_driver)->dumb_create callback 424 398 * function
-3
drivers/gpu/drm/rockchip/rockchip_drm_gem.h
··· 57 57 int rockchip_gem_dumb_create(struct drm_file *file_priv, 58 58 struct drm_device *dev, 59 59 struct drm_mode_create_dumb *args); 60 - int rockchip_gem_dumb_map_offset(struct drm_file *file_priv, 61 - struct drm_device *dev, uint32_t handle, 62 - uint64_t *offset); 63 60 #endif /* _ROCKCHIP_DRM_GEM_H */
+76 -116
drivers/gpu/drm/rockchip/rockchip_drm_vop.c
··· 42 42 #include "rockchip_drm_psr.h" 43 43 #include "rockchip_drm_vop.h" 44 44 45 - #define __REG_SET_RELAXED(x, off, mask, shift, v, write_mask) \ 46 - vop_mask_write(x, off, mask, shift, v, write_mask, true) 47 - 48 - #define __REG_SET_NORMAL(x, off, mask, shift, v, write_mask) \ 49 - vop_mask_write(x, off, mask, shift, v, write_mask, false) 50 - 51 - #define REG_SET(x, base, reg, v, mode) \ 52 - __REG_SET_##mode(x, base + reg.offset, \ 53 - reg.mask, reg.shift, v, reg.write_mask) 54 - #define REG_SET_MASK(x, base, reg, mask, v, mode) \ 55 - __REG_SET_##mode(x, base + reg.offset, \ 56 - mask, reg.shift, v, reg.write_mask) 57 - 58 45 #define VOP_WIN_SET(x, win, name, v) \ 59 - REG_SET(x, win->base, win->phy->name, v, RELAXED) 46 + vop_reg_set(vop, &win->phy->name, win->base, ~0, v, #name) 60 47 #define VOP_SCL_SET(x, win, name, v) \ 61 - REG_SET(x, win->base, win->phy->scl->name, v, RELAXED) 48 + vop_reg_set(vop, &win->phy->scl->name, win->base, ~0, v, #name) 62 49 #define VOP_SCL_SET_EXT(x, win, name, v) \ 63 - REG_SET(x, win->base, win->phy->scl->ext->name, v, RELAXED) 64 - #define VOP_CTRL_SET(x, name, v) \ 65 - REG_SET(x, 0, (x)->data->ctrl->name, v, NORMAL) 50 + vop_reg_set(vop, &win->phy->scl->ext->name, \ 51 + win->base, ~0, v, #name) 66 52 67 - #define VOP_INTR_GET(vop, name) \ 68 - vop_read_reg(vop, 0, &vop->data->ctrl->name) 53 + #define VOP_INTR_SET_MASK(vop, name, mask, v) \ 54 + vop_reg_set(vop, &vop->data->intr->name, 0, mask, v, #name) 69 55 70 - #define VOP_INTR_SET(vop, name, mask, v) \ 71 - REG_SET_MASK(vop, 0, vop->data->intr->name, mask, v, NORMAL) 56 + #define VOP_REG_SET(vop, group, name, v) \ 57 + vop_reg_set(vop, &vop->data->group->name, 0, ~0, v, #name) 58 + 72 59 #define VOP_INTR_SET_TYPE(vop, name, type, v) \ 73 60 do { \ 74 61 int i, reg = 0, mask = 0; \ ··· 65 78 mask |= 1 << i; \ 66 79 } \ 67 80 } \ 68 - VOP_INTR_SET(vop, name, mask, reg); \ 81 + VOP_INTR_SET_MASK(vop, name, mask, reg); \ 69 82 } while (0) 70 83 #define VOP_INTR_GET_TYPE(vop, name, type) \ 71 84 vop_get_intr_type(vop, &vop->data->intr->name, type) 72 85 73 86 #define VOP_WIN_GET(x, win, name) \ 74 - vop_read_reg(x, win->base, &win->phy->name) 87 + vop_read_reg(x, win->offset, win->phy->name) 75 88 76 89 #define VOP_WIN_GET_YRGBADDR(vop, win) \ 77 90 vop_readl(vop, win->base + win->phy->yrgb_mst.offset) ··· 153 166 return (vop_readl(vop, base + reg->offset) >> reg->shift) & reg->mask; 154 167 } 155 168 156 - static inline void vop_mask_write(struct vop *vop, uint32_t offset, 157 - uint32_t mask, uint32_t shift, uint32_t v, 158 - bool write_mask, bool relaxed) 169 + static void vop_reg_set(struct vop *vop, const struct vop_reg *reg, 170 + uint32_t _offset, uint32_t _mask, uint32_t v, 171 + const char *reg_name) 159 172 { 160 - if (!mask) 161 - return; 173 + int offset, mask, shift; 162 174 163 - if (write_mask) { 175 + if (!reg || !reg->mask) { 176 + dev_dbg(vop->dev, "Warning: not support %s\n", reg_name); 177 + return; 178 + } 179 + 180 + offset = reg->offset + _offset; 181 + mask = reg->mask & _mask; 182 + shift = reg->shift; 183 + 184 + if (reg->write_mask) { 164 185 v = ((v << shift) & 0xffff) | (mask << (shift + 16)); 165 186 } else { 166 187 uint32_t cached_val = vop->regsbak[offset >> 2]; ··· 177 182 vop->regsbak[offset >> 2] = v; 178 183 } 179 184 180 - if (relaxed) 185 + if (reg->relaxed) 181 186 writel_relaxed(v, vop->regs + offset); 182 187 else 183 188 writel(v, vop->regs + offset); ··· 199 204 200 205 static inline void vop_cfg_done(struct vop *vop) 201 206 { 202 - VOP_CTRL_SET(vop, cfg_done, 1); 207 + VOP_REG_SET(vop, common, cfg_done, 1); 203 208 } 204 209 205 210 static bool has_rb_swapped(uint32_t format) ··· 495 500 static int vop_enable(struct drm_crtc *crtc) 496 501 { 497 502 struct vop *vop = to_vop(crtc); 498 - int ret; 503 + int ret, i; 499 504 500 505 ret = pm_runtime_get_sync(vop->dev); 501 506 if (ret < 0) { ··· 528 533 } 529 534 530 535 memcpy(vop->regs, vop->regsbak, vop->len); 536 + /* 537 + * We need to make sure that all windows are disabled before we 538 + * enable the crtc. Otherwise we might try to scan from a destroyed 539 + * buffer later. 540 + */ 541 + for (i = 0; i < vop->data->win_size; i++) { 542 + struct vop_win *vop_win = &vop->win[i]; 543 + const struct vop_win_data *win = vop_win->data; 544 + 545 + spin_lock(&vop->reg_lock); 546 + VOP_WIN_SET(vop, win, enable, 0); 547 + spin_unlock(&vop->reg_lock); 548 + } 549 + 531 550 vop_cfg_done(vop); 532 551 533 552 /* ··· 551 542 552 543 spin_lock(&vop->reg_lock); 553 544 554 - VOP_CTRL_SET(vop, standby, 0); 545 + VOP_REG_SET(vop, common, standby, 1); 555 546 556 547 spin_unlock(&vop->reg_lock); 557 548 ··· 576 567 struct drm_crtc_state *old_state) 577 568 { 578 569 struct vop *vop = to_vop(crtc); 579 - int i; 580 570 581 571 WARN_ON(vop->event); 582 572 583 573 rockchip_drm_psr_deactivate(&vop->crtc); 584 - 585 - /* 586 - * We need to make sure that all windows are disabled before we 587 - * disable that crtc. Otherwise we might try to scan from a destroyed 588 - * buffer later. 589 - */ 590 - for (i = 0; i < vop->data->win_size; i++) { 591 - struct vop_win *vop_win = &vop->win[i]; 592 - const struct vop_win_data *win = vop_win->data; 593 - 594 - spin_lock(&vop->reg_lock); 595 - VOP_WIN_SET(vop, win, enable, 0); 596 - spin_unlock(&vop->reg_lock); 597 - } 598 - 599 - vop_cfg_done(vop); 600 574 601 575 drm_crtc_vblank_off(crtc); 602 576 ··· 595 603 596 604 spin_lock(&vop->reg_lock); 597 605 598 - VOP_CTRL_SET(vop, standby, 1); 606 + VOP_REG_SET(vop, common, standby, 1); 599 607 600 608 spin_unlock(&vop->reg_lock); 601 609 ··· 675 683 * Src.x1 can be odd when do clip, but yuv plane start point 676 684 * need align with 2 pixel. 677 685 */ 678 - if (is_yuv_support(fb->format->format) && ((state->src.x1 >> 16) % 2)) 686 + if (is_yuv_support(fb->format->format) && ((state->src.x1 >> 16) % 2)) { 687 + DRM_ERROR("Invalid Source: Yuv format not support odd xpos\n"); 679 688 return -EINVAL; 689 + } 680 690 681 691 return 0; 682 692 } ··· 759 765 spin_lock(&vop->reg_lock); 760 766 761 767 VOP_WIN_SET(vop, win, format, format); 762 - VOP_WIN_SET(vop, win, yrgb_vir, fb->pitches[0] >> 2); 768 + VOP_WIN_SET(vop, win, yrgb_vir, DIV_ROUND_UP(fb->pitches[0], 4)); 763 769 VOP_WIN_SET(vop, win, yrgb_mst, dma_addr); 764 770 if (is_yuv_support(fb->format->format)) { 765 771 int hsub = drm_format_horz_chroma_subsampling(fb->format->format); ··· 773 779 offset += (src->y1 >> 16) * fb->pitches[1] / vsub; 774 780 775 781 dma_addr = rk_uv_obj->dma_addr + offset + fb->offsets[1]; 776 - VOP_WIN_SET(vop, win, uv_vir, fb->pitches[1] >> 2); 782 + VOP_WIN_SET(vop, win, uv_vir, DIV_ROUND_UP(fb->pitches[1], 4)); 777 783 VOP_WIN_SET(vop, win, uv_mst, dma_addr); 778 784 } 779 785 ··· 894 900 return; 895 901 } 896 902 897 - /* 898 - * If dclk rate is zero, mean that scanout is stop, 899 - * we don't need wait any more. 900 - */ 901 - if (clk_get_rate(vop->dclk)) { 902 - /* 903 - * Rk3288 vop timing register is immediately, when configure 904 - * display timing on display time, may cause tearing. 905 - * 906 - * Vop standby will take effect at end of current frame, 907 - * if dsp hold valid irq happen, it means standby complete. 908 - * 909 - * mode set: 910 - * standby and wait complete --> |---- 911 - * | display time 912 - * |---- 913 - * |---> dsp hold irq 914 - * configure display timing --> | 915 - * standby exit | 916 - * | new frame start. 917 - */ 918 - 919 - reinit_completion(&vop->dsp_hold_completion); 920 - vop_dsp_hold_valid_irq_enable(vop); 921 - 922 - spin_lock(&vop->reg_lock); 923 - 924 - VOP_CTRL_SET(vop, standby, 1); 925 - 926 - spin_unlock(&vop->reg_lock); 927 - 928 - wait_for_completion(&vop->dsp_hold_completion); 929 - 930 - vop_dsp_hold_valid_irq_disable(vop); 931 - } 932 - 933 903 pin_pol = BIT(DCLK_INVERT); 934 904 pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) ? 935 905 BIT(HSYNC_POSITIVE) : 0; 936 906 pin_pol |= (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) ? 937 907 BIT(VSYNC_POSITIVE) : 0; 938 - VOP_CTRL_SET(vop, pin_pol, pin_pol); 908 + VOP_REG_SET(vop, output, pin_pol, pin_pol); 939 909 940 910 switch (s->output_type) { 941 911 case DRM_MODE_CONNECTOR_LVDS: 942 - VOP_CTRL_SET(vop, rgb_en, 1); 943 - VOP_CTRL_SET(vop, rgb_pin_pol, pin_pol); 912 + VOP_REG_SET(vop, output, rgb_en, 1); 913 + VOP_REG_SET(vop, output, rgb_pin_pol, pin_pol); 944 914 break; 945 915 case DRM_MODE_CONNECTOR_eDP: 946 - VOP_CTRL_SET(vop, edp_pin_pol, pin_pol); 947 - VOP_CTRL_SET(vop, edp_en, 1); 916 + VOP_REG_SET(vop, output, edp_pin_pol, pin_pol); 917 + VOP_REG_SET(vop, output, edp_en, 1); 948 918 break; 949 919 case DRM_MODE_CONNECTOR_HDMIA: 950 - VOP_CTRL_SET(vop, hdmi_pin_pol, pin_pol); 951 - VOP_CTRL_SET(vop, hdmi_en, 1); 920 + VOP_REG_SET(vop, output, hdmi_pin_pol, pin_pol); 921 + VOP_REG_SET(vop, output, hdmi_en, 1); 952 922 break; 953 923 case DRM_MODE_CONNECTOR_DSI: 954 - VOP_CTRL_SET(vop, mipi_pin_pol, pin_pol); 955 - VOP_CTRL_SET(vop, mipi_en, 1); 924 + VOP_REG_SET(vop, output, mipi_pin_pol, pin_pol); 925 + VOP_REG_SET(vop, output, mipi_en, 1); 956 926 break; 957 927 case DRM_MODE_CONNECTOR_DisplayPort: 958 928 pin_pol &= ~BIT(DCLK_INVERT); 959 - VOP_CTRL_SET(vop, dp_pin_pol, pin_pol); 960 - VOP_CTRL_SET(vop, dp_en, 1); 929 + VOP_REG_SET(vop, output, dp_pin_pol, pin_pol); 930 + VOP_REG_SET(vop, output, dp_en, 1); 961 931 break; 962 932 default: 963 933 DRM_DEV_ERROR(vop->dev, "unsupported connector_type [%d]\n", ··· 934 976 if (s->output_mode == ROCKCHIP_OUT_MODE_AAAA && 935 977 !(vop_data->feature & VOP_FEATURE_OUTPUT_RGB10)) 936 978 s->output_mode = ROCKCHIP_OUT_MODE_P888; 937 - VOP_CTRL_SET(vop, out_mode, s->output_mode); 979 + VOP_REG_SET(vop, common, out_mode, s->output_mode); 938 980 939 - VOP_CTRL_SET(vop, htotal_pw, (htotal << 16) | hsync_len); 981 + VOP_REG_SET(vop, modeset, htotal_pw, (htotal << 16) | hsync_len); 940 982 val = hact_st << 16; 941 983 val |= hact_end; 942 - VOP_CTRL_SET(vop, hact_st_end, val); 943 - VOP_CTRL_SET(vop, hpost_st_end, val); 984 + VOP_REG_SET(vop, modeset, hact_st_end, val); 985 + VOP_REG_SET(vop, modeset, hpost_st_end, val); 944 986 945 - VOP_CTRL_SET(vop, vtotal_pw, (vtotal << 16) | vsync_len); 987 + VOP_REG_SET(vop, modeset, vtotal_pw, (vtotal << 16) | vsync_len); 946 988 val = vact_st << 16; 947 989 val |= vact_end; 948 - VOP_CTRL_SET(vop, vact_st_end, val); 949 - VOP_CTRL_SET(vop, vpost_st_end, val); 990 + VOP_REG_SET(vop, modeset, vact_st_end, val); 991 + VOP_REG_SET(vop, modeset, vpost_st_end, val); 950 992 951 - VOP_CTRL_SET(vop, line_flag_num[0], vact_end); 993 + VOP_REG_SET(vop, intr, line_flag_num[0], vact_end); 952 994 953 995 clk_set_rate(vop->dclk, adjusted_mode->clock * 1000); 954 996 955 - VOP_CTRL_SET(vop, standby, 0); 997 + VOP_REG_SET(vop, common, standby, 0); 956 998 957 999 rockchip_drm_psr_activate(&vop->crtc); 958 1000 } ··· 1251 1293 0, &vop_plane_funcs, 1252 1294 win_data->phy->data_formats, 1253 1295 win_data->phy->nformats, 1254 - win_data->type, NULL); 1296 + NULL, win_data->type, NULL); 1255 1297 if (ret) { 1256 1298 DRM_DEV_ERROR(vop->dev, "failed to init plane %d\n", 1257 1299 ret); ··· 1290 1332 &vop_plane_funcs, 1291 1333 win_data->phy->data_formats, 1292 1334 win_data->phy->nformats, 1293 - win_data->type, NULL); 1335 + NULL, win_data->type, NULL); 1294 1336 if (ret) { 1295 1337 DRM_DEV_ERROR(vop->dev, "failed to init overlay %d\n", 1296 1338 ret); ··· 1356 1398 static int vop_initial(struct vop *vop) 1357 1399 { 1358 1400 const struct vop_data *vop_data = vop->data; 1359 - const struct vop_reg_data *init_table = vop_data->init_table; 1360 1401 struct reset_control *ahb_rst; 1361 1402 int i, ret; 1362 1403 ··· 1415 1458 1416 1459 memcpy(vop->regsbak, vop->regs, vop->len); 1417 1460 1418 - for (i = 0; i < vop_data->table_size; i++) 1419 - vop_writel(vop, init_table[i].offset, init_table[i].value); 1461 + VOP_REG_SET(vop, misc, global_regdone_en, 1); 1462 + VOP_REG_SET(vop, common, dsp_blank, 0); 1420 1463 1421 1464 for (i = 0; i < vop_data->win_size; i++) { 1422 1465 const struct vop_win_data *win = &vop_data->win[i]; 1466 + int channel = i * 2 + 1; 1423 1467 1468 + VOP_WIN_SET(vop, win, channel, (channel + 1) << 4 | channel); 1424 1469 VOP_WIN_SET(vop, win, enable, 0); 1470 + VOP_WIN_SET(vop, win, gate, 1); 1425 1471 } 1426 1472 1427 1473 vop_cfg_done(vop);
+54 -34
drivers/gpu/drm/rockchip/rockchip_drm_vop.h
··· 15 15 #ifndef _ROCKCHIP_DRM_VOP_H 16 16 #define _ROCKCHIP_DRM_VOP_H 17 17 18 + /* 19 + * major: IP major version, used for IP structure 20 + * minor: big feature change under same structure 21 + */ 22 + #define VOP_VERSION(major, minor) ((major) << 8 | (minor)) 23 + #define VOP_MAJOR(version) ((version) >> 8) 24 + #define VOP_MINOR(version) ((version) & 0xff) 25 + 18 26 enum vop_data_format { 19 27 VOP_FMT_ARGB8888 = 0, 20 28 VOP_FMT_RGB888, ··· 32 24 VOP_FMT_YUV444SP, 33 25 }; 34 26 35 - struct vop_reg_data { 36 - uint32_t offset; 37 - uint32_t value; 38 - }; 39 - 40 27 struct vop_reg { 41 - uint32_t offset; 42 - uint32_t shift; 43 28 uint32_t mask; 29 + uint16_t offset; 30 + uint8_t shift; 44 31 bool write_mask; 32 + bool relaxed; 45 33 }; 46 34 47 - struct vop_ctrl { 48 - struct vop_reg standby; 49 - struct vop_reg data_blank; 50 - struct vop_reg gate_en; 51 - struct vop_reg mmu_en; 52 - struct vop_reg rgb_en; 35 + struct vop_modeset { 36 + struct vop_reg htotal_pw; 37 + struct vop_reg hact_st_end; 38 + struct vop_reg hpost_st_end; 39 + struct vop_reg vtotal_pw; 40 + struct vop_reg vact_st_end; 41 + struct vop_reg vpost_st_end; 42 + }; 43 + 44 + struct vop_output { 45 + struct vop_reg pin_pol; 46 + struct vop_reg dp_pin_pol; 47 + struct vop_reg edp_pin_pol; 48 + struct vop_reg hdmi_pin_pol; 49 + struct vop_reg mipi_pin_pol; 50 + struct vop_reg rgb_pin_pol; 51 + struct vop_reg dp_en; 53 52 struct vop_reg edp_en; 54 53 struct vop_reg hdmi_en; 55 54 struct vop_reg mipi_en; 56 - struct vop_reg dp_en; 57 - struct vop_reg out_mode; 55 + struct vop_reg rgb_en; 56 + }; 57 + 58 + struct vop_common { 59 + struct vop_reg cfg_done; 60 + struct vop_reg dsp_blank; 61 + struct vop_reg data_blank; 58 62 struct vop_reg dither_down; 59 63 struct vop_reg dither_up; 60 - struct vop_reg pin_pol; 61 - struct vop_reg rgb_pin_pol; 62 - struct vop_reg hdmi_pin_pol; 63 - struct vop_reg edp_pin_pol; 64 - struct vop_reg mipi_pin_pol; 65 - struct vop_reg dp_pin_pol; 64 + struct vop_reg gate_en; 65 + struct vop_reg mmu_en; 66 + struct vop_reg out_mode; 67 + struct vop_reg standby; 68 + }; 66 69 67 - struct vop_reg htotal_pw; 68 - struct vop_reg hact_st_end; 69 - struct vop_reg vtotal_pw; 70 - struct vop_reg vact_st_end; 71 - struct vop_reg hpost_st_end; 72 - struct vop_reg vpost_st_end; 73 - 74 - struct vop_reg line_flag_num[2]; 75 - 76 - struct vop_reg cfg_done; 70 + struct vop_misc { 71 + struct vop_reg global_regdone_en; 77 72 }; 78 73 79 74 struct vop_intr { 80 75 const int *intrs; 81 76 uint32_t nintrs; 77 + 78 + struct vop_reg line_flag_num[2]; 82 79 struct vop_reg enable; 83 80 struct vop_reg clear; 84 81 struct vop_reg status; ··· 128 115 uint32_t nformats; 129 116 130 117 struct vop_reg enable; 118 + struct vop_reg gate; 131 119 struct vop_reg format; 132 120 struct vop_reg rb_swap; 133 121 struct vop_reg act_info; ··· 141 127 142 128 struct vop_reg dst_alpha_ctl; 143 129 struct vop_reg src_alpha_ctl; 130 + struct vop_reg channel; 144 131 }; 145 132 146 133 struct vop_win_data { ··· 151 136 }; 152 137 153 138 struct vop_data { 154 - const struct vop_reg_data *init_table; 155 - unsigned int table_size; 156 - const struct vop_ctrl *ctrl; 139 + uint32_t version; 157 140 const struct vop_intr *intr; 141 + const struct vop_common *common; 142 + const struct vop_misc *misc; 143 + const struct vop_modeset *modeset; 144 + const struct vop_output *output; 158 145 const struct vop_win_data *win; 159 146 unsigned int win_size; 160 147 ··· 298 281 int act_height; 299 282 300 283 act_height = (src_h + vskiplines - 1) / vskiplines; 284 + 285 + if (act_height == dst_h) 286 + return GET_SCL_FT_BILI_DN(src_h, dst_h) / vskiplines; 301 287 302 288 return GET_SCL_FT_BILI_DN(act_height, dst_h); 303 289 }
+258 -117
drivers/gpu/drm/rockchip/rockchip_vop_reg.c
··· 20 20 #include "rockchip_drm_vop.h" 21 21 #include "rockchip_vop_reg.h" 22 22 23 - #define VOP_REG(off, _mask, s) \ 24 - {.offset = off, \ 23 + #define _VOP_REG(off, _mask, _shift, _write_mask, _relaxed) \ 24 + { \ 25 + .offset = off, \ 25 26 .mask = _mask, \ 26 - .shift = s, \ 27 - .write_mask = false,} 27 + .shift = _shift, \ 28 + .write_mask = _write_mask, \ 29 + .relaxed = _relaxed, \ 30 + } 28 31 29 - #define VOP_REG_MASK(off, _mask, s) \ 30 - {.offset = off, \ 31 - .mask = _mask, \ 32 - .shift = s, \ 33 - .write_mask = true,} 32 + #define VOP_REG(off, _mask, _shift) \ 33 + _VOP_REG(off, _mask, _shift, false, true) 34 + 35 + #define VOP_REG_SYNC(off, _mask, _shift) \ 36 + _VOP_REG(off, _mask, _shift, false, false) 37 + 38 + #define VOP_REG_MASK_SYNC(off, _mask, _shift) \ 39 + _VOP_REG(off, _mask, _shift, true, false) 34 40 35 41 static const uint32_t formats_win_full[] = { 36 42 DRM_FORMAT_XRGB8888, ··· 116 110 static const struct vop_intr rk3036_intr = { 117 111 .intrs = rk3036_vop_intrs, 118 112 .nintrs = ARRAY_SIZE(rk3036_vop_intrs), 119 - .status = VOP_REG(RK3036_INT_STATUS, 0xf, 0), 120 - .enable = VOP_REG(RK3036_INT_STATUS, 0xf, 4), 121 - .clear = VOP_REG(RK3036_INT_STATUS, 0xf, 8), 113 + .line_flag_num[0] = VOP_REG(RK3036_INT_STATUS, 0xfff, 12), 114 + .status = VOP_REG_SYNC(RK3036_INT_STATUS, 0xf, 0), 115 + .enable = VOP_REG_SYNC(RK3036_INT_STATUS, 0xf, 4), 116 + .clear = VOP_REG_SYNC(RK3036_INT_STATUS, 0xf, 8), 122 117 }; 123 118 124 - static const struct vop_ctrl rk3036_ctrl_data = { 125 - .standby = VOP_REG(RK3036_SYS_CTRL, 0x1, 30), 126 - .out_mode = VOP_REG(RK3036_DSP_CTRL0, 0xf, 0), 127 - .pin_pol = VOP_REG(RK3036_DSP_CTRL0, 0xf, 4), 119 + static const struct vop_modeset rk3036_modeset = { 128 120 .htotal_pw = VOP_REG(RK3036_DSP_HTOTAL_HS_END, 0x1fff1fff, 0), 129 121 .hact_st_end = VOP_REG(RK3036_DSP_HACT_ST_END, 0x1fff1fff, 0), 130 122 .vtotal_pw = VOP_REG(RK3036_DSP_VTOTAL_VS_END, 0x1fff1fff, 0), 131 123 .vact_st_end = VOP_REG(RK3036_DSP_VACT_ST_END, 0x1fff1fff, 0), 132 - .line_flag_num[0] = VOP_REG(RK3036_INT_STATUS, 0xfff, 12), 133 - .cfg_done = VOP_REG(RK3036_REG_CFG_DONE, 0x1, 0), 134 124 }; 135 125 136 - static const struct vop_reg_data rk3036_vop_init_reg_table[] = { 137 - {RK3036_DSP_CTRL1, 0x00000000}, 126 + static const struct vop_output rk3036_output = { 127 + .pin_pol = VOP_REG(RK3036_DSP_CTRL0, 0xf, 4), 128 + }; 129 + 130 + static const struct vop_common rk3036_common = { 131 + .standby = VOP_REG_SYNC(RK3036_SYS_CTRL, 0x1, 30), 132 + .out_mode = VOP_REG(RK3036_DSP_CTRL0, 0xf, 0), 133 + .dsp_blank = VOP_REG(RK3036_DSP_CTRL1, 0x1, 24), 134 + .cfg_done = VOP_REG_SYNC(RK3036_REG_CFG_DONE, 0x1, 0), 138 135 }; 139 136 140 137 static const struct vop_data rk3036_vop = { 141 - .init_table = rk3036_vop_init_reg_table, 142 - .table_size = ARRAY_SIZE(rk3036_vop_init_reg_table), 143 - .ctrl = &rk3036_ctrl_data, 144 138 .intr = &rk3036_intr, 139 + .common = &rk3036_common, 140 + .modeset = &rk3036_modeset, 141 + .output = &rk3036_output, 145 142 .win = rk3036_vop_win_data, 146 143 .win_size = ARRAY_SIZE(rk3036_vop_win_data), 147 144 }; ··· 197 188 .uv_vir = VOP_REG(RK3288_WIN0_VIR, 0x3fff, 16), 198 189 .src_alpha_ctl = VOP_REG(RK3288_WIN0_SRC_ALPHA_CTRL, 0xff, 0), 199 190 .dst_alpha_ctl = VOP_REG(RK3288_WIN0_DST_ALPHA_CTRL, 0xff, 0), 191 + .channel = VOP_REG(RK3288_WIN0_CTRL2, 0xff, 0), 200 192 }; 201 193 202 194 static const struct vop_win_phy rk3288_win23_data = { 203 195 .data_formats = formats_win_lite, 204 196 .nformats = ARRAY_SIZE(formats_win_lite), 205 - .enable = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 0), 197 + .enable = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 4), 198 + .gate = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 0), 206 199 .format = VOP_REG(RK3288_WIN2_CTRL0, 0x7, 1), 207 200 .rb_swap = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 12), 208 201 .dsp_info = VOP_REG(RK3288_WIN2_DSP_INFO0, 0x0fff0fff, 0), ··· 215 204 .dst_alpha_ctl = VOP_REG(RK3288_WIN2_DST_ALPHA_CTRL, 0xff, 0), 216 205 }; 217 206 218 - static const struct vop_ctrl rk3288_ctrl_data = { 219 - .standby = VOP_REG(RK3288_SYS_CTRL, 0x1, 22), 220 - .gate_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 23), 221 - .mmu_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 20), 222 - .rgb_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 12), 223 - .hdmi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 13), 224 - .edp_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 14), 225 - .mipi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 15), 226 - .dither_down = VOP_REG(RK3288_DSP_CTRL1, 0xf, 1), 227 - .dither_up = VOP_REG(RK3288_DSP_CTRL1, 0x1, 6), 228 - .data_blank = VOP_REG(RK3288_DSP_CTRL0, 0x1, 19), 229 - .out_mode = VOP_REG(RK3288_DSP_CTRL0, 0xf, 0), 230 - .pin_pol = VOP_REG(RK3288_DSP_CTRL0, 0xf, 4), 207 + static const struct vop_modeset rk3288_modeset = { 231 208 .htotal_pw = VOP_REG(RK3288_DSP_HTOTAL_HS_END, 0x1fff1fff, 0), 232 209 .hact_st_end = VOP_REG(RK3288_DSP_HACT_ST_END, 0x1fff1fff, 0), 233 210 .vtotal_pw = VOP_REG(RK3288_DSP_VTOTAL_VS_END, 0x1fff1fff, 0), 234 211 .vact_st_end = VOP_REG(RK3288_DSP_VACT_ST_END, 0x1fff1fff, 0), 235 212 .hpost_st_end = VOP_REG(RK3288_POST_DSP_HACT_INFO, 0x1fff1fff, 0), 236 213 .vpost_st_end = VOP_REG(RK3288_POST_DSP_VACT_INFO, 0x1fff1fff, 0), 237 - .line_flag_num[0] = VOP_REG(RK3288_INTR_CTRL0, 0x1fff, 12), 238 - .cfg_done = VOP_REG(RK3288_REG_CFG_DONE, 0x1, 0), 239 214 }; 240 215 241 - static const struct vop_reg_data rk3288_init_reg_table[] = { 242 - {RK3288_SYS_CTRL, 0x00c00000}, 243 - {RK3288_DSP_CTRL0, 0x00000000}, 244 - {RK3288_WIN0_CTRL0, 0x00000080}, 245 - {RK3288_WIN1_CTRL0, 0x00000080}, 246 - /* TODO: Win2/3 support multiple area function, but we haven't found 247 - * a suitable way to use it yet, so let's just use them as other windows 248 - * with only area 0 enabled. 249 - */ 250 - {RK3288_WIN2_CTRL0, 0x00000010}, 251 - {RK3288_WIN3_CTRL0, 0x00000010}, 216 + static const struct vop_output rk3288_output = { 217 + .pin_pol = VOP_REG(RK3288_DSP_CTRL0, 0xf, 4), 218 + .rgb_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 12), 219 + .hdmi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 13), 220 + .edp_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 14), 221 + .mipi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 15), 222 + }; 223 + 224 + static const struct vop_common rk3288_common = { 225 + .standby = VOP_REG_SYNC(RK3288_SYS_CTRL, 0x1, 22), 226 + .gate_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 23), 227 + .mmu_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 20), 228 + .dither_down = VOP_REG(RK3288_DSP_CTRL1, 0xf, 1), 229 + .dither_up = VOP_REG(RK3288_DSP_CTRL1, 0x1, 6), 230 + .data_blank = VOP_REG(RK3288_DSP_CTRL0, 0x1, 19), 231 + .dsp_blank = VOP_REG(RK3288_DSP_CTRL0, 0x3, 18), 232 + .out_mode = VOP_REG(RK3288_DSP_CTRL0, 0xf, 0), 233 + .cfg_done = VOP_REG_SYNC(RK3288_REG_CFG_DONE, 0x1, 0), 252 234 }; 253 235 254 236 /* ··· 271 267 static const struct vop_intr rk3288_vop_intr = { 272 268 .intrs = rk3288_vop_intrs, 273 269 .nintrs = ARRAY_SIZE(rk3288_vop_intrs), 270 + .line_flag_num[0] = VOP_REG(RK3288_INTR_CTRL0, 0x1fff, 12), 274 271 .status = VOP_REG(RK3288_INTR_CTRL0, 0xf, 0), 275 272 .enable = VOP_REG(RK3288_INTR_CTRL0, 0xf, 4), 276 273 .clear = VOP_REG(RK3288_INTR_CTRL0, 0xf, 8), 277 274 }; 278 275 279 276 static const struct vop_data rk3288_vop = { 280 - .init_table = rk3288_init_reg_table, 281 - .table_size = ARRAY_SIZE(rk3288_init_reg_table), 277 + .version = VOP_VERSION(3, 1), 282 278 .feature = VOP_FEATURE_OUTPUT_RGB10, 283 279 .intr = &rk3288_vop_intr, 284 - .ctrl = &rk3288_ctrl_data, 280 + .common = &rk3288_common, 281 + .modeset = &rk3288_modeset, 282 + .output = &rk3288_output, 285 283 .win = rk3288_vop_win_data, 286 284 .win_size = ARRAY_SIZE(rk3288_vop_win_data), 287 285 }; 288 286 289 - static const struct vop_ctrl rk3399_ctrl_data = { 290 - .standby = VOP_REG(RK3399_SYS_CTRL, 0x1, 22), 291 - .gate_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 23), 292 - .dp_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 11), 293 - .rgb_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 12), 294 - .hdmi_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 13), 295 - .edp_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 14), 296 - .mipi_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 15), 297 - .dither_down = VOP_REG(RK3399_DSP_CTRL1, 0xf, 1), 298 - .dither_up = VOP_REG(RK3399_DSP_CTRL1, 0x1, 6), 299 - .data_blank = VOP_REG(RK3399_DSP_CTRL0, 0x1, 19), 300 - .out_mode = VOP_REG(RK3399_DSP_CTRL0, 0xf, 0), 301 - .rgb_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 16), 302 - .dp_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 16), 303 - .hdmi_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 20), 304 - .edp_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 24), 305 - .mipi_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 28), 306 - .htotal_pw = VOP_REG(RK3399_DSP_HTOTAL_HS_END, 0x1fff1fff, 0), 307 - .hact_st_end = VOP_REG(RK3399_DSP_HACT_ST_END, 0x1fff1fff, 0), 308 - .vtotal_pw = VOP_REG(RK3399_DSP_VTOTAL_VS_END, 0x1fff1fff, 0), 309 - .vact_st_end = VOP_REG(RK3399_DSP_VACT_ST_END, 0x1fff1fff, 0), 310 - .hpost_st_end = VOP_REG(RK3399_POST_DSP_HACT_INFO, 0x1fff1fff, 0), 311 - .vpost_st_end = VOP_REG(RK3399_POST_DSP_VACT_INFO, 0x1fff1fff, 0), 312 - .line_flag_num[0] = VOP_REG(RK3399_LINE_FLAG, 0xffff, 0), 313 - .line_flag_num[1] = VOP_REG(RK3399_LINE_FLAG, 0xffff, 16), 314 - .cfg_done = VOP_REG_MASK(RK3399_REG_CFG_DONE, 0x1, 0), 315 - }; 316 - 317 - static const int rk3399_vop_intrs[] = { 287 + static const int rk3368_vop_intrs[] = { 318 288 FS_INTR, 319 289 0, 0, 320 290 LINE_FLAG_INTR, ··· 298 320 DSP_HOLD_VALID_INTR, 299 321 }; 300 322 301 - static const struct vop_intr rk3399_vop_intr = { 302 - .intrs = rk3399_vop_intrs, 303 - .nintrs = ARRAY_SIZE(rk3399_vop_intrs), 304 - .status = VOP_REG_MASK(RK3399_INTR_STATUS0, 0xffff, 0), 305 - .enable = VOP_REG_MASK(RK3399_INTR_EN0, 0xffff, 0), 306 - .clear = VOP_REG_MASK(RK3399_INTR_CLEAR0, 0xffff, 0), 323 + static const struct vop_intr rk3368_vop_intr = { 324 + .intrs = rk3368_vop_intrs, 325 + .nintrs = ARRAY_SIZE(rk3368_vop_intrs), 326 + .line_flag_num[0] = VOP_REG(RK3368_LINE_FLAG, 0xffff, 0), 327 + .line_flag_num[1] = VOP_REG(RK3368_LINE_FLAG, 0xffff, 16), 328 + .status = VOP_REG_MASK_SYNC(RK3368_INTR_STATUS, 0x3fff, 0), 329 + .enable = VOP_REG_MASK_SYNC(RK3368_INTR_EN, 0x3fff, 0), 330 + .clear = VOP_REG_MASK_SYNC(RK3368_INTR_CLEAR, 0x3fff, 0), 307 331 }; 308 332 309 - static const struct vop_reg_data rk3399_init_reg_table[] = { 310 - {RK3399_SYS_CTRL, 0x2000f800}, 311 - {RK3399_DSP_CTRL0, 0x00000000}, 312 - {RK3399_WIN0_CTRL0, 0x00000080}, 313 - {RK3399_WIN1_CTRL0, 0x00000080}, 314 - /* TODO: Win2/3 support multiple area function, but we haven't found 315 - * a suitable way to use it yet, so let's just use them as other windows 316 - * with only area 0 enabled. 317 - */ 318 - {RK3399_WIN2_CTRL0, 0x00000010}, 319 - {RK3399_WIN3_CTRL0, 0x00000010}, 333 + static const struct vop_win_phy rk3368_win23_data = { 334 + .data_formats = formats_win_lite, 335 + .nformats = ARRAY_SIZE(formats_win_lite), 336 + .gate = VOP_REG(RK3368_WIN2_CTRL0, 0x1, 0), 337 + .enable = VOP_REG(RK3368_WIN2_CTRL0, 0x1, 4), 338 + .format = VOP_REG(RK3368_WIN2_CTRL0, 0x3, 5), 339 + .rb_swap = VOP_REG(RK3368_WIN2_CTRL0, 0x1, 20), 340 + .dsp_info = VOP_REG(RK3368_WIN2_DSP_INFO0, 0x0fff0fff, 0), 341 + .dsp_st = VOP_REG(RK3368_WIN2_DSP_ST0, 0x1fff1fff, 0), 342 + .yrgb_mst = VOP_REG(RK3368_WIN2_MST0, 0xffffffff, 0), 343 + .yrgb_vir = VOP_REG(RK3368_WIN2_VIR0_1, 0x1fff, 0), 344 + .src_alpha_ctl = VOP_REG(RK3368_WIN2_SRC_ALPHA_CTRL, 0xff, 0), 345 + .dst_alpha_ctl = VOP_REG(RK3368_WIN2_DST_ALPHA_CTRL, 0xff, 0), 346 + }; 347 + 348 + static const struct vop_win_data rk3368_vop_win_data[] = { 349 + { .base = 0x00, .phy = &rk3288_win01_data, 350 + .type = DRM_PLANE_TYPE_PRIMARY }, 351 + { .base = 0x40, .phy = &rk3288_win01_data, 352 + .type = DRM_PLANE_TYPE_OVERLAY }, 353 + { .base = 0x00, .phy = &rk3368_win23_data, 354 + .type = DRM_PLANE_TYPE_OVERLAY }, 355 + { .base = 0x50, .phy = &rk3368_win23_data, 356 + .type = DRM_PLANE_TYPE_CURSOR }, 357 + }; 358 + 359 + static const struct vop_output rk3368_output = { 360 + .rgb_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 16), 361 + .hdmi_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 20), 362 + .edp_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 24), 363 + .mipi_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 28), 364 + .rgb_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 12), 365 + .hdmi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 13), 366 + .edp_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 14), 367 + .mipi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 15), 368 + }; 369 + 370 + static const struct vop_misc rk3368_misc = { 371 + .global_regdone_en = VOP_REG(RK3368_SYS_CTRL, 0x1, 11), 372 + }; 373 + 374 + static const struct vop_data rk3368_vop = { 375 + .version = VOP_VERSION(3, 2), 376 + .intr = &rk3368_vop_intr, 377 + .common = &rk3288_common, 378 + .modeset = &rk3288_modeset, 379 + .output = &rk3368_output, 380 + .misc = &rk3368_misc, 381 + .win = rk3368_vop_win_data, 382 + .win_size = ARRAY_SIZE(rk3368_vop_win_data), 383 + }; 384 + 385 + static const struct vop_intr rk3366_vop_intr = { 386 + .intrs = rk3368_vop_intrs, 387 + .nintrs = ARRAY_SIZE(rk3368_vop_intrs), 388 + .line_flag_num[0] = VOP_REG(RK3366_LINE_FLAG, 0xffff, 0), 389 + .line_flag_num[1] = VOP_REG(RK3366_LINE_FLAG, 0xffff, 16), 390 + .status = VOP_REG_MASK_SYNC(RK3366_INTR_STATUS0, 0xffff, 0), 391 + .enable = VOP_REG_MASK_SYNC(RK3366_INTR_EN0, 0xffff, 0), 392 + .clear = VOP_REG_MASK_SYNC(RK3366_INTR_CLEAR0, 0xffff, 0), 393 + }; 394 + 395 + static const struct vop_data rk3366_vop = { 396 + .version = VOP_VERSION(3, 4), 397 + .intr = &rk3366_vop_intr, 398 + .common = &rk3288_common, 399 + .modeset = &rk3288_modeset, 400 + .output = &rk3368_output, 401 + .misc = &rk3368_misc, 402 + .win = rk3368_vop_win_data, 403 + .win_size = ARRAY_SIZE(rk3368_vop_win_data), 404 + }; 405 + 406 + static const struct vop_output rk3399_output = { 407 + .dp_pin_pol = VOP_REG(RK3399_DSP_CTRL1, 0xf, 16), 408 + .rgb_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 16), 409 + .hdmi_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 20), 410 + .edp_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 24), 411 + .mipi_pin_pol = VOP_REG(RK3368_DSP_CTRL1, 0xf, 28), 412 + .dp_en = VOP_REG(RK3399_SYS_CTRL, 0x1, 11), 413 + .rgb_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 12), 414 + .hdmi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 13), 415 + .edp_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 14), 416 + .mipi_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 15), 320 417 }; 321 418 322 419 static const struct vop_data rk3399_vop_big = { 323 - .init_table = rk3399_init_reg_table, 324 - .table_size = ARRAY_SIZE(rk3399_init_reg_table), 420 + .version = VOP_VERSION(3, 5), 325 421 .feature = VOP_FEATURE_OUTPUT_RGB10, 326 - .intr = &rk3399_vop_intr, 327 - .ctrl = &rk3399_ctrl_data, 328 - /* 329 - * rk3399 vop big windows register layout is same as rk3288. 330 - */ 331 - .win = rk3288_vop_win_data, 332 - .win_size = ARRAY_SIZE(rk3288_vop_win_data), 422 + .intr = &rk3366_vop_intr, 423 + .common = &rk3288_common, 424 + .modeset = &rk3288_modeset, 425 + .output = &rk3399_output, 426 + .misc = &rk3368_misc, 427 + .win = rk3368_vop_win_data, 428 + .win_size = ARRAY_SIZE(rk3368_vop_win_data), 333 429 }; 334 430 335 431 static const struct vop_win_data rk3399_vop_lit_win_data[] = { 336 432 { .base = 0x00, .phy = &rk3288_win01_data, 337 433 .type = DRM_PLANE_TYPE_PRIMARY }, 338 - { .base = 0x00, .phy = &rk3288_win23_data, 434 + { .base = 0x00, .phy = &rk3368_win23_data, 339 435 .type = DRM_PLANE_TYPE_CURSOR}, 340 436 }; 341 437 342 438 static const struct vop_data rk3399_vop_lit = { 343 - .init_table = rk3399_init_reg_table, 344 - .table_size = ARRAY_SIZE(rk3399_init_reg_table), 345 - .intr = &rk3399_vop_intr, 346 - .ctrl = &rk3399_ctrl_data, 347 - /* 348 - * rk3399 vop lit windows register layout is same as rk3288, 349 - * but cut off the win1 and win3 windows. 350 - */ 439 + .version = VOP_VERSION(3, 6), 440 + .intr = &rk3366_vop_intr, 441 + .common = &rk3288_common, 442 + .modeset = &rk3288_modeset, 443 + .output = &rk3399_output, 444 + .misc = &rk3368_misc, 351 445 .win = rk3399_vop_lit_win_data, 352 446 .win_size = ARRAY_SIZE(rk3399_vop_lit_win_data), 447 + }; 448 + 449 + static const struct vop_win_data rk3228_vop_win_data[] = { 450 + { .base = 0x00, .phy = &rk3288_win01_data, 451 + .type = DRM_PLANE_TYPE_PRIMARY }, 452 + { .base = 0x40, .phy = &rk3288_win01_data, 453 + .type = DRM_PLANE_TYPE_CURSOR }, 454 + }; 455 + 456 + static const struct vop_data rk3228_vop = { 457 + .version = VOP_VERSION(3, 7), 458 + .feature = VOP_FEATURE_OUTPUT_RGB10, 459 + .intr = &rk3366_vop_intr, 460 + .common = &rk3288_common, 461 + .modeset = &rk3288_modeset, 462 + .output = &rk3399_output, 463 + .misc = &rk3368_misc, 464 + .win = rk3228_vop_win_data, 465 + .win_size = ARRAY_SIZE(rk3228_vop_win_data), 466 + }; 467 + 468 + static const struct vop_modeset rk3328_modeset = { 469 + .htotal_pw = VOP_REG(RK3328_DSP_HTOTAL_HS_END, 0x1fff1fff, 0), 470 + .hact_st_end = VOP_REG(RK3328_DSP_HACT_ST_END, 0x1fff1fff, 0), 471 + .vtotal_pw = VOP_REG(RK3328_DSP_VTOTAL_VS_END, 0x1fff1fff, 0), 472 + .vact_st_end = VOP_REG(RK3328_DSP_VACT_ST_END, 0x1fff1fff, 0), 473 + .hpost_st_end = VOP_REG(RK3328_POST_DSP_HACT_INFO, 0x1fff1fff, 0), 474 + .vpost_st_end = VOP_REG(RK3328_POST_DSP_VACT_INFO, 0x1fff1fff, 0), 475 + }; 476 + 477 + static const struct vop_output rk3328_output = { 478 + .rgb_en = VOP_REG(RK3328_SYS_CTRL, 0x1, 12), 479 + .hdmi_en = VOP_REG(RK3328_SYS_CTRL, 0x1, 13), 480 + .edp_en = VOP_REG(RK3328_SYS_CTRL, 0x1, 14), 481 + .mipi_en = VOP_REG(RK3328_SYS_CTRL, 0x1, 15), 482 + .rgb_pin_pol = VOP_REG(RK3328_DSP_CTRL1, 0xf, 16), 483 + .hdmi_pin_pol = VOP_REG(RK3328_DSP_CTRL1, 0xf, 20), 484 + .edp_pin_pol = VOP_REG(RK3328_DSP_CTRL1, 0xf, 24), 485 + .mipi_pin_pol = VOP_REG(RK3328_DSP_CTRL1, 0xf, 28), 486 + }; 487 + 488 + static const struct vop_misc rk3328_misc = { 489 + .global_regdone_en = VOP_REG(RK3328_SYS_CTRL, 0x1, 11), 490 + }; 491 + 492 + static const struct vop_common rk3328_common = { 493 + .standby = VOP_REG_SYNC(RK3328_SYS_CTRL, 0x1, 22), 494 + .dither_down = VOP_REG(RK3328_DSP_CTRL1, 0xf, 1), 495 + .dither_up = VOP_REG(RK3328_DSP_CTRL1, 0x1, 6), 496 + .dsp_blank = VOP_REG(RK3328_DSP_CTRL0, 0x3, 18), 497 + .out_mode = VOP_REG(RK3328_DSP_CTRL0, 0xf, 0), 498 + .cfg_done = VOP_REG_SYNC(RK3328_REG_CFG_DONE, 0x1, 0), 499 + }; 500 + 501 + static const struct vop_intr rk3328_vop_intr = { 502 + .intrs = rk3368_vop_intrs, 503 + .nintrs = ARRAY_SIZE(rk3368_vop_intrs), 504 + .line_flag_num[0] = VOP_REG(RK3328_LINE_FLAG, 0xffff, 0), 505 + .line_flag_num[1] = VOP_REG(RK3328_LINE_FLAG, 0xffff, 16), 506 + .status = VOP_REG_MASK_SYNC(RK3328_INTR_STATUS0, 0xffff, 0), 507 + .enable = VOP_REG_MASK_SYNC(RK3328_INTR_EN0, 0xffff, 0), 508 + .clear = VOP_REG_MASK_SYNC(RK3328_INTR_CLEAR0, 0xffff, 0), 509 + }; 510 + 511 + static const struct vop_win_data rk3328_vop_win_data[] = { 512 + { .base = 0xd0, .phy = &rk3288_win01_data, 513 + .type = DRM_PLANE_TYPE_PRIMARY }, 514 + { .base = 0x1d0, .phy = &rk3288_win01_data, 515 + .type = DRM_PLANE_TYPE_OVERLAY }, 516 + { .base = 0x2d0, .phy = &rk3288_win01_data, 517 + .type = DRM_PLANE_TYPE_CURSOR }, 518 + }; 519 + 520 + static const struct vop_data rk3328_vop = { 521 + .version = VOP_VERSION(3, 8), 522 + .feature = VOP_FEATURE_OUTPUT_RGB10, 523 + .intr = &rk3328_vop_intr, 524 + .common = &rk3328_common, 525 + .modeset = &rk3328_modeset, 526 + .output = &rk3328_output, 527 + .misc = &rk3328_misc, 528 + .win = rk3328_vop_win_data, 529 + .win_size = ARRAY_SIZE(rk3328_vop_win_data), 353 530 }; 354 531 355 532 static const struct of_device_id vop_driver_dt_match[] = { ··· 512 379 .data = &rk3036_vop }, 513 380 { .compatible = "rockchip,rk3288-vop", 514 381 .data = &rk3288_vop }, 382 + { .compatible = "rockchip,rk3368-vop", 383 + .data = &rk3368_vop }, 384 + { .compatible = "rockchip,rk3366-vop", 385 + .data = &rk3366_vop }, 515 386 { .compatible = "rockchip,rk3399-vop-big", 516 387 .data = &rk3399_vop_big }, 517 388 { .compatible = "rockchip,rk3399-vop-lit", 518 389 .data = &rk3399_vop_lit }, 390 + { .compatible = "rockchip,rk3228-vop", 391 + .data = &rk3228_vop }, 392 + { .compatible = "rockchip,rk3328-vop", 393 + .data = &rk3328_vop }, 519 394 {}, 520 395 }; 521 396 MODULE_DEVICE_TABLE(of, vop_driver_dt_match);
+712 -193
drivers/gpu/drm/rockchip/rockchip_vop_reg.h
··· 41 41 #define RK3288_WIN0_SRC_ALPHA_CTRL 0x0060 42 42 #define RK3288_WIN0_DST_ALPHA_CTRL 0x0064 43 43 #define RK3288_WIN0_FADING_CTRL 0x0068 44 + #define RK3288_WIN0_CTRL2 0x006c 44 45 45 46 /* win1 register */ 46 47 #define RK3288_WIN1_CTRL0 0x0070 ··· 123 122 #define RK3288_DSP_VACT_ST_END_F1 0x019c 124 123 /* register definition end */ 125 124 125 + /* rk3368 register definition */ 126 + #define RK3368_REG_CFG_DONE 0x0000 127 + #define RK3368_VERSION_INFO 0x0004 128 + #define RK3368_SYS_CTRL 0x0008 129 + #define RK3368_SYS_CTRL1 0x000c 130 + #define RK3368_DSP_CTRL0 0x0010 131 + #define RK3368_DSP_CTRL1 0x0014 132 + #define RK3368_DSP_BG 0x0018 133 + #define RK3368_MCU_CTRL 0x001c 134 + #define RK3368_LINE_FLAG 0x0020 135 + #define RK3368_INTR_EN 0x0024 136 + #define RK3368_INTR_CLEAR 0x0028 137 + #define RK3368_INTR_STATUS 0x002c 138 + #define RK3368_WIN0_CTRL0 0x0030 139 + #define RK3368_WIN0_CTRL1 0x0034 140 + #define RK3368_WIN0_COLOR_KEY 0x0038 141 + #define RK3368_WIN0_VIR 0x003c 142 + #define RK3368_WIN0_YRGB_MST 0x0040 143 + #define RK3368_WIN0_CBR_MST 0x0044 144 + #define RK3368_WIN0_ACT_INFO 0x0048 145 + #define RK3368_WIN0_DSP_INFO 0x004c 146 + #define RK3368_WIN0_DSP_ST 0x0050 147 + #define RK3368_WIN0_SCL_FACTOR_YRGB 0x0054 148 + #define RK3368_WIN0_SCL_FACTOR_CBR 0x0058 149 + #define RK3368_WIN0_SCL_OFFSET 0x005c 150 + #define RK3368_WIN0_SRC_ALPHA_CTRL 0x0060 151 + #define RK3368_WIN0_DST_ALPHA_CTRL 0x0064 152 + #define RK3368_WIN0_FADING_CTRL 0x0068 153 + #define RK3368_WIN0_CTRL2 0x006c 154 + #define RK3368_WIN1_CTRL0 0x0070 155 + #define RK3368_WIN1_CTRL1 0x0074 156 + #define RK3368_WIN1_COLOR_KEY 0x0078 157 + #define RK3368_WIN1_VIR 0x007c 158 + #define RK3368_WIN1_YRGB_MST 0x0080 159 + #define RK3368_WIN1_CBR_MST 0x0084 160 + #define RK3368_WIN1_ACT_INFO 0x0088 161 + #define RK3368_WIN1_DSP_INFO 0x008c 162 + #define RK3368_WIN1_DSP_ST 0x0090 163 + #define RK3368_WIN1_SCL_FACTOR_YRGB 0x0094 164 + #define RK3368_WIN1_SCL_FACTOR_CBR 0x0098 165 + #define RK3368_WIN1_SCL_OFFSET 0x009c 166 + #define RK3368_WIN1_SRC_ALPHA_CTRL 0x00a0 167 + #define RK3368_WIN1_DST_ALPHA_CTRL 0x00a4 168 + #define RK3368_WIN1_FADING_CTRL 0x00a8 169 + #define RK3368_WIN1_CTRL2 0x00ac 170 + #define RK3368_WIN2_CTRL0 0x00b0 171 + #define RK3368_WIN2_CTRL1 0x00b4 172 + #define RK3368_WIN2_VIR0_1 0x00b8 173 + #define RK3368_WIN2_VIR2_3 0x00bc 174 + #define RK3368_WIN2_MST0 0x00c0 175 + #define RK3368_WIN2_DSP_INFO0 0x00c4 176 + #define RK3368_WIN2_DSP_ST0 0x00c8 177 + #define RK3368_WIN2_COLOR_KEY 0x00cc 178 + #define RK3368_WIN2_MST1 0x00d0 179 + #define RK3368_WIN2_DSP_INFO1 0x00d4 180 + #define RK3368_WIN2_DSP_ST1 0x00d8 181 + #define RK3368_WIN2_SRC_ALPHA_CTRL 0x00dc 182 + #define RK3368_WIN2_MST2 0x00e0 183 + #define RK3368_WIN2_DSP_INFO2 0x00e4 184 + #define RK3368_WIN2_DSP_ST2 0x00e8 185 + #define RK3368_WIN2_DST_ALPHA_CTRL 0x00ec 186 + #define RK3368_WIN2_MST3 0x00f0 187 + #define RK3368_WIN2_DSP_INFO3 0x00f4 188 + #define RK3368_WIN2_DSP_ST3 0x00f8 189 + #define RK3368_WIN2_FADING_CTRL 0x00fc 190 + #define RK3368_WIN3_CTRL0 0x0100 191 + #define RK3368_WIN3_CTRL1 0x0104 192 + #define RK3368_WIN3_VIR0_1 0x0108 193 + #define RK3368_WIN3_VIR2_3 0x010c 194 + #define RK3368_WIN3_MST0 0x0110 195 + #define RK3368_WIN3_DSP_INFO0 0x0114 196 + #define RK3368_WIN3_DSP_ST0 0x0118 197 + #define RK3368_WIN3_COLOR_KEY 0x011c 198 + #define RK3368_WIN3_MST1 0x0120 199 + #define RK3368_WIN3_DSP_INFO1 0x0124 200 + #define RK3368_WIN3_DSP_ST1 0x0128 201 + #define RK3368_WIN3_SRC_ALPHA_CTRL 0x012c 202 + #define RK3368_WIN3_MST2 0x0130 203 + #define RK3368_WIN3_DSP_INFO2 0x0134 204 + #define RK3368_WIN3_DSP_ST2 0x0138 205 + #define RK3368_WIN3_DST_ALPHA_CTRL 0x013c 206 + #define RK3368_WIN3_MST3 0x0140 207 + #define RK3368_WIN3_DSP_INFO3 0x0144 208 + #define RK3368_WIN3_DSP_ST3 0x0148 209 + #define RK3368_WIN3_FADING_CTRL 0x014c 210 + #define RK3368_HWC_CTRL0 0x0150 211 + #define RK3368_HWC_CTRL1 0x0154 212 + #define RK3368_HWC_MST 0x0158 213 + #define RK3368_HWC_DSP_ST 0x015c 214 + #define RK3368_HWC_SRC_ALPHA_CTRL 0x0160 215 + #define RK3368_HWC_DST_ALPHA_CTRL 0x0164 216 + #define RK3368_HWC_FADING_CTRL 0x0168 217 + #define RK3368_HWC_RESERVED1 0x016c 218 + #define RK3368_POST_DSP_HACT_INFO 0x0170 219 + #define RK3368_POST_DSP_VACT_INFO 0x0174 220 + #define RK3368_POST_SCL_FACTOR_YRGB 0x0178 221 + #define RK3368_POST_RESERVED 0x017c 222 + #define RK3368_POST_SCL_CTRL 0x0180 223 + #define RK3368_POST_DSP_VACT_INFO_F1 0x0184 224 + #define RK3368_DSP_HTOTAL_HS_END 0x0188 225 + #define RK3368_DSP_HACT_ST_END 0x018c 226 + #define RK3368_DSP_VTOTAL_VS_END 0x0190 227 + #define RK3368_DSP_VACT_ST_END 0x0194 228 + #define RK3368_DSP_VS_ST_END_F1 0x0198 229 + #define RK3368_DSP_VACT_ST_END_F1 0x019c 230 + #define RK3368_PWM_CTRL 0x01a0 231 + #define RK3368_PWM_PERIOD_HPR 0x01a4 232 + #define RK3368_PWM_DUTY_LPR 0x01a8 233 + #define RK3368_PWM_CNT 0x01ac 234 + #define RK3368_BCSH_COLOR_BAR 0x01b0 235 + #define RK3368_BCSH_BCS 0x01b4 236 + #define RK3368_BCSH_H 0x01b8 237 + #define RK3368_BCSH_CTRL 0x01bc 238 + #define RK3368_CABC_CTRL0 0x01c0 239 + #define RK3368_CABC_CTRL1 0x01c4 240 + #define RK3368_CABC_CTRL2 0x01c8 241 + #define RK3368_CABC_CTRL3 0x01cc 242 + #define RK3368_CABC_GAUSS_LINE0_0 0x01d0 243 + #define RK3368_CABC_GAUSS_LINE0_1 0x01d4 244 + #define RK3368_CABC_GAUSS_LINE1_0 0x01d8 245 + #define RK3368_CABC_GAUSS_LINE1_1 0x01dc 246 + #define RK3368_CABC_GAUSS_LINE2_0 0x01e0 247 + #define RK3368_CABC_GAUSS_LINE2_1 0x01e4 248 + #define RK3368_FRC_LOWER01_0 0x01e8 249 + #define RK3368_FRC_LOWER01_1 0x01ec 250 + #define RK3368_FRC_LOWER10_0 0x01f0 251 + #define RK3368_FRC_LOWER10_1 0x01f4 252 + #define RK3368_FRC_LOWER11_0 0x01f8 253 + #define RK3368_FRC_LOWER11_1 0x01fc 254 + #define RK3368_IFBDC_CTRL 0x0200 255 + #define RK3368_IFBDC_TILES_NUM 0x0204 256 + #define RK3368_IFBDC_FRAME_RST_CYCLE 0x0208 257 + #define RK3368_IFBDC_BASE_ADDR 0x020c 258 + #define RK3368_IFBDC_MB_SIZE 0x0210 259 + #define RK3368_IFBDC_CMP_INDEX_INIT 0x0214 260 + #define RK3368_IFBDC_VIR 0x0220 261 + #define RK3368_IFBDC_DEBUG0 0x0230 262 + #define RK3368_IFBDC_DEBUG1 0x0234 263 + #define RK3368_LATENCY_CTRL0 0x0250 264 + #define RK3368_RD_MAX_LATENCY_NUM0 0x0254 265 + #define RK3368_RD_LATENCY_THR_NUM0 0x0258 266 + #define RK3368_RD_LATENCY_SAMP_NUM0 0x025c 267 + #define RK3368_WIN0_DSP_BG 0x0260 268 + #define RK3368_WIN1_DSP_BG 0x0264 269 + #define RK3368_WIN2_DSP_BG 0x0268 270 + #define RK3368_WIN3_DSP_BG 0x026c 271 + #define RK3368_SCAN_LINE_NUM 0x0270 272 + #define RK3368_CABC_DEBUG0 0x0274 273 + #define RK3368_CABC_DEBUG1 0x0278 274 + #define RK3368_CABC_DEBUG2 0x027c 275 + #define RK3368_DBG_REG_000 0x0280 276 + #define RK3368_DBG_REG_001 0x0284 277 + #define RK3368_DBG_REG_002 0x0288 278 + #define RK3368_DBG_REG_003 0x028c 279 + #define RK3368_DBG_REG_004 0x0290 280 + #define RK3368_DBG_REG_005 0x0294 281 + #define RK3368_DBG_REG_006 0x0298 282 + #define RK3368_DBG_REG_007 0x029c 283 + #define RK3368_DBG_REG_008 0x02a0 284 + #define RK3368_DBG_REG_016 0x02c0 285 + #define RK3368_DBG_REG_017 0x02c4 286 + #define RK3368_DBG_REG_018 0x02c8 287 + #define RK3368_DBG_REG_019 0x02cc 288 + #define RK3368_DBG_REG_020 0x02d0 289 + #define RK3368_DBG_REG_021 0x02d4 290 + #define RK3368_DBG_REG_022 0x02d8 291 + #define RK3368_DBG_REG_023 0x02dc 292 + #define RK3368_DBG_REG_028 0x02f0 293 + #define RK3368_MMU_DTE_ADDR 0x0300 294 + #define RK3368_MMU_STATUS 0x0304 295 + #define RK3368_MMU_COMMAND 0x0308 296 + #define RK3368_MMU_PAGE_FAULT_ADDR 0x030c 297 + #define RK3368_MMU_ZAP_ONE_LINE 0x0310 298 + #define RK3368_MMU_INT_RAWSTAT 0x0314 299 + #define RK3368_MMU_INT_CLEAR 0x0318 300 + #define RK3368_MMU_INT_MASK 0x031c 301 + #define RK3368_MMU_INT_STATUS 0x0320 302 + #define RK3368_MMU_AUTO_GATING 0x0324 303 + #define RK3368_WIN2_LUT_ADDR 0x0400 304 + #define RK3368_WIN3_LUT_ADDR 0x0800 305 + #define RK3368_HWC_LUT_ADDR 0x0c00 306 + #define RK3368_GAMMA_LUT_ADDR 0x1000 307 + #define RK3368_CABC_GAMMA_LUT_ADDR 0x1800 308 + #define RK3368_MCU_BYPASS_WPORT 0x2200 309 + #define RK3368_MCU_BYPASS_RPORT 0x2300 310 + /* rk3368 register definition end */ 311 + 312 + #define RK3366_REG_CFG_DONE 0x0000 313 + #define RK3366_VERSION_INFO 0x0004 314 + #define RK3366_SYS_CTRL 0x0008 315 + #define RK3366_SYS_CTRL1 0x000c 316 + #define RK3366_DSP_CTRL0 0x0010 317 + #define RK3366_DSP_CTRL1 0x0014 318 + #define RK3366_DSP_BG 0x0018 319 + #define RK3366_MCU_CTRL 0x001c 320 + #define RK3366_WB_CTRL0 0x0020 321 + #define RK3366_WB_CTRL1 0x0024 322 + #define RK3366_WB_YRGB_MST 0x0028 323 + #define RK3366_WB_CBR_MST 0x002c 324 + #define RK3366_WIN0_CTRL0 0x0030 325 + #define RK3366_WIN0_CTRL1 0x0034 326 + #define RK3366_WIN0_COLOR_KEY 0x0038 327 + #define RK3366_WIN0_VIR 0x003c 328 + #define RK3366_WIN0_YRGB_MST 0x0040 329 + #define RK3366_WIN0_CBR_MST 0x0044 330 + #define RK3366_WIN0_ACT_INFO 0x0048 331 + #define RK3366_WIN0_DSP_INFO 0x004c 332 + #define RK3366_WIN0_DSP_ST 0x0050 333 + #define RK3366_WIN0_SCL_FACTOR_YRGB 0x0054 334 + #define RK3366_WIN0_SCL_FACTOR_CBR 0x0058 335 + #define RK3366_WIN0_SCL_OFFSET 0x005c 336 + #define RK3366_WIN0_SRC_ALPHA_CTRL 0x0060 337 + #define RK3366_WIN0_DST_ALPHA_CTRL 0x0064 338 + #define RK3366_WIN0_FADING_CTRL 0x0068 339 + #define RK3366_WIN0_CTRL2 0x006c 340 + #define RK3366_WIN1_CTRL0 0x0070 341 + #define RK3366_WIN1_CTRL1 0x0074 342 + #define RK3366_WIN1_COLOR_KEY 0x0078 343 + #define RK3366_WIN1_VIR 0x007c 344 + #define RK3366_WIN1_YRGB_MST 0x0080 345 + #define RK3366_WIN1_CBR_MST 0x0084 346 + #define RK3366_WIN1_ACT_INFO 0x0088 347 + #define RK3366_WIN1_DSP_INFO 0x008c 348 + #define RK3366_WIN1_DSP_ST 0x0090 349 + #define RK3366_WIN1_SCL_FACTOR_YRGB 0x0094 350 + #define RK3366_WIN1_SCL_FACTOR_CBR 0x0098 351 + #define RK3366_WIN1_SCL_OFFSET 0x009c 352 + #define RK3366_WIN1_SRC_ALPHA_CTRL 0x00a0 353 + #define RK3366_WIN1_DST_ALPHA_CTRL 0x00a4 354 + #define RK3366_WIN1_FADING_CTRL 0x00a8 355 + #define RK3366_WIN1_CTRL2 0x00ac 356 + #define RK3366_WIN2_CTRL0 0x00b0 357 + #define RK3366_WIN2_CTRL1 0x00b4 358 + #define RK3366_WIN2_VIR0_1 0x00b8 359 + #define RK3366_WIN2_VIR2_3 0x00bc 360 + #define RK3366_WIN2_MST0 0x00c0 361 + #define RK3366_WIN2_DSP_INFO0 0x00c4 362 + #define RK3366_WIN2_DSP_ST0 0x00c8 363 + #define RK3366_WIN2_COLOR_KEY 0x00cc 364 + #define RK3366_WIN2_MST1 0x00d0 365 + #define RK3366_WIN2_DSP_INFO1 0x00d4 366 + #define RK3366_WIN2_DSP_ST1 0x00d8 367 + #define RK3366_WIN2_SRC_ALPHA_CTRL 0x00dc 368 + #define RK3366_WIN2_MST2 0x00e0 369 + #define RK3366_WIN2_DSP_INFO2 0x00e4 370 + #define RK3366_WIN2_DSP_ST2 0x00e8 371 + #define RK3366_WIN2_DST_ALPHA_CTRL 0x00ec 372 + #define RK3366_WIN2_MST3 0x00f0 373 + #define RK3366_WIN2_DSP_INFO3 0x00f4 374 + #define RK3366_WIN2_DSP_ST3 0x00f8 375 + #define RK3366_WIN2_FADING_CTRL 0x00fc 376 + #define RK3366_WIN3_CTRL0 0x0100 377 + #define RK3366_WIN3_CTRL1 0x0104 378 + #define RK3366_WIN3_VIR0_1 0x0108 379 + #define RK3366_WIN3_VIR2_3 0x010c 380 + #define RK3366_WIN3_MST0 0x0110 381 + #define RK3366_WIN3_DSP_INFO0 0x0114 382 + #define RK3366_WIN3_DSP_ST0 0x0118 383 + #define RK3366_WIN3_COLOR_KEY 0x011c 384 + #define RK3366_WIN3_MST1 0x0120 385 + #define RK3366_WIN3_DSP_INFO1 0x0124 386 + #define RK3366_WIN3_DSP_ST1 0x0128 387 + #define RK3366_WIN3_SRC_ALPHA_CTRL 0x012c 388 + #define RK3366_WIN3_MST2 0x0130 389 + #define RK3366_WIN3_DSP_INFO2 0x0134 390 + #define RK3366_WIN3_DSP_ST2 0x0138 391 + #define RK3366_WIN3_DST_ALPHA_CTRL 0x013c 392 + #define RK3366_WIN3_MST3 0x0140 393 + #define RK3366_WIN3_DSP_INFO3 0x0144 394 + #define RK3366_WIN3_DSP_ST3 0x0148 395 + #define RK3366_WIN3_FADING_CTRL 0x014c 396 + #define RK3366_HWC_CTRL0 0x0150 397 + #define RK3366_HWC_CTRL1 0x0154 398 + #define RK3366_HWC_MST 0x0158 399 + #define RK3366_HWC_DSP_ST 0x015c 400 + #define RK3366_HWC_SRC_ALPHA_CTRL 0x0160 401 + #define RK3366_HWC_DST_ALPHA_CTRL 0x0164 402 + #define RK3366_HWC_FADING_CTRL 0x0168 403 + #define RK3366_HWC_RESERVED1 0x016c 404 + #define RK3366_POST_DSP_HACT_INFO 0x0170 405 + #define RK3366_POST_DSP_VACT_INFO 0x0174 406 + #define RK3366_POST_SCL_FACTOR_YRGB 0x0178 407 + #define RK3366_POST_RESERVED 0x017c 408 + #define RK3366_POST_SCL_CTRL 0x0180 409 + #define RK3366_POST_DSP_VACT_INFO_F1 0x0184 410 + #define RK3366_DSP_HTOTAL_HS_END 0x0188 411 + #define RK3366_DSP_HACT_ST_END 0x018c 412 + #define RK3366_DSP_VTOTAL_VS_END 0x0190 413 + #define RK3366_DSP_VACT_ST_END 0x0194 414 + #define RK3366_DSP_VS_ST_END_F1 0x0198 415 + #define RK3366_DSP_VACT_ST_END_F1 0x019c 416 + #define RK3366_PWM_CTRL 0x01a0 417 + #define RK3366_PWM_PERIOD_HPR 0x01a4 418 + #define RK3366_PWM_DUTY_LPR 0x01a8 419 + #define RK3366_PWM_CNT 0x01ac 420 + #define RK3366_BCSH_COLOR_BAR 0x01b0 421 + #define RK3366_BCSH_BCS 0x01b4 422 + #define RK3366_BCSH_H 0x01b8 423 + #define RK3366_BCSH_CTRL 0x01bc 424 + #define RK3366_CABC_CTRL0 0x01c0 425 + #define RK3366_CABC_CTRL1 0x01c4 426 + #define RK3366_CABC_CTRL2 0x01c8 427 + #define RK3366_CABC_CTRL3 0x01cc 428 + #define RK3366_CABC_GAUSS_LINE0_0 0x01d0 429 + #define RK3366_CABC_GAUSS_LINE0_1 0x01d4 430 + #define RK3366_CABC_GAUSS_LINE1_0 0x01d8 431 + #define RK3366_CABC_GAUSS_LINE1_1 0x01dc 432 + #define RK3366_CABC_GAUSS_LINE2_0 0x01e0 433 + #define RK3366_CABC_GAUSS_LINE2_1 0x01e4 434 + #define RK3366_FRC_LOWER01_0 0x01e8 435 + #define RK3366_FRC_LOWER01_1 0x01ec 436 + #define RK3366_FRC_LOWER10_0 0x01f0 437 + #define RK3366_FRC_LOWER10_1 0x01f4 438 + #define RK3366_FRC_LOWER11_0 0x01f8 439 + #define RK3366_FRC_LOWER11_1 0x01fc 440 + #define RK3366_INTR_EN0 0x0280 441 + #define RK3366_INTR_CLEAR0 0x0284 442 + #define RK3366_INTR_STATUS0 0x0288 443 + #define RK3366_INTR_RAW_STATUS0 0x028c 444 + #define RK3366_INTR_EN1 0x0290 445 + #define RK3366_INTR_CLEAR1 0x0294 446 + #define RK3366_INTR_STATUS1 0x0298 447 + #define RK3366_INTR_RAW_STATUS1 0x029c 448 + #define RK3366_LINE_FLAG 0x02a0 449 + #define RK3366_VOP_STATUS 0x02a4 450 + #define RK3366_BLANKING_VALUE 0x02a8 451 + #define RK3366_WIN0_DSP_BG 0x02b0 452 + #define RK3366_WIN1_DSP_BG 0x02b4 453 + #define RK3366_WIN2_DSP_BG 0x02b8 454 + #define RK3366_WIN3_DSP_BG 0x02bc 455 + #define RK3366_WIN2_LUT_ADDR 0x0400 456 + #define RK3366_WIN3_LUT_ADDR 0x0800 457 + #define RK3366_HWC_LUT_ADDR 0x0c00 458 + #define RK3366_GAMMA0_LUT_ADDR 0x1000 459 + #define RK3366_GAMMA1_LUT_ADDR 0x1400 460 + #define RK3366_CABC_GAMMA_LUT_ADDR 0x1800 461 + #define RK3366_MCU_BYPASS_WPORT 0x2200 462 + #define RK3366_MCU_BYPASS_RPORT 0x2300 463 + #define RK3366_MMU_DTE_ADDR 0x2400 464 + #define RK3366_MMU_STATUS 0x2404 465 + #define RK3366_MMU_COMMAND 0x2408 466 + #define RK3366_MMU_PAGE_FAULT_ADDR 0x240c 467 + #define RK3366_MMU_ZAP_ONE_LINE 0x2410 468 + #define RK3366_MMU_INT_RAWSTAT 0x2414 469 + #define RK3366_MMU_INT_CLEAR 0x2418 470 + #define RK3366_MMU_INT_MASK 0x241c 471 + #define RK3366_MMU_INT_STATUS 0x2420 472 + #define RK3366_MMU_AUTO_GATING 0x2424 473 + 474 + /* rk3399 register definition */ 475 + #define RK3399_REG_CFG_DONE 0x0000 476 + #define RK3399_VERSION_INFO 0x0004 477 + #define RK3399_SYS_CTRL 0x0008 478 + #define RK3399_SYS_CTRL1 0x000c 479 + #define RK3399_DSP_CTRL0 0x0010 480 + #define RK3399_DSP_CTRL1 0x0014 481 + #define RK3399_DSP_BG 0x0018 482 + #define RK3399_MCU_CTRL 0x001c 483 + #define RK3399_WB_CTRL0 0x0020 484 + #define RK3399_WB_CTRL1 0x0024 485 + #define RK3399_WB_YRGB_MST 0x0028 486 + #define RK3399_WB_CBR_MST 0x002c 487 + #define RK3399_WIN0_CTRL0 0x0030 488 + #define RK3399_WIN0_CTRL1 0x0034 489 + #define RK3399_WIN0_COLOR_KEY 0x0038 490 + #define RK3399_WIN0_VIR 0x003c 491 + #define RK3399_WIN0_YRGB_MST 0x0040 492 + #define RK3399_WIN0_CBR_MST 0x0044 493 + #define RK3399_WIN0_ACT_INFO 0x0048 494 + #define RK3399_WIN0_DSP_INFO 0x004c 495 + #define RK3399_WIN0_DSP_ST 0x0050 496 + #define RK3399_WIN0_SCL_FACTOR_YRGB 0x0054 497 + #define RK3399_WIN0_SCL_FACTOR_CBR 0x0058 498 + #define RK3399_WIN0_SCL_OFFSET 0x005c 499 + #define RK3399_WIN0_SRC_ALPHA_CTRL 0x0060 500 + #define RK3399_WIN0_DST_ALPHA_CTRL 0x0064 501 + #define RK3399_WIN0_FADING_CTRL 0x0068 502 + #define RK3399_WIN0_CTRL2 0x006c 503 + #define RK3399_WIN1_CTRL0 0x0070 504 + #define RK3399_WIN1_CTRL1 0x0074 505 + #define RK3399_WIN1_COLOR_KEY 0x0078 506 + #define RK3399_WIN1_VIR 0x007c 507 + #define RK3399_WIN1_YRGB_MST 0x0080 508 + #define RK3399_WIN1_CBR_MST 0x0084 509 + #define RK3399_WIN1_ACT_INFO 0x0088 510 + #define RK3399_WIN1_DSP_INFO 0x008c 511 + #define RK3399_WIN1_DSP_ST 0x0090 512 + #define RK3399_WIN1_SCL_FACTOR_YRGB 0x0094 513 + #define RK3399_WIN1_SCL_FACTOR_CBR 0x0098 514 + #define RK3399_WIN1_SCL_OFFSET 0x009c 515 + #define RK3399_WIN1_SRC_ALPHA_CTRL 0x00a0 516 + #define RK3399_WIN1_DST_ALPHA_CTRL 0x00a4 517 + #define RK3399_WIN1_FADING_CTRL 0x00a8 518 + #define RK3399_WIN1_CTRL2 0x00ac 519 + #define RK3399_WIN2_CTRL0 0x00b0 520 + #define RK3399_WIN2_CTRL1 0x00b4 521 + #define RK3399_WIN2_VIR0_1 0x00b8 522 + #define RK3399_WIN2_VIR2_3 0x00bc 523 + #define RK3399_WIN2_MST0 0x00c0 524 + #define RK3399_WIN2_DSP_INFO0 0x00c4 525 + #define RK3399_WIN2_DSP_ST0 0x00c8 526 + #define RK3399_WIN2_COLOR_KEY 0x00cc 527 + #define RK3399_WIN2_MST1 0x00d0 528 + #define RK3399_WIN2_DSP_INFO1 0x00d4 529 + #define RK3399_WIN2_DSP_ST1 0x00d8 530 + #define RK3399_WIN2_SRC_ALPHA_CTRL 0x00dc 531 + #define RK3399_WIN2_MST2 0x00e0 532 + #define RK3399_WIN2_DSP_INFO2 0x00e4 533 + #define RK3399_WIN2_DSP_ST2 0x00e8 534 + #define RK3399_WIN2_DST_ALPHA_CTRL 0x00ec 535 + #define RK3399_WIN2_MST3 0x00f0 536 + #define RK3399_WIN2_DSP_INFO3 0x00f4 537 + #define RK3399_WIN2_DSP_ST3 0x00f8 538 + #define RK3399_WIN2_FADING_CTRL 0x00fc 539 + #define RK3399_WIN3_CTRL0 0x0100 540 + #define RK3399_WIN3_CTRL1 0x0104 541 + #define RK3399_WIN3_VIR0_1 0x0108 542 + #define RK3399_WIN3_VIR2_3 0x010c 543 + #define RK3399_WIN3_MST0 0x0110 544 + #define RK3399_WIN3_DSP_INFO0 0x0114 545 + #define RK3399_WIN3_DSP_ST0 0x0118 546 + #define RK3399_WIN3_COLOR_KEY 0x011c 547 + #define RK3399_WIN3_MST1 0x0120 548 + #define RK3399_WIN3_DSP_INFO1 0x0124 549 + #define RK3399_WIN3_DSP_ST1 0x0128 550 + #define RK3399_WIN3_SRC_ALPHA_CTRL 0x012c 551 + #define RK3399_WIN3_MST2 0x0130 552 + #define RK3399_WIN3_DSP_INFO2 0x0134 553 + #define RK3399_WIN3_DSP_ST2 0x0138 554 + #define RK3399_WIN3_DST_ALPHA_CTRL 0x013c 555 + #define RK3399_WIN3_MST3 0x0140 556 + #define RK3399_WIN3_DSP_INFO3 0x0144 557 + #define RK3399_WIN3_DSP_ST3 0x0148 558 + #define RK3399_WIN3_FADING_CTRL 0x014c 559 + #define RK3399_HWC_CTRL0 0x0150 560 + #define RK3399_HWC_CTRL1 0x0154 561 + #define RK3399_HWC_MST 0x0158 562 + #define RK3399_HWC_DSP_ST 0x015c 563 + #define RK3399_HWC_SRC_ALPHA_CTRL 0x0160 564 + #define RK3399_HWC_DST_ALPHA_CTRL 0x0164 565 + #define RK3399_HWC_FADING_CTRL 0x0168 566 + #define RK3399_HWC_RESERVED1 0x016c 567 + #define RK3399_POST_DSP_HACT_INFO 0x0170 568 + #define RK3399_POST_DSP_VACT_INFO 0x0174 569 + #define RK3399_POST_SCL_FACTOR_YRGB 0x0178 570 + #define RK3399_POST_RESERVED 0x017c 571 + #define RK3399_POST_SCL_CTRL 0x0180 572 + #define RK3399_POST_DSP_VACT_INFO_F1 0x0184 573 + #define RK3399_DSP_HTOTAL_HS_END 0x0188 574 + #define RK3399_DSP_HACT_ST_END 0x018c 575 + #define RK3399_DSP_VTOTAL_VS_END 0x0190 576 + #define RK3399_DSP_VACT_ST_END 0x0194 577 + #define RK3399_DSP_VS_ST_END_F1 0x0198 578 + #define RK3399_DSP_VACT_ST_END_F1 0x019c 579 + #define RK3399_PWM_CTRL 0x01a0 580 + #define RK3399_PWM_PERIOD_HPR 0x01a4 581 + #define RK3399_PWM_DUTY_LPR 0x01a8 582 + #define RK3399_PWM_CNT 0x01ac 583 + #define RK3399_BCSH_COLOR_BAR 0x01b0 584 + #define RK3399_BCSH_BCS 0x01b4 585 + #define RK3399_BCSH_H 0x01b8 586 + #define RK3399_BCSH_CTRL 0x01bc 587 + #define RK3399_CABC_CTRL0 0x01c0 588 + #define RK3399_CABC_CTRL1 0x01c4 589 + #define RK3399_CABC_CTRL2 0x01c8 590 + #define RK3399_CABC_CTRL3 0x01cc 591 + #define RK3399_CABC_GAUSS_LINE0_0 0x01d0 592 + #define RK3399_CABC_GAUSS_LINE0_1 0x01d4 593 + #define RK3399_CABC_GAUSS_LINE1_0 0x01d8 594 + #define RK3399_CABC_GAUSS_LINE1_1 0x01dc 595 + #define RK3399_CABC_GAUSS_LINE2_0 0x01e0 596 + #define RK3399_CABC_GAUSS_LINE2_1 0x01e4 597 + #define RK3399_FRC_LOWER01_0 0x01e8 598 + #define RK3399_FRC_LOWER01_1 0x01ec 599 + #define RK3399_FRC_LOWER10_0 0x01f0 600 + #define RK3399_FRC_LOWER10_1 0x01f4 601 + #define RK3399_FRC_LOWER11_0 0x01f8 602 + #define RK3399_FRC_LOWER11_1 0x01fc 603 + #define RK3399_AFBCD0_CTRL 0x0200 604 + #define RK3399_AFBCD0_HDR_PTR 0x0204 605 + #define RK3399_AFBCD0_PIC_SIZE 0x0208 606 + #define RK3399_AFBCD0_STATUS 0x020c 607 + #define RK3399_AFBCD1_CTRL 0x0220 608 + #define RK3399_AFBCD1_HDR_PTR 0x0224 609 + #define RK3399_AFBCD1_PIC_SIZE 0x0228 610 + #define RK3399_AFBCD1_STATUS 0x022c 611 + #define RK3399_AFBCD2_CTRL 0x0240 612 + #define RK3399_AFBCD2_HDR_PTR 0x0244 613 + #define RK3399_AFBCD2_PIC_SIZE 0x0248 614 + #define RK3399_AFBCD2_STATUS 0x024c 615 + #define RK3399_AFBCD3_CTRL 0x0260 616 + #define RK3399_AFBCD3_HDR_PTR 0x0264 617 + #define RK3399_AFBCD3_PIC_SIZE 0x0268 618 + #define RK3399_AFBCD3_STATUS 0x026c 619 + #define RK3399_INTR_EN0 0x0280 620 + #define RK3399_INTR_CLEAR0 0x0284 621 + #define RK3399_INTR_STATUS0 0x0288 622 + #define RK3399_INTR_RAW_STATUS0 0x028c 623 + #define RK3399_INTR_EN1 0x0290 624 + #define RK3399_INTR_CLEAR1 0x0294 625 + #define RK3399_INTR_STATUS1 0x0298 626 + #define RK3399_INTR_RAW_STATUS1 0x029c 627 + #define RK3399_LINE_FLAG 0x02a0 628 + #define RK3399_VOP_STATUS 0x02a4 629 + #define RK3399_BLANKING_VALUE 0x02a8 630 + #define RK3399_MCU_BYPASS_PORT 0x02ac 631 + #define RK3399_WIN0_DSP_BG 0x02b0 632 + #define RK3399_WIN1_DSP_BG 0x02b4 633 + #define RK3399_WIN2_DSP_BG 0x02b8 634 + #define RK3399_WIN3_DSP_BG 0x02bc 635 + #define RK3399_YUV2YUV_WIN 0x02c0 636 + #define RK3399_YUV2YUV_POST 0x02c4 637 + #define RK3399_AUTO_GATING_EN 0x02cc 638 + #define RK3399_WIN0_CSC_COE 0x03a0 639 + #define RK3399_WIN1_CSC_COE 0x03c0 640 + #define RK3399_WIN2_CSC_COE 0x03e0 641 + #define RK3399_WIN3_CSC_COE 0x0400 642 + #define RK3399_HWC_CSC_COE 0x0420 643 + #define RK3399_BCSH_R2Y_CSC_COE 0x0440 644 + #define RK3399_BCSH_Y2R_CSC_COE 0x0460 645 + #define RK3399_POST_YUV2YUV_Y2R_COE 0x0480 646 + #define RK3399_POST_YUV2YUV_3X3_COE 0x04a0 647 + #define RK3399_POST_YUV2YUV_R2Y_COE 0x04c0 648 + #define RK3399_WIN0_YUV2YUV_Y2R 0x04e0 649 + #define RK3399_WIN0_YUV2YUV_3X3 0x0500 650 + #define RK3399_WIN0_YUV2YUV_R2Y 0x0520 651 + #define RK3399_WIN1_YUV2YUV_Y2R 0x0540 652 + #define RK3399_WIN1_YUV2YUV_3X3 0x0560 653 + #define RK3399_WIN1_YUV2YUV_R2Y 0x0580 654 + #define RK3399_WIN2_YUV2YUV_Y2R 0x05a0 655 + #define RK3399_WIN2_YUV2YUV_3X3 0x05c0 656 + #define RK3399_WIN2_YUV2YUV_R2Y 0x05e0 657 + #define RK3399_WIN3_YUV2YUV_Y2R 0x0600 658 + #define RK3399_WIN3_YUV2YUV_3X3 0x0620 659 + #define RK3399_WIN3_YUV2YUV_R2Y 0x0640 660 + #define RK3399_WIN2_LUT_ADDR 0x1000 661 + #define RK3399_WIN3_LUT_ADDR 0x1400 662 + #define RK3399_HWC_LUT_ADDR 0x1800 663 + #define RK3399_CABC_GAMMA_LUT_ADDR 0x1c00 664 + #define RK3399_GAMMA_LUT_ADDR 0x2000 665 + /* rk3399 register definition end */ 666 + 667 + /* rk3328 register definition end */ 668 + #define RK3328_REG_CFG_DONE 0x00000000 669 + #define RK3328_VERSION_INFO 0x00000004 670 + #define RK3328_SYS_CTRL 0x00000008 671 + #define RK3328_SYS_CTRL1 0x0000000c 672 + #define RK3328_DSP_CTRL0 0x00000010 673 + #define RK3328_DSP_CTRL1 0x00000014 674 + #define RK3328_DSP_BG 0x00000018 675 + #define RK3328_AUTO_GATING_EN 0x0000003c 676 + #define RK3328_LINE_FLAG 0x00000040 677 + #define RK3328_VOP_STATUS 0x00000044 678 + #define RK3328_BLANKING_VALUE 0x00000048 679 + #define RK3328_WIN0_DSP_BG 0x00000050 680 + #define RK3328_WIN1_DSP_BG 0x00000054 681 + #define RK3328_DBG_PERF_LATENCY_CTRL0 0x000000c0 682 + #define RK3328_DBG_PERF_RD_MAX_LATENCY_NUM0 0x000000c4 683 + #define RK3328_DBG_PERF_RD_LATENCY_THR_NUM0 0x000000c8 684 + #define RK3328_DBG_PERF_RD_LATENCY_SAMP_NUM0 0x000000cc 685 + #define RK3328_INTR_EN0 0x000000e0 686 + #define RK3328_INTR_CLEAR0 0x000000e4 687 + #define RK3328_INTR_STATUS0 0x000000e8 688 + #define RK3328_INTR_RAW_STATUS0 0x000000ec 689 + #define RK3328_INTR_EN1 0x000000f0 690 + #define RK3328_INTR_CLEAR1 0x000000f4 691 + #define RK3328_INTR_STATUS1 0x000000f8 692 + #define RK3328_INTR_RAW_STATUS1 0x000000fc 693 + #define RK3328_WIN0_CTRL0 0x00000100 694 + #define RK3328_WIN0_CTRL1 0x00000104 695 + #define RK3328_WIN0_COLOR_KEY 0x00000108 696 + #define RK3328_WIN0_VIR 0x0000010c 697 + #define RK3328_WIN0_YRGB_MST 0x00000110 698 + #define RK3328_WIN0_CBR_MST 0x00000114 699 + #define RK3328_WIN0_ACT_INFO 0x00000118 700 + #define RK3328_WIN0_DSP_INFO 0x0000011c 701 + #define RK3328_WIN0_DSP_ST 0x00000120 702 + #define RK3328_WIN0_SCL_FACTOR_YRGB 0x00000124 703 + #define RK3328_WIN0_SCL_FACTOR_CBR 0x00000128 704 + #define RK3328_WIN0_SCL_OFFSET 0x0000012c 705 + #define RK3328_WIN0_SRC_ALPHA_CTRL 0x00000130 706 + #define RK3328_WIN0_DST_ALPHA_CTRL 0x00000134 707 + #define RK3328_WIN0_FADING_CTRL 0x00000138 708 + #define RK3328_WIN0_CTRL2 0x0000013c 709 + #define RK3328_DBG_WIN0_REG0 0x000001f0 710 + #define RK3328_DBG_WIN0_REG1 0x000001f4 711 + #define RK3328_DBG_WIN0_REG2 0x000001f8 712 + #define RK3328_DBG_WIN0_RESERVED 0x000001fc 713 + #define RK3328_WIN1_CTRL0 0x00000200 714 + #define RK3328_WIN1_CTRL1 0x00000204 715 + #define RK3328_WIN1_COLOR_KEY 0x00000208 716 + #define RK3328_WIN1_VIR 0x0000020c 717 + #define RK3328_WIN1_YRGB_MST 0x00000210 718 + #define RK3328_WIN1_CBR_MST 0x00000214 719 + #define RK3328_WIN1_ACT_INFO 0x00000218 720 + #define RK3328_WIN1_DSP_INFO 0x0000021c 721 + #define RK3328_WIN1_DSP_ST 0x00000220 722 + #define RK3328_WIN1_SCL_FACTOR_YRGB 0x00000224 723 + #define RK3328_WIN1_SCL_FACTOR_CBR 0x00000228 724 + #define RK3328_WIN1_SCL_OFFSET 0x0000022c 725 + #define RK3328_WIN1_SRC_ALPHA_CTRL 0x00000230 726 + #define RK3328_WIN1_DST_ALPHA_CTRL 0x00000234 727 + #define RK3328_WIN1_FADING_CTRL 0x00000238 728 + #define RK3328_WIN1_CTRL2 0x0000023c 729 + #define RK3328_DBG_WIN1_REG0 0x000002f0 730 + #define RK3328_DBG_WIN1_REG1 0x000002f4 731 + #define RK3328_DBG_WIN1_REG2 0x000002f8 732 + #define RK3328_DBG_WIN1_RESERVED 0x000002fc 733 + #define RK3328_WIN2_CTRL0 0x00000300 734 + #define RK3328_WIN2_CTRL1 0x00000304 735 + #define RK3328_WIN2_COLOR_KEY 0x00000308 736 + #define RK3328_WIN2_VIR 0x0000030c 737 + #define RK3328_WIN2_YRGB_MST 0x00000310 738 + #define RK3328_WIN2_CBR_MST 0x00000314 739 + #define RK3328_WIN2_ACT_INFO 0x00000318 740 + #define RK3328_WIN2_DSP_INFO 0x0000031c 741 + #define RK3328_WIN2_DSP_ST 0x00000320 742 + #define RK3328_WIN2_SCL_FACTOR_YRGB 0x00000324 743 + #define RK3328_WIN2_SCL_FACTOR_CBR 0x00000328 744 + #define RK3328_WIN2_SCL_OFFSET 0x0000032c 745 + #define RK3328_WIN2_SRC_ALPHA_CTRL 0x00000330 746 + #define RK3328_WIN2_DST_ALPHA_CTRL 0x00000334 747 + #define RK3328_WIN2_FADING_CTRL 0x00000338 748 + #define RK3328_WIN2_CTRL2 0x0000033c 749 + #define RK3328_DBG_WIN2_REG0 0x000003f0 750 + #define RK3328_DBG_WIN2_REG1 0x000003f4 751 + #define RK3328_DBG_WIN2_REG2 0x000003f8 752 + #define RK3328_DBG_WIN2_RESERVED 0x000003fc 753 + #define RK3328_WIN3_CTRL0 0x00000400 754 + #define RK3328_WIN3_CTRL1 0x00000404 755 + #define RK3328_WIN3_COLOR_KEY 0x00000408 756 + #define RK3328_WIN3_VIR 0x0000040c 757 + #define RK3328_WIN3_YRGB_MST 0x00000410 758 + #define RK3328_WIN3_CBR_MST 0x00000414 759 + #define RK3328_WIN3_ACT_INFO 0x00000418 760 + #define RK3328_WIN3_DSP_INFO 0x0000041c 761 + #define RK3328_WIN3_DSP_ST 0x00000420 762 + #define RK3328_WIN3_SCL_FACTOR_YRGB 0x00000424 763 + #define RK3328_WIN3_SCL_FACTOR_CBR 0x00000428 764 + #define RK3328_WIN3_SCL_OFFSET 0x0000042c 765 + #define RK3328_WIN3_SRC_ALPHA_CTRL 0x00000430 766 + #define RK3328_WIN3_DST_ALPHA_CTRL 0x00000434 767 + #define RK3328_WIN3_FADING_CTRL 0x00000438 768 + #define RK3328_WIN3_CTRL2 0x0000043c 769 + #define RK3328_DBG_WIN3_REG0 0x000004f0 770 + #define RK3328_DBG_WIN3_REG1 0x000004f4 771 + #define RK3328_DBG_WIN3_REG2 0x000004f8 772 + #define RK3328_DBG_WIN3_RESERVED 0x000004fc 773 + 774 + #define RK3328_HWC_CTRL0 0x00000500 775 + #define RK3328_HWC_CTRL1 0x00000504 776 + #define RK3328_HWC_MST 0x00000508 777 + #define RK3328_HWC_DSP_ST 0x0000050c 778 + #define RK3328_HWC_SRC_ALPHA_CTRL 0x00000510 779 + #define RK3328_HWC_DST_ALPHA_CTRL 0x00000514 780 + #define RK3328_HWC_FADING_CTRL 0x00000518 781 + #define RK3328_HWC_RESERVED1 0x0000051c 782 + #define RK3328_POST_DSP_HACT_INFO 0x00000600 783 + #define RK3328_POST_DSP_VACT_INFO 0x00000604 784 + #define RK3328_POST_SCL_FACTOR_YRGB 0x00000608 785 + #define RK3328_POST_RESERVED 0x0000060c 786 + #define RK3328_POST_SCL_CTRL 0x00000610 787 + #define RK3328_POST_DSP_VACT_INFO_F1 0x00000614 788 + #define RK3328_DSP_HTOTAL_HS_END 0x00000618 789 + #define RK3328_DSP_HACT_ST_END 0x0000061c 790 + #define RK3328_DSP_VTOTAL_VS_END 0x00000620 791 + #define RK3328_DSP_VACT_ST_END 0x00000624 792 + #define RK3328_DSP_VS_ST_END_F1 0x00000628 793 + #define RK3328_DSP_VACT_ST_END_F1 0x0000062c 794 + #define RK3328_BCSH_COLOR_BAR 0x00000640 795 + #define RK3328_BCSH_BCS 0x00000644 796 + #define RK3328_BCSH_H 0x00000648 797 + #define RK3328_BCSH_CTRL 0x0000064c 798 + #define RK3328_FRC_LOWER01_0 0x00000678 799 + #define RK3328_FRC_LOWER01_1 0x0000067c 800 + #define RK3328_FRC_LOWER10_0 0x00000680 801 + #define RK3328_FRC_LOWER10_1 0x00000684 802 + #define RK3328_FRC_LOWER11_0 0x00000688 803 + #define RK3328_FRC_LOWER11_1 0x0000068c 804 + #define RK3328_DBG_POST_REG0 0x000006e8 805 + #define RK3328_DBG_POST_RESERVED 0x000006ec 806 + #define RK3328_DBG_DATAO 0x000006f0 807 + #define RK3328_DBG_DATAO_2 0x000006f4 808 + 809 + /* sdr to hdr */ 810 + #define RK3328_SDR2HDR_CTRL 0x00000700 811 + #define RK3328_EOTF_OETF_Y0 0x00000704 812 + #define RK3328_RESERVED0001 0x00000708 813 + #define RK3328_RESERVED0002 0x0000070c 814 + #define RK3328_EOTF_OETF_Y1 0x00000710 815 + #define RK3328_EOTF_OETF_Y64 0x0000080c 816 + #define RK3328_OETF_DX_DXPOW1 0x00000810 817 + #define RK3328_OETF_DX_DXPOW64 0x0000090c 818 + #define RK3328_OETF_XN1 0x00000910 819 + #define RK3328_OETF_XN63 0x00000a08 820 + 821 + /* hdr to sdr */ 822 + #define RK3328_HDR2SDR_CTRL 0x00000a10 823 + #define RK3328_HDR2SDR_SRC_RANGE 0x00000a14 824 + #define RK3328_HDR2SDR_NORMFACEETF 0x00000a18 825 + #define RK3328_RESERVED0003 0x00000a1c 826 + #define RK3328_HDR2SDR_DST_RANGE 0x00000a20 827 + #define RK3328_HDR2SDR_NORMFACCGAMMA 0x00000a24 828 + #define RK3328_EETF_OETF_Y0 0x00000a28 829 + #define RK3328_SAT_Y0 0x00000a2c 830 + #define RK3328_EETF_OETF_Y1 0x00000a30 831 + #define RK3328_SAT_Y1 0x00000ab0 832 + #define RK3328_SAT_Y8 0x00000acc 833 + 834 + #define RK3328_HWC_LUT_ADDR 0x00000c00 835 + 126 836 /* rk3036 register definition */ 127 837 #define RK3036_SYS_CTRL 0x00 128 838 #define RK3036_DSP_CTRL0 0x04 ··· 877 165 #define RK3036_WIN1_LUT_ADDR 0x400 878 166 #define RK3036_HWC_LUT_ADDR 0x800 879 167 /* rk3036 register definition end */ 880 - 881 - /* rk3399 register definition */ 882 - #define RK3399_REG_CFG_DONE 0x00000 883 - #define RK3399_VERSION_INFO 0x00004 884 - #define RK3399_SYS_CTRL 0x00008 885 - #define RK3399_SYS_CTRL1 0x0000c 886 - #define RK3399_DSP_CTRL0 0x00010 887 - #define RK3399_DSP_CTRL1 0x00014 888 - #define RK3399_DSP_BG 0x00018 889 - #define RK3399_MCU_CTRL 0x0001c 890 - #define RK3399_WB_CTRL0 0x00020 891 - #define RK3399_WB_CTRL1 0x00024 892 - #define RK3399_WB_YRGB_MST 0x00028 893 - #define RK3399_WB_CBR_MST 0x0002c 894 - #define RK3399_WIN0_CTRL0 0x00030 895 - #define RK3399_WIN0_CTRL1 0x00034 896 - #define RK3399_WIN0_COLOR_KEY 0x00038 897 - #define RK3399_WIN0_VIR 0x0003c 898 - #define RK3399_WIN0_YRGB_MST 0x00040 899 - #define RK3399_WIN0_CBR_MST 0x00044 900 - #define RK3399_WIN0_ACT_INFO 0x00048 901 - #define RK3399_WIN0_DSP_INFO 0x0004c 902 - #define RK3399_WIN0_DSP_ST 0x00050 903 - #define RK3399_WIN0_SCL_FACTOR_YRGB 0x00054 904 - #define RK3399_WIN0_SCL_FACTOR_CBR 0x00058 905 - #define RK3399_WIN0_SCL_OFFSET 0x0005c 906 - #define RK3399_WIN0_SRC_ALPHA_CTRL 0x00060 907 - #define RK3399_WIN0_DST_ALPHA_CTRL 0x00064 908 - #define RK3399_WIN0_FADING_CTRL 0x00068 909 - #define RK3399_WIN0_CTRL2 0x0006c 910 - #define RK3399_WIN1_CTRL0 0x00070 911 - #define RK3399_WIN1_CTRL1 0x00074 912 - #define RK3399_WIN1_COLOR_KEY 0x00078 913 - #define RK3399_WIN1_VIR 0x0007c 914 - #define RK3399_WIN1_YRGB_MST 0x00080 915 - #define RK3399_WIN1_CBR_MST 0x00084 916 - #define RK3399_WIN1_ACT_INFO 0x00088 917 - #define RK3399_WIN1_DSP_INFO 0x0008c 918 - #define RK3399_WIN1_DSP_ST 0x00090 919 - #define RK3399_WIN1_SCL_FACTOR_YRGB 0x00094 920 - #define RK3399_WIN1_SCL_FACTOR_CBR 0x00098 921 - #define RK3399_WIN1_SCL_OFFSET 0x0009c 922 - #define RK3399_WIN1_SRC_ALPHA_CTRL 0x000a0 923 - #define RK3399_WIN1_DST_ALPHA_CTRL 0x000a4 924 - #define RK3399_WIN1_FADING_CTRL 0x000a8 925 - #define RK3399_WIN1_CTRL2 0x000ac 926 - #define RK3399_WIN2_CTRL0 0x000b0 927 - #define RK3399_WIN2_CTRL1 0x000b4 928 - #define RK3399_WIN2_VIR0_1 0x000b8 929 - #define RK3399_WIN2_VIR2_3 0x000bc 930 - #define RK3399_WIN2_MST0 0x000c0 931 - #define RK3399_WIN2_DSP_INFO0 0x000c4 932 - #define RK3399_WIN2_DSP_ST0 0x000c8 933 - #define RK3399_WIN2_COLOR_KEY 0x000cc 934 - #define RK3399_WIN2_MST1 0x000d0 935 - #define RK3399_WIN2_DSP_INFO1 0x000d4 936 - #define RK3399_WIN2_DSP_ST1 0x000d8 937 - #define RK3399_WIN2_SRC_ALPHA_CTRL 0x000dc 938 - #define RK3399_WIN2_MST2 0x000e0 939 - #define RK3399_WIN2_DSP_INFO2 0x000e4 940 - #define RK3399_WIN2_DSP_ST2 0x000e8 941 - #define RK3399_WIN2_DST_ALPHA_CTRL 0x000ec 942 - #define RK3399_WIN2_MST3 0x000f0 943 - #define RK3399_WIN2_DSP_INFO3 0x000f4 944 - #define RK3399_WIN2_DSP_ST3 0x000f8 945 - #define RK3399_WIN2_FADING_CTRL 0x000fc 946 - #define RK3399_WIN3_CTRL0 0x00100 947 - #define RK3399_WIN3_CTRL1 0x00104 948 - #define RK3399_WIN3_VIR0_1 0x00108 949 - #define RK3399_WIN3_VIR2_3 0x0010c 950 - #define RK3399_WIN3_MST0 0x00110 951 - #define RK3399_WIN3_DSP_INFO0 0x00114 952 - #define RK3399_WIN3_DSP_ST0 0x00118 953 - #define RK3399_WIN3_COLOR_KEY 0x0011c 954 - #define RK3399_WIN3_MST1 0x00120 955 - #define RK3399_WIN3_DSP_INFO1 0x00124 956 - #define RK3399_WIN3_DSP_ST1 0x00128 957 - #define RK3399_WIN3_SRC_ALPHA_CTRL 0x0012c 958 - #define RK3399_WIN3_MST2 0x00130 959 - #define RK3399_WIN3_DSP_INFO2 0x00134 960 - #define RK3399_WIN3_DSP_ST2 0x00138 961 - #define RK3399_WIN3_DST_ALPHA_CTRL 0x0013c 962 - #define RK3399_WIN3_MST3 0x00140 963 - #define RK3399_WIN3_DSP_INFO3 0x00144 964 - #define RK3399_WIN3_DSP_ST3 0x00148 965 - #define RK3399_WIN3_FADING_CTRL 0x0014c 966 - #define RK3399_HWC_CTRL0 0x00150 967 - #define RK3399_HWC_CTRL1 0x00154 968 - #define RK3399_HWC_MST 0x00158 969 - #define RK3399_HWC_DSP_ST 0x0015c 970 - #define RK3399_HWC_SRC_ALPHA_CTRL 0x00160 971 - #define RK3399_HWC_DST_ALPHA_CTRL 0x00164 972 - #define RK3399_HWC_FADING_CTRL 0x00168 973 - #define RK3399_HWC_RESERVED1 0x0016c 974 - #define RK3399_POST_DSP_HACT_INFO 0x00170 975 - #define RK3399_POST_DSP_VACT_INFO 0x00174 976 - #define RK3399_POST_SCL_FACTOR_YRGB 0x00178 977 - #define RK3399_POST_RESERVED 0x0017c 978 - #define RK3399_POST_SCL_CTRL 0x00180 979 - #define RK3399_POST_DSP_VACT_INFO_F1 0x00184 980 - #define RK3399_DSP_HTOTAL_HS_END 0x00188 981 - #define RK3399_DSP_HACT_ST_END 0x0018c 982 - #define RK3399_DSP_VTOTAL_VS_END 0x00190 983 - #define RK3399_DSP_VACT_ST_END 0x00194 984 - #define RK3399_DSP_VS_ST_END_F1 0x00198 985 - #define RK3399_DSP_VACT_ST_END_F1 0x0019c 986 - #define RK3399_PWM_CTRL 0x001a0 987 - #define RK3399_PWM_PERIOD_HPR 0x001a4 988 - #define RK3399_PWM_DUTY_LPR 0x001a8 989 - #define RK3399_PWM_CNT 0x001ac 990 - #define RK3399_BCSH_COLOR_BAR 0x001b0 991 - #define RK3399_BCSH_BCS 0x001b4 992 - #define RK3399_BCSH_H 0x001b8 993 - #define RK3399_BCSH_CTRL 0x001bc 994 - #define RK3399_CABC_CTRL0 0x001c0 995 - #define RK3399_CABC_CTRL1 0x001c4 996 - #define RK3399_CABC_CTRL2 0x001c8 997 - #define RK3399_CABC_CTRL3 0x001cc 998 - #define RK3399_CABC_GAUSS_LINE0_0 0x001d0 999 - #define RK3399_CABC_GAUSS_LINE0_1 0x001d4 1000 - #define RK3399_CABC_GAUSS_LINE1_0 0x001d8 1001 - #define RK3399_CABC_GAUSS_LINE1_1 0x001dc 1002 - #define RK3399_CABC_GAUSS_LINE2_0 0x001e0 1003 - #define RK3399_CABC_GAUSS_LINE2_1 0x001e4 1004 - #define RK3399_FRC_LOWER01_0 0x001e8 1005 - #define RK3399_FRC_LOWER01_1 0x001ec 1006 - #define RK3399_FRC_LOWER10_0 0x001f0 1007 - #define RK3399_FRC_LOWER10_1 0x001f4 1008 - #define RK3399_FRC_LOWER11_0 0x001f8 1009 - #define RK3399_FRC_LOWER11_1 0x001fc 1010 - #define RK3399_AFBCD0_CTRL 0x00200 1011 - #define RK3399_AFBCD0_HDR_PTR 0x00204 1012 - #define RK3399_AFBCD0_PIC_SIZE 0x00208 1013 - #define RK3399_AFBCD0_STATUS 0x0020c 1014 - #define RK3399_AFBCD1_CTRL 0x00220 1015 - #define RK3399_AFBCD1_HDR_PTR 0x00224 1016 - #define RK3399_AFBCD1_PIC_SIZE 0x00228 1017 - #define RK3399_AFBCD1_STATUS 0x0022c 1018 - #define RK3399_AFBCD2_CTRL 0x00240 1019 - #define RK3399_AFBCD2_HDR_PTR 0x00244 1020 - #define RK3399_AFBCD2_PIC_SIZE 0x00248 1021 - #define RK3399_AFBCD2_STATUS 0x0024c 1022 - #define RK3399_AFBCD3_CTRL 0x00260 1023 - #define RK3399_AFBCD3_HDR_PTR 0x00264 1024 - #define RK3399_AFBCD3_PIC_SIZE 0x00268 1025 - #define RK3399_AFBCD3_STATUS 0x0026c 1026 - #define RK3399_INTR_EN0 0x00280 1027 - #define RK3399_INTR_CLEAR0 0x00284 1028 - #define RK3399_INTR_STATUS0 0x00288 1029 - #define RK3399_INTR_RAW_STATUS0 0x0028c 1030 - #define RK3399_INTR_EN1 0x00290 1031 - #define RK3399_INTR_CLEAR1 0x00294 1032 - #define RK3399_INTR_STATUS1 0x00298 1033 - #define RK3399_INTR_RAW_STATUS1 0x0029c 1034 - #define RK3399_LINE_FLAG 0x002a0 1035 - #define RK3399_VOP_STATUS 0x002a4 1036 - #define RK3399_BLANKING_VALUE 0x002a8 1037 - #define RK3399_MCU_BYPASS_PORT 0x002ac 1038 - #define RK3399_WIN0_DSP_BG 0x002b0 1039 - #define RK3399_WIN1_DSP_BG 0x002b4 1040 - #define RK3399_WIN2_DSP_BG 0x002b8 1041 - #define RK3399_WIN3_DSP_BG 0x002bc 1042 - #define RK3399_YUV2YUV_WIN 0x002c0 1043 - #define RK3399_YUV2YUV_POST 0x002c4 1044 - #define RK3399_AUTO_GATING_EN 0x002cc 1045 - #define RK3399_WIN0_CSC_COE 0x003a0 1046 - #define RK3399_WIN1_CSC_COE 0x003c0 1047 - #define RK3399_WIN2_CSC_COE 0x003e0 1048 - #define RK3399_WIN3_CSC_COE 0x00400 1049 - #define RK3399_HWC_CSC_COE 0x00420 1050 - #define RK3399_BCSH_R2Y_CSC_COE 0x00440 1051 - #define RK3399_BCSH_Y2R_CSC_COE 0x00460 1052 - #define RK3399_POST_YUV2YUV_Y2R_COE 0x00480 1053 - #define RK3399_POST_YUV2YUV_3X3_COE 0x004a0 1054 - #define RK3399_POST_YUV2YUV_R2Y_COE 0x004c0 1055 - #define RK3399_WIN0_YUV2YUV_Y2R 0x004e0 1056 - #define RK3399_WIN0_YUV2YUV_3X3 0x00500 1057 - #define RK3399_WIN0_YUV2YUV_R2Y 0x00520 1058 - #define RK3399_WIN1_YUV2YUV_Y2R 0x00540 1059 - #define RK3399_WIN1_YUV2YUV_3X3 0x00560 1060 - #define RK3399_WIN1_YUV2YUV_R2Y 0x00580 1061 - #define RK3399_WIN2_YUV2YUV_Y2R 0x005a0 1062 - #define RK3399_WIN2_YUV2YUV_3X3 0x005c0 1063 - #define RK3399_WIN2_YUV2YUV_R2Y 0x005e0 1064 - #define RK3399_WIN3_YUV2YUV_Y2R 0x00600 1065 - #define RK3399_WIN3_YUV2YUV_3X3 0x00620 1066 - #define RK3399_WIN3_YUV2YUV_R2Y 0x00640 1067 - #define RK3399_WIN2_LUT_ADDR 0x01000 1068 - #define RK3399_WIN3_LUT_ADDR 0x01400 1069 - #define RK3399_HWC_LUT_ADDR 0x01800 1070 - #define RK3399_CABC_GAMMA_LUT_ADDR 0x01c00 1071 - #define RK3399_GAMMA_LUT_ADDR 0x02000 1072 - /* rk3399 register definition end */ 1073 168 1074 169 #endif /* _ROCKCHIP_VOP_REG_H */
-2
drivers/gpu/drm/shmobile/shmob_drm_drv.c
··· 145 145 .gem_prime_vunmap = drm_gem_cma_prime_vunmap, 146 146 .gem_prime_mmap = drm_gem_cma_prime_mmap, 147 147 .dumb_create = drm_gem_cma_dumb_create, 148 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 149 - .dumb_destroy = drm_gem_dumb_destroy, 150 148 .fops = &shmob_drm_fops, 151 149 .name = "shmob-drm", 152 150 .desc = "Renesas SH Mobile DRM",
+1 -2
drivers/gpu/drm/sti/sti_cursor.c
··· 348 348 .update_plane = drm_atomic_helper_update_plane, 349 349 .disable_plane = drm_atomic_helper_disable_plane, 350 350 .destroy = sti_cursor_destroy, 351 - .set_property = drm_atomic_helper_plane_set_property, 352 351 .reset = sti_plane_reset, 353 352 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 354 353 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, ··· 391 392 &sti_cursor_plane_helpers_funcs, 392 393 cursor_supported_formats, 393 394 ARRAY_SIZE(cursor_supported_formats), 394 - DRM_PLANE_TYPE_CURSOR, NULL); 395 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 395 396 if (res) { 396 397 DRM_ERROR("Failed to initialize universal plane\n"); 397 398 goto err_plane;
-2
drivers/gpu/drm/sti/sti_drv.c
··· 175 175 .gem_free_object_unlocked = drm_gem_cma_free_object, 176 176 .gem_vm_ops = &drm_gem_cma_vm_ops, 177 177 .dumb_create = drm_gem_cma_dumb_create, 178 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 179 - .dumb_destroy = drm_gem_dumb_destroy, 180 178 .fops = &sti_driver_fops, 181 179 182 180 .enable_vblank = sti_crtc_enable_vblank,
-1
drivers/gpu/drm/sti/sti_dvo.c
··· 412 412 } 413 413 414 414 static const struct drm_connector_funcs sti_dvo_connector_funcs = { 415 - .dpms = drm_atomic_helper_connector_dpms, 416 415 .fill_modes = drm_helper_probe_single_connector_modes, 417 416 .detect = sti_dvo_connector_detect, 418 417 .destroy = drm_connector_cleanup,
+1 -2
drivers/gpu/drm/sti/sti_gdp.c
··· 895 895 .update_plane = drm_atomic_helper_update_plane, 896 896 .disable_plane = drm_atomic_helper_disable_plane, 897 897 .destroy = sti_gdp_destroy, 898 - .set_property = drm_atomic_helper_plane_set_property, 899 898 .reset = sti_plane_reset, 900 899 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 901 900 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, ··· 930 931 &sti_gdp_plane_helpers_funcs, 931 932 gdp_supported_formats, 932 933 ARRAY_SIZE(gdp_supported_formats), 933 - type, NULL); 934 + NULL, type, NULL); 934 935 if (res) { 935 936 DRM_ERROR("Failed to initialize universal plane\n"); 936 937 goto err;
-1
drivers/gpu/drm/sti/sti_hda.c
··· 647 647 } 648 648 649 649 static const struct drm_connector_funcs sti_hda_connector_funcs = { 650 - .dpms = drm_atomic_helper_connector_dpms, 651 650 .fill_modes = drm_helper_probe_single_connector_modes, 652 651 .destroy = drm_connector_cleanup, 653 652 .reset = drm_atomic_helper_connector_reset,
-2
drivers/gpu/drm/sti/sti_hdmi.c
··· 1113 1113 } 1114 1114 1115 1115 static const struct drm_connector_funcs sti_hdmi_connector_funcs = { 1116 - .dpms = drm_atomic_helper_connector_dpms, 1117 1116 .fill_modes = drm_helper_probe_single_connector_modes, 1118 1117 .detect = sti_hdmi_connector_detect, 1119 1118 .destroy = drm_connector_cleanup, 1120 1119 .reset = drm_atomic_helper_connector_reset, 1121 - .set_property = drm_atomic_helper_connector_set_property, 1122 1120 .atomic_set_property = sti_hdmi_connector_set_property, 1123 1121 .atomic_get_property = sti_hdmi_connector_get_property, 1124 1122 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
+1 -2
drivers/gpu/drm/sti/sti_hqvdp.c
··· 1276 1276 .update_plane = drm_atomic_helper_update_plane, 1277 1277 .disable_plane = drm_atomic_helper_disable_plane, 1278 1278 .destroy = sti_hqvdp_destroy, 1279 - .set_property = drm_atomic_helper_plane_set_property, 1280 1279 .reset = sti_plane_reset, 1281 1280 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 1282 1281 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, ··· 1297 1298 &sti_hqvdp_plane_helpers_funcs, 1298 1299 hqvdp_supported_formats, 1299 1300 ARRAY_SIZE(hqvdp_supported_formats), 1300 - DRM_PLANE_TYPE_OVERLAY, NULL); 1301 + NULL, DRM_PLANE_TYPE_OVERLAY, NULL); 1301 1302 if (res) { 1302 1303 DRM_ERROR("Failed to initialize universal plane\n"); 1303 1304 return NULL;
+7 -1
drivers/gpu/drm/stm/Kconfig
··· 7 7 select DRM_PANEL_BRIDGE 8 8 select VIDEOMODE_HELPERS 9 9 select FB_PROVIDE_GET_FB_UNMAPPED_AREA 10 - default y 11 10 12 11 help 13 12 Enable support for the on-chip display controller on 14 13 STMicroelectronics STM32 MCUs. 15 14 To compile this driver as a module, choose M here: the module 16 15 will be called stm-drm. 16 + 17 + config DRM_STM_DSI 18 + tristate "STMicroelectronics specific extensions for Synopsys MIPI DSI" 19 + depends on DRM_STM 20 + select DRM_DW_MIPI_DSI 21 + help 22 + Choose this option for MIPI DSI support on STMicroelectronics SoC.
+2
drivers/gpu/drm/stm/Makefile
··· 2 2 drv.o \ 3 3 ltdc.o 4 4 5 + obj-$(CONFIG_DRM_STM_DSI) += dw_mipi_dsi-stm.o 6 + 5 7 obj-$(CONFIG_DRM_STM) += stm-drm.o
+7 -16
drivers/gpu/drm/stm/drv.c
··· 20 20 21 21 #include "ltdc.h" 22 22 23 - #define DRIVER_NAME "stm" 24 - #define DRIVER_DESC "STMicroelectronics SoC DRM" 25 - #define DRIVER_DATE "20170330" 26 - #define DRIVER_MAJOR 1 27 - #define DRIVER_MINOR 0 28 - #define DRIVER_PATCH_LEVEL 0 29 - 30 23 #define STM_MAX_FB_WIDTH 2048 31 24 #define STM_MAX_FB_HEIGHT 2048 /* same as width to handle orientation */ 32 25 ··· 52 59 .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME | 53 60 DRIVER_ATOMIC, 54 61 .lastclose = drv_lastclose, 55 - .name = DRIVER_NAME, 56 - .desc = DRIVER_DESC, 57 - .date = DRIVER_DATE, 58 - .major = DRIVER_MAJOR, 59 - .minor = DRIVER_MINOR, 60 - .patchlevel = DRIVER_PATCH_LEVEL, 62 + .name = "stm", 63 + .desc = "STMicroelectronics SoC DRM", 64 + .date = "20170330", 65 + .major = 1, 66 + .minor = 0, 67 + .patchlevel = 0, 61 68 .fops = &drv_driver_fops, 62 69 .dumb_create = drm_gem_cma_dumb_create, 63 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 64 - .dumb_destroy = drm_gem_dumb_destroy, 65 70 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 66 71 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 67 72 .gem_free_object_unlocked = drm_gem_cma_free_object, ··· 197 206 .probe = stm_drm_platform_probe, 198 207 .remove = stm_drm_platform_remove, 199 208 .driver = { 200 - .name = DRIVER_NAME, 209 + .name = "stm32-display", 201 210 .of_match_table = drv_dt_ids, 202 211 }, 203 212 };
+352
drivers/gpu/drm/stm/dw_mipi_dsi-stm.c
··· 1 + /* 2 + * Copyright (C) STMicroelectronics SA 2017 3 + * 4 + * Authors: Philippe Cornu <philippe.cornu@st.com> 5 + * Yannick Fertre <yannick.fertre@st.com> 6 + * 7 + * License terms: GNU General Public License (GPL), version 2 8 + */ 9 + 10 + #include <linux/clk.h> 11 + #include <linux/iopoll.h> 12 + #include <linux/module.h> 13 + #include <drm/drmP.h> 14 + #include <drm/drm_mipi_dsi.h> 15 + #include <drm/bridge/dw_mipi_dsi.h> 16 + #include <video/mipi_display.h> 17 + 18 + /* DSI wrapper register & bit definitions */ 19 + /* Note: registers are named as in the Reference Manual */ 20 + #define DSI_WCFGR 0x0400 /* Wrapper ConFiGuration Reg */ 21 + #define WCFGR_DSIM BIT(0) /* DSI Mode */ 22 + #define WCFGR_COLMUX GENMASK(3, 1) /* COLor MUltipleXing */ 23 + 24 + #define DSI_WCR 0x0404 /* Wrapper Control Reg */ 25 + #define WCR_DSIEN BIT(3) /* DSI ENable */ 26 + 27 + #define DSI_WISR 0x040C /* Wrapper Interrupt and Status Reg */ 28 + #define WISR_PLLLS BIT(8) /* PLL Lock Status */ 29 + #define WISR_RRS BIT(12) /* Regulator Ready Status */ 30 + 31 + #define DSI_WPCR0 0x0418 /* Wrapper Phy Conf Reg 0 */ 32 + #define WPCR0_UIX4 GENMASK(5, 0) /* Unit Interval X 4 */ 33 + #define WPCR0_TDDL BIT(16) /* Turn Disable Data Lanes */ 34 + 35 + #define DSI_WRPCR 0x0430 /* Wrapper Regulator & Pll Ctrl Reg */ 36 + #define WRPCR_PLLEN BIT(0) /* PLL ENable */ 37 + #define WRPCR_NDIV GENMASK(8, 2) /* pll loop DIVision Factor */ 38 + #define WRPCR_IDF GENMASK(14, 11) /* pll Input Division Factor */ 39 + #define WRPCR_ODF GENMASK(17, 16) /* pll Output Division Factor */ 40 + #define WRPCR_REGEN BIT(24) /* REGulator ENable */ 41 + #define WRPCR_BGREN BIT(28) /* BandGap Reference ENable */ 42 + #define IDF_MIN 1 43 + #define IDF_MAX 7 44 + #define NDIV_MIN 10 45 + #define NDIV_MAX 125 46 + #define ODF_MIN 1 47 + #define ODF_MAX 8 48 + 49 + /* dsi color format coding according to the datasheet */ 50 + enum dsi_color { 51 + DSI_RGB565_CONF1, 52 + DSI_RGB565_CONF2, 53 + DSI_RGB565_CONF3, 54 + DSI_RGB666_CONF1, 55 + DSI_RGB666_CONF2, 56 + DSI_RGB888, 57 + }; 58 + 59 + #define LANE_MIN_KBPS 31250 60 + #define LANE_MAX_KBPS 500000 61 + 62 + /* Sleep & timeout for regulator on/off, pll lock/unlock & fifo empty */ 63 + #define SLEEP_US 1000 64 + #define TIMEOUT_US 200000 65 + 66 + struct dw_mipi_dsi_stm { 67 + void __iomem *base; 68 + struct clk *pllref_clk; 69 + }; 70 + 71 + static inline void dsi_write(struct dw_mipi_dsi_stm *dsi, u32 reg, u32 val) 72 + { 73 + writel(val, dsi->base + reg); 74 + } 75 + 76 + static inline u32 dsi_read(struct dw_mipi_dsi_stm *dsi, u32 reg) 77 + { 78 + return readl(dsi->base + reg); 79 + } 80 + 81 + static inline void dsi_set(struct dw_mipi_dsi_stm *dsi, u32 reg, u32 mask) 82 + { 83 + dsi_write(dsi, reg, dsi_read(dsi, reg) | mask); 84 + } 85 + 86 + static inline void dsi_clear(struct dw_mipi_dsi_stm *dsi, u32 reg, u32 mask) 87 + { 88 + dsi_write(dsi, reg, dsi_read(dsi, reg) & ~mask); 89 + } 90 + 91 + static inline void dsi_update_bits(struct dw_mipi_dsi_stm *dsi, u32 reg, 92 + u32 mask, u32 val) 93 + { 94 + dsi_write(dsi, reg, (dsi_read(dsi, reg) & ~mask) | val); 95 + } 96 + 97 + static enum dsi_color dsi_color_from_mipi(enum mipi_dsi_pixel_format fmt) 98 + { 99 + switch (fmt) { 100 + case MIPI_DSI_FMT_RGB888: 101 + return DSI_RGB888; 102 + case MIPI_DSI_FMT_RGB666: 103 + return DSI_RGB666_CONF2; 104 + case MIPI_DSI_FMT_RGB666_PACKED: 105 + return DSI_RGB666_CONF1; 106 + case MIPI_DSI_FMT_RGB565: 107 + return DSI_RGB565_CONF1; 108 + default: 109 + DRM_DEBUG_DRIVER("MIPI color invalid, so we use rgb888\n"); 110 + } 111 + return DSI_RGB888; 112 + } 113 + 114 + static int dsi_pll_get_clkout_khz(int clkin_khz, int idf, int ndiv, int odf) 115 + { 116 + /* prevent from division by 0 */ 117 + if (idf * odf) 118 + return DIV_ROUND_CLOSEST(clkin_khz * ndiv, idf * odf); 119 + 120 + return 0; 121 + } 122 + 123 + static int dsi_pll_get_params(int clkin_khz, int clkout_khz, 124 + int *idf, int *ndiv, int *odf) 125 + { 126 + int i, o, n, n_min, n_max; 127 + int fvco_min, fvco_max, delta, best_delta; /* all in khz */ 128 + 129 + /* Early checks preventing division by 0 & odd results */ 130 + if ((clkin_khz <= 0) || (clkout_khz <= 0)) 131 + return -EINVAL; 132 + 133 + fvco_min = LANE_MIN_KBPS * 2 * ODF_MAX; 134 + fvco_max = LANE_MAX_KBPS * 2 * ODF_MIN; 135 + 136 + best_delta = 1000000; /* big started value (1000000khz) */ 137 + 138 + for (i = IDF_MIN; i <= IDF_MAX; i++) { 139 + /* Compute ndiv range according to Fvco */ 140 + n_min = ((fvco_min * i) / (2 * clkin_khz)) + 1; 141 + n_max = (fvco_max * i) / (2 * clkin_khz); 142 + 143 + /* No need to continue idf loop if we reach ndiv max */ 144 + if (n_min >= NDIV_MAX) 145 + break; 146 + 147 + /* Clamp ndiv to valid values */ 148 + if (n_min < NDIV_MIN) 149 + n_min = NDIV_MIN; 150 + if (n_max > NDIV_MAX) 151 + n_max = NDIV_MAX; 152 + 153 + for (o = ODF_MIN; o <= ODF_MAX; o *= 2) { 154 + n = DIV_ROUND_CLOSEST(i * o * clkout_khz, clkin_khz); 155 + /* Check ndiv according to vco range */ 156 + if ((n < n_min) || (n > n_max)) 157 + continue; 158 + /* Check if new delta is better & saves parameters */ 159 + delta = dsi_pll_get_clkout_khz(clkin_khz, i, n, o) - 160 + clkout_khz; 161 + if (delta < 0) 162 + delta = -delta; 163 + if (delta < best_delta) { 164 + *idf = i; 165 + *ndiv = n; 166 + *odf = o; 167 + best_delta = delta; 168 + } 169 + /* fast return in case of "perfect result" */ 170 + if (!delta) 171 + return 0; 172 + } 173 + } 174 + 175 + return 0; 176 + } 177 + 178 + static int dw_mipi_dsi_phy_init(void *priv_data) 179 + { 180 + struct dw_mipi_dsi_stm *dsi = priv_data; 181 + u32 val; 182 + int ret; 183 + 184 + /* Enable the regulator */ 185 + dsi_set(dsi, DSI_WRPCR, WRPCR_REGEN | WRPCR_BGREN); 186 + ret = readl_poll_timeout(dsi->base + DSI_WISR, val, val & WISR_RRS, 187 + SLEEP_US, TIMEOUT_US); 188 + if (ret) 189 + DRM_DEBUG_DRIVER("!TIMEOUT! waiting REGU, let's continue\n"); 190 + 191 + /* Enable the DSI PLL & wait for its lock */ 192 + dsi_set(dsi, DSI_WRPCR, WRPCR_PLLEN); 193 + ret = readl_poll_timeout(dsi->base + DSI_WISR, val, val & WISR_PLLLS, 194 + SLEEP_US, TIMEOUT_US); 195 + if (ret) 196 + DRM_DEBUG_DRIVER("!TIMEOUT! waiting PLL, let's continue\n"); 197 + 198 + /* Enable the DSI wrapper */ 199 + dsi_set(dsi, DSI_WCR, WCR_DSIEN); 200 + 201 + return 0; 202 + } 203 + 204 + static int 205 + dw_mipi_dsi_get_lane_mbps(void *priv_data, struct drm_display_mode *mode, 206 + unsigned long mode_flags, u32 lanes, u32 format, 207 + unsigned int *lane_mbps) 208 + { 209 + struct dw_mipi_dsi_stm *dsi = priv_data; 210 + unsigned int idf, ndiv, odf, pll_in_khz, pll_out_khz; 211 + int ret, bpp; 212 + u32 val; 213 + 214 + pll_in_khz = (unsigned int)(clk_get_rate(dsi->pllref_clk) / 1000); 215 + 216 + /* Compute requested pll out */ 217 + bpp = mipi_dsi_pixel_format_to_bpp(format); 218 + pll_out_khz = mode->clock * bpp / lanes; 219 + /* Add 20% to pll out to be higher than pixel bw (burst mode only) */ 220 + pll_out_khz = (pll_out_khz * 12) / 10; 221 + if (pll_out_khz > LANE_MAX_KBPS) { 222 + pll_out_khz = LANE_MAX_KBPS; 223 + DRM_WARN("Warning max phy mbps is used\n"); 224 + } 225 + if (pll_out_khz < LANE_MIN_KBPS) { 226 + pll_out_khz = LANE_MIN_KBPS; 227 + DRM_WARN("Warning min phy mbps is used\n"); 228 + } 229 + 230 + /* Compute best pll parameters */ 231 + idf = 0; 232 + ndiv = 0; 233 + odf = 0; 234 + ret = dsi_pll_get_params(pll_in_khz, pll_out_khz, &idf, &ndiv, &odf); 235 + if (ret) 236 + DRM_WARN("Warning dsi_pll_get_params(): bad params\n"); 237 + 238 + /* Get the adjusted pll out value */ 239 + pll_out_khz = dsi_pll_get_clkout_khz(pll_in_khz, idf, ndiv, odf); 240 + 241 + /* Set the PLL division factors */ 242 + dsi_update_bits(dsi, DSI_WRPCR, WRPCR_NDIV | WRPCR_IDF | WRPCR_ODF, 243 + (ndiv << 2) | (idf << 11) | ((ffs(odf) - 1) << 16)); 244 + 245 + /* Compute uix4 & set the bit period in high-speed mode */ 246 + val = 4000000 / pll_out_khz; 247 + dsi_update_bits(dsi, DSI_WPCR0, WPCR0_UIX4, val); 248 + 249 + /* Select video mode by resetting DSIM bit */ 250 + dsi_clear(dsi, DSI_WCFGR, WCFGR_DSIM); 251 + 252 + /* Select the color coding */ 253 + dsi_update_bits(dsi, DSI_WCFGR, WCFGR_COLMUX, 254 + dsi_color_from_mipi(format) << 1); 255 + 256 + *lane_mbps = pll_out_khz / 1000; 257 + 258 + DRM_DEBUG_DRIVER("pll_in %ukHz pll_out %ukHz lane_mbps %uMHz\n", 259 + pll_in_khz, pll_out_khz, *lane_mbps); 260 + 261 + return 0; 262 + } 263 + 264 + static const struct dw_mipi_dsi_phy_ops dw_mipi_dsi_stm_phy_ops = { 265 + .init = dw_mipi_dsi_phy_init, 266 + .get_lane_mbps = dw_mipi_dsi_get_lane_mbps, 267 + }; 268 + 269 + static struct dw_mipi_dsi_plat_data dw_mipi_dsi_stm_plat_data = { 270 + .max_data_lanes = 2, 271 + .phy_ops = &dw_mipi_dsi_stm_phy_ops, 272 + }; 273 + 274 + static const struct of_device_id dw_mipi_dsi_stm_dt_ids[] = { 275 + { .compatible = "st,stm32-dsi", .data = &dw_mipi_dsi_stm_plat_data, }, 276 + { }, 277 + }; 278 + MODULE_DEVICE_TABLE(of, dw_mipi_dsi_stm_dt_ids); 279 + 280 + static int dw_mipi_dsi_stm_probe(struct platform_device *pdev) 281 + { 282 + struct device *dev = &pdev->dev; 283 + struct dw_mipi_dsi_stm *dsi; 284 + struct resource *res; 285 + int ret; 286 + 287 + dsi = devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); 288 + if (!dsi) 289 + return -ENOMEM; 290 + 291 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 292 + if (!res) { 293 + DRM_ERROR("Unable to get resource\n"); 294 + return -ENODEV; 295 + } 296 + 297 + dsi->base = devm_ioremap_resource(dev, res); 298 + if (IS_ERR(dsi->base)) { 299 + DRM_ERROR("Unable to get dsi registers\n"); 300 + return PTR_ERR(dsi->base); 301 + } 302 + 303 + dsi->pllref_clk = devm_clk_get(dev, "ref"); 304 + if (IS_ERR(dsi->pllref_clk)) { 305 + ret = PTR_ERR(dsi->pllref_clk); 306 + dev_err(dev, "Unable to get pll reference clock: %d\n", ret); 307 + return ret; 308 + } 309 + 310 + ret = clk_prepare_enable(dsi->pllref_clk); 311 + if (ret) { 312 + dev_err(dev, "%s: Failed to enable pllref_clk\n", __func__); 313 + return ret; 314 + } 315 + 316 + dw_mipi_dsi_stm_plat_data.base = dsi->base; 317 + dw_mipi_dsi_stm_plat_data.priv_data = dsi; 318 + 319 + ret = dw_mipi_dsi_probe(pdev, &dw_mipi_dsi_stm_plat_data); 320 + if (ret) { 321 + DRM_ERROR("Failed to initialize mipi dsi host\n"); 322 + clk_disable_unprepare(dsi->pllref_clk); 323 + } 324 + 325 + return ret; 326 + } 327 + 328 + static int dw_mipi_dsi_stm_remove(struct platform_device *pdev) 329 + { 330 + struct dw_mipi_dsi_stm *dsi = dw_mipi_dsi_stm_plat_data.priv_data; 331 + 332 + clk_disable_unprepare(dsi->pllref_clk); 333 + dw_mipi_dsi_remove(pdev); 334 + 335 + return 0; 336 + } 337 + 338 + static struct platform_driver dw_mipi_dsi_stm_driver = { 339 + .probe = dw_mipi_dsi_stm_probe, 340 + .remove = dw_mipi_dsi_stm_remove, 341 + .driver = { 342 + .of_match_table = dw_mipi_dsi_stm_dt_ids, 343 + .name = "dw_mipi_dsi-stm", 344 + }, 345 + }; 346 + 347 + module_platform_driver(dw_mipi_dsi_stm_driver); 348 + 349 + MODULE_AUTHOR("Philippe Cornu <philippe.cornu@st.com>"); 350 + MODULE_AUTHOR("Yannick Fertre <yannick.fertre@st.com>"); 351 + MODULE_DESCRIPTION("STMicroelectronics DW MIPI DSI host controller driver"); 352 + MODULE_LICENSE("GPL v2");
+109 -131
drivers/gpu/drm/stm/ltdc.c
··· 42 42 * an extra offset specified with reg_ofs. 43 43 */ 44 44 #define REG_OFS_NONE 0 45 - #define REG_OFS_4 4 /* Insertion of "Layer Configuration 2" reg */ 45 + #define REG_OFS_4 4 /* Insertion of "Layer Conf. 2" reg */ 46 46 #define REG_OFS (ldev->caps.reg_ofs) 47 - #define LAY_OFS 0x80 /* Register Offset between 2 layers */ 47 + #define LAY_OFS 0x80 /* Register Offset between 2 layers */ 48 48 49 49 /* Global register offsets */ 50 - #define LTDC_IDR 0x0000 /* IDentification */ 51 - #define LTDC_LCR 0x0004 /* Layer Count */ 52 - #define LTDC_SSCR 0x0008 /* Synchronization Size Configuration */ 53 - #define LTDC_BPCR 0x000C /* Back Porch Configuration */ 54 - #define LTDC_AWCR 0x0010 /* Active Width Configuration */ 55 - #define LTDC_TWCR 0x0014 /* Total Width Configuration */ 56 - #define LTDC_GCR 0x0018 /* Global Control */ 57 - #define LTDC_GC1R 0x001C /* Global Configuration 1 */ 58 - #define LTDC_GC2R 0x0020 /* Global Configuration 2 */ 59 - #define LTDC_SRCR 0x0024 /* Shadow Reload Configuration */ 60 - #define LTDC_GACR 0x0028 /* GAmma Correction */ 61 - #define LTDC_BCCR 0x002C /* Background Color Configuration */ 62 - #define LTDC_IER 0x0034 /* Interrupt Enable */ 63 - #define LTDC_ISR 0x0038 /* Interrupt Status */ 64 - #define LTDC_ICR 0x003C /* Interrupt Clear */ 65 - #define LTDC_LIPCR 0x0040 /* Line Interrupt Position Configuration */ 66 - #define LTDC_CPSR 0x0044 /* Current Position Status */ 67 - #define LTDC_CDSR 0x0048 /* Current Display Status */ 50 + #define LTDC_IDR 0x0000 /* IDentification */ 51 + #define LTDC_LCR 0x0004 /* Layer Count */ 52 + #define LTDC_SSCR 0x0008 /* Synchronization Size Configuration */ 53 + #define LTDC_BPCR 0x000C /* Back Porch Configuration */ 54 + #define LTDC_AWCR 0x0010 /* Active Width Configuration */ 55 + #define LTDC_TWCR 0x0014 /* Total Width Configuration */ 56 + #define LTDC_GCR 0x0018 /* Global Control */ 57 + #define LTDC_GC1R 0x001C /* Global Configuration 1 */ 58 + #define LTDC_GC2R 0x0020 /* Global Configuration 2 */ 59 + #define LTDC_SRCR 0x0024 /* Shadow Reload Configuration */ 60 + #define LTDC_GACR 0x0028 /* GAmma Correction */ 61 + #define LTDC_BCCR 0x002C /* Background Color Configuration */ 62 + #define LTDC_IER 0x0034 /* Interrupt Enable */ 63 + #define LTDC_ISR 0x0038 /* Interrupt Status */ 64 + #define LTDC_ICR 0x003C /* Interrupt Clear */ 65 + #define LTDC_LIPCR 0x0040 /* Line Interrupt Position Conf. */ 66 + #define LTDC_CPSR 0x0044 /* Current Position Status */ 67 + #define LTDC_CDSR 0x0048 /* Current Display Status */ 68 68 69 69 /* Layer register offsets */ 70 - #define LTDC_L1LC1R (0x0080) /* L1 Layer Configuration 1 */ 71 - #define LTDC_L1LC2R (0x0084) /* L1 Layer Configuration 2 */ 72 - #define LTDC_L1CR (0x0084 + REG_OFS) /* L1 Control */ 73 - #define LTDC_L1WHPCR (0x0088 + REG_OFS) /* L1 Window Hor Position Config */ 74 - #define LTDC_L1WVPCR (0x008C + REG_OFS) /* L1 Window Vert Position Config */ 75 - #define LTDC_L1CKCR (0x0090 + REG_OFS) /* L1 Color Keying Configuration */ 76 - #define LTDC_L1PFCR (0x0094 + REG_OFS) /* L1 Pixel Format Configuration */ 77 - #define LTDC_L1CACR (0x0098 + REG_OFS) /* L1 Constant Alpha Config */ 78 - #define LTDC_L1DCCR (0x009C + REG_OFS) /* L1 Default Color Configuration */ 79 - #define LTDC_L1BFCR (0x00A0 + REG_OFS) /* L1 Blend Factors Configuration */ 80 - #define LTDC_L1FBBCR (0x00A4 + REG_OFS) /* L1 FrameBuffer Bus Control */ 81 - #define LTDC_L1AFBCR (0x00A8 + REG_OFS) /* L1 AuxFB Control */ 82 - #define LTDC_L1CFBAR (0x00AC + REG_OFS) /* L1 Color FrameBuffer Address */ 83 - #define LTDC_L1CFBLR (0x00B0 + REG_OFS) /* L1 Color FrameBuffer Length */ 84 - #define LTDC_L1CFBLNR (0x00B4 + REG_OFS) /* L1 Color FrameBuffer Line Nb */ 85 - #define LTDC_L1AFBAR (0x00B8 + REG_OFS) /* L1 AuxFB Address */ 86 - #define LTDC_L1AFBLR (0x00BC + REG_OFS) /* L1 AuxFB Length */ 87 - #define LTDC_L1AFBLNR (0x00C0 + REG_OFS) /* L1 AuxFB Line Number */ 88 - #define LTDC_L1CLUTWR (0x00C4 + REG_OFS) /* L1 CLUT Write */ 89 - #define LTDC_L1YS1R (0x00E0 + REG_OFS) /* L1 YCbCr Scale 1 */ 90 - #define LTDC_L1YS2R (0x00E4 + REG_OFS) /* L1 YCbCr Scale 2 */ 70 + #define LTDC_L1LC1R (0x80) /* L1 Layer Configuration 1 */ 71 + #define LTDC_L1LC2R (0x84) /* L1 Layer Configuration 2 */ 72 + #define LTDC_L1CR (0x84 + REG_OFS)/* L1 Control */ 73 + #define LTDC_L1WHPCR (0x88 + REG_OFS)/* L1 Window Hor Position Config */ 74 + #define LTDC_L1WVPCR (0x8C + REG_OFS)/* L1 Window Vert Position Config */ 75 + #define LTDC_L1CKCR (0x90 + REG_OFS)/* L1 Color Keying Configuration */ 76 + #define LTDC_L1PFCR (0x94 + REG_OFS)/* L1 Pixel Format Configuration */ 77 + #define LTDC_L1CACR (0x98 + REG_OFS)/* L1 Constant Alpha Config */ 78 + #define LTDC_L1DCCR (0x9C + REG_OFS)/* L1 Default Color Configuration */ 79 + #define LTDC_L1BFCR (0xA0 + REG_OFS)/* L1 Blend Factors Configuration */ 80 + #define LTDC_L1FBBCR (0xA4 + REG_OFS)/* L1 FrameBuffer Bus Control */ 81 + #define LTDC_L1AFBCR (0xA8 + REG_OFS)/* L1 AuxFB Control */ 82 + #define LTDC_L1CFBAR (0xAC + REG_OFS)/* L1 Color FrameBuffer Address */ 83 + #define LTDC_L1CFBLR (0xB0 + REG_OFS)/* L1 Color FrameBuffer Length */ 84 + #define LTDC_L1CFBLNR (0xB4 + REG_OFS)/* L1 Color FrameBuffer Line Nb */ 85 + #define LTDC_L1AFBAR (0xB8 + REG_OFS)/* L1 AuxFB Address */ 86 + #define LTDC_L1AFBLR (0xBC + REG_OFS)/* L1 AuxFB Length */ 87 + #define LTDC_L1AFBLNR (0xC0 + REG_OFS)/* L1 AuxFB Line Number */ 88 + #define LTDC_L1CLUTWR (0xC4 + REG_OFS)/* L1 CLUT Write */ 89 + #define LTDC_L1YS1R (0xE0 + REG_OFS)/* L1 YCbCr Scale 1 */ 90 + #define LTDC_L1YS2R (0xE4 + REG_OFS)/* L1 YCbCr Scale 2 */ 91 91 92 92 /* Bit definitions */ 93 93 #define SSCR_VSH GENMASK(10, 0) /* Vertical Synchronization Height */ ··· 104 104 105 105 #define GCR_LTDCEN BIT(0) /* LTDC ENable */ 106 106 #define GCR_DEN BIT(16) /* Dither ENable */ 107 - #define GCR_PCPOL BIT(28) /* Pixel Clock POLarity */ 108 - #define GCR_DEPOL BIT(29) /* Data Enable POLarity */ 109 - #define GCR_VSPOL BIT(30) /* Vertical Synchro POLarity */ 110 - #define GCR_HSPOL BIT(31) /* Horizontal Synchro POLarity */ 107 + #define GCR_PCPOL BIT(28) /* Pixel Clock POLarity-Inverted */ 108 + #define GCR_DEPOL BIT(29) /* Data Enable POLarity-High */ 109 + #define GCR_VSPOL BIT(30) /* Vertical Synchro POLarity-High */ 110 + #define GCR_HSPOL BIT(31) /* Horizontal Synchro POLarity-High */ 111 111 112 112 #define GC1R_WBCH GENMASK(3, 0) /* Width of Blue CHannel output */ 113 113 #define GC1R_WGCH GENMASK(7, 4) /* Width of Green Channel output */ ··· 172 172 #define LXCFBLR_CFBLL GENMASK(12, 0) /* Color Frame Buffer Line Length */ 173 173 #define LXCFBLR_CFBP GENMASK(28, 16) /* Color Frame Buffer Pitch in bytes */ 174 174 175 - #define LXCFBLNR_CFBLN GENMASK(10, 0) /* Color Frame Buffer Line Number */ 175 + #define LXCFBLNR_CFBLN GENMASK(10, 0) /* Color Frame Buffer Line Number */ 176 176 177 - #define HSPOL_AL 0 /* Horizontal Sync POLarity Active Low */ 178 - #define VSPOL_AL 0 /* Vertical Sync POLarity Active Low */ 179 - #define DEPOL_AL 0 /* Data Enable POLarity Active Low */ 180 - #define PCPOL_IPC 0 /* Input Pixel Clock */ 181 - #define HSPOL_AH GCR_HSPOL /* Horizontal Sync POLarity Active High */ 182 - #define VSPOL_AH GCR_VSPOL /* Vertical Sync POLarity Active High */ 183 - #define DEPOL_AH GCR_DEPOL /* Data Enable POLarity Active High */ 184 - #define PCPOL_IIPC GCR_PCPOL /* Inverted Input Pixel Clock */ 185 - #define CONSTA_MAX 0xFF /* CONSTant Alpha MAX= 1.0 */ 186 - #define BF1_PAXCA 0x600 /* Pixel Alpha x Constant Alpha */ 187 - #define BF1_CA 0x400 /* Constant Alpha */ 188 - #define BF2_1PAXCA 0x007 /* 1 - (Pixel Alpha x Constant Alpha) */ 189 - #define BF2_1CA 0x005 /* 1 - Constant Alpha */ 177 + #define CONSTA_MAX 0xFF /* CONSTant Alpha MAX= 1.0 */ 178 + #define BF1_PAXCA 0x600 /* Pixel Alpha x Constant Alpha */ 179 + #define BF1_CA 0x400 /* Constant Alpha */ 180 + #define BF2_1PAXCA 0x007 /* 1 - (Pixel Alpha x Constant Alpha) */ 181 + #define BF2_1CA 0x005 /* 1 - Constant Alpha */ 190 182 191 - #define NB_PF 8 /* Max nb of HW pixel format */ 183 + #define NB_PF 8 /* Max nb of HW pixel format */ 192 184 193 185 enum ltdc_pix_fmt { 194 186 PF_NONE, 195 187 /* RGB formats */ 196 - PF_ARGB8888, /* ARGB [32 bits] */ 197 - PF_RGBA8888, /* RGBA [32 bits] */ 198 - PF_RGB888, /* RGB [24 bits] */ 199 - PF_RGB565, /* RGB [16 bits] */ 200 - PF_ARGB1555, /* ARGB A:1 bit RGB:15 bits [16 bits] */ 201 - PF_ARGB4444, /* ARGB A:4 bits R/G/B: 4 bits each [16 bits] */ 188 + PF_ARGB8888, /* ARGB [32 bits] */ 189 + PF_RGBA8888, /* RGBA [32 bits] */ 190 + PF_RGB888, /* RGB [24 bits] */ 191 + PF_RGB565, /* RGB [16 bits] */ 192 + PF_ARGB1555, /* ARGB A:1 bit RGB:15 bits [16 bits] */ 193 + PF_ARGB4444, /* ARGB A:4 bits R/G/B: 4 bits each [16 bits] */ 202 194 /* Indexed formats */ 203 - PF_L8, /* Indexed 8 bits [8 bits] */ 204 - PF_AL44, /* Alpha:4 bits + indexed 4 bits [8 bits] */ 205 - PF_AL88 /* Alpha:8 bits + indexed 8 bits [16 bits] */ 195 + PF_L8, /* Indexed 8 bits [8 bits] */ 196 + PF_AL44, /* Alpha:4 bits + indexed 4 bits [8 bits] */ 197 + PF_AL88 /* Alpha:8 bits + indexed 8 bits [16 bits] */ 206 198 }; 207 199 208 200 /* The index gives the encoding of the pixel format for an HW version */ 209 201 static const enum ltdc_pix_fmt ltdc_pix_fmt_a0[NB_PF] = { 210 - PF_ARGB8888, /* 0x00 */ 211 - PF_RGB888, /* 0x01 */ 212 - PF_RGB565, /* 0x02 */ 213 - PF_ARGB1555, /* 0x03 */ 214 - PF_ARGB4444, /* 0x04 */ 215 - PF_L8, /* 0x05 */ 216 - PF_AL44, /* 0x06 */ 217 - PF_AL88 /* 0x07 */ 202 + PF_ARGB8888, /* 0x00 */ 203 + PF_RGB888, /* 0x01 */ 204 + PF_RGB565, /* 0x02 */ 205 + PF_ARGB1555, /* 0x03 */ 206 + PF_ARGB4444, /* 0x04 */ 207 + PF_L8, /* 0x05 */ 208 + PF_AL44, /* 0x06 */ 209 + PF_AL88 /* 0x07 */ 218 210 }; 219 211 220 212 static const enum ltdc_pix_fmt ltdc_pix_fmt_a1[NB_PF] = { 221 - PF_ARGB8888, /* 0x00 */ 222 - PF_RGB888, /* 0x01 */ 223 - PF_RGB565, /* 0x02 */ 224 - PF_RGBA8888, /* 0x03 */ 225 - PF_AL44, /* 0x04 */ 226 - PF_L8, /* 0x05 */ 227 - PF_ARGB1555, /* 0x06 */ 228 - PF_ARGB4444 /* 0x07 */ 213 + PF_ARGB8888, /* 0x00 */ 214 + PF_RGB888, /* 0x01 */ 215 + PF_RGB565, /* 0x02 */ 216 + PF_RGBA8888, /* 0x03 */ 217 + PF_AL44, /* 0x04 */ 218 + PF_L8, /* 0x05 */ 219 + PF_ARGB1555, /* 0x06 */ 220 + PF_ARGB4444 /* 0x07 */ 229 221 }; 230 222 231 223 static inline u32 reg_read(void __iomem *base, u32 reg) ··· 294 302 default: 295 303 pf = PF_NONE; 296 304 break; 297 - /* Note: There are no DRM_FORMAT for AL44 and AL88 */ 305 + /* Note: There are no DRM_FORMAT for AL44 and AL88 */ 298 306 } 299 307 300 308 return pf; ··· 317 325 return DRM_FORMAT_ARGB4444; 318 326 case PF_L8: 319 327 return DRM_FORMAT_C8; 320 - case PF_AL44: /* No DRM support */ 321 - case PF_AL88: /* No DRM support */ 328 + case PF_AL44: /* No DRM support */ 329 + case PF_AL88: /* No DRM support */ 322 330 case PF_NONE: 323 331 default: 324 332 return 0; ··· 361 369 /* 362 370 * DRM_CRTC 363 371 */ 364 - 365 - static void ltdc_crtc_load_lut(struct drm_crtc *crtc) 366 - { 367 - struct ltdc_device *ldev = crtc_to_ltdc(crtc); 368 - unsigned int i, lay; 369 - 370 - for (lay = 0; lay < ldev->caps.nb_layers; lay++) 371 - for (i = 0; i < 256; i++) 372 - reg_write(ldev->regs, LTDC_L1CLUTWR + lay * LAY_OFS, 373 - ldev->clut[i]); 374 - } 375 372 376 373 static void ltdc_crtc_atomic_enable(struct drm_crtc *crtc, 377 374 struct drm_crtc_state *old_state) ··· 440 459 441 460 clk_enable(ldev->pixel_clk); 442 461 443 - /* Configures the HS, VS, DE and PC polarities. */ 444 - val = HSPOL_AL | VSPOL_AL | DEPOL_AL | PCPOL_IPC; 462 + /* Configures the HS, VS, DE and PC polarities. Default Active Low */ 463 + val = 0; 445 464 446 465 if (vm.flags & DISPLAY_FLAGS_HSYNC_HIGH) 447 - val |= HSPOL_AH; 466 + val |= GCR_HSPOL; 448 467 449 468 if (vm.flags & DISPLAY_FLAGS_VSYNC_HIGH) 450 - val |= VSPOL_AH; 469 + val |= GCR_VSPOL; 451 470 452 471 if (vm.flags & DISPLAY_FLAGS_DE_HIGH) 453 - val |= DEPOL_AH; 472 + val |= GCR_DEPOL; 454 473 455 474 if (vm.flags & DISPLAY_FLAGS_PIXDATA_NEGEDGE) 456 - val |= PCPOL_IIPC; 475 + val |= GCR_PCPOL; 457 476 458 477 reg_update_bits(ldev->regs, LTDC_GCR, 459 478 GCR_HSPOL | GCR_VSPOL | GCR_DEPOL | GCR_PCPOL, val); ··· 500 519 } 501 520 } 502 521 503 - static struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = { 504 - .load_lut = ltdc_crtc_load_lut, 522 + static const struct drm_crtc_helper_funcs ltdc_crtc_helper_funcs = { 505 523 .mode_set_nofb = ltdc_crtc_mode_set_nofb, 506 524 .atomic_flush = ltdc_crtc_atomic_flush, 507 525 .atomic_enable = ltdc_crtc_atomic_enable, ··· 525 545 reg_clear(ldev->regs, LTDC_IER, IER_LIE); 526 546 } 527 547 528 - static struct drm_crtc_funcs ltdc_crtc_funcs = { 548 + static const struct drm_crtc_funcs ltdc_crtc_funcs = { 529 549 .destroy = drm_crtc_cleanup, 530 550 .set_config = drm_atomic_helper_set_config, 531 551 .page_flip = drm_atomic_helper_page_flip, ··· 590 610 src_w = state->src_w >> 16; 591 611 src_h = state->src_h >> 16; 592 612 593 - DRM_DEBUG_DRIVER( 594 - "plane:%d fb:%d (%dx%d)@(%d,%d) -> (%dx%d)@(%d,%d)\n", 595 - plane->base.id, fb->base.id, 596 - src_w, src_h, src_x, src_y, 597 - state->crtc_w, state->crtc_h, state->crtc_x, state->crtc_y); 613 + DRM_DEBUG_DRIVER("plane:%d fb:%d (%dx%d)@(%d,%d) -> (%dx%d)@(%d,%d)\n", 614 + plane->base.id, fb->base.id, 615 + src_w, src_h, src_x, src_y, 616 + state->crtc_w, state->crtc_h, 617 + state->crtc_x, state->crtc_y); 598 618 599 619 bpcr = reg_read(ldev->regs, LTDC_BPCR); 600 620 ahbp = (bpcr & BPCR_AHBP) >> 16; ··· 619 639 if (val == NB_PF) { 620 640 DRM_ERROR("Pixel format %.4s not supported\n", 621 641 (char *)&fb->format->format); 622 - val = 0; /* set by default ARGB 32 bits */ 642 + val = 0; /* set by default ARGB 32 bits */ 623 643 } 624 644 reg_update_bits(ldev->regs, LTDC_L1PFCR + lofs, LXPFCR_PF, val); 625 645 ··· 633 653 634 654 /* Specifies the constant alpha value */ 635 655 val = CONSTA_MAX; 636 - reg_update_bits(ldev->regs, LTDC_L1CACR + lofs, 637 - LXCACR_CONSTA, val); 656 + reg_update_bits(ldev->regs, LTDC_L1CACR + lofs, LXCACR_CONSTA, val); 638 657 639 658 /* Specifies the blending factors */ 640 659 val = BF1_PAXCA | BF2_1PAXCA; ··· 642 663 643 664 /* Configures the frame buffer line number */ 644 665 val = y1 - y0 + 1; 645 - reg_update_bits(ldev->regs, LTDC_L1CFBLNR + lofs, 646 - LXCFBLNR_CFBLN, val); 666 + reg_update_bits(ldev->regs, LTDC_L1CFBLNR + lofs, LXCFBLNR_CFBLN, val); 647 667 648 668 /* Sets the FB address */ 649 669 paddr = (u32)drm_fb_cma_get_gem_addr(fb, state, 0); ··· 681 703 oldstate->crtc->base.id, plane->base.id); 682 704 } 683 705 684 - static struct drm_plane_funcs ltdc_plane_funcs = { 706 + static const struct drm_plane_funcs ltdc_plane_funcs = { 685 707 .update_plane = drm_atomic_helper_update_plane, 686 708 .disable_plane = drm_atomic_helper_disable_plane, 687 709 .destroy = drm_plane_cleanup, 688 - .set_property = drm_atomic_helper_plane_set_property, 689 710 .reset = drm_atomic_helper_plane_reset, 690 711 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 691 712 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state, ··· 722 745 723 746 ret = drm_universal_plane_init(ddev, plane, possible_crtcs, 724 747 &ltdc_plane_funcs, formats, nb_fmt, 725 - type, NULL); 748 + NULL, type, NULL); 726 749 if (ret < 0) 727 750 return 0; 728 751 ··· 747 770 struct ltdc_device *ldev = ddev->dev_private; 748 771 struct drm_plane *primary, *overlay; 749 772 unsigned int i; 750 - int res; 773 + int ret; 751 774 752 775 primary = ltdc_plane_create(ddev, DRM_PLANE_TYPE_PRIMARY); 753 776 if (!primary) { ··· 755 778 return -EINVAL; 756 779 } 757 780 758 - res = drm_crtc_init_with_planes(ddev, crtc, primary, NULL, 781 + ret = drm_crtc_init_with_planes(ddev, crtc, primary, NULL, 759 782 &ltdc_crtc_funcs, NULL); 760 - if (res) { 783 + if (ret) { 761 784 DRM_ERROR("Can not initialize CRTC\n"); 762 785 goto cleanup; 763 786 } ··· 770 793 for (i = 1; i < ldev->caps.nb_layers; i++) { 771 794 overlay = ltdc_plane_create(ddev, DRM_PLANE_TYPE_OVERLAY); 772 795 if (!overlay) { 773 - res = -ENOMEM; 796 + ret = -ENOMEM; 774 797 DRM_ERROR("Can not create overlay plane %d\n", i); 775 798 goto cleanup; 776 799 } ··· 780 803 781 804 cleanup: 782 805 ltdc_plane_destroy_all(ddev); 783 - return res; 806 + return ret; 784 807 } 785 808 786 809 /* ··· 802 825 return -ENOMEM; 803 826 804 827 encoder->possible_crtcs = CRTC_MASK; 805 - encoder->possible_clones = 0; /* No cloning support */ 828 + encoder->possible_clones = 0; /* No cloning support */ 806 829 807 830 drm_encoder_init(ddev, encoder, &ltdc_encoder_funcs, 808 831 DRM_MODE_ENCODER_DPI, NULL); ··· 861 884 struct drm_panel *panel; 862 885 struct drm_crtc *crtc; 863 886 struct reset_control *rstc; 864 - struct resource res; 887 + struct resource *res; 865 888 int irq, ret, i; 866 889 867 890 DRM_DEBUG_DRIVER("\n"); ··· 870 893 if (ret) 871 894 return ret; 872 895 873 - rstc = of_reset_control_get(np, NULL); 896 + rstc = devm_reset_control_get_exclusive(dev, NULL); 874 897 875 898 mutex_init(&ldev->err_lock); 876 899 ··· 885 908 return -ENODEV; 886 909 } 887 910 888 - if (of_address_to_resource(np, 0, &res)) { 911 + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 912 + if (!res) { 889 913 DRM_ERROR("Unable to get resource\n"); 890 914 ret = -ENODEV; 891 915 goto err; 892 916 } 893 917 894 - ldev->regs = devm_ioremap_resource(dev, &res); 918 + ldev->regs = devm_ioremap_resource(dev, res); 895 919 if (IS_ERR(ldev->regs)) { 896 920 DRM_ERROR("Unable to get ltdc registers\n"); 897 921 ret = PTR_ERR(ldev->regs);
-1
drivers/gpu/drm/stm/ltdc.h
··· 28 28 bool is_panel_bridge; 29 29 struct mutex err_lock; /* protecting error_status */ 30 30 struct ltdc_caps caps; 31 - u32 clut[256]; /* color look up table */ 32 31 u32 error_status; 33 32 u32 irq_status; 34 33 };
-2
drivers/gpu/drm/sun4i/sun4i_drv.c
··· 40 40 41 41 /* GEM Operations */ 42 42 .dumb_create = drm_gem_cma_dumb_create, 43 - .dumb_destroy = drm_gem_dumb_destroy, 44 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 45 43 .gem_free_object_unlocked = drm_gem_cma_free_object, 46 44 .gem_vm_ops = &drm_gem_cma_vm_ops, 47 45
-1
drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c
··· 306 306 } 307 307 308 308 static const struct drm_connector_funcs sun4i_hdmi_connector_funcs = { 309 - .dpms = drm_atomic_helper_connector_dpms, 310 309 .detect = sun4i_hdmi_connector_detect, 311 310 .fill_modes = drm_helper_probe_single_connector_modes, 312 311 .destroy = drm_connector_cleanup,
+1 -1
drivers/gpu/drm/sun4i/sun4i_layer.c
··· 115 115 ret = drm_universal_plane_init(drm, &layer->plane, 0, 116 116 &sun4i_backend_layer_funcs, 117 117 plane->formats, plane->nformats, 118 - plane->type, NULL); 118 + NULL, plane->type, NULL); 119 119 if (ret) { 120 120 dev_err(drm->dev, "Couldn't initialize layer\n"); 121 121 return ERR_PTR(ret);
-1
drivers/gpu/drm/sun4i/sun4i_rgb.c
··· 120 120 } 121 121 122 122 static struct drm_connector_funcs sun4i_rgb_con_funcs = { 123 - .dpms = drm_atomic_helper_connector_dpms, 124 123 .fill_modes = drm_helper_probe_single_connector_modes, 125 124 .destroy = sun4i_rgb_connector_destroy, 126 125 .reset = drm_atomic_helper_connector_reset,
-1
drivers/gpu/drm/sun4i/sun4i_tv.c
··· 546 546 } 547 547 548 548 static struct drm_connector_funcs sun4i_tv_comp_connector_funcs = { 549 - .dpms = drm_atomic_helper_connector_dpms, 550 549 .fill_modes = drm_helper_probe_single_connector_modes, 551 550 .destroy = sun4i_tv_comp_connector_destroy, 552 551 .reset = drm_atomic_helper_connector_reset,
+1 -1
drivers/gpu/drm/sun4i/sun8i_layer.c
··· 90 90 ret = drm_universal_plane_init(drm, &layer->plane, 0, 91 91 &sun8i_mixer_layer_funcs, 92 92 plane->formats, plane->nformats, 93 - plane->type, NULL); 93 + NULL, plane->type, NULL); 94 94 if (ret) { 95 95 dev_err(drm->dev, "Couldn't initialize layer\n"); 96 96 return ERR_PTR(ret);
+6 -6
drivers/gpu/drm/tegra/dc.c
··· 678 678 679 679 err = drm_universal_plane_init(drm, &plane->base, possible_crtcs, 680 680 &tegra_primary_plane_funcs, formats, 681 - num_formats, DRM_PLANE_TYPE_PRIMARY, 682 - NULL); 681 + num_formats, NULL, 682 + DRM_PLANE_TYPE_PRIMARY, NULL); 683 683 if (err < 0) { 684 684 kfree(plane); 685 685 return ERR_PTR(err); ··· 844 844 845 845 err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, 846 846 &tegra_cursor_plane_funcs, formats, 847 - num_formats, DRM_PLANE_TYPE_CURSOR, 848 - NULL); 847 + num_formats, NULL, 848 + DRM_PLANE_TYPE_CURSOR, NULL); 849 849 if (err < 0) { 850 850 kfree(plane); 851 851 return ERR_PTR(err); ··· 906 906 907 907 err = drm_universal_plane_init(drm, &plane->base, 1 << dc->pipe, 908 908 &tegra_overlay_plane_funcs, formats, 909 - num_formats, DRM_PLANE_TYPE_OVERLAY, 910 - NULL); 909 + num_formats, NULL, 910 + DRM_PLANE_TYPE_OVERLAY, NULL); 911 911 if (err < 0) { 912 912 kfree(plane); 913 913 return ERR_PTR(err);
-1
drivers/gpu/drm/tegra/dsi.c
··· 815 815 } 816 816 817 817 static const struct drm_connector_funcs tegra_dsi_connector_funcs = { 818 - .dpms = drm_atomic_helper_connector_dpms, 819 818 .reset = tegra_dsi_connector_reset, 820 819 .detect = tegra_output_connector_detect, 821 820 .fill_modes = drm_helper_probe_single_connector_modes,
-1
drivers/gpu/drm/tegra/hdmi.c
··· 902 902 } 903 903 904 904 static const struct drm_connector_funcs tegra_hdmi_connector_funcs = { 905 - .dpms = drm_atomic_helper_connector_dpms, 906 905 .reset = drm_atomic_helper_connector_reset, 907 906 .detect = tegra_hdmi_connector_detect, 908 907 .fill_modes = drm_helper_probe_single_connector_modes,
-1
drivers/gpu/drm/tegra/rgb.c
··· 88 88 } 89 89 90 90 static const struct drm_connector_funcs tegra_rgb_connector_funcs = { 91 - .dpms = drm_atomic_helper_connector_dpms, 92 91 .reset = drm_atomic_helper_connector_reset, 93 92 .detect = tegra_output_connector_detect, 94 93 .fill_modes = drm_helper_probe_single_connector_modes,
-1
drivers/gpu/drm/tegra/sor.c
··· 1340 1340 } 1341 1341 1342 1342 static const struct drm_connector_funcs tegra_sor_connector_funcs = { 1343 - .dpms = drm_atomic_helper_connector_dpms, 1344 1343 .reset = tegra_sor_connector_reset, 1345 1344 .detect = tegra_sor_connector_detect, 1346 1345 .fill_modes = drm_helper_probe_single_connector_modes,
-2
drivers/gpu/drm/tilcdc/tilcdc_drv.c
··· 542 542 .gem_free_object_unlocked = drm_gem_cma_free_object, 543 543 .gem_vm_ops = &drm_gem_cma_vm_ops, 544 544 .dumb_create = drm_gem_cma_dumb_create, 545 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 546 - .dumb_destroy = drm_gem_dumb_destroy, 547 545 548 546 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 549 547 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
-1
drivers/gpu/drm/tilcdc/tilcdc_panel.c
··· 189 189 190 190 static const struct drm_connector_funcs panel_connector_funcs = { 191 191 .destroy = panel_connector_destroy, 192 - .dpms = drm_atomic_helper_connector_dpms, 193 192 .fill_modes = drm_helper_probe_single_connector_modes, 194 193 .reset = drm_atomic_helper_connector_reset, 195 194 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-1
drivers/gpu/drm/tilcdc/tilcdc_plane.c
··· 28 28 .update_plane = drm_atomic_helper_update_plane, 29 29 .disable_plane = drm_atomic_helper_disable_plane, 30 30 .destroy = drm_plane_cleanup, 31 - .set_property = drm_atomic_helper_plane_set_property, 32 31 .reset = drm_atomic_helper_plane_reset, 33 32 .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state, 34 33 .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
-1
drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
··· 202 202 203 203 static const struct drm_connector_funcs tfp410_connector_funcs = { 204 204 .destroy = tfp410_connector_destroy, 205 - .dpms = drm_atomic_helper_connector_dpms, 206 205 .detect = tfp410_connector_detect, 207 206 .fill_modes = drm_helper_probe_single_connector_modes, 208 207 .reset = drm_atomic_helper_connector_reset,
+1
drivers/gpu/drm/tinydrm/Kconfig
··· 23 23 config TINYDRM_REPAPER 24 24 tristate "DRM support for Pervasive Displays RePaper panels (V231)" 25 25 depends on DRM_TINYDRM && SPI 26 + depends on THERMAL || !THERMAL 26 27 help 27 28 DRM driver for the following Pervasive Displays panels: 28 29 1.44" TFT EPD Panel (E1144CS021)
+1 -2
drivers/gpu/drm/tinydrm/core/tinydrm-pipe.c
··· 71 71 } 72 72 73 73 static const struct drm_connector_funcs tinydrm_connector_funcs = { 74 - .dpms = drm_atomic_helper_connector_dpms, 75 74 .reset = drm_atomic_helper_connector_reset, 76 75 .detect = tinydrm_connector_detect, 77 76 .fill_modes = drm_helper_probe_single_connector_modes, ··· 224 225 return PTR_ERR(connector); 225 226 226 227 ret = drm_simple_display_pipe_init(drm, &tdev->pipe, funcs, formats, 227 - format_count, connector); 228 + format_count, NULL, connector); 228 229 if (ret) 229 230 return ret; 230 231
+6 -2
drivers/gpu/drm/tinydrm/mi0283qt.c
··· 195 195 196 196 device_property_read_u32(dev, "rotation", &rotation); 197 197 198 - ret = mipi_dbi_spi_init(spi, mipi, dc, &mi0283qt_pipe_funcs, 199 - &mi0283qt_driver, &mi0283qt_mode, rotation); 198 + ret = mipi_dbi_spi_init(spi, mipi, dc); 199 + if (ret) 200 + return ret; 201 + 202 + ret = mipi_dbi_init(&spi->dev, mipi, &mi0283qt_pipe_funcs, 203 + &mi0283qt_driver, &mi0283qt_mode, rotation); 200 204 if (ret) 201 205 return ret; 202 206
+5 -12
drivers/gpu/drm/tinydrm/mipi-dbi.c
··· 776 776 /** 777 777 * mipi_dbi_spi_init - Initialize MIPI DBI SPI interfaced controller 778 778 * @spi: SPI device 779 - * @dc: D/C gpio (optional) 780 779 * @mipi: &mipi_dbi structure to initialize 781 - * @pipe_funcs: Display pipe functions 782 - * @driver: DRM driver 783 - * @mode: Display mode 784 - * @rotation: Initial rotation in degrees Counter Clock Wise 780 + * @dc: D/C gpio (optional) 785 781 * 786 782 * This function sets &mipi_dbi->command, enables &mipi->read_commands for the 787 - * usual read commands and initializes @mipi using mipi_dbi_init(). 783 + * usual read commands. It should be followed by a call to mipi_dbi_init() or 784 + * a driver-specific init. 788 785 * 789 786 * If @dc is set, a Type C Option 3 interface is assumed, if not 790 787 * Type C Option 1. ··· 796 799 * Zero on success, negative error code on failure. 797 800 */ 798 801 int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi, 799 - struct gpio_desc *dc, 800 - const struct drm_simple_display_pipe_funcs *pipe_funcs, 801 - struct drm_driver *driver, 802 - const struct drm_display_mode *mode, 803 - unsigned int rotation) 802 + struct gpio_desc *dc) 804 803 { 805 804 size_t tx_size = tinydrm_spi_max_transfer_size(spi, 0); 806 805 struct device *dev = &spi->dev; ··· 842 849 return -ENOMEM; 843 850 } 844 851 845 - return mipi_dbi_init(dev, mipi, pipe_funcs, driver, mode, rotation); 852 + return 0; 846 853 } 847 854 EXPORT_SYMBOL(mipi_dbi_spi_init); 848 855
+8
drivers/gpu/drm/vc4/Kconfig
··· 19 19 This driver requires that "avoid_warnings=2" be present in 20 20 the config.txt for the firmware, to keep it from smashing 21 21 our display setup. 22 + 23 + config DRM_VC4_HDMI_CEC 24 + bool "Broadcom VC4 HDMI CEC Support" 25 + depends on DRM_VC4 26 + select CEC_CORE 27 + help 28 + Choose this option if you have a Broadcom VC4 GPU 29 + and want to use CEC.
+210 -55
drivers/gpu/drm/vc4/vc4_bo.c
··· 24 24 #include "vc4_drv.h" 25 25 #include "uapi/drm/vc4_drm.h" 26 26 27 + static const char * const bo_type_names[] = { 28 + "kernel", 29 + "V3D", 30 + "V3D shader", 31 + "dumb", 32 + "binner", 33 + "RCL", 34 + "BCL", 35 + "kernel BO cache", 36 + }; 37 + 38 + static bool is_user_label(int label) 39 + { 40 + return label >= VC4_BO_TYPE_COUNT; 41 + } 42 + 27 43 static void vc4_bo_stats_dump(struct vc4_dev *vc4) 28 44 { 29 - DRM_INFO("num bos allocated: %d\n", 30 - vc4->bo_stats.num_allocated); 31 - DRM_INFO("size bos allocated: %dkb\n", 32 - vc4->bo_stats.size_allocated / 1024); 33 - DRM_INFO("num bos used: %d\n", 34 - vc4->bo_stats.num_allocated - vc4->bo_stats.num_cached); 35 - DRM_INFO("size bos used: %dkb\n", 36 - (vc4->bo_stats.size_allocated - 37 - vc4->bo_stats.size_cached) / 1024); 38 - DRM_INFO("num bos cached: %d\n", 39 - vc4->bo_stats.num_cached); 40 - DRM_INFO("size bos cached: %dkb\n", 41 - vc4->bo_stats.size_cached / 1024); 45 + int i; 46 + 47 + for (i = 0; i < vc4->num_labels; i++) { 48 + if (!vc4->bo_labels[i].num_allocated) 49 + continue; 50 + 51 + DRM_INFO("%30s: %6dkb BOs (%d)\n", 52 + vc4->bo_labels[i].name, 53 + vc4->bo_labels[i].size_allocated / 1024, 54 + vc4->bo_labels[i].num_allocated); 55 + } 42 56 } 43 57 44 58 #ifdef CONFIG_DEBUG_FS ··· 61 47 struct drm_info_node *node = (struct drm_info_node *)m->private; 62 48 struct drm_device *dev = node->minor->dev; 63 49 struct vc4_dev *vc4 = to_vc4_dev(dev); 64 - struct vc4_bo_stats stats; 50 + int i; 65 51 66 - /* Take a snapshot of the current stats with the lock held. */ 67 52 mutex_lock(&vc4->bo_lock); 68 - stats = vc4->bo_stats; 69 - mutex_unlock(&vc4->bo_lock); 53 + for (i = 0; i < vc4->num_labels; i++) { 54 + if (!vc4->bo_labels[i].num_allocated) 55 + continue; 70 56 71 - seq_printf(m, "num bos allocated: %d\n", 72 - stats.num_allocated); 73 - seq_printf(m, "size bos allocated: %dkb\n", 74 - stats.size_allocated / 1024); 75 - seq_printf(m, "num bos used: %d\n", 76 - stats.num_allocated - stats.num_cached); 77 - seq_printf(m, "size bos used: %dkb\n", 78 - (stats.size_allocated - stats.size_cached) / 1024); 79 - seq_printf(m, "num bos cached: %d\n", 80 - stats.num_cached); 81 - seq_printf(m, "size bos cached: %dkb\n", 82 - stats.size_cached / 1024); 57 + seq_printf(m, "%30s: %6dkb BOs (%d)\n", 58 + vc4->bo_labels[i].name, 59 + vc4->bo_labels[i].size_allocated / 1024, 60 + vc4->bo_labels[i].num_allocated); 61 + } 62 + mutex_unlock(&vc4->bo_lock); 83 63 84 64 return 0; 85 65 } 86 66 #endif 67 + 68 + /* Takes ownership of *name and returns the appropriate slot for it in 69 + * the bo_labels[] array, extending it as necessary. 70 + * 71 + * This is inefficient and could use a hash table instead of walking 72 + * an array and strcmp()ing. However, the assumption is that user 73 + * labeling will be infrequent (scanout buffers and other long-lived 74 + * objects, or debug driver builds), so we can live with it for now. 75 + */ 76 + static int vc4_get_user_label(struct vc4_dev *vc4, const char *name) 77 + { 78 + int i; 79 + int free_slot = -1; 80 + 81 + for (i = 0; i < vc4->num_labels; i++) { 82 + if (!vc4->bo_labels[i].name) { 83 + free_slot = i; 84 + } else if (strcmp(vc4->bo_labels[i].name, name) == 0) { 85 + kfree(name); 86 + return i; 87 + } 88 + } 89 + 90 + if (free_slot != -1) { 91 + WARN_ON(vc4->bo_labels[free_slot].num_allocated != 0); 92 + vc4->bo_labels[free_slot].name = name; 93 + return free_slot; 94 + } else { 95 + u32 new_label_count = vc4->num_labels + 1; 96 + struct vc4_label *new_labels = 97 + krealloc(vc4->bo_labels, 98 + new_label_count * sizeof(*new_labels), 99 + GFP_KERNEL); 100 + 101 + if (!new_labels) { 102 + kfree(name); 103 + return -1; 104 + } 105 + 106 + free_slot = vc4->num_labels; 107 + vc4->bo_labels = new_labels; 108 + vc4->num_labels = new_label_count; 109 + 110 + vc4->bo_labels[free_slot].name = name; 111 + vc4->bo_labels[free_slot].num_allocated = 0; 112 + vc4->bo_labels[free_slot].size_allocated = 0; 113 + 114 + return free_slot; 115 + } 116 + } 117 + 118 + static void vc4_bo_set_label(struct drm_gem_object *gem_obj, int label) 119 + { 120 + struct vc4_bo *bo = to_vc4_bo(gem_obj); 121 + struct vc4_dev *vc4 = to_vc4_dev(gem_obj->dev); 122 + 123 + lockdep_assert_held(&vc4->bo_lock); 124 + 125 + if (label != -1) { 126 + vc4->bo_labels[label].num_allocated++; 127 + vc4->bo_labels[label].size_allocated += gem_obj->size; 128 + } 129 + 130 + vc4->bo_labels[bo->label].num_allocated--; 131 + vc4->bo_labels[bo->label].size_allocated -= gem_obj->size; 132 + 133 + if (vc4->bo_labels[bo->label].num_allocated == 0 && 134 + is_user_label(bo->label)) { 135 + /* Free user BO label slots on last unreference. 136 + * Slots are just where we track the stats for a given 137 + * name, and once a name is unused we can reuse that 138 + * slot. 139 + */ 140 + kfree(vc4->bo_labels[bo->label].name); 141 + vc4->bo_labels[bo->label].name = NULL; 142 + } 143 + 144 + bo->label = label; 145 + } 87 146 88 147 static uint32_t bo_page_index(size_t size) 89 148 { 90 149 return (size / PAGE_SIZE) - 1; 91 150 } 92 151 93 - /* Must be called with bo_lock held. */ 94 152 static void vc4_bo_destroy(struct vc4_bo *bo) 95 153 { 96 154 struct drm_gem_object *obj = &bo->base.base; 97 155 struct vc4_dev *vc4 = to_vc4_dev(obj->dev); 156 + 157 + lockdep_assert_held(&vc4->bo_lock); 158 + 159 + vc4_bo_set_label(obj, -1); 98 160 99 161 if (bo->validated_shader) { 100 162 kfree(bo->validated_shader->texture_samples); ··· 178 88 bo->validated_shader = NULL; 179 89 } 180 90 181 - vc4->bo_stats.num_allocated--; 182 - vc4->bo_stats.size_allocated -= obj->size; 183 - 184 91 reservation_object_fini(&bo->_resv); 185 92 186 93 drm_gem_cma_free_object(obj); 187 94 } 188 95 189 - /* Must be called with bo_lock held. */ 190 96 static void vc4_bo_remove_from_cache(struct vc4_bo *bo) 191 97 { 192 - struct drm_gem_object *obj = &bo->base.base; 193 - struct vc4_dev *vc4 = to_vc4_dev(obj->dev); 98 + struct vc4_dev *vc4 = to_vc4_dev(bo->base.base.dev); 194 99 195 - vc4->bo_stats.num_cached--; 196 - vc4->bo_stats.size_cached -= obj->size; 197 - 100 + lockdep_assert_held(&vc4->bo_lock); 198 101 list_del(&bo->unref_head); 199 102 list_del(&bo->size_head); 200 103 } ··· 248 165 } 249 166 250 167 static struct vc4_bo *vc4_bo_get_from_cache(struct drm_device *dev, 251 - uint32_t size) 168 + uint32_t size, 169 + enum vc4_kernel_bo_type type) 252 170 { 253 171 struct vc4_dev *vc4 = to_vc4_dev(dev); 254 172 uint32_t page_index = bo_page_index(size); ··· 270 186 kref_init(&bo->base.base.refcount); 271 187 272 188 out: 189 + if (bo) 190 + vc4_bo_set_label(&bo->base.base, type); 273 191 mutex_unlock(&vc4->bo_lock); 274 192 return bo; 275 193 } ··· 294 208 return ERR_PTR(-ENOMEM); 295 209 296 210 mutex_lock(&vc4->bo_lock); 297 - vc4->bo_stats.num_allocated++; 298 - vc4->bo_stats.size_allocated += size; 211 + bo->label = VC4_BO_TYPE_KERNEL; 212 + vc4->bo_labels[VC4_BO_TYPE_KERNEL].num_allocated++; 213 + vc4->bo_labels[VC4_BO_TYPE_KERNEL].size_allocated += size; 299 214 mutex_unlock(&vc4->bo_lock); 300 215 bo->resv = &bo->_resv; 301 216 reservation_object_init(bo->resv); ··· 305 218 } 306 219 307 220 struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size, 308 - bool allow_unzeroed) 221 + bool allow_unzeroed, enum vc4_kernel_bo_type type) 309 222 { 310 223 size_t size = roundup(unaligned_size, PAGE_SIZE); 311 224 struct vc4_dev *vc4 = to_vc4_dev(dev); ··· 316 229 return ERR_PTR(-EINVAL); 317 230 318 231 /* First, try to get a vc4_bo from the kernel BO cache. */ 319 - bo = vc4_bo_get_from_cache(dev, size); 232 + bo = vc4_bo_get_from_cache(dev, size, type); 320 233 if (bo) { 321 234 if (!allow_unzeroed) 322 235 memset(bo->base.vaddr, 0, bo->base.base.size); ··· 338 251 return ERR_PTR(-ENOMEM); 339 252 } 340 253 } 341 - return to_vc4_bo(&cma_obj->base); 254 + bo = to_vc4_bo(&cma_obj->base); 255 + 256 + mutex_lock(&vc4->bo_lock); 257 + vc4_bo_set_label(&cma_obj->base, type); 258 + mutex_unlock(&vc4->bo_lock); 259 + 260 + return bo; 342 261 } 343 262 344 263 int vc4_dumb_create(struct drm_file *file_priv, ··· 361 268 if (args->size < args->pitch * args->height) 362 269 args->size = args->pitch * args->height; 363 270 364 - bo = vc4_bo_create(dev, args->size, false); 271 + bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_DUMB); 365 272 if (IS_ERR(bo)) 366 273 return PTR_ERR(bo); 367 274 ··· 371 278 return ret; 372 279 } 373 280 374 - /* Must be called with bo_lock held. */ 375 281 static void vc4_bo_cache_free_old(struct drm_device *dev) 376 282 { 377 283 struct vc4_dev *vc4 = to_vc4_dev(dev); 378 284 unsigned long expire_time = jiffies - msecs_to_jiffies(1000); 285 + 286 + lockdep_assert_held(&vc4->bo_lock); 379 287 380 288 while (!list_empty(&vc4->bo_cache.time_list)) { 381 289 struct vc4_bo *bo = list_last_entry(&vc4->bo_cache.time_list, ··· 442 348 list_add(&bo->size_head, cache_list); 443 349 list_add(&bo->unref_head, &vc4->bo_cache.time_list); 444 350 445 - vc4->bo_stats.num_cached++; 446 - vc4->bo_stats.size_cached += gem_bo->size; 351 + vc4_bo_set_label(&bo->base.base, VC4_BO_TYPE_KERNEL_CACHE); 447 352 448 353 vc4_bo_cache_free_old(dev); 449 354 ··· 576 483 * We can't allocate from the BO cache, because the BOs don't 577 484 * get zeroed, and that might leak data between users. 578 485 */ 579 - bo = vc4_bo_create(dev, args->size, false); 486 + bo = vc4_bo_create(dev, args->size, false, VC4_BO_TYPE_V3D); 580 487 if (IS_ERR(bo)) 581 488 return PTR_ERR(bo); 582 489 ··· 629 536 return -EINVAL; 630 537 } 631 538 632 - bo = vc4_bo_create(dev, args->size, true); 539 + bo = vc4_bo_create(dev, args->size, true, VC4_BO_TYPE_V3D_SHADER); 633 540 if (IS_ERR(bo)) 634 541 return PTR_ERR(bo); 635 542 ··· 744 651 return 0; 745 652 } 746 653 747 - void vc4_bo_cache_init(struct drm_device *dev) 654 + int vc4_bo_cache_init(struct drm_device *dev) 748 655 { 749 656 struct vc4_dev *vc4 = to_vc4_dev(dev); 657 + int i; 658 + 659 + /* Create the initial set of BO labels that the kernel will 660 + * use. This lets us avoid a bunch of string reallocation in 661 + * the kernel's draw and BO allocation paths. 662 + */ 663 + vc4->bo_labels = kcalloc(VC4_BO_TYPE_COUNT, sizeof(*vc4->bo_labels), 664 + GFP_KERNEL); 665 + if (!vc4->bo_labels) 666 + return -ENOMEM; 667 + vc4->num_labels = VC4_BO_TYPE_COUNT; 668 + 669 + BUILD_BUG_ON(ARRAY_SIZE(bo_type_names) != VC4_BO_TYPE_COUNT); 670 + for (i = 0; i < VC4_BO_TYPE_COUNT; i++) 671 + vc4->bo_labels[i].name = bo_type_names[i]; 750 672 751 673 mutex_init(&vc4->bo_lock); 752 674 ··· 771 663 setup_timer(&vc4->bo_cache.time_timer, 772 664 vc4_bo_cache_time_timer, 773 665 (unsigned long)dev); 666 + 667 + return 0; 774 668 } 775 669 776 670 void vc4_bo_cache_destroy(struct drm_device *dev) 777 671 { 778 672 struct vc4_dev *vc4 = to_vc4_dev(dev); 673 + int i; 779 674 780 675 del_timer(&vc4->bo_cache.time_timer); 781 676 cancel_work_sync(&vc4->bo_cache.time_work); 782 677 783 678 vc4_bo_cache_purge(dev); 784 679 785 - if (vc4->bo_stats.num_allocated) { 786 - DRM_ERROR("Destroying BO cache while BOs still allocated:\n"); 787 - vc4_bo_stats_dump(vc4); 680 + for (i = 0; i < vc4->num_labels; i++) { 681 + if (vc4->bo_labels[i].num_allocated) { 682 + DRM_ERROR("Destroying BO cache with %d %s " 683 + "BOs still allocated\n", 684 + vc4->bo_labels[i].num_allocated, 685 + vc4->bo_labels[i].name); 686 + } 687 + 688 + if (is_user_label(i)) 689 + kfree(vc4->bo_labels[i].name); 788 690 } 691 + kfree(vc4->bo_labels); 692 + } 693 + 694 + int vc4_label_bo_ioctl(struct drm_device *dev, void *data, 695 + struct drm_file *file_priv) 696 + { 697 + struct vc4_dev *vc4 = to_vc4_dev(dev); 698 + struct drm_vc4_label_bo *args = data; 699 + char *name; 700 + struct drm_gem_object *gem_obj; 701 + int ret = 0, label; 702 + 703 + if (!args->len) 704 + return -EINVAL; 705 + 706 + name = strndup_user(u64_to_user_ptr(args->name), args->len + 1); 707 + if (IS_ERR(name)) 708 + return PTR_ERR(name); 709 + 710 + gem_obj = drm_gem_object_lookup(file_priv, args->handle); 711 + if (!gem_obj) { 712 + DRM_ERROR("Failed to look up GEM BO %d\n", args->handle); 713 + kfree(name); 714 + return -ENOENT; 715 + } 716 + 717 + mutex_lock(&vc4->bo_lock); 718 + label = vc4_get_user_label(vc4, name); 719 + if (label != -1) 720 + vc4_bo_set_label(gem_obj, label); 721 + else 722 + ret = -ENOMEM; 723 + mutex_unlock(&vc4->bo_lock); 724 + 725 + drm_gem_object_unreference_unlocked(gem_obj); 726 + 727 + return ret; 789 728 }
+6 -4
drivers/gpu/drm/vc4/vc4_drv.c
··· 140 140 DRM_IOCTL_DEF_DRV(VC4_GET_PARAM, vc4_get_param_ioctl, DRM_RENDER_ALLOW), 141 141 DRM_IOCTL_DEF_DRV(VC4_SET_TILING, vc4_set_tiling_ioctl, DRM_RENDER_ALLOW), 142 142 DRM_IOCTL_DEF_DRV(VC4_GET_TILING, vc4_get_tiling_ioctl, DRM_RENDER_ALLOW), 143 + DRM_IOCTL_DEF_DRV(VC4_LABEL_BO, vc4_label_bo_ioctl, DRM_RENDER_ALLOW), 143 144 }; 144 145 145 146 static struct drm_driver vc4_drm_driver = { ··· 179 178 .gem_prime_mmap = vc4_prime_mmap, 180 179 181 180 .dumb_create = vc4_dumb_create, 182 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 183 - .dumb_destroy = drm_gem_dumb_destroy, 184 181 185 182 .ioctls = vc4_drm_ioctls, 186 183 .num_ioctls = ARRAY_SIZE(vc4_drm_ioctls), ··· 256 257 vc4->dev = drm; 257 258 drm->dev_private = vc4; 258 259 259 - vc4_bo_cache_init(drm); 260 + ret = vc4_bo_cache_init(drm); 261 + if (ret) 262 + goto dev_unref; 260 263 261 264 drm_mode_config_init(drm); 262 265 ··· 282 281 component_unbind_all(dev, drm); 283 282 gem_destroy: 284 283 vc4_gem_destroy(drm); 285 - drm_dev_unref(drm); 286 284 vc4_bo_cache_destroy(drm); 285 + dev_unref: 286 + drm_dev_unref(drm); 287 287 return ret; 288 288 } 289 289
+32 -7
drivers/gpu/drm/vc4/vc4_drv.h
··· 11 11 #include <drm/drm_encoder.h> 12 12 #include <drm/drm_gem_cma_helper.h> 13 13 14 + /* Don't forget to update vc4_bo.c: bo_type_names[] when adding to 15 + * this. 16 + */ 17 + enum vc4_kernel_bo_type { 18 + /* Any kernel allocation (gem_create_object hook) before it 19 + * gets another type set. 20 + */ 21 + VC4_BO_TYPE_KERNEL, 22 + VC4_BO_TYPE_V3D, 23 + VC4_BO_TYPE_V3D_SHADER, 24 + VC4_BO_TYPE_DUMB, 25 + VC4_BO_TYPE_BIN, 26 + VC4_BO_TYPE_RCL, 27 + VC4_BO_TYPE_BCL, 28 + VC4_BO_TYPE_KERNEL_CACHE, 29 + VC4_BO_TYPE_COUNT 30 + }; 31 + 14 32 struct vc4_dev { 15 33 struct drm_device *dev; 16 34 ··· 64 46 struct timer_list time_timer; 65 47 } bo_cache; 66 48 67 - struct vc4_bo_stats { 49 + u32 num_labels; 50 + struct vc4_label { 51 + const char *name; 68 52 u32 num_allocated; 69 53 u32 size_allocated; 70 - u32 num_cached; 71 - u32 size_cached; 72 - } bo_stats; 54 + } *bo_labels; 73 55 74 - /* Protects bo_cache and the BO stats. */ 56 + /* Protects bo_cache and bo_labels. */ 75 57 struct mutex bo_lock; 76 58 77 59 uint64_t dma_fence_context; ··· 187 169 /* normally (resv == &_resv) except for imported bo's */ 188 170 struct reservation_object *resv; 189 171 struct reservation_object _resv; 172 + 173 + /* One of enum vc4_kernel_bo_type, or VC4_BO_TYPE_COUNT + i 174 + * for user-allocated labels. 175 + */ 176 + int label; 190 177 }; 191 178 192 179 static inline struct vc4_bo * ··· 483 460 struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size); 484 461 void vc4_free_object(struct drm_gem_object *gem_obj); 485 462 struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t size, 486 - bool from_cache); 463 + bool from_cache, enum vc4_kernel_bo_type type); 487 464 int vc4_dumb_create(struct drm_file *file_priv, 488 465 struct drm_device *dev, 489 466 struct drm_mode_create_dumb *args); ··· 501 478 struct drm_file *file_priv); 502 479 int vc4_get_hang_state_ioctl(struct drm_device *dev, void *data, 503 480 struct drm_file *file_priv); 481 + int vc4_label_bo_ioctl(struct drm_device *dev, void *data, 482 + struct drm_file *file_priv); 504 483 int vc4_mmap(struct file *filp, struct vm_area_struct *vma); 505 484 struct reservation_object *vc4_prime_res_obj(struct drm_gem_object *obj); 506 485 int vc4_prime_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma); ··· 510 485 struct dma_buf_attachment *attach, 511 486 struct sg_table *sgt); 512 487 void *vc4_prime_vmap(struct drm_gem_object *obj); 513 - void vc4_bo_cache_init(struct drm_device *dev); 488 + int vc4_bo_cache_init(struct drm_device *dev); 514 489 void vc4_bo_cache_destroy(struct drm_device *dev); 515 490 int vc4_bo_stats_debugfs(struct seq_file *m, void *arg); 516 491
+6 -7
drivers/gpu/drm/vc4/vc4_gem.c
··· 119 119 bo_state[i].size = vc4_bo->base.base.size; 120 120 } 121 121 122 - if (copy_to_user((void __user *)(uintptr_t)get_state->bo, 122 + if (copy_to_user(u64_to_user_ptr(get_state->bo), 123 123 bo_state, 124 124 state->bo_count * sizeof(*bo_state))) 125 125 ret = -EFAULT; ··· 678 678 goto fail; 679 679 } 680 680 681 - if (copy_from_user(handles, 682 - (void __user *)(uintptr_t)args->bo_handles, 681 + if (copy_from_user(handles, u64_to_user_ptr(args->bo_handles), 683 682 exec->bo_count * sizeof(uint32_t))) { 684 683 ret = -EFAULT; 685 684 DRM_ERROR("Failed to copy in GEM handles\n"); ··· 754 755 exec->shader_state_size = args->shader_rec_count; 755 756 756 757 if (copy_from_user(bin, 757 - (void __user *)(uintptr_t)args->bin_cl, 758 + u64_to_user_ptr(args->bin_cl), 758 759 args->bin_cl_size)) { 759 760 ret = -EFAULT; 760 761 goto fail; 761 762 } 762 763 763 764 if (copy_from_user(exec->shader_rec_u, 764 - (void __user *)(uintptr_t)args->shader_rec, 765 + u64_to_user_ptr(args->shader_rec), 765 766 args->shader_rec_size)) { 766 767 ret = -EFAULT; 767 768 goto fail; 768 769 } 769 770 770 771 if (copy_from_user(exec->uniforms_u, 771 - (void __user *)(uintptr_t)args->uniforms, 772 + u64_to_user_ptr(args->uniforms), 772 773 args->uniforms_size)) { 773 774 ret = -EFAULT; 774 775 goto fail; 775 776 } 776 777 777 - bo = vc4_bo_create(dev, exec_size, true); 778 + bo = vc4_bo_create(dev, exec_size, true, VC4_BO_TYPE_BCL); 778 779 if (IS_ERR(bo)) { 779 780 DRM_ERROR("Couldn't allocate BO for binning\n"); 780 781 ret = PTR_ERR(bo);
+252 -36
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 57 57 #include <sound/pcm_drm_eld.h> 58 58 #include <sound/pcm_params.h> 59 59 #include <sound/soc.h> 60 + #include "media/cec.h" 60 61 #include "vc4_drv.h" 61 62 #include "vc4_regs.h" 63 + 64 + #define HSM_CLOCK_FREQ 163682864 65 + #define CEC_CLOCK_FREQ 40000 66 + #define CEC_CLOCK_DIV (HSM_CLOCK_FREQ / CEC_CLOCK_FREQ) 62 67 63 68 /* HDMI audio information */ 64 69 struct vc4_hdmi_audio { ··· 89 84 void __iomem *hd_regs; 90 85 int hpd_gpio; 91 86 bool hpd_active_low; 87 + 88 + struct cec_adapter *cec_adap; 89 + struct cec_msg cec_rx_msg; 90 + bool cec_tx_ok; 91 + bool cec_irq_was_rx; 92 92 93 93 struct clk *pixel_clock; 94 94 struct clk *hsm_clock; ··· 159 149 HDMI_REG(VC4_HDMI_VERTB1), 160 150 HDMI_REG(VC4_HDMI_TX_PHY_RESET_CTL), 161 151 HDMI_REG(VC4_HDMI_TX_PHY_CTL0), 152 + 153 + HDMI_REG(VC4_HDMI_CEC_CNTRL_1), 154 + HDMI_REG(VC4_HDMI_CEC_CNTRL_2), 155 + HDMI_REG(VC4_HDMI_CEC_CNTRL_3), 156 + HDMI_REG(VC4_HDMI_CEC_CNTRL_4), 157 + HDMI_REG(VC4_HDMI_CEC_CNTRL_5), 158 + HDMI_REG(VC4_HDMI_CPU_STATUS), 159 + HDMI_REG(VC4_HDMI_CPU_MASK_STATUS), 160 + 161 + HDMI_REG(VC4_HDMI_CEC_RX_DATA_1), 162 + HDMI_REG(VC4_HDMI_CEC_RX_DATA_2), 163 + HDMI_REG(VC4_HDMI_CEC_RX_DATA_3), 164 + HDMI_REG(VC4_HDMI_CEC_RX_DATA_4), 165 + HDMI_REG(VC4_HDMI_CEC_TX_DATA_1), 166 + HDMI_REG(VC4_HDMI_CEC_TX_DATA_2), 167 + HDMI_REG(VC4_HDMI_CEC_TX_DATA_3), 168 + HDMI_REG(VC4_HDMI_CEC_TX_DATA_4), 162 169 }; 163 170 164 171 static const struct { ··· 243 216 if (gpio_get_value_cansleep(vc4->hdmi->hpd_gpio) ^ 244 217 vc4->hdmi->hpd_active_low) 245 218 return connector_status_connected; 246 - else 247 - return connector_status_disconnected; 219 + cec_phys_addr_invalidate(vc4->hdmi->cec_adap); 220 + return connector_status_disconnected; 248 221 } 249 222 250 223 if (drm_probe_ddc(vc4->hdmi->ddc)) ··· 252 225 253 226 if (HDMI_READ(VC4_HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) 254 227 return connector_status_connected; 255 - else 256 - return connector_status_disconnected; 228 + cec_phys_addr_invalidate(vc4->hdmi->cec_adap); 229 + return connector_status_disconnected; 257 230 } 258 231 259 232 static void vc4_hdmi_connector_destroy(struct drm_connector *connector) ··· 274 247 struct edid *edid; 275 248 276 249 edid = drm_get_edid(connector, vc4->hdmi->ddc); 250 + cec_s_phys_addr_from_edid(vc4->hdmi->cec_adap, edid); 277 251 if (!edid) 278 252 return -ENODEV; 279 253 ··· 293 265 } 294 266 295 267 static const struct drm_connector_funcs vc4_hdmi_connector_funcs = { 296 - .dpms = drm_atomic_helper_connector_dpms, 297 268 .detect = vc4_hdmi_connector_detect, 298 269 .fill_modes = drm_helper_probe_single_connector_modes, 299 270 .destroy = vc4_hdmi_connector_destroy, ··· 490 463 HD_WRITE(VC4_HD_VID_CTL, 491 464 HD_READ(VC4_HD_VID_CTL) & ~VC4_HD_VID_CTL_ENABLE); 492 465 493 - HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); 494 - udelay(1); 495 - HD_WRITE(VC4_HD_M_CTL, 0); 496 - 497 - clk_disable_unprepare(hdmi->hsm_clock); 498 466 clk_disable_unprepare(hdmi->pixel_clock); 499 467 500 468 ret = pm_runtime_put(&hdmi->pdev->dev); ··· 531 509 return; 532 510 } 533 511 534 - /* This is the rate that is set by the firmware. The number 535 - * needs to be a bit higher than the pixel clock rate 536 - * (generally 148.5Mhz). 537 - */ 538 - ret = clk_set_rate(hdmi->hsm_clock, 163682864); 539 - if (ret) { 540 - DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); 541 - return; 542 - } 543 - 544 512 ret = clk_set_rate(hdmi->pixel_clock, 545 513 mode->clock * 1000 * 546 514 ((mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1)); ··· 544 532 DRM_ERROR("Failed to turn on pixel clock: %d\n", ret); 545 533 return; 546 534 } 547 - 548 - ret = clk_prepare_enable(hdmi->hsm_clock); 549 - if (ret) { 550 - DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", 551 - ret); 552 - clk_disable_unprepare(hdmi->pixel_clock); 553 - return; 554 - } 555 - 556 - HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); 557 - udelay(1); 558 - HD_WRITE(VC4_HD_M_CTL, 0); 559 - 560 - HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); 561 535 562 536 HDMI_WRITE(VC4_HDMI_SW_RESET_CONTROL, 563 537 VC4_HDMI_SW_RESET_HDMI | ··· 1148 1150 snd_soc_unregister_codec(dev); 1149 1151 } 1150 1152 1153 + #ifdef CONFIG_DRM_VC4_HDMI_CEC 1154 + static irqreturn_t vc4_cec_irq_handler_thread(int irq, void *priv) 1155 + { 1156 + struct vc4_dev *vc4 = priv; 1157 + struct vc4_hdmi *hdmi = vc4->hdmi; 1158 + 1159 + if (hdmi->cec_irq_was_rx) { 1160 + if (hdmi->cec_rx_msg.len) 1161 + cec_received_msg(hdmi->cec_adap, &hdmi->cec_rx_msg); 1162 + } else if (hdmi->cec_tx_ok) { 1163 + cec_transmit_done(hdmi->cec_adap, CEC_TX_STATUS_OK, 1164 + 0, 0, 0, 0); 1165 + } else { 1166 + /* 1167 + * This CEC implementation makes 1 retry, so if we 1168 + * get a NACK, then that means it made 2 attempts. 1169 + */ 1170 + cec_transmit_done(hdmi->cec_adap, CEC_TX_STATUS_NACK, 1171 + 0, 2, 0, 0); 1172 + } 1173 + return IRQ_HANDLED; 1174 + } 1175 + 1176 + static void vc4_cec_read_msg(struct vc4_dev *vc4, u32 cntrl1) 1177 + { 1178 + struct cec_msg *msg = &vc4->hdmi->cec_rx_msg; 1179 + unsigned int i; 1180 + 1181 + msg->len = 1 + ((cntrl1 & VC4_HDMI_CEC_REC_WRD_CNT_MASK) >> 1182 + VC4_HDMI_CEC_REC_WRD_CNT_SHIFT); 1183 + for (i = 0; i < msg->len; i += 4) { 1184 + u32 val = HDMI_READ(VC4_HDMI_CEC_RX_DATA_1 + i); 1185 + 1186 + msg->msg[i] = val & 0xff; 1187 + msg->msg[i + 1] = (val >> 8) & 0xff; 1188 + msg->msg[i + 2] = (val >> 16) & 0xff; 1189 + msg->msg[i + 3] = (val >> 24) & 0xff; 1190 + } 1191 + } 1192 + 1193 + static irqreturn_t vc4_cec_irq_handler(int irq, void *priv) 1194 + { 1195 + struct vc4_dev *vc4 = priv; 1196 + struct vc4_hdmi *hdmi = vc4->hdmi; 1197 + u32 stat = HDMI_READ(VC4_HDMI_CPU_STATUS); 1198 + u32 cntrl1, cntrl5; 1199 + 1200 + if (!(stat & VC4_HDMI_CPU_CEC)) 1201 + return IRQ_NONE; 1202 + hdmi->cec_rx_msg.len = 0; 1203 + cntrl1 = HDMI_READ(VC4_HDMI_CEC_CNTRL_1); 1204 + cntrl5 = HDMI_READ(VC4_HDMI_CEC_CNTRL_5); 1205 + hdmi->cec_irq_was_rx = cntrl5 & VC4_HDMI_CEC_RX_CEC_INT; 1206 + if (hdmi->cec_irq_was_rx) { 1207 + vc4_cec_read_msg(vc4, cntrl1); 1208 + cntrl1 |= VC4_HDMI_CEC_CLEAR_RECEIVE_OFF; 1209 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1, cntrl1); 1210 + cntrl1 &= ~VC4_HDMI_CEC_CLEAR_RECEIVE_OFF; 1211 + } else { 1212 + hdmi->cec_tx_ok = cntrl1 & VC4_HDMI_CEC_TX_STATUS_GOOD; 1213 + cntrl1 &= ~VC4_HDMI_CEC_START_XMIT_BEGIN; 1214 + } 1215 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1, cntrl1); 1216 + HDMI_WRITE(VC4_HDMI_CPU_CLEAR, VC4_HDMI_CPU_CEC); 1217 + 1218 + return IRQ_WAKE_THREAD; 1219 + } 1220 + 1221 + static int vc4_hdmi_cec_adap_enable(struct cec_adapter *adap, bool enable) 1222 + { 1223 + struct vc4_dev *vc4 = cec_get_drvdata(adap); 1224 + /* clock period in microseconds */ 1225 + const u32 usecs = 1000000 / CEC_CLOCK_FREQ; 1226 + u32 val = HDMI_READ(VC4_HDMI_CEC_CNTRL_5); 1227 + 1228 + val &= ~(VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET | 1229 + VC4_HDMI_CEC_CNT_TO_4700_US_MASK | 1230 + VC4_HDMI_CEC_CNT_TO_4500_US_MASK); 1231 + val |= ((4700 / usecs) << VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT) | 1232 + ((4500 / usecs) << VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT); 1233 + 1234 + if (enable) { 1235 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_5, val | 1236 + VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET); 1237 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_5, val); 1238 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_2, 1239 + ((1500 / usecs) << VC4_HDMI_CEC_CNT_TO_1500_US_SHIFT) | 1240 + ((1300 / usecs) << VC4_HDMI_CEC_CNT_TO_1300_US_SHIFT) | 1241 + ((800 / usecs) << VC4_HDMI_CEC_CNT_TO_800_US_SHIFT) | 1242 + ((600 / usecs) << VC4_HDMI_CEC_CNT_TO_600_US_SHIFT) | 1243 + ((400 / usecs) << VC4_HDMI_CEC_CNT_TO_400_US_SHIFT)); 1244 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_3, 1245 + ((2750 / usecs) << VC4_HDMI_CEC_CNT_TO_2750_US_SHIFT) | 1246 + ((2400 / usecs) << VC4_HDMI_CEC_CNT_TO_2400_US_SHIFT) | 1247 + ((2050 / usecs) << VC4_HDMI_CEC_CNT_TO_2050_US_SHIFT) | 1248 + ((1700 / usecs) << VC4_HDMI_CEC_CNT_TO_1700_US_SHIFT)); 1249 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_4, 1250 + ((4300 / usecs) << VC4_HDMI_CEC_CNT_TO_4300_US_SHIFT) | 1251 + ((3900 / usecs) << VC4_HDMI_CEC_CNT_TO_3900_US_SHIFT) | 1252 + ((3600 / usecs) << VC4_HDMI_CEC_CNT_TO_3600_US_SHIFT) | 1253 + ((3500 / usecs) << VC4_HDMI_CEC_CNT_TO_3500_US_SHIFT)); 1254 + 1255 + HDMI_WRITE(VC4_HDMI_CPU_MASK_CLEAR, VC4_HDMI_CPU_CEC); 1256 + } else { 1257 + HDMI_WRITE(VC4_HDMI_CPU_MASK_SET, VC4_HDMI_CPU_CEC); 1258 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_5, val | 1259 + VC4_HDMI_CEC_TX_SW_RESET | VC4_HDMI_CEC_RX_SW_RESET); 1260 + } 1261 + return 0; 1262 + } 1263 + 1264 + static int vc4_hdmi_cec_adap_log_addr(struct cec_adapter *adap, u8 log_addr) 1265 + { 1266 + struct vc4_dev *vc4 = cec_get_drvdata(adap); 1267 + 1268 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1, 1269 + (HDMI_READ(VC4_HDMI_CEC_CNTRL_1) & ~VC4_HDMI_CEC_ADDR_MASK) | 1270 + (log_addr & 0xf) << VC4_HDMI_CEC_ADDR_SHIFT); 1271 + return 0; 1272 + } 1273 + 1274 + static int vc4_hdmi_cec_adap_transmit(struct cec_adapter *adap, u8 attempts, 1275 + u32 signal_free_time, struct cec_msg *msg) 1276 + { 1277 + struct vc4_dev *vc4 = cec_get_drvdata(adap); 1278 + u32 val; 1279 + unsigned int i; 1280 + 1281 + for (i = 0; i < msg->len; i += 4) 1282 + HDMI_WRITE(VC4_HDMI_CEC_TX_DATA_1 + i, 1283 + (msg->msg[i]) | 1284 + (msg->msg[i + 1] << 8) | 1285 + (msg->msg[i + 2] << 16) | 1286 + (msg->msg[i + 3] << 24)); 1287 + 1288 + val = HDMI_READ(VC4_HDMI_CEC_CNTRL_1); 1289 + val &= ~VC4_HDMI_CEC_START_XMIT_BEGIN; 1290 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1, val); 1291 + val &= ~VC4_HDMI_CEC_MESSAGE_LENGTH_MASK; 1292 + val |= (msg->len - 1) << VC4_HDMI_CEC_MESSAGE_LENGTH_SHIFT; 1293 + val |= VC4_HDMI_CEC_START_XMIT_BEGIN; 1294 + 1295 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1, val); 1296 + return 0; 1297 + } 1298 + 1299 + static const struct cec_adap_ops vc4_hdmi_cec_adap_ops = { 1300 + .adap_enable = vc4_hdmi_cec_adap_enable, 1301 + .adap_log_addr = vc4_hdmi_cec_adap_log_addr, 1302 + .adap_transmit = vc4_hdmi_cec_adap_transmit, 1303 + }; 1304 + #endif 1305 + 1151 1306 static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) 1152 1307 { 1153 1308 struct platform_device *pdev = to_platform_device(dev); ··· 1356 1205 return -EPROBE_DEFER; 1357 1206 } 1358 1207 1208 + /* This is the rate that is set by the firmware. The number 1209 + * needs to be a bit higher than the pixel clock rate 1210 + * (generally 148.5Mhz). 1211 + */ 1212 + ret = clk_set_rate(hdmi->hsm_clock, HSM_CLOCK_FREQ); 1213 + if (ret) { 1214 + DRM_ERROR("Failed to set HSM clock rate: %d\n", ret); 1215 + goto err_put_i2c; 1216 + } 1217 + 1218 + ret = clk_prepare_enable(hdmi->hsm_clock); 1219 + if (ret) { 1220 + DRM_ERROR("Failed to turn on HDMI state machine clock: %d\n", 1221 + ret); 1222 + goto err_put_i2c; 1223 + } 1224 + 1359 1225 /* Only use the GPIO HPD pin if present in the DT, otherwise 1360 1226 * we'll use the HDMI core's register. 1361 1227 */ ··· 1384 1216 &hpd_gpio_flags); 1385 1217 if (hdmi->hpd_gpio < 0) { 1386 1218 ret = hdmi->hpd_gpio; 1387 - goto err_put_i2c; 1219 + goto err_unprepare_hsm; 1388 1220 } 1389 1221 1390 1222 hdmi->hpd_active_low = hpd_gpio_flags & OF_GPIO_ACTIVE_LOW; ··· 1392 1224 1393 1225 vc4->hdmi = hdmi; 1394 1226 1227 + /* HDMI core must be enabled. */ 1228 + if (!(HD_READ(VC4_HD_M_CTL) & VC4_HD_M_ENABLE)) { 1229 + HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_SW_RST); 1230 + udelay(1); 1231 + HD_WRITE(VC4_HD_M_CTL, 0); 1232 + 1233 + HD_WRITE(VC4_HD_M_CTL, VC4_HD_M_ENABLE); 1234 + } 1395 1235 pm_runtime_enable(dev); 1396 1236 1397 1237 drm_encoder_init(drm, hdmi->encoder, &vc4_hdmi_encoder_funcs, ··· 1411 1235 ret = PTR_ERR(hdmi->connector); 1412 1236 goto err_destroy_encoder; 1413 1237 } 1238 + #ifdef CONFIG_DRM_VC4_HDMI_CEC 1239 + hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops, 1240 + vc4, "vc4", 1241 + CEC_CAP_TRANSMIT | 1242 + CEC_CAP_LOG_ADDRS | 1243 + CEC_CAP_PASSTHROUGH | 1244 + CEC_CAP_RC, 1); 1245 + ret = PTR_ERR_OR_ZERO(hdmi->cec_adap); 1246 + if (ret < 0) 1247 + goto err_destroy_conn; 1248 + HDMI_WRITE(VC4_HDMI_CPU_MASK_SET, 0xffffffff); 1249 + value = HDMI_READ(VC4_HDMI_CEC_CNTRL_1); 1250 + value &= ~VC4_HDMI_CEC_DIV_CLK_CNT_MASK; 1251 + /* 1252 + * Set the logical address to Unregistered and set the clock 1253 + * divider: the hsm_clock rate and this divider setting will 1254 + * give a 40 kHz CEC clock. 1255 + */ 1256 + value |= VC4_HDMI_CEC_ADDR_MASK | 1257 + (4091 << VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT); 1258 + HDMI_WRITE(VC4_HDMI_CEC_CNTRL_1, value); 1259 + ret = devm_request_threaded_irq(dev, platform_get_irq(pdev, 0), 1260 + vc4_cec_irq_handler, 1261 + vc4_cec_irq_handler_thread, 0, 1262 + "vc4 hdmi cec", vc4); 1263 + if (ret) 1264 + goto err_delete_cec_adap; 1265 + ret = cec_register_adapter(hdmi->cec_adap, dev); 1266 + if (ret < 0) 1267 + goto err_delete_cec_adap; 1268 + #endif 1414 1269 1415 1270 ret = vc4_hdmi_audio_init(hdmi); 1416 1271 if (ret) ··· 1449 1242 1450 1243 return 0; 1451 1244 1245 + #ifdef CONFIG_DRM_VC4_HDMI_CEC 1246 + err_delete_cec_adap: 1247 + cec_delete_adapter(hdmi->cec_adap); 1248 + err_destroy_conn: 1249 + vc4_hdmi_connector_destroy(hdmi->connector); 1250 + #endif 1452 1251 err_destroy_encoder: 1453 1252 vc4_hdmi_encoder_destroy(hdmi->encoder); 1253 + err_unprepare_hsm: 1254 + clk_disable_unprepare(hdmi->hsm_clock); 1454 1255 pm_runtime_disable(dev); 1455 1256 err_put_i2c: 1456 1257 put_device(&hdmi->ddc->dev); ··· 1474 1259 struct vc4_hdmi *hdmi = vc4->hdmi; 1475 1260 1476 1261 vc4_hdmi_audio_cleanup(hdmi); 1477 - 1262 + cec_unregister_adapter(hdmi->cec_adap); 1478 1263 vc4_hdmi_connector_destroy(hdmi->connector); 1479 1264 vc4_hdmi_encoder_destroy(hdmi->encoder); 1480 1265 1266 + clk_disable_unprepare(hdmi->hsm_clock); 1481 1267 pm_runtime_disable(dev); 1482 1268 1483 1269 put_device(&hdmi->ddc->dev);
+1 -1
drivers/gpu/drm/vc4/vc4_plane.c
··· 902 902 ret = drm_universal_plane_init(dev, plane, 0, 903 903 &vc4_plane_funcs, 904 904 formats, num_formats, 905 - type, NULL); 905 + NULL, type, NULL); 906 906 907 907 drm_plane_helper_add(plane, &vc4_plane_helper_funcs); 908 908
+113
drivers/gpu/drm/vc4/vc4_regs.h
··· 561 561 # define VC4_HDMI_VERTB_VBP_MASK VC4_MASK(8, 0) 562 562 # define VC4_HDMI_VERTB_VBP_SHIFT 0 563 563 564 + #define VC4_HDMI_CEC_CNTRL_1 0x0e8 565 + /* Set when the transmission has ended. */ 566 + # define VC4_HDMI_CEC_TX_EOM BIT(31) 567 + /* If set, transmission was acked on the 1st or 2nd attempt (only one 568 + * retry is attempted). If in continuous mode, this means TX needs to 569 + * be filled if !TX_EOM. 570 + */ 571 + # define VC4_HDMI_CEC_TX_STATUS_GOOD BIT(30) 572 + # define VC4_HDMI_CEC_RX_EOM BIT(29) 573 + # define VC4_HDMI_CEC_RX_STATUS_GOOD BIT(28) 574 + /* Number of bytes received for the message. */ 575 + # define VC4_HDMI_CEC_REC_WRD_CNT_MASK VC4_MASK(27, 24) 576 + # define VC4_HDMI_CEC_REC_WRD_CNT_SHIFT 24 577 + /* Sets continuous receive mode. Generates interrupt after each 8 578 + * bytes to signal that RX_DATA should be consumed, and at RX_EOM. 579 + * 580 + * If disabled, maximum 16 bytes will be received (including header), 581 + * and interrupt at RX_EOM. Later bytes will be acked but not put 582 + * into the RX_DATA. 583 + */ 584 + # define VC4_HDMI_CEC_RX_CONTINUE BIT(23) 585 + # define VC4_HDMI_CEC_TX_CONTINUE BIT(22) 586 + /* Set this after a CEC interrupt. */ 587 + # define VC4_HDMI_CEC_CLEAR_RECEIVE_OFF BIT(21) 588 + /* Starts a TX. Will wait for appropriate idel time before CEC 589 + * activity. Must be cleared in between transmits. 590 + */ 591 + # define VC4_HDMI_CEC_START_XMIT_BEGIN BIT(20) 592 + # define VC4_HDMI_CEC_MESSAGE_LENGTH_MASK VC4_MASK(19, 16) 593 + # define VC4_HDMI_CEC_MESSAGE_LENGTH_SHIFT 16 594 + /* Device's CEC address */ 595 + # define VC4_HDMI_CEC_ADDR_MASK VC4_MASK(15, 12) 596 + # define VC4_HDMI_CEC_ADDR_SHIFT 12 597 + /* Divides off of HSM clock to generate CEC bit clock. */ 598 + /* With the current defaults the CEC bit clock is 40 kHz = 25 usec */ 599 + # define VC4_HDMI_CEC_DIV_CLK_CNT_MASK VC4_MASK(11, 0) 600 + # define VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT 0 601 + 602 + /* Set these fields to how many bit clock cycles get to that many 603 + * microseconds. 604 + */ 605 + #define VC4_HDMI_CEC_CNTRL_2 0x0ec 606 + # define VC4_HDMI_CEC_CNT_TO_1500_US_MASK VC4_MASK(30, 24) 607 + # define VC4_HDMI_CEC_CNT_TO_1500_US_SHIFT 24 608 + # define VC4_HDMI_CEC_CNT_TO_1300_US_MASK VC4_MASK(23, 17) 609 + # define VC4_HDMI_CEC_CNT_TO_1300_US_SHIFT 17 610 + # define VC4_HDMI_CEC_CNT_TO_800_US_MASK VC4_MASK(16, 11) 611 + # define VC4_HDMI_CEC_CNT_TO_800_US_SHIFT 11 612 + # define VC4_HDMI_CEC_CNT_TO_600_US_MASK VC4_MASK(10, 5) 613 + # define VC4_HDMI_CEC_CNT_TO_600_US_SHIFT 5 614 + # define VC4_HDMI_CEC_CNT_TO_400_US_MASK VC4_MASK(4, 0) 615 + # define VC4_HDMI_CEC_CNT_TO_400_US_SHIFT 0 616 + 617 + #define VC4_HDMI_CEC_CNTRL_3 0x0f0 618 + # define VC4_HDMI_CEC_CNT_TO_2750_US_MASK VC4_MASK(31, 24) 619 + # define VC4_HDMI_CEC_CNT_TO_2750_US_SHIFT 24 620 + # define VC4_HDMI_CEC_CNT_TO_2400_US_MASK VC4_MASK(23, 16) 621 + # define VC4_HDMI_CEC_CNT_TO_2400_US_SHIFT 16 622 + # define VC4_HDMI_CEC_CNT_TO_2050_US_MASK VC4_MASK(15, 8) 623 + # define VC4_HDMI_CEC_CNT_TO_2050_US_SHIFT 8 624 + # define VC4_HDMI_CEC_CNT_TO_1700_US_MASK VC4_MASK(7, 0) 625 + # define VC4_HDMI_CEC_CNT_TO_1700_US_SHIFT 0 626 + 627 + #define VC4_HDMI_CEC_CNTRL_4 0x0f4 628 + # define VC4_HDMI_CEC_CNT_TO_4300_US_MASK VC4_MASK(31, 24) 629 + # define VC4_HDMI_CEC_CNT_TO_4300_US_SHIFT 24 630 + # define VC4_HDMI_CEC_CNT_TO_3900_US_MASK VC4_MASK(23, 16) 631 + # define VC4_HDMI_CEC_CNT_TO_3900_US_SHIFT 16 632 + # define VC4_HDMI_CEC_CNT_TO_3600_US_MASK VC4_MASK(15, 8) 633 + # define VC4_HDMI_CEC_CNT_TO_3600_US_SHIFT 8 634 + # define VC4_HDMI_CEC_CNT_TO_3500_US_MASK VC4_MASK(7, 0) 635 + # define VC4_HDMI_CEC_CNT_TO_3500_US_SHIFT 0 636 + 637 + #define VC4_HDMI_CEC_CNTRL_5 0x0f8 638 + # define VC4_HDMI_CEC_TX_SW_RESET BIT(27) 639 + # define VC4_HDMI_CEC_RX_SW_RESET BIT(26) 640 + # define VC4_HDMI_CEC_PAD_SW_RESET BIT(25) 641 + # define VC4_HDMI_CEC_MUX_TP_OUT_CEC BIT(24) 642 + # define VC4_HDMI_CEC_RX_CEC_INT BIT(23) 643 + # define VC4_HDMI_CEC_CLK_PRELOAD_MASK VC4_MASK(22, 16) 644 + # define VC4_HDMI_CEC_CLK_PRELOAD_SHIFT 16 645 + # define VC4_HDMI_CEC_CNT_TO_4700_US_MASK VC4_MASK(15, 8) 646 + # define VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT 8 647 + # define VC4_HDMI_CEC_CNT_TO_4500_US_MASK VC4_MASK(7, 0) 648 + # define VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT 0 649 + 650 + /* Transmit data, first byte is low byte of the 32-bit reg. MSB of 651 + * each byte transmitted first. 652 + */ 653 + #define VC4_HDMI_CEC_TX_DATA_1 0x0fc 654 + #define VC4_HDMI_CEC_TX_DATA_2 0x100 655 + #define VC4_HDMI_CEC_TX_DATA_3 0x104 656 + #define VC4_HDMI_CEC_TX_DATA_4 0x108 657 + #define VC4_HDMI_CEC_RX_DATA_1 0x10c 658 + #define VC4_HDMI_CEC_RX_DATA_2 0x110 659 + #define VC4_HDMI_CEC_RX_DATA_3 0x114 660 + #define VC4_HDMI_CEC_RX_DATA_4 0x118 661 + 564 662 #define VC4_HDMI_TX_PHY_RESET_CTL 0x2c0 565 663 566 664 #define VC4_HDMI_TX_PHY_CTL0 0x2c4 567 665 # define VC4_HDMI_TX_PHY_RNG_PWRDN BIT(25) 666 + 667 + /* Interrupt status bits */ 668 + #define VC4_HDMI_CPU_STATUS 0x340 669 + #define VC4_HDMI_CPU_SET 0x344 670 + #define VC4_HDMI_CPU_CLEAR 0x348 671 + # define VC4_HDMI_CPU_CEC BIT(6) 672 + # define VC4_HDMI_CPU_HOTPLUG BIT(0) 673 + 674 + #define VC4_HDMI_CPU_MASK_STATUS 0x34c 675 + #define VC4_HDMI_CPU_MASK_SET 0x350 676 + #define VC4_HDMI_CPU_MASK_CLEAR 0x354 568 677 569 678 #define VC4_HDMI_GCP(x) (0x400 + ((x) * 0x4)) 570 679 #define VC4_HDMI_RAM_PACKET(x) (0x400 + ((x) * 0x24)) 571 680 #define VC4_HDMI_PACKET_STRIDE 0x24 572 681 573 682 #define VC4_HD_M_CTL 0x00c 683 + /* Debug: Current receive value on the CEC pad. */ 684 + # define VC4_HD_CECRXD BIT(9) 685 + /* Debug: Override CEC output to 0. */ 686 + # define VC4_HD_CECOVR BIT(8) 574 687 # define VC4_HD_M_REGISTER_FILE_STANDBY (3 << 6) 575 688 # define VC4_HD_M_RAM_STANDBY (3 << 4) 576 689 # define VC4_HD_M_SW_RST BIT(2)
+1 -1
drivers/gpu/drm/vc4/vc4_render_cl.c
··· 320 320 321 321 size += xtiles * ytiles * loop_body_size; 322 322 323 - setup->rcl = &vc4_bo_create(dev, size, true)->base; 323 + setup->rcl = &vc4_bo_create(dev, size, true, VC4_BO_TYPE_RCL)->base; 324 324 if (IS_ERR(setup->rcl)) 325 325 return PTR_ERR(setup->rcl); 326 326 list_add_tail(&to_vc4_bo(&setup->rcl->base)->unref_head,
+2 -1
drivers/gpu/drm/vc4/vc4_v3d.c
··· 236 236 INIT_LIST_HEAD(&list); 237 237 238 238 while (true) { 239 - struct vc4_bo *bo = vc4_bo_create(drm, size, true); 239 + struct vc4_bo *bo = vc4_bo_create(drm, size, true, 240 + VC4_BO_TYPE_BIN); 240 241 241 242 if (IS_ERR(bo)) { 242 243 ret = PTR_ERR(bo);
-2
drivers/gpu/drm/vc4/vc4_vec.c
··· 366 366 } 367 367 368 368 static const struct drm_connector_funcs vc4_vec_connector_funcs = { 369 - .dpms = drm_atomic_helper_connector_dpms, 370 369 .detect = vc4_vec_connector_detect, 371 370 .fill_modes = drm_helper_probe_single_connector_modes, 372 - .set_property = drm_atomic_helper_connector_set_property, 373 371 .destroy = vc4_vec_connector_destroy, 374 372 .reset = drm_atomic_helper_connector_reset, 375 373 .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
-1
drivers/gpu/drm/virtio/virtgpu_display.c
··· 252 252 } 253 253 254 254 static const struct drm_connector_funcs virtio_gpu_connector_funcs = { 255 - .dpms = drm_atomic_helper_connector_dpms, 256 255 .detect = virtio_gpu_conn_detect, 257 256 .fill_modes = drm_helper_probe_single_connector_modes, 258 257 .destroy = virtio_gpu_conn_destroy,
+1 -1
drivers/gpu/drm/virtio/virtgpu_plane.c
··· 298 298 ret = drm_universal_plane_init(dev, plane, 1 << index, 299 299 &virtio_gpu_plane_funcs, 300 300 formats, nformats, 301 - type, NULL); 301 + NULL, type, NULL); 302 302 if (ret) 303 303 goto err_plane_init; 304 304
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c
··· 428 428 0, &vmw_ldu_plane_funcs, 429 429 vmw_primary_plane_formats, 430 430 ARRAY_SIZE(vmw_primary_plane_formats), 431 - DRM_PLANE_TYPE_PRIMARY, NULL); 431 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 432 432 if (ret) { 433 433 DRM_ERROR("Failed to initialize primary plane"); 434 434 goto err_free; ··· 443 443 0, &vmw_ldu_cursor_funcs, 444 444 vmw_cursor_plane_formats, 445 445 ARRAY_SIZE(vmw_cursor_plane_formats), 446 - DRM_PLANE_TYPE_CURSOR, NULL); 446 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 447 447 if (ret) { 448 448 DRM_ERROR("Failed to initialize cursor plane"); 449 449 drm_plane_cleanup(&ldu->base.primary);
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_scrn.c
··· 624 624 0, &vmw_sou_plane_funcs, 625 625 vmw_primary_plane_formats, 626 626 ARRAY_SIZE(vmw_primary_plane_formats), 627 - DRM_PLANE_TYPE_PRIMARY, NULL); 627 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 628 628 if (ret) { 629 629 DRM_ERROR("Failed to initialize primary plane"); 630 630 goto err_free; ··· 639 639 0, &vmw_sou_cursor_funcs, 640 640 vmw_cursor_plane_formats, 641 641 ARRAY_SIZE(vmw_cursor_plane_formats), 642 - DRM_PLANE_TYPE_CURSOR, NULL); 642 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 643 643 if (ret) { 644 644 DRM_ERROR("Failed to initialize cursor plane"); 645 645 drm_plane_cleanup(&sou->base.primary);
+2 -2
drivers/gpu/drm/vmwgfx/vmwgfx_stdu.c
··· 1475 1475 0, &vmw_stdu_plane_funcs, 1476 1476 vmw_primary_plane_formats, 1477 1477 ARRAY_SIZE(vmw_primary_plane_formats), 1478 - DRM_PLANE_TYPE_PRIMARY, NULL); 1478 + NULL, DRM_PLANE_TYPE_PRIMARY, NULL); 1479 1479 if (ret) { 1480 1480 DRM_ERROR("Failed to initialize primary plane"); 1481 1481 goto err_free; ··· 1490 1490 0, &vmw_stdu_cursor_funcs, 1491 1491 vmw_cursor_plane_formats, 1492 1492 ARRAY_SIZE(vmw_cursor_plane_formats), 1493 - DRM_PLANE_TYPE_CURSOR, NULL); 1493 + NULL, DRM_PLANE_TYPE_CURSOR, NULL); 1494 1494 if (ret) { 1495 1495 DRM_ERROR("Failed to initialize cursor plane"); 1496 1496 drm_plane_cleanup(&stdu->base.primary);
-2
drivers/gpu/drm/zte/zx_drm_drv.c
··· 62 62 .gem_free_object_unlocked = drm_gem_cma_free_object, 63 63 .gem_vm_ops = &drm_gem_cma_vm_ops, 64 64 .dumb_create = drm_gem_cma_dumb_create, 65 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, 66 - .dumb_destroy = drm_gem_dumb_destroy, 67 65 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, 68 66 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 69 67 .gem_prime_export = drm_gem_prime_export,
-1
drivers/gpu/drm/zte/zx_hdmi.c
··· 300 300 } 301 301 302 302 static const struct drm_connector_funcs zx_hdmi_connector_funcs = { 303 - .dpms = drm_atomic_helper_connector_dpms, 304 303 .fill_modes = drm_helper_probe_single_connector_modes, 305 304 .detect = zx_hdmi_connector_detect, 306 305 .destroy = drm_connector_cleanup,
+1 -1
drivers/gpu/drm/zte/zx_plane.c
··· 540 540 541 541 ret = drm_universal_plane_init(drm, plane, VOU_CRTC_MASK, 542 542 &zx_plane_funcs, formats, format_count, 543 - type, NULL); 543 + NULL, type, NULL); 544 544 if (ret) { 545 545 DRM_DEV_ERROR(dev, "failed to init universal plane: %d\n", ret); 546 546 return ret;
-1
drivers/gpu/drm/zte/zx_tvenc.c
··· 269 269 }; 270 270 271 271 static const struct drm_connector_funcs zx_tvenc_connector_funcs = { 272 - .dpms = drm_atomic_helper_connector_dpms, 273 272 .fill_modes = drm_helper_probe_single_connector_modes, 274 273 .destroy = drm_connector_cleanup, 275 274 .reset = drm_atomic_helper_connector_reset,
-1
drivers/gpu/drm/zte/zx_vga.c
··· 138 138 } 139 139 140 140 static const struct drm_connector_funcs zx_vga_connector_funcs = { 141 - .dpms = drm_atomic_helper_connector_dpms, 142 141 .fill_modes = drm_helper_probe_single_connector_modes, 143 142 .detect = zx_vga_connector_detect, 144 143 .destroy = drm_connector_cleanup,
-1
drivers/gpu/host1x/bus.c
··· 41 41 /** 42 42 * host1x_subdev_add() - add a new subdevice with an associated device node 43 43 * @device: host1x device to add the subdevice to 44 - * @driver: host1x driver 45 44 * @np: device node 46 45 */ 47 46 static int host1x_subdev_add(struct host1x_device *device,
-15
drivers/staging/vboxvideo/vbox_fb.c
··· 317 317 return 0; 318 318 } 319 319 320 - static void vbox_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, 321 - u16 blue, int regno) 322 - { 323 - } 324 - 325 - static void vbox_fb_gamma_get(struct drm_crtc *crtc, u16 *red, u16 *green, 326 - u16 *blue, int regno) 327 - { 328 - *red = regno; 329 - *green = regno; 330 - *blue = regno; 331 - } 332 - 333 320 static struct drm_fb_helper_funcs vbox_fb_helper_funcs = { 334 - .gamma_set = vbox_fb_gamma_set, 335 - .gamma_get = vbox_fb_gamma_get, 336 321 .fb_probe = vboxfb_create, 337 322 }; 338 323
-5
drivers/staging/vboxvideo/vbox_mode.c
··· 134 134 return 0; 135 135 } 136 136 137 - static void vbox_crtc_load_lut(struct drm_crtc *crtc) 138 - { 139 - } 140 - 141 137 static void vbox_crtc_dpms(struct drm_crtc *crtc, int mode) 142 138 { 143 139 struct vbox_crtc *vbox_crtc = to_vbox_crtc(crtc); ··· 326 330 .mode_set = vbox_crtc_mode_set, 327 331 /* .mode_set_base = vbox_crtc_mode_set_base, */ 328 332 .disable = vbox_crtc_disable, 329 - .load_lut = vbox_crtc_load_lut, 330 333 .prepare = vbox_crtc_prepare, 331 334 .commit = vbox_crtc_commit, 332 335 };
+1 -9
include/drm/drm_atomic.h
··· 315 315 struct drm_plane_state * __must_check 316 316 drm_atomic_get_plane_state(struct drm_atomic_state *state, 317 317 struct drm_plane *plane); 318 - int drm_atomic_plane_set_property(struct drm_plane *plane, 319 - struct drm_plane_state *state, struct drm_property *property, 320 - uint64_t val); 321 318 struct drm_connector_state * __must_check 322 319 drm_atomic_get_connector_state(struct drm_atomic_state *state, 323 320 struct drm_connector *connector); 324 - int drm_atomic_connector_set_property(struct drm_connector *connector, 325 - struct drm_connector_state *state, struct drm_property *property, 326 - uint64_t val); 327 321 328 322 void drm_atomic_private_obj_init(struct drm_private_obj *obj, 329 323 struct drm_private_state *state, ··· 544 550 int __must_check 545 551 drm_atomic_add_affected_planes(struct drm_atomic_state *state, 546 552 struct drm_crtc *crtc); 547 - 548 - void drm_atomic_legacy_backoff(struct drm_atomic_state *state); 549 553 550 554 void 551 555 drm_atomic_clean_old_fb(struct drm_device *dev, unsigned plane_mask, int ret); ··· 875 883 * 876 884 * To give drivers flexibility &struct drm_crtc_state has 3 booleans to track 877 885 * whether the state CRTC changed enough to need a full modeset cycle: 878 - * planes_changed, mode_changed and active_changed. This helper simply 886 + * mode_changed, active_changed and connectors_changed. This helper simply 879 887 * combines these three to compute the overall need for a modeset for @state. 880 888 * 881 889 * The atomic helper code sets these booleans, but drivers can and should
-11
include/drm/drm_atomic_helper.h
··· 124 124 int drm_atomic_helper_resume(struct drm_device *dev, 125 125 struct drm_atomic_state *state); 126 126 127 - int drm_atomic_helper_crtc_set_property(struct drm_crtc *crtc, 128 - struct drm_property *property, 129 - uint64_t val); 130 - int drm_atomic_helper_plane_set_property(struct drm_plane *plane, 131 - struct drm_property *property, 132 - uint64_t val); 133 - int drm_atomic_helper_connector_set_property(struct drm_connector *connector, 134 - struct drm_property *property, 135 - uint64_t val); 136 127 int drm_atomic_helper_page_flip(struct drm_crtc *crtc, 137 128 struct drm_framebuffer *fb, 138 129 struct drm_pending_vblank_event *event, ··· 136 145 uint32_t flags, 137 146 uint32_t target, 138 147 struct drm_modeset_acquire_ctx *ctx); 139 - int drm_atomic_helper_connector_dpms(struct drm_connector *connector, 140 - int mode); 141 148 struct drm_encoder * 142 149 drm_atomic_helper_best_encoder(struct drm_connector *connector); 143 150
+3
include/drm/drm_bridge.h
··· 268 268 struct drm_bridge *drm_panel_bridge_add(struct drm_panel *panel, 269 269 u32 connector_type); 270 270 void drm_panel_bridge_remove(struct drm_bridge *bridge); 271 + struct drm_bridge *devm_drm_panel_bridge_add(struct device *dev, 272 + struct drm_panel *panel, 273 + u32 connector_type); 271 274 #endif 272 275 273 276 #endif
+4 -6
include/drm/drm_connector.h
··· 382 382 * implement the 4 level DPMS support on the connector any more, but 383 383 * instead only have an on/off "ACTIVE" property on the CRTC object. 384 384 * 385 - * Drivers implementing atomic modeset should use 386 - * drm_atomic_helper_connector_dpms() to implement this hook. 385 + * This hook is not used by atomic drivers, remapping of the legacy DPMS 386 + * property is entirely handled in the DRM core. 387 387 * 388 388 * RETURNS: 389 389 * ··· 480 480 * This is the legacy entry point to update a property attached to the 481 481 * connector. 482 482 * 483 - * Drivers implementing atomic modeset should use 484 - * drm_atomic_helper_connector_set_property() to implement this hook. 485 - * 486 483 * This callback is optional if the driver does not support any legacy 487 - * driver-private properties. 484 + * driver-private properties. For atomic drivers it is not used because 485 + * property handling is done entirely in the DRM core. 488 486 * 489 487 * RETURNS: 490 488 *
+2 -12
include/drm/drm_crtc.h
··· 358 358 * drm_crtc_enable_color_mgmt(), which then supports the legacy gamma 359 359 * interface through the drm_atomic_helper_legacy_gamma_set() 360 360 * compatibility implementation. 361 - * 362 - * NOTE: 363 - * 364 - * Drivers that support gamma tables and also fbdev emulation through 365 - * the provided helper library need to take care to fill out the gamma 366 - * hooks for both. Currently there's a bit an unfortunate duplication 367 - * going on, which should eventually be unified to just one set of 368 - * hooks. 369 361 */ 370 362 int (*gamma_set)(struct drm_crtc *crtc, u16 *r, u16 *g, u16 *b, 371 363 uint32_t size, ··· 473 481 * This is the legacy entry point to update a property attached to the 474 482 * CRTC. 475 483 * 476 - * Drivers implementing atomic modeset should use 477 - * drm_atomic_helper_crtc_set_property() to implement this hook. 478 - * 479 484 * This callback is optional if the driver does not support any legacy 480 - * driver-private properties. 485 + * driver-private properties. For atomic drivers it is not used because 486 + * property handling is done entirely in the DRM core. 481 487 * 482 488 * RETURNS: 483 489 *
+46 -6
include/drm/drm_drv.h
··· 390 390 */ 391 391 void (*master_drop)(struct drm_device *dev, struct drm_file *file_priv); 392 392 393 + /** 394 + * @debugfs_init: 395 + * 396 + * Allows drivers to create driver-specific debugfs files. 397 + */ 393 398 int (*debugfs_init)(struct drm_minor *minor); 394 399 395 400 /** ··· 413 408 */ 414 409 void (*gem_free_object_unlocked) (struct drm_gem_object *obj); 415 410 411 + /** 412 + * @gem_open_object: 413 + * 414 + * Driver hook called upon gem handle creation 415 + */ 416 416 int (*gem_open_object) (struct drm_gem_object *, struct drm_file *); 417 + 418 + /** 419 + * @gem_close_object: 420 + * 421 + * Driver hook called upon gem handle release 422 + */ 417 423 void (*gem_close_object) (struct drm_gem_object *, struct drm_file *); 418 424 419 425 /** ··· 437 421 size_t size); 438 422 439 423 /* prime: */ 440 - /* export handle -> fd (see drm_gem_prime_handle_to_fd() helper) */ 424 + /** 425 + * @prime_handle_to_fd: 426 + * 427 + * export handle -> fd (see drm_gem_prime_handle_to_fd() helper) 428 + */ 441 429 int (*prime_handle_to_fd)(struct drm_device *dev, struct drm_file *file_priv, 442 430 uint32_t handle, uint32_t flags, int *prime_fd); 443 - /* import fd -> handle (see drm_gem_prime_fd_to_handle() helper) */ 431 + /** 432 + * @prime_fd_to_handle: 433 + * 434 + * import fd -> handle (see drm_gem_prime_fd_to_handle() helper) 435 + */ 444 436 int (*prime_fd_to_handle)(struct drm_device *dev, struct drm_file *file_priv, 445 437 int prime_fd, uint32_t *handle); 446 - /* export GEM -> dmabuf */ 438 + /** 439 + * @gem_prime_export: 440 + * 441 + * export GEM -> dmabuf 442 + */ 447 443 struct dma_buf * (*gem_prime_export)(struct drm_device *dev, 448 444 struct drm_gem_object *obj, int flags); 449 - /* import dmabuf -> GEM */ 445 + /** 446 + * @gem_prime_import: 447 + * 448 + * import dmabuf -> GEM 449 + */ 450 450 struct drm_gem_object * (*gem_prime_import)(struct drm_device *dev, 451 451 struct dma_buf *dma_buf); 452 - /* low-level interface used by drm_gem_prime_{import,export} */ 453 452 int (*gem_prime_pin)(struct drm_gem_object *obj); 454 453 void (*gem_prime_unpin)(struct drm_gem_object *obj); 455 454 struct reservation_object * (*gem_prime_res_obj)( ··· 536 505 struct drm_device *dev, 537 506 uint32_t handle); 538 507 539 - /* Driver private ops for this object */ 508 + /** 509 + * @gem_vm_ops: Driver private ops for this object 510 + */ 540 511 const struct vm_operations_struct *gem_vm_ops; 541 512 513 + /** @major: driver major number */ 542 514 int major; 515 + /** @minor: driver minor number */ 543 516 int minor; 517 + /** @patchlevel: driver patch level */ 544 518 int patchlevel; 519 + /** @name: driver name */ 545 520 char *name; 521 + /** @desc: driver description */ 546 522 char *desc; 523 + /** @date: driver date */ 547 524 char *date; 548 525 526 + /** @driver_features: driver features */ 549 527 u32 driver_features; 550 528 551 529 /**
-32
include/drm/drm_fb_helper.h
··· 85 85 */ 86 86 struct drm_fb_helper_funcs { 87 87 /** 88 - * @gamma_set: 89 - * 90 - * Set the given gamma LUT register on the given CRTC. 91 - * 92 - * This callback is optional. 93 - * 94 - * FIXME: 95 - * 96 - * This callback is functionally redundant with the core gamma table 97 - * support and simply exists because the fbdev hasn't yet been 98 - * refactored to use the core gamma table interfaces. 99 - */ 100 - void (*gamma_set)(struct drm_crtc *crtc, u16 red, u16 green, 101 - u16 blue, int regno); 102 - /** 103 - * @gamma_get: 104 - * 105 - * Read the given gamma LUT register on the given CRTC, used to save the 106 - * current LUT when force-restoring the fbdev for e.g. kdbg. 107 - * 108 - * This callback is optional. 109 - * 110 - * FIXME: 111 - * 112 - * This callback is functionally redundant with the core gamma table 113 - * support and simply exists because the fbdev hasn't yet been 114 - * refactored to use the core gamma table interfaces. 115 - */ 116 - void (*gamma_get)(struct drm_crtc *crtc, u16 *red, u16 *green, 117 - u16 *blue, int regno); 118 - 119 - /** 120 88 * @fb_probe: 121 89 * 122 90 * Driver callback to allocate and initialize the fbdev info structure.
+2
include/drm/drm_gem.h
··· 302 302 bool dirty, bool accessed); 303 303 304 304 struct drm_gem_object *drm_gem_object_lookup(struct drm_file *filp, u32 handle); 305 + int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev, 306 + u32 handle, u64 *offset); 305 307 int drm_gem_dumb_destroy(struct drm_file *file, 306 308 struct drm_device *dev, 307 309 uint32_t handle);
+6
include/drm/drm_mode_config.h
··· 757 757 */ 758 758 bool allow_fb_modifiers; 759 759 760 + /** 761 + * @modifiers: Plane property to list support modifier/format 762 + * combination. 763 + */ 764 + struct drm_property *modifiers_property; 765 + 760 766 /* cursor size */ 761 767 uint32_t cursor_width, cursor_height; 762 768
+3 -19
include/drm/drm_modeset_helper_vtables.h
··· 267 267 enum mode_set_atomic); 268 268 269 269 /** 270 - * @load_lut: 271 - * 272 - * Load a LUT prepared with the &drm_fb_helper_funcs.gamma_set vfunc. 273 - * 274 - * This callback is optional and is only used by the fbdev emulation 275 - * helpers. 276 - * 277 - * FIXME: 278 - * 279 - * This callback is functionally redundant with the core gamma table 280 - * support and simply exists because the fbdev hasn't yet been 281 - * refactored to use the core gamma table interfaces. 282 - */ 283 - void (*load_lut)(struct drm_crtc *crtc); 284 - 285 - /** 286 270 * @disable: 287 271 * 288 272 * This callback should be used to disable the CRTC. With the atomic ··· 1163 1179 * - It only works for single plane updates 1164 1180 * - Async Pageflips are not supported yet 1165 1181 * - Some hw might still scan out the old buffer until the next 1166 - * vblank, however we let go of the fb references as soon as 1167 - * we run this hook. For now drivers must implement their own workers 1168 - * for deferring if needed, until a common solution is created. 1182 + * vblank, however we let go of the fb references as soon as 1183 + * we run this hook. For now drivers must implement their own workers 1184 + * for deferring if needed, until a common solution is created. 1169 1185 */ 1170 1186 void (*atomic_async_update)(struct drm_plane *plane, 1171 1187 struct drm_plane_state *new_state);
+23 -5
include/drm/drm_plane.h
··· 233 233 * This is the legacy entry point to update a property attached to the 234 234 * plane. 235 235 * 236 - * Drivers implementing atomic modeset should use 237 - * drm_atomic_helper_plane_set_property() to implement this hook. 238 - * 239 236 * This callback is optional if the driver does not support any legacy 240 - * driver-private properties. 237 + * driver-private properties. For atomic drivers it is not used because 238 + * property handling is done entirely in the DRM core. 241 239 * 242 240 * RETURNS: 243 241 * ··· 390 392 */ 391 393 void (*atomic_print_state)(struct drm_printer *p, 392 394 const struct drm_plane_state *state); 395 + 396 + /** 397 + * @format_mod_supported: 398 + * 399 + * This optional hook is used for the DRM to determine if the given 400 + * format/modifier combination is valid for the plane. This allows the 401 + * DRM to generate the correct format bitmask (which formats apply to 402 + * which modifier). 403 + * 404 + * Returns: 405 + * 406 + * True if the given modifier is valid for that format on the plane. 407 + * False otherwise. 408 + */ 409 + bool (*format_mod_supported)(struct drm_plane *plane, uint32_t format, 410 + uint64_t modifier); 393 411 }; 394 412 395 413 /** ··· 501 487 unsigned int format_count; 502 488 bool format_default; 503 489 490 + uint64_t *modifiers; 491 + unsigned int modifier_count; 492 + 504 493 struct drm_crtc *crtc; 505 494 struct drm_framebuffer *fb; 506 495 ··· 544 527 545 528 #define obj_to_plane(x) container_of(x, struct drm_plane, base) 546 529 547 - __printf(8, 9) 530 + __printf(9, 10) 548 531 int drm_universal_plane_init(struct drm_device *dev, 549 532 struct drm_plane *plane, 550 533 uint32_t possible_crtcs, 551 534 const struct drm_plane_funcs *funcs, 552 535 const uint32_t *formats, 553 536 unsigned int format_count, 537 + const uint64_t *format_modifiers, 554 538 enum drm_plane_type type, 555 539 const char *name, ...); 556 540 int drm_plane_init(struct drm_device *dev,
-25
include/drm/drm_scdc_helper.h
··· 131 131 132 132 bool drm_scdc_get_scrambling_status(struct i2c_adapter *adapter); 133 133 134 - /** 135 - * drm_scdc_set_scrambling - enable scrambling 136 - * @adapter: I2C adapter for DDC channel 137 - * @enable: bool to indicate if scrambling is to be enabled/disabled 138 - * 139 - * Writes the TMDS config register over SCDC channel, and: 140 - * enables scrambling when enable = 1 141 - * disables scrambling when enable = 0 142 - * 143 - * Returns: 144 - * True if scrambling is set/reset successfully, false otherwise. 145 - */ 146 134 bool drm_scdc_set_scrambling(struct i2c_adapter *adapter, bool enable); 147 - 148 - /** 149 - * drm_scdc_set_high_tmds_clock_ratio - set TMDS clock ratio 150 - * @adapter: I2C adapter for DDC channel 151 - * @set: ret or reset the high clock ratio 152 - * 153 - * Writes to the TMDS config register over SCDC channel, and: 154 - * sets TMDS clock ratio to 1/40 when set = 1 155 - * sets TMDS clock ratio to 1/10 when set = 0 156 - * 157 - * Returns: 158 - * True if write is successful, false otherwise. 159 - */ 160 135 bool drm_scdc_set_high_tmds_clock_ratio(struct i2c_adapter *adapter, bool set); 161 136 #endif
+1
include/drm/drm_simple_kms_helper.h
··· 122 122 struct drm_simple_display_pipe *pipe, 123 123 const struct drm_simple_display_pipe_funcs *funcs, 124 124 const uint32_t *formats, unsigned int format_count, 125 + const uint64_t *format_modifiers, 125 126 struct drm_connector *connector); 126 127 127 128 #endif /* __LINUX_DRM_SIMPLE_KMS_HELPER_H */
+1 -5
include/drm/tinydrm/mipi-dbi.h
··· 62 62 } 63 63 64 64 int mipi_dbi_spi_init(struct spi_device *spi, struct mipi_dbi *mipi, 65 - struct gpio_desc *dc, 66 - const struct drm_simple_display_pipe_funcs *pipe_funcs, 67 - struct drm_driver *driver, 68 - const struct drm_display_mode *mode, 69 - unsigned int rotation); 65 + struct gpio_desc *dc); 70 66 int mipi_dbi_init(struct device *dev, struct mipi_dbi *mipi, 71 67 const struct drm_simple_display_pipe_funcs *pipe_funcs, 72 68 struct drm_driver *driver,
+1 -3
include/drm/tinydrm/tinydrm.h
··· 56 56 .gem_prime_vmap = drm_gem_cma_prime_vmap, \ 57 57 .gem_prime_vunmap = drm_gem_cma_prime_vunmap, \ 58 58 .gem_prime_mmap = drm_gem_cma_prime_mmap, \ 59 - .dumb_create = drm_gem_cma_dumb_create, \ 60 - .dumb_map_offset = drm_gem_cma_dumb_map_offset, \ 61 - .dumb_destroy = drm_gem_dumb_destroy 59 + .dumb_create = drm_gem_cma_dumb_create 62 60 63 61 /** 64 62 * TINYDRM_MODE - tinydrm display mode
+2 -1
include/linux/sync_file.h
··· 43 43 #endif 44 44 45 45 wait_queue_head_t wq; 46 + unsigned long flags; 46 47 47 48 struct dma_fence *fence; 48 49 struct dma_fence_cb cb; 49 50 }; 50 51 51 - #define POLL_ENABLED DMA_FENCE_FLAG_USER_BITS 52 + #define POLL_ENABLED 0 52 53 53 54 struct sync_file *sync_file_create(struct dma_fence *fence); 54 55 struct dma_fence *sync_file_get_fence(int fd);
+11 -11
include/uapi/drm/armada_drm.h
··· 23 23 DRM_##dir(DRM_COMMAND_BASE + DRM_ARMADA_##name, struct drm_armada_##str) 24 24 25 25 struct drm_armada_gem_create { 26 - uint32_t handle; 27 - uint32_t size; 26 + __u32 handle; 27 + __u32 size; 28 28 }; 29 29 #define DRM_IOCTL_ARMADA_GEM_CREATE \ 30 30 ARMADA_IOCTL(IOWR, GEM_CREATE, gem_create) 31 31 32 32 struct drm_armada_gem_mmap { 33 - uint32_t handle; 34 - uint32_t pad; 35 - uint64_t offset; 36 - uint64_t size; 37 - uint64_t addr; 33 + __u32 handle; 34 + __u32 pad; 35 + __u64 offset; 36 + __u64 size; 37 + __u64 addr; 38 38 }; 39 39 #define DRM_IOCTL_ARMADA_GEM_MMAP \ 40 40 ARMADA_IOCTL(IOWR, GEM_MMAP, gem_mmap) 41 41 42 42 struct drm_armada_gem_pwrite { 43 - uint64_t ptr; 44 - uint32_t handle; 45 - uint32_t offset; 46 - uint32_t size; 43 + __u64 ptr; 44 + __u32 handle; 45 + __u32 offset; 46 + __u32 size; 47 47 }; 48 48 #define DRM_IOCTL_ARMADA_GEM_PWRITE \ 49 49 ARMADA_IOCTL(IOW, GEM_PWRITE, gem_pwrite)
+11
include/uapi/drm/drm_fourcc.h
··· 185 185 #define DRM_FORMAT_MOD_VENDOR_BROADCOM 0x07 186 186 /* add more to the end as needed */ 187 187 188 + #define DRM_FORMAT_RESERVED ((1ULL << 56) - 1) 189 + 188 190 #define fourcc_mod_code(vendor, val) \ 189 191 ((((__u64)DRM_FORMAT_MOD_VENDOR_## vendor) << 56) | (val & 0x00ffffffffffffffULL)) 190 192 ··· 197 195 * similar to the fourcc codes above. drm_fourcc.h is considered the 198 196 * authoritative source for all of these. 199 197 */ 198 + 199 + /* 200 + * Invalid Modifier 201 + * 202 + * This modifier can be used as a sentinel to terminate the format modifiers 203 + * list, or to initialize a variable with an invalid modifier. It might also be 204 + * used to report an error back to userspace for certain APIs. 205 + */ 206 + #define DRM_FORMAT_MOD_INVALID fourcc_mod_code(NONE, DRM_FORMAT_RESERVED) 200 207 201 208 /* 202 209 * Linear Layout
+50
include/uapi/drm/drm_mode.h
··· 712 712 __u64 user_data; 713 713 }; 714 714 715 + struct drm_format_modifier_blob { 716 + #define FORMAT_BLOB_CURRENT 1 717 + /* Version of this blob format */ 718 + u32 version; 719 + 720 + /* Flags */ 721 + u32 flags; 722 + 723 + /* Number of fourcc formats supported */ 724 + u32 count_formats; 725 + 726 + /* Where in this blob the formats exist (in bytes) */ 727 + u32 formats_offset; 728 + 729 + /* Number of drm_format_modifiers */ 730 + u32 count_modifiers; 731 + 732 + /* Where in this blob the modifiers exist (in bytes) */ 733 + u32 modifiers_offset; 734 + 735 + /* u32 formats[] */ 736 + /* struct drm_format_modifier modifiers[] */ 737 + }; 738 + 739 + struct drm_format_modifier { 740 + /* Bitmask of formats in get_plane format list this info applies to. The 741 + * offset allows a sliding window of which 64 formats (bits). 742 + * 743 + * Some examples: 744 + * In today's world with < 65 formats, and formats 0, and 2 are 745 + * supported 746 + * 0x0000000000000005 747 + * ^-offset = 0, formats = 5 748 + * 749 + * If the number formats grew to 128, and formats 98-102 are 750 + * supported with the modifier: 751 + * 752 + * 0x0000003c00000000 0000000000000000 753 + * ^ 754 + * |__offset = 64, formats = 0x3c00000000 755 + * 756 + */ 757 + __u64 formats; 758 + __u32 offset; 759 + __u32 pad; 760 + 761 + /* The modifier that applies to the >get_plane format list bitmask. */ 762 + __u64 modifier; 763 + }; 764 + 715 765 /** 716 766 * Create a new 'blob' data property, copying length bytes from data pointer, 717 767 * and returning new blob ID.
+11
include/uapi/drm/vc4_drm.h
··· 40 40 #define DRM_VC4_GET_PARAM 0x07 41 41 #define DRM_VC4_SET_TILING 0x08 42 42 #define DRM_VC4_GET_TILING 0x09 43 + #define DRM_VC4_LABEL_BO 0x0a 43 44 44 45 #define DRM_IOCTL_VC4_SUBMIT_CL DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SUBMIT_CL, struct drm_vc4_submit_cl) 45 46 #define DRM_IOCTL_VC4_WAIT_SEQNO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_WAIT_SEQNO, struct drm_vc4_wait_seqno) ··· 52 51 #define DRM_IOCTL_VC4_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_PARAM, struct drm_vc4_get_param) 53 52 #define DRM_IOCTL_VC4_SET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_SET_TILING, struct drm_vc4_set_tiling) 54 53 #define DRM_IOCTL_VC4_GET_TILING DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_GET_TILING, struct drm_vc4_get_tiling) 54 + #define DRM_IOCTL_VC4_LABEL_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_VC4_LABEL_BO, struct drm_vc4_label_bo) 55 55 56 56 struct drm_vc4_submit_rcl_surface { 57 57 __u32 hindex; /* Handle index, or ~0 if not present. */ ··· 311 309 __u32 handle; 312 310 __u32 flags; 313 311 __u64 modifier; 312 + }; 313 + 314 + /** 315 + * struct drm_vc4_label_bo - Attach a name to a BO for debug purposes. 316 + */ 317 + struct drm_vc4_label_bo { 318 + __u32 handle; 319 + __u32 len; 320 + __u64 name; 314 321 }; 315 322 316 323 #if defined(__cplusplus)