.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Samsung S5P/EXYNOS4 SoC series FIMC (CAMIF) driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2010-2012 Samsung Electronics Co., Ltd. |
---|
5 | 6 | * Sylwester Nawrocki <s.nawrocki@samsung.com> |
---|
6 | | - * |
---|
7 | | - * This program is free software; you can redistribute it and/or modify |
---|
8 | | - * it under the terms of the GNU General Public License as published |
---|
9 | | - * by the Free Software Foundation, either version 2 of the License, |
---|
10 | | - * or (at your option) any later version. |
---|
11 | 7 | */ |
---|
12 | 8 | |
---|
13 | 9 | #include <linux/module.h> |
---|
.. | .. |
---|
40 | 36 | |
---|
41 | 37 | static struct fimc_fmt fimc_formats[] = { |
---|
42 | 38 | { |
---|
43 | | - .name = "RGB565", |
---|
44 | 39 | .fourcc = V4L2_PIX_FMT_RGB565, |
---|
45 | 40 | .depth = { 16 }, |
---|
46 | 41 | .color = FIMC_FMT_RGB565, |
---|
.. | .. |
---|
48 | 43 | .colplanes = 1, |
---|
49 | 44 | .flags = FMT_FLAGS_M2M, |
---|
50 | 45 | }, { |
---|
51 | | - .name = "BGR666", |
---|
52 | 46 | .fourcc = V4L2_PIX_FMT_BGR666, |
---|
53 | 47 | .depth = { 32 }, |
---|
54 | 48 | .color = FIMC_FMT_RGB666, |
---|
.. | .. |
---|
56 | 50 | .colplanes = 1, |
---|
57 | 51 | .flags = FMT_FLAGS_M2M, |
---|
58 | 52 | }, { |
---|
59 | | - .name = "BGRA8888, 32 bpp", |
---|
60 | 53 | .fourcc = V4L2_PIX_FMT_BGR32, |
---|
61 | 54 | .depth = { 32 }, |
---|
62 | 55 | .color = FIMC_FMT_RGB888, |
---|
.. | .. |
---|
64 | 57 | .colplanes = 1, |
---|
65 | 58 | .flags = FMT_FLAGS_M2M | FMT_HAS_ALPHA, |
---|
66 | 59 | }, { |
---|
67 | | - .name = "ARGB1555", |
---|
68 | 60 | .fourcc = V4L2_PIX_FMT_RGB555, |
---|
69 | 61 | .depth = { 16 }, |
---|
70 | 62 | .color = FIMC_FMT_RGB555, |
---|
.. | .. |
---|
72 | 64 | .colplanes = 1, |
---|
73 | 65 | .flags = FMT_FLAGS_M2M_OUT | FMT_HAS_ALPHA, |
---|
74 | 66 | }, { |
---|
75 | | - .name = "ARGB4444", |
---|
76 | 67 | .fourcc = V4L2_PIX_FMT_RGB444, |
---|
77 | 68 | .depth = { 16 }, |
---|
78 | 69 | .color = FIMC_FMT_RGB444, |
---|
.. | .. |
---|
80 | 71 | .colplanes = 1, |
---|
81 | 72 | .flags = FMT_FLAGS_M2M_OUT | FMT_HAS_ALPHA, |
---|
82 | 73 | }, { |
---|
83 | | - .name = "YUV 4:4:4", |
---|
84 | 74 | .mbus_code = MEDIA_BUS_FMT_YUV10_1X30, |
---|
85 | 75 | .flags = FMT_FLAGS_WRITEBACK, |
---|
86 | 76 | }, { |
---|
87 | | - .name = "YUV 4:2:2 packed, YCbYCr", |
---|
88 | 77 | .fourcc = V4L2_PIX_FMT_YUYV, |
---|
89 | 78 | .depth = { 16 }, |
---|
90 | 79 | .color = FIMC_FMT_YCBYCR422, |
---|
.. | .. |
---|
93 | 82 | .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8, |
---|
94 | 83 | .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM, |
---|
95 | 84 | }, { |
---|
96 | | - .name = "YUV 4:2:2 packed, CbYCrY", |
---|
97 | 85 | .fourcc = V4L2_PIX_FMT_UYVY, |
---|
98 | 86 | .depth = { 16 }, |
---|
99 | 87 | .color = FIMC_FMT_CBYCRY422, |
---|
.. | .. |
---|
102 | 90 | .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8, |
---|
103 | 91 | .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM, |
---|
104 | 92 | }, { |
---|
105 | | - .name = "YUV 4:2:2 packed, CrYCbY", |
---|
106 | 93 | .fourcc = V4L2_PIX_FMT_VYUY, |
---|
107 | 94 | .depth = { 16 }, |
---|
108 | 95 | .color = FIMC_FMT_CRYCBY422, |
---|
.. | .. |
---|
111 | 98 | .mbus_code = MEDIA_BUS_FMT_VYUY8_2X8, |
---|
112 | 99 | .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM, |
---|
113 | 100 | }, { |
---|
114 | | - .name = "YUV 4:2:2 packed, YCrYCb", |
---|
115 | 101 | .fourcc = V4L2_PIX_FMT_YVYU, |
---|
116 | 102 | .depth = { 16 }, |
---|
117 | 103 | .color = FIMC_FMT_YCRYCB422, |
---|
.. | .. |
---|
120 | 106 | .mbus_code = MEDIA_BUS_FMT_YVYU8_2X8, |
---|
121 | 107 | .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM, |
---|
122 | 108 | }, { |
---|
123 | | - .name = "YUV 4:2:2 planar, Y/Cb/Cr", |
---|
124 | 109 | .fourcc = V4L2_PIX_FMT_YUV422P, |
---|
125 | 110 | .depth = { 16 }, |
---|
126 | 111 | .color = FIMC_FMT_YCBYCR422, |
---|
.. | .. |
---|
128 | 113 | .colplanes = 3, |
---|
129 | 114 | .flags = FMT_FLAGS_M2M, |
---|
130 | 115 | }, { |
---|
131 | | - .name = "YUV 4:2:2 planar, Y/CbCr", |
---|
132 | 116 | .fourcc = V4L2_PIX_FMT_NV16, |
---|
133 | 117 | .depth = { 16 }, |
---|
134 | 118 | .color = FIMC_FMT_YCBYCR422, |
---|
.. | .. |
---|
136 | 120 | .colplanes = 2, |
---|
137 | 121 | .flags = FMT_FLAGS_M2M, |
---|
138 | 122 | }, { |
---|
139 | | - .name = "YUV 4:2:2 planar, Y/CrCb", |
---|
140 | 123 | .fourcc = V4L2_PIX_FMT_NV61, |
---|
141 | 124 | .depth = { 16 }, |
---|
142 | 125 | .color = FIMC_FMT_YCRYCB422, |
---|
.. | .. |
---|
144 | 127 | .colplanes = 2, |
---|
145 | 128 | .flags = FMT_FLAGS_M2M, |
---|
146 | 129 | }, { |
---|
147 | | - .name = "YUV 4:2:0 planar, YCbCr", |
---|
148 | 130 | .fourcc = V4L2_PIX_FMT_YUV420, |
---|
149 | 131 | .depth = { 12 }, |
---|
150 | 132 | .color = FIMC_FMT_YCBCR420, |
---|
.. | .. |
---|
152 | 134 | .colplanes = 3, |
---|
153 | 135 | .flags = FMT_FLAGS_M2M, |
---|
154 | 136 | }, { |
---|
155 | | - .name = "YUV 4:2:0 planar, Y/CbCr", |
---|
156 | 137 | .fourcc = V4L2_PIX_FMT_NV12, |
---|
157 | 138 | .depth = { 12 }, |
---|
158 | 139 | .color = FIMC_FMT_YCBCR420, |
---|
.. | .. |
---|
160 | 141 | .colplanes = 2, |
---|
161 | 142 | .flags = FMT_FLAGS_M2M, |
---|
162 | 143 | }, { |
---|
163 | | - .name = "YUV 4:2:0 non-contig. 2p, Y/CbCr", |
---|
164 | 144 | .fourcc = V4L2_PIX_FMT_NV12M, |
---|
165 | 145 | .color = FIMC_FMT_YCBCR420, |
---|
166 | 146 | .depth = { 8, 4 }, |
---|
.. | .. |
---|
168 | 148 | .colplanes = 2, |
---|
169 | 149 | .flags = FMT_FLAGS_M2M, |
---|
170 | 150 | }, { |
---|
171 | | - .name = "YUV 4:2:0 non-contig. 3p, Y/Cb/Cr", |
---|
172 | 151 | .fourcc = V4L2_PIX_FMT_YUV420M, |
---|
173 | 152 | .color = FIMC_FMT_YCBCR420, |
---|
174 | 153 | .depth = { 8, 2, 2 }, |
---|
.. | .. |
---|
176 | 155 | .colplanes = 3, |
---|
177 | 156 | .flags = FMT_FLAGS_M2M, |
---|
178 | 157 | }, { |
---|
179 | | - .name = "YUV 4:2:0 non-contig. 2p, tiled", |
---|
180 | 158 | .fourcc = V4L2_PIX_FMT_NV12MT, |
---|
181 | 159 | .color = FIMC_FMT_YCBCR420, |
---|
182 | 160 | .depth = { 8, 4 }, |
---|
.. | .. |
---|
184 | 162 | .colplanes = 2, |
---|
185 | 163 | .flags = FMT_FLAGS_M2M, |
---|
186 | 164 | }, { |
---|
187 | | - .name = "JPEG encoded data", |
---|
188 | 165 | .fourcc = V4L2_PIX_FMT_JPEG, |
---|
189 | 166 | .color = FIMC_FMT_JPEG, |
---|
190 | 167 | .depth = { 8 }, |
---|
.. | .. |
---|
193 | 170 | .mbus_code = MEDIA_BUS_FMT_JPEG_1X8, |
---|
194 | 171 | .flags = FMT_FLAGS_CAM | FMT_FLAGS_COMPRESSED, |
---|
195 | 172 | }, { |
---|
196 | | - .name = "S5C73MX interleaved UYVY/JPEG", |
---|
197 | 173 | .fourcc = V4L2_PIX_FMT_S5C_UYVY_JPG, |
---|
198 | 174 | .color = FIMC_FMT_YUYV_JPEG, |
---|
199 | 175 | .depth = { 8 }, |
---|
.. | .. |
---|
978 | 954 | spin_lock_init(&fimc->slock); |
---|
979 | 955 | mutex_init(&fimc->lock); |
---|
980 | 956 | |
---|
981 | | - fimc->sysreg = fimc_get_sysreg_regmap(dev->of_node); |
---|
982 | | - if (IS_ERR(fimc->sysreg)) |
---|
983 | | - return PTR_ERR(fimc->sysreg); |
---|
| 957 | + if (fimc->variant->has_isp_wb) { |
---|
| 958 | + fimc->sysreg = fimc_get_sysreg_regmap(dev->of_node); |
---|
| 959 | + if (IS_ERR(fimc->sysreg)) |
---|
| 960 | + return PTR_ERR(fimc->sysreg); |
---|
| 961 | + } |
---|
984 | 962 | |
---|
985 | 963 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
---|
986 | 964 | fimc->regs = devm_ioremap_resource(dev, res); |
---|
.. | .. |
---|
1134 | 1112 | return 0; |
---|
1135 | 1113 | } |
---|
1136 | 1114 | |
---|
1137 | | -/* Image pixel limits, similar across several FIMC HW revisions. */ |
---|
1138 | | -static const struct fimc_pix_limit s5p_pix_limit[4] = { |
---|
1139 | | - [0] = { |
---|
1140 | | - .scaler_en_w = 3264, |
---|
1141 | | - .scaler_dis_w = 8192, |
---|
1142 | | - .out_rot_en_w = 1920, |
---|
1143 | | - .out_rot_dis_w = 4224, |
---|
1144 | | - }, |
---|
1145 | | - [1] = { |
---|
1146 | | - .scaler_en_w = 4224, |
---|
1147 | | - .scaler_dis_w = 8192, |
---|
1148 | | - .out_rot_en_w = 1920, |
---|
1149 | | - .out_rot_dis_w = 4224, |
---|
1150 | | - }, |
---|
1151 | | - [2] = { |
---|
1152 | | - .scaler_en_w = 1920, |
---|
1153 | | - .scaler_dis_w = 8192, |
---|
1154 | | - .out_rot_en_w = 1280, |
---|
1155 | | - .out_rot_dis_w = 1920, |
---|
1156 | | - }, |
---|
1157 | | -}; |
---|
1158 | | - |
---|
1159 | | -static const struct fimc_variant fimc0_variant_s5pv210 = { |
---|
1160 | | - .has_inp_rot = 1, |
---|
1161 | | - .has_out_rot = 1, |
---|
1162 | | - .has_cam_if = 1, |
---|
1163 | | - .min_inp_pixsize = 16, |
---|
1164 | | - .min_out_pixsize = 16, |
---|
1165 | | - .hor_offs_align = 8, |
---|
1166 | | - .min_vsize_align = 16, |
---|
1167 | | - .pix_limit = &s5p_pix_limit[1], |
---|
1168 | | -}; |
---|
1169 | | - |
---|
1170 | | -static const struct fimc_variant fimc1_variant_s5pv210 = { |
---|
1171 | | - .has_inp_rot = 1, |
---|
1172 | | - .has_out_rot = 1, |
---|
1173 | | - .has_cam_if = 1, |
---|
1174 | | - .has_mainscaler_ext = 1, |
---|
1175 | | - .min_inp_pixsize = 16, |
---|
1176 | | - .min_out_pixsize = 16, |
---|
1177 | | - .hor_offs_align = 1, |
---|
1178 | | - .min_vsize_align = 1, |
---|
1179 | | - .pix_limit = &s5p_pix_limit[2], |
---|
1180 | | -}; |
---|
1181 | | - |
---|
1182 | | -static const struct fimc_variant fimc2_variant_s5pv210 = { |
---|
1183 | | - .has_cam_if = 1, |
---|
1184 | | - .min_inp_pixsize = 16, |
---|
1185 | | - .min_out_pixsize = 16, |
---|
1186 | | - .hor_offs_align = 8, |
---|
1187 | | - .min_vsize_align = 16, |
---|
1188 | | - .pix_limit = &s5p_pix_limit[2], |
---|
1189 | | -}; |
---|
1190 | | - |
---|
1191 | 1115 | /* S5PV210, S5PC110 */ |
---|
1192 | 1116 | static const struct fimc_drvdata fimc_drvdata_s5pv210 = { |
---|
1193 | | - .variant = { |
---|
1194 | | - [0] = &fimc0_variant_s5pv210, |
---|
1195 | | - [1] = &fimc1_variant_s5pv210, |
---|
1196 | | - [2] = &fimc2_variant_s5pv210, |
---|
1197 | | - }, |
---|
1198 | 1117 | .num_entities = 3, |
---|
1199 | 1118 | .lclk_frequency = 166000000UL, |
---|
1200 | 1119 | .out_buf_count = 4, |
---|