2 * Copyright (c) 2016 MediaTek Inc.
3 * Author: Ming Hsiu Tsai <minghsiu.tsai@mediatek.com>
4 * Rick Chang <rick.chang@mediatek.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
16 #ifndef _MTK_JPEG_HW_H
17 #define _MTK_JPEG_HW_H
19 #include <media/videobuf2-core.h>
21 #include "mtk_jpeg_core.h"
22 #include "mtk_jpeg_reg.h"
25 MTK_JPEG_DEC_RESULT_EOF_DONE
= 0,
26 MTK_JPEG_DEC_RESULT_PAUSE
= 1,
27 MTK_JPEG_DEC_RESULT_UNDERFLOW
= 2,
28 MTK_JPEG_DEC_RESULT_OVERFLOW
= 3,
29 MTK_JPEG_DEC_RESULT_ERROR_BS
= 4,
30 MTK_JPEG_DEC_RESULT_ERROR_UNKNOWN
= 6
33 struct mtk_jpeg_dec_param
{
45 u32 comp_id
[MTK_JPEG_COMP_MAX
];
46 u32 sampling_w
[MTK_JPEG_COMP_MAX
];
47 u32 sampling_h
[MTK_JPEG_COMP_MAX
];
48 u32 qtbl_num
[MTK_JPEG_COMP_MAX
];
50 u32 blk_comp
[MTK_JPEG_COMP_MAX
];
55 u32 img_stride
[MTK_JPEG_COMP_MAX
];
56 u32 mem_stride
[MTK_JPEG_COMP_MAX
];
57 u32 comp_w
[MTK_JPEG_COMP_MAX
];
58 u32 comp_size
[MTK_JPEG_COMP_MAX
];
65 static inline u32
mtk_jpeg_align(u32 val
, u32 align
)
67 return (val
+ align
- 1) & ~(align
- 1);
77 dma_addr_t plane_addr
[MTK_JPEG_COMP_MAX
];
81 int mtk_jpeg_dec_fill_param(struct mtk_jpeg_dec_param
*param
);
82 u32
mtk_jpeg_dec_get_int_status(void __iomem
*dec_reg_base
);
83 u32
mtk_jpeg_dec_enum_result(u32 irq_result
);
84 void mtk_jpeg_dec_set_config(void __iomem
*base
,
85 struct mtk_jpeg_dec_param
*config
,
86 struct mtk_jpeg_bs
*bs
,
87 struct mtk_jpeg_fb
*fb
);
88 void mtk_jpeg_dec_reset(void __iomem
*dec_reg_base
);
89 void mtk_jpeg_dec_start(void __iomem
*dec_reg_base
);
91 #endif /* _MTK_JPEG_HW_H */