diff options
Diffstat (limited to 'drivers/usb/media/pwc/pwc-ctrl.c')
-rw-r--r-- | drivers/usb/media/pwc/pwc-ctrl.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/usb/media/pwc/pwc-ctrl.c index 26aa914bc541..42352f531bc0 100644 --- a/drivers/usb/media/pwc/pwc-ctrl.c +++ b/drivers/usb/media/pwc/pwc-ctrl.c | |||
@@ -418,6 +418,44 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
418 | 418 | ||
419 | 419 | ||
420 | 420 | ||
421 | static void pwc_set_image_buffer_size(struct pwc_device *pdev) | ||
422 | { | ||
423 | int i, factor = 0, filler = 0; | ||
424 | |||
425 | /* for PALETTE_YUV420P */ | ||
426 | switch(pdev->vpalette) | ||
427 | { | ||
428 | case VIDEO_PALETTE_YUV420P: | ||
429 | factor = 6; | ||
430 | filler = 128; | ||
431 | break; | ||
432 | case VIDEO_PALETTE_RAW: | ||
433 | factor = 6; /* can be uncompressed YUV420P */ | ||
434 | filler = 0; | ||
435 | break; | ||
436 | } | ||
437 | |||
438 | /* Set sizes in bytes */ | ||
439 | pdev->image.size = pdev->image.x * pdev->image.y * factor / 4; | ||
440 | pdev->view.size = pdev->view.x * pdev->view.y * factor / 4; | ||
441 | |||
442 | /* Align offset, or you'll get some very weird results in | ||
443 | YUV420 mode... x must be multiple of 4 (to get the Y's in | ||
444 | place), and y even (or you'll mixup U & V). This is less of a | ||
445 | problem for YUV420P. | ||
446 | */ | ||
447 | pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC; | ||
448 | pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE; | ||
449 | |||
450 | /* Fill buffers with gray or black */ | ||
451 | for (i = 0; i < MAX_IMAGES; i++) { | ||
452 | if (pdev->image_ptr[i] != NULL) | ||
453 | memset(pdev->image_ptr[i], filler, pdev->view.size); | ||
454 | } | ||
455 | } | ||
456 | |||
457 | |||
458 | |||
421 | /** | 459 | /** |
422 | @pdev: device structure | 460 | @pdev: device structure |
423 | @width: viewport width | 461 | @width: viewport width |
@@ -475,44 +513,6 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame | |||
475 | } | 513 | } |
476 | 514 | ||
477 | 515 | ||
478 | void pwc_set_image_buffer_size(struct pwc_device *pdev) | ||
479 | { | ||
480 | int i, factor = 0, filler = 0; | ||
481 | |||
482 | /* for PALETTE_YUV420P */ | ||
483 | switch(pdev->vpalette) | ||
484 | { | ||
485 | case VIDEO_PALETTE_YUV420P: | ||
486 | factor = 6; | ||
487 | filler = 128; | ||
488 | break; | ||
489 | case VIDEO_PALETTE_RAW: | ||
490 | factor = 6; /* can be uncompressed YUV420P */ | ||
491 | filler = 0; | ||
492 | break; | ||
493 | } | ||
494 | |||
495 | /* Set sizes in bytes */ | ||
496 | pdev->image.size = pdev->image.x * pdev->image.y * factor / 4; | ||
497 | pdev->view.size = pdev->view.x * pdev->view.y * factor / 4; | ||
498 | |||
499 | /* Align offset, or you'll get some very weird results in | ||
500 | YUV420 mode... x must be multiple of 4 (to get the Y's in | ||
501 | place), and y even (or you'll mixup U & V). This is less of a | ||
502 | problem for YUV420P. | ||
503 | */ | ||
504 | pdev->offset.x = ((pdev->view.x - pdev->image.x) / 2) & 0xFFFC; | ||
505 | pdev->offset.y = ((pdev->view.y - pdev->image.y) / 2) & 0xFFFE; | ||
506 | |||
507 | /* Fill buffers with gray or black */ | ||
508 | for (i = 0; i < MAX_IMAGES; i++) { | ||
509 | if (pdev->image_ptr[i] != NULL) | ||
510 | memset(pdev->image_ptr[i], filler, pdev->view.size); | ||
511 | } | ||
512 | } | ||
513 | |||
514 | |||
515 | |||
516 | /* BRIGHTNESS */ | 516 | /* BRIGHTNESS */ |
517 | 517 | ||
518 | int pwc_get_brightness(struct pwc_device *pdev) | 518 | int pwc_get_brightness(struct pwc_device *pdev) |
@@ -949,7 +949,7 @@ int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) | |||
949 | return SendControlMsg(SET_STATUS_CTL, LED_FORMATTER, 2); | 949 | return SendControlMsg(SET_STATUS_CTL, LED_FORMATTER, 2); |
950 | } | 950 | } |
951 | 951 | ||
952 | int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) | 952 | static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) |
953 | { | 953 | { |
954 | unsigned char buf[2]; | 954 | unsigned char buf[2]; |
955 | int ret; | 955 | int ret; |