1/* drivers/gpu/drm/exynos/regs-rotator.h
2 *
3 * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 *		http://www.samsung.com/
5 *
6 * Register definition file for Samsung Rotator Interface (Rotator) driver
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11*/
12
13#ifndef EXYNOS_REGS_ROTATOR_H
14#define EXYNOS_REGS_ROTATOR_H
15
16/* Configuration */
17#define ROT_CONFIG			0x00
18#define ROT_CONFIG_IRQ			(3 << 8)
19
20/* Image Control */
21#define ROT_CONTROL			0x10
22#define ROT_CONTROL_PATTERN_WRITE	(1 << 16)
23#define ROT_CONTROL_FMT_YCBCR420_2P	(1 << 8)
24#define ROT_CONTROL_FMT_RGB888		(6 << 8)
25#define ROT_CONTROL_FMT_MASK		(7 << 8)
26#define ROT_CONTROL_FLIP_VERTICAL	(2 << 6)
27#define ROT_CONTROL_FLIP_HORIZONTAL	(3 << 6)
28#define ROT_CONTROL_FLIP_MASK		(3 << 6)
29#define ROT_CONTROL_ROT_90		(1 << 4)
30#define ROT_CONTROL_ROT_180		(2 << 4)
31#define ROT_CONTROL_ROT_270		(3 << 4)
32#define ROT_CONTROL_ROT_MASK		(3 << 4)
33#define ROT_CONTROL_START		(1 << 0)
34
35/* Status */
36#define ROT_STATUS			0x20
37#define ROT_STATUS_IRQ_PENDING(x)	(1 << (x))
38#define ROT_STATUS_IRQ(x)		(((x) >> 8) & 0x3)
39#define ROT_STATUS_IRQ_VAL_COMPLETE	1
40#define ROT_STATUS_IRQ_VAL_ILLEGAL	2
41
42/* Buffer Address */
43#define ROT_SRC_BUF_ADDR(n)		(0x30 + ((n) << 2))
44#define ROT_DST_BUF_ADDR(n)		(0x50 + ((n) << 2))
45
46/* Buffer Size */
47#define ROT_SRC_BUF_SIZE		0x3c
48#define ROT_DST_BUF_SIZE		0x5c
49#define ROT_SET_BUF_SIZE_H(x)		((x) << 16)
50#define ROT_SET_BUF_SIZE_W(x)		((x) << 0)
51#define ROT_GET_BUF_SIZE_H(x)		((x) >> 16)
52#define ROT_GET_BUF_SIZE_W(x)		((x) & 0xffff)
53
54/* Crop Position */
55#define ROT_SRC_CROP_POS		0x40
56#define ROT_DST_CROP_POS		0x60
57#define ROT_CROP_POS_Y(x)		((x) << 16)
58#define ROT_CROP_POS_X(x)		((x) << 0)
59
60/* Source Crop Size */
61#define ROT_SRC_CROP_SIZE		0x44
62#define ROT_SRC_CROP_SIZE_H(x)		((x) << 16)
63#define ROT_SRC_CROP_SIZE_W(x)		((x) << 0)
64
65/* Round to nearest aligned value */
66#define ROT_ALIGN(x, align, mask)	(((x) + (1 << ((align) - 1))) & (mask))
67/* Minimum limit value */
68#define ROT_MIN(min, mask)		(((min) + ~(mask)) & (mask))
69/* Maximum limit value */
70#define ROT_MAX(max, mask)		((max) & (mask))
71
72#endif /* EXYNOS_REGS_ROTATOR_H */
73
74