aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/zoran
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2009-03-08 16:04:38 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-03-30 11:43:21 -0400
commit1cd3c0fa927084549005fc22e54d99684b314f14 (patch)
treeffec4f2829239216640983e0102f4638493a1140 /drivers/media/video/zoran
parent98ec633972a70cf71d71bc8762804f0af4792d08 (diff)
V4L/DVB (11022): zoran/bt819: use new notify functionality.
Bt819 needs the parent driver to drive a GPIO pin low and high in order to reset its fifo. Use the new notify callback for this. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/zoran')
-rw-r--r--drivers/media/video/zoran/zoran_card.c20
-rw-r--r--drivers/media/video/zoran/zoran_device.c36
-rw-r--r--drivers/media/video/zoran/zoran_device.h3
-rw-r--r--drivers/media/video/zoran/zoran_driver.c12
4 files changed, 25 insertions, 46 deletions
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c
index b5d228d91b06..ec9b6ef56090 100644
--- a/drivers/media/video/zoran/zoran_card.c
+++ b/drivers/media/video/zoran/zoran_card.c
@@ -39,7 +39,6 @@
39#include <linux/i2c.h> 39#include <linux/i2c.h>
40#include <linux/i2c-algo-bit.h> 40#include <linux/i2c-algo-bit.h>
41#include <linux/videodev2.h> 41#include <linux/videodev2.h>
42#include <media/v4l2-common.h>
43#include <linux/spinlock.h> 42#include <linux/spinlock.h>
44#include <linux/sem.h> 43#include <linux/sem.h>
45#include <linux/kmod.h> 44#include <linux/kmod.h>
@@ -48,8 +47,9 @@
48#include <linux/pci.h> 47#include <linux/pci.h>
49#include <linux/interrupt.h> 48#include <linux/interrupt.h>
50#include <linux/mutex.h> 49#include <linux/mutex.h>
51 50#include <linux/io.h>
52#include <asm/io.h> 51#include <media/v4l2-common.h>
52#include <media/bt819.h>
53 53
54#include "videocodec.h" 54#include "videocodec.h"
55#include "zoran.h" 55#include "zoran.h"
@@ -1196,6 +1196,19 @@ zoran_setup_videocodec (struct zoran *zr,
1196 return m; 1196 return m;
1197} 1197}
1198 1198
1199static int zoran_subdev_notify(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
1200{
1201 struct zoran *zr = to_zoran(sd->v4l2_dev);
1202
1203 /* Bt819 needs to reset its FIFO buffer using #FRST pin and
1204 LML33 card uses GPIO(7) for that. */
1205 if (cmd == BT819_FIFO_RESET_LOW)
1206 GPIO(zr, 7, 0);
1207 else if (cmd == BT819_FIFO_RESET_HIGH)
1208 GPIO(zr, 7, 1);
1209 return 0;
1210}
1211
1199/* 1212/*
1200 * Scan for a Buz card (actually for the PCI controller ZR36057), 1213 * Scan for a Buz card (actually for the PCI controller ZR36057),
1201 * request the irq and map the io memory 1214 * request the irq and map the io memory
@@ -1226,6 +1239,7 @@ static int __devinit zoran_probe(struct pci_dev *pdev,
1226 ZORAN_NAME, __func__); 1239 ZORAN_NAME, __func__);
1227 return -ENOMEM; 1240 return -ENOMEM;
1228 } 1241 }
1242 zr->v4l2_dev.notify = zoran_subdev_notify;
1229 if (v4l2_device_register(&pdev->dev, &zr->v4l2_dev)) 1243 if (v4l2_device_register(&pdev->dev, &zr->v4l2_dev))
1230 goto zr_free_mem; 1244 goto zr_free_mem;
1231 zr->pci_dev = pdev; 1245 zr->pci_dev = pdev;
diff --git a/drivers/media/video/zoran/zoran_device.c b/drivers/media/video/zoran/zoran_device.c
index f8bcd1a248c2..e0223deed35e 100644
--- a/drivers/media/video/zoran/zoran_device.c
+++ b/drivers/media/video/zoran/zoran_device.c
@@ -1584,8 +1584,8 @@ zoran_init_hardware (struct zoran *zr)
1584 route.input = zr->card.input[zr->input].muxsel; 1584 route.input = zr->card.input[zr->input].muxsel;
1585 1585
1586 decoder_call(zr, core, init, 0); 1586 decoder_call(zr, core, init, 0);
1587 decoder_s_std(zr, zr->norm); 1587 decoder_call(zr, tuner, s_std, zr->norm);
1588 decoder_s_routing(zr, &route); 1588 decoder_call(zr, video, s_routing, &route);
1589 1589
1590 encoder_call(zr, core, init, 0); 1590 encoder_call(zr, core, init, 0);
1591 encoder_call(zr, video, s_std_output, zr->norm); 1591 encoder_call(zr, video, s_std_output, zr->norm);
@@ -1650,35 +1650,3 @@ zr36057_init_vfe (struct zoran *zr)
1650 reg |= ZR36057_VDCR_Triton; 1650 reg |= ZR36057_VDCR_Triton;
1651 btwrite(reg, ZR36057_VDCR); 1651 btwrite(reg, ZR36057_VDCR);
1652} 1652}
1653
1654/*
1655 * Interface to decoder and encoder chips using i2c bus
1656 */
1657
1658int decoder_s_std(struct zoran *zr, v4l2_std_id std)
1659{
1660 int res;
1661
1662 /* Bt819 needs to reset its FIFO buffer using #FRST pin and
1663 LML33 card uses GPIO(7) for that. */
1664 if (zr->card.type == LML33)
1665 GPIO(zr, 7, 0);
1666 res = decoder_call(zr, tuner, s_std, std);
1667 if (zr->card.type == LML33)
1668 GPIO(zr, 7, 1); /* Pull #FRST high. */
1669 return res;
1670}
1671
1672int decoder_s_routing(struct zoran *zr, struct v4l2_routing *route)
1673{
1674 int res;
1675
1676 /* Bt819 needs to reset its FIFO buffer using #FRST pin and
1677 LML33 card uses GPIO(7) for that. */
1678 if (zr->card.type == LML33)
1679 GPIO(zr, 7, 0);
1680 res = decoder_call(zr, video, s_routing, route);
1681 if (zr->card.type == LML33)
1682 GPIO(zr, 7, 1); /* Pull #FRST high. */
1683 return res;
1684}
diff --git a/drivers/media/video/zoran/zoran_device.h b/drivers/media/video/zoran/zoran_device.h
index 85414e17524e..07f2c23ff740 100644
--- a/drivers/media/video/zoran/zoran_device.h
+++ b/drivers/media/video/zoran/zoran_device.h
@@ -92,7 +92,4 @@ extern int pass_through;
92#define encoder_call(zr, o, f, args...) \ 92#define encoder_call(zr, o, f, args...) \
93 v4l2_subdev_call(zr->encoder, o, f, ##args) 93 v4l2_subdev_call(zr->encoder, o, f, ##args)
94 94
95int decoder_s_std(struct zoran *zr, v4l2_std_id std);
96int decoder_s_routing(struct zoran *zr, struct v4l2_routing *route);
97
98#endif /* __ZORAN_DEVICE_H__ */ 95#endif /* __ZORAN_DEVICE_H__ */
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c
index 60501f256b28..1e87fb9f7146 100644
--- a/drivers/media/video/zoran/zoran_driver.c
+++ b/drivers/media/video/zoran/zoran_driver.c
@@ -1449,7 +1449,7 @@ zoran_set_norm (struct zoran *zr,
1449 v4l2_std_id std = 0; 1449 v4l2_std_id std = 0;
1450 1450
1451 decoder_call(zr, video, querystd, &std); 1451 decoder_call(zr, video, querystd, &std);
1452 decoder_s_std(zr, std); 1452 decoder_call(zr, tuner, s_std, std);
1453 1453
1454 /* let changes come into effect */ 1454 /* let changes come into effect */
1455 ssleep(2); 1455 ssleep(2);
@@ -1461,7 +1461,7 @@ zoran_set_norm (struct zoran *zr,
1461 "%s: %s - no norm detected\n", 1461 "%s: %s - no norm detected\n",
1462 ZR_DEVNAME(zr), __func__); 1462 ZR_DEVNAME(zr), __func__);
1463 /* reset norm */ 1463 /* reset norm */
1464 decoder_s_std(zr, zr->norm); 1464 decoder_call(zr, tuner, s_std, zr->norm);
1465 return -EIO; 1465 return -EIO;
1466 } 1466 }
1467 1467
@@ -1480,7 +1480,7 @@ zoran_set_norm (struct zoran *zr,
1480 if (on) 1480 if (on)
1481 zr36057_overlay(zr, 0); 1481 zr36057_overlay(zr, 0);
1482 1482
1483 decoder_s_std(zr, norm); 1483 decoder_call(zr, tuner, s_std, norm);
1484 encoder_call(zr, video, s_std_output, norm); 1484 encoder_call(zr, video, s_std_output, norm);
1485 1485
1486 if (on) 1486 if (on)
@@ -1522,7 +1522,7 @@ zoran_set_input (struct zoran *zr,
1522 route.input = zr->card.input[input].muxsel; 1522 route.input = zr->card.input[input].muxsel;
1523 zr->input = input; 1523 zr->input = input;
1524 1524
1525 decoder_s_routing(zr, &route); 1525 decoder_call(zr, video, s_routing, &route);
1526 1526
1527 return 0; 1527 return 0;
1528} 1528}
@@ -1775,7 +1775,7 @@ jpgreqbuf_unlock_and_return:
1775 goto gstat_unlock_and_return; 1775 goto gstat_unlock_and_return;
1776 } 1776 }
1777 1777
1778 decoder_s_routing(zr, &route); 1778 decoder_call(zr, video, s_routing, &route);
1779 1779
1780 /* sleep 1 second */ 1780 /* sleep 1 second */
1781 ssleep(1); 1781 ssleep(1);
@@ -1786,7 +1786,7 @@ jpgreqbuf_unlock_and_return:
1786 1786
1787 /* restore previous input and norm */ 1787 /* restore previous input and norm */
1788 route.input = zr->card.input[zr->input].muxsel; 1788 route.input = zr->card.input[zr->input].muxsel;
1789 decoder_s_routing(zr, &route); 1789 decoder_call(zr, video, s_routing, &route);
1790gstat_unlock_and_return: 1790gstat_unlock_and_return:
1791 mutex_unlock(&zr->resource_lock); 1791 mutex_unlock(&zr->resource_lock);
1792 1792