Commit f7acc4bb authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[media] em28xx: Fix DVB-C maxsize for em2884

The logic at em28xx_isoc_dvb_max_packetsize() sucks, at least for newer
the needed packet size. Yet, it is better than nothing.

Rewrite the code in order to change the default to 752 for em2884 and
newer chips and provide a better way to handle per-chipset specifics.

For em2874, the current default should be enough, as the only em2874
board is currently a 1-seg ISDB-T board, so, it needs only a limited
amount of bandwidth.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent cf845297
...@@ -1113,17 +1113,19 @@ EXPORT_SYMBOL_GPL(em28xx_init_isoc); ...@@ -1113,17 +1113,19 @@ EXPORT_SYMBOL_GPL(em28xx_init_isoc);
int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev) int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev)
{ {
unsigned int chip_cfg2; unsigned int chip_cfg2;
unsigned int packet_size = 564; unsigned int packet_size;
if (dev->chip_id == CHIP_ID_EM2874 || dev->chip_id == CHIP_ID_EM2884) { switch (dev->chip_id) {
/* FIXME - for now assume 564 like it was before, but the case CHIP_ID_EM2710:
em2874 code should be added to return the proper value... */ case CHIP_ID_EM2750:
packet_size = 564; case CHIP_ID_EM2800:
} else if (dev->chip_id == CHIP_ID_EM28174) { case CHIP_ID_EM2820:
/* FIXME same as em2874. 564 was enough for 22 Mbit DVB-T case CHIP_ID_EM2840:
but too much for 44 Mbit DVB-C. */ case CHIP_ID_EM2860:
packet_size = 752; /* No DVB support */
} else { return -EINVAL;
case CHIP_ID_EM2870:
case CHIP_ID_EM2883:
/* TS max packet size stored in bits 1-0 of R01 */ /* TS max packet size stored in bits 1-0 of R01 */
chip_cfg2 = em28xx_read_reg(dev, EM28XX_R01_CHIPCFG2); chip_cfg2 = em28xx_read_reg(dev, EM28XX_R01_CHIPCFG2);
switch (chip_cfg2 & EM28XX_CHIPCFG2_TS_PACKETSIZE_MASK) { switch (chip_cfg2 & EM28XX_CHIPCFG2_TS_PACKETSIZE_MASK) {
...@@ -1140,9 +1142,24 @@ int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev) ...@@ -1140,9 +1142,24 @@ int em28xx_isoc_dvb_max_packetsize(struct em28xx *dev)
packet_size = 752; packet_size = 752;
break; break;
} }
break;
case CHIP_ID_EM2874:
/*
* FIXME: for now assumes 564 like it was before, but the
* em2874 code should be added to return the proper value
*/
packet_size = 564;
break;
case CHIP_ID_EM2884:
case CHIP_ID_EM28174:
default:
/*
* FIXME: same as em2874. 564 was enough for 22 Mbit DVB-T
* but not enough for 44 Mbit DVB-C.
*/
packet_size = 752;
} }
em28xx_coredbg("dvb max packet size=%d\n", packet_size);
return packet_size; return packet_size;
} }
EXPORT_SYMBOL_GPL(em28xx_isoc_dvb_max_packetsize); EXPORT_SYMBOL_GPL(em28xx_isoc_dvb_max_packetsize);
......
...@@ -167,6 +167,11 @@ static int start_streaming(struct em28xx_dvb *dvb) ...@@ -167,6 +167,11 @@ static int start_streaming(struct em28xx_dvb *dvb)
return rc; return rc;
max_dvb_packet_size = em28xx_isoc_dvb_max_packetsize(dev); max_dvb_packet_size = em28xx_isoc_dvb_max_packetsize(dev);
if (max_dvb_packet_size < 0)
return max_dvb_packet_size;
dprintk(1, "Using %d buffers each with %d bytes\n",
EM28XX_DVB_NUM_BUFS,
max_dvb_packet_size);
return em28xx_init_isoc(dev, EM28XX_DVB_MAX_PACKETS, return em28xx_init_isoc(dev, EM28XX_DVB_MAX_PACKETS,
EM28XX_DVB_NUM_BUFS, max_dvb_packet_size, EM28XX_DVB_NUM_BUFS, max_dvb_packet_size,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment