2 * Xilinx DRM KMS Header for Xilinx
4 * Copyright (C) 2013 Xilinx, Inc.
6 * Author: Hyun Woo Kwon <hyunk@xilinx.com>
8 * This software is licensed under the terms of the GNU General Public
9 * License version 2, as published by the Free Software Foundation, and
10 * may be copied, distributed, and modified under those terms.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
18 #ifndef _XILINX_DRM_H_
19 #define _XILINX_DRM_H_
21 enum xilinx_video_format {
22 XILINX_VIDEO_FORMAT_YUV422 = 0,
23 XILINX_VIDEO_FORMAT_YUV444 = 1,
24 XILINX_VIDEO_FORMAT_RGB = 2,
25 XILINX_VIDEO_FORMAT_YUV420 = 3,
26 XILINX_VIDEO_FORMAT_XRGB = 16,
27 XILINX_VIDEO_FORMAT_NONE = 32,
30 /* convert the xilinx format to the drm format */
31 int xilinx_drm_format_by_code(unsigned int xilinx_format, uint32_t *drm_format);
32 int xilinx_drm_format_by_name(const char *name, uint32_t *drm_format);
34 unsigned int xilinx_drm_format_bpp(uint32_t drm_format);
35 unsigned int xilinx_drm_format_depth(uint32_t drm_format);
37 /* io write operations */
38 static inline void xilinx_drm_writel(void __iomem *base, int offset, u32 val)
40 writel(val, base + offset);
43 /* io read operations */
44 static inline u32 xilinx_drm_readl(void __iomem *base, int offset)
46 return readl(base + offset);
49 static inline void xilinx_drm_clr(void __iomem *base, int offset, u32 clr)
51 xilinx_drm_writel(base, offset, xilinx_drm_readl(base, offset) & ~clr);
54 static inline void xilinx_drm_set(void __iomem *base, int offset, u32 set)
56 xilinx_drm_writel(base, offset, xilinx_drm_readl(base, offset) | set);
62 bool xilinx_drm_check_format(struct drm_device *drm, uint32_t fourcc);
63 uint32_t xilinx_drm_get_format(struct drm_device *drm);
64 unsigned int xilinx_drm_get_align(struct drm_device *drm);
65 void xilinx_drm_set_config(struct drm_device *drm, struct drm_mode_set *set);
67 #endif /* _XILINX_DRM_H_ */