From c8c39796c484fc6f4e45d8d71f3cf55e9ab27e6c Mon Sep 17 00:00:00 2001 From: Frank Schaefer Date: Tue, 26 Mar 2013 13:38:39 -0300 Subject: [PATCH] [media] em28xx: make em28xx_set_outfmt() working with EM25xx family bridges MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Streaming doesn't work with the EM2765 if bit 5 of the output format register 0x27 is set. It's actually not clear if really has to be set for the other chips, but for now let's keep it to avoid regressions and add a comment to the code. Signed-off-by: Frank Schäfer Signed-off-by: Mauro Carvalho Chehab --- drivers/media/usb/em28xx/em28xx-core.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c index b2dcb3d1342d..575a46a18e1f 100644 --- a/drivers/media/usb/em28xx/em28xx-core.c +++ b/drivers/media/usb/em28xx/em28xx-core.c @@ -697,12 +697,23 @@ int em28xx_vbi_supported(struct em28xx *dev) int em28xx_set_outfmt(struct em28xx *dev) { int ret; - u8 vinctrl; - - ret = em28xx_write_reg_bits(dev, EM28XX_R27_OUTFMT, - dev->format->reg | 0x20, 0xff); + u8 fmt, vinctrl; + + fmt = dev->format->reg; + if (!dev->is_em25xx) + fmt |= 0x20; + /* + * NOTE: it's not clear if this is really needed ! + * The datasheets say bit 5 is a reserved bit and devices seem to work + * fine without it. But the Windows driver sets it for em2710/50+em28xx + * devices and we've always been setting it, too. + * + * em2765 (em25xx, em276x/7x/8x) devices do NOT work with this bit set, + * it's likely used for an additional (compressed ?) format there. + */ + ret = em28xx_write_reg(dev, EM28XX_R27_OUTFMT, fmt); if (ret < 0) - return ret; + return ret; ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, dev->vinmode); if (ret < 0) -- 2.30.2