1 /*
2  *
3  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
4  * Authors:
5  *	Seung-Woo Kim <sw0312.kim@samsung.com>
6  *	Inki Dae <inki.dae@samsung.com>
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice (including the next
16  * paragraph) shall be included in all copies or substantial portions of the
17  * Software.
18  *
19  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
22  * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
23  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
24  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25  * OTHER DEALINGS IN THE SOFTWARE.
26  */
27 
28 #ifndef _EXYNOS_MIXER_H_
29 #define _EXYNOS_MIXER_H_
30 
31 #define HDMI_OVERLAY_NUMBER	3
32 
33 struct hdmi_win_data {
34 	dma_addr_t		dma_addr;
35 	void __iomem		*vaddr;
36 	dma_addr_t		chroma_dma_addr;
37 	void __iomem		*chroma_vaddr;
38 	uint32_t		pixel_format;
39 	unsigned int		bpp;
40 	unsigned int		crtc_x;
41 	unsigned int		crtc_y;
42 	unsigned int		crtc_width;
43 	unsigned int		crtc_height;
44 	unsigned int		fb_x;
45 	unsigned int		fb_y;
46 	unsigned int		fb_width;
47 	unsigned int		fb_height;
48 	unsigned int		mode_width;
49 	unsigned int		mode_height;
50 	unsigned int		scan_flags;
51 };
52 
53 struct mixer_resources {
54 	struct device *dev;
55 	/** interrupt index */
56 	int irq;
57 	/** pointer to Mixer registers */
58 	void __iomem *mixer_regs;
59 	/** pointer to Video Processor registers */
60 	void __iomem *vp_regs;
61 	/** spinlock for protection of registers */
62 	spinlock_t reg_slock;
63 	/** other resources */
64 	struct clk *mixer;
65 	struct clk *vp;
66 	struct clk *sclk_mixer;
67 	struct clk *sclk_hdmi;
68 	struct clk *sclk_dac;
69 };
70 
71 struct mixer_context {
72 	unsigned int			default_win;
73 	struct fb_videomode		*default_timing;
74 	unsigned int			default_bpp;
75 
76 	/** mixer interrupt */
77 	unsigned int irq;
78 	/** current crtc pipe for vblank */
79 	int pipe;
80 	/** interlace scan mode */
81 	bool interlace;
82 	/** vp enabled status */
83 	bool vp_enabled;
84 
85 	/** mixer and vp resources */
86 	struct mixer_resources mixer_res;
87 
88 	/** overlay window data */
89 	struct hdmi_win_data		win_data[HDMI_OVERLAY_NUMBER];
90 };
91 
92 #endif
93