aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/em28xx/em28xx-core.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2009-05-16 16:09:28 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:21:08 -0400
commitd18e2fda7133287bf8a81809816e646cf17c332e (patch)
treed42b038af4ed02b31add846f6731dfabb5d78123 /drivers/media/video/em28xx/em28xx-core.c
parent027aa2c771d9fb8dc6aae95c80b50e40e3c97dc5 (diff)
V4L/DVB (11810): em28xx: properly set packet size based on the device's eeprom configuration.
The em28xx actually has a register that tells the driver what the maximum packet size is (based on a value programmed into the eeprom). Make use of that register instead of assuming a hardcoded value of 564 (since 564 is not correct for devices that do QAM such as the KWorld 340u). Note that for now the em2874 code isn't there, falling back to the 564 value, however this is not a problem since there are not any em2874 based devices in the current v4l-dvb tree). Thanks to Jarod Wilson for detecting the initial problem and figuring out that the isoc configuration was wrong for his device. Cc: Jarod Wilson <jarod@wilsonet.com> Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-core.c')
-rw-r--r--drivers/media/video/em28xx/em28xx-core.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c
index 7375353c04eb..b7a2fedc3904 100644
--- a/drivers/media/video/em28xx/em28xx-core.c
+++ b/drivers/media/video/em28xx/em28xx-core.c
@@ -1012,6 +1012,41 @@ int em28xx_init_isoc(struct em28xx *dev, int max_packets,
1012} 1012}
1013EXPORT_SYMBOL_GPL(em28xx_init_isoc); 1013EXPORT_SYMBOL_GPL(em28xx_init_isoc);
1014 1014
1015/* Determine the packet size for the DVB stream for the given device
1016 (underlying value programmed into the eeprom) */
1017int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev)
1018{
1019 unsigned int chip_cfg2;
1020 unsigned int packet_size = 564;
1021
1022 if (dev->chip_id == CHIP_ID_EM2874) {
1023 /* FIXME - for now assume 564 like it was before, but the
1024 em2874 code should be added to return the proper value... */
1025 packet_size = 564;
1026 } else {
1027 /* TS max packet size stored in bits 1-0 of R01 */
1028 chip_cfg2 = em28xx_read_reg(dev, EM28XX_R01_CHIPCFG2);
1029 switch (chip_cfg2 & EM28XX_CHIPCFG2_TS_PACKETSIZE_MASK) {
1030 case EM28XX_CHIPCFG2_TS_PACKETSIZE_188:
1031 packet_size = 188;
1032 break;
1033 case EM28XX_CHIPCFG2_TS_PACKETSIZE_376:
1034 packet_size = 376;
1035 break;
1036 case EM28XX_CHIPCFG2_TS_PACKETSIZE_564:
1037 packet_size = 564;
1038 break;
1039 case EM28XX_CHIPCFG2_TS_PACKETSIZE_752:
1040 packet_size = 752;
1041 break;
1042 }
1043 }
1044
1045 em28xx_coredbg("dvb max packet size=%d\n", packet_size);
1046 return packet_size;
1047}
1048EXPORT_SYMBOL_GPL(em28xx_isoc_dvb_max_packetsize);
1049
1015/* 1050/*
1016 * em28xx_wake_i2c() 1051 * em28xx_wake_i2c()
1017 * configure i2c attached devices 1052 * configure i2c attached devices