Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
jpeg-regs.h
Go to the documentation of this file.
1 /* linux/drivers/media/platform/s5p-jpeg/jpeg-regs.h
2  *
3  * Register definition file for Samsung JPEG codec driver
4  *
5  * Copyright (c) 2011 Samsung Electronics Co., Ltd.
6  * http://www.samsung.com
7  *
8  * Author: Andrzej Pietrasiewicz <[email protected]>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2 as
12  * published by the Free Software Foundation.
13  */
14 
15 #ifndef JPEG_REGS_H_
16 #define JPEG_REGS_H_
17 
18 /* JPEG mode register */
19 #define S5P_JPGMOD 0x00
20 #define S5P_PROC_MODE_MASK (0x1 << 3)
21 #define S5P_PROC_MODE_DECOMPR (0x1 << 3)
22 #define S5P_PROC_MODE_COMPR (0x0 << 3)
23 #define S5P_SUBSAMPLING_MODE_MASK 0x7
24 #define S5P_SUBSAMPLING_MODE_444 (0x0 << 0)
25 #define S5P_SUBSAMPLING_MODE_422 (0x1 << 0)
26 #define S5P_SUBSAMPLING_MODE_420 (0x2 << 0)
27 #define S5P_SUBSAMPLING_MODE_GRAY (0x3 << 0)
28 
29 /* JPEG operation status register */
30 #define S5P_JPGOPR 0x04
31 
32 /* Quantization tables*/
33 #define S5P_JPG_QTBL 0x08
34 #define S5P_QT_NUMt_SHIFT(t) (((t) - 1) << 1)
35 #define S5P_QT_NUMt_MASK(t) (0x3 << S5P_QT_NUMt_SHIFT(t))
36 
37 /* Huffman tables */
38 #define S5P_JPG_HTBL 0x0c
39 #define S5P_HT_NUMt_AC_SHIFT(t) (((t) << 1) - 1)
40 #define S5P_HT_NUMt_AC_MASK(t) (0x1 << S5P_HT_NUMt_AC_SHIFT(t))
41 
42 #define S5P_HT_NUMt_DC_SHIFT(t) (((t) - 1) << 1)
43 #define S5P_HT_NUMt_DC_MASK(t) (0x1 << S5P_HT_NUMt_DC_SHIFT(t))
44 
45 /* JPEG restart interval register upper byte */
46 #define S5P_JPGDRI_U 0x10
47 
48 /* JPEG restart interval register lower byte */
49 #define S5P_JPGDRI_L 0x14
50 
51 /* JPEG vertical resolution register upper byte */
52 #define S5P_JPGY_U 0x18
53 
54 /* JPEG vertical resolution register lower byte */
55 #define S5P_JPGY_L 0x1c
56 
57 /* JPEG horizontal resolution register upper byte */
58 #define S5P_JPGX_U 0x20
59 
60 /* JPEG horizontal resolution register lower byte */
61 #define S5P_JPGX_L 0x24
62 
63 /* JPEG byte count register upper byte */
64 #define S5P_JPGCNT_U 0x28
65 
66 /* JPEG byte count register middle byte */
67 #define S5P_JPGCNT_M 0x2c
68 
69 /* JPEG byte count register lower byte */
70 #define S5P_JPGCNT_L 0x30
71 
72 /* JPEG interrupt setting register */
73 #define S5P_JPGINTSE 0x34
74 #define S5P_RSTm_INT_EN_MASK (0x1 << 7)
75 #define S5P_RSTm_INT_EN (0x1 << 7)
76 #define S5P_DATA_NUM_INT_EN_MASK (0x1 << 6)
77 #define S5P_DATA_NUM_INT_EN (0x1 << 6)
78 #define S5P_FINAL_MCU_NUM_INT_EN_MASK (0x1 << 5)
79 #define S5P_FINAL_MCU_NUM_INT_EN (0x1 << 5)
80 
81 /* JPEG interrupt status register */
82 #define S5P_JPGINTST 0x38
83 #define S5P_RESULT_STAT_SHIFT 6
84 #define S5P_RESULT_STAT_MASK (0x1 << S5P_RESULT_STAT_SHIFT)
85 #define S5P_STREAM_STAT_SHIFT 5
86 #define S5P_STREAM_STAT_MASK (0x1 << S5P_STREAM_STAT_SHIFT)
87 
88 /* JPEG command register */
89 #define S5P_JPGCOM 0x4c
90 #define S5P_INT_RELEASE (0x1 << 2)
91 
92 /* Raw image data r/w address register */
93 #define S5P_JPG_IMGADR 0x50
94 
95 /* JPEG file r/w address register */
96 #define S5P_JPG_JPGADR 0x58
97 
98 /* Coefficient for RGB-to-YCbCr converter register */
99 #define S5P_JPG_COEF(n) (0x5c + (((n) - 1) << 2))
100 #define S5P_COEFn_SHIFT(j) ((3 - (j)) << 3)
101 #define S5P_COEFn_MASK(j) (0xff << S5P_COEFn_SHIFT(j))
102 
103 /* JPEG color mode register */
104 #define S5P_JPGCMOD 0x68
105 #define S5P_MOD_SEL_MASK (0x7 << 5)
106 #define S5P_MOD_SEL_422 (0x1 << 5)
107 #define S5P_MOD_SEL_565 (0x2 << 5)
108 #define S5P_MODE_Y16_MASK (0x1 << 1)
109 #define S5P_MODE_Y16 (0x1 << 1)
110 
111 /* JPEG clock control register */
112 #define S5P_JPGCLKCON 0x6c
113 #define S5P_CLK_DOWN_READY (0x1 << 1)
114 #define S5P_POWER_ON (0x1 << 0)
115 
116 /* JPEG start register */
117 #define S5P_JSTART 0x70
118 
119 /* JPEG SW reset register */
120 #define S5P_JPG_SW_RESET 0x78
121 
122 /* JPEG timer setting register */
123 #define S5P_JPG_TIMER_SE 0x7c
124 #define S5P_TIMER_INT_EN_MASK (0x1 << 31)
125 #define S5P_TIMER_INT_EN (0x1 << 31)
126 #define S5P_TIMER_INIT_MASK 0x7fffffff
127 
128 /* JPEG timer status register */
129 #define S5P_JPG_TIMER_ST 0x80
130 #define S5P_TIMER_INT_STAT_SHIFT 31
131 #define S5P_TIMER_INT_STAT_MASK (0x1 << S5P_TIMER_INT_STAT_SHIFT)
132 #define S5P_TIMER_CNT_SHIFT 0
133 #define S5P_TIMER_CNT_MASK 0x7fffffff
134 
135 /* JPEG decompression output format register */
136 #define S5P_JPG_OUTFORM 0x88
137 #define S5P_DEC_OUT_FORMAT_MASK (0x1 << 0)
138 #define S5P_DEC_OUT_FORMAT_422 (0x0 << 0)
139 #define S5P_DEC_OUT_FORMAT_420 (0x1 << 0)
140 
141 /* JPEG version register */
142 #define S5P_JPG_VERSION 0x8c
143 
144 /* JPEG compressed stream size interrupt setting register */
145 #define S5P_JPG_ENC_STREAM_INTSE 0x98
146 #define S5P_ENC_STREAM_INT_MASK (0x1 << 24)
147 #define S5P_ENC_STREAM_INT_EN (0x1 << 24)
148 #define S5P_ENC_STREAM_BOUND_MASK 0xffffff
149 
150 /* JPEG compressed stream size interrupt status register */
151 #define S5P_JPG_ENC_STREAM_INTST 0x9c
152 #define S5P_ENC_STREAM_INT_STAT_MASK 0x1
153 
154 /* JPEG quantizer table register */
155 #define S5P_JPG_QTBL_CONTENT(n) (0x400 + (n) * 0x100)
156 
157 /* JPEG DC Huffman table register */
158 #define S5P_JPG_HDCTBL(n) (0x800 + (n) * 0x400)
159 
160 /* JPEG DC Huffman table register */
161 #define S5P_JPG_HDCTBLG(n) (0x840 + (n) * 0x400)
162 
163 /* JPEG AC Huffman table register */
164 #define S5P_JPG_HACTBL(n) (0x880 + (n) * 0x400)
165 
166 /* JPEG AC Huffman table register */
167 #define S5P_JPG_HACTBLG(n) (0x8c0 + (n) * 0x400)
168 
169 #endif /* JPEG_REGS_H_ */
170