hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/exynos4-is/fimc-core.c
....@@ -1,13 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Samsung S5P/EXYNOS4 SoC series FIMC (CAMIF) driver
34 *
45 * Copyright (C) 2010-2012 Samsung Electronics Co., Ltd.
56 * 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.
117 */
128
139 #include <linux/module.h>
....@@ -40,7 +36,6 @@
4036
4137 static struct fimc_fmt fimc_formats[] = {
4238 {
43
- .name = "RGB565",
4439 .fourcc = V4L2_PIX_FMT_RGB565,
4540 .depth = { 16 },
4641 .color = FIMC_FMT_RGB565,
....@@ -48,7 +43,6 @@
4843 .colplanes = 1,
4944 .flags = FMT_FLAGS_M2M,
5045 }, {
51
- .name = "BGR666",
5246 .fourcc = V4L2_PIX_FMT_BGR666,
5347 .depth = { 32 },
5448 .color = FIMC_FMT_RGB666,
....@@ -56,7 +50,6 @@
5650 .colplanes = 1,
5751 .flags = FMT_FLAGS_M2M,
5852 }, {
59
- .name = "BGRA8888, 32 bpp",
6053 .fourcc = V4L2_PIX_FMT_BGR32,
6154 .depth = { 32 },
6255 .color = FIMC_FMT_RGB888,
....@@ -64,7 +57,6 @@
6457 .colplanes = 1,
6558 .flags = FMT_FLAGS_M2M | FMT_HAS_ALPHA,
6659 }, {
67
- .name = "ARGB1555",
6860 .fourcc = V4L2_PIX_FMT_RGB555,
6961 .depth = { 16 },
7062 .color = FIMC_FMT_RGB555,
....@@ -72,7 +64,6 @@
7264 .colplanes = 1,
7365 .flags = FMT_FLAGS_M2M_OUT | FMT_HAS_ALPHA,
7466 }, {
75
- .name = "ARGB4444",
7667 .fourcc = V4L2_PIX_FMT_RGB444,
7768 .depth = { 16 },
7869 .color = FIMC_FMT_RGB444,
....@@ -80,11 +71,9 @@
8071 .colplanes = 1,
8172 .flags = FMT_FLAGS_M2M_OUT | FMT_HAS_ALPHA,
8273 }, {
83
- .name = "YUV 4:4:4",
8474 .mbus_code = MEDIA_BUS_FMT_YUV10_1X30,
8575 .flags = FMT_FLAGS_WRITEBACK,
8676 }, {
87
- .name = "YUV 4:2:2 packed, YCbYCr",
8877 .fourcc = V4L2_PIX_FMT_YUYV,
8978 .depth = { 16 },
9079 .color = FIMC_FMT_YCBYCR422,
....@@ -93,7 +82,6 @@
9382 .mbus_code = MEDIA_BUS_FMT_YUYV8_2X8,
9483 .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM,
9584 }, {
96
- .name = "YUV 4:2:2 packed, CbYCrY",
9785 .fourcc = V4L2_PIX_FMT_UYVY,
9886 .depth = { 16 },
9987 .color = FIMC_FMT_CBYCRY422,
....@@ -102,7 +90,6 @@
10290 .mbus_code = MEDIA_BUS_FMT_UYVY8_2X8,
10391 .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM,
10492 }, {
105
- .name = "YUV 4:2:2 packed, CrYCbY",
10693 .fourcc = V4L2_PIX_FMT_VYUY,
10794 .depth = { 16 },
10895 .color = FIMC_FMT_CRYCBY422,
....@@ -111,7 +98,6 @@
11198 .mbus_code = MEDIA_BUS_FMT_VYUY8_2X8,
11299 .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM,
113100 }, {
114
- .name = "YUV 4:2:2 packed, YCrYCb",
115101 .fourcc = V4L2_PIX_FMT_YVYU,
116102 .depth = { 16 },
117103 .color = FIMC_FMT_YCRYCB422,
....@@ -120,7 +106,6 @@
120106 .mbus_code = MEDIA_BUS_FMT_YVYU8_2X8,
121107 .flags = FMT_FLAGS_M2M | FMT_FLAGS_CAM,
122108 }, {
123
- .name = "YUV 4:2:2 planar, Y/Cb/Cr",
124109 .fourcc = V4L2_PIX_FMT_YUV422P,
125110 .depth = { 16 },
126111 .color = FIMC_FMT_YCBYCR422,
....@@ -128,7 +113,6 @@
128113 .colplanes = 3,
129114 .flags = FMT_FLAGS_M2M,
130115 }, {
131
- .name = "YUV 4:2:2 planar, Y/CbCr",
132116 .fourcc = V4L2_PIX_FMT_NV16,
133117 .depth = { 16 },
134118 .color = FIMC_FMT_YCBYCR422,
....@@ -136,7 +120,6 @@
136120 .colplanes = 2,
137121 .flags = FMT_FLAGS_M2M,
138122 }, {
139
- .name = "YUV 4:2:2 planar, Y/CrCb",
140123 .fourcc = V4L2_PIX_FMT_NV61,
141124 .depth = { 16 },
142125 .color = FIMC_FMT_YCRYCB422,
....@@ -144,7 +127,6 @@
144127 .colplanes = 2,
145128 .flags = FMT_FLAGS_M2M,
146129 }, {
147
- .name = "YUV 4:2:0 planar, YCbCr",
148130 .fourcc = V4L2_PIX_FMT_YUV420,
149131 .depth = { 12 },
150132 .color = FIMC_FMT_YCBCR420,
....@@ -152,7 +134,6 @@
152134 .colplanes = 3,
153135 .flags = FMT_FLAGS_M2M,
154136 }, {
155
- .name = "YUV 4:2:0 planar, Y/CbCr",
156137 .fourcc = V4L2_PIX_FMT_NV12,
157138 .depth = { 12 },
158139 .color = FIMC_FMT_YCBCR420,
....@@ -160,7 +141,6 @@
160141 .colplanes = 2,
161142 .flags = FMT_FLAGS_M2M,
162143 }, {
163
- .name = "YUV 4:2:0 non-contig. 2p, Y/CbCr",
164144 .fourcc = V4L2_PIX_FMT_NV12M,
165145 .color = FIMC_FMT_YCBCR420,
166146 .depth = { 8, 4 },
....@@ -168,7 +148,6 @@
168148 .colplanes = 2,
169149 .flags = FMT_FLAGS_M2M,
170150 }, {
171
- .name = "YUV 4:2:0 non-contig. 3p, Y/Cb/Cr",
172151 .fourcc = V4L2_PIX_FMT_YUV420M,
173152 .color = FIMC_FMT_YCBCR420,
174153 .depth = { 8, 2, 2 },
....@@ -176,7 +155,6 @@
176155 .colplanes = 3,
177156 .flags = FMT_FLAGS_M2M,
178157 }, {
179
- .name = "YUV 4:2:0 non-contig. 2p, tiled",
180158 .fourcc = V4L2_PIX_FMT_NV12MT,
181159 .color = FIMC_FMT_YCBCR420,
182160 .depth = { 8, 4 },
....@@ -184,7 +162,6 @@
184162 .colplanes = 2,
185163 .flags = FMT_FLAGS_M2M,
186164 }, {
187
- .name = "JPEG encoded data",
188165 .fourcc = V4L2_PIX_FMT_JPEG,
189166 .color = FIMC_FMT_JPEG,
190167 .depth = { 8 },
....@@ -193,7 +170,6 @@
193170 .mbus_code = MEDIA_BUS_FMT_JPEG_1X8,
194171 .flags = FMT_FLAGS_CAM | FMT_FLAGS_COMPRESSED,
195172 }, {
196
- .name = "S5C73MX interleaved UYVY/JPEG",
197173 .fourcc = V4L2_PIX_FMT_S5C_UYVY_JPG,
198174 .color = FIMC_FMT_YUYV_JPEG,
199175 .depth = { 8 },
....@@ -978,9 +954,11 @@
978954 spin_lock_init(&fimc->slock);
979955 mutex_init(&fimc->lock);
980956
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
+ }
984962
985963 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
986964 fimc->regs = devm_ioremap_resource(dev, res);
....@@ -1134,67 +1112,8 @@
11341112 return 0;
11351113 }
11361114
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
-
11911115 /* S5PV210, S5PC110 */
11921116 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
- },
11981117 .num_entities = 3,
11991118 .lclk_frequency = 166000000UL,
12001119 .out_buf_count = 4,