aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2007-07-25 11:55:52 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 21:03:23 -0400
commit6e5eb59102aa6007d3ea2b382a1d3ca4112c272a (patch)
tree17b18f6d9851fac32dc3e49dd6cd0da6147abcc8 /drivers/media/video/ivtv
parentc976bc82339437e840f7dbf0b8c89c09d3fcd75e (diff)
V4L/DVB (5924): ivtv-fb: initializing the fb should trigger ivtv firmware load
ivtv-fb: initializing the framebuffer should trigger ivtv firmware load Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r--drivers/media/video/ivtv/ivtv-driver.c12
-rw-r--r--drivers/media/video/ivtv/ivtv-fb.c5
-rw-r--r--drivers/media/video/ivtv/ivtv-fileops.c10
3 files changed, 18 insertions, 9 deletions
diff --git a/drivers/media/video/ivtv/ivtv-driver.c b/drivers/media/video/ivtv/ivtv-driver.c
index 00bdcc2e8f53..55ed0305fd64 100644
--- a/drivers/media/video/ivtv/ivtv-driver.c
+++ b/drivers/media/video/ivtv/ivtv-driver.c
@@ -1189,6 +1189,12 @@ int ivtv_init_on_first_open(struct ivtv *itv)
1189 int fw_retry_count = 3; 1189 int fw_retry_count = 3;
1190 int video_input; 1190 int video_input;
1191 1191
1192 if (test_bit(IVTV_F_I_FAILED, &itv->i_flags))
1193 return -ENXIO;
1194
1195 if (test_and_set_bit(IVTV_F_I_INITED, &itv->i_flags))
1196 return 0;
1197
1192 while (--fw_retry_count > 0) { 1198 while (--fw_retry_count > 0) {
1193 /* load firmware */ 1199 /* load firmware */
1194 if (ivtv_firmware_init(itv) == 0) 1200 if (ivtv_firmware_init(itv) == 0)
@@ -1196,9 +1202,10 @@ int ivtv_init_on_first_open(struct ivtv *itv)
1196 if (fw_retry_count > 1) 1202 if (fw_retry_count > 1)
1197 IVTV_WARN("Retry loading firmware\n"); 1203 IVTV_WARN("Retry loading firmware\n");
1198 } 1204 }
1205
1199 if (fw_retry_count == 0) { 1206 if (fw_retry_count == 0) {
1200 IVTV_ERR("Error initializing firmware\n"); 1207 set_bit(IVTV_F_I_FAILED, &itv->i_flags);
1201 return -1; 1208 return -ENXIO;
1202 } 1209 }
1203 1210
1204 /* Try and get firmware versions */ 1211 /* Try and get firmware versions */
@@ -1381,6 +1388,7 @@ EXPORT_SYMBOL(ivtv_udma_setup);
1381EXPORT_SYMBOL(ivtv_udma_unmap); 1388EXPORT_SYMBOL(ivtv_udma_unmap);
1382EXPORT_SYMBOL(ivtv_udma_alloc); 1389EXPORT_SYMBOL(ivtv_udma_alloc);
1383EXPORT_SYMBOL(ivtv_udma_prepare); 1390EXPORT_SYMBOL(ivtv_udma_prepare);
1391EXPORT_SYMBOL(ivtv_init_on_first_open);
1384 1392
1385module_init(module_start); 1393module_init(module_start);
1386module_exit(module_cleanup); 1394module_exit(module_cleanup);
diff --git a/drivers/media/video/ivtv/ivtv-fb.c b/drivers/media/video/ivtv/ivtv-fb.c
index b8ad249a0b17..00765da8a6a0 100644
--- a/drivers/media/video/ivtv/ivtv-fb.c
+++ b/drivers/media/video/ivtv/ivtv-fb.c
@@ -1013,6 +1013,11 @@ static int ivtvfb_init_io(struct ivtv *itv)
1013{ 1013{
1014 struct osd_info *oi = itv->osd_info; 1014 struct osd_info *oi = itv->osd_info;
1015 1015
1016 if (ivtv_init_on_first_open(itv)) {
1017 IVTV_FB_ERR("Failed to initialize ivtv\n");
1018 return -ENXIO;
1019 }
1020
1016 ivtv_fb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size); 1021 ivtv_fb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size);
1017 1022
1018 /* The osd buffer size depends on the number of video buffers allocated 1023 /* The osd buffer size depends on the number of video buffers allocated
diff --git a/drivers/media/video/ivtv/ivtv-fileops.c b/drivers/media/video/ivtv/ivtv-fileops.c
index 498860841644..fedddecf661e 100644
--- a/drivers/media/video/ivtv/ivtv-fileops.c
+++ b/drivers/media/video/ivtv/ivtv-fileops.c
@@ -846,16 +846,12 @@ int ivtv_v4l2_open(struct inode *inode, struct file *filp)
846 if (itv == NULL) { 846 if (itv == NULL) {
847 /* Couldn't find a device registered 847 /* Couldn't find a device registered
848 on that minor, shouldn't happen! */ 848 on that minor, shouldn't happen! */
849 printk(KERN_WARNING "ivtv: No ivtv device found on minor %d\n", minor); 849 IVTV_WARN("No ivtv device found on minor %d\n", minor);
850 return -ENXIO; 850 return -ENXIO;
851 } 851 }
852 852
853 if (!test_and_set_bit(IVTV_F_I_INITED, &itv->i_flags)) 853 if (ivtv_init_on_first_open(itv)) {
854 if (ivtv_init_on_first_open(itv)) 854 IVTV_ERR("Failed to initialize on minor %d\n", minor);
855 set_bit(IVTV_F_I_FAILED, &itv->i_flags);
856
857 if (test_bit(IVTV_F_I_FAILED, &itv->i_flags)) {
858 printk(KERN_WARNING "ivtv: failed to initialize on minor %d\n", minor);
859 return -ENXIO; 855 return -ENXIO;
860 } 856 }
861 857