aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2009-07-14 11:33:25 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-07-24 13:03:26 -0400
commit579d315218e8a3f696e375c5f6917da6488bec8a (patch)
treec72d128308c801311cdf79638cbfbe453824411a /drivers/media
parentd36bb4e77257ed0df86deca3f69794f037f68c7d (diff)
V4L/DVB (12244): em28xx: adjust vinmode/vinctl based on the stream input format
Depending on the video input format, vinmode/vinctl needs adjustments. For TV, this is not relevant, since the supported decoders output data at the same format. However, webcam sensors may have different formats, so, this needs to be adjusted based on the device. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/em28xx/em28xx-cards.c11
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c17
-rw-r--r--drivers/media/video/em28xx/em28xx.h3
3 files changed, 17 insertions, 14 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c
index 82536dd6b0fd..e793aee16726 100644
--- a/drivers/media/video/em28xx/em28xx-cards.c
+++ b/drivers/media/video/em28xx/em28xx-cards.c
@@ -1735,6 +1735,11 @@ static int em28xx_hint_sensor(struct em28xx *dev)
1735 dev->sensor_xres = 640; 1735 dev->sensor_xres = 640;
1736 dev->sensor_yres = 480; 1736 dev->sensor_yres = 480;
1737 dev->sensor_xtal = 6300000; 1737 dev->sensor_xtal = 6300000;
1738
1739 /* probably means GRGB 16 bit bayer */
1740 dev->vinmode = 0x0d;
1741 dev->vinctl = 0x00;
1742
1738 break; 1743 break;
1739 default: 1744 default:
1740 printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version)); 1745 printk("Unknown Micron Sensor 0x%04x\n", be16_to_cpu(version));
@@ -2415,6 +2420,12 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev,
2415 } 2420 }
2416 2421
2417 /* 2422 /*
2423 * Default format, used for tvp5150 or saa711x output formats
2424 */
2425 dev->vinmode = 0x10;
2426 dev->vinctl = 0x11;
2427
2428 /*
2418 * If the device can be a webcam, seek for a sensor. 2429 * If the device can be a webcam, seek for a sensor.
2419 * If sensor is not found, then it isn't a webcam. 2430 * If sensor is not found, then it isn't a webcam.
2420 */ 2431 */
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index c7fcce713945..5b78e199abd1 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -648,28 +648,17 @@ int em28xx_capture_start(struct em28xx *dev, int start)
648int em28xx_set_outfmt(struct em28xx *dev) 648int em28xx_set_outfmt(struct em28xx *dev)
649{ 649{
650 int ret; 650 int ret;
651 int vinmode, vinctl, outfmt;
652
653 outfmt = dev->format->reg;
654
655 if (dev->board.is_webcam) {
656 vinmode = 0x0d;
657 vinctl = 0x00;
658 } else {
659 vinmode = 0x10;
660 vinctl = 0x11;
661 }
662 651
663 ret = em28xx_write_reg_bits(dev, EM28XX_R27_OUTFMT, 652 ret = em28xx_write_reg_bits(dev, EM28XX_R27_OUTFMT,
664 outfmt | 0x20, 0xff); 653 dev->format->reg | 0x20, 0xff);
665 if (ret < 0) 654 if (ret < 0)
666 return ret; 655 return ret;
667 656
668 ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, vinmode); 657 ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, dev->vinmode);
669 if (ret < 0) 658 if (ret < 0)
670 return ret; 659 return ret;
671 660
672 return em28xx_write_reg(dev, EM28XX_R11_VINCTRL, vinctl); 661 return em28xx_write_reg(dev, EM28XX_R11_VINCTRL, dev->vinctl);
673} 662}
674 663
675static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, 664static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h
index ce76633786c8..766ab59b8d59 100644
--- a/drivers/media/video/em28xx/em28xx.h
+++ b/drivers/media/video/em28xx/em28xx.h
@@ -483,6 +483,9 @@ struct em28xx {
483 int sensor_xres, sensor_yres; 483 int sensor_xres, sensor_yres;
484 int sensor_xtal; 484 int sensor_xtal;
485 485
486 /* Vinmode/Vinctl used at the driver */
487 int vinmode, vinctl;
488
486 unsigned int stream_on:1; /* Locks streams */ 489 unsigned int stream_on:1; /* Locks streams */
487 unsigned int has_audio_class:1; 490 unsigned int has_audio_class:1;
488 unsigned int has_alsa_audio:1; 491 unsigned int has_alsa_audio:1;