diff options
author | Dmitry Belimov <d.belimov@gmail.com> | 2008-08-26 12:44:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-10-12 07:36:55 -0400 |
commit | f03813e4d1900b619d4cb133506b130e535614f0 (patch) | |
tree | 3803072475bafcc341d82feb0ce257be29a566f0 /drivers/media | |
parent | 9d95af9d09d537d287eea9914c0d1ca4cfa0ec7f (diff) |
V4L/DVB (8795): saa7134-empress: insert leading null bytes for Beholder M6 empress cards
Additional code to improve the init sequence and add board type tests
were done by Hans Verkuil.
Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/saa7134/saa6752hs.c | 17 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 15 |
2 files changed, 23 insertions, 9 deletions
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 28499e591925..f40cb0b479b1 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c | |||
@@ -653,7 +653,7 @@ static int saa6752hs_qmenu(struct saa6752hs_state *h, | |||
653 | return v4l2_ctrl_query_menu(qmenu, &qctrl, NULL); | 653 | return v4l2_ctrl_query_menu(qmenu, &qctrl, NULL); |
654 | } | 654 | } |
655 | 655 | ||
656 | static int saa6752hs_init(struct i2c_client* client) | 656 | static int saa6752hs_init(struct i2c_client *client, u32 leading_null_bytes) |
657 | { | 657 | { |
658 | unsigned char buf[9], buf2[4]; | 658 | unsigned char buf[9], buf2[4]; |
659 | struct saa6752hs_state *h; | 659 | struct saa6752hs_state *h; |
@@ -705,6 +705,12 @@ static int saa6752hs_init(struct i2c_client* client) | |||
705 | buf[1] = 0x05; | 705 | buf[1] = 0x05; |
706 | i2c_master_send(client,buf,2); | 706 | i2c_master_send(client,buf,2); |
707 | 707 | ||
708 | /* Set leading null byte for TS */ | ||
709 | buf[0] = 0xF6; | ||
710 | buf[1] = (leading_null_bytes >> 8) & 0xff; | ||
711 | buf[2] = leading_null_bytes & 0xff; | ||
712 | i2c_master_send(client, buf, 3); | ||
713 | |||
708 | /* compute PAT */ | 714 | /* compute PAT */ |
709 | memcpy(localPAT, PAT, sizeof(PAT)); | 715 | memcpy(localPAT, PAT, sizeof(PAT)); |
710 | localPAT[17] = 0xe0 | ((h->params.ts_pid_pmt >> 8) & 0x0f); | 716 | localPAT[17] = 0xe0 | ((h->params.ts_pid_pmt >> 8) & 0x0f); |
@@ -812,14 +818,13 @@ saa6752hs_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
812 | int i; | 818 | int i; |
813 | 819 | ||
814 | switch (cmd) { | 820 | switch (cmd) { |
821 | case VIDIOC_INT_INIT: | ||
822 | /* apply settings and start encoder */ | ||
823 | saa6752hs_init(client, *(u32 *)arg); | ||
824 | break; | ||
815 | case VIDIOC_S_EXT_CTRLS: | 825 | case VIDIOC_S_EXT_CTRLS: |
816 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) | 826 | if (ctrls->ctrl_class != V4L2_CTRL_CLASS_MPEG) |
817 | return -EINVAL; | 827 | return -EINVAL; |
818 | if (ctrls->count == 0) { | ||
819 | /* apply settings and start encoder */ | ||
820 | saa6752hs_init(client); | ||
821 | break; | ||
822 | } | ||
823 | /* fall through */ | 828 | /* fall through */ |
824 | case VIDIOC_TRY_EXT_CTRLS: | 829 | case VIDIOC_TRY_EXT_CTRLS: |
825 | case VIDIOC_G_EXT_CTRLS: | 830 | case VIDIOC_G_EXT_CTRLS: |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index f5a186a13db2..946edf64dc28 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -64,10 +64,19 @@ static void ts_reset_encoder(struct saa7134_dev* dev) | |||
64 | 64 | ||
65 | static int ts_init_encoder(struct saa7134_dev* dev) | 65 | static int ts_init_encoder(struct saa7134_dev* dev) |
66 | { | 66 | { |
67 | struct v4l2_ext_controls ctrls = { V4L2_CTRL_CLASS_MPEG, 0 }; | 67 | u32 leading_null_bytes = 0; |
68 | 68 | ||
69 | /* If more cards start to need this, then this | ||
70 | should probably be added to the card definitions. */ | ||
71 | switch (dev->board) { | ||
72 | case SAA7134_BOARD_BEHOLD_M6: | ||
73 | case SAA7134_BOARD_BEHOLD_M63: | ||
74 | case SAA7134_BOARD_BEHOLD_M6_EXTRA: | ||
75 | leading_null_bytes = 1; | ||
76 | break; | ||
77 | } | ||
69 | ts_reset_encoder(dev); | 78 | ts_reset_encoder(dev); |
70 | saa7134_i2c_call_clients(dev, VIDIOC_S_EXT_CTRLS, &ctrls); | 79 | saa7134_i2c_call_clients(dev, VIDIOC_INT_INIT, &leading_null_bytes); |
71 | dev->empress_started = 1; | 80 | dev->empress_started = 1; |
72 | return 0; | 81 | return 0; |
73 | } | 82 | } |