Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * |
| 3 | * device driver for philips saa7134 based TV cards |
| 4 | * driver core |
| 5 | * |
| 6 | * (c) 2001-03 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 21 | */ |
| 22 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | #include <linux/init.h> |
| 24 | #include <linux/list.h> |
| 25 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/kernel.h> |
| 27 | #include <linux/slab.h> |
| 28 | #include <linux/kmod.h> |
| 29 | #include <linux/sound.h> |
| 30 | #include <linux/interrupt.h> |
| 31 | #include <linux/delay.h> |
Ingo Molnar | 1e4baed | 2006-01-15 07:52:23 -0200 | [diff] [blame] | 32 | #include <linux/mutex.h> |
Tobias Klauser | 56b146d | 2006-04-10 22:54:21 -0700 | [diff] [blame] | 33 | #include <linux/dma-mapping.h> |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 34 | #include <linux/pm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 35 | |
| 36 | #include "saa7134-reg.h" |
| 37 | #include "saa7134.h" |
| 38 | |
| 39 | MODULE_DESCRIPTION("v4l2 driver module for saa7130/34 based TV cards"); |
| 40 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); |
| 41 | MODULE_LICENSE("GPL"); |
| 42 | |
| 43 | /* ------------------------------------------------------------------ */ |
| 44 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 45 | static unsigned int irq_debug; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 46 | module_param(irq_debug, int, 0644); |
| 47 | MODULE_PARM_DESC(irq_debug,"enable debug messages [IRQ handler]"); |
| 48 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 49 | static unsigned int core_debug; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | module_param(core_debug, int, 0644); |
| 51 | MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); |
| 52 | |
Douglas Schilling Landgraf | ff699e6 | 2008-04-22 14:41:48 -0300 | [diff] [blame] | 53 | static unsigned int gpio_tracking; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | module_param(gpio_tracking, int, 0644); |
| 55 | MODULE_PARM_DESC(gpio_tracking,"enable debug messages [gpio]"); |
| 56 | |
Mauro Carvalho Chehab | 23ce51d | 2009-01-31 08:14:24 -0300 | [diff] [blame] | 57 | static unsigned int alsa = 1; |
Ricardo Cerqueira | 4aabf63 | 2005-11-13 16:08:00 -0800 | [diff] [blame] | 58 | module_param(alsa, int, 0644); |
Mauro Carvalho Chehab | 23ce51d | 2009-01-31 08:14:24 -0300 | [diff] [blame] | 59 | MODULE_PARM_DESC(alsa,"enable/disable ALSA DMA sound [dmasound]"); |
Ricardo Cerqueira | 4aabf63 | 2005-11-13 16:08:00 -0800 | [diff] [blame] | 60 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 61 | static unsigned int latency = UNSET; |
| 62 | module_param(latency, int, 0444); |
| 63 | MODULE_PARM_DESC(latency,"pci latency timer"); |
| 64 | |
Mauro Carvalho Chehab | ecb7377 | 2006-03-17 20:54:32 -0300 | [diff] [blame] | 65 | int saa7134_no_overlay=-1; |
| 66 | module_param_named(no_overlay, saa7134_no_overlay, int, 0444); |
Mauro Carvalho Chehab | 9050d94 | 2006-03-10 16:46:50 -0300 | [diff] [blame] | 67 | MODULE_PARM_DESC(no_overlay,"allow override overlay default (0 disables, 1 enables)" |
| 68 | " [some VIA/SIS chipsets are known to have problem with overlay]"); |
| 69 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | static unsigned int video_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; |
| 71 | static unsigned int vbi_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; |
| 72 | static unsigned int radio_nr[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | static unsigned int tuner[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; |
| 74 | static unsigned int card[] = {[0 ... (SAA7134_MAXBOARDS - 1)] = UNSET }; |
| 75 | |
Mauro Carvalho Chehab | 674434c | 2005-12-12 00:37:28 -0800 | [diff] [blame] | 76 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | module_param_array(video_nr, int, NULL, 0444); |
| 78 | module_param_array(vbi_nr, int, NULL, 0444); |
| 79 | module_param_array(radio_nr, int, NULL, 0444); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | module_param_array(tuner, int, NULL, 0444); |
| 81 | module_param_array(card, int, NULL, 0444); |
| 82 | |
| 83 | MODULE_PARM_DESC(video_nr, "video device number"); |
| 84 | MODULE_PARM_DESC(vbi_nr, "vbi device number"); |
| 85 | MODULE_PARM_DESC(radio_nr, "radio device number"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 86 | MODULE_PARM_DESC(tuner, "tuner type"); |
| 87 | MODULE_PARM_DESC(card, "card type"); |
| 88 | |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 89 | DEFINE_MUTEX(saa7134_devlist_lock); |
| 90 | EXPORT_SYMBOL(saa7134_devlist_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 91 | LIST_HEAD(saa7134_devlist); |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 92 | EXPORT_SYMBOL(saa7134_devlist); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | static LIST_HEAD(mops_list); |
| 94 | static unsigned int saa7134_devcount; |
| 95 | |
Adrian Bunk | 7845701 | 2006-07-15 15:19:56 -0300 | [diff] [blame] | 96 | int (*saa7134_dmasound_init)(struct saa7134_dev *dev); |
| 97 | int (*saa7134_dmasound_exit)(struct saa7134_dev *dev); |
Ricardo Cerqueira | f5b974c | 2005-12-01 00:51:20 -0800 | [diff] [blame] | 98 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | #define dprintk(fmt, arg...) if (core_debug) \ |
| 100 | printk(KERN_DEBUG "%s/core: " fmt, dev->name , ## arg) |
| 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | void saa7134_track_gpio(struct saa7134_dev *dev, char *msg) |
| 103 | { |
| 104 | unsigned long mode,status; |
| 105 | |
| 106 | if (!gpio_tracking) |
| 107 | return; |
| 108 | /* rising SAA7134_GPIO_GPRESCAN reads the status */ |
| 109 | saa_andorb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN,0); |
| 110 | saa_andorb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN,SAA7134_GPIO_GPRESCAN); |
| 111 | mode = saa_readl(SAA7134_GPIO_GPMODE0 >> 2) & 0xfffffff; |
| 112 | status = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & 0xfffffff; |
| 113 | printk(KERN_DEBUG |
| 114 | "%s: gpio: mode=0x%07lx in=0x%07lx out=0x%07lx [%s]\n", |
| 115 | dev->name, mode, (~mode) & status, mode & status, msg); |
| 116 | } |
| 117 | |
Hartmut Hackmann | b819594 | 2007-04-27 12:31:11 -0300 | [diff] [blame] | 118 | void saa7134_set_gpio(struct saa7134_dev *dev, int bit_no, int value) |
| 119 | { |
| 120 | u32 index, bitval; |
Hartmut Hackmann | b819594 | 2007-04-27 12:31:11 -0300 | [diff] [blame] | 121 | |
| 122 | index = 1 << bit_no; |
| 123 | switch (value) { |
| 124 | case 0: /* static value */ |
| 125 | case 1: dprintk("setting GPIO%d to static %d\n", bit_no, value); |
| 126 | /* turn sync mode off if necessary */ |
| 127 | if (index & 0x00c00000) |
| 128 | saa_andorb(SAA7134_VIDEO_PORT_CTRL6, 0x0f, 0x00); |
| 129 | if (value) |
| 130 | bitval = index; |
| 131 | else |
| 132 | bitval = 0; |
| 133 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, index); |
| 134 | saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, index, bitval); |
| 135 | break; |
| 136 | case 3: /* tristate */ |
| 137 | dprintk("setting GPIO%d to tristate\n", bit_no); |
| 138 | saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, index, 0); |
| 139 | break; |
Hartmut Hackmann | cfeb883 | 2007-04-27 12:31:17 -0300 | [diff] [blame] | 140 | } |
| 141 | } |
| 142 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | /* ------------------------------------------------------------------ */ |
| 144 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | |
| 146 | /* ----------------------------------------------------------- */ |
| 147 | /* delayed request_module */ |
| 148 | |
Reimar Doeffinger | fd1eab7 | 2005-12-01 00:51:39 -0800 | [diff] [blame] | 149 | #if defined(CONFIG_MODULES) && defined(MODULE) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | |
Markus Rechberger | 4217e25 | 2007-04-27 12:31:17 -0300 | [diff] [blame] | 151 | static void request_module_async(struct work_struct *work){ |
| 152 | struct saa7134_dev* dev = container_of(work, struct saa7134_dev, request_module_wk); |
| 153 | if (card_is_empress(dev)) |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 154 | request_module("saa7134-empress"); |
Markus Rechberger | 4217e25 | 2007-04-27 12:31:17 -0300 | [diff] [blame] | 155 | if (card_is_dvb(dev)) |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 156 | request_module("saa7134-dvb"); |
Mauro Carvalho Chehab | 23ce51d | 2009-01-31 08:14:24 -0300 | [diff] [blame] | 157 | if (alsa) { |
| 158 | if (dev->pci->device != PCI_DEVICE_ID_PHILIPS_SAA7130) |
| 159 | request_module("saa7134-alsa"); |
| 160 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 161 | } |
| 162 | |
Markus Rechberger | 4217e25 | 2007-04-27 12:31:17 -0300 | [diff] [blame] | 163 | static void request_submodules(struct saa7134_dev *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | { |
Markus Rechberger | 4217e25 | 2007-04-27 12:31:17 -0300 | [diff] [blame] | 165 | INIT_WORK(&dev->request_module_wk, request_module_async); |
| 166 | schedule_work(&dev->request_module_wk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 167 | } |
| 168 | |
| 169 | #else |
Adrian Bunk | 15f189e | 2007-03-09 17:39:52 -0300 | [diff] [blame] | 170 | #define request_submodules(dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 171 | #endif /* CONFIG_MODULES */ |
| 172 | |
| 173 | /* ------------------------------------------------------------------ */ |
| 174 | |
| 175 | /* nr of (saa7134-)pages for the given buffer size */ |
| 176 | static int saa7134_buffer_pages(int size) |
| 177 | { |
| 178 | size = PAGE_ALIGN(size); |
| 179 | size += PAGE_SIZE; /* for non-page-aligned buffers */ |
| 180 | size /= 4096; |
| 181 | return size; |
| 182 | } |
| 183 | |
| 184 | /* calc max # of buffers from size (must not exceed the 4MB virtual |
| 185 | * address space per DMA channel) */ |
| 186 | int saa7134_buffer_count(unsigned int size, unsigned int count) |
| 187 | { |
| 188 | unsigned int maxcount; |
| 189 | |
| 190 | maxcount = 1024 / saa7134_buffer_pages(size); |
| 191 | if (count > maxcount) |
| 192 | count = maxcount; |
| 193 | return count; |
| 194 | } |
| 195 | |
| 196 | int saa7134_buffer_startpage(struct saa7134_buf *buf) |
| 197 | { |
| 198 | return saa7134_buffer_pages(buf->vb.bsize) * buf->vb.i; |
| 199 | } |
| 200 | |
| 201 | unsigned long saa7134_buffer_base(struct saa7134_buf *buf) |
| 202 | { |
| 203 | unsigned long base; |
Mauro Carvalho Chehab | c1accaa | 2007-08-23 16:37:49 -0300 | [diff] [blame] | 204 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 205 | |
| 206 | base = saa7134_buffer_startpage(buf) * 4096; |
Mauro Carvalho Chehab | c1accaa | 2007-08-23 16:37:49 -0300 | [diff] [blame] | 207 | base += dma->sglist[0].offset; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | return base; |
| 209 | } |
| 210 | |
| 211 | /* ------------------------------------------------------------------ */ |
| 212 | |
| 213 | int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt) |
| 214 | { |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 215 | __le32 *cpu; |
Hans Verkuil | 614b147 | 2008-08-22 17:01:45 -0300 | [diff] [blame] | 216 | dma_addr_t dma_addr = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 217 | |
| 218 | cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr); |
| 219 | if (NULL == cpu) |
| 220 | return -ENOMEM; |
| 221 | pt->size = SAA7134_PGTABLE_SIZE; |
| 222 | pt->cpu = cpu; |
| 223 | pt->dma = dma_addr; |
| 224 | return 0; |
| 225 | } |
| 226 | |
| 227 | int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, |
| 228 | struct scatterlist *list, unsigned int length, |
| 229 | unsigned int startpage) |
| 230 | { |
Alexey Dobriyan | c9c12b7 | 2005-06-23 22:04:37 -0700 | [diff] [blame] | 231 | __le32 *ptr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 | unsigned int i,p; |
| 233 | |
| 234 | BUG_ON(NULL == pt || NULL == pt->cpu); |
| 235 | |
| 236 | ptr = pt->cpu + startpage; |
| 237 | for (i = 0; i < length; i++, list++) |
| 238 | for (p = 0; p * 4096 < list->length; p++, ptr++) |
Gerd Knorr | a20758f | 2005-06-23 22:04:34 -0700 | [diff] [blame] | 239 | *ptr = cpu_to_le32(sg_dma_address(list) - list->offset); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt) |
| 244 | { |
| 245 | if (NULL == pt->cpu) |
| 246 | return; |
| 247 | pci_free_consistent(pci, pt->size, pt->cpu, pt->dma); |
| 248 | pt->cpu = NULL; |
| 249 | } |
| 250 | |
| 251 | /* ------------------------------------------------------------------ */ |
| 252 | |
Mauro Carvalho Chehab | c7b0ac0 | 2006-03-10 12:29:15 -0300 | [diff] [blame] | 253 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | { |
Mauro Carvalho Chehab | c1accaa | 2007-08-23 16:37:49 -0300 | [diff] [blame] | 255 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); |
Eric Sesterhenn | ae24601 | 2006-03-13 13:17:11 -0300 | [diff] [blame] | 256 | BUG_ON(in_interrupt()); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 257 | |
| 258 | videobuf_waiton(&buf->vb,0,0); |
Mauro Carvalho Chehab | c1accaa | 2007-08-23 16:37:49 -0300 | [diff] [blame] | 259 | videobuf_dma_unmap(q, dma); |
| 260 | videobuf_dma_free(dma); |
Brandon Philips | 0fc0686 | 2007-11-06 20:02:36 -0300 | [diff] [blame] | 261 | buf->vb.state = VIDEOBUF_NEEDS_INIT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | /* ------------------------------------------------------------------ */ |
| 265 | |
| 266 | int saa7134_buffer_queue(struct saa7134_dev *dev, |
| 267 | struct saa7134_dmaqueue *q, |
| 268 | struct saa7134_buf *buf) |
| 269 | { |
| 270 | struct saa7134_buf *next = NULL; |
| 271 | |
| 272 | assert_spin_locked(&dev->slock); |
| 273 | dprintk("buffer_queue %p\n",buf); |
| 274 | if (NULL == q->curr) { |
| 275 | if (!q->need_two) { |
| 276 | q->curr = buf; |
| 277 | buf->activate(dev,buf,NULL); |
| 278 | } else if (list_empty(&q->queue)) { |
| 279 | list_add_tail(&buf->vb.queue,&q->queue); |
Brandon Philips | 0fc0686 | 2007-11-06 20:02:36 -0300 | [diff] [blame] | 280 | buf->vb.state = VIDEOBUF_QUEUED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | } else { |
| 282 | next = list_entry(q->queue.next,struct saa7134_buf, |
| 283 | vb.queue); |
| 284 | q->curr = buf; |
| 285 | buf->activate(dev,buf,next); |
| 286 | } |
| 287 | } else { |
| 288 | list_add_tail(&buf->vb.queue,&q->queue); |
Brandon Philips | 0fc0686 | 2007-11-06 20:02:36 -0300 | [diff] [blame] | 289 | buf->vb.state = VIDEOBUF_QUEUED; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 290 | } |
| 291 | return 0; |
| 292 | } |
| 293 | |
| 294 | void saa7134_buffer_finish(struct saa7134_dev *dev, |
| 295 | struct saa7134_dmaqueue *q, |
| 296 | unsigned int state) |
| 297 | { |
| 298 | assert_spin_locked(&dev->slock); |
| 299 | dprintk("buffer_finish %p\n",q->curr); |
| 300 | |
| 301 | /* finish current buffer */ |
| 302 | q->curr->vb.state = state; |
| 303 | do_gettimeofday(&q->curr->vb.ts); |
| 304 | wake_up(&q->curr->vb.done); |
| 305 | q->curr = NULL; |
| 306 | } |
| 307 | |
| 308 | void saa7134_buffer_next(struct saa7134_dev *dev, |
| 309 | struct saa7134_dmaqueue *q) |
| 310 | { |
| 311 | struct saa7134_buf *buf,*next = NULL; |
| 312 | |
| 313 | assert_spin_locked(&dev->slock); |
| 314 | BUG_ON(NULL != q->curr); |
| 315 | |
| 316 | if (!list_empty(&q->queue)) { |
| 317 | /* activate next one from queue */ |
| 318 | buf = list_entry(q->queue.next,struct saa7134_buf,vb.queue); |
| 319 | dprintk("buffer_next %p [prev=%p/next=%p]\n", |
| 320 | buf,q->queue.prev,q->queue.next); |
| 321 | list_del(&buf->vb.queue); |
| 322 | if (!list_empty(&q->queue)) |
| 323 | next = list_entry(q->queue.next,struct saa7134_buf, |
| 324 | vb.queue); |
| 325 | q->curr = buf; |
| 326 | buf->activate(dev,buf,next); |
| 327 | dprintk("buffer_next #2 prev=%p/next=%p\n", |
| 328 | q->queue.prev,q->queue.next); |
| 329 | } else { |
| 330 | /* nothing to do -- just stop DMA */ |
| 331 | dprintk("buffer_next %p\n",NULL); |
| 332 | saa7134_set_dmabits(dev); |
| 333 | del_timer(&q->timeout); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | void saa7134_buffer_timeout(unsigned long data) |
| 338 | { |
| 339 | struct saa7134_dmaqueue *q = (struct saa7134_dmaqueue*)data; |
| 340 | struct saa7134_dev *dev = q->dev; |
| 341 | unsigned long flags; |
| 342 | |
| 343 | spin_lock_irqsave(&dev->slock,flags); |
| 344 | |
| 345 | /* try to reset the hardware (SWRST) */ |
| 346 | saa_writeb(SAA7134_REGION_ENABLE, 0x00); |
| 347 | saa_writeb(SAA7134_REGION_ENABLE, 0x80); |
| 348 | saa_writeb(SAA7134_REGION_ENABLE, 0x00); |
| 349 | |
| 350 | /* flag current buffer as failed, |
| 351 | try to start over with the next one. */ |
| 352 | if (q->curr) { |
| 353 | dprintk("timeout on %p\n",q->curr); |
Brandon Philips | 0fc0686 | 2007-11-06 20:02:36 -0300 | [diff] [blame] | 354 | saa7134_buffer_finish(dev,q,VIDEOBUF_ERROR); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 355 | } |
| 356 | saa7134_buffer_next(dev,q); |
| 357 | spin_unlock_irqrestore(&dev->slock,flags); |
| 358 | } |
| 359 | |
| 360 | /* ------------------------------------------------------------------ */ |
| 361 | |
| 362 | int saa7134_set_dmabits(struct saa7134_dev *dev) |
| 363 | { |
| 364 | u32 split, task=0, ctrl=0, irq=0; |
| 365 | enum v4l2_field cap = V4L2_FIELD_ANY; |
| 366 | enum v4l2_field ov = V4L2_FIELD_ANY; |
| 367 | |
| 368 | assert_spin_locked(&dev->slock); |
| 369 | |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 370 | if (dev->insuspend) |
Maxim Levitsky | acd827d | 2007-10-08 12:07:35 -0300 | [diff] [blame] | 371 | return 0; |
| 372 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 373 | /* video capture -- dma 0 + video task A */ |
| 374 | if (dev->video_q.curr) { |
| 375 | task |= 0x01; |
| 376 | ctrl |= SAA7134_MAIN_CTRL_TE0; |
| 377 | irq |= SAA7134_IRQ1_INTE_RA0_1 | |
| 378 | SAA7134_IRQ1_INTE_RA0_0; |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 379 | cap = dev->video_q.curr->vb.field; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 380 | } |
| 381 | |
| 382 | /* video capture -- dma 1+2 (planar modes) */ |
| 383 | if (dev->video_q.curr && |
| 384 | dev->video_q.curr->fmt->planar) { |
| 385 | ctrl |= SAA7134_MAIN_CTRL_TE4 | |
| 386 | SAA7134_MAIN_CTRL_TE5; |
| 387 | } |
| 388 | |
| 389 | /* screen overlay -- dma 0 + video task B */ |
| 390 | if (dev->ovenable) { |
| 391 | task |= 0x10; |
| 392 | ctrl |= SAA7134_MAIN_CTRL_TE1; |
| 393 | ov = dev->ovfield; |
| 394 | } |
| 395 | |
| 396 | /* vbi capture -- dma 0 + vbi task A+B */ |
| 397 | if (dev->vbi_q.curr) { |
| 398 | task |= 0x22; |
| 399 | ctrl |= SAA7134_MAIN_CTRL_TE2 | |
| 400 | SAA7134_MAIN_CTRL_TE3; |
| 401 | irq |= SAA7134_IRQ1_INTE_RA0_7 | |
| 402 | SAA7134_IRQ1_INTE_RA0_6 | |
| 403 | SAA7134_IRQ1_INTE_RA0_5 | |
| 404 | SAA7134_IRQ1_INTE_RA0_4; |
| 405 | } |
| 406 | |
| 407 | /* audio capture -- dma 3 */ |
Ricardo Cerqueira | b54134b | 2005-11-08 21:38:54 -0800 | [diff] [blame] | 408 | if (dev->dmasound.dma_running) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | ctrl |= SAA7134_MAIN_CTRL_TE6; |
| 410 | irq |= SAA7134_IRQ1_INTE_RA3_1 | |
| 411 | SAA7134_IRQ1_INTE_RA3_0; |
| 412 | } |
| 413 | |
| 414 | /* TS capture -- dma 5 */ |
| 415 | if (dev->ts_q.curr) { |
| 416 | ctrl |= SAA7134_MAIN_CTRL_TE5; |
Dmitry Belimov | 8809b9c | 2008-08-26 13:47:10 -0300 | [diff] [blame] | 417 | irq |= SAA7134_IRQ1_INTE_RA2_1 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 418 | SAA7134_IRQ1_INTE_RA2_0; |
| 419 | } |
| 420 | |
| 421 | /* set task conditions + field handling */ |
| 422 | if (V4L2_FIELD_HAS_BOTH(cap) || V4L2_FIELD_HAS_BOTH(ov) || cap == ov) { |
| 423 | /* default config -- use full frames */ |
| 424 | saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0d); |
| 425 | saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0d); |
| 426 | saa_writeb(SAA7134_FIELD_HANDLING(TASK_A), 0x02); |
| 427 | saa_writeb(SAA7134_FIELD_HANDLING(TASK_B), 0x02); |
| 428 | split = 0; |
| 429 | } else { |
| 430 | /* split fields between tasks */ |
| 431 | if (V4L2_FIELD_TOP == cap) { |
| 432 | /* odd A, even B, repeat */ |
| 433 | saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0d); |
| 434 | saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0e); |
| 435 | } else { |
| 436 | /* odd B, even A, repeat */ |
| 437 | saa_writeb(SAA7134_TASK_CONDITIONS(TASK_A), 0x0e); |
| 438 | saa_writeb(SAA7134_TASK_CONDITIONS(TASK_B), 0x0d); |
| 439 | } |
| 440 | saa_writeb(SAA7134_FIELD_HANDLING(TASK_A), 0x01); |
| 441 | saa_writeb(SAA7134_FIELD_HANDLING(TASK_B), 0x01); |
| 442 | split = 1; |
| 443 | } |
| 444 | |
| 445 | /* irqs */ |
| 446 | saa_writeb(SAA7134_REGION_ENABLE, task); |
| 447 | saa_writel(SAA7134_IRQ1, irq); |
| 448 | saa_andorl(SAA7134_MAIN_CTRL, |
| 449 | SAA7134_MAIN_CTRL_TE0 | |
| 450 | SAA7134_MAIN_CTRL_TE1 | |
| 451 | SAA7134_MAIN_CTRL_TE2 | |
| 452 | SAA7134_MAIN_CTRL_TE3 | |
| 453 | SAA7134_MAIN_CTRL_TE4 | |
| 454 | SAA7134_MAIN_CTRL_TE5 | |
| 455 | SAA7134_MAIN_CTRL_TE6, |
| 456 | ctrl); |
| 457 | dprintk("dmabits: task=0x%02x ctrl=0x%02x irq=0x%x split=%s\n", |
| 458 | task, ctrl, irq, split ? "no" : "yes"); |
| 459 | |
| 460 | return 0; |
| 461 | } |
| 462 | |
| 463 | /* ------------------------------------------------------------------ */ |
| 464 | /* IRQ handler + helpers */ |
| 465 | |
| 466 | static char *irqbits[] = { |
| 467 | "DONE_RA0", "DONE_RA1", "DONE_RA2", "DONE_RA3", |
| 468 | "AR", "PE", "PWR_ON", "RDCAP", "INTL", "FIDT", "MMC", |
| 469 | "TRIG_ERR", "CONF_ERR", "LOAD_ERR", |
| 470 | "GPIO16?", "GPIO18", "GPIO22", "GPIO23" |
| 471 | }; |
| 472 | #define IRQBITS ARRAY_SIZE(irqbits) |
| 473 | |
| 474 | static void print_irqstatus(struct saa7134_dev *dev, int loop, |
| 475 | unsigned long report, unsigned long status) |
| 476 | { |
| 477 | unsigned int i; |
| 478 | |
| 479 | printk(KERN_DEBUG "%s/irq[%d,%ld]: r=0x%lx s=0x%02lx", |
| 480 | dev->name,loop,jiffies,report,status); |
| 481 | for (i = 0; i < IRQBITS; i++) { |
| 482 | if (!(report & (1 << i))) |
| 483 | continue; |
| 484 | printk(" %s",irqbits[i]); |
| 485 | } |
| 486 | if (report & SAA7134_IRQ_REPORT_DONE_RA0) { |
| 487 | printk(" | RA0=%s,%s,%s,%ld", |
| 488 | (status & 0x40) ? "vbi" : "video", |
| 489 | (status & 0x20) ? "b" : "a", |
| 490 | (status & 0x10) ? "odd" : "even", |
| 491 | (status & 0x0f)); |
| 492 | } |
| 493 | printk("\n"); |
| 494 | } |
| 495 | |
David Howells | 7d12e78 | 2006-10-05 14:55:46 +0100 | [diff] [blame] | 496 | static irqreturn_t saa7134_irq(int irq, void *dev_id) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 497 | { |
| 498 | struct saa7134_dev *dev = (struct saa7134_dev*) dev_id; |
| 499 | unsigned long report,status; |
| 500 | int loop, handled = 0; |
| 501 | |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 502 | if (dev->insuspend) |
| 503 | goto out; |
| 504 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | for (loop = 0; loop < 10; loop++) { |
| 506 | report = saa_readl(SAA7134_IRQ_REPORT); |
| 507 | status = saa_readl(SAA7134_IRQ_STATUS); |
Ricardo Cerqueira | 79dd0c69 | 2005-11-08 21:38:53 -0800 | [diff] [blame] | 508 | |
Heikki Lindholm | 843b137 | 2007-11-30 13:27:26 -0300 | [diff] [blame] | 509 | /* If dmasound support is active and we get a sound report, |
| 510 | * mask out the report and let the saa7134-alsa module deal |
| 511 | * with it */ |
Ricardo Cerqueira | 4aabf63 | 2005-11-13 16:08:00 -0800 | [diff] [blame] | 512 | if ((report & SAA7134_IRQ_REPORT_DONE_RA3) && |
| 513 | (dev->dmasound.priv_data != NULL) ) |
| 514 | { |
Ricardo Cerqueira | 79dd0c69 | 2005-11-08 21:38:53 -0800 | [diff] [blame] | 515 | if (irq_debug > 1) |
Heikki Lindholm | 843b137 | 2007-11-30 13:27:26 -0300 | [diff] [blame] | 516 | printk(KERN_DEBUG "%s/irq: preserving DMA sound interrupt\n", |
| 517 | dev->name); |
| 518 | report &= ~SAA7134_IRQ_REPORT_DONE_RA3; |
| 519 | } |
| 520 | |
| 521 | if (0 == report) { |
| 522 | if (irq_debug > 1) |
| 523 | printk(KERN_DEBUG "%s/irq: no (more) work\n", |
Ricardo Cerqueira | 79dd0c69 | 2005-11-08 21:38:53 -0800 | [diff] [blame] | 524 | dev->name); |
| 525 | goto out; |
| 526 | } |
| 527 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 528 | handled = 1; |
| 529 | saa_writel(SAA7134_IRQ_REPORT,report); |
| 530 | if (irq_debug) |
| 531 | print_irqstatus(dev,loop,report,status); |
| 532 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 533 | |
Maxim Levitsky | 11f7078 | 2007-09-27 20:44:39 -0300 | [diff] [blame] | 534 | if ((report & SAA7134_IRQ_REPORT_RDCAP) || |
| 535 | (report & SAA7134_IRQ_REPORT_INTL)) |
| 536 | saa7134_irq_video_signalchange(dev); |
| 537 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | |
| 539 | if ((report & SAA7134_IRQ_REPORT_DONE_RA0) && |
| 540 | (status & 0x60) == 0) |
| 541 | saa7134_irq_video_done(dev,status); |
| 542 | |
| 543 | if ((report & SAA7134_IRQ_REPORT_DONE_RA0) && |
| 544 | (status & 0x40) == 0x40) |
| 545 | saa7134_irq_vbi_done(dev,status); |
| 546 | |
| 547 | if ((report & SAA7134_IRQ_REPORT_DONE_RA2) && |
| 548 | card_has_mpeg(dev)) |
| 549 | saa7134_irq_ts_done(dev,status); |
| 550 | |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 551 | if (report & SAA7134_IRQ_REPORT_GPIO16) { |
| 552 | switch (dev->has_remote) { |
| 553 | case SAA7134_REMOTE_GPIO: |
Sergey Vlasov | 7a766f9 | 2006-04-07 10:04:56 -0300 | [diff] [blame] | 554 | if (!dev->remote) |
| 555 | break; |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 556 | if (dev->remote->mask_keydown & 0x10000) { |
| 557 | saa7134_input_irq(dev); |
| 558 | } |
| 559 | break; |
Ricardo Cerqueira | bd15eba | 2005-11-08 21:37:11 -0800 | [diff] [blame] | 560 | |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 561 | case SAA7134_REMOTE_I2C: |
| 562 | break; /* FIXME: invoke I2C get_key() */ |
| 563 | |
| 564 | default: /* GPIO16 not used by IR remote */ |
| 565 | break; |
| 566 | } |
| 567 | } |
| 568 | |
| 569 | if (report & SAA7134_IRQ_REPORT_GPIO18) { |
| 570 | switch (dev->has_remote) { |
| 571 | case SAA7134_REMOTE_GPIO: |
Sergey Vlasov | 7a766f9 | 2006-04-07 10:04:56 -0300 | [diff] [blame] | 572 | if (!dev->remote) |
| 573 | break; |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 574 | if ((dev->remote->mask_keydown & 0x40000) || |
| 575 | (dev->remote->mask_keyup & 0x40000)) { |
| 576 | saa7134_input_irq(dev); |
| 577 | } |
| 578 | break; |
| 579 | |
| 580 | case SAA7134_REMOTE_I2C: |
| 581 | break; /* FIXME: invoke I2C get_key() */ |
| 582 | |
| 583 | default: /* GPIO18 not used by IR remote */ |
| 584 | break; |
| 585 | } |
| 586 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 587 | } |
| 588 | |
| 589 | if (10 == loop) { |
| 590 | print_irqstatus(dev,loop,report,status); |
| 591 | if (report & SAA7134_IRQ_REPORT_PE) { |
| 592 | /* disable all parity error */ |
| 593 | printk(KERN_WARNING "%s/irq: looping -- " |
| 594 | "clearing PE (parity error!) enable bit\n",dev->name); |
| 595 | saa_clearl(SAA7134_IRQ2,SAA7134_IRQ2_INTE_PE); |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 596 | } else if (report & SAA7134_IRQ_REPORT_GPIO16) { |
| 597 | /* disable gpio16 IRQ */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 598 | printk(KERN_WARNING "%s/irq: looping -- " |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 599 | "clearing GPIO16 enable bit\n",dev->name); |
| 600 | saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO16); |
| 601 | } else if (report & SAA7134_IRQ_REPORT_GPIO18) { |
| 602 | /* disable gpio18 IRQs */ |
| 603 | printk(KERN_WARNING "%s/irq: looping -- " |
| 604 | "clearing GPIO18 enable bit\n",dev->name); |
| 605 | saa_clearl(SAA7134_IRQ2, SAA7134_IRQ2_INTE_GPIO18); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | } else { |
| 607 | /* disable all irqs */ |
| 608 | printk(KERN_WARNING "%s/irq: looping -- " |
| 609 | "clearing all enable bits\n",dev->name); |
| 610 | saa_writel(SAA7134_IRQ1,0); |
| 611 | saa_writel(SAA7134_IRQ2,0); |
| 612 | } |
| 613 | } |
| 614 | |
| 615 | out: |
| 616 | return IRQ_RETVAL(handled); |
| 617 | } |
| 618 | |
| 619 | /* ------------------------------------------------------------------ */ |
| 620 | |
| 621 | /* early init (no i2c, no irq) */ |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 622 | |
| 623 | static int saa7134_hw_enable1(struct saa7134_dev *dev) |
| 624 | { |
| 625 | /* RAM FIFO config */ |
| 626 | saa_writel(SAA7134_FIFO_SIZE, 0x08070503); |
| 627 | saa_writel(SAA7134_THRESHOULD, 0x02020202); |
| 628 | |
| 629 | /* enable audio + video processing */ |
| 630 | saa_writel(SAA7134_MAIN_CTRL, |
| 631 | SAA7134_MAIN_CTRL_VPLLE | |
| 632 | SAA7134_MAIN_CTRL_APLLE | |
| 633 | SAA7134_MAIN_CTRL_EXOSC | |
| 634 | SAA7134_MAIN_CTRL_EVFE1 | |
| 635 | SAA7134_MAIN_CTRL_EVFE2 | |
| 636 | SAA7134_MAIN_CTRL_ESFE | |
| 637 | SAA7134_MAIN_CTRL_EBDAC); |
| 638 | |
| 639 | /* |
| 640 | * Initialize OSS _after_ enabling audio clock PLL and audio processing. |
| 641 | * OSS initialization writes to registers via the audio DSP; these |
| 642 | * writes will fail unless the audio clock has been started. At worst, |
| 643 | * audio will not work. |
| 644 | */ |
| 645 | |
| 646 | /* enable peripheral devices */ |
| 647 | saa_writeb(SAA7134_SPECIAL_MODE, 0x01); |
| 648 | |
| 649 | /* set vertical line numbering start (vbi needs this) */ |
| 650 | saa_writeb(SAA7134_SOURCE_TIMING2, 0x20); |
| 651 | |
| 652 | return 0; |
| 653 | } |
| 654 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 655 | static int saa7134_hwinit1(struct saa7134_dev *dev) |
| 656 | { |
| 657 | dprintk("hwinit1\n"); |
| 658 | |
| 659 | saa_writel(SAA7134_IRQ1, 0); |
| 660 | saa_writel(SAA7134_IRQ2, 0); |
Andy Walls | 7ef5e02 | 2009-01-10 18:04:45 -0300 | [diff] [blame] | 661 | |
| 662 | /* Clear any stale IRQ reports */ |
| 663 | saa_writel(SAA7134_IRQ_REPORT, saa_readl(SAA7134_IRQ_REPORT)); |
| 664 | |
Ingo Molnar | 3593cab | 2006-02-07 06:49:14 -0200 | [diff] [blame] | 665 | mutex_init(&dev->lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 666 | spin_lock_init(&dev->slock); |
| 667 | |
| 668 | saa7134_track_gpio(dev,"pre-init"); |
| 669 | saa7134_video_init1(dev); |
| 670 | saa7134_vbi_init1(dev); |
| 671 | if (card_has_mpeg(dev)) |
| 672 | saa7134_ts_init1(dev); |
| 673 | saa7134_input_init1(dev); |
| 674 | |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 675 | saa7134_hw_enable1(dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 676 | |
| 677 | return 0; |
| 678 | } |
| 679 | |
| 680 | /* late init (with i2c + irq) */ |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 681 | static int saa7134_hw_enable2(struct saa7134_dev *dev) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 682 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 683 | |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 684 | unsigned int irq2_mask; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 685 | |
| 686 | /* enable IRQ's */ |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 687 | irq2_mask = |
Mauro Carvalho Chehab | 330a115 | 2005-07-12 13:59:01 -0700 | [diff] [blame] | 688 | SAA7134_IRQ2_INTE_DEC3 | |
| 689 | SAA7134_IRQ2_INTE_DEC2 | |
| 690 | SAA7134_IRQ2_INTE_DEC1 | |
| 691 | SAA7134_IRQ2_INTE_DEC0 | |
| 692 | SAA7134_IRQ2_INTE_PE | |
| 693 | SAA7134_IRQ2_INTE_AR; |
| 694 | |
Sergey Vlasov | 7a766f9 | 2006-04-07 10:04:56 -0300 | [diff] [blame] | 695 | if (dev->has_remote == SAA7134_REMOTE_GPIO && dev->remote) { |
Peter Missel | 0602fbb | 2006-01-09 18:21:23 -0200 | [diff] [blame] | 696 | if (dev->remote->mask_keydown & 0x10000) |
| 697 | irq2_mask |= SAA7134_IRQ2_INTE_GPIO16; |
| 698 | else if (dev->remote->mask_keydown & 0x40000) |
| 699 | irq2_mask |= SAA7134_IRQ2_INTE_GPIO18; |
| 700 | else if (dev->remote->mask_keyup & 0x40000) |
| 701 | irq2_mask |= SAA7134_IRQ2_INTE_GPIO18A; |
| 702 | } |
Mauro Carvalho Chehab | 330a115 | 2005-07-12 13:59:01 -0700 | [diff] [blame] | 703 | |
Dmitri Belimov | 3de2ed1 | 2008-09-29 02:25:40 -0300 | [diff] [blame] | 704 | if (dev->has_remote == SAA7134_REMOTE_I2C) { |
| 705 | request_module("ir-kbd-i2c"); |
| 706 | } |
| 707 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 708 | saa_writel(SAA7134_IRQ1, 0); |
Mauro Carvalho Chehab | 330a115 | 2005-07-12 13:59:01 -0700 | [diff] [blame] | 709 | saa_writel(SAA7134_IRQ2, irq2_mask); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | |
| 711 | return 0; |
| 712 | } |
| 713 | |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 714 | static int saa7134_hwinit2(struct saa7134_dev *dev) |
| 715 | { |
| 716 | |
| 717 | dprintk("hwinit2\n"); |
| 718 | |
| 719 | saa7134_video_init2(dev); |
| 720 | saa7134_tvaudio_init2(dev); |
| 721 | |
| 722 | saa7134_hw_enable2(dev); |
| 723 | |
| 724 | return 0; |
| 725 | } |
| 726 | |
| 727 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 728 | /* shutdown */ |
| 729 | static int saa7134_hwfini(struct saa7134_dev *dev) |
| 730 | { |
| 731 | dprintk("hwfini\n"); |
| 732 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 733 | if (card_has_mpeg(dev)) |
| 734 | saa7134_ts_fini(dev); |
| 735 | saa7134_input_fini(dev); |
| 736 | saa7134_vbi_fini(dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 737 | saa7134_tvaudio_fini(dev); |
| 738 | return 0; |
| 739 | } |
| 740 | |
| 741 | static void __devinit must_configure_manually(void) |
| 742 | { |
| 743 | unsigned int i,p; |
| 744 | |
| 745 | printk(KERN_WARNING |
| 746 | "saa7134: <rant>\n" |
| 747 | "saa7134: Congratulations! Your TV card vendor saved a few\n" |
| 748 | "saa7134: cents for a eeprom, thus your pci board has no\n" |
| 749 | "saa7134: subsystem ID and I can't identify it automatically\n" |
| 750 | "saa7134: </rant>\n" |
| 751 | "saa7134: I feel better now. Ok, here are the good news:\n" |
| 752 | "saa7134: You can use the card=<nr> insmod option to specify\n" |
| 753 | "saa7134: which board do you have. The list:\n"); |
| 754 | for (i = 0; i < saa7134_bcount; i++) { |
| 755 | printk(KERN_WARNING "saa7134: card=%d -> %-40.40s", |
| 756 | i,saa7134_boards[i].name); |
| 757 | for (p = 0; saa7134_pci_tbl[p].driver_data; p++) { |
| 758 | if (saa7134_pci_tbl[p].driver_data != i) |
| 759 | continue; |
| 760 | printk(" %04x:%04x", |
| 761 | saa7134_pci_tbl[p].subvendor, |
| 762 | saa7134_pci_tbl[p].subdevice); |
| 763 | } |
| 764 | printk("\n"); |
| 765 | } |
| 766 | } |
| 767 | |
| 768 | static struct video_device *vdev_init(struct saa7134_dev *dev, |
| 769 | struct video_device *template, |
| 770 | char *type) |
| 771 | { |
| 772 | struct video_device *vfd; |
| 773 | |
| 774 | vfd = video_device_alloc(); |
| 775 | if (NULL == vfd) |
| 776 | return NULL; |
| 777 | *vfd = *template; |
| 778 | vfd->minor = -1; |
Hans Verkuil | b8ced13 | 2009-03-15 06:53:32 -0300 | [diff] [blame] | 779 | vfd->v4l2_dev = &dev->v4l2_dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 780 | vfd->release = video_device_release; |
Mauro Carvalho Chehab | 8c85454 | 2007-12-07 17:34:48 -0300 | [diff] [blame] | 781 | vfd->debug = video_debug; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 782 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", |
| 783 | dev->name, type, saa7134_boards[dev->board].name); |
| 784 | return vfd; |
| 785 | } |
| 786 | |
| 787 | static void saa7134_unregister_video(struct saa7134_dev *dev) |
| 788 | { |
| 789 | if (dev->video_dev) { |
| 790 | if (-1 != dev->video_dev->minor) |
| 791 | video_unregister_device(dev->video_dev); |
| 792 | else |
| 793 | video_device_release(dev->video_dev); |
| 794 | dev->video_dev = NULL; |
| 795 | } |
| 796 | if (dev->vbi_dev) { |
| 797 | if (-1 != dev->vbi_dev->minor) |
| 798 | video_unregister_device(dev->vbi_dev); |
| 799 | else |
| 800 | video_device_release(dev->vbi_dev); |
| 801 | dev->vbi_dev = NULL; |
| 802 | } |
| 803 | if (dev->radio_dev) { |
| 804 | if (-1 != dev->radio_dev->minor) |
| 805 | video_unregister_device(dev->radio_dev); |
| 806 | else |
| 807 | video_device_release(dev->radio_dev); |
| 808 | dev->radio_dev = NULL; |
| 809 | } |
| 810 | } |
| 811 | |
| 812 | static void mpeg_ops_attach(struct saa7134_mpeg_ops *ops, |
| 813 | struct saa7134_dev *dev) |
| 814 | { |
| 815 | int err; |
| 816 | |
| 817 | if (NULL != dev->mops) |
| 818 | return; |
| 819 | if (saa7134_boards[dev->board].mpeg != ops->type) |
| 820 | return; |
| 821 | err = ops->init(dev); |
| 822 | if (0 != err) |
| 823 | return; |
| 824 | dev->mops = ops; |
| 825 | } |
| 826 | |
| 827 | static void mpeg_ops_detach(struct saa7134_mpeg_ops *ops, |
| 828 | struct saa7134_dev *dev) |
| 829 | { |
| 830 | if (NULL == dev->mops) |
| 831 | return; |
| 832 | if (dev->mops != ops) |
| 833 | return; |
| 834 | dev->mops->fini(dev); |
| 835 | dev->mops = NULL; |
| 836 | } |
| 837 | |
| 838 | static int __devinit saa7134_initdev(struct pci_dev *pci_dev, |
| 839 | const struct pci_device_id *pci_id) |
| 840 | { |
| 841 | struct saa7134_dev *dev; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 842 | struct saa7134_mpeg_ops *mops; |
| 843 | int err; |
| 844 | |
Alan McIvor | a4df8e1 | 2008-04-22 14:46:09 -0300 | [diff] [blame] | 845 | if (saa7134_devcount == SAA7134_MAXBOARDS) |
| 846 | return -ENOMEM; |
| 847 | |
Panagiotis Issaris | 7408187 | 2006-01-11 19:40:56 -0200 | [diff] [blame] | 848 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 849 | if (NULL == dev) |
| 850 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 851 | |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 852 | err = v4l2_device_register(&pci_dev->dev, &dev->v4l2_dev); |
| 853 | if (err) |
| 854 | goto fail0; |
| 855 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 856 | /* pci init */ |
| 857 | dev->pci = pci_dev; |
| 858 | if (pci_enable_device(pci_dev)) { |
| 859 | err = -EIO; |
| 860 | goto fail1; |
| 861 | } |
| 862 | |
| 863 | dev->nr = saa7134_devcount; |
| 864 | sprintf(dev->name,"saa%x[%d]",pci_dev->device,dev->nr); |
| 865 | |
| 866 | /* pci quirks */ |
| 867 | if (pci_pci_problems) { |
| 868 | if (pci_pci_problems & PCIPCI_TRITON) |
| 869 | printk(KERN_INFO "%s: quirk: PCIPCI_TRITON\n", dev->name); |
| 870 | if (pci_pci_problems & PCIPCI_NATOMA) |
| 871 | printk(KERN_INFO "%s: quirk: PCIPCI_NATOMA\n", dev->name); |
| 872 | if (pci_pci_problems & PCIPCI_VIAETBF) |
| 873 | printk(KERN_INFO "%s: quirk: PCIPCI_VIAETBF\n", dev->name); |
| 874 | if (pci_pci_problems & PCIPCI_VSFX) |
| 875 | printk(KERN_INFO "%s: quirk: PCIPCI_VSFX\n",dev->name); |
| 876 | #ifdef PCIPCI_ALIMAGIK |
| 877 | if (pci_pci_problems & PCIPCI_ALIMAGIK) { |
| 878 | printk(KERN_INFO "%s: quirk: PCIPCI_ALIMAGIK -- latency fixup\n", |
| 879 | dev->name); |
| 880 | latency = 0x0A; |
| 881 | } |
| 882 | #endif |
Alan Cox | 3d265c9 | 2006-09-14 11:53:16 -0300 | [diff] [blame] | 883 | if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) { |
Mauro Carvalho Chehab | 9050d94 | 2006-03-10 16:46:50 -0300 | [diff] [blame] | 884 | printk(KERN_INFO "%s: quirk: this driver and your " |
| 885 | "chipset may not work together" |
| 886 | " in overlay mode.\n",dev->name); |
Mauro Carvalho Chehab | ecb7377 | 2006-03-17 20:54:32 -0300 | [diff] [blame] | 887 | if (!saa7134_no_overlay) { |
Mauro Carvalho Chehab | 9050d94 | 2006-03-10 16:46:50 -0300 | [diff] [blame] | 888 | printk(KERN_INFO "%s: quirk: overlay " |
| 889 | "mode will be disabled.\n", |
| 890 | dev->name); |
Mauro Carvalho Chehab | ecb7377 | 2006-03-17 20:54:32 -0300 | [diff] [blame] | 891 | saa7134_no_overlay = 1; |
Mauro Carvalho Chehab | 9050d94 | 2006-03-10 16:46:50 -0300 | [diff] [blame] | 892 | } else { |
| 893 | printk(KERN_INFO "%s: quirk: overlay " |
| 894 | "mode will be forced. Use this" |
| 895 | " option at your own risk.\n", |
| 896 | dev->name); |
| 897 | } |
| 898 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 899 | } |
| 900 | if (UNSET != latency) { |
| 901 | printk(KERN_INFO "%s: setting pci latency timer to %d\n", |
| 902 | dev->name,latency); |
| 903 | pci_write_config_byte(pci_dev, PCI_LATENCY_TIMER, latency); |
| 904 | } |
| 905 | |
| 906 | /* print pci info */ |
| 907 | pci_read_config_byte(pci_dev, PCI_CLASS_REVISION, &dev->pci_rev); |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 908 | pci_read_config_byte(pci_dev, PCI_LATENCY_TIMER, &dev->pci_lat); |
| 909 | printk(KERN_INFO "%s: found at %s, rev: %d, irq: %d, " |
Greg Kroah-Hartman | 228aef6 | 2006-06-12 15:16:52 -0700 | [diff] [blame] | 910 | "latency: %d, mmio: 0x%llx\n", dev->name, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 911 | pci_name(pci_dev), dev->pci_rev, pci_dev->irq, |
Greg Kroah-Hartman | 228aef6 | 2006-06-12 15:16:52 -0700 | [diff] [blame] | 912 | dev->pci_lat,(unsigned long long)pci_resource_start(pci_dev,0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 913 | pci_set_master(pci_dev); |
Tobias Klauser | 56b146d | 2006-04-10 22:54:21 -0700 | [diff] [blame] | 914 | if (!pci_dma_supported(pci_dev, DMA_32BIT_MASK)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 915 | printk("%s: Oops: no 32bit PCI DMA ???\n",dev->name); |
| 916 | err = -EIO; |
| 917 | goto fail1; |
| 918 | } |
| 919 | |
| 920 | /* board config */ |
| 921 | dev->board = pci_id->driver_data; |
| 922 | if (card[dev->nr] >= 0 && |
| 923 | card[dev->nr] < saa7134_bcount) |
| 924 | dev->board = card[dev->nr]; |
| 925 | if (SAA7134_BOARD_NOAUTO == dev->board) { |
| 926 | must_configure_manually(); |
| 927 | dev->board = SAA7134_BOARD_UNKNOWN; |
| 928 | } |
Hartmut Hackmann | a75ec3f | 2006-10-30 19:56:59 -0300 | [diff] [blame] | 929 | dev->autodetected = card[dev->nr] != dev->board; |
Simon Arlott | d53687d | 2008-07-26 11:30:03 -0300 | [diff] [blame] | 930 | dev->tuner_type = saa7134_boards[dev->board].tuner_type; |
| 931 | dev->tuner_addr = saa7134_boards[dev->board].tuner_addr; |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 932 | dev->radio_type = saa7134_boards[dev->board].radio_type; |
| 933 | dev->radio_addr = saa7134_boards[dev->board].radio_addr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 934 | dev->tda9887_conf = saa7134_boards[dev->board].tda9887_conf; |
| 935 | if (UNSET != tuner[dev->nr]) |
| 936 | dev->tuner_type = tuner[dev->nr]; |
Simon Arlott | d53687d | 2008-07-26 11:30:03 -0300 | [diff] [blame] | 937 | printk(KERN_INFO "%s: subsystem: %04x:%04x, board: %s [card=%d,%s]\n", |
Hartmut Hackmann | a75ec3f | 2006-10-30 19:56:59 -0300 | [diff] [blame] | 938 | dev->name,pci_dev->subsystem_vendor, |
| 939 | pci_dev->subsystem_device,saa7134_boards[dev->board].name, |
| 940 | dev->board, dev->autodetected ? |
| 941 | "autodetected" : "insmod option"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 942 | |
| 943 | /* get mmio */ |
| 944 | if (!request_mem_region(pci_resource_start(pci_dev,0), |
| 945 | pci_resource_len(pci_dev,0), |
| 946 | dev->name)) { |
| 947 | err = -EBUSY; |
Greg Kroah-Hartman | 228aef6 | 2006-06-12 15:16:52 -0700 | [diff] [blame] | 948 | printk(KERN_ERR "%s: can't get MMIO memory @ 0x%llx\n", |
| 949 | dev->name,(unsigned long long)pci_resource_start(pci_dev,0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 950 | goto fail1; |
| 951 | } |
Suresh Siddha | d522af5 | 2008-10-20 17:57:02 -0300 | [diff] [blame] | 952 | dev->lmmio = ioremap(pci_resource_start(pci_dev, 0), |
| 953 | pci_resource_len(pci_dev, 0)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 954 | dev->bmmio = (__u8 __iomem *)dev->lmmio; |
| 955 | if (NULL == dev->lmmio) { |
| 956 | err = -EIO; |
| 957 | printk(KERN_ERR "%s: can't ioremap() MMIO memory\n", |
| 958 | dev->name); |
| 959 | goto fail2; |
| 960 | } |
| 961 | |
| 962 | /* initialize hardware #1 */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 963 | saa7134_board_init1(dev); |
| 964 | saa7134_hwinit1(dev); |
| 965 | |
| 966 | /* get irq */ |
| 967 | err = request_irq(pci_dev->irq, saa7134_irq, |
Thomas Gleixner | 8076fe3 | 2006-07-01 19:29:37 -0700 | [diff] [blame] | 968 | IRQF_SHARED | IRQF_DISABLED, dev->name, dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 969 | if (err < 0) { |
| 970 | printk(KERN_ERR "%s: can't get IRQ %d\n", |
| 971 | dev->name,pci_dev->irq); |
| 972 | goto fail3; |
| 973 | } |
| 974 | |
| 975 | /* wait a bit, register i2c bus */ |
| 976 | msleep(100); |
| 977 | saa7134_i2c_register(dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 978 | saa7134_board_init2(dev); |
Mauro Carvalho Chehab | c030f5e | 2008-02-19 16:26:33 -0300 | [diff] [blame] | 979 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 980 | saa7134_hwinit2(dev); |
| 981 | |
| 982 | /* load i2c helpers */ |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 983 | if (card_is_empress(dev)) { |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 984 | struct v4l2_subdev *sd = |
Hans Verkuil | 195784b | 2009-03-28 09:27:02 -0300 | [diff] [blame] | 985 | v4l2_i2c_new_subdev(&dev->i2c_adap, |
| 986 | "saa6752hs", "saa6752hs", |
| 987 | saa7134_boards[dev->board].empress_addr); |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 988 | |
| 989 | if (sd) |
| 990 | sd->grp_id = GRP_EMPRESS; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 991 | } |
Mauro Carvalho Chehab | 330a115 | 2005-07-12 13:59:01 -0700 | [diff] [blame] | 992 | |
Hans Verkuil | 2983baf | 2009-03-29 06:26:27 -0300 | [diff] [blame] | 993 | if (saa7134_boards[dev->board].rds_addr) { |
| 994 | unsigned short addrs[2] = { 0, I2C_CLIENT_END }; |
| 995 | struct v4l2_subdev *sd; |
| 996 | |
| 997 | addrs[0] = saa7134_boards[dev->board].rds_addr; |
| 998 | sd = v4l2_i2c_new_probed_subdev(&dev->i2c_adap, "saa6588", |
| 999 | "saa6588", addrs); |
| 1000 | if (sd) |
| 1001 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); |
| 1002 | } |
| 1003 | |
Markus Rechberger | 4217e25 | 2007-04-27 12:31:17 -0300 | [diff] [blame] | 1004 | request_submodules(dev); |
Ricardo Cerqueira | b54134b | 2005-11-08 21:38:54 -0800 | [diff] [blame] | 1005 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1006 | v4l2_prio_init(&dev->prio); |
| 1007 | |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1008 | mutex_lock(&saa7134_devlist_lock); |
| 1009 | list_for_each_entry(mops, &mops_list, next) |
| 1010 | mpeg_ops_attach(mops, dev); |
| 1011 | list_add_tail(&dev->devlist, &saa7134_devlist); |
| 1012 | mutex_unlock(&saa7134_devlist_lock); |
| 1013 | |
| 1014 | /* check for signal */ |
| 1015 | saa7134_irq_video_signalchange(dev); |
| 1016 | |
| 1017 | if (TUNER_ABSENT != dev->tuner_type) |
| 1018 | saa_call_all(dev, core, s_standby, 0); |
| 1019 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1020 | /* register v4l devices */ |
Hans Verkuil | 0ea6bc8 | 2008-07-26 08:26:43 -0300 | [diff] [blame] | 1021 | if (saa7134_no_overlay > 0) |
| 1022 | printk(KERN_INFO "%s: Overlay support disabled.\n", dev->name); |
| 1023 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1024 | dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); |
| 1025 | err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, |
| 1026 | video_nr[dev->nr]); |
| 1027 | if (err < 0) { |
| 1028 | printk(KERN_INFO "%s: can't register video device\n", |
| 1029 | dev->name); |
| 1030 | goto fail4; |
| 1031 | } |
| 1032 | printk(KERN_INFO "%s: registered device video%d [v4l2]\n", |
Hans Verkuil | c6330fb | 2008-10-19 18:54:26 -0300 | [diff] [blame] | 1033 | dev->name, dev->video_dev->num); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1034 | |
Mauro Carvalho Chehab | a962239 | 2007-12-11 12:05:06 -0300 | [diff] [blame] | 1035 | dev->vbi_dev = vdev_init(dev, &saa7134_video_template, "vbi"); |
Mauro Carvalho Chehab | a962239 | 2007-12-11 12:05:06 -0300 | [diff] [blame] | 1036 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1037 | err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI, |
| 1038 | vbi_nr[dev->nr]); |
| 1039 | if (err < 0) |
| 1040 | goto fail4; |
| 1041 | printk(KERN_INFO "%s: registered device vbi%d\n", |
Hans Verkuil | c6330fb | 2008-10-19 18:54:26 -0300 | [diff] [blame] | 1042 | dev->name, dev->vbi_dev->num); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1043 | |
| 1044 | if (card_has_radio(dev)) { |
| 1045 | dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio"); |
| 1046 | err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO, |
| 1047 | radio_nr[dev->nr]); |
| 1048 | if (err < 0) |
| 1049 | goto fail4; |
| 1050 | printk(KERN_INFO "%s: registered device radio%d\n", |
Hans Verkuil | c6330fb | 2008-10-19 18:54:26 -0300 | [diff] [blame] | 1051 | dev->name, dev->radio_dev->num); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1052 | } |
| 1053 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1054 | /* everything worked */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1055 | saa7134_devcount++; |
| 1056 | |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1057 | if (saa7134_dmasound_init && !dev->dmasound.priv_data) |
Adrian Bunk | 7845701 | 2006-07-15 15:19:56 -0300 | [diff] [blame] | 1058 | saa7134_dmasound_init(dev); |
Hartmut Hackmann | 80d3523 | 2007-03-13 20:44:22 -0300 | [diff] [blame] | 1059 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1060 | return 0; |
| 1061 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1062 | fail4: |
| 1063 | saa7134_unregister_video(dev); |
| 1064 | saa7134_i2c_unregister(dev); |
| 1065 | free_irq(pci_dev->irq, dev); |
| 1066 | fail3: |
| 1067 | saa7134_hwfini(dev); |
| 1068 | iounmap(dev->lmmio); |
| 1069 | fail2: |
| 1070 | release_mem_region(pci_resource_start(pci_dev,0), |
| 1071 | pci_resource_len(pci_dev,0)); |
| 1072 | fail1: |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 1073 | v4l2_device_unregister(&dev->v4l2_dev); |
| 1074 | fail0: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1075 | kfree(dev); |
| 1076 | return err; |
| 1077 | } |
| 1078 | |
| 1079 | static void __devexit saa7134_finidev(struct pci_dev *pci_dev) |
| 1080 | { |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 1081 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
| 1082 | struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1083 | struct saa7134_mpeg_ops *mops; |
| 1084 | |
Ricardo Cerqueira | f5b974c | 2005-12-01 00:51:20 -0800 | [diff] [blame] | 1085 | /* Release DMA sound modules if present */ |
Adrian Bunk | 7845701 | 2006-07-15 15:19:56 -0300 | [diff] [blame] | 1086 | if (saa7134_dmasound_exit && dev->dmasound.priv_data) { |
| 1087 | saa7134_dmasound_exit(dev); |
Ricardo Cerqueira | f5b974c | 2005-12-01 00:51:20 -0800 | [diff] [blame] | 1088 | } |
| 1089 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1090 | /* debugging ... */ |
| 1091 | if (irq_debug) { |
| 1092 | u32 report = saa_readl(SAA7134_IRQ_REPORT); |
| 1093 | u32 status = saa_readl(SAA7134_IRQ_STATUS); |
| 1094 | print_irqstatus(dev,42,report,status); |
| 1095 | } |
| 1096 | |
| 1097 | /* disable peripheral devices */ |
| 1098 | saa_writeb(SAA7134_SPECIAL_MODE,0); |
| 1099 | |
| 1100 | /* shutdown hardware */ |
| 1101 | saa_writel(SAA7134_IRQ1,0); |
| 1102 | saa_writel(SAA7134_IRQ2,0); |
| 1103 | saa_writel(SAA7134_MAIN_CTRL,0); |
| 1104 | |
| 1105 | /* shutdown subsystems */ |
| 1106 | saa7134_hwfini(dev); |
| 1107 | |
| 1108 | /* unregister */ |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1109 | mutex_lock(&saa7134_devlist_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1110 | list_del(&dev->devlist); |
Trent Piepho | 6d28e98 | 2007-10-10 05:37:42 -0300 | [diff] [blame] | 1111 | list_for_each_entry(mops, &mops_list, next) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1112 | mpeg_ops_detach(mops, dev); |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1113 | mutex_unlock(&saa7134_devlist_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1114 | saa7134_devcount--; |
| 1115 | |
| 1116 | saa7134_i2c_unregister(dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1117 | saa7134_unregister_video(dev); |
| 1118 | |
Ricardo Cerqueira | f5b974c | 2005-12-01 00:51:20 -0800 | [diff] [blame] | 1119 | |
Ricardo Cerqueira | 4aabf63 | 2005-11-13 16:08:00 -0800 | [diff] [blame] | 1120 | /* the DMA sound modules should be unloaded before reaching |
| 1121 | this, but just in case they are still present... */ |
| 1122 | if (dev->dmasound.priv_data != NULL) { |
| 1123 | free_irq(pci_dev->irq, &dev->dmasound); |
| 1124 | dev->dmasound.priv_data = NULL; |
| 1125 | } |
| 1126 | |
Ricardo Cerqueira | f5b974c | 2005-12-01 00:51:20 -0800 | [diff] [blame] | 1127 | |
Ricardo Cerqueira | 4aabf63 | 2005-11-13 16:08:00 -0800 | [diff] [blame] | 1128 | /* release resources */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1129 | free_irq(pci_dev->irq, dev); |
| 1130 | iounmap(dev->lmmio); |
| 1131 | release_mem_region(pci_resource_start(pci_dev,0), |
| 1132 | pci_resource_len(pci_dev,0)); |
| 1133 | |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 1134 | |
| 1135 | v4l2_device_unregister(&dev->v4l2_dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1136 | |
| 1137 | /* free memory */ |
| 1138 | kfree(dev); |
| 1139 | } |
| 1140 | |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1141 | #ifdef CONFIG_PM |
Alexander Beregalov | 05d26cc | 2008-08-20 20:44:54 -0300 | [diff] [blame] | 1142 | |
| 1143 | /* resends a current buffer in queue after resume */ |
| 1144 | static int saa7134_buffer_requeue(struct saa7134_dev *dev, |
| 1145 | struct saa7134_dmaqueue *q) |
| 1146 | { |
| 1147 | struct saa7134_buf *buf, *next; |
| 1148 | |
| 1149 | assert_spin_locked(&dev->slock); |
| 1150 | |
| 1151 | buf = q->curr; |
| 1152 | next = buf; |
| 1153 | dprintk("buffer_requeue\n"); |
| 1154 | |
| 1155 | if (!buf) |
| 1156 | return 0; |
| 1157 | |
| 1158 | dprintk("buffer_requeue : resending active buffers \n"); |
| 1159 | |
| 1160 | if (!list_empty(&q->queue)) |
| 1161 | next = list_entry(q->queue.next, struct saa7134_buf, |
| 1162 | vb.queue); |
| 1163 | buf->activate(dev, buf, next); |
| 1164 | |
| 1165 | return 0; |
| 1166 | } |
| 1167 | |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1168 | static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state) |
| 1169 | { |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 1170 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
| 1171 | struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1172 | |
Maxim Levitsky | acd827d | 2007-10-08 12:07:35 -0300 | [diff] [blame] | 1173 | /* disable overlay - apps should enable it explicitly on resume*/ |
| 1174 | dev->ovenable = 0; |
| 1175 | |
| 1176 | /* Disable interrupts, DMA, and rest of the chip*/ |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1177 | saa_writel(SAA7134_IRQ1, 0); |
| 1178 | saa_writel(SAA7134_IRQ2, 0); |
Maxim Levitsky | acd827d | 2007-10-08 12:07:35 -0300 | [diff] [blame] | 1179 | saa_writel(SAA7134_MAIN_CTRL, 0); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1180 | |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1181 | dev->insuspend = 1; |
Maxim Levitsky | 3203cb8 | 2007-11-04 19:34:23 -0300 | [diff] [blame] | 1182 | synchronize_irq(pci_dev->irq); |
| 1183 | |
| 1184 | /* ACK interrupts once more, just in case, |
| 1185 | since the IRQ handler won't ack them anymore*/ |
| 1186 | |
| 1187 | saa_writel(SAA7134_IRQ_REPORT, saa_readl(SAA7134_IRQ_REPORT)); |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1188 | |
| 1189 | /* Disable timeout timers - if we have active buffers, we will |
| 1190 | fill them on resume*/ |
| 1191 | |
| 1192 | del_timer(&dev->video_q.timeout); |
| 1193 | del_timer(&dev->vbi_q.timeout); |
| 1194 | del_timer(&dev->ts_q.timeout); |
Matthias Schwarzott | f40aa80 | 2007-10-18 14:58:11 -0300 | [diff] [blame] | 1195 | |
| 1196 | if (dev->remote) |
| 1197 | saa7134_ir_stop(dev); |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1198 | |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1199 | pci_save_state(pci_dev); |
Maxim Levitsky | 0d65cd4 | 2007-11-04 17:59:28 -0300 | [diff] [blame] | 1200 | pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1201 | |
Maxim Levitsky | 0d65cd4 | 2007-11-04 17:59:28 -0300 | [diff] [blame] | 1202 | return 0; |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1203 | } |
| 1204 | |
| 1205 | static int saa7134_resume(struct pci_dev *pci_dev) |
| 1206 | { |
Hans Verkuil | fac6986 | 2009-01-17 12:17:14 -0300 | [diff] [blame] | 1207 | struct v4l2_device *v4l2_dev = pci_get_drvdata(pci_dev); |
| 1208 | struct saa7134_dev *dev = container_of(v4l2_dev, struct saa7134_dev, v4l2_dev); |
Daniel Walker | a3c53e2 | 2008-01-17 12:52:05 -0800 | [diff] [blame] | 1209 | unsigned long flags; |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1210 | |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1211 | pci_set_power_state(pci_dev, PCI_D0); |
Maxim Levitsky | 0d65cd4 | 2007-11-04 17:59:28 -0300 | [diff] [blame] | 1212 | pci_restore_state(pci_dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1213 | |
| 1214 | /* Do things that are done in saa7134_initdev , |
| 1215 | except of initializing memory structures.*/ |
| 1216 | |
| 1217 | saa7134_board_init1(dev); |
| 1218 | |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1219 | /* saa7134_hwinit1 */ |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1220 | if (saa7134_boards[dev->board].video_out) |
| 1221 | saa7134_videoport_init(dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1222 | if (card_has_mpeg(dev)) |
| 1223 | saa7134_ts_init_hw(dev); |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1224 | if (dev->remote) |
| 1225 | saa7134_ir_start(dev, dev->remote); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1226 | saa7134_hw_enable1(dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1227 | |
Maxim Levitsky | 5c01203 | 2007-11-04 18:21:25 -0300 | [diff] [blame] | 1228 | msleep(100); |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1229 | |
| 1230 | saa7134_board_init2(dev); |
| 1231 | |
| 1232 | /*saa7134_hwinit2*/ |
| 1233 | saa7134_set_tvnorm_hw(dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1234 | saa7134_tvaudio_setmute(dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1235 | saa7134_tvaudio_setvolume(dev, dev->ctl_volume); |
Maxim Levitsky | f36224d | 2007-10-23 00:58:59 -0300 | [diff] [blame] | 1236 | saa7134_tvaudio_init(dev); |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1237 | saa7134_tvaudio_do_scan(dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1238 | saa7134_enable_i2s(dev); |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1239 | saa7134_hw_enable2(dev); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1240 | |
Maxim Levitsky | 5c01203 | 2007-11-04 18:21:25 -0300 | [diff] [blame] | 1241 | saa7134_irq_video_signalchange(dev); |
| 1242 | |
Maxim Levitsky | acd827d | 2007-10-08 12:07:35 -0300 | [diff] [blame] | 1243 | /*resume unfinished buffer(s)*/ |
| 1244 | spin_lock_irqsave(&dev->slock, flags); |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1245 | saa7134_buffer_requeue(dev, &dev->video_q); |
| 1246 | saa7134_buffer_requeue(dev, &dev->vbi_q); |
| 1247 | saa7134_buffer_requeue(dev, &dev->ts_q); |
| 1248 | |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1249 | /* FIXME: Disable DMA audio sound - temporary till proper support |
| 1250 | is implemented*/ |
| 1251 | |
| 1252 | dev->dmasound.dma_running = 0; |
| 1253 | |
Maxim Levitsky | acd827d | 2007-10-08 12:07:35 -0300 | [diff] [blame] | 1254 | /* start DMA now*/ |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1255 | dev->insuspend = 0; |
Maxim Levitsky | 3203cb8 | 2007-11-04 19:34:23 -0300 | [diff] [blame] | 1256 | smp_wmb(); |
Maxim Levitsky | acd827d | 2007-10-08 12:07:35 -0300 | [diff] [blame] | 1257 | saa7134_set_dmabits(dev); |
| 1258 | spin_unlock_irqrestore(&dev->slock, flags); |
| 1259 | |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1260 | return 0; |
| 1261 | } |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1262 | #endif |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1263 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1264 | /* ----------------------------------------------------------- */ |
| 1265 | |
| 1266 | int saa7134_ts_register(struct saa7134_mpeg_ops *ops) |
| 1267 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1268 | struct saa7134_dev *dev; |
| 1269 | |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1270 | mutex_lock(&saa7134_devlist_lock); |
Trent Piepho | 6d28e98 | 2007-10-10 05:37:42 -0300 | [diff] [blame] | 1271 | list_for_each_entry(dev, &saa7134_devlist, devlist) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1272 | mpeg_ops_attach(ops, dev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1273 | list_add_tail(&ops->next,&mops_list); |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1274 | mutex_unlock(&saa7134_devlist_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1275 | return 0; |
| 1276 | } |
| 1277 | |
| 1278 | void saa7134_ts_unregister(struct saa7134_mpeg_ops *ops) |
| 1279 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1280 | struct saa7134_dev *dev; |
| 1281 | |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1282 | mutex_lock(&saa7134_devlist_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1283 | list_del(&ops->next); |
Trent Piepho | 6d28e98 | 2007-10-10 05:37:42 -0300 | [diff] [blame] | 1284 | list_for_each_entry(dev, &saa7134_devlist, devlist) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1285 | mpeg_ops_detach(ops, dev); |
Mauro Carvalho Chehab | befd6e6 | 2009-02-09 12:27:03 -0300 | [diff] [blame] | 1286 | mutex_unlock(&saa7134_devlist_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1287 | } |
| 1288 | |
| 1289 | EXPORT_SYMBOL(saa7134_ts_register); |
| 1290 | EXPORT_SYMBOL(saa7134_ts_unregister); |
| 1291 | |
| 1292 | /* ----------------------------------------------------------- */ |
| 1293 | |
| 1294 | static struct pci_driver saa7134_pci_driver = { |
Mauro Carvalho Chehab | 4ac9791 | 2005-11-08 21:37:43 -0800 | [diff] [blame] | 1295 | .name = "saa7134", |
| 1296 | .id_table = saa7134_pci_tbl, |
| 1297 | .probe = saa7134_initdev, |
| 1298 | .remove = __devexit_p(saa7134_finidev), |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1299 | #ifdef CONFIG_PM |
Maxim Levitsky | cb71201 | 2007-09-27 20:34:25 -0300 | [diff] [blame] | 1300 | .suspend = saa7134_suspend, |
| 1301 | .resume = saa7134_resume |
Maxim Levitsky | c458473 | 2007-10-12 00:57:15 -0300 | [diff] [blame] | 1302 | #endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1303 | }; |
| 1304 | |
| 1305 | static int saa7134_init(void) |
| 1306 | { |
| 1307 | INIT_LIST_HEAD(&saa7134_devlist); |
| 1308 | printk(KERN_INFO "saa7130/34: v4l2 driver version %d.%d.%d loaded\n", |
| 1309 | (SAA7134_VERSION_CODE >> 16) & 0xff, |
| 1310 | (SAA7134_VERSION_CODE >> 8) & 0xff, |
| 1311 | SAA7134_VERSION_CODE & 0xff); |
| 1312 | #ifdef SNAPSHOT |
| 1313 | printk(KERN_INFO "saa7130/34: snapshot date %04d-%02d-%02d\n", |
| 1314 | SNAPSHOT/10000, (SNAPSHOT/100)%100, SNAPSHOT%100); |
| 1315 | #endif |
Otavio Salvador | 2304759 | 2006-01-09 15:25:17 -0200 | [diff] [blame] | 1316 | return pci_register_driver(&saa7134_pci_driver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1317 | } |
| 1318 | |
| 1319 | static void saa7134_fini(void) |
| 1320 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1321 | pci_unregister_driver(&saa7134_pci_driver); |
| 1322 | } |
| 1323 | |
| 1324 | module_init(saa7134_init); |
| 1325 | module_exit(saa7134_fini); |
| 1326 | |
| 1327 | /* ----------------------------------------------------------- */ |
| 1328 | |
Hartmut Hackmann | 58ef4f9 | 2007-04-27 12:31:12 -0300 | [diff] [blame] | 1329 | EXPORT_SYMBOL(saa7134_set_gpio); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1330 | EXPORT_SYMBOL(saa7134_boards); |
| 1331 | |
Ricardo Cerqueira | 4aabf63 | 2005-11-13 16:08:00 -0800 | [diff] [blame] | 1332 | /* ----------------- for the DMA sound modules --------------- */ |
Ricardo Cerqueira | 79dd0c69 | 2005-11-08 21:38:53 -0800 | [diff] [blame] | 1333 | |
Adrian Bunk | 7845701 | 2006-07-15 15:19:56 -0300 | [diff] [blame] | 1334 | EXPORT_SYMBOL(saa7134_dmasound_init); |
| 1335 | EXPORT_SYMBOL(saa7134_dmasound_exit); |
Ricardo Cerqueira | 79dd0c69 | 2005-11-08 21:38:53 -0800 | [diff] [blame] | 1336 | EXPORT_SYMBOL(saa7134_pgtable_free); |
| 1337 | EXPORT_SYMBOL(saa7134_pgtable_build); |
| 1338 | EXPORT_SYMBOL(saa7134_pgtable_alloc); |
| 1339 | EXPORT_SYMBOL(saa7134_set_dmabits); |
| 1340 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1341 | /* ----------------------------------------------------------- */ |
| 1342 | /* |
| 1343 | * Local variables: |
| 1344 | * c-basic-offset: 8 |
| 1345 | * End: |
| 1346 | */ |