diff options
-rw-r--r-- | drivers/media/video/bt819.c | 14 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_card.c | 20 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_device.c | 36 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_device.h | 3 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 12 | ||||
-rw-r--r-- | include/media/bt819.h | 33 |
6 files changed, 71 insertions, 47 deletions
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index e0d8e2b186d1..217294d56414 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -32,13 +32,14 @@ | |||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/ioctl.h> | 33 | #include <linux/ioctl.h> |
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <asm/uaccess.h> | 35 | #include <linux/uaccess.h> |
36 | #include <linux/i2c.h> | 36 | #include <linux/i2c.h> |
37 | #include <linux/i2c-id.h> | 37 | #include <linux/i2c-id.h> |
38 | #include <linux/videodev2.h> | 38 | #include <linux/videodev2.h> |
39 | #include <media/v4l2-device.h> | 39 | #include <media/v4l2-device.h> |
40 | #include <media/v4l2-chip-ident.h> | 40 | #include <media/v4l2-chip-ident.h> |
41 | #include <media/v4l2-i2c-drv.h> | 41 | #include <media/v4l2-i2c-drv.h> |
42 | #include <media/bt819.h> | ||
42 | 43 | ||
43 | MODULE_DESCRIPTION("Brooktree-819 video decoder driver"); | 44 | MODULE_DESCRIPTION("Brooktree-819 video decoder driver"); |
44 | MODULE_AUTHOR("Mike Bernson & Dave Perks"); | 45 | MODULE_AUTHOR("Mike Bernson & Dave Perks"); |
@@ -250,7 +251,11 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std) | |||
250 | 251 | ||
251 | v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std); | 252 | v4l2_dbg(1, debug, sd, "set norm %llx\n", (unsigned long long)std); |
252 | 253 | ||
254 | if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL) | ||
255 | v4l2_err(sd, "no notify found!\n"); | ||
256 | |||
253 | if (std & V4L2_STD_NTSC) { | 257 | if (std & V4L2_STD_NTSC) { |
258 | v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0); | ||
254 | bt819_setbit(decoder, 0x01, 0, 1); | 259 | bt819_setbit(decoder, 0x01, 0, 1); |
255 | bt819_setbit(decoder, 0x01, 1, 0); | 260 | bt819_setbit(decoder, 0x01, 1, 0); |
256 | bt819_setbit(decoder, 0x01, 5, 0); | 261 | bt819_setbit(decoder, 0x01, 5, 0); |
@@ -259,6 +264,7 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std) | |||
259 | /* bt819_setbit(decoder, 0x1a, 5, 1); */ | 264 | /* bt819_setbit(decoder, 0x1a, 5, 1); */ |
260 | timing = &timing_data[1]; | 265 | timing = &timing_data[1]; |
261 | } else if (std & V4L2_STD_PAL) { | 266 | } else if (std & V4L2_STD_PAL) { |
267 | v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0); | ||
262 | bt819_setbit(decoder, 0x01, 0, 1); | 268 | bt819_setbit(decoder, 0x01, 0, 1); |
263 | bt819_setbit(decoder, 0x01, 1, 1); | 269 | bt819_setbit(decoder, 0x01, 1, 1); |
264 | bt819_setbit(decoder, 0x01, 5, 1); | 270 | bt819_setbit(decoder, 0x01, 5, 1); |
@@ -283,6 +289,7 @@ static int bt819_s_std(struct v4l2_subdev *sd, v4l2_std_id std) | |||
283 | bt819_write(decoder, 0x08, (timing->hscale >> 8) & 0xff); | 289 | bt819_write(decoder, 0x08, (timing->hscale >> 8) & 0xff); |
284 | bt819_write(decoder, 0x09, timing->hscale & 0xff); | 290 | bt819_write(decoder, 0x09, timing->hscale & 0xff); |
285 | decoder->norm = std; | 291 | decoder->norm = std; |
292 | v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, 0); | ||
286 | return 0; | 293 | return 0; |
287 | } | 294 | } |
288 | 295 | ||
@@ -295,7 +302,11 @@ static int bt819_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro | |||
295 | if (route->input < 0 || route->input > 7) | 302 | if (route->input < 0 || route->input > 7) |
296 | return -EINVAL; | 303 | return -EINVAL; |
297 | 304 | ||
305 | if (sd->v4l2_dev == NULL || sd->v4l2_dev->notify == NULL) | ||
306 | v4l2_err(sd, "no notify found!\n"); | ||
307 | |||
298 | if (decoder->input != route->input) { | 308 | if (decoder->input != route->input) { |
309 | v4l2_subdev_notify(sd, BT819_FIFO_RESET_LOW, 0); | ||
299 | decoder->input = route->input; | 310 | decoder->input = route->input; |
300 | /* select mode */ | 311 | /* select mode */ |
301 | if (decoder->input == 0) { | 312 | if (decoder->input == 0) { |
@@ -305,6 +316,7 @@ static int bt819_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *ro | |||
305 | bt819_setbit(decoder, 0x0b, 6, 1); | 316 | bt819_setbit(decoder, 0x0b, 6, 1); |
306 | bt819_setbit(decoder, 0x1a, 1, 0); | 317 | bt819_setbit(decoder, 0x1a, 1, 0); |
307 | } | 318 | } |
319 | v4l2_subdev_notify(sd, BT819_FIFO_RESET_HIGH, 0); | ||
308 | } | 320 | } |
309 | return 0; | 321 | return 0; |
310 | } | 322 | } |
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 | ||
1199 | static 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 | |||
1658 | int 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 | |||
1672 | int 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 | ||
95 | int decoder_s_std(struct zoran *zr, v4l2_std_id std); | ||
96 | int 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); |
1790 | gstat_unlock_and_return: | 1790 | gstat_unlock_and_return: |
1791 | mutex_unlock(&zr->resource_lock); | 1791 | mutex_unlock(&zr->resource_lock); |
1792 | 1792 | ||
diff --git a/include/media/bt819.h b/include/media/bt819.h new file mode 100644 index 000000000000..38f666bde77a --- /dev/null +++ b/include/media/bt819.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /* | ||
2 | bt819.h - bt819 notifications | ||
3 | |||
4 | Copyright (C) 2009 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _BT819_H_ | ||
22 | #define _BT819_H_ | ||
23 | |||
24 | #include <linux/ioctl.h> | ||
25 | |||
26 | /* v4l2_device notifications. */ | ||
27 | |||
28 | /* Needed to reset the FIFO buffer when changing the input | ||
29 | or the video standard. */ | ||
30 | #define BT819_FIFO_RESET_LOW _IO('b', 0) | ||
31 | #define BT819_FIFO_RESET_HIGH _IO('b', 1) | ||
32 | |||
33 | #endif | ||