Release 4.7 drivers/media/pci/cx88/cx88-mpeg.c
/*
*
* Support for the mpeg transport stream transfers
* PCI function #2 of the cx2388x.
*
* (c) 2004 Jelle Foks <jelle@foks.us>
* (c) 2004 Chris Pascoe <c.pascoe@itee.uq.edu.au>
* (c) 2004 Gerd Knorr <kraxel@bytesex.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <asm/delay.h>
#include "cx88.h"
/* ------------------------------------------------------------------ */
MODULE_DESCRIPTION("mpeg driver for cx2388x based TV cards");
MODULE_AUTHOR("Jelle Foks <jelle@foks.us>");
MODULE_AUTHOR("Chris Pascoe <c.pascoe@itee.uq.edu.au>");
MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
MODULE_LICENSE("GPL");
MODULE_VERSION(CX88_VERSION);
static unsigned int debug;
module_param(debug,int,0644);
MODULE_PARM_DESC(debug,"enable debug messages [mpeg]");
#define dprintk(level, fmt, arg...) do { \
if (debug + 1 > level) \
printk(KERN_DEBUG "%s/2-mpeg: " fmt, dev->core->name, ## arg); \
} while(0)
#define mpeg_dbg(level, fmt, arg...) do { \
if (debug + 1 > level) \
printk(KERN_DEBUG "%s/2-mpeg: " fmt, core->name, ## arg); \
} while(0)
#if defined(CONFIG_MODULES) && defined(MODULE)
static void request_module_async(struct work_struct *work)
{
struct cx8802_dev *dev=container_of(work, struct cx8802_dev, request_module_wk);
if (dev->core->board.mpeg & CX88_MPEG_DVB)
request_module("cx88-dvb");
if (dev->core->board.mpeg & CX88_MPEG_BLACKBIRD)
request_module("cx88-blackbird");
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
markus rechberger | markus rechberger | 60 | 100.00% | 2 | 100.00% |
| Total | 60 | 100.00% | 2 | 100.00% |
static void request_modules(struct cx8802_dev *dev)
{
INIT_WORK(&dev->request_module_wk, request_module_async);
schedule_work(&dev->request_module_wk);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
markus rechberger | markus rechberger | 29 | 100.00% | 1 | 100.00% |
| Total | 29 | 100.00% | 1 | 100.00% |
static void flush_request_modules(struct cx8802_dev *dev)
{
flush_work(&dev->request_module_wk);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
tejun heo | tejun heo | 19 | 100.00% | 2 | 100.00% |
| Total | 19 | 100.00% | 2 | 100.00% |
#else
#define request_modules(dev)
#define flush_request_modules(dev)
#endif /* CONFIG_MODULES */
static LIST_HEAD(cx8802_devlist);
static DEFINE_MUTEX(cx8802_mutex);
/* ------------------------------------------------------------------ */
int cx8802_start_dma(struct cx8802_dev *dev,
struct cx88_dmaqueue *q,
struct cx88_buffer *buf)
{
struct cx88_core *core = dev->core;
dprintk(1, "cx8802_start_dma w: %d, h: %d, f: %d\n",
core->width, core->height, core->field);
/* setup fifo + format */
cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28],
dev->ts_packet_size, buf->risc.dma);
/* write TS length to chip */
cx_write(MO_TS_LNGTH, dev->ts_packet_size);
/* FIXME: this needs a review.
* also: move to cx88-blackbird + cx88-dvb source files? */
dprintk( 1, "core->active_type_id = 0x%08x\n", core->active_type_id);
if ( (core->active_type_id == CX88_MPEG_DVB) &&
(core->board.mpeg & CX88_MPEG_DVB) ) {
dprintk( 1, "cx8802_start_dma doing .dvb\n");
/* negedge driven & software reset */
cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl);
udelay(100);
cx_write(MO_PINMUX_IO, 0x00);
cx_write(TS_HW_SOP_CNTRL, 0x47<<16|188<<4|0x01);
switch (core->boardnr) {
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T:
case CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD:
case CX88_BOARD_PCHDTV_HD5500:
cx_write(TS_SOP_STAT, 1<<13);
break;
case CX88_BOARD_SAMSUNG_SMT_7020:
cx_write(TS_SOP_STAT, 0x00);
break;
case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
cx_write(MO_PINMUX_IO, 0x88); /* Enable MPEG parallel IO and video signal pins */
udelay(100);
break;
case CX88_BOARD_HAUPPAUGE_HVR1300:
/* Enable MPEG parallel IO and video signal pins */
cx_write(MO_PINMUX_IO, 0x88);
cx_write(TS_SOP_STAT, 0);
cx_write(TS_VALERR_CNTRL, 0);
break;
case CX88_BOARD_PINNACLE_PCTV_HD_800i:
/* Enable MPEG parallel IO and video signal pins */
cx_write(MO_PINMUX_IO, 0x88);
cx_write(TS_HW_SOP_CNTRL, (0x47 << 16) | (188 << 4));
dev->ts_gen_cntrl = 5;
cx_write(TS_SOP_STAT, 0);
cx_write(TS_VALERR_CNTRL, 0);
udelay(100);
break;
default:
cx_write(TS_SOP_STAT, 0x00);
break;
}
cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl);
udelay(100);
} else if ( (core->active_type_id == CX88_MPEG_BLACKBIRD) &&
(core->board.mpeg & CX88_MPEG_BLACKBIRD) ) {
dprintk( 1, "cx8802_start_dma doing .blackbird\n");
cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */
cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */
udelay(100);
cx_write(TS_HW_SOP_CNTRL, 0x408); /* mpeg start byte */
cx_write(TS_VALERR_CNTRL, 0x2000);
cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */
udelay(100);
} else {
printk( "%s() Failed. Unsupported value in .mpeg (0x%08x)\n", __func__,
core->board.mpeg );
return -EINVAL;
}
/* reset counter */
cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET);
q->count = 0;
/* enable irqs */
dprintk( 1, "setting the interrupt mask\n" );
cx_set(MO_PCI_INTMSK, core->pci_irqmask | PCI_INT_TSINT);
cx_set(MO_TS_INTMSK, 0x1f0011);
/* start dma */
cx_set(MO_DEV_CNTRL2, (1<<5));
cx_set(MO_TS_DMACNTRL, 0x11);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 222 | 45.77% | 2 | 8.70% |
steven toth | steven toth | 148 | 30.52% | 5 | 21.74% |
michael krufky | michael krufky | 38 | 7.84% | 3 | 13.04% |
sohail syyed | sohail syyed | 22 | 4.54% | 1 | 4.35% |
mauro carvalho chehab | mauro carvalho chehab | 22 | 4.54% | 2 | 8.70% |
dirk herrendoerfer | dirk herrendoerfer | 11 | 2.27% | 1 | 4.35% |
catalin climov | catalin climov | 8 | 1.65% | 1 | 4.35% |
hans verkuil | hans verkuil | 6 | 1.24% | 3 | 13.04% |
trent piepho | trent piepho | 4 | 0.82% | 3 | 13.04% |
rusty scott | rusty scott | 3 | 0.62% | 1 | 4.35% |
harvey harrison | harvey harrison | 1 | 0.21% | 1 | 4.35% |
| Total | 485 | 100.00% | 23 | 100.00% |
static int cx8802_stop_dma(struct cx8802_dev *dev)
{
struct cx88_core *core = dev->core;
dprintk( 1, "cx8802_stop_dma\n" );
/* stop dma */
cx_clear(MO_TS_DMACNTRL, 0x11);
/* disable irqs */
cx_clear(MO_PCI_INTMSK, PCI_INT_TSINT);
cx_clear(MO_TS_INTMSK, 0x1f0011);
/* Reset the controller */
cx_write(TS_GEN_CNTRL, 0xcd);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 53 | 86.89% | 1 | 25.00% |
mauro carvalho chehab | mauro carvalho chehab | 6 | 9.84% | 1 | 25.00% |
trent piepho | trent piepho | 2 | 3.28% | 2 | 50.00% |
| Total | 61 | 100.00% | 4 | 100.00% |
static int cx8802_restart_queue(struct cx8802_dev *dev,
struct cx88_dmaqueue *q)
{
struct cx88_buffer *buf;
dprintk( 1, "cx8802_restart_queue\n" );
if (list_empty(&q->active))
return 0;
buf = list_entry(q->active.next, struct cx88_buffer, list);
dprintk(2,"restart_queue [%p/%d]: restart dma\n",
buf, buf->vb.vb2_buf.index);
cx8802_start_dma(dev, q, buf);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 75 | 87.21% | 1 | 20.00% |
mauro carvalho chehab | mauro carvalho chehab | 6 | 6.98% | 1 | 20.00% |
hans verkuil | hans verkuil | 3 | 3.49% | 1 | 20.00% |
junghak sung | junghak sung | 1 | 1.16% | 1 | 20.00% |
jelle foks | jelle foks | 1 | 1.16% | 1 | 20.00% |
| Total | 86 | 100.00% | 5 | 100.00% |
/* ------------------------------------------------------------------ */
int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev,
struct cx88_buffer *buf)
{
int size = dev->ts_packet_size * dev->ts_packet_count;
struct sg_table *sgt = vb2_dma_sg_plane_desc(&buf->vb.vb2_buf, 0);
struct cx88_riscmem *risc = &buf->risc;
int rc;
if (vb2_plane_size(&buf->vb.vb2_buf, 0) < size)
return -EINVAL;
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, size);
rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl,
dev->ts_packet_size, dev->ts_packet_count, 0);
if (rc) {
if (risc->cpu)
pci_free_consistent(dev->pci, risc->size, risc->cpu, risc->dma);
memset(risc, 0, sizeof(*risc));
return rc;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
hans verkuil | hans verkuil | 85 | 50.00% | 3 | 37.50% |
gerd knorr | gerd knorr | 62 | 36.47% | 1 | 12.50% |
mauro carvalho chehab | mauro carvalho chehab | 15 | 8.82% | 2 | 25.00% |
junghak sung | junghak sung | 6 | 3.53% | 1 | 12.50% |
trent piepho | trent piepho | 2 | 1.18% | 1 | 12.50% |
| Total | 170 | 100.00% | 8 | 100.00% |
void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf)
{
struct cx88_buffer *prev;
struct cx88_dmaqueue *cx88q = &dev->mpegq;
dprintk( 1, "cx8802_buf_queue\n" );
/* add jump to start */
buf->risc.cpu[1] = cpu_to_le32(buf->risc.dma + 8);
buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_CNT_INC);
buf->risc.jmp[1] = cpu_to_le32(buf->risc.dma + 8);
if (list_empty(&cx88q->active)) {
dprintk( 1, "queue is empty - first active\n" );
list_add_tail(&buf->list, &cx88q->active);
dprintk(1,"[%p/%d] %s - first active\n",
buf, buf->vb.vb2_buf.index, __func__);
} else {
buf->risc.cpu[0] |= cpu_to_le32(RISC_IRQ1);
dprintk( 1, "queue is not empty - append to active\n" );
prev = list_entry(cx88q->active.prev, struct cx88_buffer, list);
list_add_tail(&buf->list, &cx88q->active);
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
dprintk( 1, "[%p/%d] %s - append to active\n",
buf, buf->vb.vb2_buf.index, __func__);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 157 | 66.81% | 1 | 14.29% |
hans verkuil | hans verkuil | 46 | 19.57% | 1 | 14.29% |
mauro carvalho chehab | mauro carvalho chehab | 26 | 11.06% | 2 | 28.57% |
harvey harrison | harvey harrison | 2 | 0.85% | 1 | 14.29% |
junghak sung | junghak sung | 2 | 0.85% | 1 | 14.29% |
trent piepho | trent piepho | 2 | 0.85% | 1 | 14.29% |
| Total | 235 | 100.00% | 7 | 100.00% |
/* ----------------------------------------------------------- */
static void do_cancel_buffers(struct cx8802_dev *dev)
{
struct cx88_dmaqueue *q = &dev->mpegq;
struct cx88_buffer *buf;
unsigned long flags;
spin_lock_irqsave(&dev->slock,flags);
while (!list_empty(&q->active)) {
buf = list_entry(q->active.next, struct cx88_buffer, list);
list_del(&buf->list);
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_ERROR);
}
spin_unlock_irqrestore(&dev->slock,flags);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 91 | 91.92% | 1 | 25.00% |
hans verkuil | hans verkuil | 4 | 4.04% | 1 | 25.00% |
junghak sung | junghak sung | 2 | 2.02% | 1 | 25.00% |
mauro carvalho chehab | mauro carvalho chehab | 2 | 2.02% | 1 | 25.00% |
| Total | 99 | 100.00% | 4 | 100.00% |
void cx8802_cancel_buffers(struct cx8802_dev *dev)
{
dprintk( 1, "cx8802_cancel_buffers" );
cx8802_stop_dma(dev);
do_cancel_buffers(dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 20 | 74.07% | 1 | 50.00% |
mauro carvalho chehab | mauro carvalho chehab | 7 | 25.93% | 1 | 50.00% |
| Total | 27 | 100.00% | 2 | 100.00% |
static const char * cx88_mpeg_irqs[32] = {
"ts_risci1", NULL, NULL, NULL,
"ts_risci2", NULL, NULL, NULL,
"ts_oflow", NULL, NULL, NULL,
"ts_sync", NULL, NULL, NULL,
"opc_err", "par_err", "rip_err", "pci_abort",
"ts_err?",
};
static void cx8802_mpeg_irq(struct cx8802_dev *dev)
{
struct cx88_core *core = dev->core;
u32 status, mask, count;
dprintk( 1, "cx8802_mpeg_irq\n" );
status = cx_read(MO_TS_INTSTAT);
mask = cx_read(MO_TS_INTMSK);
if (0 == (status & mask))
return;
cx_write(MO_TS_INTSTAT, status);
if (debug || (status & mask & ~0xff))
cx88_print_irqbits(core->name, "irq mpeg ",
cx88_mpeg_irqs, ARRAY_SIZE(cx88_mpeg_irqs),
status, mask);
/* risc op code error */
if (status & (1 << 16)) {
printk(KERN_WARNING "%s: mpeg risc op code error\n",core->name);
cx_clear(MO_TS_DMACNTRL, 0x11);
cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]);
}
/* risc1 y */
if (status & 0x01) {
dprintk( 1, "wake up\n" );
spin_lock(&dev->slock);
count = cx_read(MO_TS_GPCNT);
cx88_wakeup(dev->core, &dev->mpegq, count);
spin_unlock(&dev->slock);
}
/* other general errors */
if (status & 0x1f0100) {
dprintk( 0, "general errors: 0x%08x\n", status & 0x1f0100 );
spin_lock(&dev->slock);
cx8802_stop_dma(dev);
spin_unlock(&dev->slock);
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 206 | 87.29% | 1 | 33.33% |
mauro carvalho chehab | mauro carvalho chehab | 30 | 12.71% | 2 | 66.67% |
| Total | 236 | 100.00% | 3 | 100.00% |
#define MAX_IRQ_LOOP 10
static irqreturn_t cx8802_irq(int irq, void *dev_id)
{
struct cx8802_dev *dev = dev_id;
struct cx88_core *core = dev->core;
u32 status;
int loop, handled = 0;
for (loop = 0; loop < MAX_IRQ_LOOP; loop++) {
status = cx_read(MO_PCI_INTSTAT) &
(core->pci_irqmask | PCI_INT_TSINT);
if (0 == status)
goto out;
dprintk( 1, "cx8802_irq\n" );
dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP );
dprintk( 1, " status: %d\n", status );
handled = 1;
cx_write(MO_PCI_INTSTAT, status);
if (status & core->pci_irqmask)
cx88_core_irq(core,status);
if (status & PCI_INT_TSINT)
cx8802_mpeg_irq(dev);
}
if (MAX_IRQ_LOOP == loop) {
dprintk( 0, "clearing mask\n" );
printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n",
core->name);
cx_write(MO_PCI_INTMSK,0);
}
out:
return IRQ_RETVAL(handled);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 144 | 79.12% | 2 | 50.00% |
mauro carvalho chehab | mauro carvalho chehab | 36 | 19.78% | 1 | 25.00% |
trent piepho | trent piepho | 2 | 1.10% | 1 | 25.00% |
| Total | 182 | 100.00% | 4 | 100.00% |
static int cx8802_init_common(struct cx8802_dev *dev)
{
struct cx88_core *core = dev->core;
int err;
/* pci init */
if (pci_enable_device(dev->pci))
return -EIO;
pci_set_master(dev->pci);
err = pci_set_dma_mask(dev->pci,DMA_BIT_MASK(32));
if (err) {
printk("%s/2: Oops: no 32bit PCI DMA ???\n",dev->core->name);
return -EIO;
}
dev->pci_rev = dev->pci->revision;
pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat);
printk(KERN_INFO "%s/2: found at %s, rev: %d, irq: %d, "
"latency: %d, mmio: 0x%llx\n", dev->core->name,
pci_name(dev->pci), dev->pci_rev, dev->pci->irq,
dev->pci_lat,(unsigned long long)pci_resource_start(dev->pci,0));
/* initialize driver struct */
spin_lock_init(&dev->slock);
/* init dma queue */
INIT_LIST_HEAD(&dev->mpegq.active);
/* get irq */
err = request_irq(dev->pci->irq, cx8802_irq,
IRQF_SHARED, dev->core->name, dev);
if (err < 0) {
printk(KERN_ERR "%s: can't get IRQ %d\n",
dev->core->name, dev->pci->irq);
return err;
}
cx_set(MO_PCI_INTMSK, core->pci_irqmask);
/* everything worked */
pci_set_drvdata(dev->pci,dev);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 218 | 88.62% | 2 | 20.00% |
christoph hellwig | christoph hellwig | 7 | 2.85% | 2 | 20.00% |
greg kroah-hartman | greg kroah-hartman | 6 | 2.44% | 1 | 10.00% |
bjorn mork | bjorn mork | 5 | 2.03% | 1 | 10.00% |
thomas gleixner | thomas gleixner | 5 | 2.03% | 2 | 20.00% |
yang hongyang | yang hongyang | 4 | 1.63% | 1 | 10.00% |
adrian bunk | adrian bunk | 1 | 0.41% | 1 | 10.00% |
| Total | 246 | 100.00% | 10 | 100.00% |
static void cx8802_fini_common(struct cx8802_dev *dev)
{
dprintk( 2, "cx8802_fini_common\n" );
cx8802_stop_dma(dev);
pci_disable_device(dev->pci);
/* unregister stuff */
free_irq(dev->pci->irq, dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 34 | 80.95% | 1 | 33.33% |
mauro carvalho chehab | mauro carvalho chehab | 7 | 16.67% | 1 | 33.33% |
adrian bunk | adrian bunk | 1 | 2.38% | 1 | 33.33% |
| Total | 42 | 100.00% | 3 | 100.00% |
/* ----------------------------------------------------------- */
static int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state)
{
struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
struct cx88_core *core = dev->core;
unsigned long flags;
/* stop mpeg dma */
spin_lock_irqsave(&dev->slock, flags);
if (!list_empty(&dev->mpegq.active)) {
dprintk( 2, "suspend\n" );
printk("%s: suspend mpeg\n", core->name);
cx8802_stop_dma(dev);
}
spin_unlock_irqrestore(&dev->slock, flags);
/* FIXME -- shutdown device */
cx88_shutdown(dev->core);
pci_save_state(pci_dev);
if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
pci_disable_device(pci_dev);
dev->state.disabled = 1;
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 123 | 87.23% | 2 | 40.00% |
alexey khoroshilov | alexey khoroshilov | 10 | 7.09% | 1 | 20.00% |
mauro carvalho chehab | mauro carvalho chehab | 7 | 4.96% | 1 | 20.00% |
adrian bunk | adrian bunk | 1 | 0.71% | 1 | 20.00% |
| Total | 141 | 100.00% | 5 | 100.00% |
static int cx8802_resume_common(struct pci_dev *pci_dev)
{
struct cx8802_dev *dev = pci_get_drvdata(pci_dev);
struct cx88_core *core = dev->core;
unsigned long flags;
int err;
if (dev->state.disabled) {
err=pci_enable_device(pci_dev);
if (err) {
printk(KERN_ERR "%s: can't enable device\n",
dev->core->name);
return err;
}
dev->state.disabled = 0;
}
err=pci_set_power_state(pci_dev, PCI_D0);
if (err) {
printk(KERN_ERR "%s: can't enable device\n",
dev->core->name);
pci_disable_device(pci_dev);
dev->state.disabled = 1;
return err;
}
pci_restore_state(pci_dev);
/* FIXME: re-initialize hardware */
cx88_reset(dev->core);
/* restart video+vbi capture */
spin_lock_irqsave(&dev->slock, flags);
if (!list_empty(&dev->mpegq.active)) {
printk("%s: resume mpeg\n", core->name);
cx8802_restart_queue(dev,&dev->mpegq);
}
spin_unlock_irqrestore(&dev->slock, flags);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 124 | 62.94% | 2 | 40.00% |
mauro carvalho chehab | mauro carvalho chehab | 62 | 31.47% | 1 | 20.00% |
alexey khoroshilov | alexey khoroshilov | 10 | 5.08% | 1 | 20.00% |
adrian bunk | adrian bunk | 1 | 0.51% | 1 | 20.00% |
| Total | 197 | 100.00% | 5 | 100.00% |
struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype)
{
struct cx8802_driver *d;
list_for_each_entry(d, &dev->drvlist, drvlist)
if (d->type_id == btype)
return d;
return NULL;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 38 | 88.37% | 1 | 25.00% |
trent piepho | trent piepho | 4 | 9.30% | 2 | 50.00% |
gerd knorr | gerd knorr | 1 | 2.33% | 1 | 25.00% |
| Total | 43 | 100.00% | 4 | 100.00% |
/* Driver asked for hardware access. */
static int cx8802_request_acquire(struct cx8802_driver *drv)
{
struct cx88_core *core = drv->core;
unsigned int i;
/* Fail a request for hardware if the device is busy. */
if (core->active_type_id != CX88_BOARD_NONE &&
core->active_type_id != drv->type_id)
return -EBUSY;
if (drv->type_id == CX88_MPEG_DVB) {
/* When switching to DVB, always set the input to the tuner */
core->last_analog_input = core->input;
core->input = 0;
for (i = 0;
i < (sizeof(core->board.input) / sizeof(struct cx88_input));
i++) {
if (core->board.input[i].type == CX88_VMUX_DVB) {
core->input = i;
break;
}
}
}
if (drv->advise_acquire)
{
core->active_ref++;
if (core->active_type_id == CX88_BOARD_NONE) {
core->active_type_id = drv->type_id;
drv->advise_acquire(drv);
}
mpeg_dbg(1,"%s() Post acquire GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 69 | 38.55% | 1 | 12.50% |
istvan varga | istvan varga | 58 | 32.40% | 1 | 12.50% |
roland stoll | roland stoll | 20 | 11.17% | 1 | 12.50% |
devin heitmueller | devin heitmueller | 19 | 10.61% | 1 | 12.50% |
mauro carvalho chehab | mauro carvalho chehab | 6 | 3.35% | 1 | 12.50% |
ricardo cerqueira | ricardo cerqueira | 5 | 2.79% | 1 | 12.50% |
adrian bunk | adrian bunk | 1 | 0.56% | 1 | 12.50% |
harvey harrison | harvey harrison | 1 | 0.56% | 1 | 12.50% |
| Total | 179 | 100.00% | 8 | 100.00% |
/* Driver asked to release hardware. */
static int cx8802_request_release(struct cx8802_driver *drv)
{
struct cx88_core *core = drv->core;
if (drv->advise_release && --core->active_ref == 0)
{
if (drv->type_id == CX88_MPEG_DVB) {
/* If the DVB driver is releasing, reset the input
state to the last configured analog input */
core->input = core->last_analog_input;
}
drv->advise_release(drv);
core->active_type_id = CX88_BOARD_NONE;
mpeg_dbg(1,"%s() Post release GPIO=%x\n", __func__, cx_read(MO_GP0_IO));
}
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 56 | 66.67% | 1 | 20.00% |
devin heitmueller | devin heitmueller | 19 | 22.62% | 1 | 20.00% |
roland stoll | roland stoll | 7 | 8.33% | 1 | 20.00% |
harvey harrison | harvey harrison | 1 | 1.19% | 1 | 20.00% |
adrian bunk | adrian bunk | 1 | 1.19% | 1 | 20.00% |
| Total | 84 | 100.00% | 5 | 100.00% |
static int cx8802_check_driver(struct cx8802_driver *drv)
{
if (drv == NULL)
return -ENODEV;
if ((drv->type_id != CX88_MPEG_DVB) &&
(drv->type_id != CX88_MPEG_BLACKBIRD))
return -EINVAL;
if ((drv->hw_access != CX8802_DRVCTL_SHARED) &&
(drv->hw_access != CX8802_DRVCTL_EXCLUSIVE))
return -EINVAL;
if ((drv->probe == NULL) ||
(drv->remove == NULL) ||
(drv->advise_acquire == NULL) ||
(drv->advise_release == NULL))
return -EINVAL;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 106 | 100.00% | 1 | 100.00% |
| Total | 106 | 100.00% | 1 | 100.00% |
int cx8802_register_driver(struct cx8802_driver *drv)
{
struct cx8802_dev *dev;
struct cx8802_driver *driver;
int err, i = 0;
printk(KERN_INFO
"cx88/2: registering cx8802 driver, type: %s access: %s\n",
drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
if ((err = cx8802_check_driver(drv)) != 0) {
printk(KERN_ERR "cx88/2: cx8802_driver is invalid\n");
return err;
}
mutex_lock(&cx8802_mutex);
list_for_each_entry(dev, &cx8802_devlist, devlist) {
printk(KERN_INFO
"%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n",
dev->core->name, dev->pci->subsystem_vendor,
dev->pci->subsystem_device, dev->core->board.name,
dev->core->boardnr);
/* Bring up a new struct for each driver instance */
driver = kzalloc(sizeof(*drv),GFP_KERNEL);
if (driver == NULL) {
err = -ENOMEM;
goto out;
}
/* Snapshot of the driver registration data */
drv->core = dev->core;
drv->suspend = cx8802_suspend_common;
drv->resume = cx8802_resume_common;
drv->request_acquire = cx8802_request_acquire;
drv->request_release = cx8802_request_release;
memcpy(driver, drv, sizeof(*driver));
mutex_lock(&drv->core->lock);
err = drv->probe(driver);
if (err == 0) {
i++;
list_add_tail(&driver->drvlist, &dev->drvlist);
} else {
printk(KERN_ERR
"%s/2: cx8802 probe failed, err = %d\n",
dev->core->name, err);
}
mutex_unlock(&drv->core->lock);
}
err = i ? 0 : -ENODEV;
out:
mutex_unlock(&cx8802_mutex);
return err;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 224 | 75.42% | 2 | 25.00% |
jonathan nieder | jonathan nieder | 47 | 15.82% | 2 | 25.00% |
trent piepho | trent piepho | 26 | 8.75% | 4 | 50.00% |
| Total | 297 | 100.00% | 8 | 100.00% |
int cx8802_unregister_driver(struct cx8802_driver *drv)
{
struct cx8802_dev *dev;
struct cx8802_driver *d, *dtmp;
int err = 0;
printk(KERN_INFO
"cx88/2: unregistering cx8802 driver, type: %s access: %s\n",
drv->type_id == CX88_MPEG_DVB ? "dvb" : "blackbird",
drv->hw_access == CX8802_DRVCTL_SHARED ? "shared" : "exclusive");
mutex_lock(&cx8802_mutex);
list_for_each_entry(dev, &cx8802_devlist, devlist) {
printk(KERN_INFO
"%s/2: subsystem: %04x:%04x, board: %s [card=%d]\n",
dev->core->name, dev->pci->subsystem_vendor,
dev->pci->subsystem_device, dev->core->board.name,
dev->core->boardnr);
mutex_lock(&dev->core->lock);
list_for_each_entry_safe(d, dtmp, &dev->drvlist, drvlist) {
/* only unregister the correct driver type */
if (d->type_id != drv->type_id)
continue;
err = d->remove(d);
if (err == 0) {
list_del(&d->drvlist);
kfree(d);
} else
printk(KERN_ERR "%s/2: cx8802 driver remove "
"failed (%d)\n", dev->core->name, err);
}
mutex_unlock(&dev->core->lock);
}
mutex_unlock(&cx8802_mutex);
return err;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 129 | 62.32% | 1 | 14.29% |
trent piepho | trent piepho | 46 | 22.22% | 4 | 57.14% |
jonathan nieder | jonathan nieder | 32 | 15.46% | 2 | 28.57% |
| Total | 207 | 100.00% | 7 | 100.00% |
/* ----------------------------------------------------------- */
static int cx8802_probe(struct pci_dev *pci_dev,
const struct pci_device_id *pci_id)
{
struct cx8802_dev *dev;
struct cx88_core *core;
int err;
/* general setup */
core = cx88_core_get(pci_dev);
if (NULL == core)
return -EINVAL;
printk("%s/2: cx2388x 8802 Driver Manager\n", core->name);
err = -ENODEV;
if (!core->board.mpeg)
goto fail_core;
err = -ENOMEM;
dev = kzalloc(sizeof(*dev),GFP_KERNEL);
if (NULL == dev)
goto fail_core;
dev->pci = pci_dev;
dev->alloc_ctx = vb2_dma_sg_init_ctx(&pci_dev->dev);
if (IS_ERR(dev->alloc_ctx)) {
err = PTR_ERR(dev->alloc_ctx);
goto fail_dev;
}
dev->core = core;
/* Maintain a reference so cx88-video can query the 8802 device. */
core->dvbdev = dev;
err = cx8802_init_common(dev);
if (err != 0)
goto fail_free;
INIT_LIST_HEAD(&dev->drvlist);
mutex_lock(&cx8802_mutex);
list_add_tail(&dev->devlist,&cx8802_devlist);
mutex_unlock(&cx8802_mutex);
/* now autoload cx88-dvb or cx88-blackbird */
request_modules(dev);
return 0;
fail_free:
vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
fail_dev:
kfree(dev);
fail_core:
core->dvbdev = NULL;
cx88_core_put(core,pci_dev);
return err;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 167 | 68.16% | 1 | 14.29% |
hans verkuil | hans verkuil | 41 | 16.73% | 1 | 14.29% |
mauro carvalho chehab | mauro carvalho chehab | 13 | 5.31% | 1 | 14.29% |
jonathan nieder | jonathan nieder | 12 | 4.90% | 1 | 14.29% |
markus rechberger | markus rechberger | 6 | 2.45% | 1 | 14.29% |
christian engelmayer | christian engelmayer | 3 | 1.22% | 1 | 14.29% |
darron broad | darron broad | 3 | 1.22% | 1 | 14.29% |
| Total | 245 | 100.00% | 7 | 100.00% |
static void cx8802_remove(struct pci_dev *pci_dev)
{
struct cx8802_dev *dev;
dev = pci_get_drvdata(pci_dev);
dprintk( 1, "%s\n", __func__);
flush_request_modules(dev);
mutex_lock(&dev->core->lock);
if (!list_empty(&dev->drvlist)) {
struct cx8802_driver *drv, *tmp;
int err;
printk(KERN_WARNING "%s/2: Trying to remove cx8802 driver "
"while cx8802 sub-drivers still loaded?!\n",
dev->core->name);
list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) {
err = drv->remove(drv);
if (err == 0) {
list_del(&drv->drvlist);
} else
printk(KERN_ERR "%s/2: cx8802 driver remove "
"failed (%d)\n", dev->core->name, err);
kfree(drv);
}
}
mutex_unlock(&dev->core->lock);
/* Destroy any 8802 reference. */
dev->core->dvbdev = NULL;
/* common */
cx8802_fini_common(dev);
cx88_core_put(dev->core,dev->pci);
vb2_dma_sg_cleanup_ctx(dev->alloc_ctx);
kfree(dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
steven toth | steven toth | 83 | 43.68% | 1 | 12.50% |
trent piepho | trent piepho | 74 | 38.95% | 3 | 37.50% |
jonathan nieder | jonathan nieder | 20 | 10.53% | 1 | 12.50% |
hans verkuil | hans verkuil | 7 | 3.68% | 1 | 12.50% |
tejun heo | tejun heo | 5 | 2.63% | 1 | 12.50% |
harvey harrison | harvey harrison | 1 | 0.53% | 1 | 12.50% |
| Total | 190 | 100.00% | 8 | 100.00% |
static const struct pci_device_id cx8802_pci_tbl[] = {
{
.vendor = 0x14f1,
.device = 0x8802,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},{
/* --- end of list --- */
}
};
MODULE_DEVICE_TABLE(pci, cx8802_pci_tbl);
static struct pci_driver cx8802_pci_driver = {
.name = "cx88-mpeg driver manager",
.id_table = cx8802_pci_tbl,
.probe = cx8802_probe,
.remove = cx8802_remove,
};
module_pci_driver(cx8802_pci_driver);
EXPORT_SYMBOL(cx8802_buf_prepare);
EXPORT_SYMBOL(cx8802_buf_queue);
EXPORT_SYMBOL(cx8802_cancel_buffers);
EXPORT_SYMBOL(cx8802_start_dma);
EXPORT_SYMBOL(cx8802_register_driver);
EXPORT_SYMBOL(cx8802_unregister_driver);
EXPORT_SYMBOL(cx8802_get_driver);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
gerd knorr | gerd knorr | 1611 | 40.48% | 2 | 2.82% |
steven toth | steven toth | 1139 | 28.62% | 6 | 8.45% |
mauro carvalho chehab | mauro carvalho chehab | 308 | 7.74% | 11 | 15.49% |
hans verkuil | hans verkuil | 197 | 4.95% | 6 | 8.45% |
trent piepho | trent piepho | 162 | 4.07% | 8 | 11.27% |
jonathan nieder | jonathan nieder | 117 | 2.94% | 3 | 4.23% |
markus rechberger | markus rechberger | 117 | 2.94% | 2 | 2.82% |
istvan varga | istvan varga | 58 | 1.46% | 1 | 1.41% |
devin heitmueller | devin heitmueller | 38 | 0.95% | 1 | 1.41% |
michael krufky | michael krufky | 38 | 0.95% | 3 | 4.23% |
tejun heo | tejun heo | 33 | 0.83% | 3 | 4.23% |
roland stoll | roland stoll | 27 | 0.68% | 1 | 1.41% |
sohail syyed | sohail syyed | 22 | 0.55% | 1 | 1.41% |
alexey khoroshilov | alexey khoroshilov | 20 | 0.50% | 1 | 1.41% |
junghak sung | junghak sung | 11 | 0.28% | 1 | 1.41% |
dirk herrendoerfer | dirk herrendoerfer | 11 | 0.28% | 1 | 1.41% |
catalin climov | catalin climov | 8 | 0.20% | 1 | 1.41% |
christoph hellwig | christoph hellwig | 7 | 0.18% | 2 | 2.82% |
greg kroah-hartman | greg kroah-hartman | 6 | 0.15% | 1 | 1.41% |
harvey harrison | harvey harrison | 6 | 0.15% | 1 | 1.41% |
adrian bunk | adrian bunk | 6 | 0.15% | 2 | 2.82% |
thomas gleixner | thomas gleixner | 5 | 0.13% | 2 | 2.82% |
bjorn mork | bjorn mork | 5 | 0.13% | 1 | 1.41% |
ricardo cerqueira | ricardo cerqueira | 5 | 0.13% | 1 | 1.41% |
yang hongyang | yang hongyang | 4 | 0.10% | 1 | 1.41% |
darron broad | darron broad | 3 | 0.08% | 1 | 1.41% |
jelle foks | jelle foks | 3 | 0.08% | 2 | 2.82% |
rusty scott | rusty scott | 3 | 0.08% | 1 | 1.41% |
christian engelmayer | christian engelmayer | 3 | 0.08% | 1 | 1.41% |
andrew morton | andrew morton | 3 | 0.08% | 1 | 1.41% |
lawrence rust | lawrence rust | 2 | 0.05% | 1 | 1.41% |
sachin kamat | sachin kamat | 2 | 0.05% | 1 | 1.41% |
| Total | 3980 | 100.00% | 71 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.