]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_stream_format.c
staging/atomisp: Add support for the Intel IPU v2
[mirror_ubuntu-hirsute-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / sh_css_stream_format.c
1 /*
2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 */
14
15 #include "sh_css_stream_format.h"
16 #include <ia_css_stream_format.h>
17
18 unsigned int sh_css_stream_format_2_bits_per_subpixel(
19 enum ia_css_stream_format format)
20 {
21 unsigned int rval;
22
23 switch (format) {
24 case IA_CSS_STREAM_FORMAT_RGB_444:
25 rval = 4;
26 break;
27 case IA_CSS_STREAM_FORMAT_RGB_555:
28 rval = 5;
29 break;
30 case IA_CSS_STREAM_FORMAT_RGB_565:
31 case IA_CSS_STREAM_FORMAT_RGB_666:
32 case IA_CSS_STREAM_FORMAT_RAW_6:
33 rval = 6;
34 break;
35 case IA_CSS_STREAM_FORMAT_RAW_7:
36 rval = 7;
37 break;
38 case IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY:
39 case IA_CSS_STREAM_FORMAT_YUV420_8:
40 case IA_CSS_STREAM_FORMAT_YUV422_8:
41 case IA_CSS_STREAM_FORMAT_RGB_888:
42 case IA_CSS_STREAM_FORMAT_RAW_8:
43 case IA_CSS_STREAM_FORMAT_BINARY_8:
44 case IA_CSS_STREAM_FORMAT_USER_DEF1:
45 case IA_CSS_STREAM_FORMAT_USER_DEF2:
46 case IA_CSS_STREAM_FORMAT_USER_DEF3:
47 case IA_CSS_STREAM_FORMAT_USER_DEF4:
48 case IA_CSS_STREAM_FORMAT_USER_DEF5:
49 case IA_CSS_STREAM_FORMAT_USER_DEF6:
50 case IA_CSS_STREAM_FORMAT_USER_DEF7:
51 case IA_CSS_STREAM_FORMAT_USER_DEF8:
52 rval = 8;
53 break;
54 case IA_CSS_STREAM_FORMAT_YUV420_10:
55 case IA_CSS_STREAM_FORMAT_YUV422_10:
56 case IA_CSS_STREAM_FORMAT_RAW_10:
57 rval = 10;
58 break;
59 case IA_CSS_STREAM_FORMAT_RAW_12:
60 rval = 12;
61 break;
62 case IA_CSS_STREAM_FORMAT_RAW_14:
63 rval = 14;
64 break;
65 case IA_CSS_STREAM_FORMAT_RAW_16:
66 case IA_CSS_STREAM_FORMAT_YUV420_16:
67 case IA_CSS_STREAM_FORMAT_YUV422_16:
68 rval = 16;
69 break;
70 default:
71 rval = 0;
72 break;
73 }
74
75 return rval;
76 }