ARM: dts: stm32: add gadget fifo sizes to usbotg_hs on stm32f746
[linux/fpc-iii.git] / include / drm / tinydrm / tinydrm.h
blob07a9a11fe19dcb66e863ea8155b51589d7c8ed07
1 /*
2 * Copyright (C) 2016 Noralf Trønnes
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 */
10 #ifndef __LINUX_TINYDRM_H
11 #define __LINUX_TINYDRM_H
13 #include <drm/drm_gem_cma_helper.h>
14 #include <drm/drm_fb_cma_helper.h>
15 #include <drm/drm_simple_kms_helper.h>
17 /**
18 * struct tinydrm_device - tinydrm device
19 * @drm: DRM device
20 * @pipe: Display pipe structure
21 * @dirty_lock: Serializes framebuffer flushing
22 * @fb_funcs: Framebuffer functions used when creating framebuffers
24 struct tinydrm_device {
25 struct drm_device *drm;
26 struct drm_simple_display_pipe pipe;
27 struct mutex dirty_lock;
28 const struct drm_framebuffer_funcs *fb_funcs;
31 static inline struct tinydrm_device *
32 pipe_to_tinydrm(struct drm_simple_display_pipe *pipe)
34 return container_of(pipe, struct tinydrm_device, pipe);
37 /**
38 * TINYDRM_GEM_DRIVER_OPS - default tinydrm gem operations
40 * This macro provides a shortcut for setting the tinydrm GEM operations in
41 * the &drm_driver structure.
43 #define TINYDRM_GEM_DRIVER_OPS \
44 .gem_free_object = tinydrm_gem_cma_free_object, \
45 .gem_print_info = drm_gem_cma_print_info, \
46 .gem_vm_ops = &drm_gem_cma_vm_ops, \
47 .prime_handle_to_fd = drm_gem_prime_handle_to_fd, \
48 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, \
49 .gem_prime_import = drm_gem_prime_import, \
50 .gem_prime_export = drm_gem_prime_export, \
51 .gem_prime_get_sg_table = drm_gem_cma_prime_get_sg_table, \
52 .gem_prime_import_sg_table = tinydrm_gem_cma_prime_import_sg_table, \
53 .gem_prime_vmap = drm_gem_cma_prime_vmap, \
54 .gem_prime_vunmap = drm_gem_cma_prime_vunmap, \
55 .gem_prime_mmap = drm_gem_cma_prime_mmap, \
56 .dumb_create = drm_gem_cma_dumb_create
58 /**
59 * TINYDRM_MODE - tinydrm display mode
60 * @hd: Horizontal resolution, width
61 * @vd: Vertical resolution, height
62 * @hd_mm: Display width in millimeters
63 * @vd_mm: Display height in millimeters
65 * This macro creates a &drm_display_mode for use with tinydrm.
67 #define TINYDRM_MODE(hd, vd, hd_mm, vd_mm) \
68 .hdisplay = (hd), \
69 .hsync_start = (hd), \
70 .hsync_end = (hd), \
71 .htotal = (hd), \
72 .vdisplay = (vd), \
73 .vsync_start = (vd), \
74 .vsync_end = (vd), \
75 .vtotal = (vd), \
76 .width_mm = (hd_mm), \
77 .height_mm = (vd_mm), \
78 .type = DRM_MODE_TYPE_DRIVER, \
79 .clock = 1 /* pass validation */
81 void tinydrm_gem_cma_free_object(struct drm_gem_object *gem_obj);
82 struct drm_gem_object *
83 tinydrm_gem_cma_prime_import_sg_table(struct drm_device *drm,
84 struct dma_buf_attachment *attach,
85 struct sg_table *sgt);
86 int devm_tinydrm_init(struct device *parent, struct tinydrm_device *tdev,
87 const struct drm_framebuffer_funcs *fb_funcs,
88 struct drm_driver *driver);
89 int devm_tinydrm_register(struct tinydrm_device *tdev);
90 void tinydrm_shutdown(struct tinydrm_device *tdev);
92 void tinydrm_display_pipe_update(struct drm_simple_display_pipe *pipe,
93 struct drm_plane_state *old_state);
94 int tinydrm_display_pipe_prepare_fb(struct drm_simple_display_pipe *pipe,
95 struct drm_plane_state *plane_state);
96 int
97 tinydrm_display_pipe_init(struct tinydrm_device *tdev,
98 const struct drm_simple_display_pipe_funcs *funcs,
99 int connector_type,
100 const uint32_t *formats,
101 unsigned int format_count,
102 const struct drm_display_mode *mode,
103 unsigned int rotation);
105 #endif /* __LINUX_TINYDRM_H */