1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * ST stm32 DMA2D - 2D Graphics Accelerator Driver
5 * Copyright (c) 2021 Dillon Min
10 * Copyright (c) 2011 Samsung Electronics Co., Ltd.
17 #include <linux/platform_device.h>
18 #include <media/v4l2-device.h>
19 #include <media/v4l2-ctrls.h>
21 #define DMA2D_NAME "stm-dma2d"
22 #define BUS_INFO "platform:stm-dma2d"
31 /* output pfc cmode from ARGB888 to ARGB4444 */
37 /* bg or fg pfc cmode from L8 to A4 */
46 enum dma2d_alpha_mode {
47 DMA2D_ALPHA_MODE_NO_MODIF,
48 DMA2D_ALPHA_MODE_REPLACE,
49 DMA2D_ALPHA_MODE_COMBINE
55 enum dma2d_cmode cmode;
59 /* Original dimensions */
72 struct dma2d_fmt *fmt;
80 * AM[1:0] of DMA2D_FGPFCCR
82 enum dma2d_alpha_mode a_mode;
84 unsigned int sequence;
89 struct dma2d_dev *dev;
90 struct dma2d_frame cap;
91 struct dma2d_frame out;
92 struct dma2d_frame bg;
94 * MODE[17:16] of DMA2D_CR
96 enum dma2d_op_mode op_mode;
97 struct v4l2_ctrl_handler ctrl_handler;
98 enum v4l2_colorspace colorspace;
99 enum v4l2_ycbcr_encoding ycbcr_enc;
100 enum v4l2_xfer_func xfer_func;
101 enum v4l2_quantization quant;
105 struct v4l2_device v4l2_dev;
106 struct v4l2_m2m_dev *m2m_dev;
107 struct video_device *vfd;
108 /* for device open/close etc */
110 /* to avoid the conflict with device running and user setting
113 spinlock_t ctrl_lock;
117 struct dma2d_ctx *curr;
121 void dma2d_start(struct dma2d_dev *d);
122 u32 dma2d_get_int(struct dma2d_dev *d);
123 void dma2d_clear_int(struct dma2d_dev *d);
124 void dma2d_config_out(struct dma2d_dev *d, struct dma2d_frame *frm,
126 void dma2d_config_fg(struct dma2d_dev *d, struct dma2d_frame *frm,
128 void dma2d_config_bg(struct dma2d_dev *d, struct dma2d_frame *frm,
130 void dma2d_config_common(struct dma2d_dev *d, enum dma2d_op_mode op_mode,
131 u16 width, u16 height);
133 #endif /* __DMA2D_H__ */