aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/usb/em28xx/em28xx-core.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 80f87bbbd554..ee00f9e23420 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -733,22 +733,24 @@ static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
733 return em28xx_write_regs(dev, EM28XX_R2B_YMAX, &ymax, 1); 733 return em28xx_write_regs(dev, EM28XX_R2B_YMAX, &ymax, 1);
734} 734}
735 735
736static int em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, 736static void em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
737 u16 width, u16 height) 737 u16 width, u16 height)
738{ 738{
739 u8 cwidth = width; 739 u8 cwidth = width >> 2;
740 u8 cheight = height; 740 u8 cheight = height >> 2;
741 u8 overflow = (height >> 7 & 0x02) | (width >> 8 & 0x01); 741 u8 overflow = (height >> 9 & 0x02) | (width >> 10 & 0x01);
742 /* NOTE: size limit: 2047x1023 = 2MPix */
742 743
743 em28xx_coredbg("em28xx Area Set: (%d,%d)\n", 744 em28xx_coredbg("capture area set to (%d,%d): %dx%d\n",
744 (width | (overflow & 2) << 7), 745 hstart, vstart,
745 (height | (overflow & 1) << 8)); 746 ((overflow & 2) << 9 | cwidth << 2),
747 ((overflow & 1) << 10 | cheight << 2));
746 748
747 em28xx_write_regs(dev, EM28XX_R1C_HSTART, &hstart, 1); 749 em28xx_write_regs(dev, EM28XX_R1C_HSTART, &hstart, 1);
748 em28xx_write_regs(dev, EM28XX_R1D_VSTART, &vstart, 1); 750 em28xx_write_regs(dev, EM28XX_R1D_VSTART, &vstart, 1);
749 em28xx_write_regs(dev, EM28XX_R1E_CWIDTH, &cwidth, 1); 751 em28xx_write_regs(dev, EM28XX_R1E_CWIDTH, &cwidth, 1);
750 em28xx_write_regs(dev, EM28XX_R1F_CHEIGHT, &cheight, 1); 752 em28xx_write_regs(dev, EM28XX_R1F_CHEIGHT, &cheight, 1);
751 return em28xx_write_regs(dev, EM28XX_R1B_OFLOW, &overflow, 1); 753 em28xx_write_regs(dev, EM28XX_R1B_OFLOW, &overflow, 1);
752} 754}
753 755
754static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) 756static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v)
@@ -801,9 +803,9 @@ int em28xx_resolution_set(struct em28xx *dev)
801 it out, we end up with the same format as the rest of the VBI 803 it out, we end up with the same format as the rest of the VBI
802 region */ 804 region */
803 if (em28xx_vbi_supported(dev) == 1) 805 if (em28xx_vbi_supported(dev) == 1)
804 em28xx_capture_area_set(dev, 0, 2, width >> 2, height >> 2); 806 em28xx_capture_area_set(dev, 0, 2, width, height);
805 else 807 else
806 em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); 808 em28xx_capture_area_set(dev, 0, 0, width, height);
807 809
808 return em28xx_scaler_set(dev, dev->hscale, dev->vscale); 810 return em28xx_scaler_set(dev, dev->hscale, dev->vscale);
809} 811}