This source file includes following definitions.
- sun6i_csi_get_bpp
1
2
3
4
5
6
7
8 #ifndef __SUN6I_CSI_H__
9 #define __SUN6I_CSI_H__
10
11 #include <media/v4l2-ctrls.h>
12 #include <media/v4l2-device.h>
13 #include <media/v4l2-fwnode.h>
14
15 #include "sun6i_video.h"
16
17 struct sun6i_csi;
18
19
20
21
22
23
24
25
26
27 struct sun6i_csi_config {
28 u32 pixelformat;
29 u32 code;
30 u32 field;
31 u32 width;
32 u32 height;
33 };
34
35 struct sun6i_csi {
36 struct device *dev;
37 struct v4l2_ctrl_handler ctrl_handler;
38 struct v4l2_device v4l2_dev;
39 struct media_device media_dev;
40
41 struct v4l2_async_notifier notifier;
42
43
44 struct v4l2_fwnode_endpoint v4l2_ep;
45
46 struct sun6i_csi_config config;
47
48 struct sun6i_video video;
49 };
50
51
52
53
54
55
56
57 bool sun6i_csi_is_format_supported(struct sun6i_csi *csi, u32 pixformat,
58 u32 mbus_code);
59
60
61
62
63
64
65 int sun6i_csi_set_power(struct sun6i_csi *csi, bool enable);
66
67
68
69
70
71
72 int sun6i_csi_update_config(struct sun6i_csi *csi,
73 struct sun6i_csi_config *config);
74
75
76
77
78
79
80 void sun6i_csi_update_buf_addr(struct sun6i_csi *csi, dma_addr_t addr);
81
82
83
84
85
86
87 void sun6i_csi_set_stream(struct sun6i_csi *csi, bool enable);
88
89
90 static inline int sun6i_csi_get_bpp(unsigned int pixformat)
91 {
92 switch (pixformat) {
93 case V4L2_PIX_FMT_SBGGR8:
94 case V4L2_PIX_FMT_SGBRG8:
95 case V4L2_PIX_FMT_SGRBG8:
96 case V4L2_PIX_FMT_SRGGB8:
97 case V4L2_PIX_FMT_JPEG:
98 return 8;
99 case V4L2_PIX_FMT_SBGGR10:
100 case V4L2_PIX_FMT_SGBRG10:
101 case V4L2_PIX_FMT_SGRBG10:
102 case V4L2_PIX_FMT_SRGGB10:
103 return 10;
104 case V4L2_PIX_FMT_SBGGR12:
105 case V4L2_PIX_FMT_SGBRG12:
106 case V4L2_PIX_FMT_SGRBG12:
107 case V4L2_PIX_FMT_SRGGB12:
108 case V4L2_PIX_FMT_HM12:
109 case V4L2_PIX_FMT_NV12:
110 case V4L2_PIX_FMT_NV21:
111 case V4L2_PIX_FMT_YUV420:
112 case V4L2_PIX_FMT_YVU420:
113 return 12;
114 case V4L2_PIX_FMT_YUYV:
115 case V4L2_PIX_FMT_YVYU:
116 case V4L2_PIX_FMT_UYVY:
117 case V4L2_PIX_FMT_VYUY:
118 case V4L2_PIX_FMT_NV16:
119 case V4L2_PIX_FMT_NV61:
120 case V4L2_PIX_FMT_YUV422P:
121 case V4L2_PIX_FMT_RGB565:
122 case V4L2_PIX_FMT_RGB565X:
123 return 16;
124 case V4L2_PIX_FMT_RGB24:
125 case V4L2_PIX_FMT_BGR24:
126 return 24;
127 case V4L2_PIX_FMT_RGB32:
128 case V4L2_PIX_FMT_BGR32:
129 return 32;
130 default:
131 WARN(1, "Unsupported pixformat: 0x%x\n", pixformat);
132 break;
133 }
134
135 return 0;
136 }
137
138 #endif