aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/video/mxs_pxp.h
blob: d027c358338b94982264b94e3083a95e91cdc58b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/*
 * Freescale MXS PxP driver
 *
 * Author: Matt Porter <mporter@embeddedalley.com>
 *
 * Copyright 2008-2010 Freescale Semiconductor, Inc.
 * Copyright 2008-2009 Embedded Alley Solutions, Inc All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#ifdef	CONFIG_ARCH_MX23
#define BF_PXP_CTRL_OUTBUF_FORMAT(v)	BF_PXP_CTRL_OUTPUT_RGB_FORMAT(v)

#define BV_PXP_CTRL_OUTBUF_FORMAT__ARGB8888	\
	BV_PXP_CTRL_OUTPUT_RGB_FORMAT__ARGB8888
#define BV_PXP_CTRL_OUTBUF_FORMAT__RGB888	\
	BV_PXP_CTRL_OUTPUT_RGB_FORMAT__RGB888
#define BV_PXP_CTRL_OUTBUF_FORMAT__RGB888P   	\
	BV_PXP_CTRL_OUTPUT_RGB_FORMAT__RGB888P
#define BV_PXP_CTRL_OUTBUF_FORMAT__ARGB1555	\
	BV_PXP_CTRL_OUTPUT_RGB_FORMAT__ARGB1555
#define BV_PXP_CTRL_OUTBUF_FORMAT__RGB565	\
	BV_PXP_CTRL_OUTPUT_RGB_FORMAT__RGB565
#define BV_PXP_CTRL_OUTBUF_FORMAT__RGB555	\
	BV_PXP_CTRL_OUTPUT_RGB_FORMAT__RGB555

#define BF_PXP_OUTSIZE_WIDTH(v)		BF_PXP_RGBSIZE_WIDTH(v)
#define BF_PXP_OUTSIZE_HEIGHT(v)	BF_PXP_RGBSIZE_HEIGHT(v)
#endif

struct pxp_overlay_registers {
	u32 ol;
	u32 olsize;
	u32 olparam;
	u32 olparam2;
};

/* Registers feed for PXP_NEXT */
struct pxp_registers {
	u32 ctrl;
	u32 outbuf;
	u32 outbuf2;
	u32 outsize;
	u32 s0buf;
	u32 s0ubuf;
	u32 s0vbuf;
	u32 s0param;
	u32 s0background;
	u32 s0crop;
	u32 s0scale;
	u32 s0offset;
	u32 s0colorkeylow;
	u32 s0colorkeyhigh;
	u32 olcolorkeylow;
	u32 olcolorkeyhigh;

	struct pxp_overlay_registers ol0;
	struct pxp_overlay_registers ol1;
	struct pxp_overlay_registers ol2;
	struct pxp_overlay_registers ol3;
	struct pxp_overlay_registers ol4;
	struct pxp_overlay_registers ol5;
	struct pxp_overlay_registers ol6;
	struct pxp_overlay_registers ol7;
};

struct pxp_buffer {
	/* Must be first! */
	struct videobuf_buffer vb;
	struct list_head queue;
};

struct pxps {
	struct platform_device *pdev;
	struct resource *res;
	int irq;
	void __iomem *regs;

	struct work_struct work;
	struct workqueue_struct *workqueue;
	spinlock_t lock;
	struct mutex mutex;
	int users;

	struct video_device *vdev;

	struct videobuf_queue s0_vbq;
	struct videobuf_buffer *active;
	struct list_head outq;
	struct list_head nextq;

	int output;
	u32 *outb;
	dma_addr_t outb_phys;

	/* Current S0 configuration */
	struct pxp_data_format *s0_fmt;
	u32 s0_width;
	u32 s0_height;
	u32 s0_bgcolor;
	u32 s0_chromakey;

	struct v4l2_framebuffer fb;
	struct v4l2_rect drect;
	struct v4l2_rect srect;

	/* Transformation support */
	int scaling;
	int hflip;
	int vflip;
	int rotate;
	int yuv;

	/* Output overlay support */
	int overlay_state;
	int global_alpha_state;
	u8  global_alpha;
	int local_alpha_state;
	int s1_chromakey_state;
	u32 s1_chromakey;

	/* PXP_NEXT */
	u32 regs_phys;
	struct pxp_registers *regs_virt;
	wait_queue_head_t done;
	int next_queue_ended;
};

struct pxp_data_format {
	char *name;
	unsigned int bpp;
	u32 fourcc;
	enum v4l2_colorspace colorspace;
	u32 ctrl_s0_fmt;
};

extern int mxsfb_get_info(struct fb_var_screeninfo *var,
				struct fb_fix_screeninfo *fix);
extern void mxsfb_cfg_pxp(int enable, dma_addr_t pxp_phys);