diff options
author | Prabhakar Lad <prabhakar.csengg@gmail.com> | 2017-07-20 04:56:31 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-07-26 06:14:33 -0400 |
commit | b25db383928cecba356835583b16fa7008f97b3a (patch) | |
tree | ef1c2b99a568ff3fd83e0eabb3a4fb0f109f441f | |
parent | da05d52d2f0f6bd61094a0cd045fed94bf7d673a (diff) |
media: platform: davinci: drop VPFE_CMD_S_CCDC_RAW_PARAMS
drop VPFE_CMD_S_CCDC_RAW_PARAMS ioctl from dm355/dm644x following reasons:
- This ioctl was never in public api and was only defined in kernel header.
- The function set_params constantly mixes up pointers and phys_addr_t
numbers.
- This is part of a 'VPFE_CMD_S_CCDC_RAW_PARAMS' ioctl command that is
described as an 'experimental ioctl that will change in future kernels'.
- The code to allocate the table never gets called after we copy_from_user
the user input over the kernel settings, and then compare them
for inequality.
- We then go on to use an address provided by user space as both the
__user pointer for input and pass it through phys_to_virt to come up
with a kernel pointer to copy the data to. This looks like a trivially
exploitable root hole.
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r-- | drivers/media/platform/davinci/ccdc_hw_device.h | 10 | ||||
-rw-r--r-- | drivers/media/platform/davinci/dm355_ccdc.c | 92 | ||||
-rw-r--r-- | drivers/media/platform/davinci/dm644x_ccdc.c | 151 | ||||
-rw-r--r-- | drivers/media/platform/davinci/vpfe_capture.c | 75 | ||||
-rw-r--r-- | include/media/davinci/dm644x_ccdc.h | 12 | ||||
-rw-r--r-- | include/media/davinci/vpfe_capture.h | 10 |
6 files changed, 4 insertions, 346 deletions
diff --git a/drivers/media/platform/davinci/ccdc_hw_device.h b/drivers/media/platform/davinci/ccdc_hw_device.h index 8f6688a7a111..f1b521045d64 100644 --- a/drivers/media/platform/davinci/ccdc_hw_device.h +++ b/drivers/media/platform/davinci/ccdc_hw_device.h | |||
@@ -42,16 +42,6 @@ struct ccdc_hw_ops { | |||
42 | int (*set_hw_if_params) (struct vpfe_hw_if_param *param); | 42 | int (*set_hw_if_params) (struct vpfe_hw_if_param *param); |
43 | /* get interface parameters */ | 43 | /* get interface parameters */ |
44 | int (*get_hw_if_params) (struct vpfe_hw_if_param *param); | 44 | int (*get_hw_if_params) (struct vpfe_hw_if_param *param); |
45 | /* | ||
46 | * Pointer to function to set parameters. Used | ||
47 | * for implementing VPFE_S_CCDC_PARAMS | ||
48 | */ | ||
49 | int (*set_params) (void *params); | ||
50 | /* | ||
51 | * Pointer to function to get parameter. Used | ||
52 | * for implementing VPFE_G_CCDC_PARAMS | ||
53 | */ | ||
54 | int (*get_params) (void *params); | ||
55 | /* Pointer to function to configure ccdc */ | 45 | /* Pointer to function to configure ccdc */ |
56 | int (*configure) (void); | 46 | int (*configure) (void); |
57 | 47 | ||
diff --git a/drivers/media/platform/davinci/dm355_ccdc.c b/drivers/media/platform/davinci/dm355_ccdc.c index 73db166dc338..6d492dc4c3a9 100644 --- a/drivers/media/platform/davinci/dm355_ccdc.c +++ b/drivers/media/platform/davinci/dm355_ccdc.c | |||
@@ -17,12 +17,7 @@ | |||
17 | * This module is for configuring DM355 CCD controller of VPFE to capture | 17 | * This module is for configuring DM355 CCD controller of VPFE to capture |
18 | * Raw yuv or Bayer RGB data from a decoder. CCDC has several modules | 18 | * Raw yuv or Bayer RGB data from a decoder. CCDC has several modules |
19 | * such as Defect Pixel Correction, Color Space Conversion etc to | 19 | * such as Defect Pixel Correction, Color Space Conversion etc to |
20 | * pre-process the Bayer RGB data, before writing it to SDRAM. This | 20 | * pre-process the Bayer RGB data, before writing it to SDRAM. |
21 | * module also allows application to configure individual | ||
22 | * module parameters through VPFE_CMD_S_CCDC_RAW_PARAMS IOCTL. | ||
23 | * To do so, application include dm355_ccdc.h and vpfe_capture.h header | ||
24 | * files. The setparams() API is called by vpfe_capture driver | ||
25 | * to configure module parameters | ||
26 | * | 21 | * |
27 | * TODO: 1) Raw bayer parameter settings and bayer capture | 22 | * TODO: 1) Raw bayer parameter settings and bayer capture |
28 | * 2) Split module parameter structure to module specific ioctl structs | 23 | * 2) Split module parameter structure to module specific ioctl structs |
@@ -260,90 +255,6 @@ static void ccdc_setwin(struct v4l2_rect *image_win, | |||
260 | dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_setwin..."); | 255 | dev_dbg(ccdc_cfg.dev, "\nEnd of ccdc_setwin..."); |
261 | } | 256 | } |
262 | 257 | ||
263 | static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam) | ||
264 | { | ||
265 | if (ccdcparam->datasft < CCDC_DATA_NO_SHIFT || | ||
266 | ccdcparam->datasft > CCDC_DATA_SHIFT_6BIT) { | ||
267 | dev_dbg(ccdc_cfg.dev, "Invalid value of data shift\n"); | ||
268 | return -EINVAL; | ||
269 | } | ||
270 | |||
271 | if (ccdcparam->mfilt1 < CCDC_NO_MEDIAN_FILTER1 || | ||
272 | ccdcparam->mfilt1 > CCDC_MEDIAN_FILTER1) { | ||
273 | dev_dbg(ccdc_cfg.dev, "Invalid value of median filter1\n"); | ||
274 | return -EINVAL; | ||
275 | } | ||
276 | |||
277 | if (ccdcparam->mfilt2 < CCDC_NO_MEDIAN_FILTER2 || | ||
278 | ccdcparam->mfilt2 > CCDC_MEDIAN_FILTER2) { | ||
279 | dev_dbg(ccdc_cfg.dev, "Invalid value of median filter2\n"); | ||
280 | return -EINVAL; | ||
281 | } | ||
282 | |||
283 | if ((ccdcparam->med_filt_thres < 0) || | ||
284 | (ccdcparam->med_filt_thres > CCDC_MED_FILT_THRESH)) { | ||
285 | dev_dbg(ccdc_cfg.dev, | ||
286 | "Invalid value of median filter threshold\n"); | ||
287 | return -EINVAL; | ||
288 | } | ||
289 | |||
290 | if (ccdcparam->data_sz < CCDC_DATA_16BITS || | ||
291 | ccdcparam->data_sz > CCDC_DATA_8BITS) { | ||
292 | dev_dbg(ccdc_cfg.dev, "Invalid value of data size\n"); | ||
293 | return -EINVAL; | ||
294 | } | ||
295 | |||
296 | if (ccdcparam->alaw.enable) { | ||
297 | if (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_13_4 || | ||
298 | ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) { | ||
299 | dev_dbg(ccdc_cfg.dev, "Invalid value of ALAW\n"); | ||
300 | return -EINVAL; | ||
301 | } | ||
302 | } | ||
303 | |||
304 | if (ccdcparam->blk_clamp.b_clamp_enable) { | ||
305 | if (ccdcparam->blk_clamp.sample_pixel < CCDC_SAMPLE_1PIXELS || | ||
306 | ccdcparam->blk_clamp.sample_pixel > CCDC_SAMPLE_16PIXELS) { | ||
307 | dev_dbg(ccdc_cfg.dev, | ||
308 | "Invalid value of sample pixel\n"); | ||
309 | return -EINVAL; | ||
310 | } | ||
311 | if (ccdcparam->blk_clamp.sample_ln < CCDC_SAMPLE_1LINES || | ||
312 | ccdcparam->blk_clamp.sample_ln > CCDC_SAMPLE_16LINES) { | ||
313 | dev_dbg(ccdc_cfg.dev, | ||
314 | "Invalid value of sample lines\n"); | ||
315 | return -EINVAL; | ||
316 | } | ||
317 | } | ||
318 | return 0; | ||
319 | } | ||
320 | |||
321 | /* Parameter operations */ | ||
322 | static int ccdc_set_params(void __user *params) | ||
323 | { | ||
324 | struct ccdc_config_params_raw ccdc_raw_params; | ||
325 | int x; | ||
326 | |||
327 | /* only raw module parameters can be set through the IOCTL */ | ||
328 | if (ccdc_cfg.if_type != VPFE_RAW_BAYER) | ||
329 | return -EINVAL; | ||
330 | |||
331 | x = copy_from_user(&ccdc_raw_params, params, sizeof(ccdc_raw_params)); | ||
332 | if (x) { | ||
333 | dev_dbg(ccdc_cfg.dev, "ccdc_set_params: error in copying ccdcparams, %d\n", | ||
334 | x); | ||
335 | return -EFAULT; | ||
336 | } | ||
337 | |||
338 | if (!validate_ccdc_param(&ccdc_raw_params)) { | ||
339 | memcpy(&ccdc_cfg.bayer.config_params, | ||
340 | &ccdc_raw_params, | ||
341 | sizeof(ccdc_raw_params)); | ||
342 | return 0; | ||
343 | } | ||
344 | return -EINVAL; | ||
345 | } | ||
346 | |||
347 | /* This function will configure CCDC for YCbCr video capture */ | 258 | /* This function will configure CCDC for YCbCr video capture */ |
348 | static void ccdc_config_ycbcr(void) | 259 | static void ccdc_config_ycbcr(void) |
349 | { | 260 | { |
@@ -939,7 +850,6 @@ static struct ccdc_hw_device ccdc_hw_dev = { | |||
939 | .enable = ccdc_enable, | 850 | .enable = ccdc_enable, |
940 | .enable_out_to_sdram = ccdc_enable_output_to_sdram, | 851 | .enable_out_to_sdram = ccdc_enable_output_to_sdram, |
941 | .set_hw_if_params = ccdc_set_hw_if_params, | 852 | .set_hw_if_params = ccdc_set_hw_if_params, |
942 | .set_params = ccdc_set_params, | ||
943 | .configure = ccdc_configure, | 853 | .configure = ccdc_configure, |
944 | .set_buftype = ccdc_set_buftype, | 854 | .set_buftype = ccdc_set_buftype, |
945 | .get_buftype = ccdc_get_buftype, | 855 | .get_buftype = ccdc_get_buftype, |
diff --git a/drivers/media/platform/davinci/dm644x_ccdc.c b/drivers/media/platform/davinci/dm644x_ccdc.c index 740fbc7a8c14..3b2d8a9317b8 100644 --- a/drivers/media/platform/davinci/dm644x_ccdc.c +++ b/drivers/media/platform/davinci/dm644x_ccdc.c | |||
@@ -17,13 +17,9 @@ | |||
17 | * This module is for configuring CCD controller of DM6446 VPFE to capture | 17 | * This module is for configuring CCD controller of DM6446 VPFE to capture |
18 | * Raw yuv or Bayer RGB data from a decoder. CCDC has several modules | 18 | * Raw yuv or Bayer RGB data from a decoder. CCDC has several modules |
19 | * such as Defect Pixel Correction, Color Space Conversion etc to | 19 | * such as Defect Pixel Correction, Color Space Conversion etc to |
20 | * pre-process the Raw Bayer RGB data, before writing it to SDRAM. This | 20 | * pre-process the Raw Bayer RGB data, before writing it to SDRAM. |
21 | * module also allows application to configure individual | 21 | * This file is named DM644x so that other variants such DM6443 |
22 | * module parameters through VPFE_CMD_S_CCDC_RAW_PARAMS IOCTL. | 22 | * may be supported using the same module. |
23 | * To do so, application includes dm644x_ccdc.h and vpfe_capture.h header | ||
24 | * files. The setparams() API is called by vpfe_capture driver | ||
25 | * to configure module parameters. This file is named DM644x so that other | ||
26 | * variants such DM6443 may be supported using the same module. | ||
27 | * | 23 | * |
28 | * TODO: Test Raw bayer parameter settings and bayer capture | 24 | * TODO: Test Raw bayer parameter settings and bayer capture |
29 | * Split module parameter structure to module specific ioctl structs | 25 | * Split module parameter structure to module specific ioctl structs |
@@ -216,96 +212,8 @@ static void ccdc_readregs(void) | |||
216 | dev_notice(ccdc_cfg.dev, "\nReading 0x%x to VERT_LINES...\n", val); | 212 | dev_notice(ccdc_cfg.dev, "\nReading 0x%x to VERT_LINES...\n", val); |
217 | } | 213 | } |
218 | 214 | ||
219 | static int validate_ccdc_param(struct ccdc_config_params_raw *ccdcparam) | ||
220 | { | ||
221 | if (ccdcparam->alaw.enable) { | ||
222 | u8 max_gamma = ccdc_gamma_width_max_bit(ccdcparam->alaw.gamma_wd); | ||
223 | u8 max_data = ccdc_data_size_max_bit(ccdcparam->data_sz); | ||
224 | |||
225 | if ((ccdcparam->alaw.gamma_wd > CCDC_GAMMA_BITS_09_0) || | ||
226 | (ccdcparam->alaw.gamma_wd < CCDC_GAMMA_BITS_15_6) || | ||
227 | (max_gamma > max_data)) { | ||
228 | dev_dbg(ccdc_cfg.dev, "\nInvalid data line select"); | ||
229 | return -1; | ||
230 | } | ||
231 | } | ||
232 | return 0; | ||
233 | } | ||
234 | |||
235 | static int ccdc_update_raw_params(struct ccdc_config_params_raw *raw_params) | ||
236 | { | ||
237 | struct ccdc_config_params_raw *config_params = | ||
238 | &ccdc_cfg.bayer.config_params; | ||
239 | unsigned int *fpc_virtaddr = NULL; | ||
240 | unsigned int *fpc_physaddr = NULL; | ||
241 | |||
242 | memcpy(config_params, raw_params, sizeof(*raw_params)); | ||
243 | /* | ||
244 | * allocate memory for fault pixel table and copy the user | ||
245 | * values to the table | ||
246 | */ | ||
247 | if (!config_params->fault_pxl.enable) | ||
248 | return 0; | ||
249 | |||
250 | fpc_physaddr = (unsigned int *)config_params->fault_pxl.fpc_table_addr; | ||
251 | fpc_virtaddr = (unsigned int *)phys_to_virt( | ||
252 | (unsigned long)fpc_physaddr); | ||
253 | /* | ||
254 | * Allocate memory for FPC table if current | ||
255 | * FPC table buffer is not big enough to | ||
256 | * accommodate FPC Number requested | ||
257 | */ | ||
258 | if (raw_params->fault_pxl.fp_num != config_params->fault_pxl.fp_num) { | ||
259 | if (fpc_physaddr != NULL) { | ||
260 | free_pages((unsigned long)fpc_virtaddr, | ||
261 | get_order | ||
262 | (config_params->fault_pxl.fp_num * | ||
263 | FP_NUM_BYTES)); | ||
264 | } | ||
265 | |||
266 | /* Allocate memory for FPC table */ | ||
267 | fpc_virtaddr = | ||
268 | (unsigned int *)__get_free_pages(GFP_KERNEL | GFP_DMA, | ||
269 | get_order(raw_params-> | ||
270 | fault_pxl.fp_num * | ||
271 | FP_NUM_BYTES)); | ||
272 | |||
273 | if (fpc_virtaddr == NULL) { | ||
274 | dev_dbg(ccdc_cfg.dev, | ||
275 | "\nUnable to allocate memory for FPC"); | ||
276 | return -EFAULT; | ||
277 | } | ||
278 | fpc_physaddr = | ||
279 | (unsigned int *)virt_to_phys((void *)fpc_virtaddr); | ||
280 | } | ||
281 | |||
282 | /* Copy number of fault pixels and FPC table */ | ||
283 | config_params->fault_pxl.fp_num = raw_params->fault_pxl.fp_num; | ||
284 | if (copy_from_user(fpc_virtaddr, | ||
285 | (void __user *)raw_params->fault_pxl.fpc_table_addr, | ||
286 | config_params->fault_pxl.fp_num * FP_NUM_BYTES)) { | ||
287 | dev_dbg(ccdc_cfg.dev, "\n copy_from_user failed"); | ||
288 | return -EFAULT; | ||
289 | } | ||
290 | config_params->fault_pxl.fpc_table_addr = (unsigned long)fpc_physaddr; | ||
291 | return 0; | ||
292 | } | ||
293 | |||
294 | static int ccdc_close(struct device *dev) | 215 | static int ccdc_close(struct device *dev) |
295 | { | 216 | { |
296 | struct ccdc_config_params_raw *config_params = | ||
297 | &ccdc_cfg.bayer.config_params; | ||
298 | unsigned int *fpc_physaddr = NULL, *fpc_virtaddr = NULL; | ||
299 | |||
300 | fpc_physaddr = (unsigned int *)config_params->fault_pxl.fpc_table_addr; | ||
301 | |||
302 | if (fpc_physaddr != NULL) { | ||
303 | fpc_virtaddr = (unsigned int *) | ||
304 | phys_to_virt((unsigned long)fpc_physaddr); | ||
305 | free_pages((unsigned long)fpc_virtaddr, | ||
306 | get_order(config_params->fault_pxl.fp_num * | ||
307 | FP_NUM_BYTES)); | ||
308 | } | ||
309 | return 0; | 217 | return 0; |
310 | } | 218 | } |
311 | 219 | ||
@@ -339,29 +247,6 @@ static void ccdc_sbl_reset(void) | |||
339 | vpss_clear_wbl_overflow(VPSS_PCR_CCDC_WBL_O); | 247 | vpss_clear_wbl_overflow(VPSS_PCR_CCDC_WBL_O); |
340 | } | 248 | } |
341 | 249 | ||
342 | /* Parameter operations */ | ||
343 | static int ccdc_set_params(void __user *params) | ||
344 | { | ||
345 | struct ccdc_config_params_raw ccdc_raw_params; | ||
346 | int x; | ||
347 | |||
348 | if (ccdc_cfg.if_type != VPFE_RAW_BAYER) | ||
349 | return -EINVAL; | ||
350 | |||
351 | x = copy_from_user(&ccdc_raw_params, params, sizeof(ccdc_raw_params)); | ||
352 | if (x) { | ||
353 | dev_dbg(ccdc_cfg.dev, "ccdc_set_params: error in copyingccdc params, %d\n", | ||
354 | x); | ||
355 | return -EFAULT; | ||
356 | } | ||
357 | |||
358 | if (!validate_ccdc_param(&ccdc_raw_params)) { | ||
359 | if (!ccdc_update_raw_params(&ccdc_raw_params)) | ||
360 | return 0; | ||
361 | } | ||
362 | return -EINVAL; | ||
363 | } | ||
364 | |||
365 | /* | 250 | /* |
366 | * ccdc_config_ycbcr() | 251 | * ccdc_config_ycbcr() |
367 | * This function will configure CCDC for YCbCr video capture | 252 | * This function will configure CCDC for YCbCr video capture |
@@ -489,32 +374,6 @@ static void ccdc_config_black_compense(struct ccdc_black_compensation *bcomp) | |||
489 | regw(val, CCDC_BLKCMP); | 374 | regw(val, CCDC_BLKCMP); |
490 | } | 375 | } |
491 | 376 | ||
492 | static void ccdc_config_fpc(struct ccdc_fault_pixel *fpc) | ||
493 | { | ||
494 | u32 val; | ||
495 | |||
496 | /* Initially disable FPC */ | ||
497 | val = CCDC_FPC_DISABLE; | ||
498 | regw(val, CCDC_FPC); | ||
499 | |||
500 | if (!fpc->enable) | ||
501 | return; | ||
502 | |||
503 | /* Configure Fault pixel if needed */ | ||
504 | regw(fpc->fpc_table_addr, CCDC_FPC_ADDR); | ||
505 | dev_dbg(ccdc_cfg.dev, "\nWriting 0x%lx to FPC_ADDR...\n", | ||
506 | (fpc->fpc_table_addr)); | ||
507 | /* Write the FPC params with FPC disable */ | ||
508 | val = fpc->fp_num & CCDC_FPC_FPC_NUM_MASK; | ||
509 | regw(val, CCDC_FPC); | ||
510 | |||
511 | dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FPC...\n", val); | ||
512 | /* read the FPC register */ | ||
513 | val = regr(CCDC_FPC) | CCDC_FPC_ENABLE; | ||
514 | regw(val, CCDC_FPC); | ||
515 | dev_dbg(ccdc_cfg.dev, "\nWriting 0x%x to FPC...\n", val); | ||
516 | } | ||
517 | |||
518 | /* | 377 | /* |
519 | * ccdc_config_raw() | 378 | * ccdc_config_raw() |
520 | * This function will configure CCDC for Raw capture mode | 379 | * This function will configure CCDC for Raw capture mode |
@@ -569,9 +428,6 @@ static void ccdc_config_raw(void) | |||
569 | /* Configure Black level compensation */ | 428 | /* Configure Black level compensation */ |
570 | ccdc_config_black_compense(&config_params->blk_comp); | 429 | ccdc_config_black_compense(&config_params->blk_comp); |
571 | 430 | ||
572 | /* Configure Fault Pixel Correction */ | ||
573 | ccdc_config_fpc(&config_params->fault_pxl); | ||
574 | |||
575 | /* If data size is 8 bit then pack the data */ | 431 | /* If data size is 8 bit then pack the data */ |
576 | if ((config_params->data_sz == CCDC_DATA_8BITS) || | 432 | if ((config_params->data_sz == CCDC_DATA_8BITS) || |
577 | config_params->alaw.enable) | 433 | config_params->alaw.enable) |
@@ -929,7 +785,6 @@ static struct ccdc_hw_device ccdc_hw_dev = { | |||
929 | .reset = ccdc_sbl_reset, | 785 | .reset = ccdc_sbl_reset, |
930 | .enable = ccdc_enable, | 786 | .enable = ccdc_enable, |
931 | .set_hw_if_params = ccdc_set_hw_if_params, | 787 | .set_hw_if_params = ccdc_set_hw_if_params, |
932 | .set_params = ccdc_set_params, | ||
933 | .configure = ccdc_configure, | 788 | .configure = ccdc_configure, |
934 | .set_buftype = ccdc_set_buftype, | 789 | .set_buftype = ccdc_set_buftype, |
935 | .get_buftype = ccdc_get_buftype, | 790 | .get_buftype = ccdc_get_buftype, |
diff --git a/drivers/media/platform/davinci/vpfe_capture.c b/drivers/media/platform/davinci/vpfe_capture.c index 1831bf5ccca5..b1bf4a7e8eb7 100644 --- a/drivers/media/platform/davinci/vpfe_capture.c +++ b/drivers/media/platform/davinci/vpfe_capture.c | |||
@@ -281,45 +281,6 @@ void vpfe_unregister_ccdc_device(struct ccdc_hw_device *dev) | |||
281 | EXPORT_SYMBOL(vpfe_unregister_ccdc_device); | 281 | EXPORT_SYMBOL(vpfe_unregister_ccdc_device); |
282 | 282 | ||
283 | /* | 283 | /* |
284 | * vpfe_get_ccdc_image_format - Get image parameters based on CCDC settings | ||
285 | */ | ||
286 | static int vpfe_get_ccdc_image_format(struct vpfe_device *vpfe_dev, | ||
287 | struct v4l2_format *f) | ||
288 | { | ||
289 | struct v4l2_rect image_win; | ||
290 | enum ccdc_buftype buf_type; | ||
291 | enum ccdc_frmfmt frm_fmt; | ||
292 | |||
293 | memset(f, 0, sizeof(*f)); | ||
294 | f->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; | ||
295 | ccdc_dev->hw_ops.get_image_window(&image_win); | ||
296 | f->fmt.pix.width = image_win.width; | ||
297 | f->fmt.pix.height = image_win.height; | ||
298 | f->fmt.pix.bytesperline = ccdc_dev->hw_ops.get_line_length(); | ||
299 | f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * | ||
300 | f->fmt.pix.height; | ||
301 | buf_type = ccdc_dev->hw_ops.get_buftype(); | ||
302 | f->fmt.pix.pixelformat = ccdc_dev->hw_ops.get_pixel_format(); | ||
303 | frm_fmt = ccdc_dev->hw_ops.get_frame_format(); | ||
304 | if (frm_fmt == CCDC_FRMFMT_PROGRESSIVE) | ||
305 | f->fmt.pix.field = V4L2_FIELD_NONE; | ||
306 | else if (frm_fmt == CCDC_FRMFMT_INTERLACED) { | ||
307 | if (buf_type == CCDC_BUFTYPE_FLD_INTERLEAVED) | ||
308 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; | ||
309 | else if (buf_type == CCDC_BUFTYPE_FLD_SEPARATED) | ||
310 | f->fmt.pix.field = V4L2_FIELD_SEQ_TB; | ||
311 | else { | ||
312 | v4l2_err(&vpfe_dev->v4l2_dev, "Invalid buf_type\n"); | ||
313 | return -EINVAL; | ||
314 | } | ||
315 | } else { | ||
316 | v4l2_err(&vpfe_dev->v4l2_dev, "Invalid frm_fmt\n"); | ||
317 | return -EINVAL; | ||
318 | } | ||
319 | return 0; | ||
320 | } | ||
321 | |||
322 | /* | ||
323 | * vpfe_config_ccdc_image_format() | 284 | * vpfe_config_ccdc_image_format() |
324 | * For a pix format, configure ccdc to setup the capture | 285 | * For a pix format, configure ccdc to setup the capture |
325 | */ | 286 | */ |
@@ -1697,41 +1658,6 @@ unlock_out: | |||
1697 | return ret; | 1658 | return ret; |
1698 | } | 1659 | } |
1699 | 1660 | ||
1700 | |||
1701 | static long vpfe_param_handler(struct file *file, void *priv, | ||
1702 | bool valid_prio, unsigned int cmd, void *param) | ||
1703 | { | ||
1704 | struct vpfe_device *vpfe_dev = video_drvdata(file); | ||
1705 | int ret; | ||
1706 | |||
1707 | v4l2_dbg(2, debug, &vpfe_dev->v4l2_dev, "vpfe_param_handler\n"); | ||
1708 | |||
1709 | if (vpfe_dev->started) { | ||
1710 | /* only allowed if streaming is not started */ | ||
1711 | v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, | ||
1712 | "device already started\n"); | ||
1713 | return -EBUSY; | ||
1714 | } | ||
1715 | |||
1716 | ret = mutex_lock_interruptible(&vpfe_dev->lock); | ||
1717 | if (ret) | ||
1718 | return ret; | ||
1719 | |||
1720 | switch (cmd) { | ||
1721 | case VPFE_CMD_S_CCDC_RAW_PARAMS: | ||
1722 | ret = -EINVAL; | ||
1723 | v4l2_warn(&vpfe_dev->v4l2_dev, | ||
1724 | "VPFE_CMD_S_CCDC_RAW_PARAMS not supported\n"); | ||
1725 | break; | ||
1726 | default: | ||
1727 | ret = -ENOTTY; | ||
1728 | } | ||
1729 | unlock_out: | ||
1730 | mutex_unlock(&vpfe_dev->lock); | ||
1731 | return ret; | ||
1732 | } | ||
1733 | |||
1734 | |||
1735 | /* vpfe capture ioctl operations */ | 1661 | /* vpfe capture ioctl operations */ |
1736 | static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { | 1662 | static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { |
1737 | .vidioc_querycap = vpfe_querycap, | 1663 | .vidioc_querycap = vpfe_querycap, |
@@ -1754,7 +1680,6 @@ static const struct v4l2_ioctl_ops vpfe_ioctl_ops = { | |||
1754 | .vidioc_cropcap = vpfe_cropcap, | 1680 | .vidioc_cropcap = vpfe_cropcap, |
1755 | .vidioc_g_selection = vpfe_g_selection, | 1681 | .vidioc_g_selection = vpfe_g_selection, |
1756 | .vidioc_s_selection = vpfe_s_selection, | 1682 | .vidioc_s_selection = vpfe_s_selection, |
1757 | .vidioc_default = vpfe_param_handler, | ||
1758 | }; | 1683 | }; |
1759 | 1684 | ||
1760 | static struct vpfe_device *vpfe_initialize(void) | 1685 | static struct vpfe_device *vpfe_initialize(void) |
diff --git a/include/media/davinci/dm644x_ccdc.h b/include/media/davinci/dm644x_ccdc.h index 7c909da29d43..6ea2ce241851 100644 --- a/include/media/davinci/dm644x_ccdc.h +++ b/include/media/davinci/dm644x_ccdc.h | |||
@@ -103,16 +103,6 @@ struct ccdc_black_compensation { | |||
103 | char gb; | 103 | char gb; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | /* structure for fault pixel correction */ | ||
107 | struct ccdc_fault_pixel { | ||
108 | /* Enable or Disable fault pixel correction */ | ||
109 | unsigned char enable; | ||
110 | /* Number of fault pixel */ | ||
111 | unsigned short fp_num; | ||
112 | /* Address of fault pixel table */ | ||
113 | unsigned long fpc_table_addr; | ||
114 | }; | ||
115 | |||
116 | /* Structure for CCDC configuration parameters for raw capture mode passed | 106 | /* Structure for CCDC configuration parameters for raw capture mode passed |
117 | * by application | 107 | * by application |
118 | */ | 108 | */ |
@@ -125,8 +115,6 @@ struct ccdc_config_params_raw { | |||
125 | struct ccdc_black_clamp blk_clamp; | 115 | struct ccdc_black_clamp blk_clamp; |
126 | /* Structure for Black Compensation */ | 116 | /* Structure for Black Compensation */ |
127 | struct ccdc_black_compensation blk_comp; | 117 | struct ccdc_black_compensation blk_comp; |
128 | /* Structure for Fault Pixel Module Configuration */ | ||
129 | struct ccdc_fault_pixel fault_pxl; | ||
130 | }; | 118 | }; |
131 | 119 | ||
132 | 120 | ||
diff --git a/include/media/davinci/vpfe_capture.h b/include/media/davinci/vpfe_capture.h index 8e1a4d88daa0..f003533602d0 100644 --- a/include/media/davinci/vpfe_capture.h +++ b/include/media/davinci/vpfe_capture.h | |||
@@ -183,14 +183,4 @@ struct vpfe_config_params { | |||
183 | }; | 183 | }; |
184 | 184 | ||
185 | #endif /* End of __KERNEL__ */ | 185 | #endif /* End of __KERNEL__ */ |
186 | /** | ||
187 | * VPFE_CMD_S_CCDC_RAW_PARAMS - EXPERIMENTAL IOCTL to set raw capture params | ||
188 | * This can be used to configure modules such as defect pixel correction, | ||
189 | * color space conversion, culling etc. This is an experimental ioctl that | ||
190 | * will change in future kernels. So use this ioctl with care ! | ||
191 | * TODO: This is to be split into multiple ioctls and also explore the | ||
192 | * possibility of extending the v4l2 api to include this | ||
193 | **/ | ||
194 | #define VPFE_CMD_S_CCDC_RAW_PARAMS _IOW('V', BASE_VIDIOC_PRIVATE + 1, \ | ||
195 | void *) | ||
196 | #endif /* _DAVINCI_VPFE_H */ | 186 | #endif /* _DAVINCI_VPFE_H */ |